Significant speed-up rate allocation by rate/distoratio ratio
authorEven Rouault <even.rouault@spatialys.com>
Thu, 11 Aug 2022 14:46:55 +0000 (16:46 +0200)
committerEven Rouault <even.rouault@spatialys.com>
Thu, 11 Aug 2022 16:06:50 +0000 (18:06 +0200)
commit3d9bcd37534ce1166e1f0a7764faf69bea4d89b1
treeb36495b136fd3eeec11a4c02cfb7326d69ba31a6
parente9fc08a52acaf34bdcc0e04b7f716f0a3fb2b846
Significant speed-up rate allocation by rate/distoratio ratio

- Avoid doing 128 iterations all the time, and stop when the threshold
  doesn't vary much
- Avoid calling costly opj_t2_encode_packets() repeatdly when bisecting the
  layer ratio if the truncation points haven't changed since the last
  iteration.

When used with the GDAL gdal_translate application to convert a 11977 x
8745 raster with data type UInt16 and 8 channels, the conversion time
to JPEG2000 with 20 quality layers using disto/rate allocation (
-co "IC=C8" -co "JPEG2000_DRIVER=JP2OPENJPEG" -co "PROFILE=NPJE_NUMERICALLY_LOSSLESS"
creation options of the GDAL NITF driver) goes from 5m56 wall clock
(8m20s total, 12 vCPUs) down to 1m16 wall clock (3m45 total).
src/lib/openjp2/tcd.c
src/lib/openjp2/tcd.h