summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-18 13:30:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-18 13:30:38 +0200
commit74128352047ee3fb075b0f69ab16047f70b45a42 (patch)
tree944418d43c9d6c56865bd06f14ad6af46748a443
parent17d16008befa82cb79e71fbb4dc28fb4d9ec2ce6 (diff)
parenta6e4ce9fd50897dc6d9c2ada4b6b8090de7de5bf (diff)
downloadffmpeg-streaming-74128352047ee3fb075b0f69ab16047f70b45a42.zip
ffmpeg-streaming-74128352047ee3fb075b0f69ab16047f70b45a42.tar.gz
Merge commit 'a6e4ce9fd50897dc6d9c2ada4b6b8090de7de5bf'
* commit 'a6e4ce9fd50897dc6d9c2ada4b6b8090de7de5bf': lavc: make rc_qsquish a private option of mpegvideo encoders Conflicts: libavcodec/avcodec.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/avcodec.h8
-rw-r--r--libavcodec/mpegvideo.h10
-rw-r--r--libavcodec/mpegvideo_enc.c7
-rw-r--r--libavcodec/options_table.h4
-rw-r--r--libavcodec/ratecontrol.c2
-rw-r--r--libavcodec/version.h3
6 files changed, 27 insertions, 7 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3d6f7b9..6ed8304 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2271,13 +2271,13 @@ typedef struct AVCodecContext {
*/
int max_qdiff;
+#if FF_API_MPV_OPT
/**
- * ratecontrol qmin qmax limiting method
- * 0-> clipping, 1-> use a nice continuous function to limit qscale within qmin/qmax.
- * - encoding: Set by user.
- * - decoding: unused
+ * @deprecated use encoder private options instead
*/
+ attribute_deprecated
float rc_qsquish;
+#endif
float rc_qmod_amp;
int rc_qmod_freq;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 87fe87f..72e1b4d 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -650,6 +650,12 @@ typedef struct MpegEncContext {
int mpv_flags; ///< flags set by private options
int quantizer_noise_shaping;
+ /**
+ * ratecontrol qmin qmax limiting method
+ * 0-> clipping, 1-> use a nice continuous function to limit qscale within qmin/qmax.
+ */
+ float rc_qsquish;
+
/* temp buffers for rate control */
float *cplx_tab, *bits_tab;
@@ -694,7 +700,9 @@ typedef struct MpegEncContext {
FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
{ "quantizer_noise_shaping", NULL, FF_MPV_OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS },\
{ "error_rate", "Simulate errors in the bitstream to test error concealment.", \
- FF_MPV_OFFSET(error_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS },
+ FF_MPV_OFFSET(error_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS },\
+{"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", \
+ FF_MPV_OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, 0, 99, FF_MPV_OPT_FLAGS},
extern const AVOption ff_mpv_generic_options[];
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index d045179..bdf70eb 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -950,6 +950,13 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+#if FF_API_MPV_OPT
+ FF_DISABLE_DEPRECATION_WARNINGS
+ if (avctx->rc_qsquish != 0.0)
+ s->rc_qsquish = avctx->rc_qsquish;
+ FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
if (avctx->b_frame_strategy == 2) {
for (i = 0; i < s->max_b_frames + 2; i++) {
s->tmp_frames[i] = av_frame_alloc();
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 8a7603d..a55b4cb 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -174,7 +174,9 @@ static const AVOption avcodec_options[] = {
{"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
{"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
-{"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 99, V|E},
+#if FF_API_MPV_OPT
+{"qsquish", "deprecated, use encoder private options instead", OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 99, V|E},
+#endif
{"rc_qmod_amp", "experimental quantizer modulation", OFFSET(rc_qmod_amp), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E},
{"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"rc_override_count", NULL, OFFSET(rc_override_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 72b3f44..6176144 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -570,7 +570,7 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce,
av_dlog(s, "q:%f max:%f min:%f size:%f index:%f agr:%f\n",
q, max_rate, min_rate, buffer_size, rcc->buffer_index,
s->avctx->rc_buffer_aggressivity);
- if (s->avctx->rc_qsquish == 0.0 || qmin == qmax) {
+ if (s->rc_qsquish == 0.0 || qmin == qmax) {
if (q < qmin)
q = qmin;
else if (q > qmax)
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 91db550..ca8a2c6 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -181,5 +181,8 @@
#ifndef FF_API_AVCTX_TIMEBASE
#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
+#ifndef FF_API_MPV_OPT
+#define FF_API_MPV_OPT (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
#endif /* AVCODEC_VERSION_H */
OpenPOWER on IntegriCloud