[gdal-dev] JPEG2000 read performance with OpenJPEG

Jo Meder jomeder at ihug.co.nz
Thu Dec 19 00:50:08 PST 2013


Hi,

Just to follow up, once I got GDAL built with OpenJPEG support on Windows I found the performance was terrible there as well. So I tried reading in blocks and that was obviously the way to do it. The way I was doing it was to read a scanline from each rasterband, perhaps 4 different bands for an RGBA image, and process all the pixels for a scanline at once. Now I read blocks from each rasterband in turn. It completes in a minute or so instead of taking 10 minutes without completing one scanline!

It's interesting because it kind of makes having a codepath based on GDALRasterBand::RasterIO() redundant, for my purposes anyway. Originally I thought I would have two codepaths based on reading scanlines (especially considering I'd written it all before trying JPEG 2000!) and reading blocks which were switched between depending on block size. That ends up being a chunk of code though, and with the risk of major performance issues it seems better just to go with reading blocks. All RasterIO() seems to get you, on the surface at least, is the data type conversion. However I found GDALCopyWords() which seems to handle that.

Thanks to whoever wrote the sample code in the ReadBlock() docs, very helpful as a start :-).

Regards,

Jo Meder


More information about the gdal-dev mailing list