Commit ebb651d5 authored by Reimar Döffinger's avatar Reimar Döffinger

Make sure that dv encoder initializes all encoded packet data.

The specification does not say which value to use for unused
parts, so fill all unused bytes with 0xff, which is consistent
with what DV usually uses for reserved or unused parts.

Originally committed as revision 20084 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8a8720c1
...@@ -1102,8 +1102,17 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg) ...@@ -1102,8 +1102,17 @@ static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
av_log(NULL, AV_LOG_ERROR, "ac bitstream overflow\n"); av_log(NULL, AV_LOG_ERROR, "ac bitstream overflow\n");
} }
for (j=0; j<5*s->sys->bpm; j++) for (j=0; j<5*s->sys->bpm; j++) {
int pos;
int size = pbs[j].size_in_bits >> 3;
flush_put_bits(&pbs[j]); flush_put_bits(&pbs[j]);
pos = put_bits_count(&pbs[j]) >> 3;
if (pos > size) {
av_log(avctx, AV_LOG_ERROR, "bitstream written beyond buffer size\n");
return -1;
}
memset(pbs[j].buf + pos, 0xff, size - pos);
}
return 0; return 0;
} }
......
...@@ -30,7 +30,7 @@ b3174e2db508564c1cce0b5e3c1bc1bd *./tests/data/b-lavf.mxf_d10 ...@@ -30,7 +30,7 @@ b3174e2db508564c1cce0b5e3c1bc1bd *./tests/data/b-lavf.mxf_d10
c145305a775eb2de43cdf94eb1ab5240 *./tests/data/b-lavf.mov c145305a775eb2de43cdf94eb1ab5240 *./tests/data/b-lavf.mov
357669 ./tests/data/b-lavf.mov 357669 ./tests/data/b-lavf.mov
./tests/data/b-lavf.mov CRC=0x2f6a9b26 ./tests/data/b-lavf.mov CRC=0x2f6a9b26
31f115e7106265a7a7cea7f4fcf5c329 *./tests/data/b-lavf.dv 522e5e5a46b99f8ad8aabdaf3d2f1869 *./tests/data/b-lavf.dv
3600000 ./tests/data/b-lavf.dv 3600000 ./tests/data/b-lavf.dv
./tests/data/b-lavf.dv CRC=0x02c0af30 ./tests/data/b-lavf.dv CRC=0x02c0af30
bf5c730bb8426dbcfc5420e71ee490f2 *./tests/data/b-lavf.gxf bf5c730bb8426dbcfc5420e71ee490f2 *./tests/data/b-lavf.gxf
......
...@@ -150,15 +150,15 @@ a8fccf278bbb17d37a756ecf11672b09 *./tests/data/a-snow53.avi ...@@ -150,15 +150,15 @@ a8fccf278bbb17d37a756ecf11672b09 *./tests/data/a-snow53.avi
2721758 ./tests/data/a-snow53.avi 2721758 ./tests/data/a-snow53.avi
dde5895817ad9d219f79a52d0bdfb001 *./tests/data/snowll.rotozoom.out.yuv dde5895817ad9d219f79a52d0bdfb001 *./tests/data/snowll.rotozoom.out.yuv
stddev: 0.00 PSNR:999.99 bytes: 7603200/ 7603200 stddev: 0.00 PSNR:999.99 bytes: 7603200/ 7603200
02c85b9bebb23f147ef598da7bcbf736 *./tests/data/a-dv.dv bfa766f89bfeabc0ae1044f3954bed52 *./tests/data/a-dv.dv
7200000 ./tests/data/a-dv.dv 7200000 ./tests/data/a-dv.dv
7ec62bd3350a6848364669e6e1e4b9cc *./tests/data/dv.rotozoom.out.yuv 7ec62bd3350a6848364669e6e1e4b9cc *./tests/data/dv.rotozoom.out.yuv
stddev: 1.71 PSNR: 43.46 bytes: 7603200/ 7603200 stddev: 1.71 PSNR: 43.46 bytes: 7603200/ 7603200
203e50e75a43fb1b26e1b53d99e1de4f *./tests/data/a-dv411.dv 00a9d8683ac6826af41bcf7223fb0389 *./tests/data/a-dv411.dv
7200000 ./tests/data/a-dv411.dv 7200000 ./tests/data/a-dv411.dv
7f9fa421028aabb11eaf4c6513a5a843 *./tests/data/dv.rotozoom.out.yuv 7f9fa421028aabb11eaf4c6513a5a843 *./tests/data/dv.rotozoom.out.yuv
stddev: 10.09 PSNR: 28.04 bytes: 7603200/ 7603200 stddev: 10.09 PSNR: 28.04 bytes: 7603200/ 7603200
2bae05531a24cd6764eefba64db345bc *./tests/data/a-dv50.dv 61e31c79e8949b25c849753a0785b0d7 *./tests/data/a-dv50.dv
14400000 ./tests/data/a-dv50.dv 14400000 ./tests/data/a-dv50.dv
af3f2dd5ab62c1a1d98b07d4aeb6852f *./tests/data/dv50.rotozoom.out.yuv af3f2dd5ab62c1a1d98b07d4aeb6852f *./tests/data/dv50.rotozoom.out.yuv
stddev: 0.82 PSNR: 49.81 bytes: 7603200/ 7603200 stddev: 0.82 PSNR: 49.81 bytes: 7603200/ 7603200
......
...@@ -150,15 +150,15 @@ stddev: 22.77 PSNR: 20.97 bytes: 7603200/ 7603200 ...@@ -150,15 +150,15 @@ stddev: 22.77 PSNR: 20.97 bytes: 7603200/ 7603200
3419980 ./tests/data/a-snow53.avi 3419980 ./tests/data/a-snow53.avi
c5ccac874dbf808e9088bc3107860042 *./tests/data/snowll.vsynth.out.yuv c5ccac874dbf808e9088bc3107860042 *./tests/data/snowll.vsynth.out.yuv
stddev: 0.00 PSNR:999.99 bytes: 7603200/ 7603200 stddev: 0.00 PSNR:999.99 bytes: 7603200/ 7603200
1482a23e323277f1ff67a29dd07b158d *./tests/data/a-dv.dv 27ade3031b17214cf81c19cbf70f37d7 *./tests/data/a-dv.dv
7200000 ./tests/data/a-dv.dv 7200000 ./tests/data/a-dv.dv
02ac7cdeab91d4d5621e7ce96dddc498 *./tests/data/dv.vsynth.out.yuv 02ac7cdeab91d4d5621e7ce96dddc498 *./tests/data/dv.vsynth.out.yuv
stddev: 6.90 PSNR: 31.33 bytes: 7603200/ 7603200 stddev: 6.90 PSNR: 31.33 bytes: 7603200/ 7603200
ec643f879ccc4d53d285712ec25b5d32 *./tests/data/a-dv411.dv bd67f2431db160d4bb6dcd791cea6efd *./tests/data/a-dv411.dv
7200000 ./tests/data/a-dv411.dv 7200000 ./tests/data/a-dv411.dv
b6640a3a572353f51284acb746eb00c4 *./tests/data/dv.vsynth.out.yuv b6640a3a572353f51284acb746eb00c4 *./tests/data/dv.vsynth.out.yuv
stddev: 30.76 PSNR: 18.36 bytes: 7603200/ 7603200 stddev: 30.76 PSNR: 18.36 bytes: 7603200/ 7603200
2a0eace8da46f0061493677deb1fd66d *./tests/data/a-dv50.dv 26dba84f0ea895b914ef5b333d8394ac *./tests/data/a-dv50.dv
14400000 ./tests/data/a-dv50.dv 14400000 ./tests/data/a-dv50.dv
a2ff093e93ffed10f730fa21df02fc50 *./tests/data/dv50.vsynth.out.yuv a2ff093e93ffed10f730fa21df02fc50 *./tests/data/dv50.vsynth.out.yuv
stddev: 1.72 PSNR: 43.37 bytes: 7603200/ 7603200 stddev: 1.72 PSNR: 43.37 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