History

lavc/cbs_av1: Save more frame ordering information

This is wanted by the Vulkan decoder.

Mark Thompson committed 2 years ago

Commit cafb4c51 parent f1e34f12 files · +26 −4Browse files

Unified · Split

2 files
  1. libavcodec/cbs_av1.h +5 −0
  2. libavcodec/cbs_av1_syntax_template.c +21 −4
libavcodec/cbs_av1.h+5−0
@@ -427,6 +427,8 @@ typedef struct AV1ReferenceFrameState { · 426 unmodified lines
427427 int bit_depth; // RefBitDepth
428428 int order_hint; // RefOrderHint
429429
430+ int saved_order_hints[AV1_TOTAL_REFS_PER_FRAME]; // SavedOrderHints[ref]
431+
430432 int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME];
431433 int8_t loop_filter_mode_deltas[2];
432434 uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
@@ -464,6 +466,9 @@ typedef struct CodedBitstreamAV1Context { · 31 unmodified lines
464466 int tile_rows;
465467 int tile_num;
466468
469+ int order_hints[AV1_TOTAL_REFS_PER_FRAME]; // OrderHints
470+ int ref_frame_sign_bias[AV1_TOTAL_REFS_PER_FRAME]; // RefFrameSignBias
471+
467472 AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES];
468473
469474 // AVOptions
libavcodec/cbs_av1_syntax_template.c+21−4
@@ -1414,6 +1414,8 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, · 1413 unmodified lines
14141414 priv->ref[i].valid = 0;
14151415 priv->ref[i].order_hint = 0;
14161416 }
1417+ for (i = 0; i < AV1_REFS_PER_FRAME; i++)
1418+ priv->order_hints[i + AV1_REF_FRAME_LAST] = 0;
14171419 }
14181420
14191421 flag(disable_cdf_update);
@@ -1568,11 +1570,20 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, · 148 unmodified lines
15681570 else
15691571 flag(use_ref_frame_mvs);
15701572
1571− infer(allow_intrabc, 0);
1572− }
1573+ for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
1574+ int ref_frame = AV1_REF_FRAME_LAST + i;
1575+ int hint = priv->ref[current->ref_frame_idx[i]].order_hint;
1576+ priv->order_hints[ref_frame] = hint;
1577+ if (!seq->enable_order_hint) {
1578+ priv->ref_frame_sign_bias[ref_frame] = 0;
1579+ } else {
1580+ priv->ref_frame_sign_bias[ref_frame] =
1581+ cbs_av1_get_relative_dist(seq, hint,
1582+ current->order_hint) > 0;
1583+ }
1584+ }
15731585
1574− if (!frame_is_intra) {
1575− // Derive reference frame sign biases.
1586+ infer(allow_intrabc, 0);
15761587 }
15771588
15781589 if (seq->reduced_still_picture_header || current->disable_cdf_update)
@@ -1674,6 +1685,12 @@ update_refs: · 95 unmodified lines
16741685 .bit_depth = priv->bit_depth,
16751686 .order_hint = priv->order_hint,
16761687 };
1688+
1689+ for (int j = 0; j < AV1_REFS_PER_FRAME; j++) {
1690+ priv->ref[i].saved_order_hints[j + AV1_REF_FRAME_LAST] =
1691+ priv->order_hints[j + AV1_REF_FRAME_LAST];
1692+ }
1693+
16771694 memcpy(priv->ref[i].loop_filter_ref_deltas, current->loop_filter_ref_deltas,
16781695 sizeof(current->loop_filter_ref_deltas));
16791696 memcpy(priv->ref[i].loop_filter_mode_deltas, current->loop_filter_mode_deltas,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t