[gdal-dev] Question about JP2Kakadu driver: read on big images may
cause "Failed to allocate N byte intermediate decompression
buffer for jpeg2000"
Daniele Romagnoli
daniele.romagnoli at geo-solutions.it
Tue Nov 25 05:08:06 EST 2008
Hi list,
I have a 3 bands 21600x21600 jp2K image and I wish to read it as a
21600x5400 (doing a 4:1 subsampling along Y). [I'm using GDAL 1.5.3]
When doing this read, the DirectRasterIO method gives this error:
"Failed to allocate 1399680000 byte intermediate decompression buffer for
jpeg2000."
Debugging the code I have noticed this:
Firstly, it looks for a proper number of levels to be discarded to reduce
the amount of data to be read.
In this case, being a request of 1:1 along X, no decomposition levels can be
discarded. Then it needs to read the image at its maximum resolution and
then do a subsampling on it.
This step requires to allocate a buffer where to store original data to be
afterwards subsampled. However, depending on the imagesize, this
preallocation (with VSIMalloc) may fail on very big images (my case).
Is there a solution for this problem?
- I have noticed that using GDAL_FORCE_CACHING will use the block based read
method (IReadBlock) which doesn't use that section of code.
- Maybe, when working on big images, splitting the read in several
kdu_stripe_decompressor.pull_stripe calls (with stripeHeights < imageHeight)
on a reduced buffer to be subsampled for each iteration, could be a
solution.
Any suggestions?
Thank you very much.
Regards,
Daniele
--
-------------------------------------------------------
Eng. Daniele Romagnoli
Software Engineer
GeoSolutions S.A.S.
Via Carignoni 51
55041 Camaiore (LU)
Italy
phone: +39 0584983027
fax: +39 0584983027
mob: +39 328 0559267
http://www.geo-solutions.it
-------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20081125/9cfb3430/attachment-0001.html
More information about the gdal-dev
mailing list