openjpeg.git
2 years agofix #1345: don't remove big endian test for other platforms 1354/head
Mehdi Sabwat [Tue, 1 Jun 2021 20:39:27 +0000 (22:39 +0200)]
fix #1345: don't remove big endian test for other platforms

thanks to @ePirat, it turns out that !EMSCRIPTEN does not evaluate to 1 on other platforms, so the the #1345 actually disabled the test for all platforms.

3 years agoMerge pull request #1345 from msabwat/emscripten
Even Rouault [Fri, 7 May 2021 09:22:13 +0000 (11:22 +0200)]
Merge pull request #1345 from msabwat/emscripten

emscripten: disable big endian test

3 years agoemscripten: disable big endian test 1345/head
Mehdi Sabwat [Mon, 26 Apr 2021 13:37:44 +0000 (15:37 +0200)]
emscripten: disable big endian test

This test should not run on the emscripten platform because of :
https://github.com/emscripten-core/emscripten/blob/dff33368427fba16745c8ce52f11484a67b2855d/cmake/Modules/TestBigEndian.cmake#L5

3 years agoImport files tiff and yuv(raw) (#1316)
Jamaika1 [Thu, 6 May 2021 17:30:34 +0000 (19:30 +0200)]
Import files tiff and yuv(raw) (#1316)

3 years agoMerge pull request #1350 from rouault/remove_jpwl_jp3d_mj2
Even Rouault [Thu, 6 May 2021 11:40:43 +0000 (13:40 +0200)]
Merge pull request #1350 from rouault/remove_jpwl_jp3d_mj2

Remove obsolete components JPWL, JP3D and MJ2

3 years agoRemove obsolete components JPWL, JP3D and MJ2 1350/head
Even Rouault [Tue, 4 May 2021 17:21:45 +0000 (19:21 +0200)]
Remove obsolete components JPWL, JP3D and MJ2

3 years agoMerge pull request #1348 from rouault/fix_kdu
Even Rouault [Tue, 4 May 2021 17:15:06 +0000 (19:15 +0200)]
Merge pull request #1348 from rouault/fix_kdu

tools/travis-ci/install.sh: fix links to Kakadu and jpylyzer binaries

3 years ago.travis.yml: disable tests that no longer pass for unknown reason 1348/head
Even Rouault [Tue, 4 May 2021 16:55:43 +0000 (18:55 +0200)]
.travis.yml: disable tests that no longer pass for unknown reason

3 years agotools/travis-ci/install.sh: fix links to Kakadu and jpylyzer binaries
Even Rouault [Tue, 4 May 2021 14:27:05 +0000 (16:27 +0200)]
tools/travis-ci/install.sh: fix links to Kakadu and jpylyzer binaries

3 years agoMerge pull request #1321 from ffontaine/master 1329/head
Even Rouault [Sun, 10 Jan 2021 22:58:37 +0000 (23:58 +0100)]
Merge pull request #1321 from ffontaine/master

Fix cmake file with DESTDIR

3 years agocmake/OpenJPEGConfig.cmake: replace ABSOLUTE by REALPATH 1321/head
Fabrice Fontaine [Thu, 7 Jan 2021 13:11:26 +0000 (14:11 +0100)]
cmake/OpenJPEGConfig.cmake: replace ABSOLUTE by REALPATH

Fix #1174 by replacing ABSOLUTE by REALPATH which will resolve symlinks:
https://cmake.org/cmake/help/latest/command/get_filename_component.html

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3 years agoRevert "Use INC_DIR for OPENJPEG_INCLUDE_DIRS (fixes uclouvain#1174)"
Fabrice Fontaine [Thu, 7 Jan 2021 13:09:50 +0000 (14:09 +0100)]
Revert "Use INC_DIR for OPENJPEG_INCLUDE_DIRS (fixes uclouvain#1174)"

This reverts commit 65586374d639cfc0104419992f9022174b412594 which
breaks cross-compilation of poppler under buildroot (because of
DESTDIR usage).

3 years agoMerge pull request #867 from pseiderer/fix-lcms2-static-linking-using-pgk-config
Even Rouault [Mon, 4 Jan 2021 18:42:30 +0000 (19:42 +0100)]
Merge pull request #867 from pseiderer/fix-lcms2-static-linking-using-pgk-config

Fix lcms2 static linking using pgk config

3 years agothirdparty: lcms2: append flags found by pkg-config if available 867/head
Peter Seiderer [Fri, 11 Nov 2016 22:35:13 +0000 (23:35 +0100)]
thirdparty: lcms2: append flags found by pkg-config if available

This change allows to get all required CFLAGS/LDFLAGS in case of static only
build.

Fixes a buildroot build failure (see [1], [2] and [3]).

[1] http://autobuild.buildroot.net/results/5ce/5cee20afd8bef5268832cddcb3a5270746be7a57
[2] http://lists.busybox.net/pipermail/buildroot/2016-November/177187.html
[3] http://lists.busybox.net/pipermail/buildroot/2016-November/177188.html

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Depends on https://github.com/uclouvain/openjpeg/pull/866

3 years agoMerge pull request #866 from tSed/master
Even Rouault [Mon, 4 Jan 2021 13:06:43 +0000 (14:06 +0100)]
Merge pull request #866 from tSed/master

fix static build only against tiff and its indirect dependencies

3 years agoMerge pull request #1317 from ffontaine/master
Even Rouault [Mon, 4 Jan 2021 09:45:52 +0000 (10:45 +0100)]
Merge pull request #1317 from ffontaine/master

CMakeLists.txt: Don't require a C++ compiler

3 years agoCMakeLists.txt: Don't require a C++ compiler 1317/head
Peter Korsgaard [Mon, 4 Jan 2021 08:05:42 +0000 (09:05 +0100)]
CMakeLists.txt: Don't require a C++ compiler

By default, CMake assumes that the project is using both C and C++.  By
explicitly passing 'C' as argument of the project() macro, we tell CMake
that only C is used, which prevents CMake from erroring out if a C++
compiler doesn't exist.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
[Retrieved (and slightly updated by adding enable_language(CXX) if
WITH_ASTYLE is set) from:
https://git.buildroot.net/buildroot/tree/package/openjpeg/0003-CMakeLists.txt-Don-t-require-a-C-compiler.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3 years agoFix Windows build
Even Rouault [Thu, 31 Dec 2020 13:54:59 +0000 (14:54 +0100)]
Fix Windows build

3 years agopatch provided 3rdparty zlib to work with MacOS
Antonin Descampe [Thu, 31 Dec 2020 10:06:28 +0000 (11:06 +0100)]
patch provided 3rdparty zlib to work with MacOS

3 years agoAdd HOWTO-RELEASE
Even Rouault [Tue, 29 Dec 2020 14:34:19 +0000 (15:34 +0100)]
Add HOWTO-RELEASE

3 years agoComment back opj_previous_version in abi_check.sh
Even Rouault [Tue, 29 Dec 2020 14:01:40 +0000 (15:01 +0100)]
Comment back opj_previous_version in abi_check.sh

3 years agoabi_check.sh: Update version number for automatic abi check
Even Rouault [Tue, 29 Dec 2020 13:46:50 +0000 (14:46 +0100)]
abi_check.sh: Update version number for automatic abi check

3 years agoMerge pull request #1312 from stweil/news
Even Rouault [Mon, 28 Dec 2020 21:58:58 +0000 (22:58 +0100)]
Merge pull request #1312 from stweil/news

Fix year in NEWS

3 years agoFix year in NEWS 1312/head
Stefan Weil [Mon, 28 Dec 2020 21:52:34 +0000 (22:52 +0100)]
Fix year in NEWS

Signed-off-by: Stefan Weil <sw@weilnetz.de>
3 years agoPrepare for v2.4.0 v2.4.0
Even Rouault [Mon, 28 Dec 2020 20:55:55 +0000 (21:55 +0100)]
Prepare for v2.4.0

3 years agoMerge pull request #1310 from Jamaika1/patch-1
Even Rouault [Mon, 28 Dec 2020 20:49:48 +0000 (21:49 +0100)]
Merge pull request #1310 from Jamaika1/patch-1

Change defined WIN32

3 years agoMerge pull request #1307 from cygwin-lem/pr_use-OPENJPEG_INSTALL_DOC_DIR-to-DESTINATI...
Even Rouault [Mon, 28 Dec 2020 18:05:14 +0000 (19:05 +0100)]
Merge pull request #1307 from cygwin-lem/pr_use-OPENJPEG_INSTALL_DOC_DIR-to-DESTINATION-of-HTMLs

Set ${OPENJPEG_INSTALL_DOC_DIR} to DESTINATION of HTMLs

3 years agoMerge pull request #1308 from timgates42/bugfix_typo_produced
Even Rouault [Mon, 28 Dec 2020 18:04:28 +0000 (19:04 +0100)]
Merge pull request #1308 from timgates42/bugfix_typo_produced

docs: fix simple typo, producted -> produced

3 years agoChange defined WIN32 1310/head
Jamaika1 [Mon, 21 Dec 2020 06:59:12 +0000 (07:59 +0100)]
Change defined WIN32

3 years agodocs: fix simple typo, producted -> produced 1308/head
Tim Gates [Wed, 16 Dec 2020 10:19:17 +0000 (21:19 +1100)]
docs: fix simple typo, producted -> produced

There is a small typo in thirdparty/include/zlib.h, thirdparty/libz/zlib.h.

Should read `produced` rather than `producted`.

3 years agoSet ${OPENJPEG_INSTALL_DOC_DIR} to DESTINATION of HTMLs 1307/head
Lemures Lemniscati [Mon, 14 Dec 2020 14:00:04 +0000 (23:00 +0900)]
Set ${OPENJPEG_INSTALL_DOC_DIR} to DESTINATION of HTMLs

Use ${OPENJPEG_INSTALL_DOC_DIR} as DESTINATION of HTML documents,
instead of share/doc.

3 years agoMerge pull request #1306 from matthew-sharp/master
Even Rouault [Thu, 10 Dec 2020 14:55:41 +0000 (15:55 +0100)]
Merge pull request #1306 from matthew-sharp/master

Use INC_DIR for OPENJPEG_INCLUDE_DIRS (fixes uclouvain#1174)

3 years agoUse INC_DIR for OPENJPEG_INCLUDE_DIRS (fixes uclouvain#1174) 1306/head
Matthew Sharp [Wed, 9 Dec 2020 23:17:46 +0000 (10:17 +1100)]
Use INC_DIR for OPENJPEG_INCLUDE_DIRS (fixes uclouvain#1174)
This fixes the case where the cmake file is accessed via a symlink.

3 years agoMerge pull request #1304 from rouault/fix_1302
Even Rouault [Sat, 5 Dec 2020 10:39:23 +0000 (11:39 +0100)]
Merge pull request #1304 from rouault/fix_1302

pi.c: avoid out of bounds access with POC (fixes #1302)

3 years agopi.c: avoid out of bounds access with POC (fixes #1302) 1304/head
Even Rouault [Fri, 4 Dec 2020 19:45:25 +0000 (20:45 +0100)]
pi.c: avoid out of bounds access with POC (fixes #1302)

3 years agoMerge pull request #1303 from zodf0055980/fix#1283
Even Rouault [Fri, 4 Dec 2020 19:37:43 +0000 (20:37 +0100)]
Merge pull request #1303 from zodf0055980/fix#1283

Encoder: grow again buffer size

3 years agoEncoder: grow again buffer size in opj_tcd_code_block_enc_allocate_data() (fixes... 1303/head
yuan [Fri, 4 Dec 2020 11:00:22 +0000 (19:00 +0800)]
Encoder: grow again buffer size in opj_tcd_code_block_enc_allocate_data() (fixes #1283)

3 years agoMerge pull request #1301 from rouault/fix_1299
Even Rouault [Wed, 2 Dec 2020 22:56:57 +0000 (23:56 +0100)]
Merge pull request #1301 from rouault/fix_1299

opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)

3 years agoMerge pull request #1300 from rouault/complement_1293
Even Rouault [Wed, 2 Dec 2020 22:56:39 +0000 (23:56 +0100)]
Merge pull request #1300 from rouault/complement_1293

pi.c: avoid out of bounds access with POC (refs https://github.com/uclouvain/openjpeg/issues/1293#issuecomment-737122836)

3 years agoMerge pull request #1298 from rouault/fix_1297
Even Rouault [Wed, 2 Dec 2020 22:56:30 +0000 (23:56 +0100)]
Merge pull request #1298 from rouault/fix_1297

opj_t2_encode_packet(): avoid out of bound access of #1297, but likely not the proper fix

3 years agoopj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably... 1301/head
Even Rouault [Wed, 2 Dec 2020 13:10:16 +0000 (14:10 +0100)]
opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)

3 years agopi.c: avoid out of bounds access with POC (refs https://github.com/uclouvain/openjpeg... 1300/head
Even Rouault [Wed, 2 Dec 2020 13:02:17 +0000 (14:02 +0100)]
pi.c: avoid out of bounds access with POC (refs https://github.com/uclouvain/openjpeg/issues/1293#issuecomment-737122836)

3 years agoopj_t2_encode_packet(): avoid out of bound access of #1297, but likely not the proper fix 1298/head
Even Rouault [Wed, 2 Dec 2020 12:13:26 +0000 (13:13 +0100)]
opj_t2_encode_packet(): avoid out of bound access of #1297, but likely not the proper fix

3 years agoMerge pull request #1295 from rouault/fix_1293
Even Rouault [Wed, 2 Dec 2020 09:05:39 +0000 (10:05 +0100)]
Merge pull request #1295 from rouault/fix_1293

opj_j2k_setup_encoder(): validate POC compno0 and compno1 (fixes #1293)

3 years agoMerge pull request #1296 from rouault/workaround_1294
Even Rouault [Wed, 2 Dec 2020 09:05:31 +0000 (10:05 +0100)]
Merge pull request #1296 from rouault/workaround_1294

opj_t2_encode_packet(): avoid out of bound access of #1294, but likely not the proper fix

3 years agoopj_j2k_setup_encoder(): validate POC compno0 (fixes #1293) 1295/head
Even Rouault [Tue, 1 Dec 2020 18:39:09 +0000 (19:39 +0100)]
opj_j2k_setup_encoder(): validate POC compno0 (fixes #1293)

3 years agoopj_t2_encode_packet(): avoid out of bound access of #1294, but likely not the proper fix 1296/head
Even Rouault [Tue, 1 Dec 2020 18:51:35 +0000 (19:51 +0100)]
opj_t2_encode_packet(): avoid out of bound access of #1294, but likely not the proper fix

3 years agoMerge pull request #1292 from rouault/fix_1286
Even Rouault [Tue, 1 Dec 2020 10:35:59 +0000 (11:35 +0100)]
Merge pull request #1292 from rouault/fix_1286

Encoder: avoid global buffer overflow on irreversible conversion when…

3 years agoEncoder: avoid global buffer overflow on irreversible conversion when too many decomp... 1292/head
Even Rouault [Mon, 30 Nov 2020 21:37:07 +0000 (22:37 +0100)]
Encoder: avoid global buffer overflow on irreversible conversion when too many decomposition levels are specified (fixes #1286)

3 years agoMerge pull request #1291 from rouault/tnsot_zero_missing_eoc
Even Rouault [Mon, 30 Nov 2020 22:28:31 +0000 (23:28 +0100)]
Merge pull request #1291 from rouault/tnsot_zero_missing_eoc

Decoding: deal with some SPOT6 images that have tiles with a single tile-part with TPsot == 0 and TNsot == 0, and with missing EOC

3 years agopngtoimage(): fix wrong computation of x1,y1 if -d option is used, that would result...
Even Rouault [Mon, 30 Nov 2020 21:31:51 +0000 (22:31 +0100)]
pngtoimage(): fix wrong computation of x1,y1 if -d option is used, that would result in a heap buffer overflow (fixes #1284)

3 years agoDecoding: deal with some SPOT6 images that have tiles with a single tile-part with... 1291/head
Even Rouault [Mon, 30 Nov 2020 16:36:27 +0000 (17:36 +0100)]
Decoding: deal with some SPOT6 images that have tiles with a single tile-part with TPsot == 0 and TNsot == 0, and with missing EOC

3 years agoMerge pull request #1288 from zodf0055980/master
Even Rouault [Fri, 27 Nov 2020 13:25:11 +0000 (14:25 +0100)]
Merge pull request #1288 from zodf0055980/master

Free p_tcd_marker_info to avoid memory leak

3 years agoFree p_tcd_marker_info to avoid memory leak 1288/head
yuan [Wed, 25 Nov 2020 16:22:49 +0000 (00:22 +0800)]
Free p_tcd_marker_info to avoid memory leak

3 years agoMerge pull request #1287 from zodf0055980/master
Even Rouault [Wed, 25 Nov 2020 15:59:46 +0000 (16:59 +0100)]
Merge pull request #1287 from zodf0055980/master

Encoder: grow again buffer size

3 years agoEncoder: grow again buffer size in opj_tcd_code_block_enc_allocate_data() (fixes... 1287/head
yuan [Wed, 25 Nov 2020 12:41:39 +0000 (20:41 +0800)]
Encoder: grow again buffer size in opj_tcd_code_block_enc_allocate_data() (fixes #1283)

3 years agoEncoder: grow again buffer size in opj_tcd_code_block_enc_allocate_data() (fixes... 1285/head
Even Rouault [Mon, 23 Nov 2020 17:14:02 +0000 (18:14 +0100)]
Encoder: grow again buffer size in opj_tcd_code_block_enc_allocate_data() (fixes #1283)

3 years agoEncoder: grow buffer size in opj_tcd_code_block_enc_allocate_data() to avoid write...
Even Rouault [Mon, 23 Nov 2020 12:49:05 +0000 (13:49 +0100)]
Encoder: grow buffer size in opj_tcd_code_block_enc_allocate_data() to avoid write heap buffer overflow in opj_mqc_flush (fixes #1283)

3 years agoFix typo in internal function name
Even Rouault [Mon, 23 Nov 2020 12:38:27 +0000 (13:38 +0100)]
Fix typo in internal function name

3 years agoMerge pull request #1253 from rouault/floating_point_irreversible_encoding
Even Rouault [Fri, 9 Oct 2020 11:25:27 +0000 (13:25 +0200)]
Merge pull request #1253 from rouault/floating_point_irreversible_encoding

Single-threaded performance improvements in forward DWT for 5-3 and 9-7 (and other improvements)

3 years agoBump Java compatibility from 1.5 to 1.6 (#1263)
Pei JIA [Wed, 23 Sep 2020 09:34:31 +0000 (02:34 -0700)]
Bump Java compatibility from 1.5 to 1.6 (#1263)

3 years agoMerge pull request #1276 from rouault/fix_1243
Even Rouault [Wed, 16 Sep 2020 09:52:10 +0000 (11:52 +0200)]
Merge pull request #1276 from rouault/fix_1243

Encoder: avoid uint32 overflow when allocating memory for codestream buffer (fixes #1243)

3 years agoEncoder: avoid uint32 overflow when allocating memory for codestream buffer (fixes... 1276/head
Even Rouault [Wed, 16 Sep 2020 09:27:53 +0000 (11:27 +0200)]
Encoder: avoid uint32 overflow when allocating memory for codestream buffer (fixes #1243)

3 years agoMerge pull request #1262 from rouault/fix_1261
Even Rouault [Tue, 30 Jun 2020 20:05:13 +0000 (22:05 +0200)]
Merge pull request #1262 from rouault/fix_1261

opj_decompress: fix double-free on input directory with mix of valid and invalid images

3 years agoopj_decompress: fix double-free on input directory with mix of valid and invalid... 1262/head
Even Rouault [Sun, 28 Jun 2020 12:19:59 +0000 (14:19 +0200)]
opj_decompress: fix double-free on input directory with mix of valid and invalid images (CVE-2020-15389)

Fixes #1261

Credits to @Ruia-ruia for reporting and analysis.

3 years agoMerge pull request #1260 from sebras/fix-issue-1259
Even Rouault [Mon, 22 Jun 2020 20:35:44 +0000 (22:35 +0200)]
Merge pull request #1260 from sebras/fix-issue-1259

openjp2: Plug image leak when failing to allocate codestream index.

3 years agoMerge pull request #1258 from sebras/fix-issue-1257
Even Rouault [Mon, 22 Jun 2020 20:12:08 +0000 (22:12 +0200)]
Merge pull request #1258 from sebras/fix-issue-1257

openjp2: Plug memory leak when setting data as TLS fails.

3 years agoopenjp2: Plug image leak when failing to allocate codestream index. 1260/head
Sebastian Rasmussen [Mon, 22 Jun 2020 18:18:19 +0000 (02:18 +0800)]
openjp2: Plug image leak when failing to allocate codestream index.

This fixes issue #1259.

3 years agoopenjp2: Plug memory leak when setting data as TLS fails. 1258/head
Sebastian Rasmussen [Mon, 22 Jun 2020 18:18:19 +0000 (02:18 +0800)]
openjp2: Plug memory leak when setting data as TLS fails.

Previously the Tier 1 handle was not freed when setting it as
TLS failed.

This fixes issue #1257.

3 years agoMerge pull request #1256 from sebras/master
Even Rouault [Mon, 22 Jun 2020 19:03:23 +0000 (21:03 +0200)]
Merge pull request #1256 from sebras/master

openjp2: Error out if failing to create Tier 1 handle.

3 years agoopenjp2: Error out if failing to create Tier 1 handle. 1256/head
Sebastian Rasmussen [Mon, 22 Jun 2020 18:18:19 +0000 (02:18 +0800)]
openjp2: Error out if failing to create Tier 1 handle.

Previously when the handle failed to be created (e.g. when
opj_calloc returned NULL due to low memory), the code still
assumed that the t1 handle pointer was valid and dereferenced
NULL, causing a crash. After this commit OpenJPEG will instead
error out under this condition.

This fixes issue #1255.

3 years agoTesting for invalid values of width, height, numcomps (#1254)
szukw000 [Wed, 10 Jun 2020 15:40:50 +0000 (17:40 +0200)]
Testing for invalid values of width, height, numcomps (#1254)

3 years agoT1 encoder: speed-up by aggressive inlining and more cache friendly data organization 1253/head
Even Rouault [Sun, 24 May 2020 13:38:21 +0000 (15:38 +0200)]
T1 encoder: speed-up by aggressive inlining and more cache friendly data organization

~ 9% speed improvement seen on 10980x10980 uint16 image, T36JTT_20160914T074612_B02.tif
opj_compress time from 17.2s to 15.8s

3 years agoForward DWT 9-7: major speed up by vectorizing vertical pass
Even Rouault [Fri, 22 May 2020 21:57:51 +0000 (23:57 +0200)]
Forward DWT 9-7: major speed up by vectorizing vertical pass

`bench_dwt -I -encode` times goes from 8.6s to 2.1s

3 years agoForward DWT 5-3: major speed up by vectorizing vertical pass
Even Rouault [Fri, 22 May 2020 15:50:15 +0000 (17:50 +0200)]
Forward DWT 5-3: major speed up by vectorizing vertical pass

`bench_dwt -encode` times goes from 7.9s to 1.7s

3 years agoForward DWT: small code refactoring to allow future improvements for the vertical...
Even Rouault [Fri, 22 May 2020 13:58:47 +0000 (15:58 +0200)]
Forward DWT: small code refactoring to allow future improvements for the vertical pass

3 years agodwt.c: remove unused typedef
Even Rouault [Fri, 22 May 2020 13:06:29 +0000 (15:06 +0200)]
dwt.c: remove unused typedef

3 years agoForward DWT 5x3: performance improvements in horizontal pass, and modest in vertical...
Even Rouault [Fri, 22 May 2020 13:03:40 +0000 (15:03 +0200)]
Forward DWT 5x3: performance improvements in horizontal pass, and modest in vertical pass

3 years agoForward DWT: small code refactoring to allow future improvements for the horizontal...
Even Rouault [Thu, 21 May 2020 19:20:19 +0000 (21:20 +0200)]
Forward DWT: small code refactoring to allow future improvements for the horizontal pass

3 years agoSpeed-up 9x7 IDWD by ~30% with OPJ_NUM_THREADS=2
Even Rouault [Thu, 21 May 2020 14:54:48 +0000 (16:54 +0200)]
Speed-up 9x7 IDWD by ~30% with OPJ_NUM_THREADS=2

"bench_dwt -I" time goes from 2.2s to 1.5s

3 years agoRemove useless + 5U margin in opj_dwt_decode_tile_97()
Even Rouault [Thu, 21 May 2020 09:24:29 +0000 (11:24 +0200)]
Remove useless + 5U margin in opj_dwt_decode_tile_97()

Nothing in code analysis nor test suite shows that this margin is
needed.
It dates back to commit dbeebe72b9d35f6ff807c21c7f217b569fa894f6
where vector 9x7 decoding was introduced.

3 years agoSpeed-up 9x7 IDWD by ~20%
Even Rouault [Thu, 21 May 2020 09:23:00 +0000 (11:23 +0200)]
Speed-up 9x7 IDWD by ~20%

"bench_dwt -I" time goes from 2.8s to 2.2s

3 years agobench_dwt.c: add a -I switch to test irreversible FWDT/IDWT
Even Rouault [Wed, 20 May 2020 21:20:48 +0000 (23:20 +0200)]
bench_dwt.c: add a -I switch to test irreversible FWDT/IDWT

3 years agoMerge pull request #1211 from sebras/master
Even Rouault [Wed, 20 May 2020 19:10:55 +0000 (21:10 +0200)]
Merge pull request #1211 from sebras/master

Add check to validate SGcod/SPcoc/SPcod parameter values.

3 years agoIrreversible decoding: partially revert previous commit, to fix failures in test...
Even Rouault [Wed, 20 May 2020 17:24:09 +0000 (19:24 +0200)]
Irreversible decoding: partially revert previous commit, to fix failures in test suite

3 years agoIrreversible compression/decompression DWT: use 1/K constant as per standard
Even Rouault [Wed, 20 May 2020 16:00:45 +0000 (18:00 +0200)]
Irreversible compression/decompression DWT: use 1/K constant as per standard

The previous constant opj_c13318 was mysteriously equal to 2/K , and in
the DWT, we had to divide K and opj_c13318 by 2... The issue was that the
band->stepsize computation in tcd.c didn't take into account the log2gain of
the band.

The effect of this change is expected to be mostly equivalent to the previous
situation, except some difference in rounding. But it leads to a dramatic
reduction of the mean square error and peak error in the irreversible encoding
of issue141.tif !

3 years agoIrreversible decoding: align code more closely to the standard by avoid messing up...
Even Rouault [Wed, 20 May 2020 11:14:16 +0000 (13:14 +0200)]
Irreversible decoding: align code more closely to the standard by avoid messing up with stepsize (no functional change)

3 years agoopj_dwt_encode_1_real(): avoid many bound comparisons, similarly to decoding side
Even Rouault [Wed, 20 May 2020 09:36:05 +0000 (11:36 +0200)]
opj_dwt_encode_1_real(): avoid many bound comparisons, similarly to decoding side

3 years agoopj_j2k_setup_encoder(): add validation of tile width and height to avoid potential...
Even Rouault [Tue, 19 May 2020 20:26:22 +0000 (22:26 +0200)]
opj_j2k_setup_encoder(): add validation of tile width and height to avoid potential division by zero

3 years agoopj_mct_encode_real(): add SSE optimization
Even Rouault [Tue, 19 May 2020 17:45:00 +0000 (19:45 +0200)]
opj_mct_encode_real(): add SSE optimization

3 years agoTesting: revise testing of lossy encoding by comparing PEAK and MSE with original...
Even Rouault [Tue, 19 May 2020 16:03:58 +0000 (18:03 +0200)]
Testing: revise testing of lossy encoding by comparing PEAK and MSE with original image

3 years agocompare_images.c: code reformatting
Even Rouault [Tue, 19 May 2020 16:03:29 +0000 (18:03 +0200)]
compare_images.c: code reformatting

3 years agotcd.c: add comment
Even Rouault [Mon, 18 May 2020 18:17:07 +0000 (20:17 +0200)]
tcd.c: add comment

3 years agoEncoder: use floating-point operations for irreversible transformation
Even Rouault [Mon, 18 May 2020 18:15:07 +0000 (20:15 +0200)]
Encoder: use floating-point operations for irreversible transformation

3 years agodwt.c: change sign of constants to match standard and compensate (no functional change)
Even Rouault [Mon, 18 May 2020 16:09:10 +0000 (18:09 +0200)]
dwt.c: change sign of constants to match standard and compensate (no functional change)

3 years agoAdd multithreaded support in the DWT encoder. 1248/head
Even Rouault [Thu, 30 Apr 2020 09:52:42 +0000 (11:52 +0200)]
Add multithreaded support in the DWT encoder.

Update the bench_dwt utility to have a -decode/-encode switch

Measured performance gains for DWT encoder on a
Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (4 cores, hyper threaded)

Encoding time:
$ ./bin/bench_dwt -encode -num_threads 1
time for dwt_encode: total = 8.348 s, wallclock = 8.352 s

$ ./bin/bench_dwt -encode -num_threads 2
time for dwt_encode: total = 9.776 s, wallclock = 4.904 s

$ ./bin/bench_dwt -encode -num_threads 4
time for dwt_encode: total = 13.188 s, wallclock = 3.310 s

$ ./bin/bench_dwt -encode -num_threads 8
time for dwt_encode: total = 30.024 s, wallclock = 4.064 s

Scaling is probably limited by memory access patterns causing
memory access to be the bottleneck.
The slightly worse results with threads==8 than with thread==4
is due to hyperthreading being not appropriate here.

3 years agoAdd multithreading support in the T1 (entropy phase) encoder
Even Rouault [Wed, 29 Apr 2020 09:50:17 +0000 (11:50 +0200)]
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

3 years agoMerge pull request #1246 from rouault/write_plt
Even Rouault [Wed, 20 May 2020 18:29:31 +0000 (20:29 +0200)]
Merge pull request #1246 from rouault/write_plt

Add support for generation of PLT markers in encoder

4 years agoAdd support for generation of PLT markers in encoder 1246/head
Even Rouault [Tue, 21 Apr 2020 13:55:44 +0000 (15:55 +0200)]
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

4 years agostruct opj_j2k: remove unused fields, and add some documentation
Even Rouault [Sat, 18 Apr 2020 16:25:44 +0000 (18:25 +0200)]
struct opj_j2k: remove unused fields, and add some documentation