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
427 int bit_depth; // RefBitDepth427 int bit_depth; // RefBitDepth
428 int order_hint; // RefOrderHint428 int order_hint; // RefOrderHint
429 429
430 int saved_order_hints[AV1_TOTAL_REFS_PER_FRAME]; // SavedOrderHints[ref]
431
430 int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME];432 int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME];
431 int8_t loop_filter_mode_deltas[2];433 int8_t loop_filter_mode_deltas[2];
432 uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];434 uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
@@ -464,6 +466,9 @@ typedef struct CodedBitstreamAV1Context { · 31 unmodified lines
464 int tile_rows;466 int tile_rows;
465 int tile_num;467 int tile_num;
466 468
469 int order_hints[AV1_TOTAL_REFS_PER_FRAME]; // OrderHints
470 int ref_frame_sign_bias[AV1_TOTAL_REFS_PER_FRAME]; // RefFrameSignBias
471
467 AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES];472 AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES];
468 473
469 // AVOptions474 // 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
1414 priv->ref[i].valid = 0;1414 priv->ref[i].valid = 0;
1415 priv->ref[i].order_hint = 0;1415 priv->ref[i].order_hint = 0;
1416 }1416 }
1417 for (i = 0; i < AV1_REFS_PER_FRAME; i++)
1418 priv->order_hints[i + AV1_REF_FRAME_LAST] = 0;
1417 }1419 }
1418 1420
1419 flag(disable_cdf_update);1421 flag(disable_cdf_update);
@@ -1568,11 +1570,20 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, · 148 unmodified lines
1568 else1570 else
1569 flag(use_ref_frame_mvs);1571 flag(use_ref_frame_mvs);
1570 1572
1571 infer(allow_intrabc, 0);1573 for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
1572 }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 }
1573 1585
1574 if (!frame_is_intra) {1586 infer(allow_intrabc, 0);
1575 // Derive reference frame sign biases.
1576 }1587 }
1577 1588
1578 if (seq->reduced_still_picture_header || current->disable_cdf_update)1589 if (seq->reduced_still_picture_header || current->disable_cdf_update)
@@ -1674,6 +1685,12 @@ update_refs: · 95 unmodified lines
1674 .bit_depth = priv->bit_depth,1685 .bit_depth = priv->bit_depth,
1675 .order_hint = priv->order_hint,1686 .order_hint = priv->order_hint,
1676 };1687 };
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
1677 memcpy(priv->ref[i].loop_filter_ref_deltas, current->loop_filter_ref_deltas,1694 memcpy(priv->ref[i].loop_filter_ref_deltas, current->loop_filter_ref_deltas,
1678 sizeof(current->loop_filter_ref_deltas));1695 sizeof(current->loop_filter_ref_deltas));
1679 memcpy(priv->ref[i].loop_filter_mode_deltas, current->loop_filter_mode_deltas,1696 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