From 01e8ff27b449ca8d7263165a29669a313a93e978 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 7 Dec 2003 02:10:30 +0000 Subject: [PATCH] slice flush / position fix Originally committed as revision 2569 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpegvideo.c | 6 ++++-- tests/ffmpeg.regression.ref | 6 +++--- tests/rotozoom.regression.ref | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 9b04bafcc7..1e5e59b62a 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -3916,7 +3916,9 @@ static void encode_picture(MpegEncContext *s, int picture_number) ff_mpeg4_stuffing(&s->pb); align_put_bits(&s->pb); -// flush_put_bits(&s->pb); + flush_put_bits(&s->pb); + + assert((get_bit_count(&s->pb)&7) == 0); current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob; if (s->avctx->rtp_callback) @@ -3944,7 +3946,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) s->last_bits= bits; } - s->ptr_lastgob = pbBufPtr(&s->pb); + s->ptr_lastgob += current_packet_size; s->first_slice_line=1; s->resync_mb_x=mb_x; s->resync_mb_y=mb_y; diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index 406ac28ff5..2e9aa5eb33 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -32,10 +32,10 @@ stddev: 0.00 bytes:7602176 e9f63126859b97cd23cd1413038f8f7b *./data/a-mpeg4-rc.avi 90a159074b1b109569914ee63f387860 *./data/out.yuv stddev: 10.18 bytes:7145472 -dfe8fcd409a0605ef0cb37fc5e76ecf7 *./data/a-mpeg4-adv.avi -c8877a6b8ed290a637c2119860b468b0 *./data/out.yuv +b3f1425e266569d5d726b88eadc13dd4 *./data/a-mpeg4-adv.avi +fb61365b22c947adbaeab74478579020 *./data/out.yuv stddev: 7.31 bytes:7602176 -cf79878f8851b5c865711842965a6c4a *./data/a-mpeg1b.mpg +eeca82dbf25257928663261428960710 *./data/a-mpeg1b.mpg 41b3baa7d8c17202e6577947ac37cad0 *./data/out.yuv stddev: 6.32 bytes:6842368 07042f42b3119c39eb26537a84a451df *./data/a-mjpeg.avi diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index 9134b2d49b..824dae002b 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -32,10 +32,10 @@ stddev: 0.00 bytes:7602176 6a469f42ce6946dd4c708f9e51e3da6a *./data/a-mpeg4-rc.avi df9de7134d961119705b4e0cabca1f12 *./data/out.yuv stddev: 4.20 bytes:7145472 -bb11d9808375911ea63d4f0889306037 *./data/a-mpeg4-adv.avi -e465df12f2c8a6492a6ec0b1bddc1d0d *./data/out.yuv +742ffadf3c309d2c4ac888a6a0905bf9 *./data/a-mpeg4-adv.avi +b02f71e91e9368ce94814ab3d74f91ba *./data/out.yuv stddev: 4.97 bytes:7602176 -fd09e45413a6b6e3a19bf9dd77503b17 *./data/a-mpeg1b.mpg +f68c426a1ccb7e1e7e0a76ebf01c8860 *./data/a-mpeg1b.mpg 71e80b8ff8da567f1bbff000cd925627 *./data/out.yuv stddev: 4.07 bytes:6842368 e9218a1db885fe0262e88f9df630307d *./data/a-mjpeg.avi