Commit 5b6f42da authored by Vittorio Giovara's avatar Vittorio Giovara

lavc: Move me_penalty_compensation to codec private options

This option is only used by mpegvideoenc.
It is a very codec-specific options, so deprecate the global variant.
Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent 2862b637
......@@ -1938,12 +1938,13 @@ typedef struct AVCodecContext {
*/
int mb_lmax;
#if FF_API_PRIVATE_OPT
/**
*
* - encoding: Set by user.
* - decoding: unused
* @deprecated use encoder private options instead
*/
attribute_deprecated
int me_penalty_compensation;
#endif
/**
*
......
......@@ -250,6 +250,7 @@ typedef struct MpegEncContext {
int me_method; ///< ME algorithm
#endif
int motion_est; ///< ME algorithm
int me_penalty_compensation;
int mv_dir;
#define MV_DIR_FORWARD 1
#define MV_DIR_BACKWARD 2
......@@ -616,6 +617,7 @@ FF_MPV_OPT_CMP_FUNC, \
{"noise_reduction", "Noise reduction", FF_MPV_OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"mpeg_quant", "Use MPEG quantizers instead of H.263", FF_MPV_OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, FF_MPV_OPT_FLAGS }, \
{"ps", "RTP payload size in bytes", FF_MPV_OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"mepc", "Motion estimation bitrate penalty compensation (1.0 = 256)", FF_MPV_OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.i64 = 256 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
extern const AVOption ff_mpv_generic_options[];
......
......@@ -298,6 +298,8 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->rtp_payload_size)
s->rtp_payload_size = avctx->rtp_payload_size;
if (avctx->me_penalty_compensation)
s->me_penalty_compensation = avctx->me_penalty_compensation;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
......@@ -3460,8 +3462,8 @@ static int encode_picture(MpegEncContext *s, int picture_number)
/* Estimate motion for every MB */
if(s->pict_type != AV_PICTURE_TYPE_I){
s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8;
s->lambda2= (s->lambda2* (int64_t)s->avctx->me_penalty_compensation + 128)>>8;
s->lambda = (s->lambda * s->me_penalty_compensation + 128) >> 8;
s->lambda2 = (s->lambda2 * (int64_t) s->me_penalty_compensation + 128) >> 8;
if (s->pict_type != AV_PICTURE_TYPE_B) {
if((s->avctx->pre_me && s->last_non_b_pict_type==AV_PICTURE_TYPE_I) || s->avctx->pre_me==2){
s->avctx->execute(s->avctx, pre_estimate_motion_thread, &s->thread_context[0], NULL, context_count, sizeof(void*));
......
......@@ -384,7 +384,9 @@ static const AVOption avcodec_options[] = {
#endif
{"mblmin", "minimum macroblock Lagrange factor (VBR)", OFFSET(mb_lmin), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E},
{"mblmax", "maximum macroblock Lagrange factor (VBR)", OFFSET(mb_lmax), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 31 }, 1, FF_LAMBDA_MAX, V|E},
#if FF_API_PRIVATE_OPT
{"mepc", "motion estimation bitrate penalty compensation (1.0 = 256)", OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.i64 = 256 }, INT_MIN, INT_MAX, V|E},
#endif
{"skip_loop_filter", NULL, OFFSET(skip_loop_filter), AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
{"skip_idct" , NULL, OFFSET(skip_idct) , AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
{"skip_frame" , NULL, OFFSET(skip_frame) , AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
......
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