Commit Graph

45 Commits

Author SHA1 Message Date
Even Rouault 97eb7e0bf1
Add multithreading support in the T1 (entropy phase) encoder
- API wise, opj_codec_set_threads() can be used on the encoding side
- opj_compress has a -threads switch similar to opj_uncompress
2020-05-20 20:30:21 +02:00
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
Even Rouault 84f3bebbff
Implement writing of IMF profiles
Add -IMF switch to opj_compress as well
2020-02-12 15:55:25 +01:00
Even Rouault e17bbde906 opj_set_decoded_components(): add a provision for a apply_color_transforms parameter in case we support it in the future 2017-09-19 17:48:07 +02:00
Even Rouault 7e2b6bebff Add capability to decode only a subset of all components of an image.
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.
2017-09-19 17:06:19 +02:00
Even Rouault 0c1fc0593e Complementary fix to previous commit 2017-08-07 18:32:52 +02:00
Even Rouault f58aab9d6a Add opj_image_data_alloc() / opj_image_data_free()
As bin/common/color.c used to directly call malloc()/free(), we need
to export functions dedicated to allocating/freeing image component data.
2017-08-07 18:32:52 +02:00
Even Rouault 563bd8499e Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
Matthieu Darbois 0954bc11e3 Fix some warnings (#838)
Fix warnings introduced by uclouvain/openjpeg#786
2016-09-14 00:12:43 +02:00
Even Rouault d4b7f03cfa Add opj_codec_set_threads() in public API and propagate resulting thread pool to tcd level
By default, only the main thread is used. If opj_codec_set_threads() is not used,
but the OPJ_NUM_THREADS environment variable is set, its value will be
used to initialize the number of threads. The value can be either an integer
number, or "ALL_CPUS". If OPJ_NUM_THREADS is set and this function is called,
this function will override the behaviour of the environment variable.
2016-05-25 21:02:07 +02:00
mayeut 0df90afdf7 Remove printf/fprintf to stdout/stderr throughout openjp2 lib
Update uclouvain/openjpeg#246
2015-07-30 23:26:31 +02:00
Matthieu Darbois 6def7e38b4 [trunk] Fix wrong return value for opj_setup_encoder & opj_set_decoded_resolution_factor (fixes issue 497)
Thanks Aaron.
2015-05-29 21:58:08 +00:00
Antonin Descampe 6868ee373e added memory allocation checks (fixes issue 355) 2014-09-19 10:26:35 +00:00
Antonin Descampe 50a205d20f [trunk] improve memory management (fixes issue 359) 2014-09-16 15:48:04 +00:00
Antonin Descampe b0072bf658 [trunk] allow compilation with MinGW32 (fixes issue 361) 2014-09-16 15:38:11 +00:00
Antonin Descampe 7aece5e8e7 [trunk]Replaced deprecated opj_stream_set_user_data function from API
with its 'v3' version, and removed all other 'v3' suffixes from API.
2014-04-23 07:46:11 +00:00
Antonin Descampe 7199d9b5d3 [trunk] refactoring of rsiz, profiles, and extensions management 2014-04-17 09:31:37 +00:00
Antonin Descampe d19a4ab676 [trunk] updated copyright and added copyright notice required by ISO, in each file; updated AUTHORS, NEWS 2014-04-03 15:30:57 +00:00
Mathieu Malaterre 492d8ab7d9 [trunk] Rework previous commit r2610
This way we are able to gently deprecate the old API, and preserve ABI
Update issue 306
2014-03-25 10:23:40 +00:00
Mathieu Malaterre 2a07d3d26b [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 11:28:34 +00:00
Mathieu Malaterre 048c8302fe [trunk] un-deprecated opj_stream_destroy API, import patch manually
In some case user still want to be able to call opj_stream_destroy.
Fixes issue 227
2014-03-07 09:58:32 +00:00
Mathieu Malaterre a7b051b172 [trunk] Update memory management mecanism
Fixes issue 253
2014-03-07 09:44:32 +00:00
Mathieu Malaterre d643ff5dbc [trunk] Remove remaining conversion issues in mqc.c 2014-03-03 16:11:41 +00:00
Mathieu Malaterre 25255c4ed1 [trunk] remove all api with invalid FILE* parameters which could leads to issues when applications are compiled with different flags from openjpeg.
Fixes issue 198
2014-03-03 11:36:31 +00:00
Mathieu Malaterre 563d238fa0 [trunk] Create a new static *_impl function to avoid a warning triggered by the deprecation mecanism
Fixes issue 257
2014-02-25 16:49:26 +00:00
Mathieu Malaterre 5855da5a15 [trunk] Import patch from bug #241 2013-09-26 09:28:47 +00:00
Mickael Savinaud 68415d040f [trunk] separate the opj_config file between public and private part to avoid expose unused variables into the public API. 2013-03-25 12:43:27 +00:00
Mickael Savinaud d5884afcf3 [trunk] add functions to avoid to use FILE* into the API (thanks winfried).
Update issue 120 and update issue 198
2013-02-16 17:20:55 +00:00
Mickael Savinaud fcf9fa3651 [trunk] add opj_ prefix to some internal define and use the new opj type instead of int and float in some files 2012-11-16 08:29:43 +00:00
Mickael Savinaud d5efeb7df5 [trunk]update the copyright, the authors and thanks to respect the license 2012-11-15 15:22:29 +00:00
Mickael Savinaud ec0fe09138 [trunk] move opj_bool to OPJ_BOOL to follow the other type 2012-11-15 13:13:36 +00:00
Mickael Savinaud 8562ed3018 [trunk]remove OPJ_LIMIT_DECODING struct which is not useful for v2 API 2012-11-15 13:02:33 +00:00
Mickael Savinaud 21b0ccf859 [trunk] rename public symbols with OPJ_ prefix (enum part) 2012-11-15 12:58:32 +00:00
Mickael Savinaud 84c93c2fea [trunk] rename public symbols with OPJ_ prefix 2012-11-15 12:25:11 +00:00
Mickael Savinaud ece2a2d6c2 [trunk] Normalize the return type of opj_read_from_file regarding the test in the calling function 2012-10-29 13:53:02 +00:00
Mathieu Malaterre e189679ebc [trunk] Merge back JPIP modification into v2
This commit imports changes from openjpip.c from r2122 into openjpeg.c
2012-10-29 10:12:03 +00:00
Mickael Savinaud f824078c14 [trunk] rename opj_event_msg_v2 to opj_event_msg 2012-10-25 13:49:20 +00:00
Mathieu Malaterre 9adbea785b [trunk] Fix remaining issue with OPJ_CALLCONV 2012-10-25 10:41:55 +00:00
Mickael Savinaud 0d841b5e05 [trunk] add documentation to the message handler functions 2012-10-24 11:17:48 +00:00
Mathieu Malaterre 9b2897ccd9 [trunk] Fix another set of issue with calling convention 2012-10-15 15:52:43 +00:00
Mathieu Malaterre 3c4698435c [trunk] Fix issue on windows OS. Need to explicitely state the calling convention 2012-10-15 15:50:05 +00:00
Mathieu Malaterre 98682e1073 [trunk] Remove some warnings about missing prototypes (gcc) 2012-10-15 15:47:56 +00:00
Mathieu Malaterre 75b7104724 [trunk] remove left-over from ->jpip_on implementation. JPIP is now completely removed from openjp2 and openmj2. Document jpip_iptr_offset variable 2012-10-15 07:38:10 +00:00
Mathieu Malaterre bf37be46b8 [trunk] rename PACKAGE_VERSION to OPJ_PACKAGE_VERSION
This prevent conflicts with TIFF package which also defines PACKAGE_VERSION
2012-10-01 10:39:39 +00:00
Mathieu Malaterre d518970039 [trunk] Start FolderReorgProposal task
Update issue 177
2012-09-28 08:11:41 +00:00