[FFmpeg-devel] [PATCH] lavc/vaap_encode_h265: Init the refs with predefined value.

Mark Thompson sw at jkqxz.net
Thu Dec 7 02:29:05 EET 2017


On 06/12/17 21:32, Mark Thompson wrote:
> On 06/12/17 08:20, Jun Zhao wrote:
>> From 7519718216a2b98eb289ba20ba27685dff1cf686 Mon Sep 17 00:00:00 2001
>> From: Jun Zhao <jun.zhao at intel.com>
>> Date: Wed, 6 Dec 2017 15:50:05 +0800
>> Subject: [PATCH] lavc/vaap_encode_h265: Init the refs with predefined value.
>>
>> Give a explicit init value to ref0/ref1 list to avoid use default value
>> assgined by compiler, in iHD driver, it's will lead to HEVC ENC crash.
>> h264_vaapi encoder use this way too.
>>
>> Signed-off-by: Jun Zhao <jun.zhao at intel.com>
>> ---
>>  libavcodec/vaapi_encode_h265.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
>> index 2fc94be632..db9a7163cc 100644
>> --- a/libavcodec/vaapi_encode_h265.c
>> +++ b/libavcodec/vaapi_encode_h265.c
>> @@ -757,6 +757,12 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx,
>>      else
>>          sh->slice_qp_delta = priv->fixed_qp_idr - (pps->init_qp_minus26 + 26);
>>  
>> +    for (i = 0; i < FF_ARRAY_ELEMS(vslice->ref_pic_list0); i++) {
>> +        vslice->ref_pic_list0[i].picture_id = VA_INVALID_ID;
>> +        vslice->ref_pic_list0[i].flags      = VA_PICTURE_HEVC_INVALID;
>> +        vslice->ref_pic_list1[i].picture_id = VA_INVALID_ID;
>> +        vslice->ref_pic_list1[i].flags      = VA_PICTURE_HEVC_INVALID;
>> +    }
>>  
>>      *vslice = (VAEncSliceParameterBufferHEVC) {
>>          .slice_segment_address = sh->slice_segment_address,
>> -- 
>> 2.14.1
>>
> 
> 
> Um, this doesn't appear to do anything?
> 
> I haven't tried the new driver release yet, but I intend to soon.

Well, I had a look.  Default build fails because of <https://github.com/intel/media-driver/issues/4>, but with that hacked around it does work for me on Skylake.

I made <https://github.com/intel/media-driver/pull/14> to add support for the MEM_TYPE_VA so that surface creation in ffmpeg can work without hacks.  With that, decode works for H.26[45] and VC-1, though VP8 hangs the GPU pretty much immediately (didn't investigate further).

For the surface attribute query stuff, I think it would probably be best just to implement it in the driver rather than adding further hacks to ffmpeg?  With the open-source version being released I don't think there is any reason for anyone to use the old binary-only form of it with VAAPI any more, so we might as well fix it properly.

Thanks,

- Mark


More information about the ffmpeg-devel mailing list