aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-02-27 19:09:49 +0100
committerAnton Khirnov <anton@khirnov.net>2012-02-29 07:23:31 +0100
commit63efd83ae10a158e3ae0823e3527f3845dda397a (patch)
tree6d0031e3c22a062d4777be4183627143f59c20eb
parentaf3d804f9feebe34ad3815c501fba795b801cdd0 (diff)
downloadffmpeg-63efd83ae10a158e3ae0823e3527f3845dda397a.tar.gz
mpegvideo_enc: add chroma/luma_elim_threshold private options.
Deprecate corresponding AVCodecContext fields.
-rw-r--r--libavcodec/avcodec.h6
-rw-r--r--libavcodec/mpegvideo.h6
-rw-r--r--libavcodec/mpegvideo_enc.c8
-rw-r--r--libavcodec/options.c2
-rw-r--r--libavformat/ffmdec.c2
-rw-r--r--libavformat/ffmenc.c2
-rw-r--r--tests/ref/lavf/ffm2
7 files changed, 18 insertions, 10 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5677c0bce5..01da5a6258 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 4ec419034f..084f4be769 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 e6e6a95b48..8a516b3016 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 6b5b148516..9aa02a9c05 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 089609f3ee..2149c8cdd7 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 b8d3d315bd..500ae0bf50 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 0ae40f59d9..afef176a9b 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