Message ID | 20221025182834.3925004-1-jzern@google.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] avcodec/libaomdec: fix pix_fmt w/AVCOL_SPC_RGB | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
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
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/
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/
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 {
Signed-off-by: James Zern <jzern@google.com> --- libavcodec/libaomdec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)