[FFmpeg-devel] [PATCH v3 9/9] avcodec/av1_vaapi: improve decode quality
Fei Wang
fei.w.wang at intel.com
Mon Jul 5 11:26:43 EEST 2021
- quantizer delta and matrix level specific.
- support loop filter delta.
- support use superres.
Signed-off-by: Fei Wang <fei.w.wang at intel.com>
---
libavcodec/vaapi_av1.c | 67 ++++++++++++++++++++++++++----------------
1 file changed, 41 insertions(+), 26 deletions(-)
diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index 6aaabed2c1..2d0f0a76ad 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -75,26 +75,35 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
memset(&pic_param, 0, sizeof(VADecPictureParameterBufferAV1));
pic_param = (VADecPictureParameterBufferAV1) {
- .profile = seq->seq_profile,
- .order_hint_bits_minus_1 = seq->order_hint_bits_minus_1,
- .bit_depth_idx = bit_depth_idx,
- .current_frame = pic->output_surface,
- .current_display_picture = apply_grain ? ff_vaapi_get_surface_id(s->cur_frame.tf_display.f) : pic->output_surface,
- .frame_width_minus1 = frame_header->frame_width_minus_1,
- .frame_height_minus1 = frame_header->frame_height_minus_1,
- .primary_ref_frame = frame_header->primary_ref_frame,
- .order_hint = frame_header->order_hint,
- .tile_cols = frame_header->tile_cols,
- .tile_rows = frame_header->tile_rows,
- .context_update_tile_id = frame_header->context_update_tile_id,
- .interp_filter = frame_header->interpolation_filter,
- .filter_level[0] = frame_header->loop_filter_level[0],
- .filter_level[1] = frame_header->loop_filter_level[1],
- .filter_level_u = frame_header->loop_filter_level[2],
- .filter_level_v = frame_header->loop_filter_level[3],
- .base_qindex = frame_header->base_q_idx,
- .cdef_damping_minus_3 = frame_header->cdef_damping_minus_3,
- .cdef_bits = frame_header->cdef_bits,
+ .profile = seq->seq_profile,
+ .order_hint_bits_minus_1 = seq->order_hint_bits_minus_1,
+ .bit_depth_idx = bit_depth_idx,
+ .matrix_coefficients = seq->color_config.matrix_coefficients,
+ .current_frame = pic->output_surface,
+ .current_display_picture = apply_grain ? ff_vaapi_get_surface_id(s->cur_frame.tf_display.f) : pic->output_surface,
+ .frame_width_minus1 = frame_header->frame_width_minus_1,
+ .frame_height_minus1 = frame_header->frame_height_minus_1,
+ .primary_ref_frame = frame_header->primary_ref_frame,
+ .order_hint = frame_header->order_hint,
+ .tile_cols = frame_header->tile_cols,
+ .tile_rows = frame_header->tile_rows,
+ .context_update_tile_id = frame_header->context_update_tile_id,
+ .superres_scale_denominator = frame_header->use_superres ?
+ frame_header->coded_denom + AV1_SUPERRES_DENOM_MIN :
+ AV1_SUPERRES_NUM,
+ .interp_filter = frame_header->interpolation_filter,
+ .filter_level[0] = frame_header->loop_filter_level[0],
+ .filter_level[1] = frame_header->loop_filter_level[1],
+ .filter_level_u = frame_header->loop_filter_level[2],
+ .filter_level_v = frame_header->loop_filter_level[3],
+ .base_qindex = frame_header->base_q_idx,
+ .y_dc_delta_q = frame_header->delta_q_y_dc,
+ .u_dc_delta_q = frame_header->delta_q_u_dc,
+ .u_ac_delta_q = frame_header->delta_q_u_ac,
+ .v_dc_delta_q = frame_header->delta_q_v_dc,
+ .v_ac_delta_q = frame_header->delta_q_v_ac,
+ .cdef_damping_minus_3 = frame_header->cdef_damping_minus_3,
+ .cdef_bits = frame_header->cdef_bits,
.seq_info_fields.fields = {
.still_picture = seq->still_picture,
.use_128x128_superblock = seq->use_128x128_superblock,
@@ -165,12 +174,15 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
.mode_ref_delta_update = frame_header->loop_filter_delta_update,
},
.mode_control_fields.bits = {
- .delta_q_present_flag = frame_header->delta_q_present,
- .log2_delta_q_res = frame_header->delta_q_res,
- .tx_mode = frame_header->tx_mode,
- .reference_select = frame_header->reference_select,
- .reduced_tx_set_used = frame_header->reduced_tx_set,
- .skip_mode_present = frame_header->skip_mode_present,
+ .delta_q_present_flag = frame_header->delta_q_present,
+ .log2_delta_q_res = frame_header->delta_q_res,
+ .delta_lf_present_flag = frame_header->delta_lf_present,
+ .log2_delta_lf_res = frame_header->delta_lf_res,
+ .delta_lf_multi = frame_header->delta_lf_multi,
+ .tx_mode = frame_header->tx_mode,
+ .reference_select = frame_header->reference_select,
+ .reduced_tx_set_used = frame_header->reduced_tx_set,
+ .skip_mode_present = frame_header->skip_mode_present,
},
.loop_restoration_fields.bits = {
.yframe_restoration_type = remap_lr_type[frame_header->lr_type[0]],
@@ -181,6 +193,9 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx,
},
.qmatrix_fields.bits = {
.using_qmatrix = frame_header->using_qmatrix,
+ .qm_y = frame_header->qm_y,
+ .qm_u = frame_header->qm_u,
+ .qm_v = frame_header->qm_v,
}
};
--
2.17.1
More information about the ffmpeg-devel
mailing list