[FFmpeg-devel] [PATCH v1] avcodec/av1dec: check if hwaccel is specificed

Soft Works softworkz at hotmail.com
Fri Aug 27 19:48:37 EEST 2021



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Fei
> Wang
> Sent: Friday, 27 August 2021 13:54
> To: ffmpeg-devel at ffmpeg.org
> Cc: Fei Wang <fei.w.wang at intel.com>
> Subject: [FFmpeg-devel] [PATCH v1] avcodec/av1dec: check if hwaccel
> is specificed
> 
> Since av1 decoder is only available for hw acceleration. This will
> gives out more accurate information if this decoder used but doesn't
> specificed a hwaccel.
> 
> For example:
> ffmpeg -c:v av1 -i INPUT OUTPUT
> 
> Signed-off-by: Fei Wang <fei.w.wang at intel.com>
> ---
> 1. This is improvement of patch for:
> https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=4660
> 
>  libavcodec/av1dec.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> index a69808f7b6..58a9deeb4e 100644
> --- a/libavcodec/av1dec.c
> +++ b/libavcodec/av1dec.c
> @@ -452,15 +452,22 @@ static int get_pixel_format(AVCodecContext
> *avctx)
>      *fmtp++ = s->pix_fmt;
>      *fmtp = AV_PIX_FMT_NONE;
> 
> -    ret = ff_thread_get_format(avctx, pix_fmts);
> -    if (ret < 0)
> -        return ret;
> -
>      /**
> -     * check if the HW accel is inited correctly. If not, return un-
> implemented.
> +     * check if the HW accel is specificed. If not, return un-
> implemented.
>       * Since now the av1 decoder doesn't support native decode, if
> it will be
>       * implemented in the future, need remove this check.
>       */
> +    if (!avctx->hw_device_ctx) {
> +        av_log(avctx, AV_LOG_ERROR, "The AV1 decoder requires a hw
> acceleration"
> +	       " to be specified.\n");
> +        return AVERROR(ENOSYS);
> +    }
> +
> +    ret = ff_thread_get_format(avctx, pix_fmts);
> +    if (ret < 0)
> +        return ret;
> +
> +    /** check if the HW accel is inited correctly by the specificed
> setting */
>      if (!avctx->hwaccel) {
>          av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport"
>                 " hardware accelerated AV1 decoding.\n");
> --

LGTM.


More information about the ffmpeg-devel mailing list