diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2001-08-07 22:46:19 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2001-08-07 22:46:19 +0000 |
commit | 47476fa9fdb8d44afba77e057db1789110ba13f5 (patch) | |
tree | 1c12a53e8572c13537c84fbe7f13c59bade2407a /libavcodec | |
parent | 13b54752647fd89bbfea809fd047d3476020a546 (diff) | |
download | ffmpeg-47476fa9fdb8d44afba77e057db1789110ba13f5.tar.gz |
fixed mjpeg matrix quant encoding and decoding
Originally committed as revision 48 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mjpeg.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c index e119df66f4..df7415b812 100644 --- a/libavcodec/mjpeg.c +++ b/libavcodec/mjpeg.c @@ -220,7 +220,7 @@ static int put_huffman_table(MpegEncContext *s, int table_class, int table_id, static void jpeg_table_header(MpegEncContext *s) { PutBitContext *p = &s->pb; - int i, size; + int i, j, size; UINT8 *ptr; /* quant matrixes */ @@ -229,13 +229,15 @@ static void jpeg_table_header(MpegEncContext *s) put_bits(p, 4, 0); /* 8 bit precision */ put_bits(p, 4, 0); /* table 0 */ for(i=0;i<64;i++) { - put_bits(p, 8, s->intra_matrix[i]); + j = zigzag_direct[i]; + put_bits(p, 8, s->intra_matrix[j]); } #if 0 put_bits(p, 4, 0); /* 8 bit precision */ put_bits(p, 4, 1); /* table 1 */ for(i=0;i<64;i++) { - put_bits(p, 8, s->chroma_intra_matrix[i]); + j = zigzag_direct[i]; + put_bits(p, 8, s->chroma_intra_matrix[j]); } #endif @@ -489,7 +491,7 @@ static int mjpeg_decode_init(AVCodecContext *avctx) static int mjpeg_decode_dqt(MJpegDecodeContext *s, UINT8 *buf, int buf_size) { - int len, index, i; + int len, index, i, j; init_get_bits(&s->gb, buf, buf_size); len = get_bits(&s->gb, 16); @@ -504,8 +506,10 @@ static int mjpeg_decode_dqt(MJpegDecodeContext *s, return -1; dprintf("index=%d\n", index); /* read quant table */ - for(i=0;i<64;i++) - s->quant_matrixes[index][i] = get_bits(&s->gb, 8); + for(i=0;i<64;i++) { + j = zigzag_direct[i]; + s->quant_matrixes[index][j] = get_bits(&s->gb, 8); + } len -= 65; } return 0; |