Fix JPEG-LS encoder 0xff-escaping writing too much or uninitialized data.
Originally committed as revision 7284 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
4d43cbcc74
commit
c8aee695c5
@ -804,11 +804,16 @@ static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_
|
|||||||
av_free(zero);
|
av_free(zero);
|
||||||
av_free(state);
|
av_free(state);
|
||||||
|
|
||||||
|
// the specification says that after doing 0xff escaping unused bits in the
|
||||||
|
// last byte must be set to 0, so just append 7 "optional" zero-bits to
|
||||||
|
// avoid special-casing.
|
||||||
|
put_bits(&pb2, 7, 0);
|
||||||
|
size = put_bits_count(&pb2);
|
||||||
flush_put_bits(&pb2);
|
flush_put_bits(&pb2);
|
||||||
/* do escape coding */
|
/* do escape coding */
|
||||||
size = put_bits_count(&pb2) >> 3;
|
|
||||||
init_get_bits(&gb, buf2, size);
|
init_get_bits(&gb, buf2, size);
|
||||||
while(get_bits_count(&gb) < size * 8){
|
size -= 7;
|
||||||
|
while(get_bits_count(&gb) < size){
|
||||||
int v;
|
int v;
|
||||||
v = get_bits(&gb, 8);
|
v = get_bits(&gb, 8);
|
||||||
put_bits(&pb, 8, v);
|
put_bits(&pb, 8, v);
|
||||||
|
@ -105,8 +105,8 @@ stddev: 7.93 PSNR:30.13 bytes:7602176
|
|||||||
6264498 ./data/a-ljpeg.avi
|
6264498 ./data/a-ljpeg.avi
|
||||||
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
|
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
|
||||||
stddev: 0.00 PSNR:99.99 bytes:7602176
|
stddev: 0.00 PSNR:99.99 bytes:7602176
|
||||||
8b9359781a7e87d09af1b1c9a536cb75 *./data/a-jpegls.avi
|
dca9d700da7857217408c310c501b9bc *./data/a-jpegls.avi
|
||||||
9086694 ./data/a-jpegls.avi
|
9086676 ./data/a-jpegls.avi
|
||||||
0f8637e9b861230aff9894825af83720 *./data/out.yuv
|
0f8637e9b861230aff9894825af83720 *./data/out.yuv
|
||||||
stddev: 2.84 PSNR:39.04 bytes:7602176
|
stddev: 2.84 PSNR:39.04 bytes:7602176
|
||||||
7eee6367442884321e27d15a26bc032a *./data/a-rv10.rm
|
7eee6367442884321e27d15a26bc032a *./data/a-rv10.rm
|
||||||
|
@ -105,8 +105,8 @@ bc0d8c868c1a05db0ff03f41768f6c5e *./data/a-ljpeg.avi
|
|||||||
4766558 ./data/a-ljpeg.avi
|
4766558 ./data/a-ljpeg.avi
|
||||||
dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv
|
dde5895817ad9d219f79a52d0bdfb001 *./data/out.yuv
|
||||||
stddev: 0.00 PSNR:99.99 bytes:7602176
|
stddev: 0.00 PSNR:99.99 bytes:7602176
|
||||||
8a2f3984a27a7513545cf98bc05fd066 *./data/a-jpegls.avi
|
f67cd488dfd06c03ad1d6d94d81b80c8 *./data/a-jpegls.avi
|
||||||
8334508 ./data/a-jpegls.avi
|
8334488 ./data/a-jpegls.avi
|
||||||
a63d4e3ea1f0b0c0d44821da9e09b8f4 *./data/out.yuv
|
a63d4e3ea1f0b0c0d44821da9e09b8f4 *./data/out.yuv
|
||||||
stddev: 0.67 PSNR:51.57 bytes:7602176
|
stddev: 0.67 PSNR:51.57 bytes:7602176
|
||||||
989a42671603dc1a7e6b156dccf0e820 *./data/a-rv10.rm
|
989a42671603dc1a7e6b156dccf0e820 *./data/a-rv10.rm
|
||||||
|
Loading…
Reference in New Issue
Block a user