Mesa (staging/20.2): radeon/vce: Bitrate not updated when changing framerate

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 25 18:12:28 UTC 2020


Module: Mesa
Branch: staging/20.2
Commit: 10c2cddf5601c53b0b8970704c27c539d1d4fb97
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=10c2cddf5601c53b0b8970704c27c539d1d4fb97

Author: Krunal Patel <krunalkumarmukeshkumar.patel at amd.corp-partner.google.com>
Date:   Fri Nov 20 01:23:46 2020 +0530

radeon/vce: Bitrate not updated when changing framerate

Issue: Encoding parameters not updated after changing FrameRate

Root Cause:
In rvce_begin_frame, need_rate_control was enabled if the target_bitrate,
quant_i_frames, quant_p_frames, quant_b_frames or rate_ctrl_method
changes. Due to this the rate_control() 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 need_rate_control. Eventually updating the
encoder parameters with new framerate and bitrate.

Signed-off-by: Krunal Patel <krunalkumarmukeshkumar.patel at amd.corp-partner.google.com>
Reviewed-by: Leo Liu <leo.liu at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7696>
(cherry picked from commit 35613c752f5826dcc5bbfbfb8e6ab0ab3127b7d3)

---

 src/gallium/drivers/radeon/radeon_vce.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce.c b/src/gallium/drivers/radeon/radeon_vce.c
index 416240b6d1e..c972bb55931 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -265,7 +265,9 @@ static void rvce_begin_frame(struct pipe_video_codec *encoder, struct pipe_video
       enc->pic.quant_i_frames != pic->quant_i_frames ||
       enc->pic.quant_p_frames != pic->quant_p_frames ||
       enc->pic.quant_b_frames != pic->quant_b_frames ||
-      enc->pic.rate_ctrl.target_bitrate != pic->rate_ctrl.target_bitrate;
+      enc->pic.rate_ctrl.target_bitrate != pic->rate_ctrl.target_bitrate ||
+      enc->pic.rate_ctrl.frame_rate_num != pic->rate_ctrl.frame_rate_num ||
+      enc->pic.rate_ctrl.frame_rate_den != pic->rate_ctrl.frame_rate_den;
 
    enc->pic = *pic;
    enc->si_get_pic_param(enc, pic);



More information about the mesa-commit mailing list