Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB
@ 2022-10-25 18:28 James Zern
  2022-10-25 20:57 ` Vignesh Venkatasubramanian
  2022-10-26  5:02 ` James Zern
  0 siblings, 2 replies; 4+ messages in thread
From: James Zern @ 2022-10-25 18:28 UTC (permalink / raw)
  To: ffmpeg-devel

Signed-off-by: James Zern <jzern@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@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB
  2022-10-25 18:28 [FFmpeg-devel] [PATCH] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB James Zern
@ 2022-10-25 20:57 ` Vignesh Venkatasubramanian
  2022-10-26  5:02 ` James Zern
  1 sibling, 0 replies; 4+ messages in thread
From: Vignesh Venkatasubramanian @ 2022-10-25 20:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Tue, Oct 25, 2022 at 11:28 AM James Zern
<jzern-at-google.com@ffmpeg.org> wrote:
>
> Signed-off-by: James Zern <jzern@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@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@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
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB
  2022-10-25 18:28 [FFmpeg-devel] [PATCH] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB James Zern
  2022-10-25 20:57 ` Vignesh Venkatasubramanian
@ 2022-10-26  5:02 ` James Zern
  2022-10-31 17:24   ` James Zern
  1 sibling, 1 reply; 4+ messages in thread
From: James Zern @ 2022-10-26  5:02 UTC (permalink / raw)
  To: ffmpeg-devel

On Tue, Oct 25, 2022 at 11:28 AM James Zern <jzern@google.com> wrote:
>
> Signed-off-by: James Zern <jzern@google.com>
> ---
>  libavcodec/libaomdec.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>

I was reminded that there was an earlier patch [1], which I had an
open comment on. I think it's better to be consistent with the
libdav1d wrapper and ffvp9/libvpx for now.

[1] https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210606051612.89211-1-val.zapod.vz@gmail.com/
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB
  2022-10-26  5:02 ` James Zern
@ 2022-10-31 17:24   ` James Zern
  0 siblings, 0 replies; 4+ messages in thread
From: James Zern @ 2022-10-31 17:24 UTC (permalink / raw)
  To: ffmpeg-devel

On Tue, Oct 25, 2022 at 10:02 PM James Zern <jzern@google.com> wrote:
>
> On Tue, Oct 25, 2022 at 11:28 AM James Zern <jzern@google.com> wrote:
> >
> > Signed-off-by: James Zern <jzern@google.com>
> > ---
> >  libavcodec/libaomdec.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
>
> I was reminded that there was an earlier patch [1], which I had an
> open comment on. I think it's better to be consistent with the
> libdav1d wrapper and ffvp9/libvpx for now.
>

I pushed this. Any other fixes should try to keep both wrappers in sync.

> [1] https://patchwork.ffmpeg.org/project/ffmpeg/patch/20210606051612.89211-1-val.zapod.vz@gmail.com/
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-31 17:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 18:28 [FFmpeg-devel] [PATCH] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB James Zern
2022-10-25 20:57 ` Vignesh Venkatasubramanian
2022-10-26  5:02 ` James Zern
2022-10-31 17:24   ` James Zern

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git