aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-01 22:09:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-01 22:09:19 +0200
commitcd417d947e65cad8db6c534cd1bb34ac672e8cbb (patch)
tree925df0d92a375770e122e59b786907d55b1267de /libavcodec/mjpegdec.c
parent4e09300ffab76d2ee9689be8bc3d2d5ad1afb1c2 (diff)
downloadffmpeg-cd417d947e65cad8db6c534cd1bb34ac672e8cbb.tar.gz
avcodec/mjpegdec: fix width for non chroma in rescaling
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index bcdfad7cac..e04951f7a6 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2082,10 +2082,11 @@ the_end:
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
for (p = 1; p<4; p++) {
uint8_t *line = s->picture_ptr->data[p];
- int w;
+ int w = s->width;
if (!(s->upscale_h & (1<<p)))
continue;
- w = s->width >> hshift;
+ if (p==1 || p==2)
+ w >>= hshift;
for (i = 0; i < s->chroma_height; i++) {
for (index = w - 1; index; index--)
line[index] = (line[index / 2] + line[(index + 1) / 2]) >> 1;
@@ -2105,10 +2106,11 @@ the_end:
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift);
for (p = 1; p < 4; p++) {
uint8_t *dst = &((uint8_t *)s->picture_ptr->data[p])[(s->height - 1) * s->linesize[p]];
- int w;
+ int w = s->width;
if (!(s->upscale_v & (1<<p)))
continue;
- w = s->width >> hshift;
+ if (p==1 || p==2)
+ w >>= hshift;
for (i = s->height - 1; i; i--) {
uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[p])[i / 2 * s->linesize[p]];
uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[p])[(i + 1) / 2 * s->linesize[p]];