From bde48aa92d335e96bcbbca4e30d5bb72dfe04c41 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 19 Feb 2013 08:41:38 +0100 Subject: [PATCH 1/4] FATE: enable multiple slices in the ffv1 vsynth test This allows us to test the slice threading code. --- tests/fate/vcodec.mak | 2 +- tests/ref/seek/vsynth2-ffv1 | 40 +++++++++++++++++------------------ tests/ref/vsynth/vsynth1-ffv1 | 4 ++-- tests/ref/vsynth/vsynth2-ffv1 | 4 ++-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak index 5a5b703b45..86f27c7546 100644 --- a/tests/fate/vcodec.mak +++ b/tests/fate/vcodec.mak @@ -53,7 +53,7 @@ fate-vsynth%-dv-50: DECOPTS = -sws_flags neighbor fate-vsynth%-dv-50: FMT = dv FATE_VCODEC-$(call ENCDEC, FFV1, AVI) += ffv1 -fate-vsynth%-ffv1: ENCOPTS = -strict -2 +fate-vsynth%-ffv1: ENCOPTS = -slices 4 -strict -2 FATE_VCODEC-$(call ENCDEC, FFVHUFF, AVI) += ffvhuff diff --git a/tests/ref/seek/vsynth2-ffv1 b/tests/ref/seek/vsynth2-ffv1 index a1272f8778..715a27227c 100644 --- a/tests/ref/seek/vsynth2-ffv1 +++ b/tests/ref/seek/vsynth2-ffv1 @@ -1,46 +1,46 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71679 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71679 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485798 size: 74128 +ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2498334 size: 75937 ret: 0 st: 0 flags:0 ts: 0.800000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622704 size: 71128 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1630830 size: 72682 ret:-1 st: 0 flags:1 ts:-0.320000 ret:-1 st:-1 flags:0 ts: 2.576668 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485798 size: 74128 +ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2498334 size: 75937 ret: 0 st: 0 flags:0 ts: 0.360000 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796828 size: 67971 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 801262 size: 69457 ret:-1 st: 0 flags:1 ts:-0.760000 ret:-1 st:-1 flags:0 ts: 2.153336 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622704 size: 71128 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1630830 size: 72682 ret: 0 st: 0 flags:0 ts:-0.040000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71679 ret: 0 st: 0 flags:1 ts: 2.840000 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374428 size: 75606 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3392418 size: 77461 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374428 size: 75606 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3392418 size: 77461 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796828 size: 67971 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 801262 size: 69457 ret: 0 st: 0 flags:0 ts:-0.480000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71679 ret: 0 st: 0 flags:1 ts: 2.400000 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374428 size: 75606 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3392418 size: 77461 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485798 size: 74128 +ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2498334 size: 75937 ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71679 ret: 0 st: 0 flags:0 ts:-0.920000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5648 size: 70200 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71679 ret: 0 st: 0 flags:1 ts: 2.000000 -ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374428 size: 75606 +ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3392418 size: 77461 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622704 size: 71128 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1630830 size: 72682 ret:-1 st:-1 flags:1 ts:-0.222493 ret:-1 st: 0 flags:0 ts: 2.680000 ret: 0 st: 0 flags:1 ts: 1.560000 -ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485798 size: 74128 +ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2498334 size: 75937 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796828 size: 67971 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 801262 size: 69457 ret:-1 st:-1 flags:1 ts:-0.645825 diff --git a/tests/ref/vsynth/vsynth1-ffv1 b/tests/ref/vsynth/vsynth1-ffv1 index 99787ed4ce..a162a77abc 100644 --- a/tests/ref/vsynth/vsynth1-ffv1 +++ b/tests/ref/vsynth/vsynth1-ffv1 @@ -1,4 +1,4 @@ -91c237f18bc19975077c85175daed734 *tests/data/fate/vsynth1-ffv1.avi -2655364 tests/data/fate/vsynth1-ffv1.avi +d236e8441d7e04e24d882bb97faccd36 *tests/data/fate/vsynth1-ffv1.avi +2689718 tests/data/fate/vsynth1-ffv1.avi c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-ffv1.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-ffv1 b/tests/ref/vsynth/vsynth2-ffv1 index 888e843a47..8263b01afd 100644 --- a/tests/ref/vsynth/vsynth2-ffv1 +++ b/tests/ref/vsynth/vsynth2-ffv1 @@ -1,4 +1,4 @@ -3a757276e299bf88c30e06dfb53f1c99 *tests/data/fate/vsynth2-ffv1.avi -3525792 tests/data/fate/vsynth2-ffv1.avi +9d8486fc8a260204d8ee3212d95915b5 *tests/data/fate/vsynth2-ffv1.avi +3546258 tests/data/fate/vsynth2-ffv1.avi dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-ffv1.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 From 6c7d339afcd114f77d765d79863514c263e9c2f0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 19 Feb 2013 17:19:30 +0100 Subject: [PATCH 2/4] tty: set avg_frame_rate. The container does not store any timestamps and is CFR-only. --- libavformat/tty.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/tty.c b/libavformat/tty.c index f85f230000..0ae1510491 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -98,6 +98,7 @@ static int read_header(AVFormatContext *avctx) st->codec->width = width; st->codec->height = height; avpriv_set_pts_info(st, 60, framerate.den, framerate.num); + st->avg_frame_rate = framerate; /* simulate tty display speed */ s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1); From 8a49d2bcbe7573bb4b765728b2578fac0d19763f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 6 Mar 2013 09:06:16 +0100 Subject: [PATCH 3/4] xxan: fix invalid memory access in xan_decode_frame_type0() The loop a few lines below the xan_unpack() call accesses up to dec_size * 2 bytes into y_buffer, so dec_size must be limited to buffer_size / 2. CC:libav-stable@libav.org --- libavcodec/xxan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c index 47ab54a7f9..2bc9ff697b 100644 --- a/libavcodec/xxan.c +++ b/libavcodec/xxan.c @@ -308,7 +308,7 @@ static int xan_decode_frame_type0(AVCodecContext *avctx) int dec_size; bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET); - dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size); + dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size / 2); if (dec_size < 0) dec_size = 0; for (i = 0; i < dec_size; i++) From 3e2f200237af977b9253b0aff121eee27bcedb44 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 6 Mar 2013 09:15:19 +0100 Subject: [PATCH 4/4] roqvideodec: fix a potential infinite loop in roqvideo_decode_frame(). When there is just 1 byte remanining in the buffer, nothing will be read and the loop will continue forever. Check that there are at least 8 bytes, which are always read at the beginning. CC:libav-stable@libav.org --- libavcodec/roqvideodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index ef561a3210..39233be87c 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -44,7 +44,7 @@ static void roqvideo_decode_frame(RoqContext *ri) roq_qcell *qcell; int64_t chunk_start; - while (bytestream2_get_bytes_left(&ri->gb) > 0) { + while (bytestream2_get_bytes_left(&ri->gb) >= 8) { chunk_id = bytestream2_get_le16(&ri->gb); chunk_size = bytestream2_get_le32(&ri->gb); chunk_arg = bytestream2_get_le16(&ri->gb);