2016-04-13 20:17 GMT+02:00 Martin Vignali <martin.vign...@gmail.com>:

> Hello,
>
> In attach a patch, to change the way PXR24 uncompress calc the expected
> size.
>
> My previous patch (fix PXR24 float) doesn't work when all channels of a
> file
> doesn't have the same pixel type.
>
> Now this patch calc the expected_len channel by channel.
>
> Comments welcome
>
> Martin
> Jokyo Images
>

Ping
From a8b79c2b1885472aa965ab9b7ab4d3cebf81f960 Mon Sep 17 00:00:00 2001
From: Martin Vignali <martin.vign...@gmail.com>
Date: Wed, 13 Apr 2016 20:10:05 +0200
Subject: [PATCH] libavcodec/exr : fix pxr24 when not all channels have the
 same pixel_type

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

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index f54ffad..19ca5a8 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 += (s->xsize * s->ysize * 3);/* PRX 24 store float in 24 bit instead of 32 */
+        } else if (s->channels[i].pixel_type == EXR_HALF) {
+            expected_len += (s->xsize * s->ysize * 2);
+        } else {//UINT 32
+            expected_len += (s->xsize * s->ysize * 4);
+        }
+    }
 
     dest_len = expected_len;
 
-- 
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