summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-01-28 15:08:10 +0000
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-01-28 15:08:10 +0000
commit13be46c08e59141408f1a7afd4737826afa87f11 (patch)
tree83466267710058994b498df467287a2d74a72e55 /libavcodec/mpegvideo_enc.c
parent4f32ccb61800ef1a0acf02010784da4f15adde44 (diff)
parent0ac9f33a9e69c64eee592791be3c5441a6a3d6b7 (diff)
Merge commit '0ac9f33a9e69c64eee592791be3c5441a6a3d6b7'
* commit '0ac9f33a9e69c64eee592791be3c5441a6a3d6b7': lavc: Move frame_skip_* to codec private options Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 948f39591e..576c4e74f8 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -934,8 +934,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->quant_precision = 5;
+#if FF_API_PRIVATE_OPT
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (avctx->frame_skip_threshold)
+ s->frame_skip_threshold = avctx->frame_skip_threshold;
+ if (avctx->frame_skip_factor)
+ s->frame_skip_factor = avctx->frame_skip_factor;
+ if (avctx->frame_skip_exp)
+ s->frame_skip_exp = avctx->frame_skip_exp;
+ if (avctx->frame_skip_cmp != FF_CMP_DCTMAX)
+ s->frame_skip_cmp = avctx->frame_skip_cmp;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
ff_set_cmp(&s->mecc, s->mecc.ildct_cmp, s->avctx->ildct_cmp);
- ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->avctx->frame_skip_cmp);
+ ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->frame_skip_cmp);
if (CONFIG_H261_ENCODER && s->out_format == FMT_H261)
ff_h261_encode_init(s);
@@ -1317,7 +1330,7 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref)
uint8_t *rptr = ref->f->data[plane] + 8 * (x + y * stride);
int v = s->mecc.frame_skip_cmp[1](s, dptr, rptr, stride, 8);
- switch (FFABS(s->avctx->frame_skip_exp)) {
+ switch (FFABS(s->frame_skip_exp)) {
case 0: score = FFMAX(score, v); break;
case 1: score += FFABS(v); break;
case 2: score64 += v * (int64_t)v; break;
@@ -1331,13 +1344,13 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref)
if (score)
score64 = score;
- if (s->avctx->frame_skip_exp < 0)
+ if (s->frame_skip_exp < 0)
score64 = pow(score64 / (double)(s->mb_width * s->mb_height),
- -1.0/s->avctx->frame_skip_exp);
+ -1.0/s->frame_skip_exp);
- if (score64 < s->avctx->frame_skip_threshold)
+ if (score64 < s->frame_skip_threshold)
return 1;
- if (score64 < ((s->avctx->frame_skip_factor * (int64_t)s->lambda) >> 8))
+ if (score64 < ((s->frame_skip_factor * (int64_t) s->lambda) >> 8))
return 1;
return 0;
}
@@ -1485,7 +1498,7 @@ static int select_input_picture(MpegEncContext *s)
/* set next picture type & ordering */
if (!s->reordered_input_picture[0] && s->input_picture[0]) {
- if (s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor) {
+ if (s->frame_skip_threshold || s->frame_skip_factor) {
if (s->picture_in_gop_number < s->gop_size &&
s->next_picture_ptr &&
skip_check(s, s->input_picture[0], s->next_picture_ptr)) {