From 663aa8744b743c53089128b4ff3b6a6f394d5654 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: (cherry picked from commit fb0f51bc642be3d7d96fa0a582185e46f2649f37) --- .pick_status.json | 2 +- src/gallium/drivers/radeonsi/radeon_vcn_enc.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 96481bd63ea..4a94e9d0032 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1471,7 +1471,7 @@ "description": "radeonsi/vcn: change max_poc to fixed value for hevc encoder.", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_enc.c b/src/gallium/drivers/radeonsi/radeon_vcn_enc.c index 80c4eb396aa..2ce8fdc5bb3 100644 --- a/src/gallium/drivers/radeonsi/radeon_vcn_enc.c +++ b/src/gallium/drivers/radeonsi/radeon_vcn_enc.c @@ -437,7 +437,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]; @@ -447,12 +446,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;