[FFmpeg-devel] lavc/libx264: enable the PC(2^n -1) colorspace in libx264rgb

Submitted by Jun Zhao on Nov. 27, 2019, 9:52 a.m.

Details

Message ID 1574848349-25318-1-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao Nov. 27, 2019, 9:52 a.m.
From: Jun Zhao <barryjzhao@tencent.com>

enable the PC(2^n -1) colorspace in libx264rgb

fix #8404

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavcodec/libx264.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Carl Eugen Hoyos Nov. 27, 2019, 10:03 a.m.
> Am 27.11.2019 um 10:52 schrieb Jun Zhao <mypopydev@gmail.com>:
> 
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> enable the PC(2^n -1) colorspace in libx264rgb
> 
> fix #8404
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
> libavcodec/libx264.c |    5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> index bfd91bb..60607ca 100644
> --- a/libavcodec/libx264.c
> +++ b/libavcodec/libx264.c
> @@ -867,6 +867,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
>     x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
>                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
>                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||

> +#if CONFIG_LIBX264RGB_ENCODER

The #if looks unneeded...

> +                                 avctx->pix_fmt == AV_PIX_FMT_BGR0 ||
> +                                 avctx->pix_fmt == AV_PIX_FMT_BGR24 ||
> +                                 avctx->pix_fmt == AV_PIX_FMT_RGB24 ||

... but why don’t you check for the actually used encoder instead?

Also, you may have to check that the range wasn’t explicitly set to mpeg.

> +#endif
>                                  avctx->color_range == AVCOL_RANGE_JPEG;

Carl Eugen
mypopy@gmail.com Nov. 27, 2019, 11:51 a.m.
On Wed, Nov 27, 2019 at 6:58 PM Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
>
>
> > Am 27.11.2019 um 10:52 schrieb Jun Zhao <mypopydev@gmail.com>:
> >
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > enable the PC(2^n -1) colorspace in libx264rgb
> >
> > fix #8404
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> > libavcodec/libx264.c |    5 +++++
> > 1 files changed, 5 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> > index bfd91bb..60607ca 100644
> > --- a/libavcodec/libx264.c
> > +++ b/libavcodec/libx264.c
> > @@ -867,6 +867,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
> >     x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
> >                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
> >                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
>
> > +#if CONFIG_LIBX264RGB_ENCODER
>
> The #if looks unneeded...

I perfer to keep the #if like another part for libx264rgb warpper
>
>
> > +                                 avctx->pix_fmt == AV_PIX_FMT_BGR0 ||
> > +                                 avctx->pix_fmt == AV_PIX_FMT_BGR24 ||
> > +                                 avctx->pix_fmt == AV_PIX_FMT_RGB24 ||
>
> ... but why don’t you check for the actually used encoder instead?

I don't know is it good idear to check  the actually used encoder in
the encoder warpper
>
>
> Also, you may have to check that the range wasn’t explicitly set to mpeg.

Will add the range check, tks
>
>
> > +#endif
> >                                  avctx->color_range == AVCOL_RANGE_JPEG;
>

Patch hide | download patch | download mbox

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index bfd91bb..60607ca 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -867,6 +867,11 @@  FF_ENABLE_DEPRECATION_WARNINGS
     x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
+#if CONFIG_LIBX264RGB_ENCODER
+                                 avctx->pix_fmt == AV_PIX_FMT_BGR0 ||
+                                 avctx->pix_fmt == AV_PIX_FMT_BGR24 ||
+                                 avctx->pix_fmt == AV_PIX_FMT_RGB24 ||
+#endif
                                  avctx->color_range == AVCOL_RANGE_JPEG;
 
     if (avctx->colorspace != AVCOL_SPC_UNSPECIFIED)