From d7826b58d2740966cb8f85387591b49b18c241ee Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 5 Aug 2007 20:03:37 +0000 Subject: [PATCH] make wmv1 and wmv2 playable with M$ DMO decoder Originally committed as revision 9950 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/msmpeg4.c | 7 ++- tests/ffmpeg.regression.ref | 8 ++-- tests/rotozoom.regression.ref | 8 ++-- tests/seek.regression.ref | 80 +++++++++++++++++------------------ 4 files changed, 53 insertions(+), 50 deletions(-) diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index fec804b029..f21fed7946 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -883,7 +883,7 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n) } else { rl = &rl_table[3 + s->rl_chroma_table_index]; } - run_diff = s->msmpeg4_version>=6; + run_diff = s->msmpeg4_version>=4; scantable= s->intra_scantable.permutated; } else { i = 0; @@ -942,6 +942,9 @@ else run1 = run - rl->max_run[last][level] - run_diff; if (run1 < 0) goto esc3; + code = get_rl_index(rl, last, run1+1, level); + if (s->msmpeg4_version == 4 && code == rl->n) + goto esc3; code = get_rl_index(rl, last, run1, level); if (code == rl->n) { esc3: @@ -1641,7 +1644,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, } block[0] = level; - run_diff = 0; + run_diff = s->msmpeg4_version >= 4; i = 0; if (!coded) { goto not_coded; diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index 6e1a5a40c0..94ad71085e 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -39,12 +39,12 @@ f546e8d0ada1917bc470584477f83e0e *./tests/data/a-msmpeg4.avi 639406 ./tests/data/a-msmpeg4.avi 8692a2e9ddb8081c4f00cb1557e2388e *./tests/data/out.yuv stddev: 8.00 PSNR:30.05 bytes:7602176 -44c11ce4aa20af1aa609f68e544e5479 *./tests/data/a-wmv1.avi -641448 ./tests/data/a-wmv1.avi +3c119e9ee8c8f45d36a0e8f976505f6b *./tests/data/a-wmv1.avi +641178 ./tests/data/a-wmv1.avi 69454f78ca636e83a600834e5a90660e *./tests/data/out.yuv stddev: 8.01 PSNR:30.04 bytes:7602176 -f524505cf92daef42882d688ed6eadc7 *./tests/data/a-wmv2.avi -675342 ./tests/data/a-wmv2.avi +d69fe03a838479a0a52da0765d49d42e *./tests/data/a-wmv2.avi +675138 ./tests/data/a-wmv2.avi 69454f78ca636e83a600834e5a90660e *./tests/data/out.yuv stddev: 8.01 PSNR:30.04 bytes:7602176 12d215719748b4cf1adeaca4e519ba6c *./tests/data/a-h261.avi diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index d1b2b9e294..c113e106dc 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -39,12 +39,12 @@ stddev: 5.33 PSNR:33.58 bytes:7602176 127680 ./tests/data/a-msmpeg4.avi 0e1c6e25c71c6a8fa8e506e3d97ca4c9 *./tests/data/out.yuv stddev: 5.33 PSNR:33.58 bytes:7602176 -6896c9bdf765953d272c25e34795b934 *./tests/data/a-wmv1.avi -129548 ./tests/data/a-wmv1.avi +1011e26e7d351c96d7bbfe106d831b69 *./tests/data/a-wmv1.avi +129530 ./tests/data/a-wmv1.avi 81eee429b665254d19a06607463c0b5e *./tests/data/out.yuv stddev: 5.33 PSNR:33.59 bytes:7602176 -087ed5da0e7963f7c0a81f15362861a2 *./tests/data/a-wmv2.avi -129864 ./tests/data/a-wmv2.avi +1f6598e9776ed00aebdc44cc8d48cb7c *./tests/data/a-wmv2.avi +129860 ./tests/data/a-wmv2.avi 81eee429b665254d19a06607463c0b5e *./tests/data/out.yuv stddev: 5.33 PSNR:33.59 bytes:7602176 dfd005d4c9030a0dc889c828a6408b9c *./tests/data/a-h261.avi diff --git a/tests/seek.regression.ref b/tests/seek.regression.ref index 1d83dc5290..5ea3a32d54 100644 --- a/tests/seek.regression.ref +++ b/tests/seek.regression.ref @@ -2300,99 +2300,99 @@ ret: 0 st:-1 ts:-0.645825 flags:1 ret: 0 st: 0 dts:3.100000 pts:3.100000 pos:444 size:743 flags:1 ---------------- tests/data/a-wmv1.avi -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8995 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8990 flags:1 ret: 0 st:-1 ts:-1.000000 flags:0 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8995 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8990 flags:1 ret: 0 st:-1 ts:1.894167 flags:1 -ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83764 size:11102 flags:1 +ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83754 size:11099 flags:1 ret: 0 st: 0 ts:0.800000 flags:0 -ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54778 size:9934 flags:1 +ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54770 size:9931 flags:1 ret:-1 st: 0 ts:-0.320000 flags:1 ret:-1 st:-1 ts:2.576668 flags:0 ret: 0 st:-1 ts:1.470835 flags:1 -ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83764 size:11102 flags:1 +ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83754 size:11099 flags:1 ret: 0 st: 0 ts:0.360000 flags:0 -ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29812 size:8798 flags:1 +ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29806 size:8796 flags:1 ret:-1 st: 0 ts:-0.760000 flags:1 ret:-1 st:-1 ts:2.153336 flags:0 ret: 0 st:-1 ts:1.047503 flags:1 -ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54778 size:9934 flags:1 +ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54770 size:9931 flags:1 ret: 0 st: 0 ts:-0.040000 flags:0 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8995 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8990 flags:1 ret: 0 st: 0 ts:2.840000 flags:1 -ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:115836 size:11493 flags:1 +ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:115824 size:11487 flags:1 ret: 0 st:-1 ts:1.730004 flags:0 -ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:115836 size:11493 flags:1 +ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:115824 size:11487 flags:1 ret: 0 st:-1 ts:0.624171 flags:1 -ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29812 size:8798 flags:1 +ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29806 size:8796 flags:1 ret: 0 st: 0 ts:-0.480000 flags:0 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8995 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8990 flags:1 ret: 0 st: 0 ts:2.400000 flags:1 -ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:115836 size:11493 flags:1 +ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:115824 size:11487 flags:1 ret: 0 st:-1 ts:1.306672 flags:0 -ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83764 size:11102 flags:1 +ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83754 size:11099 flags:1 ret: 0 st:-1 ts:0.200839 flags:1 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8995 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8990 flags:1 ret: 0 st: 0 ts:-0.920000 flags:0 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8995 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5660 size:8990 flags:1 ret: 0 st: 0 ts:2.000000 flags:1 -ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:115836 size:11493 flags:1 +ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:115824 size:11487 flags:1 ret: 0 st:-1 ts:0.883340 flags:0 -ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54778 size:9934 flags:1 +ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54770 size:9931 flags:1 ret:-1 st:-1 ts:-0.222493 flags:1 ret:-1 st: 0 ts:2.680000 flags:0 ret: 0 st: 0 ts:1.560000 flags:1 -ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83764 size:11102 flags:1 +ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83754 size:11099 flags:1 ret: 0 st:-1 ts:0.460008 flags:0 -ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29812 size:8798 flags:1 +ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29806 size:8796 flags:1 ret:-1 st:-1 ts:-0.645825 flags:1 ---------------- tests/data/a-wmv2.avi -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8918 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8917 flags:1 ret: 0 st:-1 ts:-1.000000 flags:0 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8918 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8917 flags:1 ret: 0 st:-1 ts:1.894167 flags:1 -ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83802 size:11171 flags:1 +ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83802 size:11170 flags:1 ret: 0 st: 0 ts:0.800000 flags:0 -ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54584 size:9990 flags:1 +ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54584 size:9989 flags:1 ret:-1 st: 0 ts:-0.320000 flags:1 ret:-1 st:-1 ts:2.576668 flags:0 ret: 0 st:-1 ts:1.470835 flags:1 -ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83802 size:11171 flags:1 +ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83802 size:11170 flags:1 ret: 0 st: 0 ts:0.360000 flags:0 -ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29644 size:8840 flags:1 +ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29644 size:8839 flags:1 ret:-1 st: 0 ts:-0.760000 flags:1 ret:-1 st:-1 ts:2.153336 flags:0 ret: 0 st:-1 ts:1.047503 flags:1 -ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54584 size:9990 flags:1 +ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54584 size:9989 flags:1 ret: 0 st: 0 ts:-0.040000 flags:0 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8918 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8917 flags:1 ret: 0 st: 0 ts:2.840000 flags:1 -ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:116072 size:11555 flags:1 +ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:116070 size:11554 flags:1 ret: 0 st:-1 ts:1.730004 flags:0 -ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:116072 size:11555 flags:1 +ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:116070 size:11554 flags:1 ret: 0 st:-1 ts:0.624171 flags:1 -ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29644 size:8840 flags:1 +ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29644 size:8839 flags:1 ret: 0 st: 0 ts:-0.480000 flags:0 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8918 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8917 flags:1 ret: 0 st: 0 ts:2.400000 flags:1 -ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:116072 size:11555 flags:1 +ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:116070 size:11554 flags:1 ret: 0 st:-1 ts:1.306672 flags:0 -ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83802 size:11171 flags:1 +ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83802 size:11170 flags:1 ret: 0 st:-1 ts:0.200839 flags:1 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8918 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8917 flags:1 ret: 0 st: 0 ts:-0.920000 flags:0 -ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8918 flags:1 +ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:5664 size:8917 flags:1 ret: 0 st: 0 ts:2.000000 flags:1 -ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:116072 size:11555 flags:1 +ret: 0 st: 0 dts:1.920000 pts:1.920000 pos:116070 size:11554 flags:1 ret: 0 st:-1 ts:0.883340 flags:0 -ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54584 size:9990 flags:1 +ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:54584 size:9989 flags:1 ret:-1 st:-1 ts:-0.222493 flags:1 ret:-1 st: 0 ts:2.680000 flags:0 ret: 0 st: 0 ts:1.560000 flags:1 -ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83802 size:11171 flags:1 +ret: 0 st: 0 dts:1.440000 pts:1.440000 pos:83802 size:11170 flags:1 ret: 0 st:-1 ts:0.460008 flags:0 -ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29644 size:8840 flags:1 +ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:29644 size:8839 flags:1 ret:-1 st:-1 ts:-0.645825 flags:1 ---------------- tests/data/b-libav-bgr24.yuv