Hello,

In attach two patch, to fix piz compression.

001 : Set to 0 entire bitmap and lut array.
Fix ticket #3932, also fix decoding error for various official samples :

openexr-images-1.7.0/TestImages/AllHalfValues.exr
openexr-images-1.7.0/ScanLines/MtTamWest.exr
openexr-images-1.7.0/ScanLines/StillLife.exr
openexr-images-1.7.0/ScanLines/Tree.exr
openexr-images-1.7.0/MultiResolution/WavyLinesSphere.exr
openexr-images-1.7.0/ScanLines/CandleGlass.exr


002 : Fix huf_decode.
s variable is now an uint16 (like in the official library).

Fix decoding :
openexr-images-1.7.0/DisplayWindow/t01.exr


Official samples can be found here :
http://download.savannah.nongnu.org/releases/openexr/openexr-images-1.7.0.tar.gz

Comments welcome

Martin
Jokyo Images
From 5bfb6bf0130cec67bff5f10b99339db5dfb41654 Mon Sep 17 00:00:00 2001
From: Martin Vignali <martin.vign...@gmail.com>
Date: Tue, 12 Apr 2016 19:51:23 +0200
Subject: [PATCH 1/2] libavcodec/exr : initialize bitmap and lut. Fix ticket
 3932

---
 libavcodec/exr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 9dd2ee9..a2b345b 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -764,11 +764,12 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
     if (max_non_zero >= BITMAP_SIZE)
         return AVERROR_INVALIDDATA;
 
-    memset(td->bitmap, 0, FFMIN(min_non_zero, BITMAP_SIZE));
+    memset(td->bitmap, 0, BITMAP_SIZE);
+    memset(td->lut, 0, sizeof(uint16_t) * USHORT_RANGE);
+
     if (min_non_zero <= max_non_zero)
         bytestream2_get_buffer(&gb, td->bitmap + min_non_zero,
                                max_non_zero - min_non_zero + 1);
-    memset(td->bitmap + max_non_zero, 0, BITMAP_SIZE - max_non_zero);
 
     maxval = reverse_lut(td->bitmap, td->lut);
 
-- 
1.9.3 (Apple Git-50)

From 54b2d419b395dbaa1e1104cd188e7f28b8fe985f Mon Sep 17 00:00:00 2001
From: Martin Vignali <martin.vign...@gmail.com>
Date: Tue, 12 Apr 2016 20:01:08 +0200
Subject: [PATCH 2/2] libavcodec/exr : fix huf_decode

---
 libavcodec/exr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index a2b345b..2c68ce8 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -520,7 +520,8 @@ static int huf_decode(const uint64_t *hcode, const HufDec *hdecod,
     uint16_t *outb    = out;
     uint16_t *oe      = out + no;
     const uint8_t *ie = gb->buffer + (nbits + 7) / 8; // input byte size
-    uint8_t cs, s;
+    uint8_t cs;
+    uint16_t s;
     int i, lc = 0;
 
     while (gb->buffer < ie) {
-- 
1.9.3 (Apple Git-50)

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to