summaryrefslogtreecommitdiff
path: root/libavcodec/lcldec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-03 18:58:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-03 18:58:19 +0200
commit2212bff9a2761c7786b27a9b8e3b42659d7e346e (patch)
tree123561fb0cb5a0bef187aacb565a0c730d89a7f3 /libavcodec/lcldec.c
parent149c1a26c4c167a763461e191a248d704cb8538a (diff)
parentc697c590fbf296b1679b80c8f4071e4c8a6c884b (diff)
downloadffmpeg-2212bff9a2761c7786b27a9b8e3b42659d7e346e.tar.gz
Merge commit 'c697c590fbf296b1679b80c8f4071e4c8a6c884b'
* commit 'c697c590fbf296b1679b80c8f4071e4c8a6c884b': lcl: Disentangle pointers to input data and decompression buffer Conflicts: libavcodec/lcldec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/lcldec.c')
-rw-r--r--libavcodec/lcldec.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 57519ea7d5..bfab58c20c 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -169,10 +169,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
LclDecContext * const c = avctx->priv_data;
- unsigned char *encoded = (unsigned char *)buf;
unsigned int pixel_ptr;
int row, col;
- unsigned char *outptr;
+ unsigned char *encoded, *outptr;
uint8_t *y_out, *u_out, *v_out;
unsigned int width = avctx->width; // Real image width
unsigned int height = avctx->height; // Real image height
@@ -195,21 +194,21 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
if (c->imgtype == IMGTYPE_RGB24 && len == width * height * 3) {
;
} else if (c->flags & FLAG_MULTITHREAD) {
- mthread_inlen = AV_RL32(encoded);
+ mthread_inlen = AV_RL32(buf);
if (len < 8) {
av_log(avctx, AV_LOG_ERROR, "len %d is too small\n", len);
return AVERROR_INVALIDDATA;
}
mthread_inlen = FFMIN(mthread_inlen, len - 8);
- mthread_outlen = AV_RL32(encoded+4);
+ mthread_outlen = AV_RL32(buf + 4);
mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
- mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf, c->decomp_size);
+ mszh_dlen = mszh_decomp(buf + 8, mthread_inlen, c->decomp_buf, c->decomp_size);
if (mthread_outlen != mszh_dlen) {
av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n",
mthread_outlen, mszh_dlen);
return AVERROR_INVALIDDATA;
}
- mszh_dlen = mszh_decomp(encoded + 8 + mthread_inlen, len - 8 - mthread_inlen,
+ mszh_dlen = mszh_decomp(buf + 8 + mthread_inlen, len - 8 - mthread_inlen,
c->decomp_buf + mthread_outlen, c->decomp_size - mthread_outlen);
if (mthread_outlen != mszh_dlen) {
av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n",
@@ -219,7 +218,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
encoded = c->decomp_buf;
len = c->decomp_size;
} else {
- mszh_dlen = mszh_decomp(encoded, len, c->decomp_buf, c->decomp_size);
+ mszh_dlen = mszh_decomp(buf, len, c->decomp_buf, c->decomp_size);
if (c->decomp_size != mszh_dlen) {
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n",
c->decomp_size, mszh_dlen);
@@ -265,23 +264,23 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 &&
len == width * height * 3) {
if (c->flags & FLAG_PNGFILTER) {
- memcpy(c->decomp_buf, encoded, len);
+ memcpy(c->decomp_buf, buf, len);
encoded = c->decomp_buf;
} else {
break;
}
} else if (c->flags & FLAG_MULTITHREAD) {
- mthread_inlen = AV_RL32(encoded);
+ mthread_inlen = AV_RL32(buf);
mthread_inlen = FFMIN(mthread_inlen, len - 8);
- mthread_outlen = AV_RL32(encoded+4);
+ mthread_outlen = AV_RL32(buf + 4);
mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
- ret = zlib_decomp(avctx, encoded + 8, mthread_inlen, 0, mthread_outlen);
+ ret = zlib_decomp(avctx, buf + 8, mthread_inlen, 0, mthread_outlen);
if (ret < 0) return ret;
- ret = zlib_decomp(avctx, encoded + 8 + mthread_inlen, len - 8 - mthread_inlen,
+ ret = zlib_decomp(avctx, buf + 8 + mthread_inlen, len - 8 - mthread_inlen,
mthread_outlen, mthread_outlen);
if (ret < 0) return ret;
} else {
- int ret = zlib_decomp(avctx, encoded, len, 0, c->decomp_size);
+ int ret = zlib_decomp(avctx, buf, len, 0, c->decomp_size);
if (ret < 0) return ret;
}
encoded = c->decomp_buf;