[FFmpeg-devel] [PATCH 08/87] avcodec: Remove deprecated coder type options

James Almer jamrial at gmail.com
Mon Apr 19 17:09:05 EEST 2021


From: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

Deprecated in be00ec832c519427cd92218abac77dafdc1d5487.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 doc/codecs.texi             | 14 --------------
 libavcodec/avcodec.h        | 12 ------------
 libavcodec/ffv1enc.c        | 17 -----------------
 libavcodec/libopenh264enc.c | 10 ----------
 libavcodec/libx264.c        |  9 ---------
 libavcodec/options_table.h  |  7 -------
 libavcodec/qsvenc.c         |  6 ------
 libavcodec/qsvenc_h264.c    |  3 ---
 libavcodec/sgienc.c         |  7 -------
 libavcodec/sunrastenc.c     | 26 --------------------------
 libavcodec/targaenc.c       |  7 -------
 libavcodec/version.h        |  3 ---
 12 files changed, 121 deletions(-)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 4a481dd5bf..702caa2a1d 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -627,20 +627,6 @@ Set limit motion vectors range (1023 for DivX player).
 
 @item global_quality @var{integer} (@emph{encoding,audio,video})
 
- at item coder @var{integer} (@emph{encoding,video})
-
-Possible values:
- at table @samp
- at item vlc
-variable length coder / huffman coder
- at item ac
-arithmetic coder
- at item raw
-raw (no encoding)
- at item rle
-run-length coder
- at end table
-
 @item context @var{integer} (@emph{encoding,video})
 Set context model.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ee2350bcb0..b468ee7c6f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1443,18 +1443,6 @@ typedef struct AVCodecContext {
      */
     int rc_initial_buffer_occupancy;
 
-#if FF_API_CODER_TYPE
-#define FF_CODER_TYPE_VLC       0
-#define FF_CODER_TYPE_AC        1
-#define FF_CODER_TYPE_RAW       2
-#define FF_CODER_TYPE_RLE       3
-    /**
-     * @deprecated use encoder private options instead
-     */
-    attribute_deprecated
-    int coder_type;
-#endif /* FF_API_CODER_TYPE */
-
 #if FF_API_PRIVATE_OPT
     /** @deprecated use encoder private options instead */
     attribute_deprecated
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index cdad65a4f9..de28ac44f1 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -554,13 +554,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-#if FF_API_CODER_TYPE
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (avctx->coder_type != -1)
-        s->ac = avctx->coder_type > 0 ? AC_RANGE_CUSTOM_TAB : AC_GOLOMB_RICE;
-    else
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
     if (s->ac == 1) // Compatbility with common command line usage
         s->ac = AC_RANGE_CUSTOM_TAB;
     else if (s->ac == AC_RANGE_DEFAULT_TAB_FORCE)
@@ -1310,13 +1303,6 @@ static const AVClass ffv1_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-#if FF_API_CODER_TYPE
-static const AVCodecDefault ffv1_defaults[] = {
-    { "coder", "-1" },
-    { NULL },
-};
-#endif
-
 AVCodec ff_ffv1_encoder = {
     .name           = "ffv1",
     .long_name      = NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
@@ -1350,9 +1336,6 @@ AVCodec ff_ffv1_encoder = {
         AV_PIX_FMT_NONE
 
     },
-#if FF_API_CODER_TYPE
-    .defaults       = ffv1_defaults,
-#endif
     .priv_class     = &ffv1_class,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 0eade73498..608fa59cdd 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -210,16 +210,6 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
             break;
         }
 
-#if FF_API_CODER_TYPE && FF_API_OPENH264_CABAC
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (s->coder < 0 && avctx->coder_type == FF_CODER_TYPE_AC)
-        s->coder = 1;
-
-    if (s->coder < 0)
-        s->coder = s->cabac;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     if (s->profile == FF_PROFILE_UNKNOWN && s->coder >= 0)
         s->profile = s->coder == 0 ? FF_PROFILE_H264_CONSTRAINED_BASELINE :
 #if OPENH264_VER_AT_LEAST(1, 8)
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ddc4973a4..6d945fc3fb 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -747,12 +747,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
     if (avctx->keyint_min >= 0)
         x4->params.i_keyint_min = avctx->keyint_min;
-#if FF_API_CODER_TYPE
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (avctx->coder_type >= 0)
-        x4->coder = avctx->coder_type == FF_CODER_TYPE_AC;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
     if (avctx->me_cmp >= 0)
         x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA;
 
@@ -1174,9 +1168,6 @@ static const AVCodecDefault x264_defaults[] = {
     { "b_strategy",       "-1" },
 #endif
     { "keyint_min",       "-1" },
-#if FF_API_CODER_TYPE
-    { "coder",            "-1" },
-#endif
     { "cmp",              "-1" },
     { "threads",          AV_STRINGIFY(X264_THREADS_AUTO) },
     { "thread_type",      "0" },
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index b3d8a79f11..9b77428a50 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -216,13 +216,6 @@ static const AVOption avcodec_options[] = {
 {"subq", "sub-pel motion estimation quality", OFFSET(me_subpel_quality), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E},
 {"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"global_quality", NULL, OFFSET(global_quality), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
-#if FF_API_CODER_TYPE
-{"coder", NULL, OFFSET(coder_type), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"},
-{"vlc", "variable length coder / Huffman coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_VLC }, INT_MIN, INT_MAX, V|E, "coder"},
-{"ac", "arithmetic coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_AC }, INT_MIN, INT_MAX, V|E, "coder"},
-{"raw", "raw (no encoding)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RAW }, INT_MIN, INT_MAX, V|E, "coder"},
-{"rle", "run-length coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RLE }, INT_MIN, INT_MAX, V|E, "coder"},
-#endif /* FF_API_CODER_TYPE */
 #if FF_API_PRIVATE_OPT
 {"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
 #endif
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 566a5c8552..d30c289fce 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -667,12 +667,6 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
             q->extco.RateDistortionOpt = q->rdo > 0 ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
 
         if (avctx->codec_id == AV_CODEC_ID_H264) {
-#if FF_API_CODER_TYPE
-FF_DISABLE_DEPRECATION_WARNINGS
-            if (avctx->coder_type >= 0)
-                q->cavlc = avctx->coder_type == FF_CODER_TYPE_VLC;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
             q->extco.CAVLC = q->cavlc ? MFX_CODINGOPTION_ON
                                       : MFX_CODINGOPTION_UNKNOWN;
 
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index ddafc45ec3..df70f30271 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -169,9 +169,6 @@ static const AVCodecDefault qsv_enc_defaults[] = {
     { "bf",        "3"     },
     { "qmin",      "-1"    },
     { "qmax",      "-1"    },
-#if FF_API_CODER_TYPE
-    { "coder",     "-1"    },
-#endif
     { "trellis",   "-1"    },
     { "flags",     "+cgop" },
 #if FF_API_PRIVATE_OPT
diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c
index 3aa0c7f4a5..2a898f5a4f 100644
--- a/libavcodec/sgienc.c
+++ b/libavcodec/sgienc.c
@@ -105,13 +105,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
     avctx->coded_frame->key_frame = 1;
 FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
-#if FF_API_CODER_TYPE
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (avctx->coder_type == FF_CODER_TYPE_RAW)
-        s->rle = 0;
-FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
     width  = avctx->width;
diff --git a/libavcodec/sunrastenc.c b/libavcodec/sunrastenc.c
index 97b2242a6e..af4529815b 100644
--- a/libavcodec/sunrastenc.c
+++ b/libavcodec/sunrastenc.c
@@ -140,22 +140,6 @@ static av_cold int sunrast_encode_init(AVCodecContext *avctx)
 {
     SUNRASTContext *s = avctx->priv_data;
 
-#if FF_API_CODER_TYPE
-FF_DISABLE_DEPRECATION_WARNINGS
-    switch (avctx->coder_type) {
-    case FF_CODER_TYPE_RLE:
-        s->type = RT_BYTE_ENCODED;
-        break;
-    case FF_CODER_TYPE_RAW:
-        s->type = RT_STANDARD;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "invalid coder_type\n");
-        return AVERROR(EINVAL);
-    }
-FF_ENABLE_DEPRECATION_WARNINGS
-    if (s->type != RT_BYTE_ENCODED && s->type != RT_STANDARD)
-#endif
     // adjust boolean option to RT equivalent
     s->type++;
 
@@ -224,13 +208,6 @@ static const AVClass sunrast_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-#if FF_API_CODER_TYPE
-static const AVCodecDefault sunrast_defaults[] = {
-     { "coder", "rle" },
-     { NULL },
-};
-#endif
-
 AVCodec ff_sunrast_encoder = {
     .name           = "sunrast",
     .long_name      = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"),
@@ -239,9 +216,6 @@ AVCodec ff_sunrast_encoder = {
     .priv_data_size = sizeof(SUNRASTContext),
     .init           = sunrast_encode_init,
     .encode2        = sunrast_encode_frame,
-#if FF_API_CODER_TYPE
-    .defaults       = sunrast_defaults,
-#endif
     .priv_class     = &sunrast_class,
     .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_BGR24,
                                                   AV_PIX_FMT_PAL8,
diff --git a/libavcodec/targaenc.c b/libavcodec/targaenc.c
index 79030a012b..f662e4a489 100644
--- a/libavcodec/targaenc.c
+++ b/libavcodec/targaenc.c
@@ -152,13 +152,6 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     bpp = pkt->data[16] >> 3;
 
 
-#if FF_API_CODER_TYPE
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (avctx->coder_type == FF_CODER_TYPE_RAW)
-        s->rle = 0;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     /* try RLE compression */
     if (s->rle)
         datasize = targa_encode_rle(out, picsize, p, bpp, avctx->width, avctx->height);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 03aba06056..31d0d26abc 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -66,9 +66,6 @@
 #ifndef FF_API_VBV_DELAY
 #define FF_API_VBV_DELAY         (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
-#ifndef FF_API_CODER_TYPE
-#define FF_API_CODER_TYPE        (LIBAVCODEC_VERSION_MAJOR < 59)
-#endif
 #ifndef FF_API_PRIVATE_OPT
 #define FF_API_PRIVATE_OPT      (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
-- 
2.31.1



More information about the ffmpeg-devel mailing list