[FFmpeg-cvslog] mpegvideo_enc: add chroma/luma_elim_threshold private options.

Anton Khirnov git at videolan.org
Thu Mar 1 03:20:16 CET 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Feb 27 19:09:49 2012 +0100| [63efd83ae10a158e3ae0823e3527f3845dda397a] | committer: Anton Khirnov

mpegvideo_enc: add chroma/luma_elim_threshold private options.

Deprecate corresponding AVCodecContext fields.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63efd83ae10a158e3ae0823e3527f3845dda397a
---

 libavcodec/avcodec.h       |    6 ++++--
 libavcodec/mpegvideo.h     |    6 +++++-
 libavcodec/mpegvideo_enc.c |    8 ++++++--
 libavcodec/options.c       |    2 ++
 libavformat/ffmdec.c       |    2 --
 libavformat/ffmenc.c       |    2 --
 tests/ref/lavf/ffm         |    2 +-
 7 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5677c0b..01da5a6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1439,19 +1439,21 @@ typedef struct AVCodecContext {
 
     int b_frame_strategy;
 
+#if FF_API_MPV_GLOBAL_OPTS
     /**
      * luma single coefficient elimination threshold
      * - encoding: Set by user.
      * - decoding: unused
      */
-    int luma_elim_threshold;
+    attribute_deprecated int luma_elim_threshold;
 
     /**
      * chroma single coeff elimination threshold
      * - encoding: Set by user.
      * - decoding: unused
      */
-    int chroma_elim_threshold;
+    attribute_deprecated int chroma_elim_threshold;
+#endif
 
     /**
      * qscale offset between IP and B-frames
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 4ec4190..084f4be 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -711,7 +711,11 @@ typedef struct MpegEncContext {
 { "skip_rd",        "RD optimal MB level residual skipping", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_SKIP_RD },    0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
 { "strict_gop",     "Strictly enforce gop size",             0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_STRICT_GOP }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
 { "qp_rd",          "Use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_QP_RD },  0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
-{ "cbp_rd",         "use rate distortion optimization for CBP",          0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_CBP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },
+{ "cbp_rd",         "use rate distortion optimization for CBP",          0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_CBP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
+{ "luma_elim_threshold",   "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\
+                                                                      FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
+{ "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\
+                                                                      FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },
 
 extern const AVOption ff_mpv_generic_options[];
 
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index e6e6a95..8a516b3 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -353,8 +353,12 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
     s->flags2       = avctx->flags2;
     s->max_b_frames = avctx->max_b_frames;
     s->codec_id     = avctx->codec->id;
-    s->luma_elim_threshold   = avctx->luma_elim_threshold;
-    s->chroma_elim_threshold = avctx->chroma_elim_threshold;
+#if FF_API_MPV_GLOBAL_OPTS
+    if (avctx->luma_elim_threshold)
+        s->luma_elim_threshold   = avctx->luma_elim_threshold;
+    if (avctx->chroma_elim_threshold)
+        s->chroma_elim_threshold = avctx->chroma_elim_threshold;
+#endif
     s->strict_std_compliance = avctx->strict_std_compliance;
     s->quarter_sample     = (avctx->flags & CODEC_FLAG_QPEL) != 0;
     s->mpeg_quant         = avctx->mpeg_quant;
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 6b5b148..9aa02a9 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -169,8 +169,10 @@ static const AVOption options[]={
 {"dc_clip", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_DC_CLIP }, INT_MIN, INT_MAX, V|D, "bug"},
 {"ms", "workaround various bugs in microsofts broken decoders", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_MS }, INT_MIN, INT_MAX, V|D, "bug"},
 {"trunc", "trancated frames", 0, AV_OPT_TYPE_CONST, {.dbl = FF_BUG_TRUNCATED}, INT_MIN, INT_MAX, V|D, "bug"},
+#if FF_API_MPV_GLOBAL_OPTS
 {"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
 {"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|V|D|E, "strict"},
 {"very", "strictly conform to a older more strict version of the spec or reference software", 0, AV_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_VERY_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"},
 {"strict", "strictly conform to all the things in the spec no matter what consequences", 0, AV_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"},
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 089609f..2149c8c 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -332,8 +332,6 @@ static int ffm_read_header(AVFormatContext *s)
             codec->dct_algo = avio_rb32(pb);
             codec->strict_std_compliance = avio_rb32(pb);
             codec->max_b_frames = avio_rb32(pb);
-            codec->luma_elim_threshold = avio_rb32(pb);
-            codec->chroma_elim_threshold = avio_rb32(pb);
             codec->mpeg_quant = avio_rb32(pb);
             codec->intra_dc_precision = avio_rb32(pb);
             codec->me_method = avio_rb32(pb);
diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
index b8d3d31..500ae0b 100644
--- a/libavformat/ffmenc.c
+++ b/libavformat/ffmenc.c
@@ -144,8 +144,6 @@ static int ffm_write_header(AVFormatContext *s)
             avio_wb32(pb, codec->dct_algo);
             avio_wb32(pb, codec->strict_std_compliance);
             avio_wb32(pb, codec->max_b_frames);
-            avio_wb32(pb, codec->luma_elim_threshold);
-            avio_wb32(pb, codec->chroma_elim_threshold);
             avio_wb32(pb, codec->mpeg_quant);
             avio_wb32(pb, codec->intra_dc_precision);
             avio_wb32(pb, codec->me_method);
diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm
index 0ae40f5..afef176 100644
--- a/tests/ref/lavf/ffm
+++ b/tests/ref/lavf/ffm
@@ -1,3 +1,3 @@
-c963591a7f9a08d48e0f988640795690 *./tests/data/lavf/lavf.ffm
+8a95fa3db8e6082ed24e963e40ec1526 *./tests/data/lavf/lavf.ffm
 376832 ./tests/data/lavf/lavf.ffm
 ./tests/data/lavf/lavf.ffm CRC=0x88f58ba1



More information about the ffmpeg-cvslog mailing list