openjpeg/src/bin/jp2
Even Rouault 4edb8c8337
Add support for generation of PLT markers in encoder
* -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 > /tmp/dump_sentinel2_ori.txt
python dump_jp2.py T36JTT_20160914T074612_B02_PLT.jp2 > /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 && echo "same !"
```

-------

Funded by ESA for S2-MPC project
2020-04-21 15:55:44 +02:00
..
CMakeLists.txt Changed cmake version test to allow for cmake 2.8.11.x 2017-11-14 21:45:09 +11:00
convert.c opj_decompress: add sanity checks to avoid segfault in case of decoding error 2020-04-01 21:11:36 +02:00
convert.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
convertbmp.c bmp_read_rle4_data(): avoid potential infinite loop 2019-04-15 16:10:18 +08:00
convertpng.c opj_decompress: add sanity checks to avoid segfault in case of decoding error 2020-04-01 21:11:36 +02:00
converttif.c opj_decompress: add sanity checks to avoid segfault in case of decoding error 2020-04-01 21:11:36 +02:00
index.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
index.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
opj_compress.c Add support for generation of PLT markers in encoder 2020-04-21 15:55:44 +02:00
opj_decompress.c openjp2/j2k: Report error if all wanted components are not decoded. 2019-02-21 16:48:02 +08:00
opj_dump.c First change on changes-for-afl-tests 2017-08-02 17:27:08 +02:00
windirent.h Fix mingw related warnings 2017-06-21 12:54:40 +02:00