diff mbox series

[FFmpeg-devel,09/14] avcodec/mjpegenc: Deprecate unused prediction type

Message ID AM7PR03MB6660E8BF950F886F1F002E218F7D9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Headers show
Series [FFmpeg-devel,01/14] avcodec/mjpegenc: Use custom close function directly | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 22, 2021, 3:25 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mjpegenc.c        | 6 ++++--
 libavcodec/mjpegenc_common.c | 2 +-
 libavcodec/mpegvideo.h       | 3 +--
 libavcodec/version.h         | 3 ++-
 4 files changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 9b5acde58d..cafa0487c5 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -77,7 +77,7 @@  static av_cold void init_uni_ac_vlc(const uint8_t huff_size_ac[256],
 static void mjpeg_encode_picture_header(MpegEncContext *s)
 {
     ff_mjpeg_encode_picture_header(s->avctx, &s->pb, &s->intra_scantable,
-                                   s->pred, s->intra_matrix, s->chroma_intra_matrix);
+                                   0, s->intra_matrix, s->chroma_intra_matrix);
 
     s->esc_pos = put_bytes_count(&s->pb, 0);
     for (int i = 1; i < s->slice_context_count; i++)
@@ -620,10 +620,12 @@  static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
 FF_MPV_COMMON_OPTS
-{ "pred", "Prediction method", FF_MPV_OFFSET(pred), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 3, VE, "pred" },
+#if FF_API_MJPEG_PRED
+{ "pred", "Deprecated, does nothing", FF_MPV_OFFSET(dummy), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 3, VE, "pred" },
     { "left",   NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX, VE, "pred" },
     { "plane",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, INT_MIN, INT_MAX, VE, "pred" },
     { "median", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, INT_MIN, INT_MAX, VE, "pred" },
+#endif
 { "huffman", "Huffman table strategy", OFFSET(huffman), AV_OPT_TYPE_INT, { .i64 = HUFFMAN_TABLE_OPTIMAL }, 0, NB_HUFFMAN_TABLE_OPTION - 1, VE, "huffman" },
     { "default", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = HUFFMAN_TABLE_DEFAULT }, INT_MIN, INT_MAX, VE, "huffman" },
     { "optimal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = HUFFMAN_TABLE_OPTIMAL }, INT_MIN, INT_MAX, VE, "huffman" },
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c
index 0303e65790..ed0e8c234d 100644
--- a/libavcodec/mjpegenc_common.c
+++ b/libavcodec/mjpegenc_common.c
@@ -310,7 +310,7 @@  void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
         put_bits(pb, 4, 0); /* AC huffman table index */
     }
 
-    put_bits(pb, 8, lossless ? pred : 0); /* Ss (not used) */
+    put_bits(pb, 8, pred); /* Ss (not used); pred only nonzero for LJPEG */
 
     switch (avctx->codec_id) {
     case AV_CODEC_ID_MJPEG:  put_bits(pb, 8, 63); break; /* Se (not used) */
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 5a3486d74c..942b05ba37 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -412,7 +412,6 @@  typedef struct MpegEncContext {
     /* MJPEG specific */
     struct MJpegContext *mjpeg_ctx;
     int esc_pos;
-    int pred;
 
     /* MSMPEG4 specific */
     int mv_table_index;
@@ -574,7 +573,7 @@  typedef struct MpegEncContext {
 
     int intra_penalty;
 
-#if FF_API_MPEGVIDEO_OPTS
+#if FF_API_MPEGVIDEO_OPTS || FF_API_MJPEG_PRED
     int dummy;               ///< used as target for deprecated options
 #endif
 } MpegEncContext;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 8a0b94f5aa..8581d891e1 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  14
+#define LIBAVCODEC_VERSION_MINOR  15
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
@@ -63,5 +63,6 @@ 
 #define FF_API_MPEGVIDEO_OPTS      (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_FLAG_TRUNCATED      (LIBAVCODEC_VERSION_MAJOR < 60)
 #define FF_API_SUB_TEXT_FORMAT     (LIBAVCODEC_VERSION_MAJOR < 60)
+#define FF_API_MJPEG_PRED          (LIBAVCODEC_VERSION_MAJOR < 60)
 
 #endif /* AVCODEC_VERSION_H */