Open GoogleCodeExporter opened 9 years ago
Hi hjpriester,
Quick analysis on my end.
First off, I'd like to point out that with conformant images & no patch, the
issue(s) is/are still present.
Images with multiple tiles, cmap/pclr and/or cdef boxes will show this
behavior. 0.jp2 has cmap/pclr and multiple tiles (but is non conformant - this
is why patches are needed).
When looking at your code, I can see that your passing the same opj_image_t to
opj_get_decoded_tile => That's why you're getting a valgrind error.
Not sure how this should be handled in OpenJPEG. I guess documentation, checks
or design is flawed.
In the mean time, to get rid of this valgrind error (& possible crash - I got
one), you shall pass a new copy of the image you got with opj_read_header on
each iteration.
Here's why :
1st iteration => tile properly decode, image is updated with cmap/pclr info. It
now has 3 components instead of 1on input.
2nd iteration => This image with 3 components is fed to opj_get_decoded_tile &
that's not what it's expecting.
Now, with this loop "fixed" :
1st iteration => you get the correct 3 components image
next iterations => only 1 component in output image, cmap/pclr info is not
applied anymore.
I guess this can be easily fixed by removing opj_jp2_free_pclr(color); at the
end of opj_jp2_apply_pclr (this shouldn't cause any leak, I don't know about
other side effects)
For cdef boxes, the fix won't be that easy because data is modified inside the
function opj_jp2_apply_cdef. A deep copy of that info shall be all that's
needed.
Original comment by m.darb...@gmail.com
on 16 May 2015 at 11:16
Image from test suite with the same behavior (doesn't require patches) :
cmap/pclr :
input/nonregression/issue104_jpxstream.jp2
I couldn't find one for cdef
Original comment by m.darb...@gmail.com
on 16 May 2015 at 12:01
thanks for looking at it. when I use opj_read_header to create an image copy I
get a message end of file reached.
so I guess I have to open the file, create codec for each tile then.
I also tried opj_copy_image_header but this does not fix the valgrind error.
Original comment by hjpries...@gmail.com
on 18 May 2015 at 2:51
Original issue reported on code.google.com by
hjpries...@gmail.com
on 30 Mar 2015 at 12:25Attachments: