diff options
author | Martin Vignali <martin.vignali@gmail.com> | 2016-06-04 14:24:08 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2016-06-06 15:39:46 +0200 |
commit | 03152e74dfdc7f438cb4a10402c4de744e807e22 (patch) | |
tree | a9fb5315f7020eb2889e813e46c554b6471442b7 /libavcodec/exr.c | |
parent | 16107aeaf31c443c010a79aaf68a6e0f1e09ef8e (diff) | |
download | ffmpeg-03152e74dfdc7f438cb4a10402c4de744e807e22.tar.gz |
avcodec/exr: improve pxr24 uncompress
Fix pxr24 uncompress when all channels doesnt have the same pixel type.
The expected length after zip decoding, is now calculated channel by channel.
Diffstat (limited to 'libavcodec/exr.c')
-rw-r--r-- | libavcodec/exr.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libavcodec/exr.c b/libavcodec/exr.c index dadbfd641d..4bcb298f97 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -805,15 +805,20 @@ static int pxr24_uncompress(EXRContext *s, const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td) { - unsigned long dest_len, expected_len; + unsigned long dest_len, expected_len = 0; const uint8_t *in = td->tmp; uint8_t *out; int c, i, j; - if (s->pixel_type == EXR_FLOAT) - expected_len = (uncompressed_size / 4) * 3; /* PRX 24 store float in 24 bit instead of 32 */ - else - expected_len = uncompressed_size; + for (i = 0; i < s->nb_channels; i++) { + if (s->channels[i].pixel_type == EXR_FLOAT) { + expected_len += (td->xsize * td->ysize * 3);/* PRX 24 store float in 24 bit instead of 32 */ + } else if (s->channels[i].pixel_type == EXR_HALF) { + expected_len += (td->xsize * td->ysize * 2); + } else {//UINT 32 + expected_len += (td->xsize * td->ysize * 4); + } + } dest_len = expected_len; |