[FFmpeg-devel] [PATCH v3] lavc/aomdec: Allow RGB decoding

James Zern jzern at google.com
Tue Jun 8 22:23:43 EEST 2021


On Sat, Jun 5, 2021 at 10:16 PM Valerii Zapodovnikov
<val.zapod.vz at gmail.com> wrote:
>
> Yes, RGB is signalled by Identity matrix if and only if XYZ is not
> in transfer. XYZ primaries are just normal primaries that can be
> used for normal RGB, no problem, so I do not check for them.
> No need to test for sRGB primaries (that is AVCOL_PRI_BT709), as
> ffplay does not know what that is (is not color managed), but mpv
> will do that automatically. This will also support other transfers
> like DCI-P3 / DCI-D65 one, et cetera. See libvpxdec.c.
> Also the default AV1 decoder is libdav1d, which is not affected.
> For XYZ support someone should add correct pixel format in the code.
>
> Signed-off-by: Valerii Zapodovnikov <val.zapod.vz at gmail.com>
> ---
>  libavcodec/libaomdec.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
> index 6e7324a832..156e644263 100644
> --- a/libavcodec/libaomdec.c
> +++ b/libavcodec/libaomdec.c
> @@ -134,15 +134,27 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
>      case AOM_IMG_FMT_I444:
>      case AOM_IMG_FMT_I44416:
>          if (img->bit_depth == 8) {
> -            avctx->pix_fmt = AV_PIX_FMT_YUV444P;
> +            if (avctx->colorspace == AVCOL_SPC_RGB && avctx->color_trc != AVCOL_TRC_SMPTE428) {

This doesn't match the check in libdav1d.c. I think you should be able
to get the same information here.


More information about the ffmpeg-devel mailing list