<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openjpeg/src/lib/openjp2/tcd.h, branch cancel</title>
<subtitle>Fork of openjpeg library for JPEG2000 encoding and decoding</subtitle>
<id>https://git.carlh.net/cgit/openjpeg/atom?h=cancel</id>
<link rel='self' href='https://git.carlh.net/cgit/openjpeg/atom?h=cancel'/>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/'/>
<updated>2025-01-24T12:26:40Z</updated>
<entry>
<title>wip</title>
<updated>2025-01-24T12:26:40Z</updated>
<author>
<name>Carl Hetherington</name>
<email>cth@carlh.net</email>
</author>
<published>2025-01-24T12:26:40Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=e53debb0a1b49af365cd9b67b7161d343c872ecd'/>
<id>urn:sha1:e53debb0a1b49af365cd9b67b7161d343c872ecd</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Cleanup code related to quality layer allocation, and add a few safety checks</title>
<updated>2022-08-11T16:12:07Z</updated>
<author>
<name>Even Rouault</name>
<email>even.rouault@spatialys.com</email>
</author>
<published>2022-08-11T16:06:21Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=c06632c6f6d0a3e106374fe462869b131366c2d0'/>
<id>urn:sha1:c06632c6f6d0a3e106374fe462869b131366c2d0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Significant speed-up rate allocation by rate/distoratio ratio</title>
<updated>2022-08-11T16:06:50Z</updated>
<author>
<name>Even Rouault</name>
<email>even.rouault@spatialys.com</email>
</author>
<published>2022-08-11T14:46:55Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=3d9bcd37534ce1166e1f0a7764faf69bea4d89b1'/>
<id>urn:sha1:3d9bcd37534ce1166e1f0a7764faf69bea4d89b1</id>
<content type='text'>
- 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).
</content>
</entry>
<entry>
<title>Added support for high throughput (HTJ2K) decoding.</title>
<updated>2021-09-25T10:26:59Z</updated>
<author>
<name>Aous Naman</name>
<email>aous72@yahoo.com</email>
</author>
<published>2021-09-02T08:51:38Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=1e6c925eb5f6b68097a9592ca4df4f24eb8b9e56'/>
<id>urn:sha1:1e6c925eb5f6b68097a9592ca4df4f24eb8b9e56</id>
<content type='text'>
There are a few limitations:
- mixed mode (HT and regular code blocks) is not supported.
- ROI in HT blocks is not supported.
- Placeholder passes are not supported.
- MultiHT sets are not support, only a singleHT set.
- there are known issues with some compliance testing files related to
  the parsing of packet header.
</content>
</entry>
<entry>
<title>Add support for generation of PLT markers in encoder</title>
<updated>2020-04-21T13:55:44Z</updated>
<author>
<name>Even Rouault</name>
<email>even.rouault@spatialys.com</email>
</author>
<published>2020-04-21T13:55:44Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=4edb8c83374f52cd6a8f2c7c875e8ffacccb5fa5'/>
<id>urn:sha1:4edb8c83374f52cd6a8f2c7c875e8ffacccb5fa5</id>
<content type='text'>
* -PLT switch added to opj_compress
* Add a opj_encoder_set_extra_options() function that
  accepts a PLT=YES option, and could be expanded later
  for other uses.

-------

Testing with a Sentinel2 10m band, T36JTT_20160914T074612_B02.jp2,
coming from S2A_MSIL1C_20160914T074612_N0204_R135_T36JTT_20160914T081456.SAFE

Decompress it to TIFF:
```
opj_uncompress -i T36JTT_20160914T074612_B02.jp2 -o T36JTT_20160914T074612_B02.tif
```

Recompress it with similar parameters as original:
```
opj_compress -n 5 -c [256,256],[256,256],[256,256],[256,256],[256,256] -t 1024,1024 -PLT -i T36JTT_20160914T074612_B02.tif -o T36JTT_20160914T074612_B02_PLT.jp2
```

Dump codestream detail with GDAL dump_jp2.py utility (https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/samples/dump_jp2.py)
```
python dump_jp2.py T36JTT_20160914T074612_B02.jp2 &gt; /tmp/dump_sentinel2_ori.txt
python dump_jp2.py T36JTT_20160914T074612_B02_PLT.jp2 &gt; /tmp/dump_sentinel2_openjpeg_plt.txt
```

The diff between both show very similar structure, and identical number of packets in PLT markers

Now testing with Kakadu (KDU803_Demo_Apps_for_Linux-x86-64_200210)

Full file decompression:
```
kdu_expand -i T36JTT_20160914T074612_B02_PLT.jp2 -o tmp.tif

Consumed 121 tile-part(s) from a total of 121 tile(s).
Consumed 80,318,806 codestream bytes (excluding any file format) = 5.329697
bits/pel.
Processed using the multi-threaded environment, with
    8 parallel threads of execution
```

Partial decompresson (presumably using PLT markers):
```
kdu_expand -i T36JTT_20160914T074612_B02.jp2 -o tmp.pgm -region "{0.5,0.5},{0.01,0.01}"
kdu_expand -i T36JTT_20160914T074612_B02_PLT.jp2 -o tmp2.pgm  -region "{0.5,0.5},{0.01,0.01}"
diff tmp.pgm tmp2.pgm &amp;&amp; echo "same !"
```

-------

Funded by ESA for S2-MPC project
</content>
</entry>
<entry>
<title>Rename mis-named function opj_tcd_get_encoded_tile_size() to opj_tcd_get_encoder_input_buffer_size()</title>
<updated>2020-04-16T18:33:22Z</updated>
<author>
<name>Even Rouault</name>
<email>even.rouault@spatialys.com</email>
</author>
<published>2020-04-16T18:33:22Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=221a801a97a3ea968a311f7905c18a1eb7f034c4'/>
<id>urn:sha1:221a801a97a3ea968a311f7905c18a1eb7f034c4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add capability to decode only a subset of all components of an image.</title>
<updated>2017-09-19T15:06:19Z</updated>
<author>
<name>Even Rouault</name>
<email>even.rouault@spatialys.com</email>
</author>
<published>2017-09-19T14:52:07Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=7e2b6bebff12eab8bdc17fc9af017e8c11652f4f'/>
<id>urn:sha1:7e2b6bebff12eab8bdc17fc9af017e8c11652f4f</id>
<content type='text'>
This adds a opj_set_decoded_components(opj_codec_t *p_codec,
OPJ_UINT32 numcomps, const OPJ_UINT32* comps_indices) function,
and equivalent "opj_decompress -c compno[,compno]*" option.

When specified, neither the MCT transform nor JP2 channel transformations
will be applied.

Tests added for various combinations of whole image vs tiled-based decoding,
full or reduced resolution, use of decode area or not.
</content>
</entry>
<entry>
<title>Various changes to allow tile buffers of more than 4giga pixels</title>
<updated>2017-09-01T14:30:44Z</updated>
<author>
<name>Even Rouault</name>
<email>even.rouault@spatialys.com</email>
</author>
<published>2017-09-01T14:30:44Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=98b93103613c90753fb6c57696f9403f8ea0b1d6'/>
<id>urn:sha1:98b93103613c90753fb6c57696f9403f8ea0b1d6</id>
<content type='text'>
Untested though, since that means a tile buffer of at least 16 GB. So
there might be places where uint32 overflow on multiplication still occur...
</content>
</entry>
<entry>
<title>TCD: allow tile buffer to be greater than 4GB on 64 bit hosts (but number of pixels must remain under 4 billion)</title>
<updated>2017-09-01T14:30:41Z</updated>
<author>
<name>Even Rouault</name>
<email>even.rouault@spatialys.com</email>
</author>
<published>2017-09-01T14:30:41Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=008a12d4fce0a7b1eabc51e04ed339be759646e2'/>
<id>urn:sha1:008a12d4fce0a7b1eabc51e04ed339be759646e2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Sub-tile decoding: only allocate tile component buffer of the needed dimension</title>
<updated>2017-09-01T14:30:29Z</updated>
<author>
<name>Even Rouault</name>
<email>even.rouault@spatialys.com</email>
</author>
<published>2017-09-01T14:30:29Z</published>
<link rel='alternate' type='text/html' href='https://git.carlh.net/cgit/openjpeg/commit/?id=f9e9942330f476b66ac4a35d0ae521200878f343'/>
<id>urn:sha1:f9e9942330f476b66ac4a35d0ae521200878f343</id>
<content type='text'>
Instead of being the full tile size.

* Use a sparse array mechanism to store code-blocks and intermediate stages of
  IDWT.
* IDWT, DC level shift and MCT stages are done just on that smaller array.
* Improve copy of tile component array to final image, by saving an intermediate
  buffer.
* For full-tile decoding at reduced resolution, only allocate the tile buffer to
  the reduced size, instead of the full-resolution size.
</content>
</entry>
</feed>
