[FFmpeg-devel] [PATCH 2/2] avcodec/vaapi_encode_h265: use is_reference to fill reference_pic_flag

Wu, Tong1 tong1.wu at intel.com
Tue Mar 5 10:06:59 EET 2024


>Subject: Re: [FFmpeg-devel] [PATCH 2/2] avcodec/vaapi_encode_h265: use
>is_reference to fill reference_pic_flag
>
>On Di, 2024-02-27 at 11:48 +0800, tong1.wu-at-intel.com at ffmpeg.org wrote:
>> From: Tong Wu <tong1.wu at intel.com>
>>
>> This codec supports FLAG_B_PICTURE_REFERENCES. We need to fill
>> reference_pic_flag with pic->is_reference.
>>
>> Signed-off-by: Tong Wu <tong1.wu at intel.com>
>> ---
>>  libavcodec/vaapi_encode_h265.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavcodec/vaapi_encode_h265.c
>b/libavcodec/vaapi_encode_h265.c
>> index c4aabbf5ed..b5d3468152 100644
>> --- a/libavcodec/vaapi_encode_h265.c
>> +++ b/libavcodec/vaapi_encode_h265.c
>> @@ -949,22 +949,22 @@ static int
>> vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
>>      case PICTURE_TYPE_IDR:
>>          vpic->pic_fields.bits.idr_pic_flag       = 1;
>>          vpic->pic_fields.bits.coding_type        = 1;
>> -        vpic->pic_fields.bits.reference_pic_flag = 1;
>> +        vpic->pic_fields.bits.reference_pic_flag = pic->is_reference;
>>          break;
>>      case PICTURE_TYPE_I:
>>          vpic->pic_fields.bits.idr_pic_flag       = 0;
>>          vpic->pic_fields.bits.coding_type        = 1;
>> -        vpic->pic_fields.bits.reference_pic_flag = 1;
>> +        vpic->pic_fields.bits.reference_pic_flag = pic->is_reference;
>>          break;
>>      case PICTURE_TYPE_P:
>>          vpic->pic_fields.bits.idr_pic_flag       = 0;
>>          vpic->pic_fields.bits.coding_type        = 2;
>> -        vpic->pic_fields.bits.reference_pic_flag = 1;
>> +        vpic->pic_fields.bits.reference_pic_flag = pic->is_reference;
>>          break;
>>      case PICTURE_TYPE_B:
>>          vpic->pic_fields.bits.idr_pic_flag       = 0;
>>          vpic->pic_fields.bits.coding_type        = 3;
>> -        vpic->pic_fields.bits.reference_pic_flag = 0;
>> +        vpic->pic_fields.bits.reference_pic_flag = pic->is_reference;
>
>Better to move the assignment out of the switch statement.

Sorry I misunderstood. Please see patch V3.

>
>Thanks
>Haihao
>
>>          break;
>>      default:
>>          av_assert0(0 && "invalid picture type");



More information about the ffmpeg-devel mailing list