[FFmpeg-cvslog] avcodec/exr: fix reading float channel when there is half and float channels in a file

Martin Vignali git at videolan.org
Sat Jun 25 18:13:03 CEST 2016


ffmpeg | branch: master | Martin Vignali <martin.vignali at gmail.com> | Sat Jun 25 17:56:03 2016 +0200| [1e38791b7f8eb2324fa21031b0822942cfdd5e3b] | committer: Paul B Mahol

avcodec/exr: fix reading float channel when there is half and float channels in a file

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e38791b7f8eb2324fa21031b0822942cfdd5e3b
---

 libavcodec/exr.c |   23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 75ada24..05e72d8 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,20 +976,15 @@ 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 */
+            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;
         }
     }



More information about the ffmpeg-cvslog mailing list