From fb0f51bc642be3d7d96fa0a582185e46f2649f37 Mon Sep 17 00:00:00 2001 From: Ruijing Dong Date: Wed, 13 Sep 2023 15:03:17 -0400 Subject: [PATCH] radeonsi/vcn: change max_poc to fixed value for hevc encoder. problem: max_poc means the number of bits used in poc lsb in slice header, and it should not be related to GOP size. When large GOP size used, it could generate corrupted video, as the POC could not be correctly decoded. solution: use fixed value of max_poc (16) for now. Cc: mesa-stable Reviewed-by: Boyuan Zhang Signed-off-by: Ruijing Dong Part-of: --- src/gallium/drivers/radeonsi/radeon_vcn_enc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_enc.c b/src/gallium/drivers/radeonsi/radeon_vcn_enc.c index 17cfcdc5365..4c06adf8b29 100644 --- a/src/gallium/drivers/radeonsi/radeon_vcn_enc.c +++ b/src/gallium/drivers/radeonsi/radeon_vcn_enc.c @@ -459,7 +459,6 @@ static void radeon_vcn_enc_hevc_get_param(struct radeon_encoder *enc, enc->enc_pic.picture_type = pic->picture_type; enc->enc_pic.frame_num = pic->frame_num; radeon_vcn_enc_quality_modes(enc, &pic->quality_modes); - enc->enc_pic.pic_order_cnt = pic->pic_order_cnt; enc->enc_pic.pic_order_cnt_type = pic->pic_order_cnt_type; enc->enc_pic.ref_idx_l0 = pic->ref_idx_l0_list[0]; enc->enc_pic.ref_idx_l1 = pic->ref_idx_l1_list[0]; @@ -469,12 +468,11 @@ static void radeon_vcn_enc_hevc_get_param(struct radeon_encoder *enc, enc->enc_pic.general_tier_flag = pic->seq.general_tier_flag; enc->enc_pic.general_profile_idc = pic->seq.general_profile_idc; enc->enc_pic.general_level_idc = pic->seq.general_level_idc; - enc->enc_pic.max_poc = MAX2(16, util_next_power_of_two(pic->seq.intra_period)); - enc->enc_pic.log2_max_poc = 0; + /* use fixed value for max_poc until new feature added */ + enc->enc_pic.max_poc = 16; + enc->enc_pic.log2_max_poc = 4; enc->enc_pic.num_temporal_layers = 1; - for (int i = enc->enc_pic.max_poc; i != 0; enc->enc_pic.log2_max_poc++) - i = (i >> 1); - + enc->enc_pic.pic_order_cnt = pic->pic_order_cnt % enc->enc_pic.max_poc; enc->enc_pic.chroma_format_idc = pic->seq.chroma_format_idc; enc->enc_pic.pic_width_in_luma_samples = pic->seq.pic_width_in_luma_samples; enc->enc_pic.pic_height_in_luma_samples = pic->seq.pic_height_in_luma_samples;