aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-07-09 01:17:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-07-09 01:17:49 +0200
commit4a2bcdb28b510ae1378b82acf422f8c8ff8a4635 (patch)
treed4853a92b57fe47e3a618e8833fd7a309dac8e8a
parentedfcbf7c83cb7828c0531e788ba8c5c47b07fc5f (diff)
parent1761ab838c75223a6b97d8c0720d09275374c53d (diff)
downloadffmpeg-4a2bcdb28b510ae1378b82acf422f8c8ff8a4635.tar.gz
Merge commit '1761ab838c75223a6b97d8c0720d09275374c53d'
* commit '1761ab838c75223a6b97d8c0720d09275374c53d': lavc: Deprecate avctx.rc_strategy Conflicts: libavcodec/mpegvideo.h libavcodec/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/avcodec.h6
-rw-r--r--libavcodec/mpegvideo.h2
-rw-r--r--libavcodec/options_table.h2
-rw-r--r--libavcodec/ratecontrol.c16
-rw-r--r--libavcodec/version.h5
5 files changed, 24 insertions, 7 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e367399deb..738f4db9cb 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1538,9 +1538,11 @@ typedef struct AVCodecContext {
*/
float b_quant_factor;
- /** obsolete FIXME remove */
- int rc_strategy;
+#if FF_API_RC_STRATEGY
+ /** @deprecated use codec private option instead */
+ attribute_deprecated int rc_strategy;
#define FF_RC_STRATEGY_XVID 1
+#endif
int b_frame_strategy;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 7b8a812c6e..fca6daf1f5 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -372,6 +372,7 @@ typedef struct MpegEncContext {
uint8_t *mb_info_ptr;
int mb_info_size;
int ehc_mode;
+ int rc_strategy;
/* H.263+ specific */
int umvplus; ///< == H263+ && unrestricted_mv
@@ -595,6 +596,7 @@ typedef struct MpegEncContext {
{"lmax", "maximum Lagrange factor (VBR)", FF_MPV_OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"ibias", "intra quant bias", FF_MPV_OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"pbias", "inter quant bias", FF_MPV_OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
+{"rc_strategy", "ratecontrol method", FF_MPV_OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, FF_MPV_OPT_FLAGS }, \
extern const AVOption ff_mpv_generic_options[];
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index e68bdc5716..140df709ac 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -120,7 +120,9 @@ static const AVOption avcodec_options[] = {
{"qdiff", "maximum difference between the quantizer scales (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.i64 = 3 }, INT_MIN, INT_MAX, V|E},
{"bf", "set maximum number of B frames between non-B-frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, -1, INT_MAX, V|E},
{"b_qfactor", "QP factor between P- and B-frames", OFFSET(b_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E},
+#if FF_API_RC_STRATEGY
{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E},
{"ps", "RTP payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index c6a51a2486..4c9b7b55ee 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -26,6 +26,8 @@
*/
#include "libavutil/attributes.h"
+#include "libavutil/internal.h"
+
#include "avcodec.h"
#include "internal.h"
#include "ratecontrol.h"
@@ -144,6 +146,13 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
return res;
}
+#if FF_API_RC_STRATEGY
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (!s->rc_strategy)
+ s->rc_strategy = s->avctx->rc_strategy;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
for (i = 0; i < 5; i++) {
rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0;
rcc->pred[i].count = 1.0;
@@ -229,7 +238,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
}
// FIXME maybe move to end
- if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) {
+ if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->rc_strategy == 1) {
#if CONFIG_LIBXVID
return ff_xvid_rate_control_init(s);
#else
@@ -309,7 +318,7 @@ av_cold void ff_rate_control_uninit(MpegEncContext *s)
av_freep(&rcc->entry);
#if CONFIG_LIBXVID
- if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID)
+ if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->rc_strategy == 1)
ff_xvid_rate_control_uninit(s);
#endif
}
@@ -762,8 +771,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
emms_c();
#if CONFIG_LIBXVID
- if ((s->avctx->flags & CODEC_FLAG_PASS2) &&
- s->avctx->rc_strategy == FF_RC_STRATEGY_XVID)
+ if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->rc_strategy == 1)
return ff_xvid_rate_estimate_qscale(s, dry_run);
#endif
diff --git a/libavcodec/version.h b/libavcodec/version.h
index d2bba0aeba..f315c87e44 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 56
#define LIBAVCODEC_VERSION_MINOR 46
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@@ -193,5 +193,8 @@
#ifndef FF_API_QUANT_BIAS
#define FF_API_QUANT_BIAS (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
+#ifndef FF_API_RC_STRATEGY
+#define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
#endif /* AVCODEC_VERSION_H */