Commit ed5d295a authored by Mats Peterson's avatar Mats Peterson Committed by Michael Niedermayer

lavf/riffenc: Improve spec compliance; Fix WMP playback of AVI with xxpc chunks

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent f680c8e4
...@@ -219,11 +219,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, ...@@ -219,11 +219,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOWHITE ||
pix_fmt == AV_PIX_FMT_MONOBLACK); pix_fmt == AV_PIX_FMT_MONOBLACK);
if (!enc->extradata_size && pal_avi) /* Size (not including the size of the color table or color masks) */
extradata_size = 4 * (1 << enc->bits_per_coded_sample); avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size));
/* size */
avio_wl32(pb, 40 + (ignore_extradata ? 0 :extradata_size));
avio_wl32(pb, enc->width); avio_wl32(pb, enc->width);
//We always store RGB TopDown //We always store RGB TopDown
avio_wl32(pb, enc->codec_tag || keep_height ? enc->height : -enc->height); avio_wl32(pb, enc->codec_tag || keep_height ? enc->height : -enc->height);
...@@ -236,7 +233,10 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, ...@@ -236,7 +233,10 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
avio_wl32(pb, (enc->width * enc->height * (enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24)+7) / 8); avio_wl32(pb, (enc->width * enc->height * (enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24)+7) / 8);
avio_wl32(pb, 0); avio_wl32(pb, 0);
avio_wl32(pb, 0); avio_wl32(pb, 0);
avio_wl32(pb, 0); /* Number of color indices in the color table that are used.
* A value of 0 means 2^biBitCount indices, but this doesn't work
* with Windows Media Player and files containing xxpc chunks. */
avio_wl32(pb, pal_avi ? 1 << enc->bits_per_coded_sample : 0);
avio_wl32(pb, 0); avio_wl32(pb, 0);
if (!ignore_extradata) { if (!ignore_extradata) {
......
e202447ccd6660149c17070204d258a4 *./tests/data/lavf-fate/lavf.avi ba77c5c8bd2b0d1e0478d143346cc3b3 *./tests/data/lavf-fate/lavf.avi
928228 ./tests/data/lavf-fate/lavf.avi 928228 ./tests/data/lavf-fate/lavf.avi
./tests/data/lavf-fate/lavf.avi CRC=0xa4770de2 ./tests/data/lavf-fate/lavf.avi CRC=0xa4770de2
0fcba876d3e499c0bebf7bb32a7f83f2 *tests/data/fate/vsynth1-bpp1.avi a0b35707a9aa7144e3e1c70c1d01f4ce *tests/data/fate/vsynth1-bpp1.avi
640460 tests/data/fate/vsynth1-bpp1.avi 640460 tests/data/fate/vsynth1-bpp1.avi
cd1e1448d9895561347ceb66d0add34d *tests/data/fate/vsynth1-bpp1.out.rawvideo cd1e1448d9895561347ceb66d0add34d *tests/data/fate/vsynth1-bpp1.out.rawvideo
stddev: 84.48 PSNR: 9.60 MAXDIFF: 218 bytes: 7603200/ 7603200 stddev: 84.48 PSNR: 9.60 MAXDIFF: 218 bytes: 7603200/ 7603200
af7eae5293b820493d1f4e6d258d8da0 *tests/data/fate/vsynth2-bpp1.avi a0330430d7dbd76cbd6d099b778397e8 *tests/data/fate/vsynth2-bpp1.avi
640460 tests/data/fate/vsynth2-bpp1.avi 640460 tests/data/fate/vsynth2-bpp1.avi
f0dfc0e87e5d96bce29a5944b1bd7471 *tests/data/fate/vsynth2-bpp1.out.rawvideo f0dfc0e87e5d96bce29a5944b1bd7471 *tests/data/fate/vsynth2-bpp1.out.rawvideo
stddev: 68.98 PSNR: 11.36 MAXDIFF: 218 bytes: 7603200/ 7603200 stddev: 68.98 PSNR: 11.36 MAXDIFF: 218 bytes: 7603200/ 7603200
01b0fbf35305b50b1c148c0a23f2cff4 *tests/data/fate/vsynth3-bpp1.avi 4c8777a88a9e52b99d5a345acffcbf06 *tests/data/fate/vsynth3-bpp1.avi
20460 tests/data/fate/vsynth3-bpp1.avi 20460 tests/data/fate/vsynth3-bpp1.avi
52ae74ef7910e5b603c12288d425b9ae *tests/data/fate/vsynth3-bpp1.out.rawvideo 52ae74ef7910e5b603c12288d425b9ae *tests/data/fate/vsynth3-bpp1.out.rawvideo
stddev: 84.76 PSNR: 9.57 MAXDIFF: 232 bytes: 86700/ 86700 stddev: 84.76 PSNR: 9.57 MAXDIFF: 232 bytes: 86700/ 86700
930d019cbf8e06c67bdec58a3639c045 *tests/data/fate/vsynth_lena-bpp1.avi 32673399a8442e397a608839eb3e95cb *tests/data/fate/vsynth_lena-bpp1.avi
640460 tests/data/fate/vsynth_lena-bpp1.avi 640460 tests/data/fate/vsynth_lena-bpp1.avi
6183ba861d4e48d4aaefc514fde270e5 *tests/data/fate/vsynth_lena-bpp1.out.rawvideo 6183ba861d4e48d4aaefc514fde270e5 *tests/data/fate/vsynth_lena-bpp1.out.rawvideo
stddev: 83.28 PSNR: 9.72 MAXDIFF: 215 bytes: 7603200/ 7603200 stddev: 83.28 PSNR: 9.72 MAXDIFF: 215 bytes: 7603200/ 7603200
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment