Message ID | 1624153359-28171-1-git-send-email-lance.lmwang@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec/libx264: Add support for Sony XAVC Class 300 and 480 | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Sun, Jun 20, 2021 at 09:42:38AM +0800, lance.lmwang@gmail.com wrote: > From: Limin Wang <lance.lmwang@gmail.com> > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- > libavcodec/libx264.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 36fdb56..89f5c7b 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -749,6 +749,17 @@ static av_cold int X264_init(AVCodecContext *avctx) > av_log(avctx, AV_LOG_ERROR, > "x264 too old for AVC Intra, at least version 142 needed\n"); > #endif > + > + if (x4->avcintra_class > 200) { > +#if X264_BUILD < 164 > + av_log(avctx, AV_LOG_ERROR, > + "x264 too old for AVC Intra 300/480, at least version 164 needed\n"); > + return AVERROR(EINVAL); > +#endif > + /* AVC-Intra 300/480 only supported by Sony XAVC flavor */ > + x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; > + } this needs a #else or something libavcodec/libx264.c: In function ‘X264_init’: libavcodec/libx264.c:760:20: error: ‘x264_param_t {aka struct x264_param_t}’ has no member named ‘i_avcintra_flavor’; did you mean ‘i_avcintra_class’? x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; ^~~~~~~~~~~~~~~~~ i_avcintra_class libavcodec/libx264.c:760:40: error: ‘X264_AVCINTRA_FLAVOR_SONY’ undeclared (first use in this function) x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; ^~~~~~~~~~~~~~~~~~~~~~~~~ libavcodec/libx264.c:760:40: note: each undeclared identifier is reported only once for each function it appears in ffbuild/common.mak:67: recipe for target 'libavcodec/libx264.o' failed make: *** [libavcodec/libx264.o] Error 1 [...]
On Mon, Jun 21, 2021 at 05:07:48PM +0200, Michael Niedermayer wrote: > On Sun, Jun 20, 2021 at 09:42:38AM +0800, lance.lmwang@gmail.com wrote: > > From: Limin Wang <lance.lmwang@gmail.com> > > > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > > --- > > libavcodec/libx264.c | 13 ++++++++++++- > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > > index 36fdb56..89f5c7b 100644 > > --- a/libavcodec/libx264.c > > +++ b/libavcodec/libx264.c > > @@ -749,6 +749,17 @@ static av_cold int X264_init(AVCodecContext *avctx) > > av_log(avctx, AV_LOG_ERROR, > > "x264 too old for AVC Intra, at least version 142 needed\n"); > > #endif > > + > > + if (x4->avcintra_class > 200) { > > +#if X264_BUILD < 164 > > + av_log(avctx, AV_LOG_ERROR, > > + "x264 too old for AVC Intra 300/480, at least version 164 needed\n"); > > + return AVERROR(EINVAL); > > +#endif > > > + /* AVC-Intra 300/480 only supported by Sony XAVC flavor */ > > + x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; > > + } > > this needs a #else or something > > libavcodec/libx264.c: In function ‘X264_init’: > libavcodec/libx264.c:760:20: error: ‘x264_param_t {aka struct x264_param_t}’ has no member named ‘i_avcintra_flavor’; did you mean ‘i_avcintra_class’? > x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; > ^~~~~~~~~~~~~~~~~ > i_avcintra_class > libavcodec/libx264.c:760:40: error: ‘X264_AVCINTRA_FLAVOR_SONY’ undeclared (first use in this function) > x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; > ^~~~~~~~~~~~~~~~~~~~~~~~~ > libavcodec/libx264.c:760:40: note: each undeclared identifier is reported only once for each function it appears in > ffbuild/common.mak:67: recipe for target 'libavcodec/libx264.o' failed > make: *** [libavcodec/libx264.o] Error 1 have updated the patch, I think v2 is good to use, but v3 will not build the code if > 142. > > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > "I am not trying to be anyone's saviour, I'm trying to think about the > future and not be sad" - Elon Musk > > _______________________________________________ > 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".
On Tue, Jun 22, 2021 at 12:12 PM <lance.lmwang@gmail.com> wrote: > > From: Limin Wang <lance.lmwang@gmail.com> > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- > have tested with x264 version 141, 142, 156, 157, 163, 164. > > libavcodec/libx264.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 36fdb56..977b78a 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -749,6 +749,19 @@ static av_cold int X264_init(AVCodecContext *avctx) > av_log(avctx, AV_LOG_ERROR, > "x264 too old for AVC Intra, at least version 142 needed\n"); > #endif > + > + if (x4->avcintra_class > 200) { > +#if X264_BUILD < 164 > + av_log(avctx, AV_LOG_ERROR, > + "x264 too old for AVC Intra 300/480, at least version 164 needed\n"); > + return AVERROR(EINVAL); > +#endif > +#if X264_BUILD >= 157 > + /* AVC-Intra 300/480 only supported by Sony XAVC flavor */ > + x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; > +#endif > + } > + It feels odd to have different versions being checked here. If its < 164 the second part is always dead code, so why not just put it into an #else of the same check? - Hendrik
On Tue, Jun 22, 2021 at 12:14:12PM +0200, Hendrik Leppkes wrote: > On Tue, Jun 22, 2021 at 12:12 PM <lance.lmwang@gmail.com> wrote: > > > > From: Limin Wang <lance.lmwang@gmail.com> > > > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > > --- > > have tested with x264 version 141, 142, 156, 157, 163, 164. > > > > libavcodec/libx264.c | 15 ++++++++++++++- > > 1 file changed, 14 insertions(+), 1 deletion(-) > > > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > > index 36fdb56..977b78a 100644 > > --- a/libavcodec/libx264.c > > +++ b/libavcodec/libx264.c > > @@ -749,6 +749,19 @@ static av_cold int X264_init(AVCodecContext *avctx) > > av_log(avctx, AV_LOG_ERROR, > > "x264 too old for AVC Intra, at least version 142 needed\n"); > > #endif > > + > > + if (x4->avcintra_class > 200) { > > +#if X264_BUILD < 164 > > + av_log(avctx, AV_LOG_ERROR, > > + "x264 too old for AVC Intra 300/480, at least version 164 needed\n"); > > + return AVERROR(EINVAL); > > +#endif > > +#if X264_BUILD >= 157 > > + /* AVC-Intra 300/480 only supported by Sony XAVC flavor */ > > + x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; > > +#endif > > + } > > + > > It feels odd to have different versions being checked here. If its < > 164 the second part is always dead code, so why not just put it into > an #else of the same check? you're right, it'll be more simple. will change to else instead of checking for 157. > > - Hendrik > _______________________________________________ > 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".
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index 36fdb56..89f5c7b 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -749,6 +749,17 @@ static av_cold int X264_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "x264 too old for AVC Intra, at least version 142 needed\n"); #endif + + if (x4->avcintra_class > 200) { +#if X264_BUILD < 164 + av_log(avctx, AV_LOG_ERROR, + "x264 too old for AVC Intra 300/480, at least version 164 needed\n"); + return AVERROR(EINVAL); +#endif + /* AVC-Intra 300/480 only supported by Sony XAVC flavor */ + x4->params.i_avcintra_flavor = X264_AVCINTRA_FLAVOR_SONY; + } + if (x4->b_bias != INT_MIN) x4->params.i_bframe_bias = x4->b_bias; if (x4->b_pyramid >= 0) @@ -1082,7 +1093,7 @@ static const AVOption options[] = { { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_NONE}, INT_MIN, INT_MAX, VE, "nal-hrd" }, { "vbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_VBR}, INT_MIN, INT_MAX, VE, "nal-hrd" }, { "cbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_CBR}, INT_MIN, INT_MAX, VE, "nal-hrd" }, - { "avcintra-class","AVC-Intra class 50/100/200", OFFSET(avcintra_class),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 200 , VE}, + { "avcintra-class","AVC-Intra class 50/100/200/300/480", OFFSET(avcintra_class),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 480 , VE}, { "me_method", "Set motion estimation method", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, X264_ME_TESA, VE, "motion-est"}, { "motion-est", "Set motion estimation method", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, X264_ME_TESA, VE, "motion-est"}, { "dia", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_DIA }, INT_MIN, INT_MAX, VE, "motion-est" },