[gdal-dev] write JPEG2000 with codek KAKADU without .tif

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Fri Aug 17 00:55:05 PDT 2012


Evgeniy Borovenskiy <eborovenskiy <at> scanex.ru> writes:

> 
> No, at the moment I use the variant in which the file '.tif' with the use of
the driver GTiffDataset is
> created. And then through CreateCopy() JPEG2000 is created.
> I'd like to create a JPEG2000 file straigh away because the size of images are
very big and the intermediate
> file '.tif' can be more than 20GB. In one of the examples of KAKADU compressor
it said that it's possible to
> record not the whole picture at once but to record the pictures in parts. Am I
write or it's impossible to
> record the pictures in parts?
> 
> Is it possible to write the function 'create' for KAKADU that will create the
driver for the direct record of
> JPEG2000 for the buffer (it's desirable to record the picture in parts)?
> 
> Evgeniy

If you are creating big images and if you want to get them ready fast you may
consider not to use GDAL for JPEG2000 compression at all. Have a try by writing
an intermediate geotiff with GDAL and compress it with native Kakadu tools. GDAL
is fast with tiffs but not so optimal with JPEG2000.

I have some fresh timings available about compressing a biggish raster map
mosaic. I created first an intermediate tiff file from .vrt mosaic with GDAL.
Resulting image had 288000 x 480000 pixels and it compressed extremely well with
deflate into 5.1 GB while as uncompressed it would have been 400 GB. Compressing
this image into JPEG2000 took 78 minutes with Kakadu tools. 

Parameters were adjusted to give a good visual quality and image file that fits
on DVD. If somebody gets interested in doing something similar, please do not
copy my -slope parameter but use -rate instead. Using slopes is faster than
using rate and it leads to constant quality instead of constant bit rate but
parameters must suit the input data.

Computer specs:
- AMD Phenom(tm) II X2 545 Processor
- 6 GB RAM
- SATA-disk, same disk for input and output
- Windows ,7 64-bit
 
Kdu_compress-version
- 7.0 compiled from sources with libtiff support
 
Kdu_compress -command
 
kdu_compress -i 50t_single.tif -o 50t_kdu70_slopes.jp2
-slope 47000,44170 
Clayers=10 
Clevels=9 
Corder=RPCL 
ORGgen_plt=yes
Cprecincts={256,256},{256,256},{128,128},{64,64} 
Stiles={32768,32768} 
-flush_period 32768

I did not have fresh GDAL with JP2KAK driver for doing a speed comparison. I am
not totally sure if GDAL could even compress this image at all because JP2KAK
driver does not support tiles and using incremental flushing in a GDAL way could
lead to error because it may try to create more than 256 tile parts. But 20 GB
is not a big image and you won't see this to happen.

-Jukka Rahkonen-





More information about the gdal-dev mailing list