On Wed, Mar 22, 2017 at 10:43 AM, Hendrik Leppkes <h.lepp...@gmail.com> wrote:
> On Wed, Mar 22, 2017 at 10:41 AM, Steve Lhomme <rob...@gmail.com> wrote:
>> ---
>>  libavcodec/hevcdec.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
>> index e24ce1e3c..3b8fadff3 100644
>> --- a/libavcodec/hevcdec.c
>> +++ b/libavcodec/hevcdec.c
>> @@ -381,6 +381,14 @@ static void export_stream_params(AVCodecContext *avctx, 
>> const HEVCParamSets *ps,
>>                    num, den, 1 << 30);
>>  }
>>
>> +#if CONFIG_HEVC_DXVA2_HWACCEL || CONFIG_HEVC_D3D11VA_HWACCEL
>> ++static void add_dxva_constraints(AVCodecContext *avctx)
>> +{
>> +    avctx->coded_width  = FFALIGN(avctx->coded_width,  128);
>> +    avctx->coded_height = FFALIGN(avctx->coded_height, 128);
>> +}
>> +#endif
>> +
>>  static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)
>>  {
>>      #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + 
>> CONFIG_HEVC_D3D11VA_HWACCEL + \
>> @@ -391,9 +399,11 @@ static enum AVPixelFormat get_format(HEVCContext *s, 
>> const HEVCSPS *sps)
>>          sps->pix_fmt == AV_PIX_FMT_YUV420P10) {
>>  #if CONFIG_HEVC_D3D11VA_HWACCEL
>>          *fmt++ = AV_PIX_FMT_D3D11VA_VLD;
>> +        add_dxva_constraints(s->avctx);
>>  #endif
>>  #if CONFIG_HEVC_DXVA2_HWACCEL
>>          *fmt++ = AV_PIX_FMT_DXVA2_VLD;
>> +        add_dxva_constraints(s->avctx);
>>  #endif
>>  #if CONFIG_HEVC_VAAPI_HWACCEL
>>          *fmt++ = AV_PIX_FMT_VAAPI;
>
> I don't think shoving more hwaccel specific logic into the codec
> themself is the best approach to follow here.

Where else should it be ?
Are we supposed to not trust coded_width/coded_height when we have to
allocate buffers ?

> Also, this isn't actually a "constraint" as such, but a
> recommendation/suggestion in the spec to avoid the need to re-allocate
> surfaces should the coded size increase due to coding tool changes in
> future segments.
>
> - Hendrik
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to