[FFmpeg-devel] [PATCH] lavc/libx264: support AV_CODEC_CAP_ENCODER_RECON_FRAME

Anton Khirnov anton at khirnov.net
Mon Jul 18 21:15:33 EEST 2022


Quoting James Almer (2022-07-18 14:23:58)
> On 7/18/2022 4:12 AM, Anton Khirnov wrote:
> > ---
> >   libavcodec/libx264.c | 52 +++++++++++++++++++++++++++++++++++++++++++-
> >   1 file changed, 51 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> > index 98ec030865..5e360682e6 100644
> > --- a/libavcodec/libx264.c
> > +++ b/libavcodec/libx264.c
> > @@ -311,6 +311,25 @@ static void free_picture(AVCodecContext *ctx)
> >       pic->extra_sei.num_payloads = 0;
> >   }
> >   
> > +static enum AVPixelFormat csp_to_pixfmt(int csp)
> > +{
> > +    switch (csp) {
> > +#ifdef X264_CSP_I400
> > +    case X264_CSP_I400:                         return AV_PIX_FMT_GRAY8;
> > +    case X264_CSP_I400 | X264_CSP_HIGH_DEPTH:   return AV_PIX_FMT_GRAY10;
> > +#endif
> > +    case X264_CSP_I420:                         return AV_PIX_FMT_YUV420P;
> > +    case X264_CSP_I420 | X264_CSP_HIGH_DEPTH:   return AV_PIX_FMT_YUV420P10;
> > +    case X264_CSP_I422:                         return AV_PIX_FMT_YUV422P;
> > +    case X264_CSP_I422 | X264_CSP_HIGH_DEPTH:   return AV_PIX_FMT_YUV422P10;
> > +    case X264_CSP_I444:                         return AV_PIX_FMT_YUV444P;
> > +    case X264_CSP_I444 | X264_CSP_HIGH_DEPTH:   return AV_PIX_FMT_YUV444P10;
> 
> We're still supporting old x264 versions, so you should add some 
> considerations for 9 bit pixfmts. On X264_BUILD < 153, just check the 
> value of x264_bit_depth.

Is there much point in continuing to support 5.5 year old x264? We could
drop a lot of ugliness, including the abominable X264_init_static().

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list