diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-06 19:03:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-08 00:18:36 +0100 |
commit | bbe25b4f3ebb5f7436d066a787e9ebf964aca1d0 (patch) | |
tree | 52557bbd33b3ba6482095f51e7387e8bbcec3502 /libavcodec/mjpegdec.c | |
parent | 9997d41672478424b6ef8dfd924b8e9192f750c0 (diff) | |
download | ffmpeg-bbe25b4f3ebb5f7436d066a787e9ebf964aca1d0.tar.gz |
ljpegdec: support non zero MCU for RGB. 2nd try
Fixes Ticket875
Compared to patch 1 this fixes a bright line at the right side.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r-- | libavcodec/mjpegdec.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 58bbd63104..c0c4080b48 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -684,6 +684,8 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p int left[3], top[3], topleft[3]; const int linesize= s->linesize[0]; const int mask= (1<<s->bits)-1; + int resync_mb_y = 0; + int resync_mb_x = 0; av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size, (unsigned)s->mb_width * 4 * sizeof(s->ljpeg_buffer[0][0])); buffer= s->ljpeg_buffer; @@ -692,7 +694,6 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p buffer[0][i]= 1 << (s->bits - 1); } for(mb_y = 0; mb_y < s->mb_height; mb_y++) { - const int modified_predictor= mb_y ? predictor : 1; uint8_t *ptr = s->picture.data[0] + (linesize * mb_y); if (s->interlaced && s->bottom_field) @@ -702,8 +703,17 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p top[i]= left[i]= topleft[i]= buffer[0][i]; } for(mb_x = 0; mb_x < s->mb_width; mb_x++) { - if (s->restart_interval && !s->restart_count) + int modified_predictor = predictor; + + if (s->restart_interval && !s->restart_count){ s->restart_count = s->restart_interval; + resync_mb_x = mb_x; + resync_mb_y = mb_y; + for(i=0; i<3; i++) + top[i]= left[i]= topleft[i]= 1 << (s->bits - 1); + } + if (mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x) + modified_predictor = 1; for(i=0;i<nb_components;i++) { int pred, dc; |