diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-20 17:09:58 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-01 05:46:39 +0400 |
commit | 46b06bd894f0d69ce137503a06249e8a9bb8f840 (patch) | |
tree | a717ee362bdb6f4d96ae093f36185818829345f5 /libavcodec/mpegvideo_enc.c | |
parent | 21a2fb7e0579703fdea96f659498ef8b1f243289 (diff) |
avcodec/mpegvideo_enc: implement frame skip score normalization
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 6bf3e384c6..5828a27c50 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1145,7 +1145,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->dsp.frame_skip_cmp[1](s, dptr, rptr, stride, 8); - switch (s->avctx->frame_skip_exp) { + switch (FFABS(s->avctx->frame_skip_exp)) { case 0: score = FFMAX(score, v); break; case 1: score += FFABS(v); break; case 2: score64 += v * (int64_t)v; break; @@ -1155,9 +1155,13 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref) } } } + emms_c(); if (score) score64 = score; + if (s->avctx->frame_skip_exp < 0) + score64 = pow(score64 / (double)(s->mb_width * s->mb_height), + -1.0/s->avctx->frame_skip_exp); if (score64 < s->avctx->frame_skip_threshold) return 1; @@ -1307,7 +1311,6 @@ static int select_input_picture(MpegEncContext *s) // FIXME check that te gop check above is +-1 correct av_frame_unref(&s->input_picture[0]->f); - emms_c(); ff_vbv_update(s, 0); goto no_output_pic; |