summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-09-13 23:45:24 +0200
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-01-21 15:33:19 -0500
commit1482aff2048511b821ff9feac19426113cc641a2 (patch)
treeb8254bb7874f24fe6f368afc7c0a37dba8175d3c /libavcodec/mpegvideo_enc.c
parent7c79587d7407dab4b9445d66b5f111fe657c8c4d (diff)
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 <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c16
1 files changed, 12 insertions, 4 deletions
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]);