avcodec/mpegvideo_enc: fix padding for odd dimensions and interlaced video
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Jun 2014 02:59:05 +0000 (04:59 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Jun 2014 03:02:46 +0000 (05:02 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpegvideo_enc.c
tests/ref/vsynth/vsynth3-mpeg2-422
tests/ref/vsynth/vsynth3-mpeg2-ilace
tests/ref/vsynth/vsynth3-mpeg2-thread
tests/ref/vsynth/vsynth3-mpeg2-thread-ivlc

index ba17b2c..be5ccd5 100644 (file)
@@ -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);
                     }
                 }
index 521aa1f..2247f28 100644 (file)
@@ -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
index 1097907..fe2720e 100644 (file)
@@ -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
index 3c75cc6..faf1071 100644 (file)
@@ -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
index f3ee8e2..8ac72f1 100644 (file)
@@ -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