From 1482aff2048511b821ff9feac19426113cc641a2 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Sun, 13 Sep 2015 23:45:24 +0200 Subject: lavc: Move noise_reduction to codec private options This option is only used by mpegvideoenc, x264, xavs, and vpx. It is a very codec-specific option, so deprecate the global variant. Signed-off-by: Vittorio Giovara --- libavcodec/mpegvideo_enc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'libavcodec/mpegvideo_enc.c') diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 29358dda2f..55cd6f833a 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -721,6 +721,13 @@ FF_ENABLE_DEPRECATION_WARNINGS return -1; } +#if FF_API_PRIVATE_OPT + FF_DISABLE_DEPRECATION_WARNINGS + if (avctx->noise_reduction) + s->noise_reduction = avctx->noise_reduction; + FF_ENABLE_DEPRECATION_WARNINGS +#endif + avctx->has_b_frames = !s->low_delay; s->encoding = 1; @@ -760,7 +767,8 @@ FF_ENABLE_DEPRECATION_WARNINGS FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture *), fail); - if (s->avctx->noise_reduction) { + + if (s->noise_reduction) { FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail); } @@ -1564,7 +1572,7 @@ static void update_noise_reduction(MpegEncContext *s) } for (i = 0; i < 64; i++) { - s->dct_offset[intra][i] = (s->avctx->noise_reduction * + s->dct_offset[intra][i] = (s->noise_reduction * s->dct_count[intra] + s->dct_error_sum[intra][i] / 2) / (s->dct_error_sum[intra][i] + 1); @@ -1637,7 +1645,7 @@ static int frame_start(MpegEncContext *s) } if (s->dct_error_sum) { - assert(s->avctx->noise_reduction && s->encoding); + assert(s->noise_reduction && s->encoding); update_noise_reduction(s); } @@ -3315,7 +3323,7 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) MERGE(current_picture.encoding_error[1]); MERGE(current_picture.encoding_error[2]); - if(dst->avctx->noise_reduction){ + if (dst->noise_reduction){ for(i=0; i<64; i++){ MERGE(dct_error_sum[0][i]); MERGE(dct_error_sum[1][i]); -- cgit v1.2.1