avcodec/mpegvideo_enc: fix padding for odd dimensions and interlaced video

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-11 04:59:05 +02:00
parent c69defd4d0
commit 60ab6e2457
5 changed files with 23 additions and 18 deletions

View 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);
}
}

View 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

View 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

View 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

View 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