Commit 709ab39c authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '15ec053c'

* commit '15ec053c':
  lavc: make border_masking into private options of mpegvideo encoders
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 1a5871d1 15ec053c
...@@ -1829,13 +1829,13 @@ typedef struct AVCodecContext { ...@@ -1829,13 +1829,13 @@ typedef struct AVCodecContext {
*/ */
int skip_bottom; int skip_bottom;
#if FF_API_MPV_OPT
/** /**
* Border processing masking, raises the quantizer for mbs on the borders * @deprecated use encoder private options instead
* of the picture.
* - encoding: Set by user.
* - decoding: unused
*/ */
attribute_deprecated
float border_masking; float border_masking;
#endif
/** /**
* minimum MB lagrange multipler * minimum MB lagrange multipler
......
...@@ -661,6 +661,7 @@ typedef struct MpegEncContext { ...@@ -661,6 +661,7 @@ typedef struct MpegEncContext {
int rc_qmod_freq; int rc_qmod_freq;
float rc_initial_cplx; float rc_initial_cplx;
float rc_buffer_aggressivity; float rc_buffer_aggressivity;
float border_masking;
char *rc_eq; char *rc_eq;
...@@ -720,6 +721,7 @@ typedef struct MpegEncContext { ...@@ -720,6 +721,7 @@ typedef struct MpegEncContext {
FF_MPV_OFFSET(rc_eq), AV_OPT_TYPE_STRING, .flags = FF_MPV_OPT_FLAGS }, \ FF_MPV_OFFSET(rc_eq), AV_OPT_TYPE_STRING, .flags = FF_MPV_OPT_FLAGS }, \
{"rc_init_cplx", "initial complexity for 1-pass encoding", FF_MPV_OFFSET(rc_initial_cplx), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \ {"rc_init_cplx", "initial complexity for 1-pass encoding", FF_MPV_OFFSET(rc_initial_cplx), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \
{"rc_buf_aggressivity", "currently useless", FF_MPV_OFFSET(rc_buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \ {"rc_buf_aggressivity", "currently useless", FF_MPV_OFFSET(rc_buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \
{"border_mask", "increase the quantizer for macroblocks close to borders", FF_MPV_OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, FF_MPV_OPT_FLAGS}, \
extern const AVOption ff_mpv_generic_options[]; extern const AVOption ff_mpv_generic_options[];
......
...@@ -374,12 +374,19 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) ...@@ -374,12 +374,19 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
/* Fixed QSCALE */ /* Fixed QSCALE */
s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE); s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE);
#if FF_API_MPV_OPT
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->border_masking != 0.0)
s->border_masking = avctx->border_masking;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
s->adaptive_quant = (s->avctx->lumi_masking || s->adaptive_quant = (s->avctx->lumi_masking ||
s->avctx->dark_masking || s->avctx->dark_masking ||
s->avctx->temporal_cplx_masking || s->avctx->temporal_cplx_masking ||
s->avctx->spatial_cplx_masking || s->avctx->spatial_cplx_masking ||
s->avctx->p_masking || s->avctx->p_masking ||
s->avctx->border_masking || s->border_masking ||
(s->mpv_flags & FF_MPV_FLAG_QP_RD)) && (s->mpv_flags & FF_MPV_FLAG_QP_RD)) &&
!s->fixed_qscale; !s->fixed_qscale;
......
...@@ -366,7 +366,9 @@ static const AVOption avcodec_options[] = { ...@@ -366,7 +366,9 @@ static const AVOption avcodec_options[] = {
{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, {"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"},
{"border_mask", "increase the quantizer for macroblocks close to borders", OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, #if FF_API_MPV_OPT
{"border_mask", "deprecated, use encoder private options instead", OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E},
#endif
{"mblmin", "minimum macroblock Lagrange factor (VBR)", OFFSET(mb_lmin), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E}, {"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}, {"mblmax", "maximum macroblock Lagrange factor (VBR)", OFFSET(mb_lmax), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 31 }, 1, FF_LAMBDA_MAX, V|E},
{"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}, {"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},
......
...@@ -619,7 +619,7 @@ static void adaptive_quantization(MpegEncContext *s, double q) ...@@ -619,7 +619,7 @@ static void adaptive_quantization(MpegEncContext *s, double q)
const float temp_cplx_masking = s->avctx->temporal_cplx_masking; const float temp_cplx_masking = s->avctx->temporal_cplx_masking;
const float spatial_cplx_masking = s->avctx->spatial_cplx_masking; const float spatial_cplx_masking = s->avctx->spatial_cplx_masking;
const float p_masking = s->avctx->p_masking; const float p_masking = s->avctx->p_masking;
const float border_masking = s->avctx->border_masking; const float border_masking = s->border_masking;
float bits_sum = 0.0; float bits_sum = 0.0;
float cplx_sum = 0.0; float cplx_sum = 0.0;
float *cplx_tab = s->cplx_tab; float *cplx_tab = s->cplx_tab;
......
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