[gdal-dev] Is OpenJPEG JP2 in a zipfile with /vsizip/ supported?

Even Rouault even.rouault at spatialys.com
Sat Sep 14 13:42:25 PDT 2024


Sean,

Yes, GDAL has an adapter between its VSI file system abstraction and 
OpenJPEG own pluggable I/O layer, so you can use any VSI virtual file 
system that has read & seek capabilities (so you can potentially do 
/vsizip//vsicurl/ of a JP2). But the efficiency might not be that great. 
Typically if it is a huge JPEG2000 file and you just need to extract a 
subset of it, even if it is tiled, locating the tile of interest might 
involve browsing through all the file, and thus decompressing most of 
it. For 2 reasons:

- first, support for exploiting the TLM marker, which is the equivalent 
of the TIFF TileOffset index, has been added only recently in OpenJPEG 
master, so not released yet. And not all tiled JPEG2000 files include 
TLM markers. The minimum JPEG2000 formulation is that each tile has just 
a header with its size, and so you have to go from one header to the 
next one to locate all tiles.

- and even if your file has TLM markers and you use openpjeg master, if 
your ZIP is a regular ZIP and not a SOZip (shameless ad for 
https://github.com/sozip/sozip-spec), seeking through at an arbitrary 
within a compressed file within a ZIP is a slow operation. But if 
someone really needs to include a JPEG2000 file they would better 
included it as a non-compressed file, because there's absolutely no file 
size gain to expect from applying deflate to a JPEG2000 file, and 
including it as non-compressed naturally enables fast random seeking.

Even

Le 14/09/2024 à 21:41, Sean Gillies via gdal-dev a écrit :
> Hi all,
>
> In theory, we can read anything from a zip archive without extracting 
> it to the filesystem, but sometimes drivers have special requirements 
> and limitations. Is JP2 from a zipfile supported by OpenJPEG?
>
> -- 
> Sean Gillies
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240914/8339359a/attachment.htm>


More information about the gdal-dev mailing list