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

James Almer jamrial at gmail.com
Sun Oct 11 20:51:21 EEST 2020


On 10/11/2020 2:27 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #8929 for me.
> 
> Please comment, Carl Eugen

> From 580477c4b0e07fa5436474ae732596bed5faf2d4 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
> Date: Sun, 11 Oct 2020 19:25:10 +0200
> Subject: [PATCH] lavc/aomdec: Allow RGB decoding.
> 
> Fixes ticket #8929.
> ---
>  libavcodec/libaomdec.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
> index 1430a651fe..f83c11ddf8 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->color_trc == AVCOL_TRC_IEC61966_2_1) {

AV1 signals RGB with the combination of AVCOL_SPC_RGB, AVCOL_PRI_BT709
and AVCOL_TRC_IEC61966_2_1, not just the latter alone.

Should be good with that change.

> +                avctx->pix_fmt = AV_PIX_FMT_GBRP;
> +            } else {
> +                avctx->pix_fmt = AV_PIX_FMT_YUV444P;
> +            }
>              avctx->profile = FF_PROFILE_AV1_HIGH;
>              return 0;
>          } else if (img->bit_depth == 10) {
> -            avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
> +            if (avctx->color_trc == AVCOL_TRC_IEC61966_2_1) {
> +                avctx->pix_fmt = AV_PIX_FMT_GBRP10;
> +            } else {
> +                avctx->pix_fmt = AV_PIX_FMT_YUV444P10;
> +            }
>              avctx->profile = FF_PROFILE_AV1_HIGH;
>              return 0;
>          } else if (img->bit_depth == 12) {
> -            avctx->pix_fmt = AV_PIX_FMT_YUV444P12;
> +            if (avctx->color_trc == AVCOL_TRC_IEC61966_2_1) {
> +                avctx->pix_fmt = AV_PIX_FMT_GBRP12;
> +            } else {
> +                avctx->pix_fmt = AV_PIX_FMT_YUV444P12;
> +            }
>              avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
>              return 0;
>          } else {
> -- 
> 2.24.1
> 


More information about the ffmpeg-devel mailing list