Commit 1761ab83 authored by Vittorio Giovara's avatar Vittorio Giovara

lavc: Deprecate avctx.rc_strategy

Only used by libxvid in ratecontrol module, so move it to a codec
private option.
Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent 02b7c630
...@@ -1342,9 +1342,11 @@ typedef struct AVCodecContext { ...@@ -1342,9 +1342,11 @@ typedef struct AVCodecContext {
*/ */
float b_quant_factor; float b_quant_factor;
/** obsolete FIXME remove */ #if FF_API_RC_STRATEGY
int rc_strategy; /** @deprecated use codec private option instead */
attribute_deprecated int rc_strategy;
#define FF_RC_STRATEGY_XVID 1 #define FF_RC_STRATEGY_XVID 1
#endif
int b_frame_strategy; int b_frame_strategy;
......
...@@ -360,6 +360,7 @@ typedef struct MpegEncContext { ...@@ -360,6 +360,7 @@ typedef struct MpegEncContext {
int prev_mb_info, last_mb_info; int prev_mb_info, last_mb_info;
uint8_t *mb_info_ptr; uint8_t *mb_info_ptr;
int mb_info_size; int mb_info_size;
int rc_strategy;
/* H.263+ specific */ /* H.263+ specific */
int umvplus; ///< == H263+ && unrestricted_mv int umvplus; ///< == H263+ && unrestricted_mv
...@@ -573,6 +574,7 @@ typedef struct MpegEncContext { ...@@ -573,6 +574,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 }, \ {"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 }, \ {"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 }, \ {"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[]; extern const AVOption ff_mpv_generic_options[];
......
...@@ -114,7 +114,9 @@ static const AVOption avcodec_options[] = { ...@@ -114,7 +114,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}, {"qdiff", "maximum difference between the quantizer scales (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.i64 = 3 }, INT_MIN, INT_MAX, V|E},
{"bf", "use 'frames' B frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, -1, INT_MAX, V|E}, {"bf", "use 'frames' 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}, {"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}, {"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}, {"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}, {"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}, {"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
*/ */
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
#include "ratecontrol.h" #include "ratecontrol.h"
...@@ -135,6 +137,13 @@ av_cold int ff_rate_control_init(MpegEncContext *s) ...@@ -135,6 +137,13 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
return res; 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++) { for (i = 0; i < 5; i++) {
rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0; rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0;
rcc->pred[i].count = 1.0; rcc->pred[i].count = 1.0;
...@@ -218,7 +227,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s) ...@@ -218,7 +227,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
} }
// FIXME maybe move to end // 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 #if CONFIG_LIBXVID
return ff_xvid_rate_control_init(s); return ff_xvid_rate_control_init(s);
#else #else
...@@ -298,7 +307,7 @@ av_cold void ff_rate_control_uninit(MpegEncContext *s) ...@@ -298,7 +307,7 @@ av_cold void ff_rate_control_uninit(MpegEncContext *s)
av_freep(&rcc->entry); av_freep(&rcc->entry);
#if CONFIG_LIBXVID #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); ff_xvid_rate_control_uninit(s);
#endif #endif
} }
...@@ -748,8 +757,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) ...@@ -748,8 +757,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
emms_c(); emms_c();
#if CONFIG_LIBXVID #if CONFIG_LIBXVID
if ((s->avctx->flags & CODEC_FLAG_PASS2) && if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->rc_strategy == 1)
s->avctx->rc_strategy == FF_RC_STRATEGY_XVID)
return ff_xvid_rate_estimate_qscale(s, dry_run); return ff_xvid_rate_estimate_qscale(s, dry_run);
#endif #endif
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 56 #define LIBAVCODEC_VERSION_MAJOR 56
#define LIBAVCODEC_VERSION_MINOR 31 #define LIBAVCODEC_VERSION_MINOR 31
#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_MICRO 2
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \
...@@ -168,5 +168,8 @@ ...@@ -168,5 +168,8 @@
#ifndef FF_API_QUANT_BIAS #ifndef FF_API_QUANT_BIAS
#define FF_API_QUANT_BIAS (LIBAVCODEC_VERSION_MAJOR < 59) #define FF_API_QUANT_BIAS (LIBAVCODEC_VERSION_MAJOR < 59)
#endif #endif
#ifndef FF_API_RC_STRATEGY
#define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
#endif /* AVCODEC_VERSION_H */ #endif /* AVCODEC_VERSION_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment