avcodec/av1_vaapi: improve decode quality

- quantizer delta and matrix level specific.
- support loop filter delta.
- support use superres.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
This commit is contained in:
Fei Wang 2021-10-12 16:24:04 +08:00 committed by James Almer
parent dc94f2eaaf
commit 84c73102d9
1 changed files with 41 additions and 27 deletions

View File

@ -147,27 +147,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 = pic->output_surface,
.current_display_picture = vaapi_av1_surface_id(&s->cur_frame),
.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 = vaapi_av1_surface_id(&s->cur_frame),
.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,
@ -238,12 +246,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]],
@ -254,6 +265,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,
}
};