Mesa (master): radeon/vcn: Handle crop parameters for encoder

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 9 16:12:58 UTC 2020


Module: Mesa
Branch: master
Commit: 4e3a09db25c6609eeeb710f3863fc67914d2edc1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e3a09db25c6609eeeb710f3863fc67914d2edc1

Author: Satyajit Sahu <satyajit.sahu at amd.com>
Date:   Tue Dec 24 11:38:25 2019 +0530

radeon/vcn: Handle crop parameters for encoder

Set proper cropping parameter if frame cropping is enabled

Signed-off-by: Satyajit Sahu <satyajit.sahu at amd.com>
Reviewed-by: Boyuan Zhang boyuan.zhang at amd.com
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3328>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3328>

---

 src/gallium/drivers/radeon/radeon_vcn_enc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vcn_enc.c b/src/gallium/drivers/radeon/radeon_vcn_enc.c
index aa9182f273b..0bcce867327 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_enc.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_enc.c
@@ -52,10 +52,17 @@ static void radeon_vcn_enc_get_param(struct radeon_encoder *enc, struct pipe_pic
       enc->enc_pic.ref_idx_l1 = pic->ref_idx_l1;
       enc->enc_pic.not_referenced = pic->not_referenced;
       enc->enc_pic.is_idr = (pic->picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR);
-      enc->enc_pic.crop_left = 0;
-      enc->enc_pic.crop_right = (align(enc->base.width, 16) - enc->base.width) / 2;
-      enc->enc_pic.crop_top = 0;
-      enc->enc_pic.crop_bottom = (align(enc->base.height, 16) - enc->base.height) / 2;
+      if (pic->pic_ctrl.enc_frame_cropping_flag) {
+          enc->enc_pic.crop_left = pic->pic_ctrl.enc_frame_crop_left_offset;
+          enc->enc_pic.crop_right = pic->pic_ctrl.enc_frame_crop_right_offset;
+          enc->enc_pic.crop_top = pic->pic_ctrl.enc_frame_crop_top_offset;
+          enc->enc_pic.crop_bottom = pic->pic_ctrl.enc_frame_crop_bottom_offset;
+      } else {
+          enc->enc_pic.crop_left = 0;
+          enc->enc_pic.crop_right = (align(enc->base.width, 16) - enc->base.width) / 2;
+          enc->enc_pic.crop_top = 0;
+          enc->enc_pic.crop_bottom = (align(enc->base.height, 16) - enc->base.height) / 2;
+      }
       enc->enc_pic.rc_layer_init.target_bit_rate = pic->rate_ctrl.target_bitrate;
       enc->enc_pic.rc_layer_init.peak_bit_rate = pic->rate_ctrl.peak_bitrate;
       enc->enc_pic.rc_layer_init.frame_rate_num = pic->rate_ctrl.frame_rate_num;




More information about the mesa-commit mailing list