[FFmpeg-devel] [PATCH] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB

Vignesh Venkatasubramanian vigneshv at google.com
Tue Oct 25 23:57:43 EEST 2022


On Tue, Oct 25, 2022 at 11:28 AM James Zern
<jzern-at-google.com at ffmpeg.org> wrote:
>
> Signed-off-by: James Zern <jzern at google.com>
> ---
>  libavcodec/libaomdec.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
> index 378d638a89..53982559d9 100644
> --- a/libavcodec/libaomdec.c
> +++ b/libavcodec/libaomdec.c
> @@ -113,15 +113,19 @@ 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;
> +            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
> +                             AV_PIX_FMT_GBRP : 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;
> +            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
> +                             AV_PIX_FMT_GBRP10 : 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;
> +            avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
> +                             AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
>              avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
>              return 0;
>          } else {
> --
> 2.38.0.135.g90850a2211-goog
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

lgtm.

I can confirm that AV1 files with gbrp pixel format play back properly
with ffplay with this patch (without this patch it does not look
right).


--
Vignesh


More information about the ffmpeg-devel mailing list