[FFmpeg-devel] [PATCH 10/26] vaapi_encode: Choose profiles dynamically

Mark Thompson sw at jkqxz.net
Thu Apr 26 01:23:14 EEST 2018


On 25/04/18 09:43, Xiang, Haihao wrote:>> Previously there was one fixed choice for each codec (e.g. H.265 -> Main
>> profile), and using anything else then required an explicit option from
>> the user.  This changes to selecting the profile based on the input format
>> and the set of profiles actually supported by the driver (e.g. P010 input
>> will choose Main 10 profile for H.265 if the driver supports it).
>>
>> The entrypoint and render target format are also chosen dynamically in the
>> same way, removing those explicit selections from the per-codec code.
>> ---
>>  doc/encoders.texi               |   3 +
>>  libavcodec/vaapi_encode.c       | 261 +++++++++++++++++++++++++++++++------
>> ---
>>  libavcodec/vaapi_encode.h       |  41 +++++--
>>  libavcodec/vaapi_encode_h264.c  |  45 ++-----
>>  libavcodec/vaapi_encode_h265.c  |  43 +++----
>>  libavcodec/vaapi_encode_mjpeg.c |  13 +-
>>  libavcodec/vaapi_encode_mpeg2.c |  36 ++----
>>  libavcodec/vaapi_encode_vp8.c   |  11 +-
>>  libavcodec/vaapi_encode_vp9.c   |  34 ++----
>>  9 files changed, 306 insertions(+), 181 deletions(-)
>>
>> ...
>> diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
>> index 5529ee5a03..e01bdcf6b4 100644
>> --- a/libavcodec/vaapi_encode_h265.c
>> +++ b/libavcodec/vaapi_encode_h265.c
>> @@ -875,7 +875,25 @@ static av_cold int
>> vaapi_encode_h265_configure(AVCodecContext *avctx)
>>      return 0;
>>  }
>>  
>> +static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {
>> +    { FF_PROFILE_HEVC_MAIN,     8, 1, 1, VAProfileHEVCMain       },
>> +#if VA_CHECK_VERSION(0, 37, 0)
>> +    { FF_PROFILE_HEVC_MAIN_10, 10, 1, 1, VAProfileHEVCMain10     },
>> +#endif
>> +#if VA_CHECK_VERSION(1, 2, 0)
>> +    { FF_PROFILE_HEVC_REXT,    12, 1, 1, VAProfileHEVCMain12     },
>> +    { FF_PROFILE_HEVC_REXT,    10, 1, 0, VAProfileHEVCMain422_10 },
>> +    { FF_PROFILE_HEVC_REXT,    12, 1, 0, VAProfileHEVCMain422_12 },
>> +    { FF_PROFILE_HEVC_REXT,     8, 0, 0, VAProfileHEVCMain444    },
>> +    { FF_PROFILE_HEVC_REXT,    10, 0, 0, VAProfileHEVCMain444_10 },
>> +    { FF_PROFILE_HEVC_REXT,    12, 0, 0, VAProfileHEVCMain444_12 },
>> +#endif
> 
> VA API 1.2 is not released yet, currently only structures for decoding are added
> . It would be better to include the above profiles in a separate patch in the
> future. 

That's fair, removed for now.  (They couldn't be chosen anyway, but not having them at all is more sensible.)

Thanks,

- Mark


More information about the ffmpeg-devel mailing list