Re: [libav-devel] [PATCH] x264: Support version 155
On 26/12/2017 12:33, Luca Barbato wrote: It has native 8 and 10 bit support. --- libavcodec/libx264.c | 30 ++ 1 file changed, 30 insertions(+) Before I forgot, I'd fold it on 12 (and possibly even 11). lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 26/12/2017 13:54, James Almer wrote: Wouldn't using av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth here as well be cleaner? The two values must be the same and I prefer to use the shorter expression. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 26/12/2017 22:34, James Almer wrote: On 12/26/2017 11:39 AM, Luca Barbato wrote: On 26/12/2017 13:54, James Almer wrote: You can still build libx264 with support for only 8 and 10 bits after this multibitdepth change, so ideally you'd still check for what's available based on X264_BIT_DEPTH and use the new enum array if it's 0. I have a patch doing this but was waiting for some feedback elsewhere before sending it. I decided to not go that way so if somebody changes the 8-only library with the 10-only library or the hydra he wouldn't have to rebuild Libav. Asking for an unsupported pixel format gets you an error message anyway. ./avconv -filter_complex testsrc -pix_fmt yuv422p10 -c:v libx264 /tmp/out.mkv avconv version v13_dev0-1426-g8436a9e03f, Copyright (c) 2000-2017 the Libav developers built on Dec 26 2017 15:37:04 with Apple LLVM version 9.0.0 (clang-900.0.39.2) File '/tmp/out.mkv' already exists. Overwrite ? [y/N] y Stream mapping: (null) -> Stream #0:0 (libx264) Press ctrl-c to stop encoding x264 [error]: not compiled with 10 bit depth support lu Alright. Just change the X264_BUILD to 153 (the version where this was introduced) instead of 155 and it should be good. Updated locally, thank you! lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 12/26/2017 10:10 AM, Nicolas George wrote: > James Almer (2017-12-26): >>> +#if X264_BUILD >= 155 >>> +if (x4->params.i_bitdepth > 8) >>> +#else > >> Wouldn't using av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth here >> as well be cleaner? > > avctx->pix_fmt tells us what libavcodec wants; x4->params.i_bitdepth > tells us what x264 proposes; they are not necessarily the same thing. x4->params.i_bitdepth is set by libavcodec based on the value of avctx->pix_fmt at the time AVCodec.init() is called, so it should be the same. Unless avctx->pix_fmt can change mid encoding, in which case things would just not work anyway. > > You may want to check the similar change you made on FFmpeg. > > Regards, > > > > ___ > libav-devel mailing list > libav-devel@libav.org > https://lists.libav.org/mailman/listinfo/libav-devel > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 12/26/2017 11:39 AM, Luca Barbato wrote: > On 26/12/2017 13:54, James Almer wrote: >> You can still build libx264 with support for only 8 and 10 bits after >> this multibitdepth change, so ideally you'd still check for what's >> available based on X264_BIT_DEPTH and use the new enum array if it's 0. >> >> I have a patch doing this but was waiting for some feedback elsewhere >> before sending it. > > I decided to not go that way so if somebody changes the 8-only library > with the 10-only library or the hydra he wouldn't have to rebuild Libav. > > Asking for an unsupported pixel format gets you an error message anyway. > > ./avconv -filter_complex testsrc -pix_fmt yuv422p10 -c:v libx264 > /tmp/out.mkv > avconv version v13_dev0-1426-g8436a9e03f, Copyright (c) 2000-2017 the > Libav developers > built on Dec 26 2017 15:37:04 with Apple LLVM version 9.0.0 > (clang-900.0.39.2) > File '/tmp/out.mkv' already exists. Overwrite ? [y/N] y > Stream mapping: > (null) -> Stream #0:0 (libx264) > Press ctrl-c to stop encoding > x264 [error]: not compiled with 10 bit depth support > > lu Alright. Just change the X264_BUILD to 153 (the version where this was introduced) instead of 155 and it should be good. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
James Almer (2017-12-26): > > +#if X264_BUILD >= 155 > > +if (x4->params.i_bitdepth > 8) > > +#else > Wouldn't using av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth here > as well be cleaner? avctx->pix_fmt tells us what libavcodec wants; x4->params.i_bitdepth tells us what x264 proposes; they are not necessarily the same thing. You may want to check the similar change you made on FFmpeg. Regards, -- Nicolas George signature.asc Description: Digital signature ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 26/12/2017 13:54, James Almer wrote: You can still build libx264 with support for only 8 and 10 bits after this multibitdepth change, so ideally you'd still check for what's available based on X264_BIT_DEPTH and use the new enum array if it's 0. I have a patch doing this but was waiting for some feedback elsewhere before sending it. I decided to not go that way so if somebody changes the 8-only library with the 10-only library or the hydra he wouldn't have to rebuild Libav. Asking for an unsupported pixel format gets you an error message anyway. ./avconv -filter_complex testsrc -pix_fmt yuv422p10 -c:v libx264 /tmp/out.mkv avconv version v13_dev0-1426-g8436a9e03f, Copyright (c) 2000-2017 the Libav developers built on Dec 26 2017 15:37:04 with Apple LLVM version 9.0.0 (clang-900.0.39.2) File '/tmp/out.mkv' already exists. Overwrite ? [y/N] y Stream mapping: (null) -> Stream #0:0 (libx264) Press ctrl-c to stop encoding x264 [error]: not compiled with 10 bit depth support lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] x264: Support version 155
On 12/26/2017 8:33 AM, Luca Barbato wrote: > It has native 8 and 10 bit support. > --- > libavcodec/libx264.c | 30 ++ > 1 file changed, 30 insertions(+) > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 0dec12edd2..6aadf33c94 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -243,7 +243,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket > *pkt, const AVFrame *frame, > > x264_picture_init( >pic ); > x4->pic.img.i_csp = x4->params.i_csp; > +#if X264_BUILD >= 155 > +if (x4->params.i_bitdepth > 8) > +#else > if (x264_bit_depth > 8) > +#endif Wouldn't using av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth here as well be cleaner? > x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH; > x4->pic.img.i_plane = 3; > > @@ -395,6 +399,9 @@ static av_cold int X264_init(AVCodecContext *avctx) > x4->params.p_log_private= avctx; > x4->params.i_log_level = X264_LOG_DEBUG; > x4->params.i_csp= convert_pix_fmt(avctx->pix_fmt); > +#if X264_BUILD >= 155 > +x4->params.i_bitdepth = > av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth; > +#endif > > if (avctx->bit_rate) { > x4->params.rc.i_bitrate = avctx->bit_rate / 1000; > @@ -659,6 +666,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > return 0; > } > > +#if X264_BUILD < 155 > static const enum AVPixelFormat pix_fmts_8bit[] = { > AV_PIX_FMT_YUV420P, > AV_PIX_FMT_YUVJ420P, > @@ -685,15 +693,37 @@ static const enum AVPixelFormat pix_fmts_10bit[] = { > AV_PIX_FMT_NV20, > AV_PIX_FMT_NONE > }; > +#endif > + > +static const enum AVPixelFormat pix_fmts_all[] = { > +AV_PIX_FMT_YUV420P, > +AV_PIX_FMT_YUVJ420P, > +AV_PIX_FMT_YUV422P, > +AV_PIX_FMT_YUVJ422P, > +AV_PIX_FMT_YUV444P, > +AV_PIX_FMT_YUVJ444P, > +AV_PIX_FMT_NV12, > +AV_PIX_FMT_NV16, > +AV_PIX_FMT_NV21, > +AV_PIX_FMT_YUV420P10, > +AV_PIX_FMT_YUV422P10, > +AV_PIX_FMT_YUV444P10, > +AV_PIX_FMT_NV20, > +AV_PIX_FMT_NONE > +}; > > static av_cold void X264_init_static(AVCodec *codec) > { > +#if X264_BUILD < 155 > if (x264_bit_depth == 8) > codec->pix_fmts = pix_fmts_8bit; > else if (x264_bit_depth == 9) > codec->pix_fmts = pix_fmts_9bit; > else if (x264_bit_depth == 10) > codec->pix_fmts = pix_fmts_10bit; > +#else > +codec->pix_fmts = pix_fmts_all; > +#endif You can still build libx264 with support for only 8 and 10 bits after this multibitdepth change, so ideally you'd still check for what's available based on X264_BIT_DEPTH and use the new enum array if it's 0. I have a patch doing this but was waiting for some feedback elsewhere before sending it. > } > > #define OFFSET(x) offsetof(X264Context, x) > ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel