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 <ceffm...@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) {
+                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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to