diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-12-16 14:42:31 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-12-16 15:05:31 +0100 |
commit | 633ae5a2101cf6a4367f89041f6356ebc795f369 (patch) | |
tree | ce6be8a8bbddd54c36ec27745e2f5a0460c59400 /libavcodec/mjpegenc.c | |
parent | 5be38f9421da8a50502e8021191fa180193765ec (diff) | |
download | ffmpeg-streaming-633ae5a2101cf6a4367f89041f6356ebc795f369.zip ffmpeg-streaming-633ae5a2101cf6a4367f89041f6356ebc795f369.tar.gz |
mjpegenc: fix 444 block count so it is below 10
Fixes Ticket1990
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegenc.c')
-rw-r--r-- | libavcodec/mjpegenc.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index 381f0fb..b476bcd 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -137,7 +137,7 @@ static void jpeg_table_header(MpegEncContext *s) if(s->avctx->active_thread_type & FF_THREAD_SLICE){ put_marker(p, DRI); put_bits(p, 16, 4); - put_bits(p, 16, s->mb_width); + put_bits(p, 16, s->mb_width*2/s->mjpeg_hsample[0]); } /* huffman table */ @@ -458,23 +458,31 @@ static void encode_block(MpegEncContext *s, DCTELEM *block, int n) void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]) { int i; - for(i=0;i<5;i++) { - encode_block(s, block[i], i); - } - if (s->chroma_format == CHROMA_420) { - encode_block(s, block[5], 5); - } else if (s->chroma_format == CHROMA_422) { - encode_block(s, block[6], 6); + if (s->chroma_format == CHROMA_444) { + encode_block(s, block[0], 0); + encode_block(s, block[2], 2); + encode_block(s, block[4], 4); + encode_block(s, block[8], 8); encode_block(s, block[5], 5); - encode_block(s, block[7], 7); - } else { + encode_block(s, block[9], 9); + + encode_block(s, block[1], 1); + encode_block(s, block[3], 3); encode_block(s, block[6], 6); - encode_block(s, block[8], 8); encode_block(s, block[10], 10); - encode_block(s, block[5], 5); encode_block(s, block[7], 7); - encode_block(s, block[9], 9); encode_block(s, block[11], 11); + } else { + for(i=0;i<5;i++) { + encode_block(s, block[i], i); + } + if (s->chroma_format == CHROMA_420) { + encode_block(s, block[5], 5); + } else { + encode_block(s, block[6], 6); + encode_block(s, block[5], 5); + encode_block(s, block[7], 7); + } } s->i_tex_bits += get_bits_diff(s); |