aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-09 01:35:34 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-09 01:46:14 +0200
commitce228206274b832b21f1c43390c3b0268b4e1091 (patch)
tree47177fccec295e665f918a456af6d61816a54805
parent7caaa72e624812e87c25af456310599f2e091b1c (diff)
downloadffmpeg-ce228206274b832b21f1c43390c3b0268b4e1091.tar.gz
avcodec/mjpegdec: fix shift_output() with lowres
Fixes Ticket2940 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mjpegdec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 4f68b9c3e5..8c4e916f1a 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1047,13 +1047,14 @@ static av_always_inline void mjpeg_copy_block(MJpegDecodeContext *s,
static void shift_output(MJpegDecodeContext *s, uint8_t *ptr, int linesize)
{
int block_x, block_y;
+ int size = 8 >> s->avctx->lowres;
if (s->bits > 8) {
- for (block_y=0; block_y<8; block_y++)
- for (block_x=0; block_x<8; block_x++)
+ for (block_y=0; block_y<size; block_y++)
+ for (block_x=0; block_x<size; block_x++)
*(uint16_t*)(ptr + 2*block_x + block_y*linesize) <<= 16 - s->bits;
} else {
- for (block_y=0; block_y<8; block_y++)
- for (block_x=0; block_x<8; block_x++)
+ for (block_y=0; block_y<size; block_y++)
+ for (block_x=0; block_x<size; block_x++)
*(ptr + block_x + block_y*linesize) <<= 8 - s->bits;
}
}