On Wed, 22 Mar 2017 10:41:13 +0100
Steve Lhomme <[email protected]> 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;

Seems a bit fragile to do it this way. Might be better to wait for
glorious future hwaccel improvements.

We'll probably have an API that returns required surface format,
minimum surface number, and surface dimensions in a specific case. Then
decoder and hwaccel code would be cleanly separated.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to