summaryrefslogtreecommitdiff
path: root/libavcodec/lcldec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-17 20:58:21 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-17 21:06:31 +0100
commit894d10332ca527ef91b29ad6eb52b73bdc95eb22 (patch)
tree2bbbe88b6c0a9899dfd04ff335105f60eb88407e /libavcodec/lcldec.c
parent92c07acce736c64592c4c3232b4d0dacbe2f27f7 (diff)
avcodec/lcldec: support rgb24 with width%4 != 0
Fixes Ticket1216 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/lcldec.c')
-rw-r--r--libavcodec/lcldec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index ca62b42109..1d94041fa5 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -180,6 +180,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
int uqvq, ret;
unsigned int mthread_inlen, mthread_outlen;
unsigned int len = buf_size;
+ int linesize;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
@@ -191,7 +192,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
case AV_CODEC_ID_MSZH:
switch (c->compression) {
case COMP_MSZH:
- if (c->imgtype == IMGTYPE_RGB24 && len == width * height * 3 ||
+ if (c->imgtype == IMGTYPE_RGB24 && len == FFALIGN(width * 3, 4) * height ||
c->imgtype == IMGTYPE_YUV111 && len == width * height * 3) {
;
} else if (c->flags & FLAG_MULTITHREAD) {
@@ -411,10 +412,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
}
break;
case IMGTYPE_RGB24:
+ linesize = len < FFALIGN(3 * width, 4) * height ? 3 * width : FFALIGN(3 * width, 4);
for (row = height - 1; row >= 0; row--) {
pixel_ptr = row * frame->linesize[0];
memcpy(outptr + pixel_ptr, encoded, 3 * width);
- encoded += 3 * width;
+ encoded += linesize;
}
break;
case IMGTYPE_YUV411: