2016-06-25 18:17 GMT+02:00 Paul B Mahol <one...@gmail.com>: > On 6/25/16, Martin Vignali <martin.vign...@gmail.com> wrote: > > Hello, > > > > In attach a patch who fix, the float decoding of b44 files when there is > > half and float channel. > > > > float (and uint32) data are not compressed when B44 compression is used > > (only half data are compressed). > > > > Applied. > If it's not too late, please don't
Correct in attach, also fixe b44a compression Sorry Martin Jokyo Images
From 75b895f1a9d09259dd79822d20cefca887f8aecf Mon Sep 17 00:00:00 2001 From: Martin Vignali <martin.vign...@gmail.com> Date: Sat, 25 Jun 2016 18:16:19 +0200 Subject: [PATCH] libavcodec/exr : fix float channel read with B44/B44A When there is half channel and float channel inside a b44/b44a file, only half data are compressed. --- libavcodec/exr.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 75ada24..c87187c 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -942,9 +942,9 @@ static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size nbB44BlockH++; for (c = 0; c < s->nb_channels; c++) { - for (iY = 0; iY < nbB44BlockH; iY++) { - for (iX = 0; iX < nbB44BlockW; iX++) {/* For each B44 block */ - if (s->channels[c].pixel_type == EXR_HALF) {/* B44 only compress half float data */ + if (s->channels[c].pixel_type == EXR_HALF) {/* B44 only compress half float data */ + for (iY = 0; iY < nbB44BlockH; iY++) { + for (iX = 0; iX < nbB44BlockW; iX++) {/* For each B44 block */ if (stayToUncompress < 3) { av_log(s, AV_LOG_ERROR, "Not enough data for B44A block: %d", stayToUncompress); return AVERROR_INVALIDDATA; @@ -976,21 +976,23 @@ static int b44_uncompress(EXRContext *s, const uint8_t *src, int compressed_size td->uncompressed_data[indexOut + 1] = tmpBuffer[indexTmp] >> 8; } } - } else{/* Float or UINT 32 channel */ - for (y = indexHgY; y < FFMIN(indexHgY + 4, td->ysize); y++) { - for (x = indexHgX; x < FFMIN(indexHgX + 4, td->xsize); x++) { - indexOut = target_channel_offset * td->xsize + y * td->channel_line_size + 4 * x; - memcpy(&td->uncompressed_data[indexOut], sr, 4); - sr += 4; - } - } } } - } - if (s->channels[c].pixel_type == EXR_HALF) { target_channel_offset += 2; - } else { + } else {/* Float or UINT 32 channel */ + if (stayToUncompress < td->ysize * td->xsize * 4) { + av_log(s, AV_LOG_ERROR, "Not enough data for uncompress channel: %d", stayToUncompress); + return AVERROR_INVALIDDATA; + } + + for (y = 0; y < td->ysize; y++) { + indexOut = target_channel_offset * td->xsize + y * td->channel_line_size; + memcpy(&td->uncompressed_data[indexOut], sr, td->xsize * 4); + sr += td->xsize * 4; + } target_channel_offset += 4; + + stayToUncompress -= td->ysize * td->xsize * 4; } } -- 1.9.3 (Apple Git-50)
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel