summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrunal Patel <krunalkumarmukeshkumar.patel@amd.corp-partner.google.com>2020-10-29 14:48:16 +0530
committerMarge Bot <eric+marge@anholt.net>2020-11-09 14:57:50 +0000
commit4143572f93ecf8a4c20d02b42d14adc275b235c0 (patch)
treea319bb30fd87ed68d6cabdecc51c24e9de7de307
parent25066eb20a23c023ed7cdeb99f7fed25c0294289 (diff)
radeon/vcn: Bitrate not updated when changing framerate
Issue: Encoding parameters not updated after changing FrameRate Root Cause: In radeon_enc_begin_frame, there is a parameter need_rate_control which was enabled only if the bitrate is changed. Due to this the radeon_enc_rc_layer_init was not updating the encoder parameters with new framerate, peak_bits_per_picture_integer and avg_target_bits_per_picture Fix: Added the condition where we will check if there is a change in other parameters and enable rate control. Eventually updating the encoder parameters with new framerate and bitrate. Signed-off-by: Krunal Patel <krunalkumarmukeshkumar.patel@amd.corp-partner.google.com> Reviewed-by: Boyuan Zhang boyuan.zhang@amd.com Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7363>
-rw-r--r--src/gallium/drivers/radeon/radeon_vcn_enc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeon/radeon_vcn_enc.c b/src/gallium/drivers/radeon/radeon_vcn_enc.c
index d21e9eedf18..ede9fb82146 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_enc.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_enc.c
@@ -280,7 +280,9 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
if (u_reduce_video_profile(enc->base.profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC) {
struct pipe_h264_enc_picture_desc *pic = (struct pipe_h264_enc_picture_desc *)picture;
need_rate_control =
- enc->enc_pic.rc_layer_init.target_bit_rate != pic->rate_ctrl.target_bitrate;
+ (enc->enc_pic.rc_layer_init.target_bit_rate != pic->rate_ctrl.target_bitrate) ||
+ (enc->enc_pic.rc_layer_init.frame_rate_num != pic->rate_ctrl.frame_rate_num) ||
+ (enc->enc_pic.rc_layer_init.frame_rate_den != pic->rate_ctrl.frame_rate_den);
} else if (u_reduce_video_profile(picture->profile) == PIPE_VIDEO_FORMAT_HEVC) {
struct pipe_h265_enc_picture_desc *pic = (struct pipe_h265_enc_picture_desc *)picture;
need_rate_control = enc->enc_pic.rc_layer_init.target_bit_rate != pic->rc.target_bitrate;