summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-11 04:59:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-11 05:02:46 +0200
commit60ab6e24574a984655800d1f7ce16c05f4e9b28c (patch)
tree58081e288e69a0e8b99aecd40208bd58ed32b8aa
parentc69defd4d014e27cbcf207fe6facaebb02ba1285 (diff)
avcodec/mpegvideo_enc: fix padding for odd dimensions and interlaced video
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mpegvideo_enc.c9
-rw-r--r--tests/ref/vsynth/vsynth3-mpeg2-4228
-rw-r--r--tests/ref/vsynth/vsynth3-mpeg2-ilace8
-rw-r--r--tests/ref/vsynth/vsynth3-mpeg2-thread8
-rw-r--r--tests/ref/vsynth/vsynth3-mpeg2-thread-ivlc8
5 files changed, 23 insertions, 18 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ba17b2c6ce..be5ccd538c 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1120,6 +1120,11 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
int h = s->height >> v_shift;
uint8_t *src = pic_arg->data[i];
uint8_t *dst = pic->f->data[i];
+ int vpad = 16;
+
+ if ( s->codec_id == AV_CODEC_ID_MPEG2VIDEO
+ && !s->progressive_sequence)
+ vpad = 32;
if (!s->avctx->rc_buffer_size)
dst += INPLACE_OFFSET;
@@ -1135,11 +1140,11 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
src += src_stride;
}
}
- if ((s->width & 15) || (s->height & 15)) {
+ if ((s->width & 15) || (s->height & (vpad-1))) {
s->dsp.draw_edges(dst, dst_stride,
w, h,
16>>h_shift,
- 16>>v_shift,
+ vpad>>v_shift,
EDGE_BOTTOM);
}
}
diff --git a/tests/ref/vsynth/vsynth3-mpeg2-422 b/tests/ref/vsynth/vsynth3-mpeg2-422
index 521aa1f9f8..2247f286e6 100644
--- a/tests/ref/vsynth/vsynth3-mpeg2-422
+++ b/tests/ref/vsynth/vsynth3-mpeg2-422
@@ -1,4 +1,4 @@
-6126aef5d72f25defd5ebf5154123fb2 *tests/data/fate/vsynth3-mpeg2-422.mpeg2video
-68916 tests/data/fate/vsynth3-mpeg2-422.mpeg2video
-9b434cef28b4f418b20b7e3a09a7a082 *tests/data/fate/vsynth3-mpeg2-422.out.rawvideo
-stddev: 4.01 PSNR: 36.06 MAXDIFF: 46 bytes: 86700/ 86700
+4d108b861715f1fa010fd70baea91793 *tests/data/fate/vsynth3-mpeg2-422.mpeg2video
+68612 tests/data/fate/vsynth3-mpeg2-422.mpeg2video
+73b16e906d07b6bbccf4b00d4a25302c *tests/data/fate/vsynth3-mpeg2-422.out.rawvideo
+stddev: 4.02 PSNR: 36.05 MAXDIFF: 46 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth3-mpeg2-ilace b/tests/ref/vsynth/vsynth3-mpeg2-ilace
index 1097907780..fe2720ef57 100644
--- a/tests/ref/vsynth/vsynth3-mpeg2-ilace
+++ b/tests/ref/vsynth/vsynth3-mpeg2-ilace
@@ -1,4 +1,4 @@
-7aafb678757a42197e2da7061262b588 *tests/data/fate/vsynth3-mpeg2-ilace.mpeg2video
-35293 tests/data/fate/vsynth3-mpeg2-ilace.mpeg2video
-3f9fa819daa94fd137db0e20325e9566 *tests/data/fate/vsynth3-mpeg2-ilace.out.rawvideo
-stddev: 9.09 PSNR: 28.95 MAXDIFF: 68 bytes: 86700/ 86700
+c13776ac25a9a9553847abddabd41915 *tests/data/fate/vsynth3-mpeg2-ilace.mpeg2video
+35773 tests/data/fate/vsynth3-mpeg2-ilace.mpeg2video
+78861ce7b0d433205e45960e1fadd911 *tests/data/fate/vsynth3-mpeg2-ilace.out.rawvideo
+stddev: 9.10 PSNR: 28.95 MAXDIFF: 62 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth3-mpeg2-thread b/tests/ref/vsynth/vsynth3-mpeg2-thread
index 3c75cc6078..faf10716a2 100644
--- a/tests/ref/vsynth/vsynth3-mpeg2-thread
+++ b/tests/ref/vsynth/vsynth3-mpeg2-thread
@@ -1,4 +1,4 @@
-45e63e4c71fd113fd70bb5e3d70e345f *tests/data/fate/vsynth3-mpeg2-thread.mpeg2video
-40669 tests/data/fate/vsynth3-mpeg2-thread.mpeg2video
-556b5626c8740332309c45f3371dcf82 *tests/data/fate/vsynth3-mpeg2-thread.out.rawvideo
-stddev: 8.82 PSNR: 29.22 MAXDIFF: 64 bytes: 86700/ 86700
+adceaea1136d072c629d8be517f8d96d *tests/data/fate/vsynth3-mpeg2-thread.mpeg2video
+40356 tests/data/fate/vsynth3-mpeg2-thread.mpeg2video
+917f425ebc14d29783d184d90f493e86 *tests/data/fate/vsynth3-mpeg2-thread.out.rawvideo
+stddev: 8.93 PSNR: 29.11 MAXDIFF: 64 bytes: 86700/ 86700
diff --git a/tests/ref/vsynth/vsynth3-mpeg2-thread-ivlc b/tests/ref/vsynth/vsynth3-mpeg2-thread-ivlc
index f3ee8e2f43..8ac72f1fae 100644
--- a/tests/ref/vsynth/vsynth3-mpeg2-thread-ivlc
+++ b/tests/ref/vsynth/vsynth3-mpeg2-thread-ivlc
@@ -1,4 +1,4 @@
-652f090a82ee947ac48fcba27a29984f *tests/data/fate/vsynth3-mpeg2-thread-ivlc.mpeg2video
-40433 tests/data/fate/vsynth3-mpeg2-thread-ivlc.mpeg2video
-556b5626c8740332309c45f3371dcf82 *tests/data/fate/vsynth3-mpeg2-thread-ivlc.out.rawvideo
-stddev: 8.82 PSNR: 29.22 MAXDIFF: 64 bytes: 86700/ 86700
+221231dae1cd87b8c51a8f4772be6632 *tests/data/fate/vsynth3-mpeg2-thread-ivlc.mpeg2video
+40091 tests/data/fate/vsynth3-mpeg2-thread-ivlc.mpeg2video
+917f425ebc14d29783d184d90f493e86 *tests/data/fate/vsynth3-mpeg2-thread-ivlc.out.rawvideo
+stddev: 8.93 PSNR: 29.11 MAXDIFF: 64 bytes: 86700/ 86700