summaryrefslogtreecommitdiff
path: root/src/bin/jp2/opj_compress.c
AgeCommit message (Collapse)Author
2024-02-28Fix some typos (found by `codespell` and `typos`)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2023-03-09CMake: error out on warnings for strict/missing prototypes.Sebastian Rasmussen
And fix strict-prototypes/missing-prototypes warnings.
2022-08-11Cleanup code related to quality layer allocation, and add a few safety checksEven Rouault
2022-05-08opj_compress.c: usage formatting fixEven Rouault
2022-01-23opj_encoder_set_extra_options(): add a GUARD_BITS=value optionEven Rouault
and add a -GuardBits option to opj_compress. The recently-released SMPTE DCP Bv2.1 Application Profile (link below) says that the number of guard bits in the QCD marker shall be 1 for 2K content and 2 for 4K content. This change allows the number of guard bits to be configured, so that users of openjpeg have the control they need to meet the specification. https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9161348 This is an alternative implementation of https://github.com/uclouvain/openjpeg/pull/1388 that keeps ABI unchanged.
2022-01-16Fix unsigned vs OPJ_INT32 mismatches (#1398)Eric Harvey
2022-01-15Added check for integer overflow in get_num_images (#1397)Eharve14
As discussed in pull request 1396, added a check for integer overflow. Change list: Defined num_images as unsigned int Moved the if statement to check for an empty directory to the beginning of the read directory section Added a check to see if num images would roll back to zero when incrementing.
2022-01-13Avoid overflow in multiplications in utilities related to big number of ↵Eharve14
files in a directory (CVE-2021-29338) (#1396)
2022-01-12opj_compress/opj_uncompress: fix integer overflow in num_images (#1395)Brad Parham
Includes the fix for CVE-2021-29338 Credit to @kaniini based on #1346 Fixes #1338
2021-10-27opj_compress: add a -TargetBitDepth switch for TIFF output (#1384)msheby
Sometimes, given the same (16-bit TIF) input, one wants to generate a variety of J2C outputs (say, 16-, 12-, and 10-bit). This patch allows one to downsample input files, and so makes it easier to automate OpenJPEG in mass generation of J2Cs without having to pipe though an image processing program.
2021-06-07Add support for enabling generation of TLM markers in encoderEven Rouault
Support was already there, but restricted to Cinema and IMF profiles, and 255 tiles * Add -TLM switch added to opj_compress * Make opj_encoder_set_extra_options() function accept a TLM=YES option.
2021-06-07Fix various compiler warningsEven Rouault
2021-05-06Import files tiff and yuv(raw) (#1316)Jamaika1
2020-05-20Add multithreading support in the T1 (entropy phase) encoderEven Rouault
- API wise, opj_codec_set_threads() can be used on the encoding side - opj_compress has a -threads switch similar to opj_uncompress
2020-04-21Add support for generation of PLT markers in encoderEven Rouault
* -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-02-13opj_compress: improve help message regarding new IMF switchEven Rouault
2020-02-12Implement writing of IMF profilesEven Rouault
Add -IMF switch to opj_compress as well
2018-10-31Fix some potential overflow issues (#1161)Stefan Weil
* Fix some potential overflow issues Put sizeof to the beginning of the multiplication to enforce that size_t instead of smaller integer types is used for the calculation. This fixes warnings from LGTM: Multiplication result may overflow 'unsigned int' before it is converted to 'unsigned long'. It also allows removing some type casts. Signed-off-by: Stefan Weil <sw@weilnetz.de> * Fix code indentation Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-31Fix several memory and resource leaksNikola Forró
Signed-off-by: Nikola Forró <nforro@redhat.com>
2018-06-16opj_compress: try to make help message of -c switch clearer (fixes #1117)Even Rouault
2018-03-12opj_compress: fix help message regarding default precinct sizeEven Rouault
2017-09-05Merge pull request #1010 from rouault/subtile_decoding_stage3Even Rouault
Subtile decoding: memory use reduction and perf improvements
2017-09-01opj_compress help: revert 32572617765cb9d77302384653a48d793b8f657f and ↵Even Rouault
indicate 1 again as being the value to get lossless for -r. In opj_j2k_setup_encoder(), make sure that ll rates[] <= 1.0 are set to 0. Document 0 as being lossless for -q / tcp_distoratio (#1009)
2017-09-01opj_compress help: indicate 0 value, instead of 1, for -r parameter to get ↵Even Rouault
lossless encoding (#1009)
2017-09-01opj_compress: reorder checks related to code block dimensions, to avoid ↵Even Rouault
potential int overflow
2017-08-10Fix crash on encoding if using opj_set_default_encoder_parameters() without ↵Even Rouault
defining tcp_numlayers
2017-06-21Style fixEven Rouault
2017-06-21Fix mingw related warningsEven Rouault
2017-05-09Reformat whole codebase with astyle.options (#128)Even Rouault
2016-09-26Remove typos from comments and man pagesMathieu Malaterre
2016-04-29cppcheck fix for openjp2 (#740)julienmalik
2015-09-25Provide safer string copy than strncpymayeut
As per @boxerab suggestion in commit b9ca882749597e4943e609daba1d3c27694fe2ff
2015-09-25Fix resource leaks & unchecked resource allocationsmayeut
2015-09-24Fix some resource leaksmayeut
2015-07-26Remove some warnings when buildingmayeut
Update #442
2015-07-26Remove some warnings when buildingmayeut
Update #442
2015-07-24Remove some warnings when buildingmayeut
Update #442
2015-07-03fixed a few bugsAaron Boxer
2015-07-03add timing to compress and decompressAaron Boxer
2015-05-29[trunk] Fix wrong return value for opj_setup_encoder & ↵Matthieu Darbois
opj_set_decoded_resolution_factor (fixes issue 497) Thanks Aaron.
2015-05-28[trunk] Fix sscanf format specifier (fixes issue 494)Matthieu Darbois
Thanks Aaron.
2014-12-02[trunk] Fixed typo in opj_compress error report (fixes issue 350)Matthieu Darbois
2014-09-30[trunk] fixes heap-buffer-overflow in parse_cmdline_encoderAntonin Descampe
Fixes issue 403 Thanks Matthieu
2014-09-16[trunk] improve memory management (fixes issue 359)Antonin Descampe
2014-07-03[trunk] fixes issue #357. MCT is automatically disabled whenAntonin Descampe
subsamppling is detected.
2014-07-01[trunk] moved comment marker setup from opj_compress to the libraryAntonin Descampe
2014-04-28[trunk] Properly handle failure to compress (remove file)Mathieu Malaterre
Fixes issue 323
2014-04-23[trunk]removed '-x' option for index file as long as it's brokenAntonin Descampe
2014-04-23[trunk]re-formatted help display in executablesAntonin Descampe
2014-04-23[trunk]formatted some messages. Removed -version option to disambiguateAntonin Descampe
with -v(erbose) option, added version info in help display