[FFmpeg-devel] [PATCH]lavc/x264:Refuse RGB24 as input pix_fmt

Michael Niedermayer michaelni at gmx.at
Tue Jun 9 12:39:26 CEST 2015


On Tue, Jun 09, 2015 at 12:35:01PM +0200, Michael Niedermayer wrote:
> On Tue, Jun 09, 2015 at 08:45:00AM +0200, Carl Eugen Hoyos wrote:
> > Hi!
> > 
> > Attached patch works around ticket #4287 here.
> > 
> > Please comment, Carl Eugen
> 
> >  libx264.c |    1 -
> >  1 file changed, 1 deletion(-)
> > 8dba04c188ee8737c913c8161587c454f008e8da  patchx264rgb.diff
> > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> > index 9020a40..5736c6c 100644
> > --- a/libavcodec/libx264.c
> > +++ b/libavcodec/libx264.c
> > @@ -755,7 +755,6 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
> >  #ifdef X264_CSP_BGR
> >      AV_PIX_FMT_BGR0,
> >      AV_PIX_FMT_BGR24,
> > -    AV_PIX_FMT_RGB24,
> >  #endif
> 
> this does not workaround it
> the following uses BGR24 but still shows the issue with git master
> that is without the patch above and the same testcase
> 
> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> index 9020a40..85f8b54 100644
> --- a/libavcodec/libx264.c
> +++ b/libavcodec/libx264.c
> @@ -350,10 +350,10 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt)
>      case AV_PIX_FMT_BGR0:
>          return X264_CSP_BGRA;
>      case AV_PIX_FMT_BGR24:
> -        return X264_CSP_BGR;
> +        return X264_CSP_RGB;
> 
>      case AV_PIX_FMT_RGB24:
> -        return X264_CSP_RGB;
> +        return X264_CSP_BGR;
>  #endif
>      case AV_PIX_FMT_NV12:      return X264_CSP_NV12;
>      case AV_PIX_FMT_NV16:

it also still happens if you hack the raw decoder to claim its output
is BGR24 instead of RGB24.
the issue is with exactly the data and x264 encoding RGB24 or BGR24
behave the same


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150609/cb03802e/attachment.asc>


More information about the ffmpeg-devel mailing list