diff mbox series

[FFmpeg-devel] avcodec/libx264: remove support for x262 MPEG-2 encoder

Message ID 20220527082922.994-1-ffmpeg@gyani.pro
State New
Headers show
Series [FFmpeg-devel] avcodec/libx264: remove support for x262 MPEG-2 encoder | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Gyan Doshi May 27, 2022, 8:29 a.m. UTC
Support for 'libx262' was added in e56f14659f by merging
Libav e1319aa1c1.

The Libav commit author believed that "x262 is a subfeature of x264"
but this is not the case. Kieran Kuhnya added support for MPEG-2
encoding in *his fork* of x264.
See https://github.com/kierank/x262/commit/6851000e27

So there are two issues:
1) Our configure enables libx262 implicitly if libx264 is enabled
and a x262 constant is defined in x264.h; this will never be fulfilled
with native x264. Users would have to build x262 and use the libx264
generated there. Which brings us to the 2nd issue.
2) Development on the x262 repo stopped in 2015. So, it's likely API
and ABI incompatible with native x264 and thus our current wrapper.

If support for x262 is desired it will have to be added as a distinct
component or by integrating the fork changes in x264.
---
 Changelog              |  1 +
 configure              |  5 +----
 libavcodec/Makefile    |  1 -
 libavcodec/allcodecs.c |  1 -
 libavcodec/libx264.c   | 34 ----------------------------------
 5 files changed, 2 insertions(+), 40 deletions(-)

Comments

Kieran Kunhya May 27, 2022, 3:16 p.m. UTC | #1
On Fri, 27 May 2022 at 09:30, Gyan Doshi <ffmpeg@gyani.pro> wrote:

> Support for 'libx262' was added in e56f14659f by merging
> Libav e1319aa1c1.
>
> The Libav commit author believed that "x262 is a subfeature of x264"
> but this is not the case. Kieran Kuhnya added support for MPEG-2
> encoding in *his fork* of x264.
> See https://github.com/kierank/x262/commit/6851000e27
>

x262 is a VideoLAN project: https://git.videolan.org/?p=x262.git;a=summary


> So there are two issues:
> 1) Our configure enables libx262 implicitly if libx264 is enabled
> and a x262 constant is defined in x264.h; this will never be fulfilled
> with native x264. Users would have to build x262 and use the libx264
> generated there. Which brings us to the 2nd issue.
>

Yes, there was some reason that I forget that meant we couldn't have a
single binary doing both.
And mainline x264 will never merge x262.


> 2) Development on the x262 repo stopped in 2015. So, it's likely API
> and ABI incompatible with native x264 and thus our current wrapper.
>

x262 works fine irrespective of lack of development. MPEG-2 came out in
1993 after all.

Kieran
Gyan Doshi May 28, 2022, 4:05 a.m. UTC | #2
On 2022-05-27 08:46 pm, Kieran Kunhya wrote:
> On Fri, 27 May 2022 at 09:30, Gyan Doshi <ffmpeg@gyani.pro> wrote:
>
>> Support for 'libx262' was added in e56f14659f by merging
>> Libav e1319aa1c1.
>>
>> The Libav commit author believed that "x262 is a subfeature of x264"
>> but this is not the case. Kieran Kuhnya added support for MPEG-2
>> encoding in *his fork* of x264.
>> See https://github.com/kierank/x262/commit/6851000e27
>>
> x262 is a VideoLAN project: https://git.videolan.org/?p=x262.git;a=summary
>
>
>> So there are two issues:
>> 1) Our configure enables libx262 implicitly if libx264 is enabled
>> and a x262 constant is defined in x264.h; this will never be fulfilled
>> with native x264. Users would have to build x262 and use the libx264
>> generated there. Which brings us to the 2nd issue.
>>
> Yes, there was some reason that I forget that meant we couldn't have a
> single binary doing both.
> And mainline x264 will never merge x262.
>
>
>> 2) Development on the x262 repo stopped in 2015. So, it's likely API
>> and ABI incompatible with native x264 and thus our current wrapper.
>>
> x262 works fine irrespective of lack of development. MPEG-2 came out in
> 1993 after all.

By development, I mean you merging updates to native x264 into your 
repo. That stopped in 2015. So, your repo only supports one bit-depth in 
a build, right?

Regards,
Gyan
diff mbox series

Patch

diff --git a/Changelog b/Changelog
index 53130f072f..40fbaf0ff2 100644
--- a/Changelog
+++ b/Changelog
@@ -17,6 +17,7 @@  version 5.1:
 - multiply video filter
 - PGS subtitle frame merge bitstream filter
 - blurdetect filter
+- removed libx262 support
 
 
 version 5.0:
diff --git a/configure b/configure
index 5a167613a4..29cb63019b 100755
--- a/configure
+++ b/configure
@@ -2472,7 +2472,6 @@  CONFIG_EXTRA="
     ividsp
     jpegtables
     lgplv3
-    libx262
     llauddsp
     llviddsp
     llvidencdsp
@@ -3375,7 +3374,6 @@  libvpx_vp9_decoder_deps="libvpx"
 libvpx_vp9_encoder_deps="libvpx"
 libwebp_encoder_deps="libwebp"
 libwebp_anim_encoder_deps="libwebp"
-libx262_encoder_deps="libx262"
 libx264_encoder_deps="libx264"
 libx264_encoder_select="atsc_a53"
 libx264rgb_encoder_deps="libx264"
@@ -6661,8 +6659,7 @@  enabled libwebp           && {
 enabled libx264           && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
                                { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
                                  warn "using libx264 without pkg-config"; } } &&
-                             require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
-                             check_cpp_condition libx262 x264.h "X264_MPEG2"
+                             require_cpp_condition libx264 x264.h "X264_BUILD >= 118"
 enabled libx265           && require_pkg_config libx265 x265 x265.h x265_api_get &&
                              require_cpp_condition libx265 x265.h "X265_BUILD >= 70"
 enabled libxavs           && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 38425d2f22..2c6be86b1e 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1096,7 +1096,6 @@  OBJS-$(CONFIG_LIBVPX_VP9_DECODER)         += libvpxdec.o libvpx.o
 OBJS-$(CONFIG_LIBVPX_VP9_ENCODER)         += libvpxenc.o libvpx.o
 OBJS-$(CONFIG_LIBWEBP_ENCODER)            += libwebpenc_common.o libwebpenc.o
 OBJS-$(CONFIG_LIBWEBP_ANIM_ENCODER)       += libwebpenc_common.o libwebpenc_animencoder.o
-OBJS-$(CONFIG_LIBX262_ENCODER)            += libx264.o
 OBJS-$(CONFIG_LIBX264_ENCODER)            += libx264.o
 OBJS-$(CONFIG_LIBX265_ENCODER)            += libx265.o
 OBJS-$(CONFIG_LIBXAVS_ENCODER)            += libxavs.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index c47133aa18..f7320fceee 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -780,7 +780,6 @@  extern FFCodec ff_libvpx_vp9_decoder;
 /* preferred over libwebp */
 extern const FFCodec ff_libwebp_anim_encoder;
 extern const FFCodec ff_libwebp_encoder;
-extern const FFCodec ff_libx262_encoder;
 #if CONFIG_LIBX264_ENCODER
 #include <x264.h>
 #if X264_BUILD < 153
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ce3791ae8..ad86665d15 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -644,12 +644,6 @@  static av_cold int X264_init(AVCodecContext *avctx)
     if (avctx->global_quality > 0)
         av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is recommended.\n");
 
-#if CONFIG_LIBX262_ENCODER
-    if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
-        x4->params.b_mpeg2 = 1;
-        x264_param_default_mpeg2(&x4->params);
-    } else
-#endif
     x264_param_default(&x4->params);
 
     x4->params.b_deblocking_filter         = avctx->flags & AV_CODEC_FLAG_LOOP_FILTER;
@@ -1275,31 +1269,3 @@  const FFCodec ff_libx264rgb_encoder = {
                       ,
 };
 #endif
-
-#if CONFIG_LIBX262_ENCODER
-static const AVClass X262_class = {
-    .class_name = "libx262",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-};
-
-const FFCodec ff_libx262_encoder = {
-    .p.name           = "libx262",
-    .p.long_name      = NULL_IF_CONFIG_SMALL("libx262 MPEG2VIDEO"),
-    .p.type           = AVMEDIA_TYPE_VIDEO,
-    .p.id             = AV_CODEC_ID_MPEG2VIDEO,
-    .p.capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
-                        AV_CODEC_CAP_OTHER_THREADS |
-                        AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
-    .p.pix_fmts       = pix_fmts_8bit,
-    .p.priv_class     = &X262_class,
-    .p.wrapper_name   = "libx264",
-    .priv_data_size   = sizeof(X264Context),
-    .init             = X264_init,
-    FF_CODEC_ENCODE_CB(X264_frame),
-    .close            = X264_close,
-    .defaults         = x264_defaults,
-    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS,
-};
-#endif