[FFmpeg-devel] [PATCH v3 5/6] lavc/qsvdec: Add mjpeg decoder support

Mark Thompson sw at jkqxz.net
Sun Mar 17 16:51:30 EET 2019


On 08/03/2019 07:40, Zhong Li wrote:
> Signed-off-by: Zhong Li <zhong.li at intel.com>
> ---
>  Changelog                 |  1 +
>  configure                 |  1 +
>  libavcodec/Makefile       |  1 +
>  libavcodec/allcodecs.c    |  1 +
>  libavcodec/qsvdec_other.c | 28 +++++++++++++++++++++++++++-
>  5 files changed, 31 insertions(+), 1 deletion(-)
> ...
> diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
> index a6f1b88ca0..b0dc559d70 100644
> --- a/libavcodec/qsvdec_other.c
> +++ b/libavcodec/qsvdec_other.c
> @@ -1,5 +1,5 @@
>  /*
> - * Intel MediaSDK QSV based MPEG-2, VC-1 and VP8 decoders
> + * Intel MediaSDK QSV based MPEG-2, VC-1, VP8 and MJPEG decoders
>   *
>   * copyright (c) 2015 Anton Khirnov
>   *
> @@ -256,3 +256,29 @@ AVCodec ff_vp8_qsv_decoder = {
>      .wrapper_name   = "qsv",
>  };
>  #endif
> +
> +#if CONFIG_MJPEG_QSV_DECODER
> +static const AVClass mjpeg_qsv_class = {
> +    .class_name = "mjpeg_qsv",
> +    .item_name  = av_default_item_name,
> +    .option     = options,
> +    .version    = LIBAVUTIL_VERSION_INT,
> +};
> +
> +AVCodec ff_mjpeg_qsv_decoder = {
> +    .name           = "mjpeg_qsv",
> +    .long_name      = NULL_IF_CONFIG_SMALL("MJPEG video (Intel Quick Sync Video acceleration)"),
> +    .priv_data_size = sizeof(QSVOtherContext),
> +    .type           = AVMEDIA_TYPE_VIDEO,
> +    .id             = AV_CODEC_ID_MJPEG,
> +    .init           = qsv_decode_init,
> +    .decode         = qsv_decode_frame,
> +    .flush          = qsv_decode_flush,
> +    .close          = qsv_decode_close,
> +    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING,
> +    .priv_class     = &mjpeg_qsv_class,
> +    .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,

This seems suspicious - MJPEG is generally 4:2:2 (e.g. UVC requires it), so I would expect a 4:2:2 format to be the default here?  (Or maybe a longer list - VAAPI certainly supports 4:2:2, 4:2:0 and 4:4:4 on the same hardware.)

> +                                                    AV_PIX_FMT_QSV,
> +                                                    AV_PIX_FMT_NONE },
> +};
> +#endif
> 

I think you need to deal more carefully with profile information, too.  Presumably the hardware decoder doesn't support any non-Huffman modes, and probably not all of those?

- Mark


More information about the ffmpeg-devel mailing list