[FFmpeg-devel] [PATCH v2 3/3] avcodec/libx264: remove separate libx264rgb RGB wrapper

Jan Ekström jeebjp at gmail.com
Fri Jul 2 14:25:13 EEST 2021


No other encoder wrapper in libavcodec is split like this, and
with RGB input this currently does not lead to 4:2:0 (which would
be generally supported in most hardware and software implementations),
but rather 4:4:4.

The libx262 encoder definition was not touched, as it already has
4:4:4 YCbCr defined for it, which as far as I can tell is not supported.
---
 configure              |  2 --
 doc/encoders.texi      |  7 ++++---
 libavcodec/allcodecs.c |  1 -
 libavcodec/libx264.c   | 43 ++++++------------------------------------
 libavcodec/version.h   |  2 +-
 5 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/configure b/configure
index b3b8065188..9e8d219449 100755
--- a/configure
+++ b/configure
@@ -3316,8 +3316,6 @@ libwebp_anim_encoder_deps="libwebp"
 libx262_encoder_deps="libx262"
 libx264_encoder_deps="libx264"
 libx264_encoder_select="atsc_a53"
-libx264rgb_encoder_deps="libx264"
-libx264rgb_encoder_select="libx264_encoder"
 libx265_encoder_deps="libx265"
 libxavs_encoder_deps="libxavs"
 libxavs2_encoder_deps="libxavs2"
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 4c38996372..e60ffe9c7d 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2280,7 +2280,7 @@ Text-like
 
 @end table
 
- at section libx264, libx264rgb
+ at section libx264
 
 x264 H.264/MPEG-4 AVC encoder wrapper.
 
@@ -2302,8 +2302,9 @@ by the libx264 @code{x264_param_parse} function.
 The x264 project website is at
 @url{http://www.videolan.org/developers/x264.html}.
 
-The libx264rgb encoder is the same as libx264, except it accepts packed RGB
-pixel formats as input instead of YUV.
+Since libavcodec 59.4.100 the libx264 encoder wrapper now supports both
+YCbCr as well as packed RGB pixel formats, and the separate libx264rgb
+wrapper has been removed.
 
 @subsection Supported Pixel Formats
 
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 623db2a9fa..d1a5dfdb75 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -772,7 +772,6 @@ extern const AVCodec ff_libx262_encoder;
 #endif
 extern LIBX264_CONST AVCodec ff_libx264_encoder;
 #endif
-extern const AVCodec ff_libx264rgb_encoder;
 extern AVCodec ff_libx265_encoder;
 extern const AVCodec ff_libxavs_encoder;
 extern const AVCodec ff_libxavs2_encoder;
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index fdb9e285a6..b31814bd4b 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -975,6 +975,9 @@ static const enum AVPixelFormat pix_fmts_8bit[] = {
     AV_PIX_FMT_YUVJ422P,
     AV_PIX_FMT_YUV444P,
     AV_PIX_FMT_YUVJ444P,
+    AV_PIX_FMT_BGR0,
+    AV_PIX_FMT_BGR24,
+    AV_PIX_FMT_RGB24,
     AV_PIX_FMT_NV12,
     AV_PIX_FMT_NV16,
 #ifdef X264_CSP_NV21
@@ -1001,6 +1004,9 @@ static const enum AVPixelFormat pix_fmts_all[] = {
     AV_PIX_FMT_YUVJ422P,
     AV_PIX_FMT_YUV444P,
     AV_PIX_FMT_YUVJ444P,
+    AV_PIX_FMT_BGR0,
+    AV_PIX_FMT_BGR24,
+    AV_PIX_FMT_RGB24,
     AV_PIX_FMT_NV12,
     AV_PIX_FMT_NV16,
 #ifdef X264_CSP_NV21
@@ -1017,13 +1023,6 @@ static const enum AVPixelFormat pix_fmts_all[] = {
     AV_PIX_FMT_NONE
 };
 
-static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
-    AV_PIX_FMT_BGR0,
-    AV_PIX_FMT_BGR24,
-    AV_PIX_FMT_RGB24,
-    AV_PIX_FMT_NONE
-};
-
 #if X264_BUILD < 153
 static av_cold void X264_init_static(AVCodec *codec)
 {
@@ -1183,36 +1182,6 @@ AVCodec ff_libx264_encoder = {
                       ,
     .wrapper_name     = "libx264",
 };
-
-static const AVClass rgbclass = {
-    .class_name = "libx264rgb",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-};
-
-const AVCodec ff_libx264rgb_encoder = {
-    .name           = "libx264rgb",
-    .long_name      = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB"),
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = AV_CODEC_ID_H264,
-    .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
-                      AV_CODEC_CAP_OTHER_THREADS |
-                      AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
-    .priv_data_size = sizeof(X264Context),
-    .init           = X264_init,
-    .encode2        = X264_frame,
-    .close          = X264_close,
-    .priv_class     = &rgbclass,
-    .defaults       = x264_defaults,
-    .pix_fmts       = pix_fmts_8bit_rgb,
-    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS
-#if X264_BUILD >= 158
-                      | FF_CODEC_CAP_INIT_THREADSAFE
-#endif
-                      ,
-    .wrapper_name   = "libx264",
-};
 #endif
 
 #if CONFIG_LIBX262_ENCODER
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 2a420a7e28..554f293aad 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  59
-#define LIBAVCODEC_VERSION_MINOR   3
+#define LIBAVCODEC_VERSION_MINOR   4
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.31.1



More information about the ffmpeg-devel mailing list