[FFmpeg-devel] [PATCH] libvpxdec: explicitly signal RGB.

James Zern jzern at google.com
Thu Sep 3 19:51:56 CEST 2015


On Thu, Sep 3, 2015 at 6:38 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> ---
>  libavcodec/libvpxdec.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>

lgtm

> diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
> index 52a89ca..eb05f26 100644
> --- a/libavcodec/libvpxdec.c
> +++ b/libavcodec/libvpxdec.c
> @@ -90,7 +90,12 @@ static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
>  #endif
>      case VPX_IMG_FMT_I444:
>          avctx->profile = FF_PROFILE_VP9_1;
> +#if VPX_IMAGE_ABI_VERSION >= 3
> +        avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
> +                         AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
> +#else
>          avctx->pix_fmt = AV_PIX_FMT_YUV444P;
> +#endif
>          return 0;
>  #ifdef VPX_IMG_FMT_HIGHBITDEPTH
>      case VPX_IMG_FMT_I42016:
> @@ -107,10 +112,20 @@ static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img)
>      case VPX_IMG_FMT_I42216:
>          avctx->profile = FF_PROFILE_VP9_3;
>          if (img->bit_depth == 10) {
> +#if VPX_IMAGE_ABI_VERSION >= 3
> +            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
> +                             AV_PIX_FMT_GBRP10LE : AV_PIX_FMT_YUV422P10LE;

Note the native decoder uses the unadorned values, we should probably
harmonize them unless the native one will reorder the channels --
whose order is undefined (except by you) [1].
There's at least one other colorspace related question that hasn't
been addressed either [2]. RGB shouldn't have been added with so
little thought, it seems like it's headed in the direction of the
colorspace bit in vp8.

[1] https://groups.google.com/a/webmproject.org/d/msg/codec-devel/bc_Fla47jbc/jXiqUn42To0J
[2] https://groups.google.com/a/webmproject.org/d/msg/webm-discuss/UjDHEG0iQGA/NI3cezeEAQAJ

> +#else
>              avctx->pix_fmt = AV_PIX_FMT_YUV422P10LE;
> +#endif
>              return 0;
>          } else if (img->bit_depth == 12) {
> +#if VPX_IMAGE_ABI_VERSION >= 3
> +            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
> +                             AV_PIX_FMT_GBRP12LE : AV_PIX_FMT_YUV422P12LE;
> +#else
>              avctx->pix_fmt = AV_PIX_FMT_YUV422P12LE;
> +#endif
>              return 0;
>          } else {
>              return AVERROR_INVALIDDATA;
> --
> 2.1.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list