Message ID | CAJiLW2MHtBgt4vm2VhqMpH8Oizz0qbp+TXuvJbub4=CniLbPJw@mail.gmail.com |
---|---|
State | Accepted |
Headers | show |
2016-11-17 21:30 GMT+01:00 Martin Vignali <martin.vignali@gmail.com>: > Hello, > > In attach a patch, who fix the decoding of half (or float) layer with > pxr24 compression, when there is also an uint32 layer. > > The uint32 layer is still not decodable. > > Found by Andreas Cadhalpun > > sample can be found here : > https://we.tl/ULGDVxQXGy > > > Comments welcome > > Martin > Ping
On 17.11.2016 21:30, Martin Vignali wrote: > From c70a83c38cd9a9434e6434d60dadf0a1c809e074 Mon Sep 17 00:00:00 2001 > From: Martin Vignali <martin.vignali@gmail.com> > Date: Thu, 17 Nov 2016 21:24:42 +0100 > Subject: [PATCH 2/3] libavcodec/exr : add support for uint32 channel decoding > with pxr24 > > Doesn't decode the uint32 layer, but decode the half part of the file. > --- > libavcodec/exr.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) This looks OK and fixes the sample, so I've applied it. Best regards, Andreas
From c70a83c38cd9a9434e6434d60dadf0a1c809e074 Mon Sep 17 00:00:00 2001 From: Martin Vignali <martin.vignali@gmail.com> Date: Thu, 17 Nov 2016 21:24:42 +0100 Subject: [PATCH 2/3] libavcodec/exr : add support for uint32 channel decoding with pxr24 Doesn't decode the uint32 layer, but decode the half part of the file. --- libavcodec/exr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index f02337e..7852727 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -882,6 +882,22 @@ static int pxr24_uncompress(EXRContext *s, const uint8_t *src, bytestream_put_le16(&out, pixel); } break; + case EXR_UINT: + ptr[0] = in; + ptr[1] = ptr[0] + s->xdelta; + ptr[2] = ptr[1] + s->xdelta; + ptr[3] = ptr[2] + s->xdelta; + in = ptr[3] + s->xdelta; + + for (j = 0; j < s->xdelta; ++j) { + uint32_t diff = (*(ptr[0]++) << 24) | + (*(ptr[1]++) << 16) | + (*(ptr[2]++) << 8 ) | + (*(ptr[3]++)); + pixel += diff; + bytestream_put_le32(&out, pixel); + } + break; default: return AVERROR_INVALIDDATA; } -- 1.9.3 (Apple Git-50)