summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-18 13:51:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-18 13:52:06 +0200
commit17a065cf204fb626b6940b1bc3df5d6ab9f4a468 (patch)
treebfb481ba8df17aaf8bba25bdfcda02e1d8ad21c0 /libavcodec
parent74128352047ee3fb075b0f69ab16047f70b45a42 (diff)
parent946f95354ba76ef73c9b66889d86ab5fba4fb486 (diff)
downloadffmpeg-streaming-17a065cf204fb626b6940b1bc3df5d6ab9f4a468.zip
ffmpeg-streaming-17a065cf204fb626b6940b1bc3df5d6ab9f4a468.tar.gz
Merge commit '946f95354ba76ef73c9b66889d86ab5fba4fb486'
* commit '946f95354ba76ef73c9b66889d86ab5fba4fb486': lavc: make rc_qmod_* into private options of mpegvideo encoders Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h4
-rw-r--r--libavcodec/mpegvideo.h8
-rw-r--r--libavcodec/mpegvideo_enc.c4
-rw-r--r--libavcodec/options_table.h4
-rw-r--r--libavcodec/ratecontrol.c6
5 files changed, 19 insertions, 7 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6ed8304..9b6a0bf 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2277,10 +2277,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
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 72e1b4d..7e3d35c 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -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"
@@ -655,6 +657,8 @@ typedef struct MpegEncContext {
* 0-> clipping, 1-> use a nice continuous function to limit qscale within qmin/qmax.
*/
float rc_qsquish;
+ float rc_qmod_amp;
+ int rc_qmod_freq;
/* temp buffers for rate control */
float *cplx_tab, *bits_tab;
@@ -702,7 +706,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[];
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index bdf70eb..76fb654 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -954,6 +954,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
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index a55b4cb..797f6de 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -176,9 +176,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: "
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 6176144..78f4db3 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -517,10 +517,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) {
OpenPOWER on IntegriCloud