[Mesa-dev] [PATCH] radeon/vcn: use enc profile instead of pic profile

Boyuan Zhang boyzhang at amd.com
Fri Mar 2 16:34:12 UTC 2018



On 2018-02-28 08:44 AM, Leo Liu wrote:
> Boyuan, please also make sure whether this patch along with other one 
> are needed to Cc stable or not.
>
> Regards,
> Leo

Thanks. I double checked the 18.0 and 17.3 branch, the previous hevc 
encode related patch sets are not in there yet. So seems we don't need 
to Cc stable for these patches.

Regards,
Boyuan

>
> On 02/28/2018 03:03 AM, Christian König wrote:
>> Am 28.02.2018 um 00:56 schrieb boyuan.zhang at amd.com:
>>> From: Boyuan Zhang <boyuan.zhang at amd.com>
>>>
>>> Picture profile might not be set in some cases. Therefore, better to 
>>> use
>>> the profile stored in encoder base.
>>>
>>> Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
>>
>> NAK, when the picture profile isn't set the picture structure isn't 
>> valid.
>>
>> Please fix the case where we forget to set the picture->profile instead.
>>
>> Christian.
>>
>>> ---
>>>   src/gallium/drivers/radeon/radeon_vcn_enc.c     |  4 ++--
>>>   src/gallium/drivers/radeon/radeon_vcn_enc_1_2.c | 16 ++++++++--------
>>>   2 files changed, 10 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/src/gallium/drivers/radeon/radeon_vcn_enc.c 
>>> b/src/gallium/drivers/radeon/radeon_vcn_enc.c
>>> index 388a333..dcc25f2 100644
>>> --- a/src/gallium/drivers/radeon/radeon_vcn_enc.c
>>> +++ b/src/gallium/drivers/radeon/radeon_vcn_enc.c
>>> @@ -40,7 +40,7 @@
>>>     static void radeon_vcn_enc_get_param(struct radeon_encoder *enc, 
>>> struct pipe_picture_desc *picture)
>>>   {
>>> -   if (u_reduce_video_profile(picture->profile) == 
>>> PIPE_VIDEO_FORMAT_MPEG4_AVC) {
>>> +   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;
>>>         enc->enc_pic.picture_type = pic->picture_type;
>>>         enc->enc_pic.frame_num = pic->frame_num;
>>> @@ -54,7 +54,7 @@ static void radeon_vcn_enc_get_param(struct 
>>> radeon_encoder *enc, struct pipe_pic
>>>         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;
>>> -   } else if (u_reduce_video_profile(picture->profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>> +   } else if (u_reduce_video_profile(enc->base.profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>>         struct pipe_h265_enc_picture_desc *pic = (struct 
>>> pipe_h265_enc_picture_desc *)picture;
>>>         enc->enc_pic.picture_type = pic->picture_type;
>>>         enc->enc_pic.frame_num = pic->frame_num;
>>> diff --git a/src/gallium/drivers/radeon/radeon_vcn_enc_1_2.c 
>>> b/src/gallium/drivers/radeon/radeon_vcn_enc_1_2.c
>>> index 07493d8..9adf40f 100644
>>> --- a/src/gallium/drivers/radeon/radeon_vcn_enc_1_2.c
>>> +++ b/src/gallium/drivers/radeon/radeon_vcn_enc_1_2.c
>>> @@ -341,7 +341,7 @@ static void radeon_enc_spec_misc_hevc(struct 
>>> radeon_encoder *enc, struct pipe_pi
>>>     static void radeon_enc_rc_session_init(struct radeon_encoder 
>>> *enc, struct pipe_picture_desc *picture)
>>>   {
>>> -    if (u_reduce_video_profile(picture->profile) == 
>>> PIPE_VIDEO_FORMAT_MPEG4_AVC) {
>>> +    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;
>>>           enc->enc_pic.rc_session_init.vbv_buffer_level = 
>>> pic->rate_ctrl.vbv_buf_lv;
>>>           switch(pic->rate_ctrl.rate_ctrl_method) {
>>> @@ -359,7 +359,7 @@ static void radeon_enc_rc_session_init(struct 
>>> radeon_encoder *enc, struct pipe_p
>>>               default:
>>> enc->enc_pic.rc_session_init.rate_control_method = 
>>> RENCODE_RATE_CONTROL_METHOD_NONE;
>>>           }
>>> -    } else if (u_reduce_video_profile(picture->profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>> +    } else if (u_reduce_video_profile(enc->base.profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>>           struct pipe_h265_enc_picture_desc *pic = (struct 
>>> pipe_h265_enc_picture_desc *)picture;
>>>           enc->enc_pic.rc_session_init.vbv_buffer_level = 
>>> pic->rc.vbv_buf_lv;
>>>           switch(pic->rc.rate_ctrl_method) {
>>> @@ -387,7 +387,7 @@ static void radeon_enc_rc_session_init(struct 
>>> radeon_encoder *enc, struct pipe_p
>>>     static void radeon_enc_rc_layer_init(struct radeon_encoder *enc, 
>>> struct pipe_picture_desc *picture)
>>>   {
>>> -    if (u_reduce_video_profile(picture->profile) == 
>>> PIPE_VIDEO_FORMAT_MPEG4_AVC) {
>>> +    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;
>>>           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;
>>> @@ -397,7 +397,7 @@ static void radeon_enc_rc_layer_init(struct 
>>> radeon_encoder *enc, struct pipe_pic
>>> enc->enc_pic.rc_layer_init.avg_target_bits_per_picture = 
>>> pic->rate_ctrl.target_bits_picture;
>>> enc->enc_pic.rc_layer_init.peak_bits_per_picture_integer = 
>>> pic->rate_ctrl.peak_bits_picture_integer;
>>> enc->enc_pic.rc_layer_init.peak_bits_per_picture_fractional = 
>>> pic->rate_ctrl.peak_bits_picture_fraction;
>>> -    } else if (u_reduce_video_profile(picture->profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>> +    } else if (u_reduce_video_profile(enc->base.profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>>           struct pipe_h265_enc_picture_desc *pic = (struct 
>>> pipe_h265_enc_picture_desc *)picture;
>>>           enc->enc_pic.rc_layer_init.target_bit_rate = 
>>> pic->rc.target_bitrate;
>>>           enc->enc_pic.rc_layer_init.peak_bit_rate = 
>>> pic->rc.peak_bitrate;
>>> @@ -1113,7 +1113,7 @@ static void radeon_enc_intra_refresh(struct 
>>> radeon_encoder *enc)
>>>     static void radeon_enc_rc_per_pic(struct radeon_encoder *enc, 
>>> struct pipe_picture_desc *picture)
>>>   {
>>> -    if (u_reduce_video_profile(picture->profile) == 
>>> PIPE_VIDEO_FORMAT_MPEG4_AVC) {
>>> +    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;
>>>           enc->enc_pic.rc_per_pic.qp = pic->quant_i_frames;
>>>           enc->enc_pic.rc_per_pic.min_qp_app = 0;
>>> @@ -1122,7 +1122,7 @@ static void radeon_enc_rc_per_pic(struct 
>>> radeon_encoder *enc, struct pipe_pictur
>>>           enc->enc_pic.rc_per_pic.enabled_filler_data = 
>>> pic->rate_ctrl.fill_data_enable;
>>>           enc->enc_pic.rc_per_pic.skip_frame_enable = false;
>>>           enc->enc_pic.rc_per_pic.enforce_hrd = 
>>> pic->rate_ctrl.enforce_hrd;
>>> -    } else if (u_reduce_video_profile(picture->profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>> +    } else if (u_reduce_video_profile(enc->base.profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>>           struct pipe_h265_enc_picture_desc *pic = (struct 
>>> pipe_h265_enc_picture_desc *)picture;
>>>           enc->enc_pic.rc_per_pic.qp = pic->rc.quant_i_frames;
>>>           enc->enc_pic.rc_per_pic.min_qp_app = 0;
>>> @@ -1292,12 +1292,12 @@ static void begin(struct radeon_encoder 
>>> *enc, struct pipe_picture_desc *pic)
>>>       radeon_enc_task_info(enc, enc->need_feedback);
>>>       radeon_enc_op_init(enc);
>>>   -    if (u_reduce_video_profile(pic->profile) == 
>>> PIPE_VIDEO_FORMAT_MPEG4_AVC) {
>>> +    if (u_reduce_video_profile(enc->base.profile) == 
>>> PIPE_VIDEO_FORMAT_MPEG4_AVC) {
>>>           radeon_enc_session_init(enc);
>>>           radeon_enc_slice_control(enc);
>>>           radeon_enc_spec_misc(enc);
>>>           radeon_enc_deblocking_filter_h264(enc);
>>> -    } else if (u_reduce_video_profile(pic->profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>> +    } else if (u_reduce_video_profile(enc->base.profile) == 
>>> PIPE_VIDEO_FORMAT_HEVC) {
>>>           radeon_enc_session_init_hevc(enc);
>>>           radeon_enc_slice_control_hevc(enc);
>>>           radeon_enc_spec_misc_hevc(enc, pic);
>>
>



More information about the mesa-dev mailing list