cbs_av1: Copy loop filter and segment parameters of repeat frame from its mapped frame

Implement load/save loop filter and segment parameters defined in
section 7.20 and 7.21 in spec for show_existing_frame frames.

Fixes ticket #11151.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
This commit is contained in:
Fei Wang 2024-08-26 16:34:10 +08:00
parent a87a96105e
commit ae9cf903e8
2 changed files with 33 additions and 8 deletions

View File

@ -477,6 +477,11 @@ typedef struct CodedBitstreamAV1Context {
// Writing will fail with an error if an OBU larger than can be // Writing will fail with an error if an OBU larger than can be
// represented by the fixed size is encountered. // represented by the fixed size is encountered.
int fixed_obu_size_length; int fixed_obu_size_length;
int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME];
int8_t loop_filter_mode_deltas[2];
uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
int16_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
} CodedBitstreamAV1Context; } CodedBitstreamAV1Context;

View File

@ -1374,6 +1374,15 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw,
priv->render_height = ref->render_height; priv->render_height = ref->render_height;
priv->bit_depth = ref->bit_depth; priv->bit_depth = ref->bit_depth;
priv->order_hint = ref->order_hint; priv->order_hint = ref->order_hint;
memcpy(priv->loop_filter_ref_deltas, ref->loop_filter_ref_deltas,
sizeof(ref->loop_filter_ref_deltas));
memcpy(priv->loop_filter_mode_deltas, ref->loop_filter_mode_deltas,
sizeof(ref->loop_filter_mode_deltas));
memcpy(priv->feature_enabled, ref->feature_enabled,
sizeof(ref->feature_enabled));
memcpy(priv->feature_value, ref->feature_value,
sizeof(ref->feature_value));
} else } else
infer(refresh_frame_flags, 0); infer(refresh_frame_flags, 0);
@ -1691,14 +1700,25 @@ update_refs:
priv->order_hints[j + AV1_REF_FRAME_LAST]; priv->order_hints[j + AV1_REF_FRAME_LAST];
} }
memcpy(priv->ref[i].loop_filter_ref_deltas, current->loop_filter_ref_deltas, if (current->show_existing_frame) {
sizeof(current->loop_filter_ref_deltas)); memcpy(priv->ref[i].loop_filter_ref_deltas, priv->loop_filter_ref_deltas,
memcpy(priv->ref[i].loop_filter_mode_deltas, current->loop_filter_mode_deltas, sizeof(priv->loop_filter_ref_deltas));
sizeof(current->loop_filter_mode_deltas)); memcpy(priv->ref[i].loop_filter_mode_deltas, priv->loop_filter_mode_deltas,
memcpy(priv->ref[i].feature_enabled, current->feature_enabled, sizeof(priv->loop_filter_mode_deltas));
sizeof(current->feature_enabled)); memcpy(priv->ref[i].feature_enabled, priv->feature_enabled,
memcpy(priv->ref[i].feature_value, current->feature_value, sizeof(priv->feature_enabled));
sizeof(current->feature_value)); memcpy(priv->ref[i].feature_value, priv->feature_value,
sizeof(priv->feature_value));
} else {
memcpy(priv->ref[i].loop_filter_ref_deltas, current->loop_filter_ref_deltas,
sizeof(current->loop_filter_ref_deltas));
memcpy(priv->ref[i].loop_filter_mode_deltas, current->loop_filter_mode_deltas,
sizeof(current->loop_filter_mode_deltas));
memcpy(priv->ref[i].feature_enabled, current->feature_enabled,
sizeof(current->feature_enabled));
memcpy(priv->ref[i].feature_value, current->feature_value,
sizeof(current->feature_value));
}
} }
} }