]> git.sesse.net Git - ffmpeg/commitdiff
lavc: make rc_qmod_* into private options of mpegvideo encoders
authorAnton Khirnov <anton@khirnov.net>
Sun, 27 Oct 2013 12:51:16 +0000 (13:51 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sat, 18 Oct 2014 03:23:05 +0000 (05:23 +0200)
libavcodec/avcodec.h
libavcodec/mpegvideo.h
libavcodec/mpegvideo_enc.c
libavcodec/options_table.h
libavcodec/ratecontrol.c

index aabad332b5984260675bb9b1167a08aa105e450f..c025c5c3dcde6cfc4c103e768194e97e0057f7d4 100644 (file)
@@ -2088,10 +2088,12 @@ typedef struct AVCodecContext {
      */
     attribute_deprecated
     float rc_qsquish;
-#endif
 
+    attribute_deprecated
     float rc_qmod_amp;
+    attribute_deprecated
     int rc_qmod_freq;
+#endif
 
     /**
      * decoder bitstream buffer size
index 56e92429429e789a98507a0e9d7fe72bf4ccd46c..e96671be14cea10edcfba438e5c08410aae6e5be 100644 (file)
@@ -28,6 +28,8 @@
 #ifndef AVCODEC_MPEGVIDEO_H
 #define AVCODEC_MPEGVIDEO_H
 
+#include <float.h>
+
 #include "avcodec.h"
 #include "blockdsp.h"
 #include "error_resilience.h"
@@ -633,6 +635,8 @@ typedef struct MpegEncContext {
      * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax.
      */
     float rc_qsquish;
+    float rc_qmod_amp;
+    int   rc_qmod_freq;
 
     /* temp buffers for rate control */
     float *cplx_tab, *bits_tab;
@@ -680,7 +684,9 @@ typedef struct MpegEncContext {
 { "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 },\
 {"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},
+                                                                    FF_MPV_OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, 0, 99, FF_MPV_OPT_FLAGS},                        \
+{"rc_qmod_amp", "experimental quantizer modulation",                FF_MPV_OFFSET(rc_qmod_amp), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS},           \
+{"rc_qmod_freq", "experimental quantizer modulation",               FF_MPV_OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS},
 
 extern const AVOption ff_mpv_generic_options[];
 
index 5c327eaf442e7a20d5d8cb8338d821fde599b6e9..952a34a8c31451b10772a3913b354f4405e4d8fb 100644 (file)
@@ -826,6 +826,10 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
     FF_DISABLE_DEPRECATION_WARNINGS
     if (avctx->rc_qsquish != 0.0)
         s->rc_qsquish = avctx->rc_qsquish;
+    if (avctx->rc_qmod_amp != 0.0)
+        s->rc_qmod_amp = avctx->rc_qmod_amp;
+    if (avctx->rc_qmod_freq)
+        s->rc_qmod_freq = avctx->rc_qmod_freq;
     FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
index e9393fc908d2224caa6676289bd1ab9280ae18ee..ef89e7a8cd4d80630c5e3392e7a142bdaa47ea64 100644 (file)
@@ -165,9 +165,9 @@ static const AVOption avcodec_options[] = {
 {"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, 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},
+{"rc_qmod_amp",  "deprecated, use encoder private options instead", OFFSET(rc_qmod_amp), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E},
+{"rc_qmod_freq", "deprecated, use encoder private options instead", OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, 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},
 {"rc_eq", "Set rate control equation. When computing the expression, besides the standard functions "
           "defined in the section 'Expression Evaluation', the following functions are available: "
index fcc5c6030ab3b0c838343f98ccd5b12808fefad8..92438b46f025070a4dc4d5c0963401ad230933d8 100644 (file)
@@ -500,10 +500,10 @@ static double modify_qscale(MpegEncContext *s, RateControlEntry *rce,
     get_qminmax(&qmin, &qmax, s, pict_type);
 
     /* modulation */
-    if (s->avctx->rc_qmod_freq &&
-        frame_num % s->avctx->rc_qmod_freq == 0 &&
+    if (s->rc_qmod_freq &&
+        frame_num % s->rc_qmod_freq == 0 &&
         pict_type == AV_PICTURE_TYPE_P)
-        q *= s->avctx->rc_qmod_amp;
+        q *= s->rc_qmod_amp;
 
     /* buffer overflow/underflow protection */
     if (buffer_size) {