Compare commits

...

2348 Commits

Author SHA1 Message Date
Antonin Descampe
7113c4e3bb Update THANKS.md 2016-10-03 23:47:10 +02:00
Antonin Descampe
b8197de716 Update CHANGELOG.md 2016-10-03 23:45:44 +02:00
Antonin Descampe
b079198838 fix abi-check and limit upload to website for master 2016-09-29 22:06:23 +02:00
Antonin Descampe
110d31891b fix abi-check 2016-09-29 21:44:38 +02:00
Antonin Descampe
cc0c71c30b fix abi-check 2016-09-29 20:23:01 +02:00
Antonin Descampe
5695ac15ff Update abi-check scripts for v2.1.2 2016-09-28 20:59:10 +02:00
Antonin Descampe
df5e8628f2 Update NEWS.md for v2.1.2 2016-09-28 20:58:55 +02:00
Antonin Descampe
b0c0f0ff04 Update Changelog for v2.1.2 2016-09-28 20:58:34 +02:00
Antonin Descampe
9afc1699f0 Update version number for future release 2.2.0 2016-09-28 18:55:02 +02:00
Mathieu Malaterre
34dae137a9 OPENJPEG_NAMESPACE is configurable by user 2016-09-26 12:01:31 +02:00
Mathieu Malaterre
4d5c5e7c48 Remove typos from comments and man pages 2016-09-26 11:26:55 +02:00
Matthieu Darbois
fac916f72a Fix PNM file reading (#847)
Malformed PNM file could cause a crash in opj_compress.
Checks were added to prevent this.

Fixes #843
Updates #440
2016-09-22 00:30:34 +02:00
Stefan Weil
8715ce2749 Fix some issues reported by Coverity Scan (#846)
* test_tile_decoder: Fix potential buffer overflow (coverity)

CID 1190155 (#1 of 1): Unbounded source buffer (STRING_SIZE)

Using a pointer instead of buffer of fixed size avoids the limit
for the length of the input file name.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* test_tile_encoder: Fix potential buffer overflow (coverity)

CID 1190154 (#1 of 1): Unbounded source buffer (STRING_SIZE)

Using a pointer instead of buffer of fixed size avoids the limit
for the length of the output file name. This implies that the length
can exceed 255, so the data type for variable len had to be fixed, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* openjpip: Initialize data before returning it

This fixes an error reported by Coverity:

CID 1190143 (#1 of 1): Uninitialized scalar variable (UNINIT)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-21 21:15:25 +02:00
Stefan Weil
045aa4d9f2 Fix potential out-of-bounds read (coverity) (#844)
* query_parser: Fix potential out-of-bounds read (coverity)

CID 1190207 (#1 of 1): Out-of-bounds read (OVERRUN)

Variable i must be checked before testing query_param.box_type.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* jpip_parser: Fix potential out-of-bounds read (coverity)

CID 1190206 (#1 of 1): Out-of-bounds read (OVERRUN)

Variable i must be checked before testing query_param.box_type.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-21 13:17:09 +02:00
Antonin Descampe
da94042481 Merge pull request #834 from trylab/issue833
Fix issue 833.
2016-09-20 18:59:30 +02:00
Antonin Descampe
31d44f0280 Disable automatic compilation of t1_generate_luts
Fix #831
2016-09-20 18:48:06 +02:00
Antonin Descampe
3aaeea7ce8 renamed USE_THREAD to OPJ_USE_THREAD
renaming to be consistent with previous OPJ CMake options
2016-09-16 17:54:12 +02:00
Matthieu Darbois
6e7616c83c Remove TODO for overflow check (#842)
The check was already done. It’s been simplified.
Reformat to get consistent style throughout the functions.
2016-09-15 23:51:34 +02:00
Matthieu Darbois
9a07ccb3d0 Add overflow checks for opj_aligned_malloc (#841)
See
https://pdfium.googlesource.com/pdfium/+/b20ab6c7acb3be1393461eb650ca8fa4660c937e/third_party/libopenjpeg20/0020-opj_aligned_malloc.patch
2016-09-15 01:57:53 +02:00
Matthieu Darbois
f88c9974e2 Flags in T1 shall be unsigned (#840)
This will remove some conversion warnings
2016-09-14 23:46:46 +02:00
Matthieu Darbois
0954bc11e3 Fix some warnings (#838)
Fix warnings introduced by uclouvain/openjpeg#786
2016-09-14 00:12:43 +02:00
Antonin Descampe
1e69940955 Merge branch 'smuehlst-bit-fields-type' 2016-09-13 21:21:56 +02:00
Antonin Descampe
f66e120452 Merge branch 'bit-fields-type' of https://github.com/smuehlst/openjpeg into smuehlst-bit-fields-type 2016-09-13 21:21:11 +02:00
Antonin Descampe
d6d0f070e1 Merge pull request #786 from rouault/tier1_optimizations_multithreading
T1 & DWT multithreading decoding optimizations
2016-09-13 16:39:26 +02:00
Antonin Descampe
f1f7c53308 remove ops 1.4 and 1.2 from abi-check to avoid symlinks in gh-pages 2016-09-13 16:21:38 +02:00
trylab
893143c8e1 Fix issue 833.
Add some overflow check operations.
2016-09-13 17:43:30 +08:00
Matthieu Darbois
805972f4c8 Add test for issue 820 (#829)
Update uclouvain/openjpeg#820
2016-09-11 19:47:32 +02:00
Matthieu Darbois
45ed017b1b Add test for issue 826 (#827)
Update uclouvain/openjpeg#826

Also correct names for data of issue uclouvain/openjpeg#823
2016-09-08 23:56:06 +02:00
Matthieu Darbois
b21a8317e5 Fix coverity 113065 (CWE-484) (#824) 2016-09-08 22:14:19 +02:00
Antonin Descampe
5fb81d986e Update THANKS.md 2016-09-08 11:28:58 +02:00
Even Rouault
48c16b2c19 Merge branch 'master' of https://github.com/uclouvain/openjpeg into tier1_optimizations_multithreading_2
Conflicts:
	src/lib/openjp2/t1.c
2016-09-08 10:30:09 +02:00
Even Rouault
ab22c5bad5 opj_thread_pool: fix potential deadlock at thread pool destruction 2016-09-08 09:43:36 +02:00
Matthieu Darbois
ef01f18dfc Cast to size_t before multiplication
Need to cast to size_t before multiplication otherwise overflow check is useless.
2016-09-08 07:34:46 +02:00
Matthieu Darbois
e078172b1c Add sanity check for tile coordinates (#823)
Coordinates are casted from OPJ_UINT32 to OPJ_INT32
Add sanity check for negative values and upper bound becoming lower
than lower bound.
See also
https://pdfium.googlesource.com/pdfium/+/b6befb2ed2485a3805cddea86dc7574510178ea9
2016-09-08 00:24:15 +02:00
Stephan Mühlstrasser
8750e183c6 Moved type OPJ_BITFIELD from openjpeg.h to opj_includes.h
OPJ_BITFIELD is used only in internal headers and must not
appear in the public openjpeg.h header.
2016-09-07 08:41:01 +02:00
Stephan Mühlstrasser
6c83f1468c Merge branch 'master' into bit-fields-type 2016-09-07 08:35:19 +02:00
Matthieu Darbois
acfb307df4 Add test for PR 818 (#822)
update uclouvain/openjpeg#818
2016-09-07 00:00:21 +02:00
Matthieu Darbois
275aad4df8 Update to libpng 1.6.25 (#821) 2016-09-06 22:33:45 +02:00
Matthieu Darbois
734d57d5f7 fix incrementing of "l_tcp->m_nb_mcc_records" in opj_j2k_read_mcc (#820) 2016-09-06 22:33:26 +02:00
trylab
c16bc057ba Fix an integer overflow issue (#809)
Prevent an integer overflow issue in function opj_pi_create_decode of
pi.c.
2016-09-06 07:55:49 +02:00
Matthieu Darbois
ea320dab8b Add overflow check in opj_tcd_init_tile (#819) 2016-09-06 07:54:29 +02:00
Matthieu Darbois
d7e6b7de8a Fix leak & invalid behavior of opj_jp2_read_ihdr (#818)
In case multiple ihdr box are present, only the first one shall be
taken into account.
2016-09-06 01:31:15 +02:00
Matthieu Darbois
ccd9ced49e Add overflow check in opj_j2k_update_image_data (#817) 2016-09-06 00:50:44 +02:00
Matthieu Darbois
9f24b078c7 Change 'restrict' define to 'OPJ_RESTRICT' (#816)
Visual Studio 2015 does not pass regression tests with `__restrict` so kept disabled for MSVC.
Need to check proper usage of OPJ_RESTRICT (if correct then there’s
probably a bug  in vc14)

Closes #661
2016-09-06 00:49:53 +02:00
Stefan Weil
51155950eb Add .gitignore (#787)
Ignore all files and directories which are generated by `cmake . && make`.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-05 22:07:50 +02:00
Matthieu Darbois
23cee22286 Switch to clang 3.8 (#814)
clang 3.9 is currently unavailable for precise through apt
2016-09-02 23:58:12 +02:00
Even Rouault
4f9abb9a45 [Win32] Use _beginthreadex instead of CreateThread() 2016-08-11 21:59:28 +02:00
Matthieu Darbois
4a2a8693e5 Update to lcms 2.8 (#808) 2016-08-06 13:04:56 +02:00
Matthieu Darbois
1509ccc51f Update to libpng 1.6.24 (#807) 2016-08-06 12:51:40 +02:00
Matthieu Darbois
5bb919a30e Reenable clang-3.9 build on travis (#806)
clang-3.9 is now available with apt add-on in travis-ci
2016-08-06 12:26:46 +02:00
Stephan Mühlstrasser
54874194a8 Unified bit-field declaration, removed tabs. 2016-07-27 10:09:54 +02:00
Stephan Mühlstrasser
d2d35bf6c2 Create separate type for bit-fields.
The definition of bit-fields with type OPJ_UINT32 caused complilation errors
on IBM iSeries, because OPJ_UINT32 is defined as uint32_t, and
uint32_t is defined as unsigned long in <stdint.h>. The definition of
bit-fields with an integer type of  a specific size doesn't make sense
anyway.
2016-07-25 20:46:11 +02:00
Matthieu Darbois
b8bd1b0e07 Add compilation test for standalone inclusion of openjpeg.h (#798)
This ensures all openjpeg.h dependencies are met.
Fix #673
2016-07-14 11:06:26 +02:00
Stefan Weil
e40c28c2e8 jpwl: Remove non-portable data type u_int16_t (fix issue #796) (#797)
The type casts which used this data type can be removed by changing
the signature of function swap16. As this function is called with
unsigned variables, this change is reasonable.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-07-14 10:49:17 +02:00
Stefan Weil
18da6155b2 Fix dependency for pkg-config (issue #594) (#795)
openjpeg provides libopenjp2.pc, so the require statements must refer to
libopenjp2 instead of openjp2.
Fixes #594 

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-07-12 00:45:51 +02:00
mayeut
b3c422654f Update ABI tracker script
Disable previous version.
2016-07-06 00:26:37 +02:00
mayeut
9db62b2011 Update ABI tracker from 2.1 to 2.1.1 2016-07-05 23:53:31 +02:00
Antonin Descampe
7948d83340 update api/abi tracker 2016-07-05 23:33:00 +02:00
mayeut
132c4a248b Add version 2.1.1 to ABI tracker 2016-07-05 22:12:11 +02:00
Antonin Descampe
ed294598ea Trigger API/ABI update on website 2016-07-05 18:10:35 +02:00
Antonin Descampe
fef144283f Update INSTALL.md 2016-07-05 16:49:10 +02:00
Antonin Descampe
4c5a1cc825 Update AUTHORS.md 2016-07-05 16:40:27 +02:00
Antonin Descampe
bd96ed8353 Update AUTHORS file 2016-07-05 16:07:16 +02:00
Antonin Descampe
f4a708ba0f Update INSTALL, README and THANKS file 2016-07-05 16:04:29 +02:00
Antonin Descampe
2372cb78a0 Upload changelog and convert some files to mardown 2016-07-05 15:29:02 +02:00
Antonin Descampe
9d5002f8fd Remove useless diff command in abi-check.sh 2016-06-26 20:00:37 +02:00
Matthieu Darbois
e4c74f5364 Correct abi-check.sh for PR (#791) 2016-06-25 01:09:42 +02:00
maddin200
cb72c08472 Update tcd.c (#790)
cppcheck unitialized variable
2016-06-21 22:13:57 +02:00
Matthieu Darbois
898ca6f522 Remove clang-3.9 build
c.f. travis-ci/travis-ci#6120
2016-06-21 22:09:08 +02:00
Antonin Descampe
86698be6e9 Automatic upload of ABI report (end) 2016-06-21 17:41:29 +02:00
Antonin Descampe
cdcb77e796 Automatic upload of ABI report (ctd) 2016-06-21 17:21:08 +02:00
Antonin Descampe
954dad66de Automatic upload of ABI report (ctd) 2016-06-21 16:46:38 +02:00
Antonin Descampe
48744a1342 setup automatic upload of ABI reports 2016-06-21 16:19:06 +02:00
Even Rouault
7d3c7a345f Be robust to failed allocations of job structures 2016-05-26 23:51:32 +02:00
Even Rouault
69497d35c0 opj_decompress: use clock_gettime() instead of getrusage() so as to get the time spent, and not to the total CPU time 2016-05-25 21:59:43 +02:00
Even Rouault
d67cd2220a opj_decompress: add a -threads <num_threads> option 2016-05-25 21:02:07 +02:00
Even Rouault
e3eb0a206d .travis.yml: add a conf with OPJ_NUM_THREADS=2 2016-05-25 21:02:07 +02:00
Even Rouault
57b216bb58 Use thread pool for DWT decoding 2016-05-25 21:02:07 +02:00
Even Rouault
5fbb8b2645 Use thread-pool for T1 decoding 2016-05-25 21:02:07 +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
Even Rouault
54179fe1d5 Add threading and thread pool API 2016-05-25 21:02:07 +02:00
Even Rouault
7092f7ea11 Fix MSVC210 build issue (use of C99 declaration after statement) introduced in ba1edf6cd4 2016-05-23 16:00:28 +02:00
Even Rouault
107eb31531 Improve perf of opj_t1_dec_sigpass_mqc_vsc() and opj_t1_dec_refpass_mqc_vsc() with loop unrolling 2016-05-23 13:45:15 +02:00
Even Rouault
8371491a99 Better inlining of opj_t1_updateflagscolflags() w.r.t. flags_stride 2016-05-23 11:53:54 +02:00
Even Rouault
956c31d5a6 opj_t1_dec_clnpass(): remove useless test in the runlen decoding path (of the non VSC case) 2016-05-23 11:53:54 +02:00
Even Rouault
93f7f90711 opj_t1_decode_cblks(): tiny perf increase when loop unrolling 2016-05-23 11:53:53 +02:00
Even Rouault
1da397e94a Tier 1 decoding: add a colflags array
Addition flag array such that colflags[1+0] is for state of col=0,row=0..3,
colflags[1+1] for col=1, row=0..3, colflags[1+flags_stride] for col=0,row=4..7, ...
This array avoids too much cache trashing when processing by 4 vertical samples
as done in the various decoding steps.
2016-05-23 11:53:53 +02:00
Even Rouault
31882ad7f4 Const'ify lut arrays so they are in the read-only data section 2016-05-22 00:54:06 +02:00
Even Rouault
ba1edf6cd4 Reduce number of occurrences of orient function argument
This is essentially used to shift inside the lut_ctxno_zc, which we
can precompute at the beginning of opj_t1_decode_cblk() /
opj_t1_encode_cblk()
2016-05-22 00:50:34 +02:00
Even Rouault
23a01dfdef Specialize decoding passes for 64x64 code blocks 2016-05-21 16:27:35 +02:00
Even Rouault
d8fef96f23 Improve code generation in opj_t1_dec_clnpass()
Add a opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit() method that
does the job of opj_t1_dec_clnpass_step_only() assuming the conditions
are met. And use it in opj_t1_dec_clnpass(). The compiler generates
more efficient code.
2016-05-21 15:52:02 +02:00
Even Rouault
c539808d09 opj_t1_updateflags(): tiny optimization
We can avoid using a loop-up table with some shift arithmetics.
2016-05-21 15:46:56 +02:00
Kal Conley
426bf8d337 Move some MQC functions into a header for speed
Allow these hot functions to be inlined. This boosts decode performance by ~10%.
2016-05-21 15:18:07 +02:00
Antonin Descampe
d0babeb6f6 WIP automatic release 2016-05-15 18:17:24 +02:00
Antonin Descampe
d1ca2b4f29 WIP: debug travis run script 2016-05-15 00:53:24 +02:00
Antonin Descampe
8ba0de3e45 Update travis and appveyor to enable automatic releases on tag commit 2016-05-15 00:42:54 +02:00
Antonin Descampe
2e0779e250 Update version number in CMakeLists.txt 2016-05-13 12:31:56 +02:00
Antonin Descampe
e55130d3c5 Update NEWS 2016-05-13 12:25:55 +02:00
Stefan Weil
4d2b6a671a Update implementation of opj_calloc (#705) 2016-05-10 22:08:49 +02:00
Stefan Weil
aae066debc Add missing source for the JPIP library and executables (issue #658) (#659)
They all need opj_malloc and other functions from opc_malloc.c.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-05-10 22:02:49 +02:00
mayeut
6609719b40 Correct expected result for test of issue 495 2016-05-08 20:26:12 +02:00
mayeut
1a8318f6c2 Fix Out-of-Bounds Access in function opj_tgt_reset
Fix uclouvain/openjpeg#775
2016-05-08 20:10:13 +02:00
mayeut
162f6199c0 Fix Heap Buffer Overflow in function color_cmyk_to_rgb
Fix uclouvain/openjpeg#774
2016-05-08 19:18:05 +02:00
mayeut
8f9cc62b3f Fix division by zero
Fix uclouvain/openjpeg#733
2016-05-08 18:40:12 +02:00
Matthieu Darbois
44a499f2ac Update lcms2 (#773)
Update to mm2/Little-CMS@e342f44
2016-05-03 22:22:03 +02:00
julienmalik
94cfb1b008 Merge pull request #769 from julienmalik/cmake_lowercase
Use lowercase for cmake commands consistenly
2016-05-02 21:57:55 +02:00
Julien Malik
17a0a8a195 Use lowercase for cmake commands consistenly
Inspired from https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/Maintenance/HowToCreateTheCMakeCaseConversion.txt
This needs vim 7.3 and fails with vim 7.4

This also fixes a number of :
- missing empty line at end of files
- useless space at end of lines
2016-05-02 16:05:41 +02:00
julienmalik
ba0cf122f6 Merge pull request #767 from julienmalik/fix_memset_null_pointer
Fix UBSan gcc warning for first arg to memset non null
2016-05-02 14:34:32 +02:00
julienmalik
da56086e01 Merge pull request #768 from julienmalik/filter_clang_warnings
Ignore clang's summary warning
2016-05-02 14:32:08 +02:00
Julien Malik
04b8cbd27a Ignore clang's summary warning
This assumes prior text has matched some other warning expression.

This reduces the warnings reported for clang build on the dashboard,
which were caused only by the "XXX warnings generated." message.
For some reason they were not reported when not using ctest launchers.

This commit allows to confidently use ctest launchers to improve
dashboard reports.
2016-05-02 12:55:43 +02:00
Julien Malik
e1e018a8dc Fix UBSan gcc warning for first arg to memset non null 2016-05-02 12:13:24 +02:00
Matthieu Darbois
b51d088267 Update to libtiff-4.0.6 (#764) 2016-05-01 18:05:46 +02:00
mayeut
4f11e89c80 Add tests for recent issues
Update uclouvain/openjpeg#725
Update uclouvain/openjpeg#726
2016-04-30 18:51:36 +02:00
Matthieu Darbois
9a20f8e8d1 Update lcms (#544)
Update to mm2/Little-CMS@0e8234e090
2016-04-30 17:58:04 +02:00
Antonin Descampe
72deb588cb Merge pull request #706 from mayeut/issue135
Fix issue 135
The fix is legal regarding the standard but I did not manage to find out if it covers a bug in opj_t2_read_packet_data or if the file is corrupted
2016-04-30 13:51:01 +02:00
mayeut
cd77b6003b Fix some coverity warnings 2016-04-30 12:15:22 +02:00
mayeut
f40a2ff2ad Fix bad call to fclose with NULL pointer 2016-04-30 01:50:33 +02:00
Matthieu Darbois
be42e72d22 Fix warnings (#763) 2016-04-30 01:12:16 +02:00
Matthieu Darbois
15f081c896 Fix Out-Of-Bounds Read in sycc42x_to_rgb function (#745)
42x Images with an odd x0/y0 lead to subsampled component starting at the
2nd column/line.
That is offset = comp->dx * comp->x0 - image->x0 = 1

Fix #726
2016-04-30 00:33:27 +02:00
Matthieu Darbois
ad593c9e06 Fix heap-buffer-overflow in color_esycc_to_rgb (#748)
When all components do not have the same dx/dy, components buffer are
read beyond their end.
Do not convert in this case.

Update uclouvain/openjpeg#725
2016-04-29 23:51:14 +02:00
julienmalik
319fc971fe cppcheck fix for openjp2 (#740) 2016-04-29 23:49:17 +02:00
Matthieu Darbois
e166e4a209 Check SSIZ is valid in opj_j2k_read_siz (#762) 2016-04-28 19:20:14 +02:00
Matthieu Darbois
29313eb5f1 Fix unsigned int overflow reported by UBSan (#761)
* Fix unsigned int overflow reported by UBSan

Please add -DOPJ_UBSAN_BUILD to CFLAGS when building with
-fsanitize=undefined,unsigned-integer-overflow

It seems clang/gcc do not allow to disable checking for block of code
other than function or file.
2016-04-28 13:16:43 +02:00
julienmalik
e982d03966 Fix implicit float-to-bool conversions (#752) 2016-04-28 11:52:45 +02:00
Matthieu Darbois
66fd497765 Fix unsigned int overflow reported by UBSan (#759) 2016-04-28 00:18:37 +02:00
mayeut
20789fed4e Fix issue 135
dwt_interleave_h.gsr105.jp2 now has the same output as kakadu
issue399 is corrupted. Only the corrupted part changes.

Update known failures for x86 MD5

NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
NR-DEC-issue135.j2k-68-decode-md5
2016-04-27 23:15:47 +02:00
julienmalik
5947e10ff7 Add clang 3.9 build to Travis matrix (#753) 2016-04-27 23:05:43 +02:00
Matthieu Darbois
e6881e7527 Fix negative shift left reported by UBSan (#758)
Follow-up of #757

This shall have no performance impact on 2’s complement machine where
the compiler replaces the multiplication by power of two (constant) by
a left shift.
Verified at least on MacOS Xcode 7.3, same assembly generated after fix.
2016-04-27 21:56:09 +02:00
Stefan Weil
2296dc9e68 Remove whitespace and CR at line endings (#678)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-04-26 22:12:11 +02:00
Matthieu Darbois
6f2ac3ee36 Fix negative shift left reported by UBSan (#757)
This shall have no performance impact on 2’s complement machine where
the compiler replaces the multiplication by power of two (constant) by
a left shift.
Verified at least on MacOS Xcode 7.3, same assembly generated after fix.
2016-04-26 22:06:06 +02:00
Matthieu Darbois
c559c62853 Do not define __attribute__ in opj_includes.h (#751)
Fix #727
2016-04-23 14:17:31 +02:00
Matthieu Darbois
a9feb9addd Merge pull request #750 from mayeut/issue-729-2
Allow to read/write 3/5/7/9/11/13/15 bpp TIF files
2016-04-23 10:51:46 +02:00
mayeut
74e814358c Allow to write 3/5/7/9/11/13/15 bpp TIF files
Update uclouvain/openjpeg#729
2016-04-23 04:29:03 +02:00
mayeut
54393d9e38 Allow to read 3/5/7/9/11/13/15 bpp TIF files 2016-04-23 04:24:04 +02:00
Matthieu Darbois
06e8dc9edd Merge pull request #746 from senbox-org/update_cmake_jpylyzer
Update cmake & jpylyzer for travis builds
2016-04-22 12:54:25 +02:00
Matthieu Darbois
f5446fdcfb Merge pull request #747 from julienmalik/update_libpng
update libpng to from 1.6.17 to 1.6.21
2016-04-22 10:48:40 +02:00
Julien Malik
8611d127db Import pnglibconf.h.prebuilt as new pnglibconf.h 2016-04-22 00:16:16 +02:00
Julien Malik
889bf16791 update libpng to from 1.6.17 to 1.6.21 2016-04-21 18:49:15 +02:00
Julien Malik
6ea2ff0b06 Update jpylyzer to 1.17.0 2016-04-21 17:58:19 +02:00
Julien Malik
3436c4e9ba upgrade cmake to 3.5.2 2016-04-21 17:53:40 +02:00
Antonin Descampe
e1a93d9e59 Merge pull request #708 from GrokImageCompression/issue_695
issue #695 MQ Encode: ensure that bp pointer never points to uninitialized memory
2016-04-18 10:51:51 +02:00
Antonin Descampe
a1c0ee9a86 Merge pull request #734 from senbox-org/opj_dump_dead_code
Remove dead code in opj_dump
2016-04-12 10:48:02 +02:00
Antonin Descampe
40b5a53d2f Merge pull request #735 from senbox-org/cppcheck_fix_openjp2
Fix uninitialized variable reported by cppcheck
2016-04-12 10:47:28 +02:00
Julien Malik
e7797b97a1 Fix uninitialized variable reported by cppcheck
Also reorder initialization to follow declaration order
2016-04-09 19:02:05 +02:00
Julien Malik
5e5f6999a8 Remove dead code in opj_dump 2016-04-09 18:34:11 +02:00
Aaron Boxer
0069a2bd2f suppress valgrind error - avoid accessing uninitialized memory in mq encoder 2016-01-30 10:05:46 -05:00
Aaron Boxer
e3100f714c issue #695 MQ Encode: ensure that bp pointer never points to uninitialized memory 2016-01-28 19:34:00 -05:00
Antonin Descampe
5c5ae1d51a fixed tile numbering
Fixes #245
2016-01-25 17:30:43 +01:00
Antonin Descampe
3767af52de Merge pull request #648 from stweil/alloc
Fix support of posix_memalloc for Linux
2016-01-23 19:43:09 +01:00
mayeut
1b86fb6f48 Update known failures 2016-01-11 00:35:47 +01:00
Matthieu Darbois
a42d03df79 Merge pull request #551 from mayeut/coc-qcc
Add COC/QCC in main header when needed
2016-01-11 00:23:44 +01:00
Mathieu Malaterre
cb33ff43bb Merge pull request #690 from rouault/failed_malloc_opj_dwt_encode_procedure
[git/2.1 regression] Fix opj_write_tile() failure when numresolutions=1
2016-01-09 14:53:29 +01:00
Even Rouault
6a1974d40d Add comment explaining bj is not use when l_data_size == 0 2016-01-09 14:30:48 +01:00
Even Rouault
87c0d7dc1e [git/2.1 regression] Fix opj_write_tile() failure when numresolutions=1
When trying the GDAL OpenJPEG driver against openjpeg current master HEAD,
I get failures when trying to create .jp2 files. The driver uses
opj_write_tile() and in some tests numresolutions = 1.

In openjp2/dwt.c:410, l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * (OPJ_UINT32)sizeof(OPJ_INT32);
is called and returns l_data_size = 0. Now in git opj_malloc() has a special case
for 0 to return a NULL pointer whereas previously it relied on system malloc(),
which in my case didn't return NULL.

So only test the pointer value if l_data_size != 0. This makes the GDAL
autotest suite to pass again.
2016-01-08 19:38:45 +01:00
Matthieu Darbois
0dd44e7dba Merge pull request #687 from stweil/memalign
Fix fatal crash on 64 bit Linux
2016-01-06 23:15:05 +01:00
Stefan Weil
9cad6bc1f6 Fix fatal crash on 64 bit Linux
By default, OpenJPEG uses the function memalign to allocate aligned
memory on Linux systems. That function needs malloc.h which was
missing. This results in a compiler warning:

openjpeg/src/lib/openjp2/opj_malloc.c:63:3: warning:
 implicit declaration of function ‘memalign’
 [-Wimplicit-function-declaration]

On hosts where sizeof(int) < sizeof(void *) the return value of memalign
will be truncated which results in an invalid pointer.

That caused "make test" to produce lots of segmentation faults when
running on a 64 bit Linux host.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 21:40:09 +01:00
Stefan Weil
79b1c4cc85 Fix whitespace issues in opj_malloc.c
Some lines ended with spaces. Remove them.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 21:40:01 +01:00
Stefan Weil
c00ee8bff7 Fix support of posix_memalign for Linux
posix_memalign is only declared conditionally in stdlib.h,
so add one of the possible definitions to get the declaration.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 18:06:45 +01:00
Matthieu Darbois
a205f70328 Merge pull request #686 from mayeut/master
[libtiff] Add missing include statement for ssize_t
Close #681
2016-01-06 18:04:51 +01:00
mayeut
9c5b30005e Add missing include statement for ssize_t
Update uclouvain/openjpeg#681
2016-01-06 17:37:37 +01:00
mayeut
83e5e2703e Merge remote-tracking branch 'uclouvain/master' 2016-01-06 17:09:14 +01:00
Matthieu Darbois
3a0253f4e2 Merge pull request #684 from stweil/typo
Fix duplicate article in comments
2016-01-06 17:01:48 +01:00
Stefan Weil
99c4f621bd Fix duplicate article in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 08:55:29 +01:00
mayeut
2e4fadf330 Merge remote-tracking branch 'uclouvain/master' 2016-01-03 02:09:04 +01:00
Matthieu Darbois
8f9905936c Merge pull request #679 from stweil/grammar
Fix grammar in comment
2015-12-31 11:45:51 +01:00
Stefan Weil
a834ab305f Fix grammar in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-12-31 10:13:26 +01:00
Matthieu Darbois
51efe91971 Merge pull request #665 from jwilk/spelling
Fix typos
2015-12-23 20:55:47 +01:00
Jakub Wilk
4ddc2627dd Fix typos 2015-11-27 21:38:41 +01:00
mayeut
5d56fb3115 Add known failures
2 more tests failing under AppVayor since nov-6 update
Update #655
2015-11-07 14:50:28 +01:00
Matthieu Darbois
51cbcd5748 Merge pull request #654 from mayeut/master
Fix undefined size jp2 box handling
2015-11-07 14:35:45 +01:00
mayeut
f51d52f85a Revert "Check for appveyor update"
This reverts commit c414d9c238.
2015-11-07 02:59:38 +01:00
mayeut
c414d9c238 Check for appveyor update 2015-11-07 02:40:18 +01:00
mayeut
e5ca873ab1 Fix missing bracket 2015-11-07 02:06:22 +01:00
mayeut
601aa38c30 fix appveyor build 2015-11-07 02:04:10 +01:00
mayeut
fb4be3894e Fix undefined size jp2 box handling
Update #653
2015-11-07 01:35:43 +01:00
mayeut
c37d69b25e Fix Travis cmake install 2015-11-02 22:28:30 +01:00
mayeut
a77717583e Update cmake for travis ASan build 2015-11-02 22:02:55 +01:00
Matthieu Darbois
968085190c Merge pull request #651 from stweil/fix
opj_decompress: Update error message
2015-11-02 21:49:25 +01:00
Stefan Weil
93a61459cd opj_decompress: Update error message
The png format is also supported, so add it to the message.
Remove also the unneeded blank character before \n.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 21:01:20 +01:00
mayeut
38ffbbe42e Fin compiler warnings 2015-11-01 17:08:47 +01:00
mayeut
ce26e523dd Fix compiler warnings 2015-11-01 16:56:50 +01:00
Stefan Weil
7dfcbf9d7b convert: Fix compiler warnings
Fix this and other similar compiler warnings:

src/bin/jp2/convert.c: In function ‘tga_readheader’:
src/bin/jp2/convert.c:595:5: warning:
 dereferencing type-punned pointer will break strict-aliasing rules
 [-Wstrict-aliasing]
     cmap_len = get_ushort(*(unsigned short*)(&tga[5]));

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 16:54:38 +01:00
Stefan Weil
4ac509182a convert: Remove unneeded type casts
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 16:53:55 +01:00
Matthieu Darbois
0ae66e891a Merge pull request #647 from stweil/master
Fix typo in comments
2015-10-30 22:50:06 +01:00
Stefan Weil
9f78c68953 Fix typo in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-29 20:37:27 +01:00
Matthieu Darbois
f080ab8ce0 Merge pull request #638 from stweil/master
Fix format strings and unneeded assignment
2015-10-21 20:53:22 +02:00
mayeut
e975ca2832 Merge branch 'master' into coc-qcc 2015-10-21 20:45:50 +02:00
Matthieu Darbois
b06bed7b7b Merge pull request #644 from smuehlst/opj_aligned_malloc
Avoid pointer arithmetic with (void *) pointers
2015-10-21 10:10:38 +02:00
Stephan Mühlstrasser
b7a162348d Avoid pointer arithmetic with (void *) pointers. 2015-10-21 09:01:31 +02:00
Stephan Mühlstrasser
540aa58f6c Merge branch 'master' into opj_aligned_malloc
Conflicts:
	src/lib/openjp2/opj_malloc.c
2015-10-21 08:57:45 +02:00
mayeut
d48be27f5a Generic aligned malloc implementation update.
Update #642
2015-10-21 00:09:04 +02:00
Stephan Mühlstrasser
eaf55b677c Generic aligned malloc implementation.
Used for platforms where none of posix_memalign(), memalign() and
_aligned_malloc() is available.
2015-10-20 21:34:54 +02:00
Stephan Mühlstrasser
0967d64854 Generic aligned malloc implementation.
Used for platforms where none of posix_memalign(), memalign() and
_aligned_malloc() is available.
2015-10-20 13:02:51 +02:00
Matthieu Darbois
5799672237 Merge pull request #641 from smuehlst/opj_hp_issue_640
Fix HP compiler warning about redeclaration of function
Fix #640
Fix #243
2015-10-19 22:23:54 +02:00
Stephan Mühlstrasser
a1fc83cc25 Fix HP compiler warning about redeclaration of function (#640)
HP compiler warns:
cc: "dwt.c", line 798: warning 562: Redeclaration of "opj_v4dwt_decode"
with a different storage class specifier: "opj_v4dwt_decode" will have
internal linkage.
cc: "t2.c", line 1341: warning 562: Redeclaration of "opj_t2_init_seg"
with a different storage class specifier: "opj_t2_init_seg" will have
internal linkage.
2015-10-19 12:14:27 +02:00
Stefan Weil
ad7eb5630e Fix format strings and unneeded assignment
The static code analyzer cppcheck warns about unsigned integers
which use "%d" in the format string.

It also warns about an unneeded assignment.

Fix both issues.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-18 19:52:57 +02:00
Matthieu Darbois
4831badeb4 Merge pull request #637 from stweil/fixes
Fix repository for JPEG2000 test data
2015-10-18 14:42:58 +02:00
mayeut
80be580d50 Merge branch 'master' into coc-qcc 2015-10-18 03:23:38 +02:00
Matthieu Darbois
05b3afd28f Merge pull request #636 from uclouvain/opj_malloc-625
Update allocation functions
Fix #625 
Fix #624
Fix #635
2015-10-18 03:14:55 +02:00
mayeut
e1122a8f50 Cleanup includes 2015-10-18 02:52:33 +02:00
mayeut
f9d47e28b9 Fix _aligned_malloc usage 2015-10-18 02:23:01 +02:00
mayeut
8034ffde8b Fix inconsistent behavior of malloc(0)
Update #635
Update #625
2015-10-17 02:55:09 +02:00
mayeut
b3a15954f6 Add missing checks. Fix crash on failed allocation. 2015-10-17 02:16:17 +02:00
mayeut
83249c318f Fixed crash on encoding
Update #624
Update #625
2015-10-17 01:30:23 +02:00
Matthieu Darbois
b1a8e1adcb Change link for appveyor 2015-10-15 23:31:42 +02:00
Matthieu Darbois
ee04854e1a Merge pull request #634 from smuehlst/opj_aix_issue_633
Fix  #633.
2015-10-15 13:14:58 +02:00
Stephan Mühlstrasser
b3c581760f Fix OpenJPEG GitHub issue #633.
"opj_includes.h" must be included before system headers, otherwise
inconsistent definitions of configuration macros lead to build
failures on AIX.
2015-10-15 10:53:33 +02:00
Matthieu Darbois
bd3959dc77 Merge pull request #632 from mayeut/travis-reduce
travis-ci: Include add ons in matrix
2015-10-15 01:18:17 +02:00
mayeut
fd424cfb66 travis-ci: Include add ons in matrix 2015-10-15 00:58:58 +02:00
mayeut
e734f0522a Remove useless environment variables 2015-10-15 00:17:05 +02:00
mayeut
9729405a8f Add ABI check for PR 2015-10-14 22:43:39 +02:00
Matthieu Darbois
65f78eaa73 Use SPDX full name & identifier for license 2015-10-13 23:54:18 +02:00
Matthieu Darbois
08238dbed6 Add appveyor status badge & license badge 2015-10-13 23:24:10 +02:00
mayeut
c8d03fea9b Merge branch 'master' into coc-qcc 2015-10-13 21:57:58 +02:00
mayeut
6721f8a53f Correct unbound variable 2015-10-13 21:37:11 +02:00
Matthieu Darbois
54a5860ee2 Merge pull request #627 from mayeut/appveyor
Add Appveyor
2015-10-13 21:27:01 +02:00
Mathieu Malaterre
372fead0d7 Remove the explicit restrict keyword
It would trigger a compiler error on xlc compiler.  Fixes #620
2015-10-13 21:07:11 +02:00
Giuseppe Baruffa
98324bbd6b I do not recall exactly... I would say that the correct version should be
if (!JPWL_ASSUME)
    return false;

meaning that once JPWL_ASSUME=1 the code will pass over such errors and try to decode anyway (just paired with the other JPWL_ASSUME on line 1112).

Fixes #596
2015-10-13 15:20:54 +02:00
mayeut
522d13af2a Update ci install script 2015-10-12 21:29:16 +02:00
Mathieu Malaterre
26dcb7c125 Remove a possible uninitialized variable
Fixes #629
2015-10-12 21:29:12 +02:00
Mathieu Malaterre
51a67a9cbf Minor style fix to remove c++ comments 2015-10-12 21:25:53 +02:00
Mathieu Malaterre
dd81b5892d minor tweaks to the code 2015-10-12 21:24:10 +02:00
mayeut
0cd240e2e3 Add appveyor.yml 2015-10-11 17:59:54 +02:00
mayeut
dac03fd168 Add exceptions 2015-10-11 17:33:40 +02:00
mayeut
d02bf257a6 Find out Visual Studio version 2015-10-11 17:10:48 +02:00
mayeut
0f1b1c63b4 Add exceptions 2015-10-11 13:47:44 +02:00
mayeut
11a27e6d20 Correct exceptions 2015-10-10 23:43:50 +02:00
Mathieu Malaterre
ab8929262a Fix an issue with parenthesis 2015-10-10 21:03:44 +02:00
mayeut
813121e688 Add exceptions 2015-10-10 20:01:03 +02:00
mayeut
7a7901cd6d Correct script 2015-10-10 19:29:53 +02:00
mayeut
c5a8732b0e Update kdu copy 2015-10-10 19:26:42 +02:00
mayeut
101a0034e2 Re-enable cloning data 2015-10-10 19:20:50 +02:00
mayeut
2c8ba10cc9 update script 2015-10-10 19:15:52 +02:00
mayeut
30a0180d84 correct kdu copy 2015-10-10 19:02:35 +02:00
mayeut
99c4376aed kdb copy 2015-10-10 18:58:26 +02:00
mayeut
c3493063b9 correct OPJ_SITE 2015-10-10 18:45:58 +02:00
mayeut
4042210416 run with appveyor 2015-10-10 18:39:59 +02:00
Mathieu Malaterre
dc869c2985 Add paranoid sentinels 2015-10-10 18:38:08 +02:00
mayeut
caeb91121a export updated path 2015-10-10 18:34:21 +02:00
mayeut
891e7c298a debug appveyor 2015-10-10 18:29:37 +02:00
mayeut
d60937922f correct warnings 2015-10-10 18:24:57 +02:00
mayeut
229d9cdb9c export TRAVIS_OS_NAME 2015-10-10 18:21:42 +02:00
mayeut
f0a980ec16 verbose 2015-10-10 18:19:09 +02:00
mayeut
cc9bf1d557 Use make under windows 2015-10-10 18:15:28 +02:00
mayeut
a01f7cdee0 debug appveyor 2015-10-10 18:01:43 +02:00
Mathieu Malaterre
d753441028 implement a portable aligned realloc 2015-10-10 17:51:29 +02:00
mayeut
53d7f70c15 remove cygwin specifics 2015-10-10 17:51:13 +02:00
mayeut
70a16d80d9 Debug build 2015-10-10 17:31:04 +02:00
mayeut
4560d270e0 Correct make script 2015-10-10 17:27:49 +02:00
mayeut
f33f50126c Add OPJ_BINARY_DIR 2015-10-10 17:25:50 +02:00
mayeut
8d2019ae73 Correct source path 2015-10-10 17:16:25 +02:00
mayeut
cf6db1641a get proper path 2015-10-10 17:12:05 +02:00
mayeut
9df5546838 Change OS guessing 2015-10-10 17:05:11 +02:00
mayeut
b816ac185b change os guessing 2015-10-10 16:50:30 +02:00
mayeut
d92c2b2117 Run under appveyor 2015-10-10 16:44:07 +02:00
mayeut
d035952c52 jpylyzer download 2015-10-10 15:18:12 +02:00
mayeut
1ed6ede703 Debug wget jpylyzer 2015-10-10 15:14:16 +02:00
mayeut
d03c4770cb Continue debugging wget jpylyzer 2015-10-10 15:08:25 +02:00
mayeut
50b561e911 Debug wget jpylyzer on appveyor 2015-10-10 14:57:25 +02:00
Mathieu Malaterre
2d410fc74b do not use aligned_alloc since it requires c11 2015-10-10 14:54:21 +02:00
mayeut
d5c460fc5f Download jpylyzer for windows 2015-10-10 14:51:30 +02:00
mayeut
62006e2b26 which provided by git, try wget 2015-10-10 14:30:15 +02:00
mayeut
d05b19072d Add appveyor support 2015-10-10 14:19:57 +02:00
mayeut
32ac092dec Disable ABI check. Keep API check. 2015-10-10 00:23:54 +02:00
mayeut
27102f0b06 Update ABI tools 2015-10-09 23:51:54 +02:00
mayeut
87d44603a0 Update exception list for gcc 4.6.4 2015-10-09 23:19:23 +02:00
mayeut
74f71ec923 Use matrix 2015-10-09 23:00:06 +02:00
mayeut
5c3632b00e Remove travis debugging 2015-10-09 22:24:51 +02:00
mayeut
a4eade843f disable output for diff build 2015-10-09 22:23:32 +02:00
mayeut
cba89a62a1 Revert modification made to check incompatibility 2015-10-09 22:20:16 +02:00
mayeut
4123c0ba86 Merge branch 'master' into travis-abi 2015-10-09 22:16:37 +02:00
mayeut
1a9cb9aef7 Use gcc-4.8 for ABI tracker 2015-10-09 22:09:50 +02:00
Mathieu Malaterre
0dc4914b4e cleanup header file and move to implementation 2015-10-09 22:04:04 +02:00
mayeut
e224dee4b8 travis debugging 2015-10-09 21:52:39 +02:00
mayeut
d2ddf006a6 retrieve & compile wdiff 2015-10-09 21:48:33 +02:00
mayeut
a7ae153a46 ABI Check 2015-10-09 21:20:54 +02:00
mayeut
de0a9ed103 Revert "Make sure to allocate on 16bits alignement. Fix issue #624"
This reverts commit 553714a87a.
2015-10-09 21:13:06 +02:00
Mathieu Malaterre
553714a87a Make sure to allocate on 16bits alignement. Fix issue #624 2015-10-09 15:37:09 +02:00
mayeut
1b2ebfc69a Add ABI tracker 2015-10-08 20:06:59 +02:00
mayeut
3259fe2ff8 Merge branch 'master' into coc-qcc 2015-10-08 19:11:52 +02:00
Matthieu Darbois
bbef2a9da3 Merge pull request #584 from mayeut/travis-matrix
Add Travis-ci build matrix
2015-10-08 19:04:24 +02:00
mayeut
5b6ff103bd Merge branch 'master' into travis-matrix 2015-10-07 21:14:38 +02:00
mayeut
c86827952f Merge remote-tracking branch 'uclouvain/master' 2015-10-07 21:07:24 +02:00
Matthieu Darbois
9b437b0c6a Merge pull request #623 from stweil/c++
Fix warnings for C++
2015-10-07 21:05:25 +02:00
Stefan Weil
c8ae3c5225 Fix warnings for C++
g++ complains about invalid conversions like these ones:

error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
error: invalid conversion from ‘void*’ to ‘opj_precision* {aka opj_prec*}’ [-fpermissive]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-07 20:53:57 +02:00
Matthieu Darbois
07f65540b5 Merge pull request #622 from smuehlst/opj_enum_bit_flags
Fixed problem that C++ compilation failed because of enum variable.
Fixes  #619
2015-10-07 20:44:05 +02:00
Stephan Mühlstrasser
8414870ca7 Fixed problem that C++ compilation failed because of enum variable.
Replaced usage of an enum typedef for a variable that is used
for bit flags with OPJ_UINT32 type.
2015-10-07 12:28:12 +02:00
mayeut
2dab5fed59 Merge branch 'master' into coc-qcc 2015-10-06 20:55:36 +02:00
mayeut
26b2728c49 Merge branch 'master' into travis-matrix 2015-10-06 20:54:16 +02:00
mayeut
e526d435cc Merge remote-tracking branch 'uclouvain/master' 2015-10-06 20:48:37 +02:00
Matthieu Darbois
f8c8222660 Merge pull request #618 from smuehlst/opj_malloc_casts
Added missing casts for return values of opj_malloc()/opj_calloc().
2015-10-06 16:24:20 +02:00
Stephan Mühlstrasser
d6b51b7041 Added missing casts for return values of opj_malloc()/opj_calloc(). 2015-10-06 15:33:46 +02:00
mayeut
987f96004f Merge branch 'master' into travis-matrix 2015-10-05 21:50:59 +02:00
mayeut
0b6a592372 Merge remote-tracking branch 'uclouvain/master' 2015-10-05 21:49:39 +02:00
Matthieu Darbois
83c9e0b1f2 Merge pull request #617 from mayeut/tpsot-tnsot-noseek
Add check for seek support before trying TPsot==TNsot workaround
2015-10-05 11:45:56 +02:00
mayeut
db23831d57 Add check for seek support before trying TPsot==TNsot workaround 2015-10-02 22:33:44 +02:00
Stefan Weil
0cfe2ca4a9 Fix repository for JPEG2000 test data
The data is now maintained in a git repository on Github.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-09-29 15:28:43 +02:00
mayeut
cf352af089 Fix up-scaling bit depth
Fixes #609
2015-09-29 09:28:34 +02:00
Matthieu Darbois
c59f464a3f Merge pull request #610 from stweil/master
Fix some typos found by codespell
2015-09-29 08:24:43 +02:00
Stefan Weil
05235963d9 Fix typo in variable name
This makes checks with codespell easier.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-09-29 05:57:09 +02:00
Stefan Weil
99fc1ab306 Fix typos in comments and string
Most typos were found by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-09-29 05:55:43 +02:00
mayeut
f7dbcf1512 Merge branch 'master' into travis-matrix 2015-09-25 22:27:56 +02:00
mayeut
838dfb8058 Provide safer string copy than strncpy
As per @boxerab suggestion in commit
b9ca882749
2015-09-25 22:04:58 +02:00
mayeut
4da7e9617f Fix resource leak 2015-09-25 00:39:05 +02:00
mayeut
b9ca882749 Fix resource leaks & unchecked resource allocations 2015-09-25 00:08:34 +02:00
mayeut
f9df8ba19a Fix some resource leaks 2015-09-24 23:32:03 +02:00
mayeut
09c35dcb84 Merge branch 'master' into travis-matrix 2015-09-23 21:20:11 +02:00
mayeut
f82d7f3a63 Use buffer on stack to read TGA header
Fixes a potential leak
Fixes #601
2015-09-23 21:17:06 +02:00
mayeut
faf63fddad Fix warning in rle4 decoding 2015-09-23 21:09:19 +02:00
Matthieu Darbois
281537851b Add Coverity Scan status 2015-09-17 14:24:06 +02:00
mayeut
55dbf8acff Fix resource leak in opj_j2k_create_cstr_index
Fixes #599
2015-09-17 12:46:42 +02:00
mayeut
c16c91797f Fix resource leak in opj_j2k_encode
Fixes #598
2015-09-17 12:41:41 +02:00
mayeut
a4e93c3b0a fix resource leak in opj_j2k_decode_one_tile
Fixes #597
2015-09-17 12:31:18 +02:00
mayeut
4bb5e24d23 Merge branch 'master' into coc-qcc 2015-09-17 02:12:27 +02:00
Mathieu Malaterre
6cb56b36f6 Update opj_decompress man page 2015-09-16 20:54:34 +02:00
Mathieu Malaterre
9c911c0e1e Update the version number 2015-09-16 20:49:45 +02:00
mayeut
3ea4486bed Travis-ci update
Correct case in config
Check DynamicAnalysis result
2015-09-14 20:09:50 +02:00
mayeut
6e11b55441 Travis-ci add linux gcc x86_64 Debug 2015-09-14 19:37:56 +02:00
mayeut
c6b2fdf572 correct MemCheck log filename 2015-09-13 16:34:17 +02:00
mayeut
700f8cb4f8 Ignore ctest return code
ctest behavior is not consistent across versions.
Ignore return code & parse logs
2015-09-13 16:09:24 +02:00
mayeut
7d32f11a6f Merge branch 'master' into travis-matrix 2015-09-13 14:58:01 +02:00
Matthieu Darbois
b4e8a425ae Merge pull request #590 from mayeut/master
Correct leak in color_cielab_to_rgb
2015-09-13 14:55:13 +02:00
mayeut
c8a3117659 Fix function name 2015-09-13 14:51:00 +02:00
mayeut
49cbc11a19 Correct leak in color_cielab_to_rgb 2015-09-13 14:42:56 +02:00
mayeut
3d295431e6 Travis set ASan build to -O1 2015-09-12 20:21:52 +02:00
mayeut
c08bd89739 Travis fix error when no tests are done 2015-09-12 20:06:31 +02:00
mayeut
1621df453d Travis error on new failures 2015-09-12 19:32:05 +02:00
mayeut
0b611c5250 Travis full matrix 2015-09-12 18:21:25 +02:00
mayeut
b8ba5a8357 Travis mingw 2015-09-12 18:12:38 +02:00
mayeut
9add0fe298 Travis mingw 2015-09-12 18:10:38 +02:00
mayeut
ecb00ea4e4 Travis mingw 2015-09-12 18:06:31 +02:00
mayeut
cde7423958 Travis add mingw 2015-09-12 17:56:29 +02:00
mayeut
6c157b60f2 Fix Travis ASan build 2015-09-12 16:37:47 +02:00
mayeut
fc131a1339 Travis ASan build 2015-09-12 16:36:19 +02:00
mayeut
4f157f3cf0 Fix matrix for debug build 2015-09-12 16:16:19 +02:00
mayeut
41730e8cc6 Travis add debug config 2015-09-12 16:11:56 +02:00
mayeut
82c238f504 Fix OPJ_CI_SKIP_TESTS 2015-09-12 15:52:13 +02:00
mayeut
52c36b4955 Add 32 bit build 2015-09-12 15:48:23 +02:00
mayeut
b7069ce2b2 Download kakadu on osx 2015-09-12 13:03:50 +02:00
mayeut
cc2ae75450 Fix build with gcc 4.6.3 2015-09-12 05:50:57 +02:00
mayeut
b97aadcf3e Fix travis build with make 2.8.7 2015-09-12 05:44:52 +02:00
mayeut
1e2dcaf7b3 Add ctest script 2015-09-12 05:26:19 +02:00
mayeut
175eceb020 Fix matrix 2015-09-12 03:19:42 +02:00
mayeut
7981908754 Fix unbound variable 2015-09-12 03:13:45 +02:00
mayeut
9258f8f6a7 Use make to unzip kakadu 2015-09-12 03:02:42 +02:00
mayeut
41a96aee5a Fix fetching of openjpeg-data
Fetch from master branch if TRAVIS_BRANCH doesn’t exist
2015-09-12 02:59:49 +02:00
mayeut
897d2c0b75 Enhance travis run script 2015-09-12 02:34:14 +02:00
mayeut
e3579b6c1d Revert "Setup travis matrix"
This reverts commit 8d46ac19ff.
2015-09-12 02:20:22 +02:00
mayeut
8d46ac19ff Setup travis matrix
This is just to get some ideas of what can be done.
Update uclouvain/openjpeg#581
2015-09-12 02:19:28 +02:00
Matthieu Darbois
4b02d246a4 Merge pull request #578 from mayeut/travis-ci
Travis-ci update, use Kakadu for testing
2015-09-11 21:36:07 +02:00
mayeut
47b7b2787b Echo Kakadu copyright notice
Move to script so that travis-ci doesn’t hide this by default
2015-09-11 21:25:45 +02:00
mayeut
c31a28fcd1 Echo Kakadu copyright notice 2015-09-11 21:21:22 +02:00
mayeut
cd10f46572 Echo Kakadu copyright notice 2015-09-11 21:15:17 +02:00
mayeut
29ce132df4 Echo Kakadu copyright notice 2015-09-11 21:04:49 +02:00
Matthieu Darbois
5d953558de Merge pull request #579 from mayeut/lossless
Correct lossless issue on linux x86
Fix #571
2015-09-11 14:39:43 +02:00
Matthieu Darbois
bac2c9e0a3 Change test in opj_tcd_makelayer
Remove float equality test. Such a test has no meaning.
2015-09-11 14:17:30 +02:00
Matthieu Darbois
ee0f313848 Update check in opj_tcd_makelayer to be robust to different float precisions 2015-09-10 15:46:51 +02:00
Matthieu Darbois
ccdce606f1 Fix threshold calculation
It doesn't change the outcome of the test suite, that's weird...
2015-09-10 15:10:14 +02:00
mayeut
d7d9f84707 Remove invalid assert in compare_images 2015-09-10 08:04:59 +02:00
mayeut
4cde646cd7 Add test for uclouvain/openjpeg#571 2015-09-10 01:24:46 +02:00
mayeut
5f02757eef Correct lossless issue on linux x86
Update uclouvain/openjpeg#571
2015-09-10 00:39:23 +02:00
mayeut
4f5ec07c31 Remove C++ comment 2015-09-09 23:38:46 +02:00
mayeut
0a27667878 Add notice for kakadu use 2015-09-09 21:35:50 +02:00
mayeut
66d890bf22 Merge remote-tracking branch 'uclouvain/master' into coc-qcc 2015-09-08 22:33:07 +02:00
mayeut
dd00120e96 Add Kakadu tests 2015-09-08 22:24:06 +02:00
mayeut
e71247bb90 correct untar of jpylyzer 2015-09-08 01:50:18 +02:00
mayeut
a024980007 Add jpylyzer tests 2015-09-08 01:47:26 +02:00
mayeut
dc46d267f0 Add build results to CDash 2015-09-08 01:19:44 +02:00
mayeut
c32809d464 Submit test results to CDash 2015-09-08 00:32:20 +02:00
mayeut
5be56d582c Set tests succeed for now 2015-09-07 23:31:28 +02:00
mayeut
bd291ae5a8 Add tests when running travis-ci 2015-09-07 23:19:40 +02:00
mayeut
f1ba09f690 Add tests when running travis-ci 2015-09-07 23:16:48 +02:00
mayeut
4eabbc8661 Add travis-ci build status 2015-09-07 22:47:32 +02:00
mayeut
e4be47279d Add travis-ci script 2015-09-07 22:40:11 +02:00
mayeut
29c644ec49 Correct mismatching delete
Fixes #575
2015-09-07 19:24:20 +02:00
mayeut
940100c28a Fix potential use-after-free in opj_j2k_write_mco function
Fixes #563
2015-09-06 17:24:03 +02:00
mayeut
c31fb68ccc fix resource leak in jpwl
Fixes #573
2015-09-06 17:18:37 +02:00
Matthieu Darbois
15d07f33d1 Merge pull request #572 from mayeut/master
Correct CMake version requirements
2015-09-01 20:53:25 +02:00
mayeut
c5dd6035c9 Correct CMake version requirements
Update uclouvain/openjpeg#488
2015-09-01 20:43:43 +02:00
mayeut
2eb97a851d Update tests 2015-08-23 12:32:21 +02:00
mayeut
8a95efcd3f Fix some UBSan warnings 2015-08-23 11:43:38 +02:00
mayeut
38770403d4 Fix some calculations in opj_tcd_init_tile
Fixes #486
Fixes #394
Update #480
Update #388
2015-08-23 11:38:04 +02:00
Matthieu Darbois
589cc547b9 Merge pull request #567 from mayeut/master
Add tests for CMYK/esYCC/CIELab
2015-08-21 21:44:05 +02:00
mayeut
a521472427 Add tests for CMYK/esYCC/CIELab 2015-08-21 21:41:50 +02:00
mayeut
d4ac2f613d Fix formatting 2015-08-21 20:17:55 +02:00
mayeut
fa9142b7e4 Fix formatting 2015-08-21 20:15:50 +02:00
mayeut
f98df1c715 TIFF can output CMYK 2015-08-21 19:54:22 +02:00
Matthieu Darbois
3109759fd7 Merge pull request #559 from szukw000/cmyk-cielab-esycc
Add support for CIELab, EYCC and CMYK
2015-08-21 19:48:31 +02:00
mayeut
0a4ac0852a Merge remote-tracking branch 'uclouvain/master' into coc-qcc 2015-07-31 01:50:55 +02:00
mayeut
dc34a6cc8c Add test for #388 2015-07-31 01:48:51 +02:00
szukw000
238f4419ab Defines three new functions
Declares three new functions
Calls the three new functions
Collects data for CIELab, sets the color_space for EYCC and CMYK
2015-07-30 23:31:12 +00:00
mayeut
60301842c7 Sync coc-qcc branch with master 2015-07-31 01:07:14 +02:00
ak-dxdy
acbb297a0a Small correction + attempt to understand git-openjpeg workflow 2015-07-31 00:51:31 +02:00
ak-dxdy
4fc1073809 French comments replaced by English ones 2015-07-31 00:51:08 +02:00
Matthieu Darbois
7c688c3453 Merge pull request #558 from mayeut/remove-printf
Remove printf/fprintf to stdout/stderr throughout openjp2 lib
2015-07-30 23:37:20 +02:00
mayeut
372c887aad Fix typo (that brakes building with '-DBUILD_MJ2:bool=on')
Fixes #556
2015-07-30 23:34:12 +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
75a33de3bc Merge pull request #552 from mayeut/jpylyzer
Add jpylyzer tests for JP2 compression
2015-07-30 18:13:15 +02:00
Matthieu Darbois
f026c0541e Merge pull request #555 from rdieter/master
better -ffast-math handling
2015-07-30 18:09:42 +02:00
Rex Dieter
e4735c703d better -ffast-math handling
issue #488

See also
http://public.kitware.com/pipermail/cmake/2015-April/060479.html
2015-07-30 09:54:07 -05:00
mayeut
ae7953849b Add jpylyzer tests for JP2 compression
Unify syntax
2015-07-30 01:33:04 +02:00
mayeut
1947323329 Add jpylyzer tests for JP2 compression 2015-07-30 01:27:34 +02:00
mayeut
c3d9719cd4 Write COC/QCC in Main Header
Update uclouvain/openjpeg#459
2015-07-29 00:29:49 +02:00
mayeut
2263b6bacc Start support for qcc/coc 2015-07-28 23:58:10 +02:00
Matthieu Darbois
5b66156be4 Merge pull request #550 from mayeut/msvc-emul
Use __emul under msvc x86 for fast 64 = 32 * 32
2015-07-27 20:14:18 +02:00
mayeut
b0035538af Use __emul under msvc x86 for fast 64 = 32 * 32
Update uclouvain/openjpeg#220
2015-07-27 20:12:48 +02:00
mayeut
45ccf501f0 Fix ARM build with Visual Studio 2015-07-26 21:12:36 +02:00
mayeut
15e4168ee2 Remove some warnings when building
Update #442
2015-07-26 19:19:31 +02:00
mayeut
2452bb7c45 Remove some warnings when building
Update #442
2015-07-26 19:01:52 +02:00
mayeut
85904a3291 Fix libtiff build with Visual Studio 2010 2015-07-26 18:49:23 +02:00
Matthieu Darbois
012f22958a Merge pull request #549 from mayeut/master
Update convert for PNG output
2015-07-26 18:29:30 +02:00
mayeut
f3dad25c77 Update convert for PNG output
Update uclouvain/openjpeg#264
2015-07-26 18:28:03 +02:00
mayeut
e6cf1744d4 Remove some warnings when building
Update #442
2015-07-26 13:41:59 +02:00
Matthieu Darbois
db9b3400e5 Merge pull request #548 from mayeut/master
Remove some warnings when building
2015-07-26 02:42:41 +02:00
mayeut
c423cc84e7 Remove some warnings when building
Update #442
2015-07-26 02:41:39 +02:00
Matthieu Darbois
d87de3a88d Merge pull request #547 from mayeut/libpng-1.6.17
Switch to libpng-1.6.17
2015-07-25 20:33:36 +02:00
mayeut
6007ac5c56 Switch to libpng-1.6.17 2015-07-25 19:48:21 +02:00
Matthieu Darbois
335e972554 Merge pull request #528 from mayeut/zlib-1.2.8
Update zlib to version 1.2.8
2015-07-25 19:00:51 +02:00
Matthieu Darbois
8c4afeff40 Merge pull request #521 from manisandro/bigendian
Fix opj_write_bytes_BE
Fixes #472 
Fixes #345 
Fixes #518
2015-07-25 15:54:26 +02:00
mayeut
ffd9db9700 Remove some warnings when building
Update #442
2015-07-25 03:16:16 +02:00
mayeut
b190a91ab5 Remove some warnings when building
Update #442
2015-07-24 23:55:45 +02:00
Matthieu Darbois
f6843d5511 Merge pull request #545 from mayeut/master
Add some missing static keywords
2015-07-23 07:49:58 +02:00
mayeut
a56819eaab Add some missing static keywords
Update uclouvain/openjpeg#243
2015-07-23 07:48:42 +02:00
Matthieu Darbois
d6f2d26430 Merge pull request #543 from mayeut/master
Prevent overflow when coding 16 bits images
2015-07-22 00:19:38 +02:00
mayeut
9ac3a1572e Prevent overflow when coding 16 bits images
Update uclouvain/openjpeg#539
2015-07-22 00:10:32 +02:00
Matthieu Darbois
0905cab40a Merge pull request #542 from mayeut/lcms2-2.6
Switch to libcms2-2.6
2015-07-22 00:03:44 +02:00
mayeut
2fc9d4956a Switch to libcms2-2.6 2015-07-21 23:49:11 +02:00
Matthieu Darbois
28c6f54798 Merge pull request #533 from mayeut/refactor-read-ppX
Refactor opj_j2k_read_ppm & opj_j2k_read_ppt
Fixes uclouvain/openjpeg#470
Fixes uclouvain/openjpeg#288
Fixes uclouvain/openjpeg#532
2015-07-21 01:26:02 +02:00
Matthieu Darbois
2c7dab7655 Merge pull request #534 from mayeut/issue-235
Add checks for odd looking cmap & for cmap outside jp2h box
2015-07-21 00:47:23 +02:00
mayeut
96ae1b8dfc Add test for odd looking cmap & for cmap outside jp2h
Update uclouvain/openjpeg#235
2015-07-21 00:46:55 +02:00
mayeut
1bbb607069 Merge remote-tracking branch 'uclouvain/master' into issue-235 2015-07-21 00:20:05 +02:00
Matthieu Darbois
fd1f7cf297 Merge pull request #538 from mayeut/master
Update PNG support
Fixes #536
2015-07-19 17:48:46 +02:00
mayeut
5bb074611a Update PNG support
Only input modified for now
Update uclouvain/openjpeg#536
Update uclouvain/openjpeg#264
2015-07-19 17:42:11 +02:00
mayeut
46c1dd22fc Correct error message for invalid TIFF input 2015-07-19 15:01:12 +02:00
Matthieu Darbois
06f6911d7b Merge pull request #537 from mayeut/master
Various Minor fixes
2015-07-18 21:46:59 +02:00
mayeut
ae4799ad07 Add some missing static
Still needs to check j2k.c & jp2.c
Update uclouvain/openjpeg#243
2015-07-18 02:39:32 +02:00
mayeut
b88025b38f Add headers to CMake target 2015-07-18 01:50:17 +02:00
Matthieu Darbois
b59085db0c Merge pull request #535 from mayeut/converttif
Update TIFF conversion to support more bit depth.
2015-07-18 00:33:02 +02:00
mayeut
8048bbc7a2 Add tests for TIFF input with Alpha channel
Update uclouvain/openjpeg#322
2015-07-18 00:07:04 +02:00
mayeut
d1591be3d7 Add tests for TIFF output
Update uclouvain/openjpeg#322
2015-07-17 23:22:40 +02:00
mayeut
6b7ad74e26 Add tests for TIFF input
Update uclouvain/openjpeg#322
2015-07-16 23:20:50 +02:00
mayeut
635a358962 Fix build warnings in converttif.c 2015-07-16 06:51:21 +02:00
mayeut
8f798864a9 Update imagetotif to support more output TIF formats
Update uclouvain/openjpeg#322
Update uclouvain/openjpeg#264
2015-07-16 00:26:02 +02:00
mayeut
ac9fb5a302 Update tiftoimage to support more input TIF formats
Update uclouvain/openjpeg#322
Update uclouvain/openjpeg#264
2015-07-14 23:51:02 +02:00
mayeut
775ee87776 Add checks for odd looking cmap & for cmap outside jp2h box
Update uclouvain/openjpeg#235
Update uclouvain/openjpeg#447
2015-07-12 19:39:30 +02:00
mayeut
0b1f8eb6f7 Merge pull request #529 from renevanderark/master
fix Suspicious code in j2k.c
Fixes #517
2015-07-12 19:20:57 +02:00
mayeut
c887df12a3 Refactor opj_read_ppm
Update uclouvain/openjpeg#470
Update uclouvain/openjpeg#288
2015-07-12 18:09:30 +02:00
mayeut
d1b053afe2 Refactor opj_j2k_read_ppt
Update uclouvain/openjpeg#470
Update uclouvain/openjpeg#532
2015-07-12 15:55:58 +02:00
mayeut
5e1474cc92 Merge pull request #531 from mayeut/issue-289
Add option to force component splitting in imagetopnm
2015-07-11 11:42:58 +02:00
mayeut
dc43ebf96c Add option to force component splitting in imagetopnm
Update uclouvain/openjpeg#289
2015-07-11 11:35:21 +02:00
Antonin Descampe
a7060dae1c updated doxygen website references 2015-07-10 18:03:28 +02:00
Rene van der Ark
ba05549b0f fix Suspicious code in j2k.c #517 2015-07-08 11:13:31 +02:00
mayeut
fb0e397330 Update zlib to version 1.2.8 2015-07-04 18:45:06 +02:00
mayeut
35ddb3abc7 Fix CMake warning when testing for LFS
Update issue #442
2015-07-04 17:33:28 +02:00
mayeut
237ddd72f1 Merge pull request #514 from mayeut/issue-254
Correctly decode files with incorrect tile-part header fields (TPsot==TNsot)
Fixes uclouvain/openjpeg#254
2015-07-04 00:47:59 +02:00
mayeut
c999b6c0f0 uclouvain/openjpeg#254 Add build option to disable the fix 2015-07-04 00:04:55 +02:00
mayeut
4e0de649bd uclouvain/openjpeg#254 Update MD5 sums for tests 2015-07-03 23:25:14 +02:00
Aaron Boxer
6b0a8e3a0f upgraded to libtiff v4.0.4 2015-07-03 19:19:17 +02:00
Antonin Descampe
eadfad7a50 commented out printf line 2015-07-03 17:36:39 +02:00
Antonin Descampe
14361eee24 commented out a printf line 2015-07-03 16:35:16 +02:00
Aaron Boxer
c9e231508b various small T1 optimizations 2015-07-03 15:23:15 +02:00
Aaron Boxer
6347686385 fixed a few bugs 2015-07-03 15:22:58 +02:00
Aaron Boxer
1a8f929111 visual studio lrintf is very slow - do not use 2015-07-03 15:22:42 +02:00
Aaron Boxer
56d3f5af6e add timing to compress and decompress 2015-07-03 15:20:11 +02:00
Sandro Mani
c665e81a39 Fix opj_write_bytes_BE (#518) 2015-06-25 23:11:22 +02:00
Antonin Descampe
c6c49865fe Update README.md 2015-06-24 17:11:09 +02:00
Antonin Descampe
52d27be5c2 Update README.md 2015-06-17 14:24:25 +02:00
Antonin Descampe
6e0118231a Update README.md 2015-06-17 14:15:26 +02:00
Antonin Descampe
da3786d2d1 Merge pull request #510 from radarhere/patch-1
Fixed typos
2015-06-16 14:01:53 +02:00
Andrew Murray
8d770ece9a Fixed typos 2015-06-16 15:07:20 +10:00
Antonin Descampe
0a0cb190da Merge pull request #507 from htmfilho/master
Formatted the readme file
2015-06-15 09:56:50 +02:00
Hildeberto Mendonça
79b079bdc0 Update README.md 2015-06-13 15:39:03 +02:00
Hildeberto Mendonça
dbb67194b2 Formatted the readme file
Put the extension `md` to allow GitHub to identify the file and transform it to HTML, improving the presentation of the project. Formatted the file to markdown. Put links to references.
2015-06-13 15:33:37 +02:00
Hildeberto Mendonça
c255e0140c Update README.md 2015-06-13 15:24:45 +02:00
Hildeberto Mendonça
2bd6aa54d6 Update and rename README to README.md 2015-06-13 15:23:02 +02:00
mayeut
c7535d084e Merge branch 'master' into issue-254 2015-06-05 20:42:57 +02:00
Matthieu Darbois
c0d7afe15c [trunk] Fix offset computations in opj_j2k_update_image_data
Update issue 481
2015-06-03 20:56:13 +00: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
Matthieu Darbois
73881d0e52 [trunk] Fix sscanf format specifier (fixes issue 494)
Thanks Aaron.
2015-05-28 22:16:49 +00:00
Matthieu Darbois
e3291c4e1f [trunk] Fix overflow in opj_image_comp_header_update (fixes issue 495) 2015-05-27 23:05:16 +00:00
Matthieu Darbois
0fa5a17c98 [trunk] Correct potential double free on malloc failure in opj_j2k_copy_default_tcp_and_create_tcp (fixes issue 492) 2015-05-19 21:57:27 +00:00
Matthieu Darbois
757f9394bf [trunk] Add check for number of layers & cblkw/cblkh values (fixes issue 475) 2015-05-19 21:24:44 +00:00
Matthieu Darbois
daed8cc919 [trunk] Add check for at most 1 COD marker per tile. 1 COD marker for MH (fixes issue 476) 2015-05-19 20:13:37 +00:00
mayeut
d1a941ea50 Revert "Correct overflows in opj_j2k_update_image_data"
This reverts commit 1fb24aba4b.
2015-05-16 14:22:16 +02:00
mayeut
00a47c1e06 Implement TNsot correction for non conforming files 2015-05-16 11:15:29 +02:00
mayeut
1fb24aba4b Correct overflows in opj_j2k_update_image_data 2015-05-16 02:51:31 +02:00
Antonin Descampe
2d24b6000d [trunk] added overflow checks (fixes issue 431)
Thanks mdarbois
2015-02-02 16:11:31 +00:00
Antonin Descampe
8b5e2a5143 [trunk] fixes a bug that prevented opj_decompress to take directory as input (fixes issue 463)
Thanks Aaron.
2015-02-02 16:11:23 +00:00
Matthieu Darbois
3ed5858902 [trunk] use hidden visibility for static library (fixes issue 354) 2015-01-25 16:59:39 +00:00
Antonin Descampe
7a8cdc4bb0 [trunk] fixed a bug encoutntered when multiple MCT markers are provided
Update issue 430
Cc: savmickael@gmail.com
@Mickael: this revision affects your work on custom MCT. Is there a way
you could provide test data to add to our test suite ? Thanks
2015-01-20 16:29:16 +00:00
Antonin Descampe
4c0ed02806 [trunk] checks for JP2 signature and file type boxes more carefully
Update issue 430
2015-01-20 14:27:20 +00:00
Antonin Descampe
5d00b719f4 [trunk] fixed a buffer overflow in opj_tcd_init_decode_tile
Update issue 431
2015-01-15 18:16:29 +00:00
Matthieu Darbois
42132ed6b5 [trunk] removed warning from convertbmp.c
Update  issue 442
2014-12-27 11:31:43 +00:00
Matthieu Darbois
31f5efe453 [trunk] fixed typo in opj_decompress (fixes issue 465) 2014-12-26 15:37:16 +00:00
Matthieu Darbois
78a7762e3f [trunk] removed unnecessary operation in opj_bio_flush (fixes issue 461) 2014-12-23 16:05:19 +00:00
Matthieu Darbois
33f52fb611 [trunk] removed warning from convert.c
Update  issue 442
2014-12-23 16:03:45 +00:00
Matthieu Darbois
81abe5b3bb [trunk] fixed imagetoraw unsigned 16bits conversion (fixes issue 460) 2014-12-23 15:06:23 +00:00
Matthieu Darbois
4a09296771 [trunk] removed warning from convertbmp.c
Update  issue 442
2014-12-23 10:13:28 +00:00
Matthieu Darbois
6922124c4c [trunk] fixed colorspace mapping for raw grayscale images (fixes issue 456) 2014-12-22 18:39:14 +00:00
Matthieu Darbois
59b844347c [trunk] fixed component precision upscaling in opj_decompress (fixes issue 458) 2014-12-22 15:50:32 +00:00
Matthieu Darbois
bde5ba6ae8 [trunk] fixed compression check for 1 bit unsigned component (fixes issue 457) 2014-12-22 15:00:12 +00:00
Matthieu Darbois
16240e21f9 [trunk] updated BMP format input support
Update  issue 203
2014-12-22 14:40:31 +00:00
Matthieu Darbois
33a0e66eb1 [trunk] updated BMP format input support
Update  issue 203
2014-12-22 13:14:37 +00:00
Matthieu Darbois
f7ff08de5a [trunk] updated tests to get BMP RLE8 tested
Update  issue 203
2014-12-20 18:58:28 +00:00
Matthieu Darbois
f1bae45c76 [trunk] fixed BMP reading for 8bpp when width & 3 == 1
Update  issue 203
2014-12-20 18:45:53 +00:00
Matthieu Darbois
65c07b42e3 [trunk] updated tests
Update  issue 415
2014-12-20 15:08:55 +00:00
Matthieu Darbois
3888daac6a [trunk] fixed test issues (fixes issue 454) 2014-12-20 13:27:30 +00:00
Matthieu Darbois
e966fef3eb [trunk] fixed a possible overflow in opj_t1_encode_cblks call to opj_int_fix_mul (fixes issue 141) 2014-12-20 13:03:11 +00:00
Matthieu Darbois
a504edf724 [trunk] fixed return value for compare_raw_files (fixes issue 453) 2014-12-20 12:42:40 +00:00
Matthieu Darbois
dde788b59e [trunk] Updated checks regarding number of decomposition levels when compressing
Update  issue 215
2014-12-19 22:56:00 +00:00
Matthieu Darbois
58fc86452d [trunk] Fixed a crash on illegal tile offset when decoding
Update  issue 427
2014-12-18 22:56:38 +00:00
Matthieu Darbois
c0cb119c0e [trunk] Fixed a crash on 0xh or wx0 image size decoding
Update  issue 427
2014-12-18 22:19:52 +00:00
Matthieu Darbois
9a21e1eef0 [trunk] removed warnings when building tcd.c (Update issue 442) 2014-12-15 18:48:50 +00:00
Matthieu Darbois
a0688a9874 [trunk] Add SSE2/SSE41 implementations for mct.c (fixes issue 451) 2014-12-13 12:29:22 +00:00
Matthieu Darbois
d0ce2ced53 [trunk] Speed-up opj_int_fix_mul by removing unneeded operation
Update  issue 220
2014-12-13 10:27:21 +00:00
Matthieu Darbois
e05d2901ec [trunk] Reduce encoder code block memory usage for non 64x64 code block sizes (fixes issue 444) 2014-12-12 21:54:22 +00:00
Matthieu Darbois
c0710f557c [trunk] Fixed invalid check in in tiff reading method (fixes issue 449) 2014-12-11 20:21:26 +00:00
Matthieu Darbois
f095027329 [trunk] add test for compression using MCT with alpha channel
Update  issue 415
2014-12-09 19:45:12 +00:00
Antonin Descampe
8d320bbdf8 [trunk] check number of components when getting mct norm (fixes issue 436) 2014-12-09 12:09:08 +00:00
Matthieu Darbois
776b83ddbc [trunk] Fixed compilation error under Visual Studio 2003 (fixes issue 351) 2014-12-09 05:44:55 +00:00
Matthieu Darbois
04ace2a558 [trunk] Fixed typo in opj_compress error report (fixes issue 350) 2014-12-02 20:18:50 +00:00
Matthieu Darbois
46afb746f0 [trunk] removed warnings when configuring with CMake 3.x on MacOS (fixes issue 443) 2014-11-25 23:57:37 +00:00
Matthieu Darbois
570dd13f55 [trunk] removed some warnings when configuring with CMake 3.x on MacOS
Update  issue 443

Warnings related to OPJ_USE_DSYMUTIL are fixed
2014-11-25 21:52:24 +00:00
Matthieu Darbois
63f877769c [trunk] removed some warnings when building src/bin/jp2/convert.c
Update  issue 442
2014-11-25 20:06:12 +00:00
Matthieu Darbois
04c6bb4a72 [trunk] removed warnings when building jp2.c (Update issue 442) 2014-11-24 21:31:09 +00:00
Matthieu Darbois
131cc98491 [trunk] added an option to upsample image components in opj_decompress
Update  issue 289

Issue is left open since there's still one image failing the tests.
2014-11-22 17:59:07 +00:00
Matthieu Darbois
13bcb63b73 [trunk] fixed pnmtoimage for odd pgm files (fixes issue 294) 2014-11-22 14:09:16 +00:00
Matthieu Darbois
0ba5d15b58 [trunk] fixed warning in option to force rgb output in opj_decompress (fixes issue 282) 2014-11-22 12:30:04 +00:00
Matthieu Darbois
7e38446075 [trunk] added option to force rgb output in opj_decompress (fixes issue 282 , fixes issue 286) 2014-11-22 00:04:39 +00:00
Matthieu Darbois
548aff34f4 [trunk] added check for tile component data size overflow (fixes issue 432) 2014-11-21 21:35:43 +00:00
Matthieu Darbois
8397eac382 [trunk] added check for pclr box validity (fixes issue 429) 2014-11-20 23:47:09 +00:00
Matthieu Darbois
a2c2d86d3d [trunk] fixed memleak in abnormal condition (fixes issue 437) 2014-11-20 20:13:47 +00:00
Matthieu Darbois
3bc360fc9d [trunk] added option to force output bit depth in opj_decompress (fixes issue 283) 2014-11-19 20:05:39 +00:00
Matthieu Darbois
ae1da37558 [trunk] replace OPJ_MACRO_TCD_ALLOCATE macro by inlined function (fixes issue 433) 2014-11-19 19:08:09 +00:00
Matthieu Darbois
f57f59b10d [trunk] remove warning during build (fixes issue 435) 2014-11-18 18:30:44 +00:00
Matthieu Darbois
b65e3ebdb6 [trunk] fixed a bug leading to jpwl build failure & add related odd width/height sYCC tests (fixes issue 422) 2014-11-18 00:07:50 +00:00
Matthieu Darbois
50acc339c5 [data] added new non-regression tests from foxit
Update issue 415
Issue not closed as in the mean time there are other images to include
2014-11-17 22:02:38 +00:00
Matthieu Darbois
f123ce8f8a [trunk] fixed a bug preventing palette image with cdef to decode properly using opj_get_decoded_tile (fixes issue 428) 2014-11-17 21:46:43 +00:00
Antonin Descampe
c3629e37a2 [trunk] significantly reduces memory for single tile RGB encoding (fixes
issue 375)
2014-11-03 14:51:41 +00:00
Antonin Descampe
cf5153c518 [trunk] add a cdef box when alpha component is present (fixes issue 416) 2014-11-03 14:12:01 +00:00
Antonin Descampe
3b7dced8e6 [trunk] fixed a bug preventing palette image with cdef to decode properly (fixes issue 412) 2014-10-30 18:26:10 +00:00
Antonin Descampe
03a410e03d [trunk] fixed a bug that was preventing image with per channel alpha to decode properly (fixes issue 414) 2014-10-30 18:26:04 +00:00
Antonin Descampe
0a6eaaa605 [trunk] add a check on precinct size (fixes issue 420) 2014-10-30 18:00:45 +00:00
Antonin Descampe
7f8f284ee5 [trunk] prevent overflow in j2k.c
Update issue 392

Issue left open to solve problem on x64-Asan and to investigate Matthieu's suggestion
2014-10-30 11:53:06 +00:00
Antonin Descampe
09fb8b6989 [trunk] add Aaron Boxer as contributor 2014-10-22 23:01:04 +00:00
Antonin Descampe
9e6c62199a [trunk] re-arrange contributors alphabetically and add Matthieu Darbois 2014-10-22 22:59:35 +00:00
Antonin Descampe
d47f7a249d [trunk] workaround to make MD5 work under valgrind on MacOSX (fixes issue 410) 2014-10-22 22:52:01 +00:00
Antonin Descampe
7280263988 [trunk] Added new non-regression tests from foxit issues
Update issue 415
2014-10-22 22:38:55 +00:00
Antonin Descampe
3e1fad2da4 [trunk] resets resno_decoded for each tile (fixes issue 399) 2014-10-22 13:16:35 +00:00
Antonin Descampe
d72940c56b [trunk] resets code-blocks reused for other tiles than the first one (fixes issue 418) 2014-10-22 13:16:12 +00:00
Antonin Descampe
ad4fad0965 [trunk] add a check on mandatory headers in Main Header (fixes issue 408) 2014-10-22 10:30:35 +00:00
Antonin Descampe
aff9cb39ed [trunk] fixed invalid member values from opj_read_header or opj_decode (fixes issue 411) 2014-10-21 15:22:22 +00:00
Antonin Descampe
0a3f234df7 [trunk] verify channel definitions is complete when cdef is present (fixes issue 397) 2014-10-21 12:54:08 +00:00
Antonin Descampe
efb70af001 [trunk] add a check on the number of resolution passed to cmdline (fixes issue 352) 2014-10-21 12:47:48 +00:00
Antonin Descampe
e65303b903 [trunk] added check on JP2_IHDR box (fixes issue 364) 2014-10-21 12:35:16 +00:00
Antonin Descampe
413de4fbfa [trunk] add a check on Zppm value in PPM markers (fixes issue 393) 2014-10-21 12:27:58 +00:00
Antonin Descampe
984351f86f [trunk] Add option to call dsymutil on built binaries (fixes issue 409) 2014-10-15 10:24:49 +00:00
Antonin Descampe
f8796711e8 [trunk] add a check on progression order (fixes issue 413) 2014-10-15 10:14:54 +00:00
Antonin Descampe
0b540067b1 [trunk] add a check for illegal SCod value (fixes issue 400) 2014-10-15 08:48:19 +00:00
Antonin Descampe
3df347eded [trunk] additional checks for marker size inconsistency (fixes issue 363) 2014-10-14 15:15:09 +00:00
Antonin Descampe
eb7c6d295a [trunk] fixed potential negative size params (fixes issue 390) 2014-10-06 21:05:32 +00:00
Antonin Descampe
f126eb0d41 [trunk] added box length inconsistency check
Update issue 364

issue364-38.patch applied. Thanks Matthieu.
2014-10-06 21:05:27 +00:00
Antonin Descampe
7256e43c48 [trunk] fixed PDF crash in Chrome (fixes issue 362) 2014-10-06 21:05:21 +00:00
Antonin Descampe
a0a3af1dee [trunk] removed illegal character in comment 2014-10-03 19:52:20 +00:00
Antonin Descampe
48832d944f [trunk]fixes buffer overflow in t2.c
Update issue 390
Summary: check for negative-size params in code
Patch from Matthieu applied. Left open to apply this to other places in
code.
2014-10-03 10:15:28 +00:00
Antonin Descampe
06bd61b571 [trunk] c++-style comment removed (fixes issue 407) 2014-10-02 07:44:53 +00:00
Antonin Descampe
a1c754c737 [trunk] fixed warning from r2891 2014-10-01 12:11:43 +00:00
Antonin Descampe
fef1276901 [trunk] fixed bad use of case statement (fixes issue 381) 2014-09-30 12:19:13 +00:00
Antonin Descampe
45f33cdbd6 [trunk] check possible overflow on size in opj_t2_read_packet_data
Update issue 390
Labels: Priority-Critical
Should be rechecked with ASan and pdfium
2014-09-30 10:07:09 +00:00
Antonin Descampe
1acfa211ae [trunk] fixes heap-buffer-overflow in parse_cmdline_encoder
Fixes issue 403
Thanks Matthieu
2014-09-30 09:48:26 +00:00
Antonin Descampe
2f3fd1194e [trunk] prevent overflow in opj_t2_read_packet_header (update issue 389) 2014-09-30 09:26:44 +00:00
Antonin Descampe
f08af3ed82 [trunk] Ensure cblk->data pointer is correctly initialized (updates issue 391). Still need to check if it does not fail anymore with ASan. 2014-09-29 12:03:50 +00:00
Antonin Descampe
2720a1a405 [trunk] fixed tile numbering in output message (fixes issue 370) 2014-09-29 12:03:36 +00:00
Mathieu Malaterre
31fd8d3fe8 trunk: extend support for pdf2jp2 2014-09-19 15:48:48 +00:00
Antonin Descampe
6868ee373e added memory allocation checks (fixes issue 355) 2014-09-19 10:26:35 +00:00
Antonin Descampe
b9a247b559 fixes install name id on OSX builds (fixes issue 367) 2014-09-19 09:30:12 +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
2c810567dd [trunk] Changed error to warning when no EOC found in codestream (fixes
issue 366)
2014-07-14 07:42:50 +00:00
Antonin Descampe
0a1a29a7fe [trunk] replaced malloc with opj_malloc. (Fixes issue 368). 2014-07-03 16:05:56 +00:00
Antonin Descampe
7d21871ed8 [trunk] fixes issue #357. MCT is automatically disabled when
subsamppling is detected.
2014-07-03 09:15:13 +00:00
Antonin Descampe
a38b97fae0 [trunk] moved comment marker setup from opj_compress to the library 2014-07-01 13:51:55 +00:00
Antonin Descampe
45313a8dfa [trunk] fixed warning in j2k.c about sign conversion 2014-04-28 09:38:44 +00:00
Mathieu Malaterre
b08135e7c1 [trunk] Finalize API for openjpeg 2.1
public header will only contains minimal information: major, minor and build version
Prefix has been changed from OPENJPEG to OPJ for consistency
SOVERSION has been removed from header (ABI vs API info)
OPJ_VERSION string has been removed, since it is accessible already (PACKAGE_VERSION)
Fixes issue 342
2014-04-28 09:17:31 +00:00
Mathieu Malaterre
4bac8488df [trunk] Properly handle failure to compress (remove file)
Fixes issue 323
2014-04-28 07:54:33 +00:00
Mathieu Malaterre
de04302c15 [trunk] Missing endianess setting
Fixes issue 337
2014-04-28 07:44:39 +00:00
Mathieu Malaterre
997758f91c [trunk] properly handle pkg-config on non-UNIX hosts
Fixes issue 340
2014-04-28 07:34:26 +00:00
Mathieu Malaterre
763214f7c0 [trunk] Provide #ifdef blockers for OpenJPEG Version
Fixes issue 342
2014-04-28 07:32:35 +00:00
Antonin Descampe
77e8dad503 [trunk] fixed typo in NEWS 2014-04-27 21:31:32 +00:00
Antonin Descampe
1758445a75 [trunk] updated NEWS for 2.1.0 2014-04-25 09:22:49 +00:00
Mathieu Malaterre
7a77a8047d [trunk] Make sure OpenJPIP compiles on WIN32 2014-04-24 11:24:56 +00:00
Antonin Descampe
d8767cbcb7 [trunk] fixed reference to opj_stream_set_user_data_v3 in jpip sources. 2014-04-24 08:51:29 +00:00
Antonin Descampe
7924d3a456 [trunk]removed '-x' option for index file as long as it's broken 2014-04-23 15:19:57 +00:00
Antonin Descampe
ec84bafcd8 [trunk]re-formatted help display in executables 2014-04-23 14:09:20 +00:00
Antonin Descampe
08c09b74cf [trunk]formatted some messages. Removed -version option to disambiguate
with -v(erbose) option, added version info in help display
2014-04-23 09:12:30 +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
8d93eae64a [trunk] fixed some warning and errors formatting and add a '-version'
option to opj_compress and opj_decompress binaries
2014-04-22 21:22:49 +00:00
Antonin Descampe
9a3d660d1b [trunk] fixed warning related to r2837 and move new field at the end of
parameters structure.
2014-04-17 09:54:38 +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
Antonin Descampe
f105cb5471 [trunk] removed debug message in CMakeLists.txt 2014-04-02 16:37:07 +00:00
Antonin Descampe
4db4198722 [trunk] fixed a bug triggering SEGFAULT on debug mode (uninitialized
structure)
2014-04-02 16:25:40 +00:00
Mathieu Malaterre
616a3345c4 [trunk] Properly copy/paste code from the autotools
gcc correctly fails compiling this code, I needed to move the code outside the main function to get the error. This actually match the autotools (incorrect) code. We'll see how they fix this code in future release.
This make the code compatible with previous openjpeg version and remove C99 requirement.
Fixes issue 316
2014-03-27 15:07:58 +00:00
Mathieu Malaterre
1f8d84a562 [trunk] Make sure to use long long (this is not C89). However this should be ok on most compilers nowadays
Update issue 316
2014-03-26 16:20:13 +00:00
Antonin Descampe
a54d757a3e [trunk] fixed warnings triggered on linux related to r2802 2014-03-26 15:17:17 +00:00
Mathieu Malaterre
b5eb374fb9 [trunk] Run test suite on issue 316 dataset
Update issue 316
2014-03-26 15:16:24 +00:00
Antonin Descampe
f1d69068c7 [trunk] add ability in opj_compress to input subsampled images through
'-F' (aka raw option). Let the user input raw images with 444, 422, 420
(etc) subsampling. To be used in conjunction with '-mct 0' option to
compress subsampled YCC images.
2014-03-26 14:26:49 +00:00
Mathieu Malaterre
ee130e2306 [trunk] Add small utilities to extract JP2 files from PDF 2014-03-26 11:52:01 +00:00
Mathieu Malaterre
9ba6bc6042 [trunk] Make sure to test value not pointer
Update issue 302
2014-03-25 16:34:59 +00:00
Antonin Descampe
5e1a0fad08 [trunk] fixed bug related to r2791 2014-03-25 15:35:33 +00:00
Mathieu Malaterre
c05118dc49 [trunk] Add sentinel in case list empty.
I was getting a cmake error `list sub-command REMOVE_ITEM requires list to be present`
2014-03-25 15:29:19 +00:00
Mathieu Malaterre
1adf89d5d2 [trunk] Import change from 2.0 branch 2014-03-25 15:21:53 +00:00
Antonin Descampe
666f71b2a1 [trunk] fixed warning due induced by r2791 2014-03-25 13:29:11 +00:00
Antonin Descampe
2b7d5b18f3 [trunk] add "-mct {0,1,2}" option to opj_compress to allow MCT to be
disabled if needed.
2014-03-25 12:38:29 +00:00
Mathieu Malaterre
18d5d25cb6 [trunk] Make sure to not use alpha pointer if it is not an RGBA input
Fixes issue 310
2014-03-25 11:47:34 +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
2b93727bea [trunk] Add documentation 2014-03-25 10:22:40 +00:00
Mathieu Malaterre
18c5be69e9 [trunk] Make sure to exit early instead of looping on every single pixels 2014-03-24 16:01:51 +00:00
Mathieu Malaterre
5a70e97f51 [trunk] Fix typo in comment (this is not j2k_dump) 2014-03-24 09:49:04 +00:00
Mathieu Malaterre
f4707da97a [trunk] Revert r2764. It breaks ~230 tests as seen on continuous. Since no dataset is available, the issue 296 will be left open.
Update issue 296
2014-03-18 15:19:29 +00:00
Mathieu Malaterre
51ab074d50 [trunk] User can now control source/target java version
Fixes issue 303
2014-03-18 15:00:23 +00:00
Mathieu Malaterre
6d9e8a5a63 [trunk] Import git commit fc884aee2b69c78500e65c3d05bf216791a9ea4a from ghostscript team
Fixes issue 296
2014-03-18 14:43:47 +00:00
Mathieu Malaterre
008de86533 [trunk] Import git commit 99a6f1af177c15f4db475186b79d169c993494ef from ghostscript team
Update issue 296
2014-03-18 14:43:18 +00:00
Mathieu Malaterre
ae49fd1aa9 [trunk] Update big endian handling no such thing as WORDS_BIGENDIAN (prefer OPJ_BIG_ENDIAN)
Update issue 302
2014-03-18 14:37:33 +00:00
Mathieu Malaterre
79d18f7fd0 [trunk] Now that dataset from issue 297 have been imported, run test suite.
None of the dataset triggered any buffer overflow. Recent changes in trunk handle all those cases.
Update issue 297
2014-03-18 10:21:11 +00:00
Mathieu Malaterre
99d1859a44 [trunk] Explicitely reject file4/file6 scenario
Update issue 286
2014-03-17 16:18:22 +00:00
Mathieu Malaterre
866cd28ad4 [trunk] Update BSD-4 copyright into a BSD-3 copyright
Fixes issue 300
2014-03-17 15:02:49 +00:00
Mathieu Malaterre
71a9f498b5 [trunk] Since r2747 we are now able to track which files are missing from the test_suite. Add them. 2014-03-14 15:52:22 +00:00
Mathieu Malaterre
b607da8ae9 [trunk] add mecanism to track of addition of new regression files in svn/data. It will report when a J2K files is added but no test is found in the test_suite file 2014-03-14 15:51:53 +00:00
Mathieu Malaterre
a43d206b93 [trunk] Remove duplicate content from test_inline.c
Thanks to Matthieu Darbois for report (and patch)
Fixes issue 285
2014-03-14 15:10:31 +00:00
Mathieu Malaterre
15863e7170 [trunk] rework code from r2463. Really there has been some code duplication from r2413
Thanks to John Rogers (oracle.com) for report
2014-03-14 15:06:20 +00:00
Mathieu Malaterre
5e91877636 [trunk] rework code from r2463. Really there has been some code duplication from r2413
Thanks to John Rogers (oracle.com) for report
2014-03-14 15:04:24 +00:00
Mathieu Malaterre
7e1d012161 [trunk] Now that issue 165 dataset is in non regression repository, activate code to reject them
Fixes issue 165
2014-03-14 15:01:13 +00:00
Mathieu Malaterre
de74605777 [trunk] Fix issue with & vs &&
Fixes issue 277
2014-03-14 14:46:40 +00:00
Mathieu Malaterre
e8abf1fb25 [trunk] Add internal implementation to dump all tiles/comp info
Eg: opj_dump -f 8 -i input.j2k
Update issue 3
2014-03-14 13:53:36 +00:00
Mathieu Malaterre
b7fe7d25e1 [trunk] Prevent a leak when reading PPT markers
Update issue 295
2014-03-14 12:27:01 +00:00
Mathieu Malaterre
138a65d6c1 [trunk] Move INLINE definition within openjpeg.h header since application may use it 2014-03-14 12:02:05 +00:00
Mathieu Malaterre
9d0bdf69e5 [trunk] Apply final missing patch from sumatrapdf team:
http://bugs.ghostscript.com/show_bug.cgi?id=694893
Update issue 231
2014-03-14 11:59:18 +00:00
Mathieu Malaterre
9194dfb94b [trunk] Rework r2731 since it breaks non-regression testing 2014-03-14 11:42:26 +00:00
Mathieu Malaterre
b7ebf54a29 [trunk] Be more verbose about failure.
Update issue 294
2014-03-14 11:37:44 +00:00
Mathieu Malaterre
3a80b72ac8 [trunk] Add a temporary work around for issue 293
As described in the bug report the default allocation mecanism for codeblock data is too small for those dataset (16bits). We would need a finer (more granular) mecanism to reallocated only on demand. For now this help the two failing tests to pass.
Fixes issue 293
2014-03-14 10:54:08 +00:00
Mathieu Malaterre
3e33012bd9 [trunk] Mark OpenJPEG to be ABI incompatible with previous one, move to SONAME 7
Also declare this is 2.1.0 (or very close)
2014-03-14 09:30:03 +00:00
Mathieu Malaterre
fd3f7ca2bb [trunk] Remove warnings about unused values introduced in r2710
Thanks to Matthieu Darbois for patch
Fixes issue 290
2014-03-14 08:44:53 +00:00
Mathieu Malaterre
6e22c4f68a [trunk] Add some sanity checks when reading Ippm(i) segments
Update issue 288
2014-03-13 15:34:36 +00:00
Mathieu Malaterre
565ef29ae3 [trunk] Make sure to reallocate ppm data buffer when multiple Ippm(i) buffer are found
This handle the case where remaining data is exactly Nppm(i)
Fixes issue 287
2014-03-13 13:47:44 +00:00
Mathieu Malaterre
68398b2a5a [trunk] Add documentation to the checkmd5refs cmake module (used for regression testing) 2014-03-13 12:37:36 +00:00
Mathieu Malaterre
5624e4a25f [trunk] Always report when decompression failed as return code value 2014-03-13 12:31:41 +00:00
Mathieu Malaterre
92e07f3b74 [trunk] Fix test NR-DEC-issue171.jp2-71-decode-md5 after recent code change 2014-03-13 12:26:30 +00:00
Mathieu Malaterre
8447f0a323 [trunk] Add a double check for user input 2014-03-13 12:26:06 +00:00
Mathieu Malaterre
f0a2fdd508 [trunk] Fix compilation on VS2010 (snprintf is not C89). C++11 should avoid this in the future 2014-03-13 11:03:05 +00:00
Mathieu Malaterre
320784659d [trunk] Just in case this would be helpful for other, here is the code used to track issue 80
Update issue 80
2014-03-13 10:56:48 +00:00
Mathieu Malaterre
51ab8cd67d [trunk] Tweak documentation in t2.c. Be more verbose in case of failure. 2014-03-13 10:46:54 +00:00
Mathieu Malaterre
237253d83b [trunk] Add some documention in the pi code 2014-03-13 10:42:06 +00:00
Mathieu Malaterre
fe100fb490 [trunk] Add debug code to extract decompressed image right before PCLR handling
Update issue 235
2014-03-13 10:35:41 +00:00
Mathieu Malaterre
c7b646e23a [trunk] Add a small helper to spli ppm into 3 pgm files
Update issue 235
2014-03-13 09:57:20 +00:00
Mathieu Malaterre
41add6882b [trunk] Make sure to use 8bits buffer when applying the ICC profile.
Fixes issue 281
2014-03-12 14:18:25 +00:00
Mathieu Malaterre
dd0d2c2f0a [trunk] Add debug info to be able to test integration with littlecms 2014-03-12 13:55:41 +00:00
Mathieu Malaterre
d38e32c036 [trunk] TIFF files in test suite can have 1 or 3 components 2014-03-12 11:32:44 +00:00
Mathieu Malaterre
73315c2edc [trunk] Simplify code when reading in TIFF images 2014-03-12 10:50:47 +00:00
Mathieu Malaterre
6b51d11d08 [trunk] Make sure when reading POC that number of layers (layer end) is within acceptable bound.
Fixes issue 80
2014-03-12 10:10:21 +00:00
Mathieu Malaterre
59270c39a7 [trunk] Re-active old warning about missing SOP marker 2014-03-11 15:21:12 +00:00
Mathieu Malaterre
db82cf7778 [trunk] Add debug info to track issue 80
Update issue 80
2014-03-11 15:17:39 +00:00
Mathieu Malaterre
ddb1d57766 [trunk] Rework assertion to work on 32bits system 2014-03-11 12:56:52 +00:00
Mathieu Malaterre
5dd770746b [trunk] Fix remainings warnings on linux/32bits arch 2014-03-11 10:28:04 +00:00
Mathieu Malaterre
fa436eb368 [trunk] Rework fseek ifdefs blockers, it breaks the 64bits behavior for fseeko 2014-03-11 10:27:01 +00:00
Mathieu Malaterre
fcc658f106 [trunk] Fix compilation errors when JPWL and/or MJ2 are build 2014-03-11 09:11:35 +00:00
Mathieu Malaterre
2e7b8fb9a1 [trunk] Another final round of fixes for sign conversion warnings.
Fixes issue 256
2014-03-10 16:43:04 +00:00
Mathieu Malaterre
1778e2576e [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-10 16:17:12 +00:00
Mathieu Malaterre
73c9e85642 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-10 16:17:01 +00:00
Mathieu Malaterre
76557d2eb3 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-10 15:51:05 +00:00
Mathieu Malaterre
9095c7361e [trunk] Remove old warnings about deprecated API 2014-03-10 14:51:59 +00:00
Mathieu Malaterre
c02c1432e8 [trunk] Remove a set of warning about sign conversion
Update issue 266
2014-03-10 14:15:27 +00:00
Mathieu Malaterre
8411ed4f80 [trunk] Remove warning about sign conversion in color.c
Update issue 256
2014-03-10 14:05:25 +00:00
Mathieu Malaterre
4de95f320f [trunk] Run richter test suite, correct a regression introduced in r2668 2014-03-10 13:51:16 +00:00
Mathieu Malaterre
aea18173d1 [trunk] Tweak JP2 conformance test suite add documentation 2014-03-10 13:31:51 +00:00
Mathieu Malaterre
856fc0652f [trunk] Properly handle number of components to run kakadu test suite.
Update issue 266
2014-03-10 13:05:20 +00:00
Mathieu Malaterre
b01c1240cf [trunk] Fix simple sign conversion warnings only visible on 32bits arch 2014-03-10 12:22:56 +00:00
Mathieu Malaterre
836ec05920 [trunk] Handle multi components files with PGM outputs 2014-03-10 12:20:55 +00:00
Mathieu Malaterre
9a52b30c3d [trunk] Properly handle PGM file generation when fullpath is specified in the cmd line
This will break a very old behavior (since 2005), but avoid writing in un-expected places for users
This also make the behavior similar with PGX file generation
2014-03-10 10:52:09 +00:00
Mathieu Malaterre
76af73bc72 [trunk] Fix inversion in code convention 2014-03-10 10:43:45 +00:00
Mathieu Malaterre
f7bc0b49cb [trunk] Fix typo in the code 2014-03-10 10:12:25 +00:00
Mathieu Malaterre
9155e98911 [trunk] rework actual code to handle DOS/UNIX end of lines in a transparent manner.
This will help cross compilation cases
2014-03-10 10:09:30 +00:00
Mathieu Malaterre
7aee50de97 [trunk] First pass to cleanup compare_dump_files 2014-03-10 09:56:22 +00:00
Mathieu Malaterre
24966ffbda [trunk] Fix compilation when TIFF lib is neither found nor compiled 2014-03-10 09:36:14 +00:00
Mathieu Malaterre
666ef53fd2 [trunk] Make sure to always initialize variable 2014-03-10 08:40:02 +00:00
Mathieu Malaterre
e02ba05034 [trunk] Fix warnings about shadow variables 2014-03-10 08:25:08 +00:00
Mathieu Malaterre
b478912910 [trunk] remove a warning when using strict prototype 2014-03-10 08:15:43 +00:00
Mathieu Malaterre
2001932c56 [trunk] Remove 2 warnings about set but not used variables 2014-03-10 08:13:05 +00:00
Mathieu Malaterre
f54de95802 [trunk] Upon failure, need to return proper return code 2014-03-07 17:23:19 +00:00
Mathieu Malaterre
fa1c2454e6 [trunk] Add new test suite that run on kakadu conformance images 2014-03-07 17:18:13 +00:00
Mathieu Malaterre
6b94237679 [trunk] Cleanup commit. Rename compare family since comparePGX now support TIFF.
Rename compareRAWimage for clarity since it merely compare files (not images).
2014-03-07 16:24:24 +00:00
Mathieu Malaterre
aedff8a000 [trunk] Use C-style comments 2014-03-07 16:17:21 +00:00
Mathieu Malaterre
a0aa8dd851 [trunk] Rework the code to simplify cleanup code 2014-03-07 16:15:59 +00:00
Mathieu Malaterre
440ef4873b [trunk] Also override the default error handler for TIFF files 2014-03-07 14:33:03 +00:00
Mathieu Malaterre
ffad2fbe55 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 14:14:31 +00:00
Mathieu Malaterre
cc1354ebfa [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 14:00:47 +00:00
Mathieu Malaterre
581d2ba8b4 [trunk] Rework r2597, make sure test suite is passing now.
Update issue 256
2014-03-07 13:50:58 +00:00
Mathieu Malaterre
61348b20b4 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 13:43:15 +00:00
Mathieu Malaterre
e619e06078 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 13:40:54 +00:00
Mathieu Malaterre
4f84d1693a [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 13:37:45 +00:00
Mathieu Malaterre
71d244a5b6 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 13:33:47 +00:00
Mathieu Malaterre
f9a0f869e3 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 13:31:25 +00:00
Mathieu Malaterre
33c472d734 [trunk] Redo r2623, and remove guilty section
Update issue 256
2014-03-07 13:29:35 +00:00
Mathieu Malaterre
a8eb122c1f [trunk] Revert r2623 for now 2014-03-07 13:14:26 +00:00
Mathieu Malaterre
956b1a7697 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 12:06:00 +00:00
Mathieu Malaterre
472ce19183 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 12:01:41 +00:00
Mathieu Malaterre
740924fa61 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 11:59:29 +00:00
Mathieu Malaterre
01b4bb5447 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 11:57:37 +00:00
Mathieu Malaterre
ee3b02932a [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 11:43:50 +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
e238148d42 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 11:27:34 +00:00
Mathieu Malaterre
9d21695476 [trunk] As reported by clang analyzer thoses values were never read 2014-03-07 11:20:59 +00:00
Mathieu Malaterre
22d11a9ccb [trunk] Remove mem leak and warning reported by clang 2014-03-07 11:17:51 +00:00
Mathieu Malaterre
fc9248ea2b [trunk] Remove simple warnings about format 2014-03-07 11:11:43 +00:00
Mathieu Malaterre
c302979738 [trunk] Remove simple warning about functions not used 2014-03-07 11:08:35 +00:00
Mathieu Malaterre
e4d077bc98 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 11:06:13 +00:00
Mathieu Malaterre
76cd9b7f72 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 10:25:16 +00:00
Mathieu Malaterre
e71431ec78 [trunk] Fix simple warning about sign conversion
Update issue 256
2014-03-07 10:21:51 +00:00
Mathieu Malaterre
7b335eb635 [trunk] Another of fixes for warning about sign conversion
Update issue 256
2014-03-07 10:19:39 +00:00
Mathieu Malaterre
c0c086388b [trunk] Fix warning about sign conversion
Update issue 256
2014-03-07 10:03:56 +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
5f7ad58f48 [trunk] Remove self-assignement.
Fixes issue 273
2014-03-07 09:33:32 +00:00
Mathieu Malaterre
016b9fc052 [trunk] Fix compilation in visual studio, inline cannot be used directly.
Fixes issue 272
2014-03-07 09:15:27 +00:00
Mathieu Malaterre
99b40e8257 [trunk] Remove warning about implicitly defined function 2014-03-07 09:14:39 +00:00
Mathieu Malaterre
a734e447b5 [trunk] Remove TIFF warning handler. This help test suite run smoothly on windows by removing the message box.
Fixes issue 276
2014-03-07 09:03:15 +00:00
Mathieu Malaterre
37128c34a9 [trunk] Fix mem leaks reported by cppcheck 2014-03-07 08:48:47 +00:00
Mathieu Malaterre
f5630ab88e [trunk] Simplify code and remove bogus out of bound check 2014-03-07 08:11:49 +00:00
Mathieu Malaterre
6790587db8 [trunk] Revert r2597 for now, since it breaks a lot of tests 2014-03-06 17:25:08 +00:00
Mathieu Malaterre
445f696dc6 [trunk] Remove warning about sign conversion.
Update issue 256
2014-03-06 16:59:34 +00:00
Mathieu Malaterre
dd5c3a9c8e [trunk] Remove some easy warnings 2014-03-06 16:29:03 +00:00
Mathieu Malaterre
0f45e38b52 [trunk] Remove warning about sign conversion.
Update issue 256
2014-03-06 16:26:24 +00:00
Mathieu Malaterre
93bc3cb628 [trunk] Remove warning about sign conversion.
Update issue 256
2014-03-06 16:01:23 +00:00
Mathieu Malaterre
79faedfb9b [trunk] Remove warning about sign conversion.
Update issue 256
2014-03-06 15:16:44 +00:00
Mathieu Malaterre
17d9caae83 [trunk] Remove warning about sign conversion.
Update issue 256
2014-03-06 15:10:39 +00:00
Mathieu Malaterre
eea18e856e [trunk] Remove warning about sign conversion.
Update issue 256
2014-03-06 15:05:00 +00:00
Mathieu Malaterre
7e64eb5414 [trunk] Remove some easy warnings about sign compare reported by gcc 2014-03-06 15:00:41 +00:00
Mathieu Malaterre
8a959bb1f4 [trunk] Remove out of bound access in code and simplify code. this is a test tool, security is not an issue here. 2014-03-06 14:50:42 +00:00
Mathieu Malaterre
8d3ef0729c [trunk] Remove simple warning about unused variables 2014-03-06 14:47:52 +00:00
Mathieu Malaterre
275680bdb7 [trunk] Make sure that all output files from the test suite are using a different output name
Fixes issue 271
2014-03-06 14:43:21 +00:00
Mathieu Malaterre
4d5d1f0f66 [trunk] Handle cmap where direct use is specified (issue235_cmapsubbox.jp2)
I doubt the old code ever work. The new code copy the old codestream bytes into the new components (instead of copying the pointer).
Technically the issue235.jp2 file should be handled since I.5.3.5 specifies that:
...
If the JP2 Header box does not contain a Component Mapping box, the components shall be mapped directly to channels,
such that component i is mapped to channel i.
...
Update issue 235
2014-03-05 09:45:04 +00:00
Mathieu Malaterre
1ef677f264 [trunk] Make sure to reject images such as 1336.pdf.asan.47.376.jp2
Fixes issue 267
2014-03-04 10:32:26 +00:00
Mathieu Malaterre
07193e2a34 [trunk] remove more conversion warning in multi-lines macro.
C allow simple tricks such as to find those:
gcc -E tcd.c | sed '/^\#/d' | indent -st -i2 > clean.c
Update issue 256
2014-03-04 09:58:07 +00:00
Mathieu Malaterre
f7da94610d [trunk] Remove some conversion warnings reported by gcc
Update issue 256
2014-03-04 09:55:38 +00:00
Mathieu Malaterre
872368d25c [trunk] Remove another warning. ftell returns long int
Update issue 256
2014-03-04 09:32:19 +00:00
Mathieu Malaterre
36320b4bf4 [trunk] Remove more conversion warnings.
Update issue 256
2014-03-04 09:30:07 +00:00
Mathieu Malaterre
7185faa857 [trunk] Remove warning about conversion.
Update issue 256
2014-03-04 09:19:49 +00:00
Mathieu Malaterre
0c80fcff2a [trunk] Add a TIFF compare function (PEAK/MSE)
Fixes issue 100
2014-03-04 09:14:47 +00:00
Mathieu Malaterre
51caff5dcf [trunk] Revert portion of r2562, need to investigate issue.
Update issue 269
2014-03-04 08:40:06 +00:00
Mathieu Malaterre
d643ff5dbc [trunk] Remove remaining conversion issues in mqc.c 2014-03-03 16:11:41 +00:00
Mathieu Malaterre
44ca89eff7 [trunk] Remove remainings conversion issues in t2.c + clock.c 2014-03-03 16:08:03 +00:00
Mathieu Malaterre
7afad19c77 [trunk] Remove a simple warning about int -> float conversion 2014-03-03 16:02:36 +00:00
Mathieu Malaterre
765c4ab4f4 [trunk] rework code to avoid a warning. this also remove a division and prefer bit-shift 2014-03-03 16:02:16 +00:00
Mathieu Malaterre
24eca792ff [trunk] Remove some more warnings about conversion 2014-03-03 15:55:27 +00:00
Mathieu Malaterre
b1b17ee264 [trunk] Prefer compile time constant to avoid conversion double -> int 2014-03-03 15:55:06 +00:00
Mathieu Malaterre
74600cfb14 [trunk] Review warning about types conversion, and add cast when needed 2014-03-03 15:47:23 +00:00
Mathieu Malaterre
171ec1583d [trunk] Remove some simple warnings about conversion 2014-03-03 12:13:11 +00:00
Mathieu Malaterre
80c5106015 [trunk] fgets takes an int as parameter 2014-03-03 12:11:53 +00:00
Mathieu Malaterre
e92fe4c1a4 [trunk] Remove warning about cast double -> int. Instead use bit-shifting (compile time computation) 2014-03-03 12:01:36 +00:00
Mathieu Malaterre
11f402b44a [trunk] Remove easy to fix warnings about conversion 2014-03-03 12:00:24 +00:00
Mathieu Malaterre
18049fe3e0 [trunk] Import left over from patch submitted as issue 225 (comment #14)
Update issue 225
2014-03-03 11:48:27 +00:00
Mathieu Malaterre
b330c10492 [trunk] remove some simple warnings about unused params 2014-03-03 11:40:59 +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
16febebd28 [trunk] Explicitely trigger issue 229, there may be an impact in code execution. The assert may get removed afterward
Update issue 229
2014-03-03 11:30:54 +00:00
Mathieu Malaterre
339952c2af [trunk] Remove simple warnings 2014-03-03 10:41:13 +00:00
Mathieu Malaterre
75715635e8 [trunk] Remove 3635.pdf.asan.77.2930.jp2 from opj_dump tests
Update issue 250
2014-03-03 10:38:41 +00:00
Mathieu Malaterre
9863d8d1d2 [trunk] Avoid conflicting declarion for fseek in openjp2 vs fseek in openjpip 2014-03-03 08:49:28 +00:00
Mathieu Malaterre
3ecccb7410 [trunk] Fix md5 values for decode-md5 tests.
Update issue 250
2014-03-03 08:45:21 +00:00
Mathieu Malaterre
3c7a7a1675 [trunk] Remove deprecated functions.
Update issue 268
2014-03-03 08:30:36 +00:00
Mathieu Malaterre
d14c475de7 [trunk] Remove warning about unused function
Update issue 268
2014-03-03 08:27:40 +00:00
Mathieu Malaterre
a68a3feb60 [trunk] Remove deprecated functions (not called anywhere in the code base).
Update issue 268
2014-03-03 08:17:20 +00:00
Mathieu Malaterre
43382a9b9c [trunk] Remove unused variables from test 2014-03-03 07:58:59 +00:00
Mathieu Malaterre
a149502c01 [trunk] Remove some simple warnings about var being set but not used 2014-03-02 10:23:05 +00:00
Mathieu Malaterre
decace60da [trunk] Remove warning about -2147483648 (aka INT_MIN), causing this decimal constant is unsigned only in ISO C90 2014-03-02 10:20:57 +00:00
Mathieu Malaterre
2c876b6765 [trunk] Remove simple warnings about comments, missing case in switch statement 2014-03-02 10:16:54 +00:00
Mathieu Malaterre
6d0785a78f [trunk] Fix compilation on MSVC compiler 2014-03-01 10:41:46 +00:00
Mathieu Malaterre
ec593a2549 [trunk] Partially rework r2506, original patch from issue 171 was totally bogus (untested?) and did break most of the test (eg. p1_04 family)
convert.c duplicate a lot of code, this patch only adresses the PGX codec section of the code.
Update issue 171
Update issue 264
2014-02-28 17:29:28 +00:00
Mathieu Malaterre
978de6fb97 [trunk] Make sure to run *-decode-md5 only after *-decode tests. Update md5 since recent code change. 2014-02-28 16:04:11 +00:00
Mathieu Malaterre
c53e2960a0 [trunk] Remove easy uint32 <-> int32 conversions 2014-02-28 16:01:07 +00:00
Mathieu Malaterre
cf91ebf278 [trunk] Re-import chunk from r2458 that made textGBR.jp2 to fail otherwise
Update issue 225
2014-02-28 15:27:30 +00:00
Mathieu Malaterre
fd5f21af00 [trunk] Rework r2458, instead we should reject 451.pdf.SIGSEGV.ce9.3723 since tile-parts are out of order (as per kakadu behavior).
Update issue 225
2014-02-28 15:24:33 +00:00
Mathieu Malaterre
1b93cb8c0a [trunk] Mark a file as being invalid for opj_dump 2014-02-28 15:14:53 +00:00
Mathieu Malaterre
a9e6268766 [trunk] Fix JPIP test with updated md5sum 2014-02-28 14:54:37 +00:00
Mathieu Malaterre
fc855084a0 [trunk] Really apply r2460 this time, but fix the original typo in the submitted patch
Update issue 225
2014-02-28 14:52:58 +00:00
Mathieu Malaterre
b7bccf86c3 [trunk] final round of minor cleanups 2014-02-28 14:38:45 +00:00
Mathieu Malaterre
6ee2a51edc [trunk] Remove PNG generation code for now 2014-02-28 14:31:01 +00:00
Mathieu Malaterre
d2dc1597fe [trunk] Prefer strcpy since it copies trailing 0 directly 2014-02-28 14:23:30 +00:00
Mathieu Malaterre
82647e79c7 [trunk] Simplify code to centralize code cleanup 2014-02-28 14:17:30 +00:00
Mathieu Malaterre
ecbebe2847 [trunk] Some code cleanup add sentinels 2014-02-28 13:59:59 +00:00
Mathieu Malaterre
816db977fd [trunk] Remove a simple warning, and use static to detect unused functions. Simplify function declarations. 2014-02-28 13:19:03 +00:00
Mathieu Malaterre
cbe77e2412 [trunk] run test suite on dataset from issue 171
Fixes issue 171
2014-02-28 12:30:11 +00:00
Mathieu Malaterre
1eb67ca49d [trunk] Remove some simple warnings in opj_dump 2014-02-28 12:06:57 +00:00
Mathieu Malaterre
7a89d731f7 [trunk] Merge final patch from issue 171 with code simplification. also handles signed case properly.
Fixes issue 171
2014-02-28 09:52:35 +00:00
Mathieu Malaterre
65503dad73 [trunk] Fix find_path behavior within cross-compilation execution 2014-02-28 08:28:25 +00:00
Mathieu Malaterre
a347262468 [trunk] Import patch from issue 218. No dataset to check, so blindly applied it.
Fixes issue 218
2014-02-27 17:21:00 +00:00
Mathieu Malaterre
6a6fa7027a [trunk] Import patch from issue 171. Only the imagetoraw part was not applied.
Update issue 171
2014-02-27 17:04:06 +00:00
Mathieu Malaterre
86cdc91180 [trunk] Try to run test suite on invalid dataset from sumatrapdf team
Update issue 225
2014-02-27 15:00:54 +00:00
Mathieu Malaterre
094465a710 [trunk] run test suite to illustrate patch from r2458 2014-02-27 14:43:17 +00:00
Mathieu Malaterre
6ae56f302e [trunk] Make sure that opj_decompress only output a single component
Update issue 110
2014-02-27 14:17:53 +00:00
Mathieu Malaterre
ad895fadb1 [trunk] add issue 46 to the test suite
Fixes issue 46
2014-02-27 10:03:11 +00:00
Mathieu Malaterre
7c120281c7 [trunk] improve command line parser syntax checking 2014-02-27 10:02:46 +00:00
Mathieu Malaterre
8a4095b405 [trunk] add a sentinel in debug code 2014-02-27 09:56:06 +00:00
Mathieu Malaterre
a7cc5b6a5d [trunk] simplify code using for loop 2014-02-27 08:38:55 +00:00
Mathieu Malaterre
ac1dfd4662 [trunk] Import test case from issue 208. This appears to be fixed now.
Fixes issue 208
2014-02-26 17:13:46 +00:00
Mathieu Malaterre
abf2f7f05e [trunk] Run test suite on dataset from issue 211. Test is now passing nicely.
Fixes issue 211
2014-02-26 16:31:27 +00:00
Mathieu Malaterre
1c209d711e [trunk] run test suite on dataset from issue 135. Add fake md5sum to make sure tests is failing.
Update issue 135
2014-02-26 16:20:36 +00:00
Mathieu Malaterre
91f521ef92 [trunk] Update missing md5sums 2014-02-26 15:55:49 +00:00
Mathieu Malaterre
9ac3ae1270 [trunk] kakadu does not support 451.pdf.SIGSEGV.ce9.372 we should not pretend to be able to decompress it
Update issue 225
2014-02-26 15:41:57 +00:00
Mathieu Malaterre
d74579aa38 [trunk] Run test suite on issue 141. Add a fake dataset to report that test is failing.
Update issue 141
2014-02-26 15:21:03 +00:00
Mathieu Malaterre
6deb1a83b5 [trunk] Add more details in case test fails 2014-02-26 15:14:27 +00:00
Mathieu Malaterre
6f3a7ef3c8 [trunk] run test suite on input dataset from issue 134
Fixes issue 134
2014-02-26 14:32:11 +00:00
Mathieu Malaterre
9f3687f917 [trunk] fixes test NR-DEC-file409752.jp2-40-decode, use proper naming convention (need to keep file extension) 2014-02-26 14:28:17 +00:00
Mathieu Malaterre
5e77c4e936 [trunk] add test suite for issue 142
Fixes issue 142
2014-02-26 14:24:02 +00:00
Mathieu Malaterre
97c376e06d [trunk] When no output PGX file is found, report an error 2014-02-26 14:23:30 +00:00
Mathieu Malaterre
8f4d674442 [trunk] Add missing include dir for wx app 2014-02-26 14:04:03 +00:00
Mathieu Malaterre
7f277fea94 [trunk] Remove some simple warnings about cast, and unused functions 2014-02-26 14:00:21 +00:00
Mathieu Malaterre
52440cc2e6 [trunk] Remove a simple warning about a cast 2014-02-26 12:54:02 +00:00
Mathieu Malaterre
3fe9243e1c [trunk] revert r2460 since it breaks ETS-C1P0-p0_03.j2k-decode.
Update issue 225
2014-02-26 12:33:49 +00:00
Mathieu Malaterre
05dae25a22 [trunk] Revert r2453 since it breaks conformance test ETS-C1P1-p1_06.j2k-decode 2014-02-26 12:30:44 +00:00
Mathieu Malaterre
23ea270881 [trunk] Import patch from sumatrapdf team. This handle testcase 1336.pdf.asan.47.376
Update issue 225
2014-02-26 11:27:01 +00:00
Mathieu Malaterre
7247543da3 [trunk] Import patch from sumatrapdf team. This handle testcase 1888.pdf.asan.35.988
Update issue 225
2014-02-26 11:26:09 +00:00
Mathieu Malaterre
37a8d2acc1 [trunk] Import patch from sumatrapdf team. This handle testcase 1851.pdf.SIGSEGV.ce9.948
Update issue 225
2014-02-26 11:25:27 +00:00
Mathieu Malaterre
4a7ba87d99 [trunk] Import patch from sumatrapdf team. Start using new color space when found.
Update issue 225
2014-02-26 11:24:38 +00:00
Mathieu Malaterre
51e3764519 [trunk] Import patch from sumatrapdf team. This handle some Part-2 compliant file, by being more tolerant in COLR box. No testcase for now.
Fixes issue 247
2014-02-26 11:22:34 +00:00
Mathieu Malaterre
533d92aa8e [trunk] Import patch from sumatrapdf team. This handle some testcase with no input dataset, but changes looks ok.
Update issue 225
2014-02-26 11:21:18 +00:00
Mathieu Malaterre
19887b7b8c [trunk] Import patch from sumatrapdf team. This handle testcase 2977.pdf.asan.67.2198
Update issue 225
2014-02-26 11:17:18 +00:00
Mathieu Malaterre
005e75bdc3 [trunk] Import (ugly) patch from sumatrapdf team. This feels like a hack rather than a solution.
Fixes issue 226
2014-02-26 11:16:32 +00:00
Mathieu Malaterre
5f3470fcd0 [trunk] Import patch from sumatrapdf team. This handle testcase 3635.pdf.asan.77.2930
Update issue 225
2014-02-26 11:14:27 +00:00
Mathieu Malaterre
adb237cfa8 [trunk] Import patch from sumatrapdf team. Original commit is 5b0c9985e3359aca9b3fcfd94424166aa61a141a.
Update issue 225
2014-02-26 11:13:21 +00:00
Mathieu Malaterre
29a29d6210 [trunk] Import patch from sumatrapdf team. This handle testcase 451.pdf.SIGSEGV.ce9.3723
Update issue 225
2014-02-26 11:11:33 +00:00
Mathieu Malaterre
3a155ceda6 [trunk] Import patch from sumatrapdf team. This handle testcase 2.pdf.SIGFPE.706.1112
Update issue 225
2014-02-26 11:10:40 +00:00
Mathieu Malaterre
7195a23a9d [trunk] Import patch from sumatrapdf team. This handle testcase 1610.pdf.SIGSEGV.59c.681
Update issue 225
2014-02-26 11:09:59 +00:00
Mathieu Malaterre
0ae6ff8018 [trunk] Import patch from sumatrapdf team. This handle testcase 2539.pdf.SIGFPE.706.1712
Update issue 225
2014-02-26 11:09:20 +00:00
Mathieu Malaterre
241769dc2f [trunk] Import patch from sumatrapdf team. This handle testcase 4035.pdf.SIGSEGV.d8b.3375
Update issue 225
2014-02-26 11:08:25 +00:00
Mathieu Malaterre
4a39ee9bbc [trunk] Import patch from sumatrapdf team. Add detection for testcase 1802.pdf.SIGSEGV.36e.894
Update issue 225
2014-02-26 11:06:18 +00:00
Mathieu Malaterre
1dedf7f0cd [trunk] Import patch from sumatrapdf team. Add a new function to check color box.
Update issue 225
2014-02-26 11:05:31 +00:00
Mathieu Malaterre
70ede09310 [trunk] Import patch from sumatrapdf team. This patch adds new colorspace handling.
Update issue 225
2014-02-26 11:04:33 +00:00
Mathieu Malaterre
3da30304fc [trunk] Import patch from sumatrapdf team. This adds alpha handling. This patch changes ABI.
Update issue 225
2014-02-26 11:03:55 +00:00
Mathieu Malaterre
820c04c679 [trunk] Update file extension function to handle cases where filename containes multiples dots.
Update issue 250
2014-02-26 10:48:06 +00:00
Mathieu Malaterre
9d848e3f5e [trunk] Clearly indicate that mem-b2ace68c-1381.jp2 should not be decompressed.
Update issue 250
2014-02-26 09:57:38 +00:00
Mathieu Malaterre
d5f71c2e1d [trunk] Fix TestJPIP1 on case sensitive system 2014-02-26 09:51:37 +00:00
Mathieu Malaterre
36a7d23273 [trunk] regex would not be used to remove java deprecation warning from dashboard 2014-02-26 09:47:53 +00:00
Mathieu Malaterre
c4317177f3 [trunk] Remove simple warnings about unused functions 2014-02-26 09:46:01 +00:00
Mathieu Malaterre
e231a84b2f [trunk] Properly store and use value returned by fread. Also invert nmemb and size in fread call.
Fixes issue 262
2014-02-26 09:40:19 +00:00
Mathieu Malaterre
b56fb96b1b [trunk] Fix invalid write access in JPIP code.
Fixes issue 261
2014-02-26 09:35:11 +00:00
Mathieu Malaterre
163c7e3460 [trunk] Run decoder on input dataset from issue 254. Add fake md5sum to make sure the test is failing.
Update issue 254
2014-02-25 17:15:22 +00:00
Mathieu Malaterre
4c1023dac6 [trunk] deprecationg warning issued by java compiler should be ignored 2014-02-25 16:53:42 +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
9021776963 [trunk] New decoded files are passing. Adding reference files.
Update issue 225
2014-02-25 16:36:26 +00:00
Mathieu Malaterre
18771f1b6a [trunk] For now assume any provided stream should not get decompressed.
Update issue 225
2014-02-25 16:16:34 +00:00
Mathieu Malaterre
ed2af11102 [trunk] Run decoder on issue 229 test cases
Update issue 229
2014-02-25 15:36:09 +00:00
Mathieu Malaterre
7dd65e84e6 [trunk] Revert r2415 for now since it introduce large regression 2014-02-25 14:14:56 +00:00
Mathieu Malaterre
e260ec6e9d [trunk] Import commit 87b08a096bb8ad61f9dbe4811e208d9c9d7fe63b from ghostpdl
don't define lrintf for MSVC 2013 (fix compilation breakage)

Update issue 225
2014-02-25 14:03:30 +00:00
Mathieu Malaterre
7ce3f3c1a6 [trunk] Import commit 4cee6ceab21025079f439bb152fb9d8ae8c5c832 from ghostpdl
Bug 694906: fix potential heap overflow in opj_t2_read_packet_header

Update issue 225
2014-02-25 13:50:29 +00:00
Mathieu Malaterre
a466755bbb [trunk] import commit 83dad6a76536222a3a51146f942e733a2e90ec52 from ghostpdl
fix potential NULL-pointer dereference caused by testing the wrong variable
after opj_realloc (happens only in OOM situations)

Update issue 225
2014-02-25 13:39:50 +00:00
Mathieu Malaterre
901c9d8ae0 [trunk] Import commit fc884aee2b69c78500e65c3d05bf216791a9ea4a from ghostpdl
prevent heap overflow in opj_t2_read_packet_header

Also prevent a double-free of segment data under OOM conditions.

Problem found in a test file, 1802.pdf.SIGSEGV.36e.894 supplied
by Mateusz "j00ru" Jurczyk and Gynvael Coldwind of the Google
Security Team using Address Sanitizer. Many thanks!

Update issue 225
2014-02-25 13:38:32 +00:00
Mathieu Malaterre
6145c82804 [trunk] Import commit 8ec8321df613986e8642e2975f7182072eb4be62 from ghostpdl
make opj_stream_set_user_data accept a NULL stream
for consistency with opj_stream_set_* which does so.

Update issue 225
2014-02-25 13:33:43 +00:00
Mathieu Malaterre
876c02206d [trunk] Import commit f4139d702559649e577a5df9cfd64b0ca6107a7a from ghostpdl
Several functions accept a buffer size but never actually check whether
the buffer overflows during reading/writing. This fixes all cases where
a size variable has explicitly been marked as unused (through a (void)
cast).

This was discovered while investigating an assertion caused by
7cc691f332f26802c64cdc47e17bff8b_signal_sigabrt_7ffff6d59425_2247_2509.pdf
among others.

Thanks to Mateusz Jurczyk and Gynvael Coldwind of the Google Security
Team for providing the example files.
2014-02-25 13:28:37 +00:00
Mathieu Malaterre
3ca312033f [trunk] Clarify raw input in openjpeg. LSB vs MSB are now documented.
Fixes issue 62
2014-02-25 10:35:07 +00:00
Mathieu Malaterre
1378475573 [trunk] Run test case for issue 228. Output has been validated.
Fixes issue 228
2014-02-25 10:30:40 +00:00
Mathieu Malaterre
00b049866b [trunk] Run sumatrapdf test cases 2014-02-25 10:06:37 +00:00
Mathieu Malaterre
d847e477f0 [trunk] add missing private lib. Update issue 223 2014-02-24 17:22:48 +00:00
Mathieu Malaterre
c55e164e87 [trunk] Make sure to always output pgx file. Handle case where multiple pgx files are generated. Fixes all tests. 2014-02-24 16:55:13 +00:00
Mathieu Malaterre
531cd5dd14 [trunk] add test demonstrating a regression in 1.5.0 and up. Update issue 205 2014-02-24 16:09:42 +00:00
Mathieu Malaterre
ff0a9f763e [trunk] improve test suite by checking against a reference md5 2014-02-24 16:07:21 +00:00
Mathieu Malaterre
228e0a3d79 [trunk] Fix a simple mem leak 2014-02-24 14:55:32 +00:00
Mathieu Malaterre
f38e29d00a [trunk] Fix two simple warnings about sign mismatch 2014-02-24 14:50:40 +00:00
Mathieu Malaterre
963283d7d0 [trunk] Fix warning about signed/unsigned mismatch 2014-02-24 14:27:02 +00:00
Mathieu Malaterre
c91044a4a7 [trunk] Make sure to handle ret value, and properly initialize output file 2014-02-24 14:22:25 +00:00
Mathieu Malaterre
f42c26adbd [trunk] Make sure to handle ret value in test 2014-02-24 14:10:11 +00:00
Mathieu Malaterre
9efad43509 [trunk] Prefer the new style cmake: add_test command
Fixes issues 258
2014-02-24 12:48:23 +00:00
Mathieu Malaterre
33d8f08964 [trunk] Fix a warning about type conversion. Use a trick where unsigned wrapping is legal 2014-02-24 08:52:44 +00:00
Antonin Descampe
e826e9281e [trunk] replaced fprintf with event_mgr in cinema-related stuff in j2k.c 2014-02-12 16:33:19 +00:00
Antonin Descampe
780120c9a2 [trunk] moved logic related to cinema profiles in library (was in
opj_compress.c). This enables one using the library with its own
executable to easily ask for cinema profiles.
2014-02-12 16:16:21 +00:00
Antonin Descampe
d6c0c85125 [trunk] added a warning when tif conversion changes input image bitdepth 2014-02-12 15:16:36 +00:00
Antonin Descampe
c81fb397bb [trunk]re-indenting convert.c 2014-02-12 14:56:49 +00:00
Mathieu Malaterre
caf4e46e06 Update kakadu cmake module 2014-02-07 10:37:06 +00:00
Antonin Descampe
ff1a30d80a [trunk] added some tests for Cinema2k 48fps and Cinema 4k 24 fps. Fixed
a bug in comparePGXimages.c leading to huge Test.xml file uploaded to
DashBoard
2014-01-23 16:33:13 +00:00
Antonin Descampe
d143f49a66 [trunk] fixed another DCI compliance bug 2014-01-23 09:39:02 +00:00
Antonin Descampe
58698b789a [trunk] uncomment tests mistakenly commented in previous commit 2014-01-22 18:44:11 +00:00
Antonin Descampe
ee3f2ffa19 [trunk] fixed several bugs in cinema mode (2K 24/48 fps, and 4K). Trunk
now produces compliant DCI code-streams.
2014-01-22 18:41:34 +00:00
Antonin Descampe
c59124dfe2 [trunk] fixed indentation in opj_compress.c, renamed 2 internal
functions, added some comments
2014-01-16 14:21:14 +00:00
Antonin Descampe
7b14cf8558 [trunk] fixed DCI-compliant codestream generation (-cinema2K and - 2014-01-16 12:55:14 +00:00
Antonin Descampe
05f796d2fa trunk: fixed cmake config so as to be able to link opj_jpip_server with FCGI. 2013-10-30 08:59:23 +00:00
Antonin Descampe
bd8c91b37d trunk: fixed cmake config so as to be able to link opj_jpip_server with FCGI. 2013-10-30 08:57:18 +00:00
Antonin Descampe
7294cdef3e trunk: disabling class-0 conformance tests for now (bad implentation of tests) 2013-10-28 23:31:55 +00:00
Rex Dieter
4d7b6374c8 complete openjpeg2 pkgconfig support, bug #68 2013-10-15 19:17:51 +00:00
Mathieu Malaterre
5855da5a15 [trunk] Import patch from bug #241 2013-09-26 09:28:47 +00:00
Antonin Descampe
34fd493512 test: modified class-0 conformance testing to comply with constraints 2013-07-11 16:48:49 +00:00
Mickael Savinaud
da4bd9b110 [trunk] use the private version of opj_config to avoid compilation error into mj2 2013-03-25 13:43:14 +00:00
Mickael Savinaud
7fbf6df09e [trunk] use opj_config_private.h into the opj_inttypes.h 2013-03-25 13:36:26 +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
8ee74f6bff [trunk] update test suite because now illegalcolortransform.j2k could be decoded 2013-03-25 09:54:15 +00:00
Mickael Savinaud
bf0fa4089f [trunk] enhance the support of sYCC into opj_decompress application (thanks winfried). 2013-03-24 23:12:41 +00:00
Mickael Savinaud
07ae149955 [trunk] managed nicely the case where TPSot value is incorrect (thanks winfried). Update the test suite to check this case. Updates issue 202. Updates issue 206. Update issue 208 2013-03-24 22:50:46 +00:00
Mickael Savinaud
ecb93d97a5 [trunk] add access to opj_apps_config.h to old applications 2013-03-17 22:22:11 +00:00
Mickael Savinaud
f769d5e27f [trunk] manage correctly the case where meth value is not correct (thanks winfried) 2013-03-17 18:27:41 +00:00
Mickael Savinaud
1e414c8f37 [trunk] correct issue 188 (thanks winfried) and add test about it. Fixes issue 188 2013-03-17 18:16:03 +00:00
Mickael Savinaud
07e6994be1 [trunk] use OPJ_ prefix on HAVE variable also for tests 2013-03-17 17:08:12 +00:00
Mickael Savinaud
0abf4f8fbb [trunk]remove wrong code in mj2 library detected by winfried (thanks to you) 2013-03-17 17:06:30 +00:00
Mickael Savinaud
a13e4a77e0 [trunk] use everywhere the new opj_ prefix for HAVE variables and use the opj_apps_config file (thanks to winfried) 2013-03-17 17:03:00 +00:00
Mickael Savinaud
6de2271e2a [trunk] use the home made macro to ensure the existence of some include file 2013-03-13 15:21:20 +00:00
Mickael Savinaud
021e255282 [trunk] use the opj_ prefix for the HAVE_FSEEKO variable 2013-03-13 15:17:35 +00:00
Mickael Savinaud
92b1e038c1 [trunk] correct missing variable in openjpeg config file 2013-03-13 10:18:04 +00:00
Mickael Savinaud
a8c33ae219 [trunk] remove some unused variable from opj_config and rename other one with opj_ prefix 2013-03-03 18:06:27 +00:00
Mickael Savinaud
e7bc30b409 [trunk] split into two config files config options related to the lib and to the application. 2013-03-03 17:55:35 +00:00
Mickael Savinaud
efaefa21fc [trunk] add the prefix opj_ to deprecated everywhere 2013-02-18 13:19:52 +00:00
Mickael Savinaud
42bd417acf [trunk] update documentation of new functions _v3 and mark deprecated related functions 2013-02-17 22:57:14 +00:00
Mickael Savinaud
af58e8e8f9 [trunk] move to the new API for function opj_stream_create_default_file_stream. Use now opj_stream_create_default_file_stream_v3 (WIP) 2013-02-17 10:34:31 +00:00
Mickael Savinaud
4bf4a7668e [trunk] move to the new API for function opj_stream_destroy. Use now opj_stream_destroy_v3 (WIP) 2013-02-16 17:39:23 +00:00
Mickael Savinaud
c03ca9c73c [trunk] rename deprecated macro with opj_ prefix and use it for opj_stream_destroy function 2013-02-16 17:31:22 +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
a2aeafe85b [trunk] add a test related to issue 202 2013-02-04 13:22:56 +00:00
Mickael Savinaud
0109b39f58 [trunk] update convert about png writing with additional metadata (thanks winfried) 2013-02-03 10:18:10 +00:00
Mickael Savinaud
752e978d56 [trunk] update test suite for issue 5 and 62 2013-02-03 09:55:31 +00:00
Mickael Savinaud
8b36a11f2b [trunk] backout one part of the rev 2266 2013-02-03 09:07:23 +00:00
Mathieu Malaterre
ccd448d626 [trunk] JP3D: Fix issue with Z handling in packet iterator 2013-01-03 14:26:38 +00:00
Mathieu Malaterre
44fb38949b [trunk] JP3D: Handles errors properly 2013-01-03 14:25:49 +00:00
Mathieu Malaterre
ad1532ed57 [trunk] JP3D: remove old debug 2013-01-03 14:22:34 +00:00
Mathieu Malaterre
caaec3bb05 [trunk] JP3D: convert from DOS to UNIX eol 2013-01-02 18:19:56 +00:00
Mathieu Malaterre
df47fae287 [trunk] JP3D: remove exe bit from source files 2013-01-02 18:16:14 +00:00
Mickael Savinaud
b65bf48369 [trunk] merge from branch 1.5 a correction about large code-block data (decoding part) and add tests about issue 5 and issue 62 2012-12-18 17:46:33 +00:00
Mathieu Malaterre
4c02acb728 [trunk] remove left over from v2 transition 2012-12-11 14:15:46 +00:00
Mathieu Malaterre
8c9151c86b [trunk] JP3D: completely redo the opj_tgt_create function. Take as input the initial opj_tgt_create as found in openjpeg 1.5, and extend with the 3rd dimension. 2012-12-11 14:09:24 +00:00
Rex Dieter
c075742bc8 Doxyfile: HTML_TIMESTAMP = NO
helps when comparing the output of multiple runs,
and distros will appreciate avoiding multilib conflicts.
2012-12-07 15:07:50 +00:00
Mickael Savinaud
b42cf317d6 [trunk] correct the new name of OPJ_HAVE_STDINT_H everywhere 2012-12-04 13:13:50 +00:00
Mickael Savinaud
f5429e4ce8 [trunk] remove SSIZE which is unused in openjpeg and rename HAVE_STDINT_H to OPJ_HAVE_STDINT_H 2012-12-04 12:51:00 +00:00
Mickael Savinaud
82dad8e629 [trunk] add openjpeg.h in some files of openjpip to use some opj type (thanks winfried) 2012-12-04 12:20:30 +00:00
Mickael Savinaud
59aa37fe2b [trunk] move typedef from opj_stdint.h to openjpeg.h and add an include of stdio.h in openjpeg.h. Fixes issue 197 2012-12-03 13:26:30 +00:00
Mickael Savinaud
0adb43f06e [trunk] correct the encoding of colr box information (thanks Winfried) 2012-12-03 13:04:43 +00:00
Mickael Savinaud
87e09a09da [trunk]add the pkgconfig support for openjp2 (thanks Winfried) 2012-12-03 12:21:48 +00:00
Mathieu Malaterre
ba630816bc [trunk] JP3D codec was trying to pull information from the registration parameter in COM. This is non-standard. 2012-11-28 13:37:50 +00:00
Mathieu Malaterre
863fdafcd5 [trunk] As per T.809 code block are not shifted in JP3D
Table A.7 
3D code-block width, height and depth exponent values xcb = value, ycb = value
or zcb = value.
NOTE – This redefines Rec. ITU-T T.800 | ISO/IEC 15444-1 significantly! The 3D
code-block width, height and depth are limited to powers of two with the minimum
size being 20 and the maximum being 210.
Further, the 3D code-block size is restricted so that 4 ≤ xcb+ycb+zcb ≤ 18.
2012-11-28 13:06:02 +00:00
Mathieu Malaterre
be5e6941bf [trunk] JP3D: this is safe to write comment using Registration: ISO-8859-15 2012-11-28 12:21:51 +00:00
Mathieu Malaterre
7980115412 [trunk] JP3D fix issue with Registration value in COM marker. Move COM marker just before COD. 2012-11-28 12:18:17 +00:00
Mathieu Malaterre
cab86a0deb [trunk] jp3d: fix command line parsing for subsampling 2012-11-28 12:04:40 +00:00
Mathieu Malaterre
be3a1da14a [trunk] Fix issue with ITU-T T.809 (05/2011)
- ZSI is now known as NSI (FF54)
- NSI now stores Ndim (=3)
- CAP extended marker was not set properly
2012-11-28 11:46:16 +00:00
Mathieu Malaterre
650c587875 [trunk] Fix compilation issue where size_t would be undefined 2012-11-28 10:54:33 +00:00
Mickael Savinaud
d29c5760bd [test] update the list of files which will be gracefully rejected when they are dump 2012-11-27 09:24:24 +00:00
Mickael Savinaud
ee9d777d69 [trunk] add empty test about the issue 197. Updates issue 197 2012-11-27 09:11:16 +00:00
Mickael Savinaud
59582bafa3 [trun[trunk] check if the dx and dy steps are not incorrect according to the JPEG2000 norm (thanks Even).
Test associated to this issue should nicely fail. Fixes issue 194
2012-11-26 16:24:29 +00:00
Mickael Savinaud
1ad85ac9ee [trunk] check if the number of tiles is not incorrect regarding the JPEG2000 norm (thanks Even).
Test associated to this issue should nicely fail. Fixes issue 163
2012-11-26 16:13:32 +00:00
Mickael Savinaud
999a84c77a [trunk] test about issue 192 should nicely fail 2012-11-26 16:03:35 +00:00
Mickael Savinaud
48e0d167aa [trunk] check the index of the component in read_qcc (thanks Even). fixes issue 192 2012-11-26 15:58:14 +00:00
Mickael Savinaud
f14da66ce5 [trunk] update test suite with issue 191 to 194 and update patch for 191 which should fail properly 2012-11-26 13:37:33 +00:00
Mickael Savinaud
14ab311d2f [trunk] fix issue 191 (thanks Even) 2012-11-19 13:37:04 +00:00
Mickael Savinaud
02ab4363b6 [trunk]remove not used structures 2012-11-19 10:31:43 +00:00
Mickael Savinaud
e1f7c73324 [trunk] remove the extended struct it is a bad idea 2012-11-16 15:40:23 +00:00
Mickael Savinaud
3042fc2a29 [trunk] add extended capacities for future development 2012-11-16 09:35:42 +00:00
Mathieu Malaterre
a622c1c2fe [trunk] rename USE_LEGACY into OPJ_USE_LEGACY for consistency with other #define 2012-11-16 09:31:12 +00:00
Mathieu Malaterre
b3e467dcba [trunk] Attempt to fix compilation error with mj2 2012-11-16 09:19:11 +00:00
Mathieu Malaterre
c0259255b0 [trunk] Attempt to fix compilation error with mj2 2012-11-16 09:18:03 +00:00
Mickael Savinaud
9398bc1764 [trunk] solve the problem with new opj_ symbols in color.c 2012-11-16 08:36:23 +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
583df79be9 [trunk]rename the cinema option to old one 2012-11-15 19:24:51 +00:00
Mickael Savinaud
0e0b892493 [trunk] update some applications with new OPJ_BOOL type 2012-11-15 19:18:43 +00:00
Mickael Savinaud
78a8d64a92 [trunk] use OPJ_INT32 instead of int in t2.c 2012-11-15 16:46:08 +00:00
Mickael Savinaud
5433e4dab8 [trunk] rename function with the new opj_ prefix 2012-11-15 16:42:55 +00:00
Mickael Savinaud
c3c59b010b [trunk] solve a potential bug when we test the realloc 2012-11-15 16:37:57 +00:00
Mickael Savinaud
8eb481b6c6 [trunk] add an assert to spot a problem. update issue 189 2012-11-15 16:28:44 +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
f663042893 [trunk] propagate the new OPJ_ symbol and type to openjpip 2012-11-15 14:43:50 +00:00
Mickael Savinaud
f07c1a11a0 [trunk]rename decompress options with the goog name 2012-11-15 14:29:38 +00:00
Mickael Savinaud
ce297bfa9e runk] fix the documentation of the API 2012-11-15 14:22:13 +00:00
Mickael Savinaud
ba1682c120 [trunk] avoid memory leak in j2k_random_tile_access.c 2012-11-15 13:51:00 +00:00
Mickael Savinaud
e212154d8d [trunk]extend last commits to apps 2012-11-15 13:38:35 +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
e3c2305ff4 [trunk] remove warnings raised by flags -Wall -Wextra -pedantic 2012-11-13 17:35:15 +00:00
Mickael Savinaud
0e3c467a5b [trunk] remove warnings raised by vs11-beta analyzer 2012-11-13 16:59:03 +00:00
Mickael Savinaud
94880d8f36 [trunk] remove warnings raised by flags -Wall -Wextra -pedantic 2012-11-13 15:26:13 +00:00
Mickael Savinaud
7307bb6e9a [trunk] remove warnings raised by flags -Wall -Wextra -pedantic and vs9 analyzer 2012-11-13 15:16:35 +00:00
Mickael Savinaud
4263410fe8 [trunk] remove warnings raised by flags -Wall -Wextra -pedantic 2012-11-13 12:59:35 +00:00
Mickael Savinaud
cb0eb855ca [trunk] manage the case where the SOT marker is alone, PSot=12 (case of PHR data).
Fixes  issue 162
2012-11-13 11:18:58 +00:00
Mickael Savinaud
569d0ec7cc [trunk] avoid memory leak in opj_t2_decode_packets 2012-11-13 09:47:16 +00:00
Mickael Savinaud
1021e87522 [trunk] add some new tests related to new data; indicate that some tests should failed because data are wrong 2012-11-12 16:32:28 +00:00
Mathieu Malaterre
dc34cf362f [trunk] Add more testing to the tile access/random
Update issue 186
2012-11-08 16:47:35 +00:00
Mathieu Malaterre
e71749428c [trunk] Fix what looks like a copy/paste error
Update issue 186
2012-11-08 16:45:27 +00:00
Mathieu Malaterre
8f58b776b0 [trunk] Add more test in j2k_random_tile_access
Update issue 186
2012-11-08 16:41:01 +00:00
Mathieu Malaterre
fb0a11636f [trunk] Add new tests (j2k_random_tile_access) 2012-11-08 16:30:46 +00:00
Mickael Savinaud
7bf09734d7 [trunk] remove old structure from testempty 2012-10-30 08:12:32 +00:00
Mickael Savinaud
853bcb3c64 [trunk] add documentation 2012-10-29 22:12:02 +00:00
Mickael Savinaud
4d32395fe1 [trunk]OPJ_STREAM_READ is now equal to OPJ_TRUE and OPJ_STREAM_WRITE to OPJ_FALSE 2012-10-29 22:06:28 +00:00
Mickael Savinaud
a6a141d326 [trunk] move opj_event_mgr struct from openjpeg. h to event.h 2012-10-29 22:02:02 +00:00
Mickael Savinaud
e0161e03db [trunk] remove old struct from V1 and not used in V2 2012-10-29 21:49:33 +00:00
Mathieu Malaterre
82d29d4c2a [trunk] Remove bool.h, use opj_bool instead
Fix remaining opj_calloc/malloc/free issues
2012-10-29 16:24:39 +00:00
Mathieu Malaterre
1a5791750b [trunk] Fix simple warning about unused variables 2012-10-29 16:07:24 +00:00
Mathieu Malaterre
482d9b58b3 [trunk] Make sure to use off_t 2012-10-29 16:07:09 +00:00
Mathieu Malaterre
5903dd7d82 [trunk] Remove temp fix now that mj2 is fixed 2012-10-29 15:28:59 +00:00
Mathieu Malaterre
301b1ffbc7 [trunk] Update version number to 2.0. This will help for testing generating scripts 2012-10-29 14:36:35 +00:00
Mathieu Malaterre
759be64115 [trunk] Fix remainings issues with doxygen doc
Convert DOS files to UNIX eol
2012-10-29 14:35: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
f31957c502 [trunk] Remove some simple warnings about missing prototypes 2012-10-29 13:28:51 +00:00
Mathieu Malaterre
fb69541cfa [trunk] Fix compilation when JPIP is OFF 2012-10-29 13:27:39 +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
18e7fcc37f [trunk] remove warnings related to the use of -Wall -Wextra -pedantic 2012-10-29 10:08:35 +00:00
Mickael Savinaud
1c8a657044 [trunk] finish to remove the old cio_ struct (last comment is incomplete) 2012-10-26 10:10:22 +00:00
Mickael Savinaud
cdea5c8eef [trunk] remove some warnings from -Wall -Wextra -pedantic 2012-10-26 10:04:55 +00:00
Mickael Savinaud
bcc386e3bb [trunk]remove some warnings raised by Wall 2012-10-26 09:39:52 +00:00
Mickael Savinaud
a2bd3bb75b [trunk] use the right cp structure in image.h 2012-10-26 07:52:27 +00:00
Mickael Savinaud
b63d618e48 [trunk] remove last warnings from t1 2012-10-25 17:31:18 +00:00
Mickael Savinaud
8864c2d59b [trunk] rename t1_getwmsedec_v2 to opj_t1_getwmsedec and remove t1_getwmsedec 2012-10-25 17:27:22 +00:00
Mickael Savinaud
c75073fbf4 [trunk] cancel previous commit about use of t1_decode_cblks from v2. We should use t1_decode_cblks from 1.5 because it is faster (rev 557) 2012-10-25 17:23:54 +00:00
Mickael Savinaud
cf4529d058 [trunk] use the opj_ prefix for last t1 functions 2012-10-25 15:50:58 +00:00
Mickael Savinaud
9b6900b058 [trunk] [trunk] remove old opj_tcp and rename opj_tcp_v2 to opj_tcp 2012-10-25 15:15:02 +00:00
Mickael Savinaud
7f7ef068fc [trunk] [trunk] remove old opj_cp and rename opj_cp_v2 to opj_cp 2012-10-25 15:09:31 +00:00
Mickael Savinaud
a41790ce8a [trunk] [trunk] remove old opj_t2 and rename opj_t2_v2 to opj_t2 2012-10-25 14:54:19 +00:00
Mickael Savinaud
06615a556d [trunk] rename opj_tcd_truct_v2 to opj_tcd_struct 2012-10-25 14:49:10 +00:00
Mickael Savinaud
94a69c2b31 [trunk] rename opj_j2k_v2 to opj_j2k 2012-10-25 14:27:09 +00:00
Mickael Savinaud
425ff2f81d [trunk] remove old opj_j2k struct 2012-10-25 14:22:29 +00:00
Mickael Savinaud
2257166e61 [trunk] rename opj_jp2_v2 to opj_jp2 2012-10-25 14:16:19 +00:00
Mickael Savinaud
56cf5f4f67 [trunk] remove old opj_jp2 struct 2012-10-25 14:11:19 +00:00
Mickael Savinaud
668484ba8f [trunk] correct a mis use of an old struct 2012-10-25 14:10:01 +00:00
Mickael Savinaud
f824078c14 [trunk] rename opj_event_msg_v2 to opj_event_msg 2012-10-25 13:49:20 +00:00
Mickael Savinaud
3250833a62 [trunk]remove old opj_event_mgr function 2012-10-25 13:46:40 +00:00
Mickael Savinaud
8bc24912d1 [trunk] style 2012-10-25 13:35:30 +00:00
Mickael Savinaud
52f6f7e0c7 [trunk] remove cio deprecated functions 2012-10-25 13:29:41 +00:00
Mickael Savinaud
ee8ee69c30 [trunk]clean jpip marker functions but it is still experimental 2012-10-25 13:15:37 +00:00
Mickael Savinaud
4941ebcc91 [trunk] remove jpt.c/.h which used functions not used by v2. The code is always available in branch 1.5 2012-10-25 11:45:44 +00:00
Mathieu Malaterre
9adbea785b [trunk] Fix remaining issue with OPJ_CALLCONV 2012-10-25 10:41:55 +00:00
Mathieu Malaterre
fd19413196 [trunk] Add documentation for stable API/ABI and gcc flags on UNIX 2012-10-25 08:44:27 +00:00
Mathieu Malaterre
6300a8a0a2 [trunk] marking as deprecated the old cio interface 2012-10-25 08:38:04 +00:00
Mathieu Malaterre
66c1228c95 [trunk] Remove some simple warnings about missing prototypes 2012-10-25 08:20:12 +00:00
Mathieu Malaterre
4585b23552 [trunk] Fix OpenJPWL compilation
Simply move files over from branch 1.5 onto current trunk, and use current openmj2 copy (it contains a copy of openjpeg 1.5.x)
2012-10-25 08:15:41 +00:00
Mathieu Malaterre
23a624f73a [trunk] Since r2060 (and r2059) openjpip is now a first class shared library, instead of a local static lib which expose all the symbols.
As such re-apply changes from r2077 which were removed in r2122
Also remove old code for now removed opj_jpip_compress
2012-10-25 07:53:22 +00:00
Mathieu Malaterre
f3d7d2f7b1 [trunk] Rework r2077
r2077 did expose too much of the detail implementation of OpenJPEG. Rework dependencies in between JPIP file level details and JPIP client/server arch.
Move JPIP file level functionalities back into OpenJP2 as was the case in openjpeg 1.5.x. Use new cio func.
2012-10-25 07:39:59 +00:00
Mathieu Malaterre
0358983ee6 [trunk] Add missing newline 2012-10-25 07:06:12 +00:00
Mathieu Malaterre
a0977266b4 [trunk] Run fix_comment on invert.c 2012-10-25 06:58:30 +00:00
Mickael Savinaud
76947f0074 [trunk] add the support of complex mct encoding when we setup the j2k encoder 2012-10-24 15:19:51 +00:00
Mickael Savinaud
f649754018 [trunk] correct a small warning raised by continous 2012-10-24 14:52:15 +00:00
Mickael Savinaud
b1c5ce2517 [trunk] remove old structures from tcd.h 2012-10-24 14:38:07 +00:00
Mickael Savinaud
f2db5ec4fb [trunk] use the right v2 structure 2012-10-24 14:10:03 +00:00
Mickael Savinaud
db08494776 [trunk] rename flag_t to opj_flag_t 2012-10-24 14:06:10 +00:00
Mickael Savinaud
9166d595e6 [trunk] use new opj prefix and type with raw functions 2012-10-24 13:18:12 +00:00
Mickael Savinaud
f1061c8763 [trunk] remove a usefulness test before a free 2012-10-24 13:05:30 +00:00
Mickael Savinaud
fca9803bee [trunk] update jp2./.h to v2 style: use new OPJ type, manage case where bpcc box is available even if ihdr indicate that it is not needed; resolve a LH TODO 2012-10-24 12:49:28 +00:00
Mickael Savinaud
0d841b5e05 [trunk] add documentation to the message handler functions 2012-10-24 11:17:48 +00:00
Mickael Savinaud
216791c3fb [trunk] Finalize dwt.v/.h with the v2 style : remove last functions already optimized, add opj_ prefix, use new name of the functions 2012-10-24 09:29:34 +00:00
Mickael Savinaud
12c4e68058 [trunk] finalize bio.c/.h related to the v2 style 2012-10-24 09:09:37 +00:00
Mathieu Malaterre
b4b451863d [trunk] Remove SONAME from Java binding 2012-10-22 10:49:22 +00:00
Mathieu Malaterre
f2808de855 [trunk] Fix java binding installation 2012-10-22 10:41:44 +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
d6bcb8b7e0 [trunk] Fix JPIP compilation. Some prototypes were not respected. 2012-10-15 15:47:19 +00:00
Mickael Savinaud
a501237ae3 [trunk] propagate the renaming to openjpwl 2012-10-15 13:32:07 +00:00
Mickael Savinaud
f6622c2fbb [trunk] fix a compilation error with windows and new public function opj_j2k_start_compress 2012-10-15 13:00:31 +00:00
Mickael Savinaud
b08b90d71c [trunk]rename j2k_lib to opj_clock 2012-10-15 12:58:32 +00:00
Mickael Savinaud
b46ed8c7a3 [trunk] modify type of opj_clock function 2012-10-15 12:43:44 +00:00
Mathieu Malaterre
45869ce843 [trunk] Fix issue during renaming of man page 2012-10-15 11:57:47 +00:00
Mathieu Malaterre
dff377a741 [trunk] Fix compilation:
- using mingw32 compiler (missing exported symbols)
- using -fvisibility=hidden (gcc on UNIX)
2012-10-15 09:44:34 +00:00
Mathieu Malaterre
b24cf8d157 [trunk] Fix Java binding compilation. Need to link against openmj2 for now to resolve all symbols.
Add a local indec.c (pulled from opj 1.5 branch)
2012-10-15 09:43:28 +00:00
Mathieu Malaterre
2ad90b7c41 [trunk] Fix missing -lm to openjpwl 2012-10-15 08:38:48 +00:00
Mathieu Malaterre
a40fc41988 [trunk] Fix missing link to zlib 2012-10-15 08:13:27 +00:00
Mathieu Malaterre
3416c6d91b [trunk] Fix openmj2 compilation in static mode. 2012-10-15 08:09:31 +00:00
Mathieu Malaterre
54c2bcb60f [trunk] Fix compilation in static mode. Prevent duplicate symbols with convert.c implementation 2012-10-15 08:02:30 +00:00
Mathieu Malaterre
44a5108e1d [trunk] Add missing newline character 2012-10-15 07:57:19 +00:00
Mathieu Malaterre
d8715871fa [trunk] Fix issues in man pages. 2012-10-15 07:52:27 +00:00
Mathieu Malaterre
772fcc963c [trunk] Fix installaiton of header file 2012-10-15 07:52:07 +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
fe3c1f9061 [trunk] Fix warning for no previous prototype by using static function 2012-10-15 07:31:05 +00:00
Mathieu Malaterre
e30818ce39 [trunk] Fix advanced (and experimental) Java binding. As reported on the mailing list. 2012-10-10 13:26:29 +00:00
Mathieu Malaterre
2e30886a0d [trunk] Fix openmj2/mj2 compilation
As reported on the mailing list, it is better to have a working (compiling) mj2 codec rather than nothing. mj2 uses it own copy of openjpeg 1.5

Update issue 177
2012-10-09 09:45:43 +00:00
Mathieu Malaterre
b18ffbd08a [trunk] Use opj_malloc/opj_free in jpip bin
Update issue 177
2012-10-09 09:44:24 +00:00
Mathieu Malaterre
16d2dc662f [trunk] FolderReorgProposal task. Remove left over of JPIP
JPIP code was moved from JP2 to openjpip

Update issue 177
2012-10-09 09:11:24 +00:00
Mathieu Malaterre
9832c911b3 [trunk] Update JPIP (FolderReorgProposal task)
This commit does three things:
- Use opj_malloc/calloc/free instead of the default C ones.
- Update JPIP API to start using cio _v2 API
- Create a new opj_jpip_compress which is the replacement for image_to_j2k -jpip

Update issue 177
2012-10-08 15:59:17 +00:00
Mathieu Malaterre
23f5eeec20 [trunk] Make openjpip a first class shared lib, for future linking 2012-10-05 17:05:06 +00:00
Mathieu Malaterre
16106b2978 [trunk] First step in moving JPIP code out of openjp2 2012-10-05 16:57:30 +00:00
Mickael Savinaud
c66e6be4a4 [trunk] update t1_generate_luts.c with the right ouput to generate t1_luts 2012-10-05 12:34:46 +00:00
Mathieu Malaterre
eda4c26d24 [trunk] Fix spelling. writting -> writing 2012-10-05 09:20:05 +00:00
Mickael Savinaud
4b140e060b [trunk] rename int.h to opj_intmath.h and rename all its functions with opj_ prefix 2012-10-05 09:10:15 +00:00
Mickael Savinaud
1fefa03329 [trunk] move fix_mul inside int.h and remove fix.h from the project 2012-10-05 08:32:05 +00:00
Mickael Savinaud
37ff9b029c [trunk] remove warnings 2012-10-05 08:18:55 +00:00
Mickael Savinaud
e798fe37e1 [trunk]remove warnings in pi.c through the update of poc struct types with new opj_types. 2012-10-03 17:03:41 +00:00
Mickael Savinaud
f4a8f7165c [trunk] update global functions of tgt with opj_ prefix 2012-10-03 15:06:58 +00:00
Mickael Savinaud
2d52e409c2 [trunk] (style) move global pi functions to the right place and update indentation 2012-10-03 14:41:40 +00:00
Mickael Savinaud
1b5e677d0c [trunk] remove old v1 functions and rename pi_initialise_encode_v2 to opj_pi_initialise_encode; pi_create_encode_v2 to opj_pi_create_decode; pi_destroy_v2 to opj_pi_destroy; pi_create_decode_v2 to opj_pi_create_decode 2012-10-03 14:29:26 +00:00
Mickael Savinaud
c508923f04 [trunk] update pi_check_next_level with the opj_ prefix and change output type to be more convenient 2012-10-03 13:25:03 +00:00
Mickael Savinaud
6c4024796e [trunk]rename pi_update_encoding_parameters to opj_pi_update_encoding_parameters 2012-10-03 12:50:44 +00:00
Mickael Savinaud
bd2c6cfa55 [trunk] replace pi_next by opj_pi_next 2012-10-03 12:43:15 +00:00
Mickael Savinaud
bd74db932e [trunk] update local function of pi.c with the opj_ prefix and the new opj types 2012-10-03 12:39:17 +00:00
Mickael Savinaud
439337fb1b [trunk] update mqc global functions with opj_ prefix 2012-10-03 12:12:33 +00:00
Mickael Savinaud
5ffe6f5acf [trunk] add comments to check some parts of mqc.c and update types 2012-10-03 11:45:53 +00:00
Mickael Savinaud
f281f8cb75 upadate mqc with new opj_type and use opj_ prefix for local functions 2012-10-03 11:38:12 +00:00
Mickael Savinaud
3a46e2d86b [trunk] correct warnings linked to static dwt functions because declaration is not hide when we use SSE 2012-10-03 09:52:09 +00:00
Mickael Savinaud
6a84a1788b {trunk]update mct functions with opj_ prefix and new opj type
add some comments
2012-10-03 09:47:50 +00:00
Mickael Savinaud
df870e5241 [trunk] update global functions of bio.c with opj_prefix and new opj type 2012-10-03 09:04:44 +00:00
Mathieu Malaterre
82afd3a891 [trunk] Set of warnings fix for gcc -pedantic 2012-10-02 09:41:51 +00:00
Mathieu Malaterre
514fc72050 [trunk] Build small internal tools to generate t1_luts.h 2012-10-02 07:45:49 +00:00
Mathieu Malaterre
4dba9aed22 [trunk] Import opj_malloc.h from branch 1.5.x 2012-10-02 06:51:59 +00:00
Mathieu Malaterre
a46dbe6941 [trunk] V2 will be release with SOVERSION=6 2012-10-01 15:45:24 +00:00
Mathieu Malaterre
394db7b738 [trunk] Remove old function tgt_create
Fix some warnings about size_t
2012-10-01 15:29:36 +00:00
Mathieu Malaterre
3ad58ee1f5 [trunk] Update README to reflect FolderReorgProposal
Update issue 177
2012-10-01 15:16:33 +00:00
Mathieu Malaterre
00aa77f2d9 [trunk] FolderReorgProposal fix. 3rd party variables were not set
Update issue 177
2012-10-01 14:50:26 +00:00
Mathieu Malaterre
60fc79c717 [trunk] Requires CMake 2.8.2 at least 2012-10-01 14:18:20 +00:00
Mathieu Malaterre
f501186b18 [trunk] Fix minor cmake style 2012-10-01 12:29:09 +00:00
Mathieu Malaterre
fe6d9ed9ba [trunk] import unit testing from 1.5.x branch 2012-10-01 12:26:27 +00:00
Mathieu Malaterre
c450d418ef [trunk] remove warnings generated by all project in thirdparties 2012-10-01 11:14:20 +00:00
Mathieu Malaterre
c3b1af023b [trunk] Discard warnings from tiff package 2012-10-01 11:06: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
4466c31fc2 [trunk] Fix missing include directory 2012-10-01 10:20:31 +00:00
Mathieu Malaterre
b2bebcf5ce [trunk] fix compilation on windows where getopt is not available 2012-10-01 10:19:12 +00:00
Mathieu Malaterre
de33ba029b [trunk] Fix missing getopt symbols on windows 2012-10-01 10:11:46 +00:00
Mathieu Malaterre
465db44499 [trunk] FolderReorgProposal task: Fix openjp2 lib name 2012-10-01 10:08:01 +00:00
Mathieu Malaterre
abdb8ee3f7 [trunk] Fix a set of warnings about C90 issues 2012-10-01 10:01:09 +00:00
Mathieu Malaterre
aa6b4b4970 [trunk] FolderReorgProposal task. Do not rebuild doxygen always
Update issue 177
2012-10-01 09:37:19 +00:00
Mathieu Malaterre
25cbfcf34a [trunk] FolderReorgProposal task: cleanup doxygen
Update issue 177
2012-10-01 09:20:30 +00:00
Mathieu Malaterre
cffc33a51c [trunk] FolderReorgProposal task: fix jpip doxygen
Update issue 177
2012-10-01 08:43:02 +00:00
Mathieu Malaterre
5db7b01fa2 [trunk] FolderReorgProposal task: Fix doxygen
Update issue 177
2012-10-01 08:30:04 +00:00
Mathieu Malaterre
1ca5ca8392 [trunk] FolderReorgProposal task: update install instruction
Update issue 177
2012-10-01 07:59:48 +00:00
Mathieu Malaterre
93761d9ab5 [trunk] FolderReorgProposal task: move source code to source dir 2012-10-01 07:49:52 +00:00
Mathieu Malaterre
bb16d8816c [trunk] FolderReorgProposal task: only keep a single build system 2012-10-01 07:33:59 +00:00
Mickael Savinaud
e1cd500ac5 [trunk] update the name of the executable used for the tests 2012-09-30 16:28:32 +00:00
Mathieu Malaterre
2d09cbfd21 [trunk] FolderReorgProposal task: rename JP3D CLI tools
Update issue 177
2012-09-28 09:57:19 +00:00
Mathieu Malaterre
d84b16caf9 [trunk] FolderReorgProposal task: rename MJ2/JPIP CLI tools
Update issue 177
2012-09-28 09:52:57 +00:00
Mathieu Malaterre
95f06f0591 [trunk] FolderReorgProposal task: fix JPWL
Update issue 177
2012-09-28 09:26:51 +00:00
Mathieu Malaterre
3bf4d635f2 [trunk] FolderReorgProposal task: rename cli tools
Update issue 177
2012-09-28 09:12:22 +00:00
Mathieu Malaterre
a4fa18e92d [trunk] FolderReorgProposal task: Fix Viewer
Update issue 177
2012-09-28 08:59:10 +00:00
Mathieu Malaterre
f71af2a2ef [trunk] FolderReorgProposal task: refactor MJ2
Update issue 177
2012-09-28 08:51:14 +00:00
Mathieu Malaterre
3e62f8d9b7 [trunk] FolderReorgProposal task: add JP3D
Update issue 177
2012-09-28 08:32:34 +00:00
Mathieu Malaterre
028720c9ec [trunk] Continue FolderReorgProposal task. Missing java wrapping
Update issue 177
2012-09-28 08:17:02 +00:00
Mathieu Malaterre
d518970039 [trunk] Start FolderReorgProposal task
Update issue 177
2012-09-28 08:11:41 +00:00
Mickael Savinaud
8363a6ab1e update j2k_lib with new opj type 2012-09-27 14:50:06 +00:00
Mickael Savinaud
a540dcd2e2 correct a warning in image.c 2012-09-27 14:48:47 +00:00
Mickael Savinaud
58b2c6c4a5 clean function_list functions 2012-09-27 14:47:34 +00:00
Mickael Savinaud
34ffde6799 [trunk] Rename bio_create and bio_destroy with opj_ prefix 2012-09-27 14:42:08 +00:00
Mickael Savinaud
e7cd945000 [trunk] udpate local functions of bio.c with opj_prefix and new opj types
update opj_bio structure
2012-09-27 14:36:30 +00:00
Mickael Savinaud
ccf0f05e98 [trunk] update t1_luts.h with opj type 2012-09-27 14:28:32 +00:00
Mickael Savinaud
36672ad50e [trunk] update some local function of t1 with opj_prefix and new opj type 2012-09-27 14:16:05 +00:00
Mickael Savinaud
8bee3d89c5 rename opj_t1_enc_clnpass and opj_t1_enc_clnpass_step with opj_ prefix and update types used in theses functions 2012-09-27 14:09:41 +00:00
Mickael Savinaud
cf212e55ac [trunk]rename t1_enc_refpass_step and t1_enc_repass with opj_ prefix and update types used in theses functions 2012-09-27 13:56:48 +00:00
Mickael Savinaud
a00f61bd5d {trunk] remove old v1 style function t1_encode_cblk
rename t1_encode_cblk_v2 to opj_t1_encode_cblk
2012-09-27 13:51:01 +00:00
Mickael Savinaud
dca76de872 [trunk] remove old v1 function t1_encode_blocks 2012-09-27 13:43:27 +00:00
Mickael Savinaud
70540f9563 [trunk] remove old v1 style t1_decode_cblk function and rename t1_decode_cblk_v2 to opj_t1_decode_cblk
rename t1_dec_sigpass t1_dec_sigpass_step, t1_updateflags, t1_dec_refpass, t1_dec_refpass_step with opj_prefix and v2 type
delete unused functions in new V2 t1 framework: t1_dec_refpass_raw, t1_dec_refpass_mqc, t1_dec_refpass_mqc_vsc, t1_dec_refpass_step_raw, t1_dec_refpass_step_mqc, t1_dec_refpass_step_mqc_vsc, t1_dec_sigpass_raw, t1_dec_sigpass_mqc, t1_dec_sigpass_mqc_vsc, t1_dec_sigpass_step_raw, t1_dec_sigpass_step_mqc, t1_dec_sigpass_step_mqc_vsc
2012-09-27 13:28:44 +00:00
Mickael Savinaud
a545cb7cff [trunk]remove t2_init_seg
rename t2_init_seg_v2 to opj_t2_init_seg
rename t2_encode_packet_v2 to opj_t2_encode_packet
2012-09-27 13:22:32 +00:00
Mickael Savinaud
9a86a3bd23 [trunk] remove t2_destroy, t2_decode_packets and t2_decode_packet
rename from t2_destroy_v2 to opj_t2_destroy
rename from t2_decode_packets_v2 to opj_t2_decode_packets
rename from t2_decode_packet_v2 to opj_t2_decode_packet
2012-09-27 13:14:15 +00:00
Mickael Savinaud
69673635ef [trunk] remove old v1 style function t2_create
rename t2_create_v2 to opj_t2_create
2012-09-27 13:03:35 +00:00
Mickael Savinaud
77e6971bbb [trunk] remove t2_encode_packet and t2_encode_packets
rename from t2_encode_packets_v2 to opj_t2_encode_packets
2012-09-27 12:53:36 +00:00
Mickael Savinaud
a9a1336502 [trunk] update t2_getnumpasses from V2 branch and put opj_ prefix 2012-09-27 09:54:35 +00:00
Mickael Savinaud
9103674950 [trunk] update t2_putnumpasses with V2 style 2012-09-27 09:48:18 +00:00
Mickael Savinaud
2af39ac017 [trunk] rename t2_getcommacode to opj_t2_getcommacode 2012-09-27 09:40:45 +00:00
Mickael Savinaud
d47b8fef18 [trunk] modify output type of t2_getcommacode 2012-09-27 09:29:47 +00:00
Mickael Savinaud
f8fc214b11 [trunk] rename local functions in t2 with opj_ prefix 2012-09-27 09:14:58 +00:00
Mickael Savinaud
7861bfa45e rename from t2_skip_packet to opj_t2_skip_packet;
rename from t2_skip_packet_data to opj_t2_skip_packet_data;
2012-09-27 08:56:00 +00:00
Mathieu Malaterre
02734264a1 [trunk] Fix possible code execution vuln
Thanks to Huzaifa Sidhpurwala of Red Hat Security Response Team for patch + dataset to reproduce issue.
Technically kdu_expand works fine on the image...

Fixes issue 175
2012-09-12 17:11:17 +00:00
Mathieu Malaterre
4a845f3d04 [trunk] Fix one remaining issue with C90 compat 2012-09-10 12:46:42 +00:00
Mathieu Malaterre
0452ebdfcd [trunk] Use new gcc feature to actually hide exported symbols
Right now we are only using the Windows/POSIX compatibility layer. This means that we have only been marking explicitely which symbols to export.
What this also means is that for one to explicitely remove non-explicitely marked symbols, one has to set -fvisibility=hidden as CFLAGS
2012-09-10 12:38:22 +00:00
Mathieu Malaterre
c8b8c4cf30 [trunk] no need to export MCT_ELEMENT_SIZE symbol 2012-09-10 12:34:46 +00:00
Mathieu Malaterre
1ff1401ff1 [trunk] Fix Heap-based buffer-overflow when decoding openjpeg image
Thanks to Huzaifa Sidhpurwala of Red Hat Security Response Team for report
This does not affect release 1.5.0 and/or 1.5 release branch.

Fixes issue 170
2012-09-10 11:05:15 +00:00
Mathieu Malaterre
3991bbe595 [trunk] Fix some C90 issues. 2012-09-10 09:42:29 +00:00
Mathieu Malaterre
20beb093a1 [trunk] Fix all C90 issues using gcc -pedantic -Wno-long-long to track them
As a side effect, fix all comment style to remove extra gcc output

Fixes issue 173
2012-09-10 09:04:47 +00:00
Mickael Savinaud
3135642ff5 [trunk] Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block.  This is no longer the preferred style.
Thanks to Hans Johnson
2012-08-30 17:20:03 +00:00
Mickael Savinaud
d5bb3b0039 [trunk] Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command names became case-insensitive.  Now the preferred style is lower-case.
This also changes all the key words to lower case. The primary reason for changing key words is that all documentation for CMakeLists.txt now shows the key words as lower case. Even the printed “Mastering CMake v5” uses lower case.
Thanks to Hans Johnson
2012-08-30 17:14:39 +00:00
Mickael Savinaud
f16216e270 [trunk] STYLE: Clean up documentation errors
Functions should only have formal documentation in one place, and preferably in the declaration (i.e. repeated documentaiton should not be at both the declaration and the definition, because it causes too much maintenance to keep them syncronized).  In cases where the definition is also the declaration (as is often the case for static functions in the .c files) the documentation was preserved at the first use of the function signature.
Functions that are formally documented should contain documentation for each function argument. 
The clang 3.1 compiler issues documentation warnings when the documentation block with @params preceeding a declaration does not match the argument list.  This patch set follows a convention used elsewere in openjpeg to add a placeholder FIXME DOC description where one was previously missing.
Thanks to Hans Johnson.
2012-08-30 16:56:31 +00:00
Mickael Savinaud
de9e1a0693 [trunk] Remove all non-ascii characters (Several compilers and development tools are confused by non-ascii characters in source code. These have been removed) thanks to Hans Johnson 2012-08-30 16:51:30 +00:00
Mickael Savinaud
47b18d89f6 [trunk] COMP: Fix one warning identified by clang31 :
openjpeg/applications/codec/j2k_dump.c:362 col 29: warning: equality comparison
with extraneous parentheses
(thanks to Hans Johnson)
2012-08-30 16:34:17 +00:00
Mickael Savinaud
3f5b474b16 [trunk] COMP: Remove compiler warning (warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]) thnaks to Hans Johnson 2012-08-30 16:22:40 +00:00
Mickael Savinaud
b103fec939 [trunk] COMP: _v2 code remove (thanks to Hans Johnson and Winfried) 2012-08-30 15:43:09 +00:00
Luc Hermitte
728be68bfe [trunk] memory leaks on ppm_data, found in tests NR-p1_05.j2k-dump, NR-p1_03.j2k-dump, ETS-C1P1-p1_03.j2k-decode, ETS-C0P1-p1_03.j2k-decode, ETS-C0P1-p1_05.j2k-decode 2012-08-23 19:37:31 +00:00
Luc Hermitte
5820e97abe [trunk] realloc is misused and may leak memory (Issue#168) (complements: compilation errors) 2012-08-23 19:34:41 +00:00
Luc Hermitte
4e81ea2a8a [trunk] realloc is misused and may leak memory (Issue#168) 2012-08-22 18:45:31 +00:00
Luc Hermitte
7bfdb31c77 [trunk] j2k_to_image gives fff-topic error message for non-openable files (Issue#167) 2012-08-22 18:22:20 +00:00
Mickael Savinaud
44cec04294 fix a compilation error 2012-08-17 15:02:18 +00:00
Mickael Savinaud
c60a84b6f5 rename t1_enc_sigpass_step and t1_enc_sigpass with opj_ prefix and update type 2012-08-17 14:56:42 +00:00
Mickael Savinaud
3b953cc763 remove deprecated v1 style function t1_destroy; rename t1_destroy_v2 to opj_t1_destroy
remove deprecated v1 style function t1_decode_cblks; rename t1_decode_cblks_v2 to opj_t1_decode_cblks
remove deprecated v1 style function t1_encode_cblks; rename t1_encode_cblks_v2 to opj_t1_encode_cblks
remove deprecated v1 style function t1_create; rename t1_create_v2 to opj_t1_create
2012-08-17 14:28:50 +00:00
Mickael Savinaud
859ce39666 rename local functions and struct with opj_ prefix 2012-08-17 13:47:45 +00:00
Mickael Savinaud
7c6ea4ed00 rename local dwt functions
remove deprecated v1 style function dwt_decode_tile; rename dwt_decode_tile_v2 to opj_dwt_decode_tile
2012-08-17 09:12:07 +00:00
Mickael Savinaud
3dab3be859 remove deprecated v1 style function dwt_encode; rename dwt_encode_v2 to opj_dwt_encode
remove deprecated v1 style function dwt_decode; rename dwt_decode_v2 to opj_dwt_decode
remove deprecated v1 style function dwt_getgain; rename dwt_getgain_v2 to opj_dwt_getgain
add opj_dwt_getnorm, opj_dwt_getnorm_real functions 
remove deprecated v1 style function dwt_encode_real; rename dwt_encode_real_v2 to opj_dwt_encode_real
remove deprecated v1 style function dwt_getgain_real; rename dwt_getgain_real_v2 to opj_dwt_getgain_real
rename dwt_calc_explicit_stepsizes to opj_dwt_calc_explicit_stepsizes
2012-08-17 08:27:57 +00:00
Mickael Savinaud
062ed99894 rename local tcd functions with opj_ prefix 2012-08-16 16:44:09 +00:00
Mickael Savinaud
d275fc90cf remove deprecated v1 style function tcd_decode_tile; rename tcd_decode_tile_v2 to opj_tcd_decode_tile
remove deprecated v1 style function tcd_free_decode
remove deprecated v1 style function tcd_free_decode_tile
2012-08-16 16:27:59 +00:00
Mickael Savinaud
dbc4c47b15 remove deprecated v1 style function tcd_destroy; rename tcd_destroy_v2 to opj_tcd_destroy
rename tcd_init_v2 to opj_tcd_init 
remove deprecated v1 style function tcd_malloc_encode
remove deprecated v1 style function tcd_free_encode
remove deprecated v1 style function tcd_init_encode
remove deprecated v1 style function tcd_malloc_decode
remove deprecated v1 style function tcd_malloc_decode_tile
remove deprecated v1 style function tcd_makelayer_fixed; rename tcd_makelayer_fixed_v2 to opj_tcd_makelayer_fixed
remove deprecated v1 style function tcd_rateallocate_fixed; rename tcd_rateallocate_fixed_v2 to opj_tcd_rateallocate_fixed
remove deprecated v1 style function tcd_makelayer; rename tcd_makelayer_v2 to opj_tcd_makelayer
remove deprecated v1 style function tcd_rateallocate; rename tcd_rateallocate_v2 to opj_tcd_rateallocate
remove deprecated v1 style function tcd_encode_tile; rename tcd_encode_tile_v2 to opj_tcd_encode_tile
2012-08-16 16:23:07 +00:00
Mickael Savinaud
e6d97ce928 remove deprecated v1 style function tcd_create; rename tcd_create_v2 to opj_tcd_create 2012-08-16 15:51:55 +00:00
Mickael Savinaud
b7473285ec rename tcd functions with opj_ prefix 2012-08-16 15:48:20 +00:00
Mickael Savinaud
8b7107b81f optimization of dwt_deinterleave_h, dwt_deinterleave_v from v2 branch; update type with OPJ_type 2012-08-16 15:33:33 +00:00
Mickael Savinaud
d1251b2850 correct warnings in j2k.c 2012-08-16 14:29:02 +00:00
Mickael Savinaud
e972589554 remove deprecated v1 style function j2k_write_eoc; rename j2k_write_eoc_v2 to opj_j2k_write_eoc 2012-08-16 14:19:00 +00:00
Mickael Savinaud
0f19c958da remove deprecated v1 style function j2k_read_eoc; rename j2k_read_eoc_v2 to opj_j2k_read_eoc 2012-08-16 14:16:28 +00:00
Mickael Savinaud
2935fbc089 clean style and remove old v1 style structure in j2k.c 2012-08-16 14:08:58 +00:00
Mickael Savinaud
f47fc4f111 remove deprecated v1 style function j2k_add_mhmarker; rename j2k_add_mhmarker_v2 to opj_j2k_add_mhmarker
remove deprecated v1 style function j2k_add_tlmarker; rename j2k_add_tlmarker_v2 to opj_j2k_add_tlmarker
2012-08-16 13:53:23 +00:00
Mickael Savinaud
01c95cb07e remove deprecated v1 style function j2k_create_compress; rename opj_j2k_create_compress_v2 to opj_j2k_create_compress 2012-08-16 13:46:43 +00:00
Mickael Savinaud
1f94541732 rename j2k functions with opj_ prefix 2012-08-16 13:44:02 +00:00
Mickael Savinaud
ff43b4dca0 remove deprecated v1 style function j2k_setup_encoder; rename opj_j2k_setup_encoder_v2 to opj_j2k_setup_encoder 2012-08-16 13:37:34 +00:00
Mickael Savinaud
5d494e940f remove deprecated v1 style function j2k_get_num_tp; rename j2k_get_num_tp_v2 to opj_j2k_get_num_tp 2012-08-16 13:34:26 +00:00
Mickael Savinaud
30de580afe remove deprecated v1 style function j2k_calculate_tp; rename j2k_calculate_tp_v2 to opj_j2k_calculate_tp 2012-08-16 13:31:22 +00:00
Mickael Savinaud
0c13350ea4 rename local j2k function with opj_ prefix 2012-08-16 13:28:52 +00:00
Mickael Savinaud
83a661c360 remove deprecated v1 style function j2k_write_rgn; rename j2k_write_rgn_v2 to opj_j2k_write_rgn 2012-08-16 13:20:16 +00:00
Mickael Savinaud
38ec1325c4 remove deprecated v1 style function j2k_write_sod; rename j2k_write_sod_v2 to opj_j2k_write_sod 2012-08-16 13:16:38 +00:00
Mickael Savinaud
2ca2e83ce5 remove deprecated v1 style function j2k_write_sot; rename j2k_write_sot_v2 to opj_j2k_write_sot 2012-08-16 13:14:00 +00:00
Mickael Savinaud
a9908ba7bd remove deprecated v1 style function j2k_write_tlm; rename j2k_write_tlm_v2 to opj_j2k_write_tlm 2012-08-16 13:11:26 +00:00
Mickael Savinaud
9f874c00aa rename local j2k function with opj_ prefix 2012-08-16 13:09:36 +00:00
Mickael Savinaud
b52cdf6a95 rename local j2k function with opj_ prefix 2012-08-16 13:07:36 +00:00
Mickael Savinaud
40e637d9e1 remove deprecated v1 style function j2k_write_poc; rename j2k_write_poc_v2 to opj_j2k_write_poc
rename j2k_write_poc_in_memory to opj_j2k_write_poc_in_memory
rename j2k_get_max_poc_size to opj_j2k_get_max_poc_size
2012-08-16 13:03:20 +00:00
Mickael Savinaud
21c76d97bb remove deprecated v1 style function j2k_write_qcd; rename j2k_write_qcd_v2 to opj_j2k_write_qcd
remove deprecated v1 style function j2k_write_qcc; rename j2k_write_qcc_v2 to opj_j2k_write_qcc
remove deprecated v1 style function j2k_write_qcx; rename j2k_write_qcc_in_memory to 
rename j2k_get_max_qcc_size to opj_j2k_get_max_qcc_size
2012-08-16 12:58:30 +00:00
Mickael Savinaud
4b3147ede7 rename j2k_get_max_coc_size to opj_j2k_get_max_coc_size 2012-08-16 12:51:46 +00:00
Mickael Savinaud
a037a66ea4 remove deprecated v1 style function j2k_write_cod; rename j2k_write_cod_v2 to opj_j2k_write_cod
remove deprecated v1 style function j2k_write_coc; rename j2k_write_coc_v2 to opj_j2k_write_coc
remove deprecated v1 style function j2k_write_cox; rename j2k_write_coc_in_memory to opj_j2k_write_coc_in_memory
2012-08-16 12:47:45 +00:00
Mickael Savinaud
c071819c26 remove deprecated v1 style function j2k_write_com; rename j2k_write_com_v2 to opj_j2k_write_com 2012-08-16 12:38:23 +00:00
Mickael Savinaud
28e018de8a remove deprecated v1 style function j2k_write_siz; rename j2k_write_siz_v2 to opj_j2k_write_siz 2012-08-16 12:36:05 +00:00
Mickael Savinaud
65102c0ba5 rename j2k_write_soc_v2 to opj_j2k_write_soc 2012-08-16 12:33:43 +00:00
Mickael Savinaud
ff8e97310d remove deprecated v1 style function j2k_write_soc 2012-08-16 12:32:34 +00:00
Mickael Savinaud
2546661aeb remove deprecated v1 style functions j2k_destroy_decompress, j2k_decode_jpt_stream, j2k_destroy_compress and j2k_encode 2012-08-16 12:29:59 +00:00
Mickael Savinaud
fdeed49637 rename local j2k function with opj_ prefix 2012-08-16 12:20:46 +00:00
Mickael Savinaud
fab7693da5 free local memory in image_to_j2k application 2012-08-16 12:03:20 +00:00
Mickael Savinaud
582323d63c rename j2k functions with opj_ prefix 2012-08-16 11:51:34 +00:00
Mickael Savinaud
a6522d3706 remove warnings from dwt.c 2012-08-16 10:46:57 +00:00
Mickael Savinaud
28a0028762 Correct the wrong output management of opj_stream_read_seek function (thanks to EvenR) 2012-08-16 09:13:58 +00:00
Mickael Savinaud
ec19c32b63 remove old v1 style functions from jp2.c 2012-08-13 11:43:02 +00:00
Mickael Savinaud
ec9aceb96f rename local jp2 functions with opj_ prefix 2012-08-13 10:10:25 +00:00
Mickael Savinaud
0e1c2e3378 rename jp2_write_jp_v2 to opj_jp2_write_jp 2012-08-13 10:03:57 +00:00
Mickael Savinaud
094b952d70 remove deprecated v1 style function jp2_write_jp 2012-08-13 09:58:43 +00:00
Mickael Savinaud
3821a4e054 rename jp2_write_jp2c_v2 to opj_jp2_write_jp2c 2012-08-13 09:57:09 +00:00
Mickael Savinaud
d24404ca9a remove deprecated v1 style function jp2_write_jp2c 2012-08-13 09:55:57 +00:00
Mickael Savinaud
fb2d6e8870 rename local function in jp2.c with the opj_ prefix 2012-08-13 09:44:40 +00:00
Mickael Savinaud
e421cbac2a rename jp2_write_ftyp_v2 to opj_jp2_write_ftyp 2012-08-13 09:39:51 +00:00
Mickael Savinaud
a71310f58b remove deprecated v1 style function jp2_write_ftyp 2012-08-13 09:36:53 +00:00
Mickael Savinaud
43c392626b rename jp2_write_colr_v2 to opj_jp2_write_colr 2012-08-13 09:35:16 +00:00
Mickael Savinaud
d286573958 remove deprecated v1 style function jp2_write_colr 2012-08-13 09:33:00 +00:00
Mickael Savinaud
ff889c40da rename jp2_write_bpcc_v2 to opj_jp2_write_bpcc 2012-08-13 09:31:24 +00:00
Mickael Savinaud
0ecdbe8614 remove deprecated v1 style function jp2_write_bpcc 2012-08-13 09:29:37 +00:00
Mickael Savinaud
8b3500a2a9 rename jp2_write_ihdr_v2 to opj_jp2_write_ihdr 2012-08-13 09:27:58 +00:00
Mickael Savinaud
c5fd56606d remove deprecated v1 style function jp2_write_ihdr 2012-08-13 09:25:41 +00:00
Mickael Savinaud
dd86b85664 rename jp2 functions with V2 style and opj_ prefix 2012-08-13 09:24:15 +00:00
Mickael Savinaud
3ec9f5fa0b remove deprecated v1 style functions jp2_write_jp2h 2012-08-13 08:54:42 +00:00
Mickael Savinaud
3bf3ce06f7 remove deprecated v1 style functions : jp2_create_compress, jp2_destroy_compress, opj_jp2_encode 2012-08-13 08:53:17 +00:00
Mickael Savinaud
cc1d601722 fix some warnings in jp2.c 2012-08-13 08:30:00 +00:00
Mickael Savinaud
e8c1b849b7 fix compilation error with win platform 2012-08-13 07:49:49 +00:00
Luc Hermitte
de44b71b12 [trunk] fix possible memory leak on realloc failure 2012-08-10 17:15:57 +00:00
Mickael Savinaud
df70c7136d use internal type to reduce warnings in jp2.c 2012-08-10 11:21:48 +00:00
Mickael Savinaud
bf2b9ea539 rename jp2_read_boxhdr_v2 to opj_jp2_read_boxhdr 2012-08-10 11:00:40 +00:00
Mickael Savinaud
b0b46c331e remove deprecated v1 style function jp2_read_boxhdr 2012-08-10 10:57:51 +00:00
Mickael Savinaud
b3269581ea rename local function in jp2.c with the opj_ prefix 2012-08-10 10:55:10 +00:00
Mickael Savinaud
699edd4393 rename jp2_read_jp_v2 to opj_jp2_read_jp 2012-08-10 10:34:40 +00:00
Mickael Savinaud
9128c6c17b remove deprecated v1 style function jp2_read_jp2c, jp2_read_struct 2012-08-10 10:27:17 +00:00
Mickael Savinaud
f121223ed8 rename jp2_read_ftyp_v2 to opj_jp2_read_ftyp 2012-08-10 10:24:09 +00:00
Mickael Savinaud
3c0e360df1 remove deprecated v1 style function jp2_read_ftyp 2012-08-10 10:22:51 +00:00
Mickael Savinaud
1de6f5fcf6 rename jp2_read_colr_v2 to opj_jp2_read_colr, jp2_read_pclr_v2 to opj_jp2_read_pclr, jp2_read_cmap_v2 to opj_jp2_read_cmap, jp2_read_cdef_v2 to opj_jp2_read_cdef 2012-08-10 10:19:11 +00:00
Mickael Savinaud
5bf4b718d4 remove deprecated v1 style function jp2_read_colr, jp2_read_pclr, jp2_read_cmap, jp2_read_cdef 2012-08-10 10:01:47 +00:00
Mickael Savinaud
f912007fe8 rename jp2_read_bpcc_v2 to opj_jp2_read_bpcc 2012-08-10 09:53:28 +00:00
Mickael Savinaud
377809a35b remove deprecated v1 style function jp2_read_bpcc 2012-08-10 09:50:23 +00:00
Mickael Savinaud
f0f981b80d rename jp2_read_ihdr_v2 to opj_jp2_read_ihdr 2012-08-10 09:47:56 +00:00
Mickael Savinaud
2b9302632c remove deprecated v1 style function jp2_read_ihdr 2012-08-10 09:46:31 +00:00
Mickael Savinaud
a59a1552ad rename jp2_read_jp2h_v2 to opj_jp2_read_jp2h 2012-08-10 09:43:28 +00:00
Mickael Savinaud
4a80e821df remove deprecated v1 style function jp2_read_jp2h 2012-08-10 09:39:40 +00:00
Mickael Savinaud
6822291f91 remove deprecated v1 style function jp2_destroy_decompress 2012-08-10 09:33:54 +00:00
Mickael Savinaud
863aacaee3 rename local functions with opj_ prefix in j2k.c (part 2) 2012-08-10 09:27:45 +00:00
Mickael Savinaud
00a2bf7120 rename local functions with opj_ prefix in j2k.c 2012-08-10 09:14:49 +00:00
Mickael Savinaud
6ac5acf765 rename some j2k decoding functions with new prefix opj_ 2012-08-10 08:21:31 +00:00
Mickael Savinaud
ce7583f173 rename mct function read/write function with opj_ prefix 2012-08-10 08:07:30 +00:00
Mickael Savinaud
24b10ac585 rename j2k_read_mct to opj_j2k_read_mct, j2k_read_mco to opj_j2k_read_mco, j2k_read_mcc to opj_j2k_read_mcc 2012-08-10 07:58:23 +00:00
Mickael Savinaud
706371e24f rename j2k_read_cbd to opj_j2k_read_cbd 2012-08-10 07:54:33 +00:00
Mickael Savinaud
5de8639685 rename j2k_read_com_v2 to opj_j2k_read_unk 2012-08-10 07:51:29 +00:00
Mickael Savinaud
d42e26d59c remove deprecated v1 style function j2k_read_unk 2012-08-10 07:49:52 +00:00
Mickael Savinaud
6ea06e87bb rename j2k_read_com_v2 to opj_j2k_read_com 2012-08-10 07:44:47 +00:00
Mickael Savinaud
5eb8a44317 remove deprecated v1 style function j2k_read_com 2012-08-10 07:42:41 +00:00
Mickael Savinaud
c89fb0b828 rename j2k_read_crg_v2 to opj_j2k_read_crg 2012-08-10 07:37:58 +00:00
Mickael Savinaud
52e111dbb7 remove deprecated v1 style function j2k_read_crg 2012-08-10 07:36:16 +00:00
Mickael Savinaud
36b5109387 rename j2k_read_ppt_v2 to opj_j2k_read_ppt 2012-08-10 07:32:57 +00:00
Mickael Savinaud
c07b085c81 remove deprecated v1 style function j2k_read_ppt 2012-08-10 07:29:57 +00:00
Mickael Savinaud
065c442141 remove deprecated v1 style function j2k_read_cox 2012-08-10 07:27:04 +00:00
Mickael Savinaud
83b570d981 correct a compilation error about misplaced declaration 2012-08-10 07:13:30 +00:00
Mickael Savinaud
2afdee9c7d remove deprecated v1 style function j2k_read_ppm 2012-08-09 17:10:56 +00:00
Mickael Savinaud
a7e809e1f7 rename j2k_read_plt_v2 to opj_j2k_read_plt 2012-08-09 17:09:26 +00:00
Mickael Savinaud
deb7cb708f remove deprecated v1 style function j2k_read_plt 2012-08-09 17:07:26 +00:00
Mickael Savinaud
fcd7db6cd1 rename j2k_read_plm_v2 to opj_j2k_read_plm 2012-08-09 17:06:13 +00:00
Mickael Savinaud
68adbd2e05 rename j2k_read_tlm_v2 to opj_j2k_read_tlm 2012-08-09 17:03:11 +00:00
Mickael Savinaud
b6258d612b remove deprecated v1 style function j2k_read_tlm 2012-08-09 17:01:20 +00:00
Mickael Savinaud
93cb76a292 rename j2k_read_poc_v2 to opj_j2k_read_poc 2012-08-09 16:57:45 +00:00
Mickael Savinaud
6191f69f0c remove deprecated v1 style function j2k_read_poc 2012-08-09 16:56:00 +00:00
Mickael Savinaud
d416e6c854 remove deprecated v1 style function j2k_read_qcx 2012-08-09 16:54:01 +00:00
Mickael Savinaud
3a63d978dd rename j2k_read_qcc_v2 to opj_j2k_read_qcc 2012-08-09 16:52:05 +00:00
Mickael Savinaud
d2a78c33df remove deprecated v1 style function j2k_read_qcc 2012-08-09 16:50:21 +00:00
Mickael Savinaud
679f91482e rename j2k_read_qcd_v2 to opj_j2k_read_qcd 2012-08-09 16:48:48 +00:00
Mickael Savinaud
d380a8554d remove deprecated v1 style function j2k_read_qcd 2012-08-09 16:47:08 +00:00
Mickael Savinaud
4f36ad0cc1 rename j2k_read_rgn_v2 to opj_j2k_read_rgn 2012-08-09 16:45:18 +00:00
Mickael Savinaud
90ba7fbf1f remove deprecated v1 style function j2k_read_rgn 2012-08-09 16:43:00 +00:00
Mickael Savinaud
76658477af rename j2k_read_coc_v2 to opj_j2k_read_coc 2012-08-09 16:40:22 +00:00
Mickael Savinaud
ffb6a9c74b remove deprecated v1 style function j2k_read_coc 2012-08-09 16:38:11 +00:00
Mickael Savinaud
21d334389f rename j2k_read_cod_v2 to opj_j2k_read_cod 2012-08-09 16:36:06 +00:00
Mickael Savinaud
94a5e081e5 remove deprecated v1 style function j2k_read_cod 2012-08-09 16:34:28 +00:00
Mickael Savinaud
5e78d72ef2 rename j2k_read_siz_v2 to opj_j2k_read_siz 2012-08-09 15:59:14 +00:00
Mickael Savinaud
5c303e2bb5 remove deprecated v1 style function j2k_read_siz 2012-08-09 15:56:27 +00:00
Mickael Savinaud
4c1cb388af rename j2k_read_sod_v2 to opj_j2k_read_sod 2012-08-09 15:44:55 +00:00
Mickael Savinaud
144bd4a878 remove deprecated v1 style function j2k_read_sod 2012-08-09 15:42:35 +00:00
Mickael Savinaud
91737aff68 rename j2k_read_sot_v2 to opj_j2k_read_sot 2012-08-09 15:39:41 +00:00
Mickael Savinaud
2391b40f47 remove deprecated v1 style function j2k_read_sot 2012-08-09 15:36:16 +00:00
Mickael Savinaud
6a8aff5a74 rename j2k_read_soc_v2 to opj_j2k_read_soc 2012-08-09 15:32:18 +00:00
Mickael Savinaud
c0ec5d404b remove deprecated v1 style function j2k_read_soc 2012-08-09 15:28:38 +00:00
Mickael Savinaud
10e9a6b6cd rename j2k_decode_v2 to opj_j2k_decode 2012-08-09 15:16:33 +00:00
Mickael Savinaud
a51aed7ce2 remove deprecated v1 style function j2k_decode 2012-08-09 15:13:33 +00:00
Mickael Savinaud
71e0106846 rename j2k_setup_decoder_v2 to opj_j2k_setup_decoder 2012-08-09 15:08:33 +00:00
Mickael Savinaud
3ce9af7fce remove deprecated v1 style function j2k_setup_decoder 2012-08-09 15:04:09 +00:00
Mickael Savinaud
05e8aae95e rename j2k_create_decompress_v2 to opj_j2k_create_decompress 2012-08-09 15:00:50 +00:00
Mickael Savinaud
381de6b7cb remove deprecated v1 style function j2k_create_decompress and jp2_create_decompress 2012-08-09 14:57:03 +00:00
Mickael Savinaud
c077645f77 rename jp2_decode_v2 to opj_jp2_decode 2012-08-09 14:46:11 +00:00
Mickael Savinaud
ebc3263987 remove deprecated v1 style function opj_jp2_decode 2012-08-09 14:42:37 +00:00
Mickael Savinaud
cf6e5bf01f rename jp2_setup_decoder_v2 to opj_jp2_setup_decoder 2012-08-09 14:38:55 +00:00
Mickael Savinaud
958c615a83 remove deprecated v1 style function jp2_setup_decoder 2012-08-09 14:31:02 +00:00
Mickael Savinaud
8e5070f469 [trunk] add the support of the flag ignore_pclr_cmap_cdef into the V2 jp2 functions (but not for box reading); no tests modified 2012-08-09 14:28:35 +00:00
Mickael Savinaud
4397b675cb [trunk] begin to clean the old V1 style message event management 2012-08-09 14:00:31 +00:00
Mickael Savinaud
9ed88f6a8d [trunk] clean jp2_read_ihdr_v2 interface 2012-08-09 13:22:25 +00:00
Mickael Savinaud
f12fde9132 [trunk] rename opj_destroy_cstr_info_v2 to opj_destroy_cstr_info 2012-08-09 12:56:43 +00:00
Mickael Savinaud
1c4ea6d246 remove deprecated v1 style function opj_destroy_cstr_info 2012-08-09 12:52:28 +00:00
Mickael Savinaud
a6d76b3c48 [trunk] move functions in openjpeg.c in two parts compression vs decompression 2012-08-09 12:51:16 +00:00
Mickael Savinaud
5d0ace0577 [trunk] rename opj_encode_v2 to opj_encode 2012-08-09 12:42:46 +00:00
Mickael Savinaud
7b88544d46 [trunk] remove deprecated v1 style function opj_encode and opj_encode_with_info 2012-08-09 12:40:22 +00:00
Mickael Savinaud
6767ea2456 [trunk] rename opj_setup_encoder_v2 to opj_setup_encoder 2012-08-09 12:35:13 +00:00
Mickael Savinaud
459db3d64b remove deprecated v1 style function opj_setup_encoder 2012-08-09 12:31:46 +00:00
Mickael Savinaud
d009cf618a rename opj_create_compress_v2 to opj_create_compress 2012-08-09 12:28:51 +00:00
Mickael Savinaud
9a9897a9de [trunk] remove deprecated v1 style function opj_create_compress 2012-08-09 12:26:04 +00:00
Mickael Savinaud
3f9fb13df6 remove deprecated v1 style function opj_decode and opj_decode_with_info 2012-08-09 12:16:59 +00:00
Mickael Savinaud
52f414669a [trunk] rename opj_setup_decoder_v2 to opj_setup_decoder 2012-08-09 12:11:24 +00:00
Mickael Savinaud
b34215906c [trunk] remove deprecated v1 style function opj_setup_decoder 2012-08-09 11:56:14 +00:00
Mickael Savinaud
fb768ac792 [trunk] remove deprecated v1 style function opj_destroy_decompress 2012-08-09 11:53:33 +00:00
Mickael Savinaud
35289bffe2 [trunk] rename opj_create_decompress_v2 to opj_create_decompress 2012-08-09 11:51:07 +00:00
Mickael Savinaud
ef00fdf472 [trunk] remove V1 style function opj_create_decompress 2012-08-09 11:46:19 +00:00
Mickael Savinaud
3de7e8358f [trunk] define local functions of j2k.c as static and clean style 2012-08-09 11:35:06 +00:00
Mickael Savinaud
28ac2f49dc [trunk] move allocation of cstr_index->tile_index to the end of the header reading 2012-08-09 11:12:28 +00:00
Mickael Savinaud
c38b5d5eb9 Add file type detection in test_tile_decoder to support JP2 file as input 2012-08-09 11:05:58 +00:00
Mickael Savinaud
180d06613a Use the right file as input for the test ttd2 2012-08-09 09:29:42 +00:00
Mickael Savinaud
c3ee4212f0 Reorganize and clean style of test_tile_decoder.c 2012-08-09 08:07:57 +00:00
Mathieu Malaterre
efafbe9a5c [trunk] Use const keyword when appropriate 2012-07-25 13:10:43 +00:00
Mathieu Malaterre
e38680a4df [trunk] Import changes from 1.5 branch 2012-07-25 13:10:21 +00:00
Mathieu Malaterre
f28fc6f2e1 [trunk] Fix r156 to compile on compilers where false is not defined. 2012-07-11 14:59:41 +00:00
Mathieu Malaterre
5ba8d36687 [trunk] This fixes issues seen on PDF files
Fixes issue 156
2012-07-11 14:55:39 +00:00
Mathieu Malaterre
178236cc5f [trunk] Fix heap buffer overflow
Enforce sanity checks on tile number and tile length, even when the (rather
broken) USE_JPWL code isn't enabled.
Import r1727 from branch 1.5
2012-07-10 13:09:45 +00:00
Mickael Savinaud
79a0533c69 [trunk] use new names for baseline 2012-06-01 07:53:44 +00:00
Mathieu Malaterre
64363995be [trunk] Fix a simple leak in test_tile_encoder 2012-05-29 14:27:42 +00:00
Mathieu Malaterre
426ad6e3a3 [trunk] Adding more tests. tte5.j2k looks as if the tile compression is broken 2012-05-29 14:25:23 +00:00
Mathieu Malaterre
0d0e7a1008 [trunk] The two files in Issue145 have a precision < 8-bit:
therefore 'jp2_read_pclr' must be changed.

j2k_to_image fails to create RGB/RGBA images with a
precision < 8-bit: therefore 'imagetopng' must be
changed.
Fixes issue 145
2012-05-29 13:55:49 +00:00
Mathieu Malaterre
806545df34 [trunk] Fix installation issues. Thanks to winfried for patch.
Fixes issue 149
2012-05-29 13:44:27 +00:00
Mathieu Malaterre
b8cc257ac5 [trunk] Follow up to r1691. Handle signed case. 2012-05-29 09:33:28 +00:00
Mathieu Malaterre
bdb4d96678 [trunk] Add new behavior for codecs. Now supports little endian RAWL format. It is now possible to encode directly little endian raw file, by simply using the rawl extension. Code has been modified to use strcasecmp instead of strncasecmp to cope with 4 letters files extensions.
Update issue 141
2012-05-29 09:30:03 +00:00
Mathieu Malaterre
0c5fb4a81b [trunk] Add commented out code for tile support in applications. 2012-05-29 09:07:49 +00:00
Mathieu Malaterre
3ff48f27cf [trunk] error message typo, refer PLT instead of PLM 2012-05-22 16:07:38 +00:00
Mathieu Malaterre
f0c732452f [trunk] add sentinel when tile_index is null 2012-05-21 08:38:13 +00:00
Mathieu Malaterre
a4d1b1ba21 [trunk] Enable tile decoding/encoding round trip 2012-05-21 08:05:29 +00:00
Mathieu Malaterre
0447ea94c1 Activate tile decoding system to reproduce issues 2012-05-21 08:03:58 +00:00
Mickael Savinaud
38fd7a84c7 Comment the using of j2k_add_marker function into a v2 function. 2012-05-21 06:51:07 +00:00
Mickael Savinaud
ee17910ec5 use the correct event handler in j2k_to_image.c 2012-05-14 17:47:10 +00:00
Mickael Savinaud
717a7dbfde resolve bug under win arch with test_tile_encoder.c 2012-05-14 17:25:10 +00:00
Mickael Savinaud
0fb6576511 2012-05-14 17:17:53 +00:00
Mathieu Malaterre
383495c863 [trunk] Start activating tile tests 2012-05-14 16:05:55 +00:00
Mathieu Malaterre
b55abf5730 [trunk] Need to use new interface opj_event_msg_v2, instead of old opj_event_msg. Remove some simple warnings 2012-05-14 15:20:20 +00:00
Mathieu Malaterre
3e1aa456b9 [trunk] Pointer is opj_jp2_v2_t, not opj_jp2_t 2012-05-14 15:19:40 +00:00
Mathieu Malaterre
00558adda8 [trunk] Wrong struct size. Use opj_jp2_v2_t instead 2012-05-14 14:51:26 +00:00
Mathieu Malaterre
1c3273aab2 [trunk] Make sure the memory is initialized. valgrind was complaning in mqc_init_enc we were reading uninit value. See also comment in r479: FIXME: mqc_init_enc and mqc_byteout underrun the buffer if we don't do this. Why? 2012-05-14 14:38:02 +00:00
Mathieu Malaterre
589b247926 [trunk] Fix minor typo in error message. 2012-05-14 14:36:24 +00:00
Mickael Savinaud
6965e3e03c adding jp2_encode_v2 from v2 branches; using the right return value for opj_stream_flush 2012-05-14 11:04:59 +00:00
Mickael Savinaud
202d5ab754 correct style in cio.c and use only op_bool return value; correct error in jp2.c and some style 2012-05-14 10:02:59 +00:00
Mickael Savinaud
1023be33fb add new functions in jp2 codec from v2 branches; solve bug in j2k_setup_encoder_v2 2012-05-14 09:37:36 +00:00
Mathieu Malaterre
595c00f55c [trunk] Fix remaining compilation errors 2012-05-14 07:17:42 +00:00
Mickael Savinaud
5aaa5eab70 remove opj_event_mgr struct from test_tile_decoder 2012-05-14 07:13:27 +00:00
Mathieu Malaterre
70b24b021a [trunk] Fix using proper v2 function 2012-05-14 07:11:02 +00:00
Mathieu Malaterre
af96c721c4 [trunk] Import from v2 test_tile_decoder 2012-05-14 07:03:33 +00:00
Mickael Savinaud
a9b653db26 Correct a mistake about declaration of j2k_write_eoc_v2 2012-05-14 06:24:27 +00:00
Mickael Savinaud
80c23d4519 solve problem with input of image_to_j2k; using the right return type comparison for opj_stream_flush; add j2k_write_com_v2, j2k_write_poc_v2, j2k_write_eoc_v2 and j2k_write_tlm_v2 2012-05-13 22:13:58 +00:00
Mickael Savinaud
821d7a8941 remove a fixme about tcd_deallocate and encodind precint 2012-05-13 15:48:19 +00:00
Mickael Savinaud
e7c8a22c67 [trunk] style 2012-05-02 13:37:54 +00:00
Mickael Savinaud
5652ccc780 [trunk] correct a bug in jpip building induced by the previous commit 2012-05-02 13:30:41 +00:00
Mickael Savinaud
055d429ae1 [trunk] Enhance support of events like the v2 branch. Use right name of variables. 2012-05-02 07:01:13 +00:00
Mathieu Malaterre
8231897b26 [trunk] apply patch from winfried on the mailing list. For more info see: https://groups.google.com/group/openjpeg/msg/e631d586a31c6de4 2012-04-23 13:28:20 +00:00
Mathieu Malaterre
df7e656034 Fix a set of warnings reported by gcc in cio.c. This patch impact the API directly (remove left over 32bits API) 2012-04-23 09:16:17 +00:00
Mathieu Malaterre
d045409b9f Adding sentinel code for debug 2012-04-23 09:15:29 +00:00
Mickael Savinaud
7f3f4cfdd0 [trunk] correct a wrong assert in j2k.c 2012-04-13 14:36:30 +00:00
Mathieu Malaterre
ef044d9f17 [trunk] attempt to fix clang/3.1 compilation error remotely 2012-03-27 08:11:14 +00:00
Mathieu Malaterre
9642c7f990 [trunk] fix compilation on OS where ssize_t is not defined. 2012-03-27 07:44:28 +00:00
Mathieu Malaterre
0c5193c588 [trunk] Final touch to get rid of most truncation warnings 2012-03-26 16:42:52 +00:00
Mathieu Malaterre
f2c2b3fc7a [trunk] one more round of warnings fixes 2012-03-26 16:18:58 +00:00
Mathieu Malaterre
1228e0e925 [trunk] change char* to const char* when possible. Remove more warnings 2012-03-26 16:08:05 +00:00
Mathieu Malaterre
3a3820bedc [trunk] remove warnings from jp2k decoder 2012-03-26 16:00:26 +00:00
Mathieu Malaterre
91ee6ed60f [trunk] change char* to const char* when possible. Remove more warnings 2012-03-26 15:56:04 +00:00
Mathieu Malaterre
7e28fdc176 [trunk] another round of compilation fixes 2012-03-26 15:37:04 +00:00
Mathieu Malaterre
569bc02649 [trunk] another set of warnings fixes for LFS support 2012-03-26 15:04:49 +00:00
Mathieu Malaterre
178309be47 [trunk] Fix equality into test 2012-03-26 14:50:34 +00:00
Mathieu Malaterre
2fb7ac9a58 [trunk] remove some simple warnings 2012-03-26 14:50:14 +00:00
Mathieu Malaterre
2e493cb89a [trunk] According to JPIP/A.2.3 in class identifiers should be an unsigned integer. Since portion of codes was using Byte8_t and other was using int, pick Byte8_t as best matching type 2012-03-26 14:44:12 +00:00
Mathieu Malaterre
cdf0d77b20 [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP (sock_manager) 2012-03-26 14:23:33 +00:00
Mathieu Malaterre
ccdfaa9115 [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP (auxtrans_manager) 2012-03-26 14:14:19 +00:00
Mathieu Malaterre
34af05ec30 [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP (metadata_manager) 2012-03-26 13:53:25 +00:00
Mathieu Malaterre
6bd41e47ac [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP (manfbox_manager) 2012-03-26 13:49:32 +00:00
Mathieu Malaterre
45d11c53f0 [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP (j2kheader_manager) 2012-03-26 13:47:52 +00:00
Mathieu Malaterre
50a68d7d59 [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP (index_manager) 2012-03-26 13:34:16 +00:00
Mathieu Malaterre
cc47b5a78c [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP (marker_param_t) 2012-03-26 13:18:09 +00:00
Mathieu Malaterre
34b4ec3624 [trunk] fix another simple warning 2012-03-26 13:15:40 +00:00
Mathieu Malaterre
86ed364dc0 [trunk] explicit cast missing 2012-03-26 13:02:40 +00:00
Mathieu Malaterre
438cde4e70 [trunk] remove simple warnings. 2012-03-26 13:01:41 +00:00
Mathieu Malaterre
3b268d1656 [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP (codestream_param_t) 2012-03-26 12:59:33 +00:00
Mathieu Malaterre
0a97782339 [trunk] continue work on getting API to use off_t instead of long toward LFS support in JPIP 2012-03-26 12:31:27 +00:00
Mathieu Malaterre
1cf1d6146c [trunk] Start working on LFS support in JPIP code section 2012-03-26 09:48:53 +00:00
Mathieu Malaterre
f3217ac170 [trunk] ICC profile length is always an unsigned integer 2012-03-26 09:19:45 +00:00
Mathieu Malaterre
c8125f8710 [trunk] make openjpeg consistant with itself, and adapt sign of struct variables 2012-03-26 09:15:26 +00:00
Mathieu Malaterre
1e3bc7c069 [trunk] Fix a potential issue with truncation of pointers diff 2012-03-26 08:51:12 +00:00
Mathieu Malaterre
34df9f3dbf [trunk] Fix some simple warnings reported by -Wconversion 2012-03-26 08:47:06 +00:00
Mathieu Malaterre
72bb159a7e [trunk] fix compilation when jpwl option is ON. 2012-03-26 08:41:48 +00:00
Mickael Savinaud
afe4e345d2 [trunk] add missing file needed to compile last commit 2012-03-26 06:48:45 +00:00
Mickael Savinaud
855b5b513d [trunk] add test_tile_encoder test and function related 2012-03-23 17:47:53 +00:00
Mathieu Malaterre
b9d271c1a8 [trunk] Fix invalid truncation from off_t to int (thanks to -Wconversion for report) 2012-03-19 14:24:26 +00:00
Mathieu Malaterre
b3931741ef [trunk] Missing PRId64 for MS compilers 2012-03-19 13:46:34 +00:00
Mathieu Malaterre
ede48e285f [trunk] Forgot portion of the previous commit. 2012-03-19 13:42:53 +00:00
Mathieu Malaterre
8890539f47 [trunk] use autotools convention where #ifdef BLA, should be provided by #define BLA 1. This is to cope with pseudo autotools generated tif header. 2012-03-19 13:10:46 +00:00
Mathieu Malaterre
ff72dd8d2c [trunk] start using new functionalities from opj_inttypes in jpip code and main openjpeg 2012-03-19 11:18:24 +00:00
Mathieu Malaterre
e07b265009 [trunk] move functionalities of stdint/inttype into opj_stdint/opj_inttypes 2012-03-19 10:15:46 +00:00
Mathieu Malaterre
8d0e5899b9 [trunk] Remove remaining of OPJ_INT64_F/OPJ_UINT64_F before move to C99 convention 2012-03-19 10:00:06 +00:00
Mathieu Malaterre
e6f8b59010 [trunk] replace more void* object pointer to proper function pointer: opj_procedure. Remove some warnings reported by gcc -pedantic 2012-03-19 09:51:23 +00:00
Mathieu Malaterre
8e65846f32 [trunk] add debug statement for Win7-VS2008-32bits-trunk-Debug-OSGeo4W 2012-03-19 09:11:58 +00:00
Mathieu Malaterre
96d4d3f3be [trunk] Quick fix for MS compilers which do not ship inttypes.h 2012-03-17 18:20:52 +00:00
Mathieu Malaterre
811c01cc2e [trunk] Fix compilation win32 with shared libs on (export symbol name) 2012-03-17 18:06:54 +00:00
Mathieu Malaterre
e24127771e [trunk] Fix numerous warnings about signed vs unsigned comparison. Adapt opj_procedure type to what it should hev been IMHO. Start using PRIi64 for printf and int64_t 2012-03-17 18:06:22 +00:00
Mathieu Malaterre
b3f00d05a8 [trunk] remove a warning, about ISO C restricts enumerator values to range of 'int' 2012-03-17 17:03:16 +00:00
Mathieu Malaterre
652d34b0a8 [trunk] HACK: This commit remove some JPWL related code just to allow compilation. See r1564 for more info 2012-03-17 15:05:38 +00:00
Mathieu Malaterre
7539577b46 [trunk] Fix compilation when zlib.h is in user specified directory. 2012-03-17 14:51:40 +00:00
Mathieu Malaterre
41ee6006c4 [trunk] Fix compilation on 32bits/PowerPC arch (debian/linux) 2012-03-15 13:36:12 +00:00
Mathieu Malaterre
813ba42cfc [trunk] make sure to build as universal build when OS is APPLE 2012-03-15 13:35:30 +00:00
Mathieu Malaterre
80076276e1 [trunk] remove a warning about no end of file 2012-03-15 13:35:04 +00:00
Mickael Savinaud
3a78e8010d [trunk] modify image_to_j2k and the lib to support functionalities given by the v2 alpha branch 2012-03-15 10:23:20 +00:00
Mathieu Malaterre
d9940f416b [trunk] Fix issue with space 2012-03-12 16:43:27 +00:00
Mathieu Malaterre
dd998e7fd3 [trunk] Add support for compiling libtiff with VS2008 2012-03-12 16:40:29 +00:00
Mathieu Malaterre
747db4d940 [trunk] Add support for MSVC 2010 compiler (32bits) 2012-03-12 15:40:22 +00:00
Mathieu Malaterre
ecd5c523dc [trunk] Update libtiff to 4.0.1 to support BigTIFF. openjpeg/tiff 4.0.1 currently builds on linux/x86_64 and linux/mingw32. 2012-03-12 11:35:35 +00:00
Mathieu Malaterre
3de14fc63e [trunk] Use stdint.h when available to compute fixed-type definition. 2012-03-11 15:12:31 +00:00
Mathieu Malaterre
7f166eaee7 [trunk] Backport diff from openjpeg 1.5 branch 2012-03-11 14:56:29 +00:00
Mickael Savinaud
ab7b5e48c4 [trunk] reverted to revision 1536 2012-03-09 17:34:05 +00:00
Mickael Savinaud
345b5cfc5c [trunk] add j2k_post_write_tile in trunk from branch v2 2012-03-09 17:16:24 +00:00
Mickael Savinaud
1ac93c3a72 [trunk] add j2k_get_tile_data in trunk from branch v2 2012-03-09 17:16:16 +00:00
Mickael Savinaud
4b8c29a708 [trunk] add tcd_get_encoded_tile_size in trunk from branch v2alpha 2012-03-09 17:16:04 +00:00
Mickael Savinaud
04b057d22c [trunk] add j2k_pre_write_tile function in trunk from v2alpha 2012-03-09 17:15:55 +00:00
Mickael Savinaud
fcfb8dd2ed [trunk] first steps about merge compression WIP 2012-03-09 17:15:41 +00:00
Mathieu Malaterre
4a2673772a [trunk] Fix a bunch of warning about C++ comments in C code. 2012-03-02 15:53:14 +00:00
Mathieu Malaterre
b9e216ac6f [trunk] merge r1229 from branch 1.5 over to trunk 2012-03-02 15:24:12 +00:00
Mathieu Malaterre
e78e2885fe [trunk] minor style to sync with branch 1.5 2012-03-02 15:21:51 +00:00
Mathieu Malaterre
777f2e7547 [trunk] convert from DOS eol to UNIX eol 2012-03-02 15:12:24 +00:00
Mathieu Malaterre
27e494d25c [trunk] Sync with branch 1.5 2012-03-02 15:09:51 +00:00
Mathieu Malaterre
d88156d998 [trunk] merge r1234 from branch 1.5 over to trunk 2012-03-02 15:07:07 +00:00
Mathieu Malaterre
44a3af51f0 [trunk] merge r1322 from branch 1.5 over to trunk 2012-03-02 15:04:45 +00:00
Mathieu Malaterre
79f090d92b [trunk] merge r1197, r1199, r1228, r1230 and r1232 from branch 1.5 over to trunk 2012-03-02 15:02:48 +00:00
Mathieu Malaterre
54c65fdad0 [trunk] merge r1479 from branch 1.5 over to trunk 2012-03-02 14:55:16 +00:00
Mathieu Malaterre
e917802316 [trunk] merge r1323 from branch 1.5 over to trunk 2012-03-02 14:52:18 +00:00
Mathieu Malaterre
6a19a31171 [trunk] Remove exe bit on CMakeLists.txt. Set from DOS eol to UNIX eol 2012-03-02 14:33:29 +00:00
Mathieu Malaterre
a06b7f2ae0 [trunk] Sync with 1.5 branch 2012-03-02 14:31:46 +00:00
Mathieu Malaterre
405b1067e2 [trunk] Backout r1513 for now. 2012-03-02 14:29:08 +00:00
Mathieu Malaterre
10cb93283a [trunk] merge rev 1330/1331 from branch 1.5 onto trunk 2012-03-02 14:24:39 +00:00
Mathieu Malaterre
d28e8f537a [trunk] merge rev 1333 from 1.5 to trunk 2012-03-02 14:19:44 +00:00
Mathieu Malaterre
24d7f54662 [trunk] merge rev 1228 from 1.5 to trunk 2012-03-02 14:14:31 +00:00
Mathieu Malaterre
687a43e199 [trunk] Import change from 1.5 branch over to trunk 2012-03-02 14:01:15 +00:00
Mathieu Malaterre
07ef7d750b [trunk] Synchronize with 1.5 branch, installation convention 2012-03-02 13:59:12 +00:00
Mathieu Malaterre
ea2b1d36aa [trunk] minor coding style change to match 1.5 2012-03-02 13:57:04 +00:00
Mathieu Malaterre
c7540fba94 [trunk] Import getopt modification from 1.5 branch 2012-03-02 13:50:29 +00:00
Mathieu Malaterre
3d9198592b [trunk] Import remaning bits from JPIP/1.5 over to trunk 2012-03-02 11:09:16 +00:00
Mathieu Malaterre
d6357bacdd [trunk] Merge rev 1068 into trunk 2012-03-02 10:58:43 +00:00
Mathieu Malaterre
647551b8e4 [trunk] Remove junk from merge 2012-03-02 10:49:53 +00:00
Mathieu Malaterre
b158c25dc3 [trunk] Import rev 1103 into trunk. 2012-03-02 10:46:04 +00:00
Mickael Savinaud
bc8a3c5b6f [trunk] correct bug when we expand the list of marker in a tile 2012-03-02 10:42:11 +00:00
Mickael Savinaud
c149db2205 [trunk] check the PSot value during the reading of SOT marker 2012-03-02 10:38:01 +00:00
Mathieu Malaterre
b5495ec972 [trunk] do not distribute binary in the source code. Remove *.jar files 2012-03-02 10:35:42 +00:00
Mathieu Malaterre
472c390e75 [trunk] import JPIP modifications for build-system from 1.5 2012-03-02 10:23:20 +00:00
Mathieu Malaterre
3d9a41e4b4 [trunk] Import applications modifications from 1.5 over to trunk 2012-03-02 10:01:00 +00:00
Mathieu Malaterre
9f77b065d3 [trunk] Convert from DOS eol to UNIX eol 2012-03-02 09:55:28 +00:00
Mathieu Malaterre
7abbe1e8d8 [trunk] Backport from OPJViewer version 1.5 over to trunk 2012-03-02 09:47:55 +00:00
Mathieu Malaterre
004b6ed60f [trunk] Remove left-over Makefile 2012-03-02 09:44:52 +00:00
Mathieu Malaterre
d12f30f90c [trunk] Sync OPJViewer with 1.5 version 2012-03-02 09:41:31 +00:00
Mathieu Malaterre
c433c2f2e2 [trunk] Backport toplevel files from 1.5 2012-03-02 09:26:15 +00:00
Mathieu Malaterre
9e52c330ae [trunk] Remove copyrighted material from java-jni. Import patch from 1.5 over to trunk/JavaOpenJPEG 2012-03-02 09:20:13 +00:00
Mathieu Malaterre
564deec2c4 [trunk] Backport toplevel changes from 1.5 over to trunk. Remove hand-generated CHANGES file 2012-03-02 09:11:48 +00:00
Mathieu Malaterre
6fd0ffccbf [trunk] Merge the CMake/ dir from opj 1.5 2012-02-13 11:20:26 +00:00
Mathieu Malaterre
ee957a4285 Integrate some more diffs from the 1.5 branch 2012-02-13 09:42:26 +00:00
Mathieu Malaterre
c63331a303 Start merging of the 1.5 branch into trunk. Start with doc 2012-02-13 09:27:50 +00:00
Antonin Descampe
4d2c44ca87 add opj_logo.icns for trunk and 1.5 2012-01-11 12:19:18 +00:00
Mathieu Malaterre
596b5cd732 Fix test NR-ENC-Bretagne2.ppm-4-encode on linux. 2011-12-20 17:54:04 +00:00
Mathieu Malaterre
8ff1ba325d Fix strange line, as reported by lockalsash (gmail.com) 2011-12-20 17:11:22 +00:00
Mathieu Malaterre
a19d7e3680 minor typo 2011-12-12 11:19:13 +00:00
Mickael Savinaud
90eeb25770 [trunk] remove some warnings detected by cppcheck 2011-12-07 09:53:46 +00:00
Mathieu Malaterre
bfe8b81d18 Add new mechanism for cppcheck 2011-12-06 16:03:05 +00:00
Mathieu Malaterre
ec71c19be7 Update changelog 2011-12-06 09:47:10 +00:00
Mathieu Malaterre
cce1fc9c65 Apply patch from Brad Hards to fix some typos. 2011-12-06 09:46:40 +00:00
Mathieu Malaterre
79fee501af Apply doxygen fixes suggested by Brad Hards on opj mailing list. 2011-12-03 17:26:59 +00:00
Mathieu Malaterre
12dfaa2d74 Sorry. Reverting mistake. 2011-12-02 15:35:47 +00:00
Mathieu Malaterre
d4e5366fe6 Simplify code. Use standard find_package call instead. ctest script will need to handle this now 2011-12-02 15:30:19 +00:00
Mathieu Malaterre
d7388d7e80 Add CPack stuff 2011-12-02 14:52:34 +00:00
Mickael Savinaud
5c363b76ee [trunk] fix a bug during the creation of the codestream index 2011-12-01 13:46:09 +00:00
Julien Malik
440adddcde [trunk] fix warnings when printing large integers 2011-12-01 10:50:14 +00:00
Mickael Savinaud
af9ad1580a [trunk] fix a warning about a recent commit (1104) 2011-12-01 09:10:26 +00:00
Julien Malik
d569430cc6 [trunk] fix compilation of j2k_random_access on Visual C++ 2011-12-01 09:02:04 +00:00
Julien Malik
c39bea2017 [trunk] make large file support variables persistent in CMake to allow reconfiguration 2011-11-30 19:43:48 +00:00
Julien Malik
a361f618a1 [trunk] fix call to opj_destroy_cstr_info_v2 in j2k_random_tile_access 2011-11-30 19:41:57 +00:00
Mickael Savinaud
8c2d8bc85f [trunk] fix bug during random access to tile (tile already decoded) 2011-11-30 17:31:47 +00:00
Mickael Savinaud
563b56e09c [trunk] fix error about the way to detect the additional test suite 2011-11-30 17:31:42 +00:00
Julien Malik
455f675806 [trunk] implement Large File support in the library 2011-11-30 16:55:25 +00:00
Mickael Savinaud
3932e860ca [trunk] fix error with new way to detect kdu_expand 2011-11-29 09:28:02 +00:00
Julien Malik
b3368a85da [trunk] add support for Large File in autoconf 2011-11-28 15:35:16 +00:00
Julien Malik
defe0b25dd [trunk] fix definition of _FILE_OFFSET_BITS macro on platform where it is needed 2011-11-28 15:32:33 +00:00
Julien Malik
b68ed904b1 [trunk] add definitions for 64 bits integer types, and define OPJ_OFF_T to map to OPJ_INT64 systematically 2011-11-28 15:32:29 +00:00
Julien Malik
2eba4fb96b [trunk] activate LargeFileSupport in CMake 2011-11-28 15:32:22 +00:00
Julien Malik
27ba604ad7 [trunk] search for kdu_expand in a more cmake-compliant way 2011-11-27 22:27:50 +00:00
Julien Malik
769982d058 [trunk] clean up redundant includes already handled in opj_includes.h 2011-11-27 21:57:16 +00:00
Julien Malik
674d702257 [trunk] backout wrong changeset 1091 - see issue 123 2011-11-27 20:28:24 +00:00
Julien Malik
c974cb1b8e [trunk] support seeking in files larger than 2 GB 2011-11-24 15:30:09 +00:00
Mathieu Malaterre
20c05a3add Remove duplicate definition 2011-11-24 12:50:54 +00:00
Mathieu Malaterre
c27322ff04 Cleanup jpip cmake compilation 2011-11-24 10:42:47 +00:00
Mathieu Malaterre
6e624946d2 add note for cmake 2011-11-24 10:20:49 +00:00
Mathieu Malaterre
ab9a63bbea Use cmake style define. Fix big endian issue on dual OS (eg. Tiger) 2011-11-24 10:17:49 +00:00
Mathieu Malaterre
3a8438e1f8 minor reindentation 2011-11-24 10:17:01 +00:00
Mathieu Malaterre
0e49c6affd Remove exe bit from source files 2011-11-24 10:16:01 +00:00
Mathieu Malaterre
8bcf78cd78 fix variable name to be hidden 2011-11-24 10:15:43 +00:00
Mathieu Malaterre
ffc944976b Avoid message pollution during cmake configuration time 2011-11-24 10:14:55 +00:00
Mickael Savinaud
1b52be6246 [trunk] WIP: fix bug with windows platform and j2k_dump 2011-11-21 17:18:33 +00:00
Mickael Savinaud
e7e1ec6e84 [trunk] WIP: fix bug with windows platform and j2k_to_image 2011-11-18 08:42:57 +00:00
Mickael Savinaud
ff3c441023 [trunk] WIP: fix bug when decoding an area or a tile with special resolution 2011-11-17 14:29:36 +00:00
Mickael Savinaud
aaf6e84373 [trunk] WIP: enhance j2k_to_image with new get_decoded_tile functionality 2011-11-17 14:24:51 +00:00
Mickael Savinaud
380a357b08 [trunk] WIP: clean j2k_dump and enhance j2k_dump with commit 1052 2011-11-17 14:23:19 +00:00
Mickael Savinaud
8026d0b2e7 [trunk] WIP: add a set decoded resolution factor function and update j2k_to_image help about decoded region 2011-11-17 14:21:11 +00:00
Kaori Hagihara
b41cad58cb [trunk][JPIP] fixed opj_server execusion error (instant terminating) with autotool, cmake still need to be fixed 2011-11-16 20:00:13 +00:00
Mickael Savinaud
39e12244cc [trunk] fix tests/nonregresion/CMakeList.txt 2011-11-10 17:38:08 +00:00
Mickael Savinaud
c4c01b61e6 [trunk] WIP: fix get_decoded_tile function to avoid error with output image 2011-11-09 16:15:15 +00:00
Mickael Savinaud
eb3cd22aa3 [trunk] fix bug with mj2 applications (credit to winfried) 2011-11-09 14:47:44 +00:00
Mickael Savinaud
5b35f5fb69 [trunk] enhance mj2 when read jp2h (credit to winfried) 2011-11-09 14:38:12 +00:00
Mickael Savinaud
11d875d043 [trunk] check if the file extension is the same as the infile format (credit to winfried) 2011-11-09 14:32:54 +00:00
Julien Malik
ac946a4602 [trunk] add some sanity check in CMakeLists to prevent STRING(REGEX..) call issues 2011-11-09 14:23:03 +00:00
Kaori Hagihara
815e2f3d03 [trunk][JPIP] enabled OpenJPEG V2 API 2011-11-08 15:22:02 +00:00
Mickael Savinaud
bd8bca87b2 [trunk] WIP: add get_decoded_tile functionality 2011-11-08 13:21:17 +00:00
Mickael Savinaud
9110aa09a4 [trunk] WIP: clean and enhance j2k files 2011-11-08 13:15:21 +00:00
Mickael Savinaud
fe085a631d [trunk] WIP: clean and enhance openjpeg.c 2011-11-08 13:13:05 +00:00
Mickael Savinaud
c7489af844 [trunk] WIP: clean and enhance openjpeg.h and add deprecated macro 2011-11-08 13:09:53 +00:00
Kaori Hagihara
32a653e67e [trunk][JPIP] updated main page of doxygen 2011-11-08 10:17:52 +00:00
Kaori Hagihara
d16c93aa08 solved memory leak of opj_server, and removed redundant defines 2011-11-03 17:20:00 +00:00
Antonin Descampe
46367a7a7b [trunk][JPIP] additional patches for autotools and cmake 2011-11-02 00:54:19 +00:00
Kaori Hagihara
83a25c06ef additional patches for autotool are applied 2011-10-26 10:20:57 +00:00
Kaori Hagihara
db7db67851 fixed client viewer to be compatible with server response header both Content-type and Content-Type 2011-10-25 22:16:56 +00:00
Kaori Hagihara
8d7073abf6 patches for cmake and autotool are applied 2011-10-25 21:10:48 +00:00
Mickael Savinaud
f1c8dd887b [trunk] WIP: add a file to exclude some valgrind errors (detected with ctest_memcheck) related to png lib found with ubuntu10.04 platform 2011-10-25 12:31:27 +00:00
Mickael Savinaud
08bc3b0386 [trunk] WIP: solve problems with reading of elements outside the tilec->data buffer in dwt 2011-10-25 12:27:51 +00:00
Mickael Savinaud
2808de6084 [trunk] WIP: manage output image with area correponding to the set decoded area 2011-10-21 16:38:08 +00:00
Mickael Savinaud
028088f5f0 [trunk] WIP: enhance codestream index generation 2011-10-21 16:36:04 +00:00
Mickael Savinaud
21178c3571 [trunk] WIP: isolate dump test suite 2011-10-20 15:10:59 +00:00
Mickael Savinaud
b8214e260c WIP: remove memory leak about new jp2_read_marker function 2011-10-20 13:18:52 +00:00
Mickael Savinaud
45d813b62c [trunk] WIP: remove previous commit about memory leak with ppm read function 2011-10-20 09:19:35 +00:00
Mickael Savinaud
73b3e0e50e [trunk] WIP: solve memory leak with ppm read function 2011-10-20 08:33:00 +00:00
Kaori Hagihara
255fcbc3a5 start using API style in openJPIP library 2011-10-19 23:29:57 +00:00
Mickael Savinaud
47d93279ff [trunk] WIP: solve problem with writing of tga image from an image with signd=1 (credit to Winfried) 2011-10-19 13:18:06 +00:00
Mickael Savinaud
5b93ae8628 [trunk] WIP: solve some memory leak in test compare functions 2011-10-19 13:06:49 +00:00
Kaori Hagihara
436318a8c8 adapt makefiles to the new structure 2011-10-18 14:31:06 +00:00
Kaori Hagihara
57a328c7a9 rearranged opj_server, opj_dec_server directory 2011-10-18 12:38:31 +00:00
Kaori Hagihara
2cd3f046e5 enable all progression orders 2011-10-14 17:10:30 +00:00
Kaori Hagihara
5c88c1376c include stdlib.h for calloc 2011-10-13 20:00:19 +00:00
Mickael Savinaud
2d39e5d7a5 [trunk] WIP: resolve heap corruption with p0_07.j2k (credit to Winfried) 2011-10-12 14:44:46 +00:00
Mickael Savinaud
27e255fa75 [trunk] WIP: correct some memory leaks in applications functions 2011-10-12 14:42:21 +00:00
Mickael Savinaud
195190b612 [trunk] WIP: add a read CBD marker function (JPEG2000 part 2) 2011-10-12 14:36:39 +00:00
Mickael Savinaud
aeabfaf417 [trunk] WIP: add a read MCO marker function (JPEG2000 part 2) 2011-10-12 14:34:17 +00:00
Mickael Savinaud
f62201ba9d [trunk] WIP: add a read MCC marker function (JPEG2000 part 2) 2011-10-12 14:32:29 +00:00
Mickael Savinaud
5cf331d881 [trunk] WIP: add a read MCT marker function (JPEG2000 part 2) 2011-10-12 14:30:22 +00:00
Kaori Hagihara
28c90cce6c enable layers requests; restricting the number of codesream quality layers 2011-10-12 13:25:53 +00:00
Mickael Savinaud
ca5b10938a [trunk] WIP: correct a segfault inside j2k_dump output 2011-10-11 13:49:58 +00:00
Kaori Hagihara
acd4cc6f5c -J option for -jpip added into the option list 2011-10-11 13:01:38 +00:00
Kaori Hagihara
7ac3a36229 change -v option was renamed to -u, which is equivalent to -TP long option 2011-10-11 10:57:41 +00:00
Mickael Savinaud
a6178c1de6 [trunk] WIP: correct some segfault with win platform and remove a aligned allocation which produce error when a realloc is done on this pointer 2011-10-11 10:09:02 +00:00
Mickael Savinaud
990dd18474 [trunk] WIP: add stream length value to read unknown marker size, backport 855 into V2 framework, correct memory leak into get_cstr_info 2011-10-11 08:01:31 +00:00
Mickael Savinaud
c4642d4fda [trunk] WIP: add output elements about decoding of jp2 files with last tile part lenght equal zero 2011-10-11 07:54:27 +00:00
Mickael Savinaud
c7d3b83164 [trunk] WIP: correct mistake with JP2 files and manage correctly the text_GBR.jp2 filecase 2011-10-11 07:49:16 +00:00
Kaori Hagihara
7c87bb35c4 change -v option was reactivated for JPIP 2011-10-10 16:10:49 +00:00
Kaori Hagihara
f20530dce2 enable JPT-stream request from client viewer option 2011-10-10 13:15:18 +00:00
Antonin Descampe
5d5adf7c7e [trunk][JPIP]removed obsolete indexer utility 2011-10-10 10:02:20 +00:00
Vincent Torri
fc01873d60 [trunk] fix name 2011-10-10 06:52:07 +00:00
Vincent Torri
81b9e78565 [trunk] add libopenjpeg-jpwl.pc.in. fix output when --disable-shared or --disable-static is passed to configure. Minor clean up of configure.ac. 2011-10-10 06:51:08 +00:00
Vincent Torri
cee4505172 [trunk] fix 'distcheck' rule 2011-10-10 06:26:34 +00:00
Mickael Savinaud
4d4b29ea94 [trunk] WIP: correct mistake in text output inside set_decoded_area function (credit to Winfried) 2011-10-07 21:57:09 +00:00
Mickael Savinaud
efd780f82a [trunk] WIP: update jp2 dump functions with the new V2 framework 2011-10-07 17:31:35 +00:00
Mickael Savinaud
cc0ff6b0bf [trunk] WIP: update output filename of conformance dump test to be compatible with new baseline 2011-10-07 17:29:07 +00:00
Mickael Savinaud
35e13cf5e8 [trunk] correct wrong input in dump_codec function and add missing return value 2011-10-07 17:11:12 +00:00
Mickael Savinaud
238652b36c [trunk] WIP: correct mistake inside set_decoded_area function (credit to Francois De Vieilleville) 2011-10-07 14:36:29 +00:00
Mickael Savinaud
e4b728ccb9 [trunk] WIP: backport rev 967-969 about test suite enhancement and rename of opj_configh.cmake.in from opj-1.5 to trunk 2011-10-07 14:20:15 +00:00
Mickael Savinaud
68967aef72 [trunk] WIP: Enhance html documentation generation with cmake, add a mainpage to this documentation and bump version to 1.99.0 into the main CMakeLists (as rev951) 2011-10-06 08:41:49 +00:00
Mickael Savinaud
fd67d46be7 [trunk] WIP: fix build error with windows configuration induced by rev 960 2011-10-06 08:05:00 +00:00
Mickael Savinaud
ee0e8a3aad [trunk] WIP: fix the decoding process with conformance files and V2 framework 2011-10-05 16:27:16 +00:00
Vincent Torri
f4734d6b4d * [vincent] fix autotools for various compilation problems
* [vincent] fix indexer compilation. Patch from Winfried
2011-09-30 21:14:25 +00:00
Kaori Hagihara
656628e69b modified indexer for JPIP, JPP-stream 2011-09-30 17:15:06 +00:00
Kaori Hagihara
6b1bca80ee enabled JPP-stream 2011-09-30 15:31:06 +00:00
Vincent Torri
537a50214a [trunk] bump version to 1.99.0 2011-09-28 04:32:28 +00:00
Mickael Savinaud
67d04dd9ba [trunk] WIP: enhance the event management into the new API 2011-09-27 12:41:49 +00:00
Mickael Savinaud
b8efd02c7f [trunk] WIP: fix some warnings about a static function and j2k_read_unk_v2 2011-09-27 12:32:28 +00:00
Mickael Savinaud
a600d8f4e2 [trunk] WIP: add basis for a new output management of the codestream information and index 2011-09-27 12:14:11 +00:00
Mickael Savinaud
de7793e918 [trunk] WIP: fix some warnings from j2k_dump and index.c 2011-09-27 12:00:06 +00:00
Mickael Savinaud
a5e442d490 [trunk] WIP: fix build compilation (with autotools) with MJ2 option (credit to Winfried) 2011-09-22 09:31:45 +00:00
Mickael Savinaud
51513c4e6b WIP: fix build compilation error with windows platform about event_mgr management 2011-09-22 08:39:59 +00:00
Mickael Savinaud
5d0b813cec [trunk] WIP: clean the j2k_dump application and the lib regards to the event management 2011-09-21 16:37:45 +00:00
Mickael Savinaud
ba0c271774 Enhance the support of endianess with cmake and inside the code (credit to Winfried) 2011-09-21 10:01:54 +00:00
Mickael Savinaud
7062c01b68 WIP: fixed build issues with JPWL option ON 2011-09-20 14:50:04 +00:00
Mickael Savinaud
c0bad42eb1 WIP: fixed build issue with MJ2 option ON with new framework 2011-09-20 14:36:23 +00:00
Mickael Savinaud
af7ebd96a0 Enhance some new JPIP files about opj_config inclusion and using of free/calloc (credit to Julien Malik) 2011-09-19 16:53:10 +00:00
Mickael Savinaud
ac59fd1476 WIP: begin to test opj_decode_tile_data 2011-09-19 16:34:44 +00:00
Mickael Savinaud
6561d70664 WIP: update t1, t2, tcd to use same strut as in V2 2011-09-19 16:09:19 +00:00
Mickael Savinaud
1a5c59326a WIP: begin to test opj_read_tile_header with V2 style 2011-09-19 16:05:43 +00:00
Mickael Savinaud
d44375aece WIP: create a new framework to output file information 2011-09-19 16:01:49 +00:00
Mickael Savinaud
cf37058d7c WIP: remove a piece of code copy by the merge op at the wrong place 2011-09-19 15:51:20 +00:00
Mickael Savinaud
dcb3fcbfa7 WIP: begin to clean j2k_dump and some other small things 2011-09-19 13:55:06 +00:00
Mickael Savinaud
6ece3f6792 WIP: enchance the new version with some bug fixes from v1 and from me 2011-09-19 13:47:35 +00:00
Mickael Savinaud
3b30e42551 WIP: add support of jp2 for new j2k_dump function and some other small stuff 2011-09-19 13:36:07 +00:00
Mickael Savinaud
b0ef524b9e WIP: new image_header struct is used and enable used of cstr_info 2011-09-19 13:30:21 +00:00
Mickael Savinaud
b138aaae08 WIP: manage the case of event_mgr is not provided to setup_decoder function 2011-09-19 13:18:19 +00:00
Mickael Savinaud
3953661078 WIP: insert elements from V2 framework into the trunk (add missing files) 2011-09-19 13:12:01 +00:00
Mickael Savinaud
b551844cc2 Work In Progress: insert elements from V2 framework into the trunk 2011-09-19 13:04:04 +00:00
Kaori Hagihara
93f3e2b007 Add README description for stateless requests 2011-09-16 14:36:51 +00:00
Kaori Hagihara
0a42a8bc46 opj_dec_server enabled stateless requests 2011-09-16 14:20:00 +00:00
Kaori Hagihara
8097b07661 opj_viewer_xerces enabled stateless requests 2011-09-16 14:18:22 +00:00
Kaori Hagihara
1475cabfa0 opj_viewer enabled stateless requests 2011-09-16 14:17:45 +00:00
Antonin Descampe
6a1573c228 TRUNK: fixed autotools for new indexer option 2011-09-09 18:54:05 +00:00
Antonin Descampe
d26e1d783f forgot the CHANGES file in r913 2011-09-09 14:53:38 +00:00
Antonin Descampe
fa720c1858 TRUNK:added a new indexer functionality to the library. With the new -jpip option at encoding, the user can now generate a JP2 file including an XML box with the index used when browsing the image with JPIP 2011-09-09 14:49:08 +00:00
Mickael Savinaud
bc7c3e44d5 fixed windows nighlty crash about one missing opj_getopt() (and warning with other platform) 2011-09-02 08:34:38 +00:00
Kaori Hagihara
480ca88b68 changed terminating status of opj_server in debug/non-server mode 2011-09-01 13:32:42 +00:00
Antonin Descampe
aba0e602ed renamed getopt.{c/h} to opj_getopt.{c/h} and forced the use of these files rather than the system ones. This fixed issue 78. Credit to Winfried. 2011-09-01 11:24:08 +00:00
Mickael Savinaud
22a2f98ced fixed a segfault with fgets return value for some cases inside test function compare_dump_file() 2011-08-31 16:51:37 +00:00
Mickael Savinaud
aaa47850c3 enhance the encoding test suite and remove unsued CONFIGURE_FILE into a CMakeList 2011-08-31 13:33:40 +00:00
Mickael Savinaud
7c2feb78d2 added first version of the encoding tests suite 2011-08-30 16:07:43 +00:00
Kaori Hagihara
0c65d2cc0c reorganization of indexer before importing extentional libopenjpeg files 2011-08-28 21:43:57 +00:00
Antonin Descampe
13c5f806c6 fixed missing include directory in opj_client/opj_dec_server/CMakeLists.txt 2011-08-27 15:52:45 +00:00
Antonin Descampe
84d3b4de46 small changes in autotools files 2011-08-26 21:58:50 +00:00
Antonin Descampe
925a772dce fixed cmake and autotools files to reflect recent indexer changes in JPIP 2011-08-26 21:46:42 +00:00
Kaori Hagihara
95015f1104 modified indexer to use the latest openjpeg library 2011-08-26 16:57:34 +00:00
Antonin Descampe
dcbc727813 fixed cmake and autotools files to reflect recent changes in JPIP 2011-08-26 12:44:28 +00:00
Kaori Hagihara
3b9d4c8d50 fixed Makefile.nix to load openjpeg library from this archive 2011-08-26 11:50:50 +00:00
Kaori Hagihara
40fe9e6d67 added tid request support to JPIP client and JPIP server quit request 2011-08-25 17:13:04 +00:00
Kaori Hagihara
4da816e459 support tid request 2011-08-24 17:07:28 +00:00
Kaori Hagihara
9c475467d5 moved declarations of functions of opj_server for readability 2011-08-24 11:26:39 +00:00
Kaori Hagihara
0310cbad0a added cachemodel_manager, which had been managed in target_manager previously 2011-08-24 11:00:15 +00:00
Mathieu Malaterre
ef258914b2 Properly close bug #73, by providing a test for it. 2011-08-22 13:13:00 +00:00
Antonin Descampe
c025f363f5 updated INSTALL files, fixed a bug in CMakeLists.txt that prevented finding the data directory 2011-08-22 10:42:32 +00:00
Antonin Descampe
51187d06b3 INSTALL and THANKS files update 2011-08-22 09:59:03 +00:00
Antonin Descampe
8210b3c873 added NEWS, AUTHORS and THANKS files. Cosmetic changes in autotools files (in trunk) 2011-08-16 13:25:42 +00:00
Antonin Descampe
883e0826e2 removed obsolete testing directory and *.nix files (in trunk) 2011-08-16 09:33:37 +00:00
Antonin Descampe
003f9f7953 fixed cmake support for openjpip 2011-08-16 08:52:23 +00:00
Antonin Descampe
2880a679f0 fixed a bug in autotools files that prevented libfcgi to be correctly found in some cases (patch from V.Torri) 2011-08-15 13:22:46 +00:00
Antonin Descampe
4d6cff7eb8 minor changes in autotools installation README 2011-08-15 09:51:47 +00:00
Antonin Descampe
d8806649ab added cmake support to openjpip 2011-08-12 13:57:36 +00:00
Mickael Savinaud
dc9a65923a Fixed issue #76 (trunk) 2011-08-11 14:29:03 +00:00
Antonin Descampe
751d2a0fe7 minor bug fix in configure.ac (credit to Vincent Torri) 2011-08-11 12:22:31 +00:00
Mickael Savinaud
e3e2dc1f6e fixed build error with position of variable declaration after patch 856 2011-08-11 08:37:11 +00:00
Mickael Savinaud
4f329cbb45 fixed wrong patch with the return value of fgets into convert.c file 2011-08-11 08:21:28 +00:00
Mickael Savinaud
0e8995aa7e fixed error with the return value of fgets into convert.c file 2011-08-10 15:54:15 +00:00
Mickael Savinaud
7812030886 moved the definition of OPJ_ARG_NOT_USED from opj_includes.h to openjpeg.h 2011-08-10 09:33:33 +00:00
Mickael Savinaud
6fb9794200 fixed segfault with 123.j2c and bug.j2c images (thanks to Tim Mattox for his contribution to this patch) 2011-08-10 09:00:34 +00:00
Mickael Savinaud
9e419fdaf7 fixed glibc error with broken2 and broken4 images 2011-08-10 08:47:20 +00:00
Mickael Savinaud
e634cd0d62 add copyright header into new test functions 2011-08-10 08:14:49 +00:00
Mickael Savinaud
676f8f189f removed unused parameters warnings with the solution proposed by myself and Bob Friesenhahn 2011-08-10 08:12:10 +00:00
Antonin Descampe
df44837b07 removed xcode project files (cmake and autotools are now the only supported build methods) 2011-08-09 15:42:42 +00:00
Mickael Savinaud
16998b4b6d update MJ2 CMakeLists regards to the new thirdparty strategy 2011-07-29 10:47:42 +00:00
Mickael Savinaud
f57c4fd0c2 increase number of warning reported on the dashboard (forgot the file in the last commit) 2011-07-29 09:12:26 +00:00
Mickael Savinaud
5743cca5f8 solve some obvious warnings for WIN platform, increase number of warning reported on the dashboard, correct last warnings with gcc 4.4 (-Wall) 2011-07-29 08:50:55 +00:00
Mickael Savinaud
e716a316f6 manage case 0 frames inside yuv_num_frames function and correct some warnings with gcc4.5 (credit to Winfried) 2011-07-28 10:45:22 +00:00
Mickael Savinaud
c2b0a8101b correct some warnings detected under unix platform 2011-07-27 16:37:57 +00:00
Mickael Savinaud
f88a57e5d7 added new decoding/dump tests based on data found in input/nonregresion repository (remove JPEG2000_CONFORMANCE_DATA_ROOT variable, add REF_DECODER_BIN_PATH variable for the encoder test suite). Remove definitively old tests 2011-07-27 12:45:04 +00:00
Mickael Savinaud
1776120dba correct CRLF problem between unix baseline and win platform test file generated by j2k_dump 2011-07-26 13:49:27 +00:00
Mickael Savinaud
f4601aff8b use ansi c function fgets instead of GNU function getline to avoid build error with win platform 2011-07-26 09:30:54 +00:00
Mickael Savinaud
14799e25c6 delete double semi-colon at end of line which generate crash on win platform 2011-07-26 07:57:53 +00:00
Mickael Savinaud
eea61ee5e4 added non-regression tests for j2k_dump function and conformance data 2011-07-25 16:33:52 +00:00
Mickael Savinaud
ff6d246efd modify j2k_dump to support output file, needed for non-regression tests 2011-07-25 16:27:07 +00:00
Mickael Savinaud
a7f08e9b36 fixed issue 74 for trunk 2011-07-25 07:31:52 +00:00
Mickael Savinaud
06363c01e4 correct some troubles about thirdparty when they are used 2011-07-22 14:26:57 +00:00
Mickael Savinaud
ec398229b1 correct a compil error linked to getopt with win platform 2011-07-21 16:26:23 +00:00
Mickael Savinaud
a19c8a4ea3 add new decode tests based on conformance data and tolerance. Non regression is also added on the decoder output. Deactivate old tests. 2011-07-21 15:23:31 +00:00
Mickael Savinaud
f8de2fc8eb to follow last version of conformance data about component separator for pgx file, we changed - to _ separator even if nb component = 1 2011-07-21 14:56:29 +00:00
Mickael Savinaud
0380840348 removed unused warning configuration message 2011-07-21 14:34:16 +00:00
Mickael Savinaud
9cd5752e38 correct build error (mislocated declaration) with convert to tiff function when HAVE_LIBTIFF is defined 2011-07-18 08:58:18 +00:00
Mickael Savinaud
65f7f8dc50 improved some CMakeLists files linked to the build of applications which used thirdparty 2011-07-13 16:49:53 +00:00
Antonin Descampe
36c8d85f43 updated CHNAGES files after branch renaming 2011-07-11 17:43:08 +00:00
Kaori Hagihara
d2bfeaa5e2 updates of jar files 2 2011-07-11 14:35:22 +00:00
Kaori Hagihara
025bc9fbe1 updates of jar files 2011-07-11 14:23:11 +00:00
Antonin Descampe
acccedbbb7 opj-v1-branch created 2011-07-10 18:36:17 +00:00
Antonin Descampe
6106e48397 improved encoding speed in t1_encode_cblks (credit to Giuseppe Baruffa) 2011-07-10 17:32:22 +00:00
Kaori Hagihara
0358177c3f bug fixed for error concerning parameter name modification, Makefile.nix also corrected 2011-07-06 19:40:26 +00:00
Antonin Descampe
875ac79d0e JPIP : fixed autotools to work with recent name changes 2011-07-06 10:21:25 +00:00
Kaori Hagihara
9350a47153 additional changes of parameter names and message names for image_viewer and decoding_server from JPT to JPIP-stream 2011-07-05 13:35:31 +00:00
Kaori Hagihara
6230ec13b4 add documentations 2011-07-05 12:25:37 +00:00
Kaori Hagihara
0a9cd082db changed program and parameter names from jpt to jpip 2011-07-05 12:10:35 +00:00
Kaori Hagihara
3f5b6c7aca changed func name parse_stream to parse_JPIPstream 2011-07-05 10:10:20 +00:00
Kaori Hagihara
826fda959c changed parameter and file names regarding JPT-stream to JPIP-stream, which handles also JPP-stream 2011-07-04 23:00:21 +00:00
Antonin Descampe
a5130aebab fixed bmptoimage (see http://groups.google.com/group/openjpeg/browse_thread/thread/33a24c5896bf6391) 2011-07-03 18:23:33 +00:00
Antonin Descampe
fa6aea80f5 fixed handling of "jp2->meth" value (Restricted ICC profile handling currently not implemented) 2011-07-03 17:56:49 +00:00
Antonin Descampe
b09051fd79 fixed CTest configuration files 2011-06-30 13:52:23 +00:00
Kaori Hagihara
1837d6efa0 typo miss corrections for fx,fy 2011-06-27 14:09:11 +00:00
Mathieu Malaterre
74583409ec Fix some error with cmake 2011-06-03 13:44:58 +00:00
Mathieu Malaterre
3da66d4d79 adding partno and numpart info as part of the warning message (issue #69) 2011-06-03 08:47:30 +00:00
Antonin Descampe
645d7cab86 fixed paths in makefile.am 2011-05-26 09:32:34 +00:00
Antonin Descampe
d737981cfe changed Makefile to Makefile.nix to avoid having autotools overwrite them 2011-05-26 08:25:40 +00:00
Kaori Hagihara
dd51c25641 added system architecture description on the documentation 2011-05-25 12:07:39 +00:00
Antonin Descampe
b7969ce657 fixed a bug in autotools that prevented "make distcheck" to work properly (credit to Vincent Torri) ; added autotools for the "applications/jpip/tools" directory 2011-05-24 09:30:25 +00:00
Antonin Descampe
5cee7cfc40 forgot to add new Makefile.am in previous commit 2011-05-23 20:32:22 +00:00
Antonin Descampe
586581685c fixed autotools (broken since the new directory structure) and added autotools as a build method for jpip (credit to Vincent Torri) 2011-05-23 20:30:20 +00:00
Antonin Descampe
88f43b15fa defined new type "opj_bool", and new constants OPJ_FALSE and OPJ_TRUE, to avoid having to deal with "stdbool.h" (patch from Winfried) 2011-05-18 11:02:27 +00:00
Antonin Descampe
0c9f6a3ac9 fixed another bug related to the number of packets in a tile-part, not correctly taken into account when generating an index file during decoding 2011-05-16 19:39:07 +00:00
Antonin Descampe
18cb325a8e fixed part of issue 69, when tile-part index is inconsistent with the total number of tile-parts 2011-05-16 11:07:37 +00:00
Antonin Descampe
ed71feac52 xcode project file updated (now integrates openjpip) 2011-05-12 11:03:11 +00:00
Antonin Descampe
7fe3933faa subsequent jpip-related commits to be logged in "applications/jpip/CHANGES" rather than main CHANGES file 2011-05-12 09:44:19 +00:00
Kaori Hagihara
9837e01971 opj_viewer removed the xml functions (for users without Xersus2), opj_viewer_xerces is the copy of the original viewer ( needs Xersus2) 2011-05-10 16:43:20 +00:00
Kaori Hagihara
5b1dc83382 temporal commit to resort the opj_viewer 2011-05-10 16:39:17 +00:00
Kaori Hagihara
42e5077688 Modification of opj_dec_server to be portable to windows 2011-05-10 14:42:00 +00:00
Kaori Hagihara
081178cd9a Removal of c99 from the compile option (to be compatible to win platform) and bool definition in libopenjpip/bool.h 2011-05-09 18:11:40 +00:00
Antonin Descampe
fb29d47f0c OpenJPIP: small bug fixes to compile on win platform 2011-05-09 09:27:48 +00:00
Antonin Descampe
1dc2654b54 OpenJPIP: fixed several bugs in opj_server (removal of strsep function, duplication of query string) + some changes to compile opj_server under windows (replacement of strcasecmp(), bzero()). 2011-05-08 10:49:06 +00:00
Antonin Descampe
2a5a6416a5 fixed a bug in mqc.c (see https://groups.google.com/d/topic/openjpeg/kQ1PbZUd19k/discussion, credit to Peter Wimmer) 2011-04-16 12:09:16 +00:00
Antonin Descampe
175fd6692c fixed wrong path in Doxyfile.dox 2011-04-16 12:03:45 +00:00
Antonin Descampe
31dba0b4e9 initial commit of OpenJPIP 1.0, a JPIP client-server architecture based on OpenJPEG (see README file in jpip directory for more details) 2011-04-14 18:37:47 +00:00
Antonin Descampe
27b894dd3f fixed applications/codec/CMakeLists.txt that prevented JPWL executables to be built with JPWL functionalities ; changed make all behaviour : DOC target removed from ALL 2011-04-14 10:13:25 +00:00
Antonin Descampe
6aaaa3eae2 changed the directory hierarchy of the whole project. See README files for details. 2011-04-13 22:38:50 +00:00
Antonin Descampe
16f205d886 re-organization of openjpeg directories hierarchy : step 1 2011-04-13 21:01:39 +00:00
Antonin Descampe
87e4c72ee4 moved "openjpeg3d" directory from the trunk to the branches directory. 2011-04-13 15:42:01 +00:00
Antonin Descampe
5ef5fc65ae renamed and reorganized "jp3d" directory to "openjpeg3d". Is now a standalone directory, with independent cmake files. Done as it uses its own version of the openjpeg library and does not depend on the one currently developped. Will be removed from the trunk and stored in a branch. 2011-04-13 15:24:36 +00:00
Antonin Descampe
e93d5a683f Fixed internal function names conflict with Jasper (http://code.google.com/p/openjpeg/issues/detail?id=30) 2011-04-12 17:24:30 +00:00
Antonin Descampe
91419e0e3e convert.c: ENDIAN condition removed, tiftoimage and imagetotif updated (ALPHA added for RGB and GRAY, correct handling of 12-bit precision), small bugfixes (credit to Winfried) 2011-04-12 17:05:47 +00:00
Antonin Descampe
74626a17db small fix in configure.ac (credit to Vincent Torri) 2011-04-12 16:18:51 +00:00
Rex Dieter
1ab46eeff2 openjpeg.pc.cmake rewrites wrong variables (issue 67) 2011-03-30 18:44:40 +00:00
Antonin Descampe
70177d55b0 name fixing in variables related to liblcms 2011-03-24 09:50:20 +00:00
Antonin Descampe
1fd9603c55 added two files FindLCMS.cmake and FindLCMS2.cmake as they are not shipped by default with other cmake modules. 2011-03-21 21:51:04 +00:00
Antonin Descampe
279b67c838 fixed a bug that created a conflict between liblcms on the system and liblcms2 in the thirdparty directory 2011-03-21 21:22:33 +00:00
Antonin Descampe
19f9147e10 Removed the libs directory containing win32 compiled versions of libpng, libtiff and liblcms. Added a thirdparty directory to include main source files of libtiff, libpng, libz and liblcms to enable support of these formats in the codec executables. CMake will try to statically build these libraries if they are not found on the system. Note that these third party libraries are not required to build libopenjpeg (which has no dependencies). 2011-03-20 22:45:24 +00:00
Antonin Descampe
6bda73eeb2 fixed lt_version in configure.ac 2011-03-10 17:08:50 +00:00
Antonin Descampe
9f349b0988 cosmetic change for status report of ./configure 2011-03-05 17:36:08 +00:00
Antonin Descampe
91ce5625b5 now assume MinGW does not have dirent.h (actually have it but without opendir function). Fixed also a WIN32 check in jp3d/libjp3dvm/openjpeg3d.h. 2011-03-04 11:21:45 +00:00
Antonin Descampe
a3df1f5c5e small fix related to the formatting of the install report displayed at the end of install procedure 2011-03-04 11:03:33 +00:00
Antonin Descampe
86edc0a40e updated autotools files to improve build and install procedures (credit to Vincent Torri) 2011-03-04 10:53:27 +00:00
Antonin Descampe
89456eed51 replaced "long" by "size_t" in dwt.c to be sure to cast to a pointer size. 2011-02-17 21:11:29 +00:00
Antonin Descampe
e023107e97 now allows 16-bit precision for mj2 encoding and decoding (solves Issue 49 and Issue 63). Credit to Winfried. 2011-02-17 20:01:14 +00:00
Mathieu Malaterre
af71acb043 Explicitly link to the math lib on UNIX as we use floor and such symbols 2011-02-16 13:59:24 +00:00
Mathieu Malaterre
e12008a718 Make sure to be able to compile index_create on UNIX. Install target 2011-02-16 13:55:04 +00:00
Antonin Descampe
c9bae1fd46 removed opj_config.h.in from svn, as it is automaticaly generated by autoheader when calling ./bootstrap.sh 2011-02-09 10:42:17 +00:00
Antonin Descampe
3a73ff3bc2 renamed "java sources" to "java-sources" to avoid blank space in directory name 2011-02-09 10:07:03 +00:00
Antonin Descampe
99c3c5a4af cmake : fixed installed links to openjpeg.h and openjpeg3d.h 2011-02-06 16:39:26 +00:00
Antonin Descampe
a1920bc5c2 fixed warnings in jp2.c (signed compared to unsigned) and dwt.c (bad cast) ; removed depcomp file from trunk (automatically copied by automake in main folder) 2011-01-30 21:33:55 +00:00
Antonin Descampe
9a811cb52a replaced en-dash with standard dash in jp2.c 2011-01-30 15:38:45 +00:00
Antonin Descampe
55c8c2bc77 license header: replaced Hervcalloc by Herve, I should learn to double-check my changes 2011-01-29 14:15:26 +00:00
Antonin Descampe
fbffea94a9 removed é in license header to prevent warning C4819 (see http://code.google.com/p/openjpeg/issues/detail?id=57) 2011-01-29 14:08:13 +00:00
Antonin Descampe
c7e17d06c8 removed other VS files 2011-01-27 10:28:45 +00:00
Antonin Descampe
75fa7a8d87 remove more obsolete VS files. Left only mj2_to_metadata VS files, as this is the only executable not yet handled by CMake 2011-01-24 22:28:21 +00:00
Antonin Descampe
5e3290a486 removed obsolete VS files 2011-01-23 19:34:26 +00:00
Antonin Descampe
90725df206 MJ2 module: Add two components to mj2.h: meth, enumcs ; Define or reset all components of mj2_cparameters_t before its usage ; Add argument -D prec to frames_to_mj2.c and use the precision in mj2_convert.c (solves Issue 49) 2011-01-23 18:33:06 +00:00
Antonin Descampe
066bda52c0 move KK definition from rs.h to rs.c to prevent duplicate symbol error when building jpwl with autotools 2011-01-23 18:17:00 +00:00
Rex Dieter
2514c5b550 cmake: SOVERSION change to 1 (from 1.4) to match auto-tools build 2011-01-18 17:23:04 +00:00
Rex Dieter
3f234ac21b remove (autotools) generated files 2011-01-17 18:45:33 +00:00
Antonin Descampe
420750f5ca convert.c: inclusion of endian.h has to be different on APPLE platforms 2011-01-16 16:23:12 +00:00
Rex Dieter
51f7cc6874 followup autotools fixes, adding DESTDIR support 2011-01-13 20:18:53 +00:00
Rex Dieter
c4252ed824 s/libopenjpeg.pc/libopenjpeg1.pc/ 2011-01-13 19:54:11 +00:00
Rex Dieter
97c5fe052c fix symlink creation (cmake) 2011-01-13 19:40:48 +00:00
Rex Dieter
5f1e13e770 adjust autotools pkg-config support to match 2011-01-13 19:36:21 +00:00
Rex Dieter
d2d6e1fd6f add pkg-config support to cmake 2011-01-13 19:29:18 +00:00
Antonin Descampe
08459fd944 removed forgotten debug info in imagetopnm() 2011-01-11 08:21:13 +00:00
Antonin Descampe
985a163e33 imagetopnm() has been rewritten to allow 16-bits precision, and PAM (P7) support. See Netpbm for more info. (patch from szukw000). 2011-01-09 22:54:35 +00:00
Winfried
7441340ab5 changed report code in Makefile.am 2011-01-07 03:20:58 +00:00
Antonin Descampe
50b3b5c991 removed badly written tests from CTest in codec/CMakeLists.txt 2011-01-03 22:44:59 +00:00
Antonin Descampe
73a6ed7c21 bug fixes to enable cmake compilation on WIN32 platform (see CHANGES for details) 2011-01-02 18:10:09 +00:00
Antonin Descampe
56afd80506 small update to xcode project 2011-01-02 18:03:28 +00:00
Winfried
398b3f08b0 Adapted Makefile.am/Makefile.nix to build choice: shared xor static 2010-12-14 03:33:31 +00:00
Antonin Descampe
1dd92890d7 fixed flags when building jp3d with MinGW 2010-12-11 23:23:02 +00:00
Winfried
436d2f4bb9 Changed build choice in configure.ac/Makefile.am/Makefile.nix: shared xor static 2010-12-10 04:27:40 +00:00
Antonin Descampe
0264197f3f removed LCMS dependency in jp3d/libjp3dvm/CMakeLists.txt 2010-12-09 21:44:20 +00:00
Antonin Descampe
b487a3521c updated xcode project 2010-12-09 11:07:22 +00:00
Antonin Descampe
816d914c4e renamed jp3d/libjp3dvm/openjpeg.h => jp3d/libjp3dvm/openjpeg3d.h 2010-12-09 10:34:47 +00:00
Antonin Descampe
c0fd0c8f89 removed "codec/compat/" directory 2010-12-09 10:23:13 +00:00
Winfried
ebcda80583 Updated Makefile.in 2010-12-09 01:23:46 +00:00
Winfried
407b95e35f Removed LCMS dependencies from Makefile.am/Makefile.nix 2010-12-09 01:11:05 +00:00
Antonin Descampe
d08a96e251 (thanks to Winfried for his help)
* [antonin] changed remaining "WIN32" to "_WIN32"
! [antonin] libopenjpeg has no more dependency on LCMS lib. Everything concerning color (icc profile, conversion to rgb, etc) has been put outside libopenjpeg and is used in j2k_to_image.c and mj2_to_frames.c.
- [antonin] removed "opj_convert{.c,.h}"
+ [antonin] added a directory "common/" that contains "getopt{.c,.h}" (previously in "codec/compat").
+ [antonin] added files "color{.c,.h}" in "common/" that define the code for icc profile management and sycc_to_rgb conversion
+ [antonin] added "common/format_defs.h" that contains common definitions used in image_to_j2k, j2k_to_image, j2k_dump.
2010-12-08 11:06:41 +00:00
Antonin Descampe
59d9b97ffe revert to previous behaviour for cmake: builds (and links) dynamically by default. Static build only if -DBUILD_SHARED_LIBS is set to OFF. 2010-12-05 15:19:57 +00:00
Antonin Descampe
cf39198a9a added a definition in getopt.h and an initial value in convert.c 2010-12-05 15:10:10 +00:00
Antonin Descampe
02229c7c2d workaround for name clash when building static and dynamic on WIN32 (see http://www.vtk.org/Bug/view.php?id=10190 for description) 2010-12-03 11:57:00 +00:00
Antonin Descampe
1c2ed5cc33 fixed a bug in codec/convert.c that prevented to build executables with WIN32 compiler (thanks winfried) 2010-11-28 18:40:57 +00:00
Antonin Descampe
efc709578a 2010-11-28 18:37:16 +00:00
Antonin Descampe
eb5694ca2a changed cmake behaviour: executables are now always statically linked. When -DBUIL_SHARED_LIBS option is ON (the default), the shared versions of the libraries are also built (but executables remain linked against the static libraries). 2010-11-28 17:07:04 +00:00
Antonin Descampe
389166e86e fix compilation and DLL creation of libopenjpeg with MSYS/MinGW (from vincent.torri, see issue 47 on googlecode) 2010-11-25 11:58:26 +00:00
Antonin Descampe
2b31495723 xcode : changed to native architecture build by default 2010-11-22 11:49:28 +00:00
Antonin Descampe
d5b44a98bc reverted 'include "../opj_config.h"' to 'include "opj_config.h"' 2010-11-22 11:48:19 +00:00
Antonin Descampe
0e5551da99 xcode project : add mj2 targets 2010-11-18 11:12:01 +00:00
Antonin Descampe
3afd3b1afd install man pages by default. install CHANGES and LICENSE 2010-11-17 10:59:21 +00:00
Antonin Descampe
223a39b51e minor changes in cmake files (from winfried) 2010-11-17 10:26:05 +00:00
Antonin Descampe
8faf300b6e fixed missing argument in main CMakeLists.txt 2010-11-17 08:39:24 +00:00
Antonin Descampe
5c76f68168 minor changes in cmake flags 2010-11-16 11:15:38 +00:00
Antonin Descampe
ad970dd9df xcode project rewrite 2010-11-15 11:12:24 +00:00
Antonin Descampe
161891a06e changed imagetopng() function to correctly deal with non-standard bit-depths. Add png support for win32. (from winfried) 2010-11-15 11:10:26 +00:00
Antonin Descampe
709068ef5b minor changes in header inclusions 2010-11-15 11:08:03 +00:00
Antonin Descampe
2b7f6f82be complete rewrite of opj_convert.c with correct values (from winfried) 2010-11-15 11:06:46 +00:00
Antonin Descampe
005b1b1a4b removed call to dirent.h in jp3d 2010-11-11 11:37:45 +00:00
Antonin Descampe
3eab8f975e add info on how to build doxygen doc with autotools 2010-11-11 11:36:10 +00:00
Ben Boeckel
2a4563a677 Fix installation rules in jpwl for CMake 2010-10-28 14:34:37 +00:00
Ben Boeckel
af32de46a2 Installation fixes when using CMake 2010-10-26 16:46:01 +00:00
Ben Boeckel
f35d25c674 Fix jp3dvm version 2010-10-25 16:04:09 +00:00
Antonin Descampe
0dc7f6a2d3 Fixed doxygen data inside source code (from winfried) 2010-10-24 20:28:22 +00:00
Ben Boeckel
bb9232c9d9 Don't clobber openjpeg.h from jp3d 2010-10-22 18:41:49 +00:00
Ben Boeckel
87cb9efb99 Install man pages 2010-10-22 18:41:17 +00:00
Ben Boeckel
4c9a60d4fd Default to building shared libraries 2010-10-22 18:40:33 +00:00
Antonin Descampe
e36881487d Patch to support the MSVC Win 64 builds (from szekerest) 2010-10-22 09:45:53 +00:00
Antonin Descampe
56dd722fb4 Currently the Visual Studio builds are broken in the SVN. Attached a patch to fix this issue (from szekerest) 2010-10-22 09:43:06 +00:00
Winfried
c2f441840f M libopenjpeg/Makefile.in
M    libopenjpeg/Makefile.am
M    jp3d/libjp3dvm/Makefile.in
M    jp3d/libjp3dvm/Makefile.am
M    CHANGES
M    jpwl/Makefile.in
M    jpwl/Makefile.am
2010-10-22 08:51:38 +00:00
Winfried
a55ea39677 M CHANGES
M    jpwl/Makefile.in
M    jpwl/Makefile.am
2010-10-22 04:11:41 +00:00
Winfried
fc668f3ec3 M configure
M    Makefile.in
M    configure.ac
A    libopenjpeg.pc.in
M    doc/Makefile.in
M    doc/Makefile.am
M    CHANGES
M    Makefile.am
2010-10-22 03:07:12 +00:00
Antonin Descampe
c515199674 fixed help display (patch from winfried) 2010-10-21 09:53:13 +00:00
Antonin Descampe
b6102e207c fixed paths to png and tiff in CMakeLists.txt and fixed link to lcms library (patch from winfried) 2010-10-21 09:49:54 +00:00
Antonin Descampe
ddc9a278aa fixed options and help display (patch from winfried) 2010-10-19 10:06:47 +00:00
Winfried
e65ef3a24f M jp3d/Makefile.nix
M    config.nix
M    doc/Makefile.in
M    doc/Makefile.am
M    doc/Makefile.nix
M    CHANGES
M    jpwl/Makefile.nix
M    Makefile.nix
2010-10-18 00:17:19 +00:00
Winfried
f4b08bacb0 -This line, and those below, will be ignored--
M    configure
M    Makefile.in
M    opj_config.h.in.user
M    mj2/Makefile.in
M    mj2/Makefile.am
M    mj2/Makefile.nix
M    libopenjpeg/Makefile.in
M    jp3d/Makefile.in
M    jp3d/libjp3dvm/Makefile.in
M    jp3d/Makefile.nix
M    jp3d/codec/Makefile.in
M    jp3d/codec/Makefile.am
M    config.nix
M    configure.ac
M    doc/Makefile.in
M    doc/Makefile.am
M    doc/Makefile.nix
M    INSTALL
M    CHANGES
M    jpwl/Makefile.in
M    jpwl/Makefile.am
M    jpwl/Makefile.nix
M    Makefile.am
M    Makefile.nix
M    codec/Makefile.in
M    codec/Makefile.am
2010-10-17 22:42:46 +00:00
Winfried
ae6cf3da7d 2010-10-13 15:16:48 +00:00
Winfried
03133377fa 2010-10-13 14:49:39 +00:00
Antonin Descampe
106da2f51e 1. The jp3d/libjp3dvm/Makefile.am has been changed:
Installing: /usr/local/TEST_CONFIG/include/openjpeg3d-1.3/
Installing: /usr/local/TEST_CONFIG/include/openjpeg3d-1.3/openjpeg3d.h

PREFIX/include:

   23  openjpeg.h -> openjpeg-1.4/openjpeg.h
   27  openjpeg3d.h -> openjpeg3d-1.3/openjpeg3d.h

28773  openjpeg-1.4/openjpeg.h
22158  openjpeg3d-1.3/openjpeg3d.h
	
2. The jp3d/Makefile.nix has been changed respectivly.
	
3. The mj2/Makefile.nix contained a wrong path to 'compat/'
	
4. opj_config.h.in.user contained a comment within a comment.
	
5. 'autoreconf' reported that AC_PROG_RANLIB is no longer necessary in 'configure.ac'.
2010-10-10 21:17:18 +00:00
Antonin Descampe
72b6fdb04b fixed a bug in mj2.c that prevented extract_j2k_from_mj2 to build properly. Patch from winfried 2010-10-08 10:16:27 +00:00
Antonin Descampe
453af11e2c fixed CMakeLists.txt typo 2010-10-05 19:17:01 +00:00
Antonin Descampe
eeefefd56c Added files to let people build openjpeg with configure tools ; Added makefiles to let people manually build openjpeg on *nix platforms ; Removed obsolete Makefiles ; Renamed dirent.h to windirent.h ; Made optional the PNG, TIFF, and LCMS support in CMake files ; Added opj_config* files to configure openjpeg before building it (opj_config.h generated by configure, cmake, or manually by the user) ; Renamed this file from ChangeLog to CHANGES ; Renamed License.txt to LICENSE ; Updated README files ; Added INSTALL and LICENSE files ; Added man pages 2010-10-05 10:33:15 +00:00
Luis Ibanez
531c0cf26f Reverting the use of #include "openjpegConfigure.h" until we find a compatible
way of doing this with autoconf, and with the default VS project files.
2010-09-08 22:40:11 +00:00
Luis Ibanez
b7208fb525 ENH: Now forcing openjpeg_JPWL to be a STATIC library. 2010-09-07 22:29:56 +00:00
Luis Ibanez
dc700d5d50 ENH: Now verifies if the OPJ_STATIC macro is not
already defined, before it defines it.
2010-09-07 22:24:12 +00:00
Luis Ibanez
00f7af7748 ENH: Including the new header file openjpegConfigure.h
in order to carry the definition of OPJ_STATIC 
     when building static libraries.
2010-09-07 22:05:17 +00:00
Luis Ibanez
9989de4bd0 COMP: adding trunk/codec/compat to the list of directories
that must be searched for header files.
2010-09-05 22:52:44 +00:00
Luis Ibanez
fcbf45ca64 ENH: Removed redundant copies of getopt.c and getopt.h.
Now reusing the ones in codec/compat.
2010-09-05 21:59:25 +00:00
Luis Ibanez
509f7a64ea ENH: The logic for defining OPJ_STATIC has now been moved to the
openjpegConfigure.h file.
2010-09-05 21:37:14 +00:00
Luis Ibanez
e80d147957 ENH: Adding symbols from traditional checks.
NOTE: the LCMS may still require CMake code for detecting the
     prescence of the library, of the use of CMake options for letting
     the user choose based on her preference.
2010-09-05 21:34:07 +00:00
Luis Ibanez
2cea89dc7d ENH: Adding a configured header file at the image of config.h. 2010-09-05 21:14:47 +00:00
Luis Ibanez
1a79adb3a9 COMP: PNG_LIBRARIES were missing for the TARGET_LINK_LIBRARIES command
of the executable targets.
2010-09-05 20:54:55 +00:00
Luis Ibanez
8dbd92f6c2 ENH: jpwl subdirectory is now build also on Unix systems.
As pointed out by Winfried and Antonin, there is no reason
     to exclude jpwl in Unix systems.
2010-09-05 20:50:17 +00:00
Luis Ibanez
d22912349b ENH: Grouping the logic that detects getopt.c into a single .cmake file.
Multiple directories were repeating this configuration independently.
The directory jp3d is expected to be self-suficient so it still does
the configuration directly.
2010-09-05 20:15:05 +00:00
Luis Ibanez
26e8f3fd28 COMP: Fixing configuration for static builds. Fixing dependencies that several
executables have on getopt.c, convert.c and index.c.

Some refactoring is going to be required in order to have a cleaner
configuration process and make it easier to maintain.
2010-09-01 00:52:26 +00:00
Luis Ibanez
86864a2f6c ENH: Silencing warnings from Visual Studio regardgin security of string functions, that can't be resolved in a multi-platform manner anywasys. 2010-08-31 23:44:21 +00:00
Luis Ibanez
7c65e4c14b STYLE: This file had inconsistent ends of line (mixture of DOS and UNIX). 2010-08-31 23:38:44 +00:00
Luis Ibanez
a56fbe42a4 COMP: Moving to the parent directory the set INCLUDE_DIRECTORIES command.
Given that files in "codec" look for files in "libjp3dvm", and files in
"libjp3dvm" look for header files in "codec".
2010-08-31 23:37:21 +00:00
Luis Ibanez
9427107b94 COMP: Remove requirement that png and tiff headers must be in a specific directory relative to this one. 2010-08-31 23:35:03 +00:00
Luis Ibanez
75c589958a BUG: The directory compat doesn't exist. The file getopt.c is actually at this level. 2010-08-31 23:27:19 +00:00
Antonin Descampe
3e8cad7e39 Update the XCode project file with JPWL targets 2010-08-30 10:15:32 +00:00
Antonin Descampe
e4c4d146e1 Update the README.cmake file : an instruction was missing to run the tests correctly. 2010-08-30 10:14:34 +00:00
Mathieu Malaterre
34e592341c Fix case 2010-08-11 08:47:21 +00:00
Antonin Descampe
94b9942cd9 Update README and Makefiles to promote cmake. Fix the README.cmake file. 2010-07-07 13:00:39 +00:00
Antonin Descampe
d5f9ea9fc2 Change CMakeLists.txt to build examples by default (image_to_j2k and j2k_to_image). 2010-07-02 12:44:22 +00:00
Mathieu Malaterre
f6ed93253b Need to include png/tiff include path 2010-07-01 17:33:51 +00:00
Mathieu Malaterre
3479749499 Synchronize branch and trunk cmakelists files 2010-06-29 19:09:10 +00:00
Mathieu Malaterre
89eafad589 Synchronize branch and trunk cmakelists files 2010-06-29 19:08:58 +00:00
Mathieu Malaterre
8bb5a19905 return error code upon errors 2010-06-29 19:08:45 +00:00
Mathieu Malaterre
84f77a71e5 Sync with v2 branch 2010-06-22 19:06:29 +00:00
Mathieu Malaterre
da0d29e4ab Merge with v2 branch 2010-06-22 17:32:19 +00:00
Mathieu Malaterre
f30f4c744e Also dump the image info as well as cp info. 2010-06-22 14:03:52 +00:00
Mathieu Malaterre
6621494d9d Apply patch from w. szukalski (sent to list). Mon, Jun 21, 2010 at 5:49 PM 2010-06-22 11:55:36 +00:00
Mathieu Malaterre
2374885ac0 adding j2k_dump executable 2010-06-21 13:21:11 +00:00
Luis Ibanez
784cf66dc2 ENH: Added custom configuration for CTest. This allows to fine tune
the selection of files for code coverage computation, and also
     allows to filter out acceptable compiler warnings.
2010-05-26 23:44:07 +00:00
Luis Ibanez
6c641471b2 ENH: Cleaning up the file comments. Setting the build time to 3am UTC. 2010-05-26 23:07:59 +00:00
Mathieu Malaterre
18c30c30d6 Remove automatic setting of BUILDNAME for now 2010-05-26 09:53:05 +00:00
Mathieu Malaterre
a1b6f1e096 Reactivate ctest 2010-05-26 09:45:12 +00:00
Mathieu Malaterre
a02c683572 Move to cmake 2.6. Add policy CMP0003 2010-05-26 09:34:01 +00:00
Antonin Descampe
8ecce4df3d Added CTestConfig.cmake to the root directory to incorporate the testing dashboard. 2010-05-26 09:00:06 +00:00
Antonin Descampe
9af159c200 MACOSX : Added a "build all" target to the XCode project file. 2010-05-26 08:25:06 +00:00
Antonin Descampe
b96b24ce8c MACOSX : Fixed the XCode project file to link with the PNG library. Library and header should be located in /usr/local/lib/ and /usr/local/include/, respectively. Check http://ethan.tira-thompson.org/Mac_OS_X_Ports.html if it is not the case on your mac. 2010-04-16 17:14:29 +00:00
Francois-Olivier Devaux
fdf04af271 [v1.4]Fixed issue 6 on google code. Variable "pi" not freed or pointed-to in function "pi_create_encode". Thanks to Kent Mein for reporting this.
[v1.4]Fixed problem with Borland C++ Builder (Borland C do not have lrintf). Thanks Marek Mauder for this fix.
2010-04-08 20:19:54 +00:00
Francois-Olivier Devaux
203a264f96 [v1.4] Fixed pi.c bug (issue 15 on google code). Thanks to Anton Lionel for catching this. 2010-04-08 18:43:03 +00:00
Francois-Olivier Devaux
b5ff4ffedc Fixed MJ2 codec bugs (issues 23-24 on google code). Thanks to Winfried for these patches. 2010-04-08 17:50:05 +00:00
Francois-Olivier Devaux
6628a4df45 Fixed JP3D codec file format analyzer. Thanks to Kristóf Ralovich for this patch. 2010-04-08 17:34:40 +00:00
Francois-Olivier Devaux
627f484bce Significant optimizations of MCT, DWT, MQ and T1 modules by Peter Wimmer (thanks Peter) 2010-04-08 17:22:58 +00:00
Francois-Olivier Devaux
d03779ee2a Added support for "jpc" codestreams which are equivalent to "j2c" codestreams [v1.4]. Thanks to Winfried for this patch 2010-03-26 16:07:08 +00:00
Francois-Olivier Devaux
3e4b0ee509 Added support for PNG image format [Not yet functional under WIN32]. Thanks to Winfried for this patch. See details here http://code.google.com/p/openjpeg/issues/detail?id=16 2010-03-26 15:46:17 +00:00
Francois-Olivier Devaux
54214fb65f Code improvements using 'g++-4.4.0' to trace the code (v1.4). Thanks to Winfried for this patch. 2010-03-24 11:20:45 +00:00
Francois-Olivier Devaux
3ecae15da2 Fixed small compatibility issues with win32 in codec (moved include <strings.h>) 2010-03-07 21:27:37 +00:00
Francois-Olivier Devaux
c2da8234d9 Updated makefiles for v1.4 and v2.0 2010-03-05 21:28:20 +00:00
Francois-Olivier Devaux
20d5c4c1a8 First import of OPJ_Validate tool 2010-03-05 21:17:11 +00:00
Francois-Olivier Devaux
34c485169e Applied changes to jp3d_to_volume.c that didn't pass in previous revision (rev545) 2010-02-19 13:37:27 +00:00
Francois-Olivier Devaux
cb4702b4c5 JP3D Module. Fixed issue when computing the number of elements in an array that leads to crash (thanks Kristof). Updated JP3D makefiles. 2010-02-18 16:36:21 +00:00
Francois-Olivier Devaux
c1a51d68a6 [FOD] Created a new constant in openjpeg.h to differentiate the case when the colorspace is not supported by the library and when it is not specified in the codestream. Suggested by Matteo Italia. 2010-01-20 15:44:13 +00:00
Antonin Descampe
9324bc4cd4 fixed MCT check bug in t1_getwmsedec. See http://groups.google.com/group/openjpeg/browse_thread/thread/d9d96dd4ec3e7443 for info 2009-11-06 12:52:54 +00:00
Antonin Descampe
449d7bedb6 fixed "tiffio" header inclusion to use user version on Win32 system only (otherwise assume its existence in system headers). 2009-11-05 16:39:02 +00:00
Antonin Descampe
bfd3fe8a4a fixed minor bugs which were triggering warnings at compilation (different signedness, wrong pointer type, etc) 2009-09-10 12:29:51 +00:00
Antonin Descampe
9dbbc6ca13 openjpeg.c : fixed initialization of parameters->cp_disto_alloc/fixed_quality/fixed_alloc/tcp_numlayers because they were preventing to use the -q and -f options. 2009-09-08 18:25:51 +00:00
Antonin Descampe
83abf56736 JavaOpenJpegDecoder.c : fixed a signed/unsigned behaviour when returning form C to JAVA 2009-08-31 13:18:20 +00:00
Mathieu Malaterre
a695c8eb51 ENH: fix svn properties 2008-10-01 16:01:23 +00:00
Mathieu Malaterre
a69db02b7f COMP: minor compilation warning 2008-10-01 16:00:42 +00:00
Antonin Descampe
73d8401465 found a bug in tcd.c that was preventing to find the correct threshold in tcd_rateallocate.c for high-precision images. Applied a temporary patch but a better solution should be found. 2008-08-22 16:18:17 +00:00
Antonin Descampe
4a90f97639 fixed a bug in image_to_j2k.c that was preventing the 'r' option to work properly (everything was compressed lossless regardless of the specified rate). 2008-08-21 16:00:44 +00:00
Francois-Olivier Devaux
4da178b0d8 Modified the way raw images with more that 8bpp are read and written 2008-08-08 13:15:36 +00:00
Antonin Descampe
f4bbad8615 Deleting v2 directory... Will be re-created as a branch 2008-07-31 11:22:44 +00:00
Parvatha Elangovan
cebdbda260 Added the default lossless parameter to opj_set_default_encoder_parameters in openjpeg.c 2008-07-09 11:43:02 +00:00
Antonin Descampe
1d45d7514b Initial commit of openjpeg version 2. Temprarily added as a separate directory in the trunk (will maybe be moved to a branch of version 1.3, this has to be investigated). 2008-07-04 11:27:40 +00:00
Antonin Descampe
846bd364be fixed a bug in dirent.h that prevented codec on Linux Alpha Systems to compile correctly. Thanks to RobinC. 2008-06-12 14:55:12 +00:00
Antonin Descampe
295ad6b112 fixed a bug in j2k.c (j2k_write_sod) that allowed to get negative rates, thanks zhong1985624 for pointing this. 2008-05-22 16:39:40 +00:00
Antonin Descampe
f4d394d932 additional test to avoid crash due to invalid image size, patch by Christopher Layne 2008-05-22 12:34:29 +00:00
Antonin Descampe
65e5ff0fb4 memory leak fixed in openjpeg.c (opj_destroy_cstr_info()), patch by Carsten Juttner 2008-05-22 09:54:44 +00:00
Antonin Descampe
2f3dd4916f updated XCode project file 2008-05-20 16:46:14 +00:00
Giuseppe Baruffa
a92cc111a2 Added help line for the -F option in j2k_to_image 2008-03-12 10:40:42 +00:00
Francois-Olivier Devaux
52296999f6 Changed Java files copyright in JavaOpenJPEG module 2008-03-04 10:56:03 +00:00
Francois-Olivier Devaux
9652def4de Corrected the wrong syntax of calloc()... 2008-02-29 09:36:12 +00:00
Francois-Olivier Devaux
6d1f3ecc9f Fixed openjpeg.c for proper initialization of codec context structures (dinfo in opj_create_compress() and opj_create_decompress(). Bug fix suggested by Andrey V. Kiselev
Clean up of opj_aligned_malloc(), to just forgo the use of posix_memalign(), as apparently memalign() is what is working better for everyone. Patch by Callum.
2008-02-29 09:33:41 +00:00
Francois-Olivier Devaux
396cb1e102 Removed the J2KViewer module, which has been replaced by OPJViewer and fixed the error handling of j2k_decode in jp2.c, thanks to Robin Cornelius 2008-02-28 11:26:04 +00:00
Giuseppe Baruffa
ac0cc6df62 Minor style modifications to comply with c99 compiler flag; removed Microsoft-specific "union-in-struct" syntax; Re-enabled cstr_info struct creation when -W switch is specified. Changed a number of things in opjviewer (e.g., decoding thread does not execute GUI calls anymore), to have it running under linux --> it is better than before, but still crashes 2008-02-11 14:43:11 +00:00
Parvatha Elangovan
29ea3dde47 In convert.c, corrected imagetobmp() conversion for grayscale. In tcd.c, corrected Rate modification in tcd_init_encode(). 2008-02-05 15:15:38 +00:00
Giuseppe Baruffa
e21d865440 In opjviewer, unification of JPEG 2000 family handlers (*.jp2, *.mj2, *.j2k) in a single file 2008-01-31 14:36:06 +00:00
Francois-Olivier Devaux
04966097fc In image.c, changed the opj_image_create0() memory allocation from malloc() to calloc() in order to avoid segfaults when freeing the memory allocated for the coding of bad images. Thanks to Christopher Layne for this improvement. 2008-01-22 10:35:26 +00:00
Antonin Descampe
8c2ae8b03d update of openjpeg XCode project file (2) 2008-01-18 10:30:24 +00:00
Antonin Descampe
9947453ea8 update of openjpeg XCode project file 2008-01-18 10:29:16 +00:00
Francois-Olivier Devaux
4514e333c6 SVN server problem. Added again MJ2 project files to try to solve issue. 2008-01-17 11:57:04 +00:00
Francois-Olivier Devaux
daff186ceb SVN server problem. Removed MJ2 project files to try to solve issue. 2008-01-17 11:52:32 +00:00
Antonin Descampe
8359fbd5e7 Initial commit of Xcode project directory (XCode 2.5 for macosx). Available targets : libopenjpeg (stat and dyn), image_to_j2k, j2k_to_image 2008-01-17 10:48:51 +00:00
Antonin Descampe
13209d2565 fixed opj_malloc.h for macosx (bugfix provided by janpeder, thanks) 2008-01-16 19:01:13 +00:00
Antonin Descampe
9a6f0596b0 remove obsolete directory "CVSROOT" 2008-01-16 17:54:47 +00:00
Antonin Descampe
901308cbc8 update makefile.osx and readme.osx to comply with version 1.3 2008-01-16 17:17:05 +00:00
Francois-Olivier Devaux
ea6d8f5aaf Added missing files to JavaOpenJPEG project (files from Patrick Piscaglia) 2008-01-11 09:33:45 +00:00
Parvatha Elangovan
4051e87d06 Patch by Callum Lerwick. Fixed error during encoding using tile option in tcd.c 2008-01-04 15:43:57 +00:00
Francois-Olivier Devaux
4619a94ebf VERSION 1.3.0 RELEASE 2007-12-21 10:39:41 +00:00
Francois-Olivier Devaux
287fb0b8fd Bug fixed by David Bruken. Fixed memory allocation issue in opj_malloc.h.
Possible errors in pi_create_encode handled
2007-12-21 10:19:01 +00:00
Antonin Descampe
847b082b64 changed variables names alpha, beta, gamma, delta in dwt.c to avoid re-declarations on Macosx 2007-12-19 14:45:35 +00:00
Francois-Olivier Devaux
5f995bcf4b Fixed allocation problem in pi.c 2007-12-19 13:57:57 +00:00
Parvatha Elangovan
64ed560f4f In pi.c, removed the Recursive function pi_check_next_level() and modified the code. 2007-12-19 12:28:40 +00:00
Francois-Olivier Devaux
1a33a09726 In mqc.h, changed MQC_NUMCTXS from 32 to 19 as JPEG 2000 only allows 19 possible contexts 2007-12-19 09:13:52 +00:00
Francois-Olivier Devaux
26606c71c8 First import of JAVAOpenJPEG, a Java wrapper of OpenJPEG, developed by Patrick Piscaglia of Telemis (www.telemis.com). Thank you Patrick for this new module ! 2007-12-10 13:16:01 +00:00
Giuseppe Baruffa
e06bcd027f Added index.h and index.c in VC6 projects; wrapped index.h in the C++ preprocessor; modified OPJViewer project and some files. 2007-11-29 14:38:26 +00:00
Francois-Olivier Devaux
9e5d165e79 Fixed the maximum number of resolutions a user can discard while decoding.
Added an error state in J2K_STATE (j2k.c)
2007-11-27 14:00:45 +00:00
Francois-Olivier Devaux
efa5f7977c Created the file index.c in the codec directory. This file handles the creation of index files, at encoding and decoding.
Fixed bugs during the creation of the index (PCRL progression order)
2007-11-27 12:38:52 +00:00
Francois-Olivier Devaux
c458af9cd6 Avoided ABI breakage 2007-11-14 11:34:48 +00:00
Francois-Olivier Devaux
010ae27471 Patch by Callum Lerwick. The opj_tcd_cblk array is one of the largest allocations, because it contains a bunch of static buffers. This also makes it a major source of cache thrashing. This patch allocates the buffers from the heap, and dynamically sizes them in the decoder. I have not yet managed to dynamically size them in the encoder, getting the decoder to do it was tricky enough... I also split opj_tcd_cblk_t into separate encode and decode versions. A lot of fields were not used by both, so this cuts its size even further. 2007-11-14 10:52:02 +00:00
Francois-Olivier Devaux
24e189e4d8 Patch by Callum Lerwick. This patch rearranges the largest memory allocations so they're allocated as late as possible, and freed as soon as possible. This cuts memory usage by about half on two large test images. 2007-11-14 08:45:00 +00:00
Francois-Olivier Devaux
61a15672bb Patch by Callum Lerwick. Instead of reinventing realloc, j2k_read_sod now just uses opj_realloc in j2k.c 2007-11-14 08:29:12 +00:00
Francois-Olivier Devaux
dbeebe72b9 Patch by Dzonatas and Callum Lerwick. Fp/vectorization patch which basically converts most of the irreversible decode codepath to floating point, eliminating a few rounds of int/fp conversion, resulting in a vast performance improvement, and an increase in accuracy. 2007-11-13 17:35:12 +00:00
Mathieu Malaterre
014694b04f BUG: Fix name of project 2007-11-08 14:52:45 +00:00
Mathieu Malaterre
6a1588c78e ENH: remove hardcoded value. It is a user-configurable option, which default to the same... 2007-11-08 14:46:53 +00:00
Mathieu Malaterre
6d7f5ccc8d ENH: do not set ffast-math for all configurations, please 2007-11-08 14:41:45 +00:00
Francois-Olivier Devaux
4bb067642f Patches from Callum Lewick: Fixed some spelling errors in dwt.c. 2007-11-08 14:29:39 +00:00
Francois-Olivier Devaux
c38de0728d In t1.c, small change to avoid calling twice t1_getwmsedec()
Patch from Callum Lewick. Basic gcc optimization flags in cmake and makefile match.
2007-11-08 14:26:03 +00:00
Giuseppe Baruffa
b93c12564d Restoring wrap_j2k_in_mj2.c, which I did not want to commit at all in rev469 2007-11-05 13:14:51 +00:00
Giuseppe Baruffa
95d760a173 Fixed a bug which prevented JPWL from working on multi-tiled images; added some more fields in the interface info structures (keep a list of markers, save start packet number for each tile) 2007-11-05 13:05:07 +00:00
Giuseppe Baruffa
123a680669 Improved success for the linux build; OPJViewer shows all the COM contents 2007-10-23 14:33:40 +00:00
Francois-Olivier Devaux
9e114bcaa4 Patch from Callum Lewick. Memset patch. See ChangeLog for more details. Thanks Callum ! 2007-10-18 12:26:11 +00:00
Francois-Olivier Devaux
5fdc05d18d Changed the ROI parameter in the image_to_j2k codec to make it correspond to the documentation (i.e. -ROI c=0,U=25) 2007-10-18 08:14:43 +00:00
Francois-Olivier Devaux
1f11a4fe90 Changed the way the image structure is allocated when the decoding parameters include some resolutions to discard. This should have a significant impact for the decoding of huge images when some resolutions are discarder (-r parameter)
Warning: The output image size is now reduced when discarding resolutions !
2007-10-12 15:04:34 +00:00
Francois-Olivier Devaux
ab0473aa42 *Patch from Callum Lewick. Clean up of j2klib.h for the aligned malloc stuff.
*convert.c: Changed some error comments for TIFF images
2007-10-10 06:17:28 +00:00
Francois-Olivier Devaux
4b60f17bba Patch from Callum Lewick. Fixed dwt.c where an alignment in buffer was problematic under x86_64. 2007-09-27 12:20:12 +00:00
Mathieu Malaterre
6265dcfb11 BUG: Fix previous patch from Callum Lerwick. I have no clue what CMAKE_INSTALL_LIBDIR refers too. Bump up cmake 2.2 restriction to cmake 2.4 because of previous patch not backward compatible. Properly set the SOVERSION in a cross plateform way (yes WIN32 is a plateform) 2007-09-25 14:54:49 +00:00
Parvatha Elangovan
7e40a9475a Fixed issues with generation of SOP marker. 2007-09-19 14:56:19 +00:00
Parvatha Elangovan
a6ba04cdf4 Fixed issues with Reading and Writing TIF images in convert.c to avoid segmentation fault.
Fixed issues relating to using user specified rates for CINEMA option for multiple images.
2007-09-18 13:07:29 +00:00
Francois-Olivier Devaux
55c4c14352 OpenJPEG library interface modified to retain compatibility with version 1.2. Sorry if some of you already adapted their code to the previous interface, but we want to avoid a ABI break.... 2007-09-17 15:11:20 +00:00
Francois-Olivier Devaux
569bbb0077 Fixed issues with cstr_info when codestream has components with different number of resolutions. 2007-09-17 14:00:43 +00:00
Francois-Olivier Devaux
abfba20b99 Patch from Callum Lerwick. Fixed the library linking so it links with the soversion properly set. Fixes up the install targets so that it interacts properly with RPM. Install target for MJ2. Sets some necessary and useful CFLAGS if gcc is in use. 2007-09-12 09:04:03 +00:00
Francois-Olivier Devaux
09231c317d Updated the MJ2 codec to be compatible with the recent changes in the OpenJPEG library. 2007-09-12 08:52:18 +00:00
Giuseppe Baruffa
1e705438e4 JPWL encoding is finalized correctly into the JP2 file format; added an additional structure in opj_codestream_info, to keep a record of the written markers 2007-09-11 15:21:12 +00:00
Giuseppe Baruffa
d70a0415b9 Adapted the JPWL and OPJViewer code to new interface; fixed a samll bug in JPWL which created large EPBs even when null protection was specified 2007-09-07 23:16:31 +00:00
Francois-Olivier Devaux
3816e0edf4 Indexes can now be generated when decoding J2K codestreams. 2007-09-07 15:01:55 +00:00
Mathieu Malaterre
e7149e0c56 ENH: license.txt was dos on my linux box. Make it native instead. 2007-09-07 13:52:43 +00:00
Mathieu Malaterre
3392d99487 BUG: cannot run tests if EXAMPLES are not built 2007-09-07 13:49:57 +00:00
Mathieu Malaterre
263e0f3bb2 ENH: make it a little more user friendly 2007-09-07 13:27:16 +00:00
Mathieu Malaterre
b29cff9b9c ENH: Add cmake code to do testing if user has properly setup a testimages directory 2007-09-07 13:21:17 +00:00
Mathieu Malaterre
2479921c71 ENH: Upon failure, properly return error code (!=0) 2007-09-07 13:06:36 +00:00
Mathieu Malaterre
53471a76f1 ENH: Fix unitialized read in img_fol (we may need a smarter initialize than memset) 2007-09-06 16:49:15 +00:00
Mathieu Malaterre
8ac5e7023c ENH: Add very simple tests (simply run command line with no option) 2007-09-06 16:38:06 +00:00
Giuseppe Baruffa
dfcacb8247 One more field in the codestream_info struct for recording the number of packets per tile part; JPWL now distributes the EPBs in all the tile part headers 2007-09-06 15:59:39 +00:00
Mathieu Malaterre
cf95a80be6 ENH: Add CMake/doxygen output 2007-09-06 15:10:15 +00:00
Mathieu Malaterre
be5db9489e ENH: add Java j2kviewer but do not compile it using cmake since cmake has too poor support for Java. Should create a custom command running ant instead. 2007-09-06 14:56:23 +00:00
Mathieu Malaterre
f3456a27e7 ENH: add Java j2kviewer but do not compile it using cmake since cmake has too poor support for Java. Should create a custom command running ant instead. 2007-09-06 14:56:00 +00:00
Mathieu Malaterre
375754f1e6 ENH: CMake: start compiling index_create. OpenJPEG.rc update copyright year 2007-09-06 14:46:24 +00:00
Mathieu Malaterre
f9c5f4565a ENH: CMake: output all executable/libs into one single directory 2007-09-06 11:01:10 +00:00
Mathieu Malaterre
86da5c2589 ENH: CMake: output all executable/libs into one single directory 2007-09-06 11:01:00 +00:00
Mathieu Malaterre
23891ede86 ENH: update changelog 2007-09-06 10:53:41 +00:00
Mathieu Malaterre
b4dc6fc133 ENH: add cmake for jp3d 2007-09-06 10:51:38 +00:00
Mathieu Malaterre
0533b5b78e Move include file that collides with system include to the correct directory (no need to be present for the lib, only codec need it) 2007-09-06 10:49:19 +00:00
Mathieu Malaterre
976ca18103 ENH: Add jpwl. Also remove old deprecated way of linking lib math on unix 2007-09-06 10:23:40 +00:00
Mathieu Malaterre
7e874368f7 ENH: Start building mj2 2007-09-06 10:13:05 +00:00
Giuseppe Baruffa
d3d2a36fbc Added some fields in the codestream_info structure: they are used to record the position of single tile parts. Changed also the write_index function in the codec, to reflect the presence of this new information. 2007-09-04 14:19:55 +00:00
Giuseppe Baruffa
564e16d5ce Added the knowledge of JPSEC SEC and INSEC markers (you have to compile the JPWL project). Management of these markers is limited to skipping them without crashing: no real security function at this stage. Deprecated USE_JPSEC and USE_JPWL will be removed next 2007-09-03 13:30:59 +00:00
Giuseppe Baruffa
c4313f0b39 Fixed save capabilities in OPJViewer due to recent code upgrade 2007-08-31 10:55:15 +00:00
Francois-Olivier Devaux
7a2d96efe1 Added information regarding the end of packet position in the index 2007-08-30 15:32:51 +00:00
Francois-Olivier Devaux
acfe0ad645 Changed the OpenJPEG library interface to enable users to access information regarding the codestream (also called index). 2007-08-30 09:51:20 +00:00
Francois-Olivier Devaux
d07fa5d9d0 Fixed wrong destructors called in openjpeg.c
Fixed bug in j2k_decode_jpt_stream
2007-08-28 10:13:58 +00:00
Parvatha Elangovan
c101f8049c The end of main header is calculated after TLM and POC marker for Dcinema. 2007-08-24 15:11:01 +00:00
Francois-Olivier Devaux
bd0b6ec2fd Fixed problem with _mm_malloc under OSX. Thanks to Callum Lerwick for solving that issue. 2007-08-24 13:46:44 +00:00
Francois-Olivier Devaux
1d02a8b595 Use <xmmintrin.h> for WIN32, else use <mm_malloc.h> 2007-08-21 12:57:39 +00:00
Francois-Olivier Devaux
07be749bf2 Moved the orient flipping into the ctxno_zc table.
Thanks to Callum Lerwick who provided all these great patches !
2007-08-21 12:51:57 +00:00
Francois-Olivier Devaux
2952874cb8 Replaced the large ctxno_mag lookup table with a small bit of inline-able branchless code 2007-08-21 12:42:55 +00:00
Francois-Olivier Devaux
1cfbdcc9ce Consolidated some calls to mqc_setcurctx. Cleaned up t1_generate_luts to output the proper types. 2007-08-21 12:36:05 +00:00
Francois-Olivier Devaux
d4d23c7eb5 Reworks of t1_updateflags to get rid of the shift operation. mqc_setcurctx moved to the header to allow it to be inlined into the t1. 2007-08-21 12:30:08 +00:00
Francois-Olivier Devaux
adca52578d Memory leaks fixed 2007-08-21 12:21:35 +00:00
Francois-Olivier Devaux
3810e943b1 Aligned malloc using Intel's _mm_malloc(), cleanup on the t1 memory allocation, getting rid of some leftover debug code 2007-08-21 12:13:54 +00:00
Francois-Olivier Devaux
ca2a0114a2 Minor cleanup patch, that gets rid of a bunch of "old style declaration" warnings from Intel's compiler 2007-08-21 12:02:23 +00:00
Francois-Olivier Devaux
2c75c27ee8 Solved problems with codec reading from image file directory when filename had more than one "." in name 2007-08-21 10:50:47 +00:00
Francois-Olivier Devaux
1d0dbeb232 Robustified MJ2 codecs 2007-08-21 10:18:40 +00:00
Francois-Olivier Devaux
d9924962ff Added support for Visual Studio 2005 2007-08-21 10:17:35 +00:00
Francois-Olivier Devaux
00e440ebdb Corrected allocation to take into account the EOC marker 2007-08-21 09:06:13 +00:00
Francois-Olivier Devaux
17f0828c74 Fixed _strnicmp bug 2007-08-20 15:26:01 +00:00
Francois-Olivier Devaux
8298fd2b0a Added support for the TGA file format in the codec 2007-08-20 15:20:42 +00:00
Francois-Olivier Devaux
7dcb817e6a Fixed the DCinema filesize allocation. It now includes the SOT marker size 2007-08-08 09:41:16 +00:00
Giuseppe Baruffa
9cf692e897 Added a basic saving capability to OPJViewer 2007-08-02 12:45:28 +00:00
Francois-Olivier Devaux
4f4aa1d49f Lighter version of libtiff uploaded (without JPEG support). 2007-07-19 15:04:39 +00:00
Francois-Olivier Devaux
9e5a83d8f9 Delete Tiffconf.h 2007-07-19 13:49:33 +00:00
Francois-Olivier Devaux
c45b8e6c38 Updated libtiff library version to 3.8.2 (for WIN32)
Updated BMP and PxM truncation when decoding J2K files with more than 8 bits (convert.c)
2007-07-19 13:44:04 +00:00
Francois-Olivier Devaux
64d72b7bfd Fixed raw option to encode raw images with more than three components. 2007-07-18 09:45:59 +00:00
Francois-Olivier Devaux
b7ce19709d Added support for RAW images. This module has been developped by the University of Perugia team. Thanks to them ! 2007-07-17 16:19:41 +00:00
Francois-Olivier Devaux
5dec8bbbe9 2007-07-13 13:07:07 +00:00
Giuseppe Baruffa
4a50efe542 Fixed a bug in JPWL module, which prevented to exploit the full error correction capability of RS codes (e.g. it gave up at 5 errors, even if 6 were correctable); defined a JPWL_MAXIMUM_EPB_ROOM for better customization of the maximum dimension of EPBs (the dimension is pre-calculated on an hypothesis, if it goes beyond 65535 there will be problems, thus we give a little less than the max, let's say 65450) 2007-07-12 08:31:01 +00:00
Antonin Descampe
bdb18ab19c fixed the size of the memory allocation in cio.c (confusion between bits and bytes) 2007-07-08 16:38:51 +00:00
Giuseppe Baruffa
167fb6337b Previous, home, and next frame buttons for exploring MJ2 files in OPJViewer 2007-06-21 14:00:32 +00:00
Francois-Olivier Devaux
c924975434 Output image color space set when decoding a JP2 file 2007-06-21 08:26:03 +00:00
Giuseppe Baruffa
92398409a5 Reload image doesn't crash in OPJViewer; more settings saved to registry 2007-06-18 13:05:28 +00:00
Giuseppe Baruffa
c647671607 added toolbar to OPJViewer 2007-06-17 23:13:04 +00:00
Giuseppe Baruffa
2845d9bf64 Possibility to disable parsing in OPJViewer; also, saves common settings to the registry; automatic build numbering 2007-06-16 17:28:47 +00:00
Francois-Olivier Devaux
3d626da232 Fixed the generation of index files. Now works with cinema formats. 2007-06-15 13:27:43 +00:00
Antonin Descampe
f428a306a1 changed the dylib-version to 1.2.0 2007-06-05 09:00:34 +00:00
Francois-Olivier Devaux
aec1d7592c Tipo corrected... 2007-06-04 13:32:25 +00:00
Francois-Olivier Devaux
21f2cab710 Release of version 1.2.0 2007-06-04 13:27:25 +00:00
Francois-Olivier Devaux
ea9335ff48 Bugs corrected in decoding of command line (getopt.c), in the handling of 16 bit files (t1.c and tcd.c) and the calculation of elapsed time for multiple tiles parts (tcd.c and tdc.h). 2007-06-04 13:23:26 +00:00
Giuseppe Baruffa
adc1aacb60 OPJViewer opens now BMP, PNG, GIF, PNM, TIFF (with wxWidgets internals); added an encoder settings tab, for future integration with "save file as..." in JPEG 2000 format 2007-06-03 17:34:46 +00:00
Francois-Olivier Devaux
814bab6900 Fixed the handling of 16bit TIFF files for cinema compression. Modified "convert.c".
Fixed the parameters used for cinema compression (9-7 transform used instead of 5-3). Modified "image_to_j2k.c"
2007-05-31 09:13:44 +00:00
Francois-Olivier Devaux
1f55aaf4a6 Bug fixed by Sylvain Munaut. Change in the reading of the POC marker. Since COD/COC can be anywhere in the header, the decoder cannot always know while decoding the POC marker the value of numlayers and numresolution. 2007-05-23 16:04:50 +00:00
Francois-Olivier Devaux
8be8111008 Patch suggested by Callum Lerwick <seg@haxxed.com>: "This makes the t1 data arrays dynamic, which greatly reduces cache thrashing. Also, some minor cleanup to prevent unnecessary casts" 2007-05-22 13:14:13 +00:00
Francois-Olivier Devaux
1bec8fe082 Patch suggested by Callum Lerwick <seg@haxxed.com>: "Some formatting cleanups, so that the long function definitions and calls fit on screen. Use of prefix increment which is theoretically faster, in
practice any sane compiler can optimize a postfix increment but its best not to count on such things. Consolidation of some redundant calculations in the inner loops, which becomes very useful in the future autovectorize patch."
2007-05-21 13:08:10 +00:00
Francois-Olivier Devaux
7d06d7fb5d Patch suggested by Callum Lerwick <seg@haxxed.com>: "This changes the flag code in t1 to use a flag_t type, which can then be changed to reduce RAM usage. It is now typedef to a short." 2007-05-21 12:50:03 +00:00
Francois-Olivier Devaux
e0ee9becb4 Patch suggested by Callum Lerwick <seg@haxxed.com>: "This patch makes the t1 LUTs static. I actually intend this as a prelude to possibly eliminating some or all of the LUTs entirely." 2007-05-21 09:44:10 +00:00
Francois-Olivier Devaux
0afa3c70bc Changlog updated 2007-05-15 14:02:03 +00:00
Francois-Olivier Devaux
38137b033a JP3D library Binaries removed from SVN. 2007-05-10 14:34:05 +00:00
Francois-Olivier Devaux
1200dd871a MJ2 codec updated from LibOpenJPEG version 0.97 to LibOpenJPEG version 1. Hence, the MJ2 codec will now take advantage of all the improvements and optimizations done on the LibOpenJPEG library. 2007-05-10 14:21:09 +00:00
Francois-Olivier Devaux
f3170bf64e Possibility to choose to apply MCT (multiple component transform) enabled, and new decoding_limit: DECODE_ALL_BUT_PACKETS 2007-05-10 14:13:30 +00:00
Giuseppe Baruffa
7c9dc11e33 workarounds for rendering differently sized components 2007-04-27 17:20:26 +00:00
Mathieu Malaterre
848214e789 ENH: add basic instructions for cmake 2007-04-26 09:09:29 +00:00
Mathieu Malaterre
e5240301c7 ENH: add basic instructions for cmake 2007-04-26 09:08:10 +00:00
Francois-Olivier Devaux
2bd0f7b8c4 Modification of the openjpeg.h file to avoid and ABI break with v1.1, removed the dangerous #IFDEF JPWL and added tcp_mct in cparameters. 2007-04-25 17:04:21 +00:00
Giuseppe Baruffa
fbc9a5edcb enable/disable decoding in OPJViewer 2007-04-22 22:41:01 +00:00
Parvatha Elangovan
110b54c7c6 Fixed Error in tiftoimage(). Modification in convert.c. 2007-04-12 10:01:48 +00:00
Parvatha Elangovan
dbd132dca8 Accepting "j2c" as format for Encoding and Decoding. Modification in image_to_j2k.c.
Modified imagetotif() to read images with signed data. Modification in convert.c.
2007-04-10 16:23:48 +00:00
Francois-Olivier Devaux
0930d9886b fix.h, dwt.c and t1.c optimized. Thanks a lot to Dzonatas <dzonatas at dzonux.net> and Callum Lerwick <seg at haxxed.com> for these great patches ! 2007-04-05 14:24:19 +00:00
Parvatha Elangovan
dd18811600 Digital cinema compliance for 4K chosen by "-cinema4K" option. Modification in image_to_j2k.c.
Bit rate limitation for each color component. Modification in image_to_j2k.c, t2.c.
Modified and tested Progression order change "-POC" option. Modification in image_to_j2k.c, j2k.c, pi.c.
Function j2k_check_poc_val() to check for possible loss of packets in case of wrong POC declaration. Modification in j2k.c.
Structure T2_MODE. This tells if the t2_encode_packets() is called during Threshold calculation or in Final pass. Modification in j2k.h, tcd.c
2007-04-04 13:40:32 +00:00
Francois-Olivier Devaux
24146a96cf Included the license in a distinct file, which allows other projects using OpenJPEG to
include it into the built package in a legally unambiguous manner.
2007-04-04 06:19:26 +00:00
Giuseppe Baruffa
7dd3a5bf22 OPJViewer should now work under Linux, at least with not big j2k files. Tested under Suse 10.1 64 bit. 2007-03-30 09:27:08 +00:00
Parvatha Elangovan
9ba672366e Enable accepting file names with `-´ symbol .Modification getopt.c
Rsiz profile name generation to be STD_RSIZ for profiles which are not DCI compliant.Modification in image_to_j2k.c
Renamed convert_progression_order to j2k_convert_progression_order. Modification j2k.c
Calculation of number of tile part in each tile in j2k_calculate_tp. Modification j2k.c
j2k_setup_encoder to set bit rate limitation for digital cinema compliance with quality option. Modification in j2k.c
Equation to check multiple tile precincts. Modification pi.c
array size generation of pi->include in pi_initialise_encode().Modification in pi.c
Modification in pi_create_encode for tile part generation.Modification in pi.c
In tcd_rateallocate a variable stable_threshold which holds the valid threshold value. This is used to avoid error in case of a wrong threshold value in the last iteration. Modification in tcd.c.
2007-03-29 14:15:14 +00:00
Giuseppe Baruffa
a1fe5809a4 Some coding style adaptations for compiling the OPJViewer GUI under Linux. It compiles, but does not yet display images. 2007-03-29 08:27:03 +00:00
Francois-Olivier Devaux
5a3c1ffe7d Fixed an historical bug in t1.c that leaded to the inclusion of useless 0xFF in the codestream. Thanks to Sylvain, Pascal and Parvatha ! 2007-03-28 08:44:21 +00:00
Giuseppe Baruffa
144e1ff4e6 Following to Hervé's suggestions, all the exit() calls, added by JPWL strict checking in t2.c and j2k.c, have been substituted with (object free'ing + opj_evt_message(EVT_ERROR) + return); added linking to TIFF library in the JPWL VC6 workspaces 2007-03-27 17:18:56 +00:00
Giuseppe Baruffa
3f36196dfd Improved parsing in OPJViewer, as well some aesthetic modifications; support for image rendering with bit depths lower than 8 bits; can display an arbitrary frame of an MJ2 file (only in B/W, though); can reload a file; better image resizing capabilities 2007-03-27 12:48:17 +00:00
Antonin Descampe
f7c9b01800 Fixed Makefile.osx and changed Readme.osx accordingly 2007-03-23 14:08:15 +00:00
Parvatha Elangovan
6045158ce6 Fixed j2k_prog_order_list[]. Modifications in j2k.c.
Fixed t1_decode_cblks. Modifications in t1.c.
2007-03-21 13:01:15 +00:00
Parvatha Elangovan
694a173adb Added feature for generation of tile parts. Modifications in image_to_j2k.c, openjpeg.c, j2k.c, pi.c
Added function j2k_write_tlm(),to generate TLM marker for a Digital cinema compliant codestream. Modifications in j2k.c.
2007-03-20 17:15:18 +00:00
Francois-Olivier Devaux
8bc6da2ffa Fixed linux makefile, with help from David Fries and Guido 2007-03-14 07:35:54 +00:00
Parvatha Elangovan
78003a016a Added option for Digital cinema profile compliant codestream. This can be chosen by "-cinema2K" or "-cinema4K" for a 2K and 4K compliance respectively. The feature for tileparts has not been implemented in this version. Modification in image_to_j2k.c
Added the Digital Cinema profiles (CINEMA2K and CINEMA4K) to the list of profiles recognized in the codestream SIZ marker segment. Modification in openjpeg.h,j2k.c
Added feature for constant quality within bitrate defined in Digital cinema standards. Modification in tcd.c
Modified the method of generation of buffer length. Modification in cio.c
2007-03-07 16:04:33 +00:00
Francois-Olivier Devaux
9e5d0b1a40 Modified codec projects (*.dsp) and makefile to include the tiff library (modified codec/image_to_j2k.dsp codec/j2k_to_image.dsp and codec/makefile) 2007-03-01 16:12:17 +00:00
Mathieu Malaterre
219dd65bef COMP: Fix compilation of executable linking to TIFF lib. 2007-03-01 14:39:31 +00:00
Giuseppe Baruffa
ba423fe3d0 Zoom capability and decoder settings dialog in OPJViewer 2007-03-01 00:01:37 +00:00
Giuseppe Baruffa
e2a54d9ac6 Modified JPWL libopenjpeg library by directly embedding the JPWL functions 2007-02-28 23:43:37 +00:00
Antonin Descampe
44ab0ccf01 add an "ifdef WIN32" to "include malloc.h" to be compliant with non-WIN32 platforms. 2007-02-28 15:55:03 +00:00
Parvatha Elangovan
192e46c32f Enabled compression of TIF image format to j2k by tifftoimage() and decompression of codestream to TIF image format using imagetotif(). Modifications in image_to_j2k.c, j2k_to_image.c, convert.c, convert.h 2007-02-28 15:31:56 +00:00
Antonin Descampe
e5c5d1064e fixed a bug in context numerotation that prevented the RESET switch to work correctly : mqc_reset_enc in mqc.c 2007-02-28 14:27:20 +00:00
Francois-Olivier Devaux
2fb6da8d85 Corrected codec Makefile by adding the compilation of "compat/getopt.c" 2007-02-28 13:56:06 +00:00
Parvatha Elangovan
fd680a1cf0 Made get_file_format function more robust. Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h 2007-02-27 14:19:09 +00:00
Parvatha Elangovan
313c772f4a Added the dirent.h file used for opening and reading Directory holding image files. Used in image_to_j2k.c and j2k_to_image.c. 2007-02-27 08:54:56 +00:00
Parvatha Elangovan
0781b7d441 Option to read images from a Folder whose path is specified in the Input parameters by "-ImgDir" along with output decod format specified by "-OutFor" . Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
Enabling use of multi character input parameters in the codec. Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
2007-02-26 15:40:01 +00:00
Giuseppe Baruffa
e6ce7958f2 Added makefile for linux build of JPWL module; added newlines at the end of JPWL files 2007-02-23 18:24:49 +00:00
Francois-Olivier Devaux
d268ea7d6a Changed version number from 1.1.0 to 1.1.1 in openjpeg.h 2007-02-23 10:48:11 +00:00
Giuseppe Baruffa
0eaafe93ac Added Readme file for OPJViewer 2007-02-23 08:59:46 +00:00
Giuseppe Baruffa
8a75823eea Fixed a copy-and-paste type assignment error (bool instead of int) in the JPWL section of decoder parameters structure in openjpeg.h; minor type-casting in jpwl_lib.c. As a result, now OPJViewer should run correctly when built against the most current SVN trunk of LibOpenJPEG.lib 2007-02-23 01:23:05 +00:00
Francois-Olivier Devaux
e841b13166 Added the OPJViewer Module (/OPJViewer), developed by Giuseppe Baruffa of the University of Perugia 2007-02-22 17:05:58 +00:00
Francois-Olivier Devaux
7cb2194c8e Algorithmic optimizations in t1.c, thanks to Guido J. ! 2007-02-21 07:57:27 +00:00
Francois-Olivier Devaux
eac141b69a Added OPJ_LIMIT_DECODING enabling us to limit the decoding to main header 2007-02-19 09:59:29 +00:00
Francois-Olivier Devaux
d084ff59f2 David Fries suggestions. In image_to_j2k and j2k_to_image, strncpy() functions: instead of specifying the path size macro, let the compiler read the length out of the array entry. 2007-02-13 09:00:37 +00:00
Francois-Olivier Devaux
dcc6f679bc Change file modified. -fPIC flag used for 64-bit compilation. Move operation (rather than copy) for the dist library creation, and -p flag added. 2007-02-13 08:49:00 +00:00
Francois-Olivier Devaux
3f5e8eb92b Extra tokens at the end of #endif directive corrected in openjpeg.c, j2k.c and image_to_j2k.c -> no more warnings in linux compilation 2007-01-31 15:19:54 +00:00
Francois-Olivier Devaux
16879e20ec Linux Makefile for the codec added 2007-01-31 14:58:22 +00:00
Francois-Olivier Devaux
b700cd9101 Linux Makefile for the codec added 2007-01-31 14:57:26 +00:00
Francois-Olivier Devaux
a6d7377213 Use of OPJ_PATH_LEN (defined as 4096) to be the maximum allowed size for filenames instead of MAX_PATH which is not always defined. This caused some programs using OpenJPEG to crash. Modifications in openjpeg.h j2k_to_image.c and image_to_j2k.c 2007-01-30 10:51:29 +00:00
Francois-Olivier Devaux
d48feb45fc Correction of the syntax usage (line 36) 2007-01-30 10:43:56 +00:00
Francois-Olivier Devaux
b5c8558934 ! [FOD] Modification in the context numbers, to reflect what has been specified in standard, in libopenjpeg/t1.h 2007-01-23 11:43:21 +00:00
Francois-Olivier Devaux
521b9bef33 Modification of the context numbers, to reflect what has been specified in standard. 2007-01-23 11:41:16 +00:00
Francois-Olivier Devaux
ed3aec55fd Copyright update 2007-01-15 09:55:40 +00:00
Francois-Olivier Devaux
ef560f19a3 JP2 module: Tests during encoding if the number of components respects the JPEG 2000 standard. 2007-01-03 15:41:50 +00:00
Giuseppe Baruffa
6b9d244449 Definition of USE_JPWL in doxygen file for building the corresponding documentation on JPWL module; creation of README file in JPWL directory 2006-12-13 11:50:24 +00:00
Francois-Olivier Devaux
16dc670030 MJ2 codec restructuration. Update of dsp project files properties 2006-12-08 17:51:18 +00:00
Francois-Olivier Devaux
acd2187a43 MJ2 codec restructuration. Update of project files (dsp, vcproj and makefile) 2006-12-08 17:49:30 +00:00
Francois-Olivier Devaux
b8445ebec0 MJ2 codec restructuration. Movec compat directory to MJ2_codec 2006-12-08 17:17:14 +00:00
Francois-Olivier Devaux
4b75a2784c MJ2 codec restructuration. Movec compat directory to MJ2_codec 2006-12-08 17:11:50 +00:00
Francois-Olivier Devaux
2b3947e8a8 MJ2 codec restructuration. Created MJ2_codec directory and moved MJ2 codec files to this directory, created libopenjpeg_097 directory and moved libopenjpeg files version 0.97 to this directory 2006-12-08 17:09:39 +00:00
Francois-Olivier Devaux
1c43ca006d MJ2 codec restructuration. Created libopenjpeg_097 directory and moved libopenjpeg files version 0.97 to this directory 2006-12-08 17:07:44 +00:00
Francois-Olivier Devaux
bc145d8dc8 MJ2 codec restructuration. Created MJ2_codec directory and moved M2 codec files to this directory 2006-12-08 17:04:31 +00:00
Giuseppe Baruffa
76ee6b8441 + Antonin verified that the MacOS build of JPWL module suffered from a missing definition of the "min" macro; I've added this into both jpwl.h and rs.h 2006-12-07 18:46:28 +00:00
Giuseppe Baruffa
3adfd18602 * Better fix of the TPH EPBs bug in JPWL module
* Fixed the UEP bug in JPWL module
+ Added some lines in the help of JPWL_image_to_j2k
2006-12-05 18:20:04 +00:00
Giuseppe Baruffa
9e42842bb5 Bug fix explanation 2006-12-04 17:26:16 +00:00
Francois-Olivier Devaux
a8591daa68 SVN file properties modified (EOL handled better) 2006-12-04 16:25:52 +00:00
Francois-Olivier Devaux
265de2ed0d SVN file properties modified (EOL handled better) 2006-12-04 16:20:36 +00:00
Francois-Olivier Devaux
36007b6a76 SVN file properties modified (EOL handled better) 2006-12-04 16:16:15 +00:00
Francois-Olivier Devaux
34661c5aea SVN file properties modified 2006-12-04 16:11:23 +00:00
Francois-Olivier Devaux
d53edb5ea7 SVN file properties modified 2006-12-04 16:11:05 +00:00
Francois-Olivier Devaux
16fbba79ec EOL handling 2006-12-04 16:10:24 +00:00
Francois-Olivier Devaux
fb4ad9c507 Version 1.1 2006-12-04 15:52:19 +00:00
Giuseppe Baruffa
9eaaf55f7a Fixed the following bug:
- when using -W h,h0 the EPBs in TPHs always get a "not latest in current header" signature, even if they are really the latest.

The fix checks for additional EPBs, after the TPH one (e.g. UEP EPBs), and sets the Depb field of the TPH EPB accordingly.
2006-12-04 15:28:48 +00:00
Francois-Olivier Devaux
dc069254c3 Changes for 4th of December 2006 (bis) 2006-12-04 15:22:25 +00:00
Francois-Olivier Devaux
b97f88bf7e Changes for 4th of December 2006 2006-12-04 15:18:47 +00:00
Francois-Olivier Devaux
2c03b73dff First integration of JPWL code 2006-12-04 14:59:33 +00:00
Francois-Olivier Devaux
6cc148e226 Code optimization usinq vsprintf() command 2006-12-04 14:57:09 +00:00
Francois-Olivier Devaux
f9d76c0be9 First integration of JPWL code 2006-12-04 14:55:38 +00:00
Francois-Olivier Devaux
bcf7032b8b First integration of JPWL code 2006-12-04 14:55:11 +00:00
Francois-Olivier Devaux
0ace960ea5 Corrected incorrect fprintf formatting 2006-12-04 14:52:34 +00:00
Francois-Olivier Devaux
b420c330b2 JPWL version 1.0 by Universita' degli Studi di Perugia 2006-12-04 13:24:22 +00:00
Francois-Olivier Devaux
7fd2ae9786 JPWL version 1.0 by Universita' degli Studi di Perugia 2006-12-04 13:23:44 +00:00
Francois-Olivier Devaux
3d2f2b4048 Deleted because this directory corresponds to an old version of the JPWL library 2006-12-04 13:20:19 +00:00
Francois-Olivier Devaux
9fc6e4f4bd Deleted because this directory corresponds to an old version of the JPWL library 2006-12-04 13:20:06 +00:00
Francois-Olivier Devaux
07fa11a94c Deleted because this directory corresponds to an old version of the JPWL library 2006-12-04 13:19:25 +00:00
Francois-Olivier Devaux
36c6e4abb9 Deleted because this directory corresponds to an old version of the JPWL library 2006-12-04 13:18:53 +00:00
Antonin Descampe
15949d43d1 fixed a cast problem in the maxlen variable 2006-10-31 18:10:03 +00:00
Antonin Descampe
696cd710df removed a debug test in the version just committed 2006-10-31 17:37:01 +00:00
Antonin Descampe
2d416a8017 fixed a bug in the computation of the mantissa (mu) 2006-10-31 17:11:15 +00:00
Antonin Descampe
b565431251 added the ability to specify the rate as "float" (before : integer) 2006-10-31 17:10:14 +00:00
Antonin Descampe
480021bc33 initial release of jp3d library and codec 2006-10-30 15:32:50 +00:00
Giuseppe Baruffa
af448b94a1 2006-10-27 19:06:07 +00:00
Giuseppe Baruffa
4bd7195ea6 Test 2006-10-27 19:04:31 +00:00
Giuseppe Baruffa
331d3e523d 2006-10-27 19:00:14 +00:00
Antonin Descampe
b5aee428ba remove some needless cvs files 2006-10-27 17:51:08 +00:00
Antonin Descampe
3386c7765a testsvn2 2006-10-27 14:48:39 +00:00
Antonin Descampe
97a3327f99 testsvn 2006-10-26 19:54:44 +00:00
Antonin Descampe
173ccf70d4 fixed a bug in j2k_to_image.c, that prevented the -l option to work correctly. 2006-08-18 10:10:47 +00:00
Antonin Descampe
7860407cb5 fixed a bug in pi.c, line 473, that appeared when more than 100 precincts were generated in a resolution level 2006-08-04 10:12:14 +00:00
Antonin Descampe
4d6bd49719 *** empty log message *** 2006-07-28 15:46:34 +00:00
Mathieu Malaterre
9aa9170110 ENH: Update CMake to do proper installation. Still using the 2.2 installation approach for now. 2006-07-22 03:47:02 +00:00
Mathieu Malaterre
4b3aabebd2 ENH: Fix warning about assignment discards qualifiers from pointer target type 2006-07-22 03:35:17 +00:00
Mathieu Malaterre
1093244d43 ENH: Update on recent commit 2006-07-22 03:30:10 +00:00
Mathieu Malaterre
0577ed8e6e STYLE: Fix style issue 2006-07-22 03:27:36 +00:00
Mathieu Malaterre
4f87b9abd1 BUG: Do not leak with greyscale bmp. Solve problem with name>256 for pgx and resolve random memory access (reported by valgrind) 2006-07-22 03:26:10 +00:00
Mathieu Malaterre
abe8e93c21 ENH: Marking const char * what should be const char *. TODO need to fix code for imagetopgx. 2006-07-21 21:07:18 +00:00
Mathieu Malaterre
f222743e19 ENH: Better solution: using the opj_version function to stay up to date 2006-07-21 21:00:19 +00:00
Mathieu Malaterre
190b4b7c9e ENH: Minor cleanup, mainly comment and line too long 2006-07-21 20:28:44 +00:00
Mathieu Malaterre
d55af7fe7e ENH: Cannot assign const char* into a char*. At same time upgrade OpenJPEG version to proper one 2006-07-21 20:03:07 +00:00
Antonin Descampe
817681fb98 fixed a bug in t1.c that prevented in some cases a true lossless compression (thanks to Don Mimlitch for reporting this bug) 2006-03-19 18:51:32 +00:00
Giuseppe Baruffa
f0721df1d9 italian text translated into english 2006-03-16 16:49:13 +00:00
Giuseppe Baruffa
76d29b8df1 This commit was generated by cvs2svn to compensate for changes in r266,
which included commits to RCS files with non-trunk default branches.
2006-03-16 16:47:31 +00:00
Giuseppe Baruffa
2f9aae7671 Added a second version of enco+deco, with comments and text in italian 2006-03-13 18:01:33 +00:00
Mathieu Malaterre
0108506433 COMP: Fix warning about C++ comment 2006-02-19 21:12:20 +00:00
Mathieu Malaterre
b883da435b COMP: Fix declaration hides parameter len 2006-02-18 12:52:52 +00:00
Mathieu Malaterre
6a4572a56f COMP: Fix declaration hides parameter len 2006-02-18 12:51:35 +00:00
Mathieu Malaterre
fba75d93c4 STYLE: Remove C++ comments 2006-02-18 12:48:49 +00:00
Freeimage
c2b399b363 removed unneeded working variables in opj_tcd_t 2006-02-12 16:53:23 +00:00
Francois-Olivier Devaux
786ec27a05 Readded CRLF 2006-02-08 14:25:03 +00:00
Francois-Olivier Devaux
2a505f73c4 Added SOURCE=..\libopenjpeg\jpw.c
Added SOURCE=..\libopenjpeg\rs.c
2006-02-08 14:24:25 +00:00
Francois-Olivier Devaux
e318641bfa Added SOURCE=..\libopenjpeg\jpw.c 2006-02-08 14:23:39 +00:00
Mathieu Malaterre
6566009e89 BUG: Need to leave option for user to change 2006-02-05 22:55:26 +00:00
Mathieu Malaterre
a350bdc1c4 ENH: Several updates: Do not need an explicit DartConfig, default inexistant file is just fine. Also remove explicit BUILD_SHARED_LIBS since this is garantee to be OFF by CMake 2006-02-05 22:17:03 +00:00
Mathieu Malaterre
23eeec8769 ENH: Do the proper thing for static/shared 2006-02-05 21:39:19 +00:00
Freeimage
f31d963a64 fixed a bug in codec/convert.c::imagetobmp 2006-02-04 18:39:46 +00:00
Freeimage
5e0948c142 readded CRLF to dsp, dsw and rc files 2006-02-04 12:38:32 +00:00
Freeimage
73ada6ce7f readded CRLF to dsp and dsw files 2006-02-04 12:07:31 +00:00
Freeimage
48311061c1 added the 'static' keyword to inline functions to keep gcc happy 2006-02-03 23:08:52 +00:00
Antonin Descampe
39ad332cee minor change : project replaced by workspace 2006-02-02 13:15:21 +00:00
Freeimage
90a4692c48 What's new ... 2006-02-01 21:27:43 +00:00
Freeimage
fe720be147 added a VERSION resource to the DLL version of OpenJPEG 2006-02-01 21:25:37 +00:00
Freeimage
8d7b0c9c05 changed function definitions of INT and FIX modules to 'inline' 2006-02-01 21:25:11 +00:00
Mathieu Malaterre
33b5757921 ENH: Update CMake to match the new shared lib system (no more def file) 2006-01-31 22:35:51 +00:00
Freeimage
355b88c15d fixed various minor warnings occuring under icc9 and bcc32, added MSVC project and compiler directives to build a 'standard' WIN32 DLL 2006-01-31 21:26:11 +00:00
Mathieu Malaterre
74c1b3637e COMP: Fix compilation on MINGW 2006-01-31 19:45:17 +00:00
Mathieu Malaterre
9ffd9e6619 ENH: update changelog about modification for shared lib in CMake which now compatible with old build system 2006-01-31 14:54:16 +00:00
Mathieu Malaterre
1460d23294 STYLE: Remove completely reference to OPJ_EXPORT 2006-01-31 14:51:39 +00:00
Mathieu Malaterre
75cf4f0906 STYLE: More verbose comments 2006-01-31 14:41:40 +00:00
Mathieu Malaterre
85c327861a STYLE: Add more comment, also use more feature from CMake to introduce the VERSION number of openjpeg 2006-01-31 14:32:40 +00:00
Mathieu Malaterre
c5c3ca370e ENH: Move to a def solution to avoid polluting header file with declspec 2006-01-31 14:20:06 +00:00
Antonin Descampe
72de930d08 fixed two initialization problems in t1.c and tcd.c 2006-01-27 16:29:41 +00:00
Freeimage
8a662fa4b1 fixed various minor warnings occuring under gcc, added corrections proposed in the forum 2006-01-26 20:02:04 +00:00
Mathieu Malaterre
7546f19b51 ENH: Sync with ITK and add ref to doxygen 2006-01-25 18:45:49 +00:00
Mathieu Malaterre
55fb4d0b67 ENH: Sync with ITK repository 2006-01-25 18:18:09 +00:00
Mathieu Malaterre
61e353d652 STYLE: Add a lot of comments for the CMake build system 2006-01-25 16:32:48 +00:00
Mathieu Malaterre
5ff45287ea ENH: Fix compilation on mingw32 and borland 2006-01-25 16:02:12 +00:00
Mathieu Malaterre
6b27c32ee8 ENH: Set a default BUILDNAME 2006-01-25 15:55:13 +00:00
Mathieu Malaterre
44869986ca BUG: Try to fix the shell script 2006-01-25 15:54:10 +00:00
Antonin Descampe
2f75846baf fixed a problem in convert.c when multiple comments 2006-01-25 15:45:01 +00:00
Mathieu Malaterre
ec2b3b3b3f COMP: Fix compilation on mingw (already had itoa) and borland (need __int64) 2006-01-25 15:21:28 +00:00
Antonin Descampe
b9b72f1951 removed all CtrlM from files 2006-01-25 10:03:59 +00:00
Antonin Descampe
ebeb57d7d3 check also for CtrlM in .txt and .cmake files 2006-01-25 09:34:32 +00:00
Antonin Descampe
e6aae96217 added cmake files to the project 2006-01-25 09:23:17 +00:00
Antonin Descampe
511d342a94 removed all CtrlM from files 2006-01-25 09:17:16 +00:00
Antonin Descampe
a1ec600b42 fix.c : replaced "WIN32" by "_MSC_VER" for int64 2006-01-25 09:04:36 +00:00
Antonin Descampe
06185ea2d1 removed all CtrlM from files 2006-01-25 09:03:41 +00:00
Antonin Descampe
fc42b3ec84 fix.c : replaced "WIN32" by "_MSC_VER" for int64 2006-01-25 09:00:40 +00:00
Antonin Descampe
5432a70c79 added "OPJ_EXPORT" in openjpeg.h to generate shared lib with win32 2006-01-25 08:50:18 +00:00
Antonin Descampe
d02b01dc85 removed all CtrlM from files (openjpeg.h,t2.c,j2k_to_image.c) 2006-01-25 08:45:21 +00:00
Antonin Descampe
cc3e813786 event.c : replaced "WIN32" by "_MSC_VER" for i2a (line 33) + replaced win32 line breaks 2006-01-24 21:02:13 +00:00
Antonin Descampe
d280fdef70 event.c : replaced "WIN32" by "_MSC_VER" for i2a 2006-01-24 20:40:58 +00:00
Antonin Descampe
40fd335947 CtrlM check added when committing files 2006-01-22 19:19:19 +00:00
Antonin Descampe
6a52f1a9df fixed various minor warnings with gdcm patches 2006-01-20 16:53:05 +00:00
Freeimage
197b0505cb fixed a bug in jp2_read_ihdr (need to allocate jp2->comps) 2006-01-19 20:25:44 +00:00
Freeimage
f8d899c4f1 What's new 2006-01-18 20:11:30 +00:00
Freeimage
d5ecae07ad fixed a bug in opj_cio_open when saving 48-bit images (wrong buffer size calculation) 2006-01-18 20:10:58 +00:00
Freeimage
8f9f70f922 changed the name of j2k_realloc to opj_realloc 2006-01-18 20:10:23 +00:00
Antonin Descampe
69dcece31a makefiles and readme updated 2005-12-21 14:54:37 +00:00
Antonin Descampe
34c8a555fa fixed a bug when specifying a rate '-r' => no distortion info was available in the index 2005-12-08 14:47:40 +00:00
Antonin Descampe
fe33ebe83c fixed a bug in t1_getwmsedec (stepsize was divided by 8192) 2005-12-08 11:01:59 +00:00
Antonin Descampe
237bb54678 added doc module to openjpeg module 2005-12-08 09:40:00 +00:00
Antonin Descampe
95bc884365 OpenJPEG version 1.1 2005-12-08 09:38:47 +00:00
Antonin Descampe
e45e87cfb7 removed old readme and Makefile 2005-12-08 09:27:26 +00:00
Antonin Descampe
2dc3ca544d removed test file 2005-12-07 21:29:44 +00:00
Antonin Descampe
4fb43c8af0 test 2005-12-07 21:28:11 +00:00
Antonin Descampe
a5d33c992d still trying to add root directory to module 2005-12-07 21:26:00 +00:00
Antonin Descampe
dbd4b4945b still trying to add root directory to module 2005-12-07 21:20:11 +00:00
Antonin Descampe
17704c6e2f still trying to add root directory to module 2005-12-07 21:10:18 +00:00
Antonin Descampe
a35e8df118 test for adding root directory to modules 2005-12-07 21:06:03 +00:00
Antonin Descampe
d9c1214282 test to add root directory to modules 2005-12-07 20:45:11 +00:00
Antonin Descampe
0674edc2ca added an 'openjpeg' module 2005-12-06 16:30:35 +00:00
Antonin Descampe
f335cb0e0b addes an 'openjpeg' module containing all modules 2005-12-06 16:19:07 +00:00
Antonin Descampe
c447f6e6bc removed pre-commit check tabs 2005-12-06 16:08:37 +00:00
Antonin Descampe
884c8429fc Makefile moved to ROOT directory 2005-12-04 17:10:57 +00:00
Antonin Descampe
5cf0326dcb LibOpenJPEG project files moved to root directory 2005-12-04 17:07:44 +00:00
Antonin Descampe
59835a580e openjpeg version 1.0 (previous version still available with tag opj0-97) 2005-12-02 18:30:54 +00:00
Antonin Descampe
08f7bfbb5f add an include <sys/time.h> before <sys/resource.h> 2005-12-02 13:48:10 +00:00
Antonin Descampe
f61cda9b7d openjpeg version 1.0 (previous version still available with tag opj0-97) 2005-12-02 13:34:15 +00:00
Antonin Descampe
76016d509b Added check to avoid tabs in source files 2005-12-01 12:38:36 +00:00
Antonin Descampe
4458ef921c minor change for readability 2005-11-09 10:20:28 +00:00
Antonin Descampe
c9ac67cd05 minor change to avoid warnings about signedness 2005-11-09 10:17:51 +00:00
Giuseppe Baruffa
cff5df73d9 Initial revision 2005-11-08 17:40:33 +00:00
Antonin Descampe
e398154212 small changes to remove warnings related to signedness 2005-11-08 16:15:40 +00:00
Antonin Descampe
0ea26e7ba6 small change to avoid signed/unsigned warning during compilation 2005-11-04 11:10:38 +00:00
Antonin Descampe
8f3bd54c3d Changes proposed by Mathieu Malaterre from the GDCM project... Thanks a lot Mathieu
- '//' replaced by '/* */'
- inclusion of int.h in int.c
- inclusion of j2k.h in int.h in order to export symbols
- adding (void) var when a variable is declared but not used
- some explicit cast
- CLOCKS_PER_SEC is declared as float in bcc55, so there is a need to cast it to int for the modulo operation
- some variables changed from float -> double
2005-11-01 10:15:34 +00:00
Antonin Descampe
18a9bcb882 changed one of the 9-7 coefficients (value closer to the one in the std) 2005-10-27 07:51:11 +00:00
Antonin Descampe
7ee36c3a4c 1) quantization stepsizes stored as float instead of shifted integers -> fixes a pb of precision when using very small stepsizes. 2) bug fixed when decoding until bitplane 0 -> r-value (1/2) added to the coefficient. 2005-10-27 07:49:29 +00:00
Francois-Olivier Devaux
7f8f47566f Modifications to decoding of JP2H box in order to be compatible with JP2 conformance files 2005-10-20 07:43:55 +00:00
Antonin Descampe
d6a523e091 major change in the dwt-module, thanks to Ive (aka Reiner Wahler): thanks a lot ! See note in dwt.c for more details. 2005-09-21 13:00:51 +00:00
Antonin Descampe
ac634b1639 bug fixed when asking for an index with more than (layer*resolutions*100) packets per tile (2nd correction) 2005-09-21 08:11:27 +00:00
Antonin Descampe
a0513798bb bug fixed when asking for an index with more than (layer*resolutions*100) packets per tile 2005-09-20 15:40:13 +00:00
Antonin Descampe
8f4d6bbeba bug fixed when freeing the memory allocated if ppm-marker or ppt-marker is used 2005-09-13 14:17:09 +00:00
Antonin Descampe
cd98a4f740 bug fixed when freeing the memory allocated if ppm-marker or ppt-marker is used 2005-09-13 14:11:41 +00:00
Francois-Olivier Devaux
e25e7e767e Modifications proposed by Rob Komar. Thanks for your contribution ! 2005-08-01 15:10:04 +00:00
Antonin Descampe
de75303c38 Several bugs fixed when dealing with pgx-files with more than 8 bpp and the fixed_quality feature. 2005-07-18 15:21:56 +00:00
Francois-Olivier Devaux
32ba9920db At lines 577, 692 and 699, zeroing of effective region of code-block rather than the 1024*1024 allocated integers of code-block. This optimization has been proposed by Dmitry Kolyadin. Thanks for your help ! 2005-06-02 15:28:37 +00:00
Francois-Olivier Devaux
7ae6a670fa Conversions from int to unsigned int to ensure correct execution of int_min and int_max at lines 800 to 830 2005-06-02 15:25:25 +00:00
Francois-Olivier Devaux
cf4f8be5f0 Conversions from int to unsigned int to ensure correct execution of int_min at line 626 to 628 2005-06-02 15:14:33 +00:00
Antonin Descampe
ec1b970a32 argv[2] replaced by outfile when writing to output file (thanks to O.Smeesters and V.Mesaros) 2005-05-26 15:18:56 +00:00
Antonin Descampe
ee6d0cfba9 CRLF -> LF 2005-05-26 15:13:08 +00:00
Francois-Olivier Devaux
789f6f8e7a CVS test 2005-05-26 14:25:54 +00:00
Sebastien Lugan
3d2a52cd82 correction CRLF -> LF 2005-05-26 14:20:00 +00:00
Antonin Descampe
384068ce8c test 2005-05-26 12:22:00 +00:00
Francois-Olivier Devaux
7e518596e0 cio_read_to_buf(...) and cio_write_from_buf(...) functions syntax modification 2005-05-26 12:07:46 +00:00
Francois-Olivier Devaux
f9eb8f93c2 Code optimization: t1_flags and t1_data set to zero with memset 2005-05-24 12:15:52 +00:00
Francois-Olivier Devaux
d54925f777 2 functions were added, to fasten buffer transfers:
void cio_read_to_buf(unsigned char* buf, int n)
void cio_write_from_buf(unsigned char* buf, int n)
Code written by Glenn Pearson
2005-05-23 15:26:29 +00:00
Francois-Olivier Devaux
eae26f958e 2 functions were added, to fasten buffer transfers:
void cio_read_to_buf(unsigned char* buf, int n)
void cio_write_from_buf(unsigned char* buf, int n)
2005-05-23 15:25:48 +00:00
Francois-Olivier Devaux
ee7c2c28f1 Variables in Movie and Track structure initialized to avoid problems when freeing memory.
These initializations are made in mj2_read_smhd and mj2_read_hmhd.
2005-05-23 09:48:44 +00:00
Francois-Olivier Devaux
8a2e6ecd8b Useless call of mj2_init_stdmovie function deleted 2005-05-23 09:46:37 +00:00
Francois-Olivier Devaux
1b0a585256 Modified mj2_init_stdmovie. Check for division by zero at line 212: tk->sample[j].sample_delta = tk->timescale / tk->sample_rate;
Thanks to Valentin Mesaros !
2005-05-20 07:59:01 +00:00
Francois-Olivier Devaux
29b6a4307a Release configuration modified 2005-04-27 11:01:28 +00:00
Francois-Olivier Devaux
ad4857df94 Light modifications 2005-04-27 10:51:01 +00:00
Francois-Olivier Devaux
a73e37301a First upload of the DTD file 2005-04-27 10:42:31 +00:00
Francois-Olivier Devaux
255e296113 Light modifications 2005-04-27 10:42:16 +00:00
Francois-Olivier Devaux
e4696a445d Update 2005-04-19 10:10:54 +00:00
Francois-Olivier Devaux
81f688433d bug while freeing memory (mj2_free) fixed 2005-04-19 09:18:51 +00:00
Francois-Olivier Devaux
0130af0ff4 Bug while writing huge MOOV boxes fixed. Thanks to Valentin Mesaros ! 2005-04-19 09:17:55 +00:00
Francois-Olivier Devaux
2cbcbb25b0 Standard movie initialisation slightely modified 2005-04-19 09:17:03 +00:00
Francois-Olivier Devaux
5197135a0a Makefile update 2005-04-19 09:16:22 +00:00
Francois-Olivier Devaux
4c67811f65 Project update 2005-04-15 08:02:18 +00:00
Francois-Olivier Devaux
8e8afafae6 Project settings update 2005-04-06 08:53:59 +00:00
Francois-Olivier Devaux
370cfc43a2 Project settings update 2005-04-06 08:44:32 +00:00
Francois-Olivier Devaux
d101633cfa Project settings update 2005-04-06 08:36:32 +00:00
Francois-Olivier Devaux
128bcc4f62 Relative path modifications 2005-04-06 08:21:31 +00:00
Francois-Olivier Devaux
050737bea0 Visual .NET project 2005-04-01 14:17:42 +00:00
Francois-Olivier Devaux
63e17a19eb New version by Glenn Pearson 2005-04-01 14:16:03 +00:00
Francois-Olivier Devaux
61e85ded8b Line 114: Simple warning message when NO_PACKETS_DECODING is not defined 2005-03-25 15:49:29 +00:00
Francois-Olivier Devaux
1cc9fa6815 Line 944:Memory release of img.comps[i].data when NO_PACKETS_DECODING is not defined 2005-03-25 15:48:50 +00:00
Francois-Olivier Devaux
7bdb0331a6 Removed unused parameter in fprintf at line 618 2005-03-25 13:58:00 +00:00
Francois-Olivier Devaux
623f1d96cf Unused "dest" pointer removed from main() 2005-03-25 13:53:54 +00:00
Francois-Olivier Devaux
1de9535b8c #endif;
replaced by
#endif
2005-03-25 13:52:55 +00:00
Francois-Olivier Devaux
68ebc572fc Makefile for frames_to_mj2, mj2_to_frames, wrap_j2k_in_mj2
and extract_j2k_from_mj2
Thanks to Valentin Mesaros from Octalis !
2005-03-25 13:47:47 +00:00
Francois-Olivier Devaux
5f44ec7d01 Newline at end of file added 2005-03-25 13:46:38 +00:00
Francois-Olivier Devaux
10aee43cbc Replaced bad message error when unknown box is found 2005-03-25 13:44:54 +00:00
Francois-Olivier Devaux
7e2e09e2a9 Replaced unlink() with remove() 2005-03-25 13:44:16 +00:00
Francois-Olivier Devaux
86ce4d4c18 New OpenJPEG MJ2 module: mj2_to_metadata created by Glenn Pearson. The OpenJPEG team would like to thank him for his contributions ! 2005-03-25 09:44:32 +00:00
Francois-Olivier Devaux
361edd25b7 Newline at end of file 2005-03-25 09:30:30 +00:00
Francois-Olivier Devaux
85691a02a6 Initialisation of movie->cl changed in mj2_init_stdmovie 2005-03-21 15:14:16 +00:00
Francois-Olivier Devaux
1f96f0e92a Modifications made to enable the decoding of a J2K file headers without decoding all packets using #NO_PACKETS_DECODING
Used with MJ2_to_metadata
2005-03-16 12:11:40 +00:00
Francois-Olivier Devaux
34a6c13a2d Input file format bug fixed (2) 2005-02-10 16:22:01 +00:00
Francois-Olivier Devaux
542f06007c Input file format bug fixed 2005-02-10 16:16:18 +00:00
Francois-Olivier Devaux
fdbca0fc9d Minor bugs in error messages fixed 2005-02-09 10:26:22 +00:00
Francois-Olivier Devaux
632902d7e3 Added tk->visual_w and tk->visual_h variables, specifying the track's visual presentation size as fixed-point 16.16 values. 2005-02-09 10:08:48 +00:00
Francois-Olivier Devaux
9310f1b4a9 Precision added to tk->balance, tk->volume, movie->volume and movie->rate 2005-02-09 09:56:32 +00:00
Francois-Olivier Devaux
ed0a46eff5 YUV_DFMT added 2005-02-09 09:55:13 +00:00
Francois-Olivier Devaux
8323900f73 Bug with number of layers to decode fixed 2005-02-01 16:30:06 +00:00
Antonin Descampe
c83ae7397d Added layer option '-l' to the command line. This option allows user to
specify a maximum number of quality layers to be decoded.
2005-01-26 09:59:31 +00:00
Antonin Descampe
3b1bee0eec * function getopt added to the decoder (to efficiently manage arguments
in command line)
* reduce_on, reduce_value grouped in a single variable reduce
* up-to-date usage display
* image_type renamed --> decod_format
* JPEG2000_format renamed -->  cod_format
2005-01-26 08:59:49 +00:00
Francois-Olivier Devaux
ba1cf545df Bug with mj2_read_struct fixed (problem when reading MJ2 files starting with the MOOV box fixed) 2005-01-14 08:14:01 +00:00
Antonin Descampe
bfb2f9f58b Luke Lee optimization for fix_mul... Thanks to him 2005-01-03 17:39:30 +00:00
Francois-Olivier Devaux
13b8ecfe44 This tool wraps J2K codestreams into a MJ2 file (designed to
work with other codecs than OpenJPEG)
2004-12-08 12:12:23 +00:00
Francois-Olivier Devaux
9e9e188ebf This tool extracts J2K codestreams from a MJ2 file (designed to
work with other codecs than OpenJPEG)
2004-12-08 12:12:00 +00:00
Francois-Olivier Devaux
5034581e69 Converting to Dos 2004-12-08 12:09:25 +00:00
Francois-Olivier Devaux
85ec5eccf7 Converting to Unix 2004-12-08 12:07:25 +00:00
Francois-Olivier Devaux
9c8fcc3616 This tool wraps J2K codestreams into a MJ2 file (designed to
work with other codecs than OpenJPEG)
2004-12-08 11:24:10 +00:00
Francois-Olivier Devaux
7976b61c89 This tool extracts J2K codestreams from a MJ2 file (designed to
work with other codecs than OpenJPEG)
2004-12-08 11:23:37 +00:00
Francois-Olivier Devaux
43a6b92345 New modular version of the MJ2 library.
The goal of this new version is to make the library more independent from OpenJPEG
2004-12-08 11:22:18 +00:00
Francois-Olivier Devaux
f25acae0bc Modifications in handling of JP2 files to increase modularity of JP2.c
Memory leak fixed with jp2 files
2004-12-08 09:08:13 +00:00
Francois-Olivier Devaux
9225f53d62 Modularity increase in jp2_init_stdjp2 function and jp2c box functions to enable new version of MJ2 module 2004-12-08 09:06:04 +00:00
Antonin Descampe
eb1b017ec7 Index structure adpated for other progression orders than LRCP
(thanks to Stefano Pensa)
2004-11-29 14:48:20 +00:00
Francois-Olivier Devaux
0ddef9b2db Modifications to increase modularity of jp2 coding/decoding 2004-11-26 16:33:18 +00:00
Francois-Olivier Devaux
1bdb07cefe fprintf correctly redirected to stderr or stdout 2004-11-15 12:41:35 +00:00
Francois-Olivier Devaux
0a879e2207 Help message updated 2004-11-05 10:08:06 +00:00
Francois-Olivier Devaux
f3c3eab744 Usage message updated 2004-11-05 10:07:02 +00:00
Francois-Olivier Devaux
08209f1d23 Help message updated 2004-11-05 09:58:42 +00:00
Francois-Olivier Devaux
3ec116ae08 Help message updated 2004-11-05 09:51:30 +00:00
Francois-Olivier Devaux
3b600a986c Stack corruption error corrected with "tmp" variable 2004-11-05 08:59:58 +00:00
Francois-Olivier Devaux
0d4a38f3a5 Bug with -F argument fixed 2004-10-08 07:08:25 +00:00
Francois-Olivier Devaux
2410db2ae7 Memory leak bug fixed in the read_mdat() function 2004-10-06 08:58:27 +00:00
Francois-Olivier Devaux
e1278bc691 Small bug corrected: unsigned int to int conversion at line 417 2004-10-06 07:12:36 +00:00
Francois-Olivier Devaux
899439a906 Bug with tk->imagefile pointer fixed 2004-09-09 13:34:20 +00:00
Francois-Olivier Devaux
02e3a4ec77 Modification of stsc_decompact function 2004-09-08 15:12:21 +00:00
Francois-Olivier Devaux
7250ce0668 Bug with sound and hint tracks fixed 2004-09-06 15:53:36 +00:00
Francois-Olivier Devaux
2ebe5f2c92 One component input image handled 2004-09-06 15:47:09 +00:00
Francois-Olivier Devaux
3c730a804b Order of data written to jp2_struct->cl inversed in jp2_read_ftyp function 2004-08-31 09:17:06 +00:00
Francois-Olivier Devaux
313975debf Pointer values initialized to zero 2004-08-27 14:22:33 +00:00
Francois-Olivier Devaux
0abe8e1997 Fixed bugs. Thanks to Dereck ! 2004-08-24 13:36:45 +00:00
Antonin Descampe
bc5c5115cb * Inserted tool for memory leaks fixing in debug mode
* Fixed some memory leaks in the decoder (some are still present when multiple tiles!)
2004-08-06 14:13:51 +00:00
Antonin Descampe
61ac18531a Help updated 2004-08-04 10:06:50 +00:00
Francois-Olivier Devaux
0ee21bdbfe Bug fixed in lossless mode 2004-08-03 14:20:04 +00:00
Antonin Descampe
d116ca5d10 Better indentation 2004-08-03 14:14:44 +00:00
Antonin Descampe
26a630dad2 Bug fixed in lossless mode 2004-08-03 14:06:10 +00:00
Francois-Olivier Devaux
2c2730280e Deleted system("pause") at the end of main function 2004-08-02 15:23:22 +00:00
Antonin Descampe
2e2ba14c53 Bug fixed in pgx-file reading 2004-07-30 09:22:22 +00:00
Antonin Descampe
9fa68ca811 Bug fixed in MQ decoder initialization (keyword comment : initbug1) 2004-07-21 05:18:57 +00:00
Antonin Descampe
d38080aa00 * Bug fixed in jpt decoding
* Bug fixed in pcrl progression order (profile-1 compliance)
* Change in tcd_dump
2004-07-20 05:40:55 +00:00
Francois-Olivier Devaux
aa6c1d28ad Error message modification 2004-07-16 15:16:07 +00:00
Antonin Descampe
ba4fd784f5 Converting to DOS-formats 2004-07-16 14:52:25 +00:00
Francois-Olivier Devaux
3d67d80d49 First upload of MJ2 module 2004-07-16 14:10:49 +00:00
Francois-Olivier Devaux
25e97927f9 First upload of mj2.h 2004-07-16 14:09:50 +00:00
Francois-Olivier Devaux
e13205349d Initial revision 2004-07-16 14:06:32 +00:00
Francois-Olivier Devaux
cc42bfbaaa Comments added 2004-07-16 13:39:09 +00:00
Francois-Olivier Devaux
c785c1b82b minor changes 2004-07-16 13:17:23 +00:00
Francois-Olivier Devaux
5da1d86a03 Bug on jp2_struct->comps memory allocation fixed 2004-07-16 13:16:39 +00:00
Antonin Descampe
54b04573f9 USAGE-statement updated 2004-07-16 10:39:06 +00:00
Francois-Olivier Devaux
ba0042bfe2 Memory leaks at decoding fixed 2004-07-16 10:31:10 +00:00
Antonin Descampe
70ed4ae986 Previous version reloaded 2004-07-16 10:27:27 +00:00
Francois-Olivier Devaux
47dfe606bd Memory leaks at decoding fixed 2004-07-16 10:22:59 +00:00
Antonin Descampe
cc034349cd Fixed bug (compatibility between index_create and j2k_decode) 2004-07-16 09:57:26 +00:00
Francois-Olivier Devaux
9653207b67 Multiple tile bug fixed (line 438) 2004-07-16 09:52:24 +00:00
Francois-Olivier Devaux
82eea41d24 Memory leaks fixed (line 1592: frees data of all components of current tile) 2004-07-16 09:14:31 +00:00
Antonin Descampe
8d2121606d Minor changes for RESET mode 2004-07-16 09:08:27 +00:00
Francois-Olivier Devaux
e28d3d63ea Comment introcudec (Created by OpenJPEG version 0.9) + Memory leaks fixed 2004-07-16 08:59:15 +00:00
Sebastien Lugan
c81b74d91b Bugfix Makefile / jp2.c & jp2.h 2004-07-15 15:52:44 +00:00
Antonin Descampe
17a559b49e (Sampling + Offset) incompatibility bug fixed 2004-07-14 15:32:56 +00:00
Antonin Descampe
0e9da05873 fixed bug from previous revision 2004-07-14 15:15:07 +00:00
Francois-Olivier Devaux
75cb7a7b2c Memory leak fix + Comment inserted in codestream: "Created by OpenJPEG version 0.9" 2004-07-14 13:00:57 +00:00
Francois-Olivier Devaux
c020831f95 Allocated memory of coding parameters (cp) freed 2004-07-14 10:58:11 +00:00
Antonin Descampe
55e5910d6b * PPM markers handling modified (comment keyword : ppmbug1)
* empty resolution level or subband handling (comment keyword : sizebug1)
* index_on field forwarded to j2k_cp_t structure
2004-07-14 08:52:15 +00:00
Antonin Descampe
de5a22aea0 Structure j2k_option_t deleted and option "-reduce" integrated to j2k_cp_t.
Parameters changed for j2k_decode, jp2_decode, j2k_decode_jpt_stream
2004-07-13 14:37:11 +00:00
Antonin Descampe
bc563fc5ba * Quantization bug fixed when using 9x7 DWT (comment keyword : quantizbug1)
* Multiplication bug fixed when dividing by 8192 (comment keyword : multbug1)
2004-07-13 09:17:17 +00:00
Antonin Descampe
f50f66c0c9 scalar_derived quantization type bug fixed (2) 2004-07-09 14:37:12 +00:00
Antonin Descampe
651f98ad06 Bug fixed for scalar_derived quantization type 2004-07-09 14:04:06 +00:00
Antonin Descampe
132d894726 Bug fixed in pgx-format 2004-07-09 10:12:16 +00:00
Antonin Descampe
af26e8504e Added jp2.h et jp2.c to the project 2004-07-07 09:08:49 +00:00
Francois-Olivier Devaux
d695f75c24 First version of JP2 file format 2004-07-07 08:24:36 +00:00
Francois-Olivier Devaux
b391bfa718 Include jp2.h file 2004-07-07 07:38:15 +00:00
Francois-Olivier Devaux
77ca0769e3 New variable in cp structure for JP2 format 2004-07-07 07:37:44 +00:00
Francois-Olivier Devaux
06496c203e j2k_encode can output data to a buffer or to a file 2004-07-07 07:37:14 +00:00
Francois-Olivier Devaux
da88349b22 Enables the decoding of JP2 files 2004-07-07 07:35:34 +00:00
Francois-Olivier Devaux
a41ed768c9 Enables the creation of JP2 files 2004-07-07 07:35:12 +00:00
Francois-Olivier Devaux
688a82dfd9 Sets the image color space for JP2 format 2004-07-07 07:34:15 +00:00
Francois-Olivier Devaux
3cb27c3912 Fixed bug for rate option 2004-07-06 07:50:05 +00:00
Antonin Descampe
71e60bf86c *.dsp files added for Microsoft Visual Studio users 2004-07-05 15:15:14 +00:00
Antonin Descampe
275b153fc2 small changes in the INDEX-file generation (in order to only use data from index data structures) 2004-05-07 14:41:45 +00:00
Antonin Descampe
a4911967eb * Fixed_quality option added : specifying -q psnr1,psnr2,psnr3,... at the command line when encoding an image generates layers with the corresponding psnr. You have to specify values in the increase order. This option is incompatible with "-r" or "-f" options.
* Old -q option is now available with -f

* The INDEX-file structure has been modified and is now like this :
------------------------------
image_width image_height
progression order
tile_width tile_height
nb_tiles_width nb_tiles_height
nb_components
nb_layers
nb_decompositions
foreach resolution_level {[precinct_width,precinct_height]}
main_header_end
codestream_size
foreach tile {
  tileno start_pos end_header end_pos squarred_error_total nb_pixels mean_squarred_error
}
foreach tile {
  foreach packet {
    packetno tileno layerno resno compno precinctno start_pos end_pos SE_reduction
  }
}
SE max
SE total
-----------------------------
2004-05-07 13:50:47 +00:00
Antonin Descampe
32e7b1529b Various corrections to avoid "signed/unsigned mismatch" warnings during compilation 2004-04-30 09:20:22 +00:00
Antonin Descampe
eb2f910daa Ajout de la possibilit� de taille de precincts diff�rente pour chaque r�solution 2004-04-29 15:32:38 +00:00
Sebastien Lugan
64c34e0d52 Reformatage : indent -kr -i2 -ci2 $(find . -name '*.c') $(find . -name '*.h') 2004-04-29 13:27:24 +00:00
Sebastien Lugan
ec9bd9f6a4 Reformatage : indent -kr $(find . -name '*.c') $(find . -name '*.h') 2004-04-29 13:10:05 +00:00
Yannick Verschueren
4f83e82a74 Change in the IFDEF due to error with Windows users 2004-04-19 13:11:33 +00:00
Yannick Verschueren
c74313aa15 remove obsolete part of code in t2_encode_packet 2004-04-19 13:08:55 +00:00
Yannick Verschueren
ae6227a9cf Remove call to obsolete library unistd.h 2004-04-19 13:07:00 +00:00
Yannick Verschueren
4bbd79b370 Potential error in tcd_init around L543 with p and q 2004-04-19 13:02:49 +00:00
Yannick Verschueren
e5106dd836 BMP problem solves : BMP-Images with dimension multiple of 4 presented problems 2004-03-15 10:42:29 +00:00
Yannick Verschueren
1f7520c88b Update to version 0.9 : option -reduce added on decoder 2004-03-05 14:42:53 +00:00
Yannick Verschueren
8ed5edaefa Error message changed (obsolete pnmtoj2k) 2004-03-05 14:35:02 +00:00
Yannick Verschueren
56fe7488ad Errors with some BMP file solved 2004-03-01 14:52:02 +00:00
Yannick Verschueren
994f0d518e Errors with some BMP file solved 2004-03-01 14:44:53 +00:00
622 changed files with 275717 additions and 15600 deletions

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
# Ignore files and directories made by `cmake .`.
CMakeFiles/
Makefile
cmake_install.cmake
/CMakeCache.txt
/CPackConfig.cmake
/CPackSourceConfig.cmake
/CTestCustom.cmake
/LICENSE.txt
/OpenJPEGConfig.cmake
/libopenjp2.pc
/src/bin/common/opj_apps_config.h
/src/lib/openjp2/opj_config.h
/src/lib/openjp2/opj_config_private.h
# Ignore directories made by `make`.
/bin/

93
.travis.yml Normal file
View File

@ -0,0 +1,93 @@
language: c
matrix:
include:
- os: osx
compiler: clang
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
- os: linux
compiler: gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
- os: linux
compiler: gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2
- os: linux
compiler: gcc
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
packages:
- gcc-multilib
- os: linux
compiler: gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug
- os: linux
compiler: clang
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
- os: linux
compiler: clang-3.8
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
sources:
- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
packages:
- clang-3.8
- os: linux
compiler: x86_64-w64-mingw32-gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
packages:
- gcc-mingw-w64-base
- binutils-mingw-w64-x86-64
- gcc-mingw-w64-x86-64
- gcc-mingw-w64
- os: linux
compiler: x86_64-w64-mingw32-gcc
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
packages:
- gcc-mingw-w64-base
- binutils-mingw-w64-i686
- gcc-mingw-w64-i686
- gcc-mingw-w64
- os: linux
compiler: gcc-4.8
env: OPJ_CI_ABI_CHECK=1
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- libelf-dev
- elfutils
- texinfo
- exuberant-ctags
install:
- ./tools/travis-ci/install.sh
script:
- ./tools/travis-ci/run.sh
- ./tools/travis-ci/abi-check.sh
before_deploy:
- export OPJ_RELEASE_PKG_FILE=$(ls build/openjpeg-${TRAVIS_TAG}*)
- echo "deploying $OPJ_RELEASE_PKG_FILE to GitHub releases"
deploy:
provider: releases
api_key:
secure: Npi13uOffALCVNwea4p4q8v85Lo/WsRqaeZQcWrAkt8MxRnfvWQtmnuwmHnVB6Cig+T1lVUHrklOaJIApIb6nkGq3CS/9bD8+SCS2NEdAAP/QYWnBi0ubWXVMRyDLypmwRpzLNSZ0xLYGFUl2PjieZYKRcz1dd/J7S+FnXhPtdjXweq0FS63zTcMe7ggjfmzSOWUCEFmMjZPaM0Be+3PweieCO1dxlHuy7ugCkx2S7d+5hNsicIhQmTADjqtJAkHoMhYqu6/yLFxhjO/+f938PATFULdODTvjCsUwdN/ySWi1Oj4uPAntfytZP7H6YrzLh8dS73QCsdkhhDJIgJskHIBSbRyyEVUnOvQgD9VaBVGHtc1KtZQTwc41OUO3BGPHl97s3oX6bqWqo/L53dB3TPHGx+1+2HL/F0zaDZuHhAKMkPwe8LFPMPB/ur65zXMHjnWb2ZTVVdoIvkbQ7nu8ApI60ejxocYBsEyAuC2CPXU2ki4jdEhm0E1hIziWNE9/LTuM17ziQuJ6WpXOSMrfP4o5aVDmLp5ZGBSocrspOksgyI9XogHaO/r+Y6N3exy+giObFfMHkZVUpsKrKmtOJ7TC1Vg5HsYGlWW8RN8dkJV47bUXm9K4sMos9eYMUt/czykPAs+132cogpII3QxXpFZQqZg6SEPVfOiyqQzTUI=
file_glob: true
file: "${OPJ_RELEASE_PKG_FILE}"
skip_cleanup: true
on:
repo: uclouvain/openjpeg
tags: true
condition: "$OPJ_CI_INCLUDE_IF_DEPLOY = 1"

21
AUTHORS.md Normal file
View File

@ -0,0 +1,21 @@
# Authors of OpenJPEG
See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md)
David Janssens designed and implemented the first version of OpenJPEG.
Kaori Hagihara designed and implemented the first version of OpenJPIP.
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
Giuseppe Baruffa added the JPWL functionalities.
Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
Yannick Verschueren,
Herve Drolon,
Francois-Olivier Devaux,
Antonin Descampe
improved the libraries and utilities.

446
CHANGELOG.md Normal file
View File

@ -0,0 +1,446 @@
# Changelog
## [v2.1.2](https://github.com/uclouvain/openjpeg/releases/v2.1.2) (2016-09-28)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.1...v2.1.2)
**Closed issues:**
- null ptr dereference in convert.c:1331 [\#843](https://github.com/uclouvain/openjpeg/issues/843)
- Out-of-Bounds Read in function bmp24toimage of convertbmp.c [\#833](https://github.com/uclouvain/openjpeg/issues/833)
- Disable automatic compilation of t1\_generate\_luts in CMakeLists.txt [\#831](https://github.com/uclouvain/openjpeg/issues/831)
- CVE-2016-7163 Integer overflow in opj\_pi\_create\_decode [\#826](https://github.com/uclouvain/openjpeg/issues/826)
- Security Advisory for OpenJPEG [\#810](https://github.com/uclouvain/openjpeg/issues/810)
- Add dashboard with static lib [\#804](https://github.com/uclouvain/openjpeg/issues/804)
- hidden visibility for the static library / building with -DOPJ\_STATIC against shared lib [\#802](https://github.com/uclouvain/openjpeg/issues/802)
- Optimization when building library from source [\#799](https://github.com/uclouvain/openjpeg/issues/799)
- unsigned int16 on Solaris 11.2/sparc [\#796](https://github.com/uclouvain/openjpeg/issues/796)
- appveyor [\#793](https://github.com/uclouvain/openjpeg/issues/793)
- Please make a new release [\#782](https://github.com/uclouvain/openjpeg/issues/782)
- FFMpeg will not link to 2.1.1 release built as shared library [\#766](https://github.com/uclouvain/openjpeg/issues/766)
- API change since v2: opj\_event\_mgr\_t not available [\#754](https://github.com/uclouvain/openjpeg/issues/754)
- openjpeg.h needs dependencies [\#673](https://github.com/uclouvain/openjpeg/issues/673)
- "master" does not build on ubuntu [\#658](https://github.com/uclouvain/openjpeg/issues/658)
- Package 'openjp2', required by 'libopenjpip', not found [\#594](https://github.com/uclouvain/openjpeg/issues/594)
**Merged pull requests:**
- Fix PNM file reading [\#847](https://github.com/uclouvain/openjpeg/pull/847) ([mayeut](https://github.com/mayeut))
- Fix some issues reported by Coverity Scan [\#846](https://github.com/uclouvain/openjpeg/pull/846) ([stweil](https://github.com/stweil))
- Fix potential out-of-bounds read \(coverity\) [\#844](https://github.com/uclouvain/openjpeg/pull/844) ([stweil](https://github.com/stweil))
- Remove TODO for overflow check [\#842](https://github.com/uclouvain/openjpeg/pull/842) ([mayeut](https://github.com/mayeut))
- Add overflow checks for opj\_aligned\_malloc [\#841](https://github.com/uclouvain/openjpeg/pull/841) ([mayeut](https://github.com/mayeut))
- Flags in T1 shall be unsigned [\#840](https://github.com/uclouvain/openjpeg/pull/840) ([mayeut](https://github.com/mayeut))
- Fix some warnings [\#838](https://github.com/uclouvain/openjpeg/pull/838) ([mayeut](https://github.com/mayeut))
- Fix issue 833. [\#834](https://github.com/uclouvain/openjpeg/pull/834) ([trylab](https://github.com/trylab))
- Add overflow checks for opj\_aligned\_malloc [\#832](https://github.com/uclouvain/openjpeg/pull/832) ([mayeut](https://github.com/mayeut))
- Add test for issue 820 [\#829](https://github.com/uclouvain/openjpeg/pull/829) ([mayeut](https://github.com/mayeut))
- Add test for issue 826 [\#827](https://github.com/uclouvain/openjpeg/pull/827) ([mayeut](https://github.com/mayeut))
- Fix coverity 113065 \(CWE-484\) [\#824](https://github.com/uclouvain/openjpeg/pull/824) ([mayeut](https://github.com/mayeut))
- Add sanity check for tile coordinates [\#823](https://github.com/uclouvain/openjpeg/pull/823) ([mayeut](https://github.com/mayeut))
- Add test for PR 818 [\#822](https://github.com/uclouvain/openjpeg/pull/822) ([mayeut](https://github.com/mayeut))
- Update to libpng 1.6.25 [\#821](https://github.com/uclouvain/openjpeg/pull/821) ([mayeut](https://github.com/mayeut))
- CVE-2016-8332: fix incrementing of "l\_tcp-\>m\_nb\_mcc\_records" in opj\_j2k\_read\_mcc [\#820](https://github.com/uclouvain/openjpeg/pull/820) ([mayeut](https://github.com/mayeut))
- Add overflow check in opj\_tcd\_init\_tile [\#819](https://github.com/uclouvain/openjpeg/pull/819) ([mayeut](https://github.com/mayeut))
- Fix leak & invalid behavior of opj\_jp2\_read\_ihdr [\#818](https://github.com/uclouvain/openjpeg/pull/818) ([mayeut](https://github.com/mayeut))
- Add overflow check in opj\_j2k\_update\_image\_data [\#817](https://github.com/uclouvain/openjpeg/pull/817) ([mayeut](https://github.com/mayeut))
- Change 'restrict' define to 'OPJ\_RESTRICT' [\#816](https://github.com/uclouvain/openjpeg/pull/816) ([mayeut](https://github.com/mayeut))
- Switch to clang 3.8 [\#814](https://github.com/uclouvain/openjpeg/pull/814) ([mayeut](https://github.com/mayeut))
- Fix an integer overflow issue [\#809](https://github.com/uclouvain/openjpeg/pull/809) ([trylab](https://github.com/trylab))
- Update to lcms 2.8 [\#808](https://github.com/uclouvain/openjpeg/pull/808) ([mayeut](https://github.com/mayeut))
- Update to libpng 1.6.24 [\#807](https://github.com/uclouvain/openjpeg/pull/807) ([mayeut](https://github.com/mayeut))
- Reenable clang-3.9 build on travis [\#806](https://github.com/uclouvain/openjpeg/pull/806) ([mayeut](https://github.com/mayeut))
- Bit fields type [\#805](https://github.com/uclouvain/openjpeg/pull/805) ([smuehlst](https://github.com/smuehlst))
- Add compilation test for standalone inclusion of openjpeg.h [\#798](https://github.com/uclouvain/openjpeg/pull/798) ([mayeut](https://github.com/mayeut))
- jpwl: Remove non-portable data type u\_int16\_t \(fix issue \#796\) [\#797](https://github.com/uclouvain/openjpeg/pull/797) ([stweil](https://github.com/stweil))
- Fix dependency for pkg-config \(issue \#594\) [\#795](https://github.com/uclouvain/openjpeg/pull/795) ([stweil](https://github.com/stweil))
- Add .gitignore [\#787](https://github.com/uclouvain/openjpeg/pull/787) ([stweil](https://github.com/stweil))
## [v2.1.1](https://github.com/uclouvain/openjpeg/releases/tag/v2.1.1) (2016-07-05)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.1...v2.1.1)
**Implemented enhancements:**
- opj\_malloc replacement [\#625](https://github.com/uclouvain/openjpeg/issues/625)
- backport "-p" and "-force-rgb" options in 1.5 [\#606](https://github.com/uclouvain/openjpeg/issues/606)
- Use travis-ci matrix build [\#581](https://github.com/uclouvain/openjpeg/issues/581)
- Add Coverity Scan analysis [\#580](https://github.com/uclouvain/openjpeg/issues/580)
- Unnecessary rate distortion calculations [\#479](https://github.com/uclouvain/openjpeg/issues/479)
- Add images from various security issues to test suite [\#415](https://github.com/uclouvain/openjpeg/issues/415)
- Coding speed for 9/7 on 32bits platforms \(x86/ARM\) can be improved with a quick fix [\#220](https://github.com/uclouvain/openjpeg/issues/220)
**Fixed bugs:**
- Out-of-Bounds Access in function opj\_tgt\_reset of tgt.c [\#775](https://github.com/uclouvain/openjpeg/issues/775)
- Heap Buffer Overflow in function color\_cmyk\_to\_rgb of color.c [\#774](https://github.com/uclouvain/openjpeg/issues/774)
- division-by-zero \(SIGFPE\) error in opj\_tcd\_init\_tile function \(line 730 of tcd.c\) [\#733](https://github.com/uclouvain/openjpeg/issues/733)
- Out-Of-Bounds Read in sycc422\_to\_rgb function [\#726](https://github.com/uclouvain/openjpeg/issues/726)
- Heap Corruption in opj\_free function [\#725](https://github.com/uclouvain/openjpeg/issues/725)
- Out-Of-Bounds Read in opj\_tcd\_free\_tile function [\#724](https://github.com/uclouvain/openjpeg/issues/724)
- Cannot handle box of undefined size [\#653](https://github.com/uclouvain/openjpeg/issues/653)
- Compilation fails without platform-supplied aligned malloc [\#642](https://github.com/uclouvain/openjpeg/issues/642)
- HP compiler warns about redeclaration of static function [\#640](https://github.com/uclouvain/openjpeg/issues/640)
- Implementation-defined behavior of malloc causes different behavior on Linux and AIX [\#635](https://github.com/uclouvain/openjpeg/issues/635)
- Build on AIX fails because "opj\_includes.h" is included after system headers [\#633](https://github.com/uclouvain/openjpeg/issues/633)
- Compiling with SSE2 on Linux 32-bit causes crashes in OpenJPEG [\#624](https://github.com/uclouvain/openjpeg/issues/624)
- Build on AIX fails because of "restrict" pointers [\#620](https://github.com/uclouvain/openjpeg/issues/620)
- bug in new tif conversion code [\#609](https://github.com/uclouvain/openjpeg/issues/609)
- bin/jp2/convert.c line 1085 Resource leak [\#607](https://github.com/uclouvain/openjpeg/issues/607)
- bin/jp2/convert.c memory leak [\#601](https://github.com/uclouvain/openjpeg/issues/601)
- Resource leak in opj\_j2k\_create\_cstr\_index in case of failure [\#599](https://github.com/uclouvain/openjpeg/issues/599)
- Resource leak in opj\_j2k\_encode in case of failure [\#598](https://github.com/uclouvain/openjpeg/issues/598)
- Resource leak in opj\_j2k\_decode\_one\_tile in case of failure [\#597](https://github.com/uclouvain/openjpeg/issues/597)
- Resource Leak [\#573](https://github.com/uclouvain/openjpeg/issues/573)
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) [\#571](https://github.com/uclouvain/openjpeg/issues/571)
- Use-after-free in opj\_j2k\_write\_mco [\#563](https://github.com/uclouvain/openjpeg/issues/563)
- openjpeg-master-2015-07-30 failed to compile on LINUX [\#556](https://github.com/uclouvain/openjpeg/issues/556)
- PNG images are always read as RGB\(A\) images [\#536](https://github.com/uclouvain/openjpeg/issues/536)
- g4\_colr.j2c not handled properly [\#532](https://github.com/uclouvain/openjpeg/issues/532)
- Bigendian: opj\_compress + opj\_decompress fails [\#518](https://github.com/uclouvain/openjpeg/issues/518)
- Suspicious code in j2k.c [\#517](https://github.com/uclouvain/openjpeg/issues/517)
- Decode times almost double\(!!\) on Visual Studio 2013, 2015 [\#505](https://github.com/uclouvain/openjpeg/issues/505)
- opj\_data/input/nonregression/issue226.j2k [\#500](https://github.com/uclouvain/openjpeg/issues/500)
- opj\_setup\_encoder always returns true [\#497](https://github.com/uclouvain/openjpeg/issues/497)
- Double free in j2k\_read\_ppm\_v3 parsing \(\(presumably invalid\) image. [\#496](https://github.com/uclouvain/openjpeg/issues/496)
- Invalid write in opj\_j2k\_update\_image\_data [\#495](https://github.com/uclouvain/openjpeg/issues/495)
- Undefined printf format specifier %ud used in code [\#494](https://github.com/uclouvain/openjpeg/issues/494)
- Potential double free on malloc failure in opj\_j2k\_copy\_default\_tcp\_and\_create\_tcp\(\) [\#492](https://github.com/uclouvain/openjpeg/issues/492)
- Do not link with -ffast-math [\#488](https://github.com/uclouvain/openjpeg/issues/488)
- Heap-buffer-overflow in opj\_dwt\_decode [\#486](https://github.com/uclouvain/openjpeg/issues/486)
- opj\_dump fails on Windows 7, 64 bits [\#482](https://github.com/uclouvain/openjpeg/issues/482)
- SIGSEGV in opj\_j2k\_update\_image\_data via pdfium\_test [\#481](https://github.com/uclouvain/openjpeg/issues/481)
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#477](https://github.com/uclouvain/openjpeg/issues/477)
- Invalid image causes write past end of heap buffer [\#476](https://github.com/uclouvain/openjpeg/issues/476)
- Assertion `l\_res-\>x0 \>= 0' fails when parsing invalid images [\#475](https://github.com/uclouvain/openjpeg/issues/475)
- Bug on opj\_write\_bytes\_BE function [\#472](https://github.com/uclouvain/openjpeg/issues/472)
- Refactor j2k\_read\_ppm\_v3 function [\#470](https://github.com/uclouvain/openjpeg/issues/470)
- compression: strange precinct dimensions [\#466](https://github.com/uclouvain/openjpeg/issues/466)
- \(:- Console message in opj\_decompress -:\) [\#465](https://github.com/uclouvain/openjpeg/issues/465)
- opj\_decompress fails to decompress any files [\#463](https://github.com/uclouvain/openjpeg/issues/463)
- bio-\>ct is unnecessarily set to zero in opj\_bio\_flush method [\#461](https://github.com/uclouvain/openjpeg/issues/461)
- Maximal unsigned short is 65535, not 65536 [\#460](https://github.com/uclouvain/openjpeg/issues/460)
- OpenJpeg fails to encode components with different precision properly [\#459](https://github.com/uclouvain/openjpeg/issues/459)
- component precision upscaling isn't correct in opj\_decompress [\#458](https://github.com/uclouvain/openjpeg/issues/458)
- Multiple precision components won't get encoded to jp2 if 1 component is unsigned 1 bit [\#457](https://github.com/uclouvain/openjpeg/issues/457)
- Incorrect code in ../bin/jp2/convert.c, function rawtoimage\_common\(...\) [\#456](https://github.com/uclouvain/openjpeg/issues/456)
- \[OpenJPEG-trunk\] opj\_stream\_get\_number\_byte\_left throws assert [\#455](https://github.com/uclouvain/openjpeg/issues/455)
- NR-DEC-kodak\_2layers\_lrcp.j2c-31-decode-md5 fails randomly when running tests in parallel [\#454](https://github.com/uclouvain/openjpeg/issues/454)
- compare\_raw\_files doesn't report an error on invalid arguments / missing input files [\#453](https://github.com/uclouvain/openjpeg/issues/453)
- Forward discrete wavelet transform: implement periodic symmetric extension at boundaries [\#452](https://github.com/uclouvain/openjpeg/issues/452)
- Bug in tiff reading method in convert.c [\#449](https://github.com/uclouvain/openjpeg/issues/449)
- Image in pdf don't display [\#447](https://github.com/uclouvain/openjpeg/issues/447)
- Multiple issues causing opj\_decompress to segfault [\#446](https://github.com/uclouvain/openjpeg/issues/446)
- opj\_compress: 40% of encode time is spent freeing data [\#445](https://github.com/uclouvain/openjpeg/issues/445)
- Multiple warnings when configuring OpenJPEG on MacOS with CMake 3.x \(trunk\) [\#443](https://github.com/uclouvain/openjpeg/issues/443)
- valgrind memleak found [\#437](https://github.com/uclouvain/openjpeg/issues/437)
- global-buffer-overflow src/lib/openjp2/t1.c:1146 opj\_t1\_getwmsedec [\#436](https://github.com/uclouvain/openjpeg/issues/436)
- Warning introduced on trunk r2923 & r2924 [\#435](https://github.com/uclouvain/openjpeg/issues/435)
- heap-buffer-overflow in opj\_t1\_decode\_cblks [\#432](https://github.com/uclouvain/openjpeg/issues/432)
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#431](https://github.com/uclouvain/openjpeg/issues/431)
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#430](https://github.com/uclouvain/openjpeg/issues/430)
- Heap-buffer-overflow in opj\_jp2\_apply\_pclr [\#429](https://github.com/uclouvain/openjpeg/issues/429)
- issue412 revisited [\#428](https://github.com/uclouvain/openjpeg/issues/428)
- Image distorted \(sides look cankered\) [\#423](https://github.com/uclouvain/openjpeg/issues/423)
- openjpeg-2.x-trunk-r2918 is broken in color.c [\#422](https://github.com/uclouvain/openjpeg/issues/422)
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#420](https://github.com/uclouvain/openjpeg/issues/420)
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#418](https://github.com/uclouvain/openjpeg/issues/418)
- UNKNOWN in opj\_read\_bytes\_LE [\#417](https://github.com/uclouvain/openjpeg/issues/417)
- Transparency problem [\#416](https://github.com/uclouvain/openjpeg/issues/416)
- Image with per channel alpha \(cdef\) does not decode properly [\#414](https://github.com/uclouvain/openjpeg/issues/414)
- OpenJPEG crashes with attached image [\#413](https://github.com/uclouvain/openjpeg/issues/413)
- Palette image with cdef fails to decompress [\#412](https://github.com/uclouvain/openjpeg/issues/412)
- Invalid member values from opj\_read\_header or opj\_decode ? [\#411](https://github.com/uclouvain/openjpeg/issues/411)
- MD5 Checksum hangs under valgrind on MacOS X [\#410](https://github.com/uclouvain/openjpeg/issues/410)
- Heap-buffer-overflow in opj\_tcd\_get\_decoded\_tile\_size [\#408](https://github.com/uclouvain/openjpeg/issues/408)
- C++ style comments in trunk/src/lib/openjp2/j2k.c [\#407](https://github.com/uclouvain/openjpeg/issues/407)
- Backport bugfixes from trunk to 2.1 branch [\#405](https://github.com/uclouvain/openjpeg/issues/405)
- Heap-buffer-overflow in parse\_cmdline\_encoder [\#403](https://github.com/uclouvain/openjpeg/issues/403)
- Heap-buffer-overflow in opj\_v4dwt\_interleave\_h [\#400](https://github.com/uclouvain/openjpeg/issues/400)
- Heap-buffer-overflow in opj\_dwt\_decode [\#399](https://github.com/uclouvain/openjpeg/issues/399)
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#398](https://github.com/uclouvain/openjpeg/issues/398)
- Heap-buffer-overflow in opj\_jp2\_apply\_cdef [\#397](https://github.com/uclouvain/openjpeg/issues/397)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#396](https://github.com/uclouvain/openjpeg/issues/396)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#395](https://github.com/uclouvain/openjpeg/issues/395)
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#394](https://github.com/uclouvain/openjpeg/issues/394)
- Heap-double-free in j2k\_read\_ppm\_v3 [\#393](https://github.com/uclouvain/openjpeg/issues/393)
- Security hole in j2k.c [\#392](https://github.com/uclouvain/openjpeg/issues/392)
- Security: double-free in opj\_tcd\_code\_block\_dec\_deallocate [\#391](https://github.com/uclouvain/openjpeg/issues/391)
- check for negative-size params in code [\#390](https://github.com/uclouvain/openjpeg/issues/390)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#389](https://github.com/uclouvain/openjpeg/issues/389)
- Heap overflow in OpenJpeg 1.5.2 [\#388](https://github.com/uclouvain/openjpeg/issues/388)
- openjpip.so.6 file too short [\#387](https://github.com/uclouvain/openjpeg/issues/387)
- Corrupted JP3D file [\#386](https://github.com/uclouvain/openjpeg/issues/386)
- variable assigned to itself [\#383](https://github.com/uclouvain/openjpeg/issues/383)
- Null pointer dereferencing [\#382](https://github.com/uclouvain/openjpeg/issues/382)
- bad use of case statement [\#381](https://github.com/uclouvain/openjpeg/issues/381)
- Release 2.1 as a Ubuntu package [\#380](https://github.com/uclouvain/openjpeg/issues/380)
- Bug in libopenjpwl.pc [\#374](https://github.com/uclouvain/openjpeg/issues/374)
- inconsistent tile numbering in decode output message [\#370](https://github.com/uclouvain/openjpeg/issues/370)
- error in code block calculations [\#369](https://github.com/uclouvain/openjpeg/issues/369)
- r2872 fails to compile due to "attempt to use poisoned malloc" error in j2k.c [\#368](https://github.com/uclouvain/openjpeg/issues/368)
- OSX build gives libopenjp2.6.dylib with not-absolute install name id [\#367](https://github.com/uclouvain/openjpeg/issues/367)
- opj\_decompress gives error but successfully decompress in OPJ 2.1 [\#366](https://github.com/uclouvain/openjpeg/issues/366)
- pngtoimage\(\) and imagetopng\(\) have wrong byte order for 16-Bit image [\#365](https://github.com/uclouvain/openjpeg/issues/365)
- PDF crash in chrome - part2 \(due to attachment limit\) [\#364](https://github.com/uclouvain/openjpeg/issues/364)
- PDF crash in chrome - part1 [\#363](https://github.com/uclouvain/openjpeg/issues/363)
- PDF crash in chrome - part0 [\#362](https://github.com/uclouvain/openjpeg/issues/362)
- Compilation fails on Windows with mingw32 gcc4.8 [\#361](https://github.com/uclouvain/openjpeg/issues/361)
- security issue [\#360](https://github.com/uclouvain/openjpeg/issues/360)
- improve memory management [\#359](https://github.com/uclouvain/openjpeg/issues/359)
- how to compress a yuv420 raw data using opj\_compress [\#357](https://github.com/uclouvain/openjpeg/issues/357)
- Some memory allocation are not checked [\#355](https://github.com/uclouvain/openjpeg/issues/355)
- Static library symbols shall be marked as hidden [\#354](https://github.com/uclouvain/openjpeg/issues/354)
- opj\_compress rejects valid bmp files [\#353](https://github.com/uclouvain/openjpeg/issues/353)
- opj\_compress crashes when number of resolutions is set to zero [\#352](https://github.com/uclouvain/openjpeg/issues/352)
- Compilation error under Visual Studio 2003 [\#351](https://github.com/uclouvain/openjpeg/issues/351)
- opj\_compress description example error \[Low priority\] [\#350](https://github.com/uclouvain/openjpeg/issues/350)
- opj\_write\_bytes\_BE is wrong in trunk [\#345](https://github.com/uclouvain/openjpeg/issues/345)
- PART1ONLY option in release.sh doesn't work properly [\#332](https://github.com/uclouvain/openjpeg/issues/332)
- openjpeg crash error [\#330](https://github.com/uclouvain/openjpeg/issues/330)
- openjpeg decompress error [\#329](https://github.com/uclouvain/openjpeg/issues/329)
- openjpeg decompress issue [\#326](https://github.com/uclouvain/openjpeg/issues/326)
- limited tif support [\#322](https://github.com/uclouvain/openjpeg/issues/322)
- asoc value of 65536 is allowed [\#321](https://github.com/uclouvain/openjpeg/issues/321)
- opj\_skip\_from\_file error [\#314](https://github.com/uclouvain/openjpeg/issues/314)
- Heavy quota usage in openjpeg [\#309](https://github.com/uclouvain/openjpeg/issues/309)
- Verify -help actually match letter [\#307](https://github.com/uclouvain/openjpeg/issues/307)
- g3\_colr.j2c not handled [\#288](https://github.com/uclouvain/openjpeg/issues/288)
- reopen/fix issue 165 [\#280](https://github.com/uclouvain/openjpeg/issues/280)
- kakadu conformance tests [\#279](https://github.com/uclouvain/openjpeg/issues/279)
- missing break after case statement in opj\_dwt\_decode\_real [\#274](https://github.com/uclouvain/openjpeg/issues/274)
- Run Coverity on trunk [\#270](https://github.com/uclouvain/openjpeg/issues/270)
- NR-ENC-random-issue-0005.tif-12-encode [\#259](https://github.com/uclouvain/openjpeg/issues/259)
- Use new add\_test signature to handle cross compilation [\#258](https://github.com/uclouvain/openjpeg/issues/258)
- Loss decoding quality in 2.0.0 [\#254](https://github.com/uclouvain/openjpeg/issues/254)
- Decompress that worked in 1.5.1 fails in 2.0 [\#252](https://github.com/uclouvain/openjpeg/issues/252)
- Expected endianness with raw input is not documented leading to SEGFAULT [\#251](https://github.com/uclouvain/openjpeg/issues/251)
- OpenJPEG writes to stderr [\#246](https://github.com/uclouvain/openjpeg/issues/246)
- Inconsistent logging of tile index [\#245](https://github.com/uclouvain/openjpeg/issues/245)
- patch for openjpeg-trunk-r2347 and BIG\_ENDIAN [\#242](https://github.com/uclouvain/openjpeg/issues/242)
- CMAP: MTYP == 0 \(direct use\) not handled properly [\#235](https://github.com/uclouvain/openjpeg/issues/235)
- Black Pixel [\#233](https://github.com/uclouvain/openjpeg/issues/233)
- opj\_compress runtime error after fresh Linux install due to apparent failure to execute ldconfig [\#219](https://github.com/uclouvain/openjpeg/issues/219)
- openjp2 debug works, release build does not [\#217](https://github.com/uclouvain/openjpeg/issues/217)
- openjpeg-branch15-r2299 and openjpeg-trunk-r2299 fail to decode a JP2 file [\#212](https://github.com/uclouvain/openjpeg/issues/212)
- openjpeg-trunk issue with Win7 [\#201](https://github.com/uclouvain/openjpeg/issues/201)
- undefined reference to `opj\_version' [\#200](https://github.com/uclouvain/openjpeg/issues/200)
- In tgt.c we used fprintf not the openjpeg message reporter [\#184](https://github.com/uclouvain/openjpeg/issues/184)
- Windows binaries not working under WinXP [\#176](https://github.com/uclouvain/openjpeg/issues/176)
- add ability to use intel ipp \(performance primitive\) within OpenJPEG [\#164](https://github.com/uclouvain/openjpeg/issues/164)
- Migration guide v2 [\#160](https://github.com/uclouvain/openjpeg/issues/160)
- Cannot decompress JPEG2000Aware3.18.7.3Win32\_kdutranscode6.3.1.j2k [\#158](https://github.com/uclouvain/openjpeg/issues/158)
- Cannot decompress JPEG2000Aware3.18.7.3Win32.j2k [\#157](https://github.com/uclouvain/openjpeg/issues/157)
- openjpeg@googlegroups.com has disappeard [\#153](https://github.com/uclouvain/openjpeg/issues/153)
- OpenJPEG 1.5.0 crashes on a ridiculously big file... [\#151](https://github.com/uclouvain/openjpeg/issues/151)
- opj\_image vs free [\#146](https://github.com/uclouvain/openjpeg/issues/146)
- Windows .dll file invalid [\#140](https://github.com/uclouvain/openjpeg/issues/140)
- Problem with second layer of a 2 layer coded LRCP \(with precincts\) [\#135](https://github.com/uclouvain/openjpeg/issues/135)
- version 1.4 crashes when opening PDF file with JPEG2000 images [\#133](https://github.com/uclouvain/openjpeg/issues/133)
- Setup a win64 dashboard [\#132](https://github.com/uclouvain/openjpeg/issues/132)
- J2KP4files/codestreams\_profile0/p0\_13.j2k question jpeg2000 [\#131](https://github.com/uclouvain/openjpeg/issues/131)
- Out of memory: Kill process 11204 \(opj\_server\) score 917 or sacrifice child [\#123](https://github.com/uclouvain/openjpeg/issues/123)
- FILE\* in opj API is unsafe [\#120](https://github.com/uclouvain/openjpeg/issues/120)
- third-party lib order [\#119](https://github.com/uclouvain/openjpeg/issues/119)
- openjpeg-1.5.0-Darwin-powerpc.dmg is huge ! [\#113](https://github.com/uclouvain/openjpeg/issues/113)
- misleading info in JP2 box lead to wrong number of components [\#110](https://github.com/uclouvain/openjpeg/issues/110)
- Image\_to\_j2k says that j2k files is generated but no file is on the HDD [\#109](https://github.com/uclouvain/openjpeg/issues/109)
- Error in openjpegV1.4 on compiling image\_to\_j2k: crash on reading bmp file [\#108](https://github.com/uclouvain/openjpeg/issues/108)
- Update to abi-compliance-checker 1.96 [\#106](https://github.com/uclouvain/openjpeg/issues/106)
- Decode error on the attached JPEG...works in KDU and with JASPER...please help! [\#101](https://github.com/uclouvain/openjpeg/issues/101)
- Mac binaries v1.4 is broken [\#95](https://github.com/uclouvain/openjpeg/issues/95)
- jp2\_read\_boxhdr\(\) has size bug in version 1 [\#92](https://github.com/uclouvain/openjpeg/issues/92)
- Support for Java JAI Imageio [\#90](https://github.com/uclouvain/openjpeg/issues/90)
- encoding test failing [\#86](https://github.com/uclouvain/openjpeg/issues/86)
- source archive on demand [\#85](https://github.com/uclouvain/openjpeg/issues/85)
- CMakeLists.txt and Makefile.am for JPIP are buggy [\#84](https://github.com/uclouvain/openjpeg/issues/84)
- pclr-cmap-cdef [\#82](https://github.com/uclouvain/openjpeg/issues/82)
- Error when compiling openjpeg\_v1\_4\_sources\_r697 [\#79](https://github.com/uclouvain/openjpeg/issues/79)
- J2K codec issue on Windows Mobile [\#77](https://github.com/uclouvain/openjpeg/issues/77)
- image\_to\_j2k.exe crashes on large .bmp file [\#75](https://github.com/uclouvain/openjpeg/issues/75)
- fatal error C1900 building the project on windows [\#65](https://github.com/uclouvain/openjpeg/issues/65)
- same option but different size [\#54](https://github.com/uclouvain/openjpeg/issues/54)
- Missing openjpegConfigure.h [\#38](https://github.com/uclouvain/openjpeg/issues/38)
- Not an issue in openjpeg, but ... [\#37](https://github.com/uclouvain/openjpeg/issues/37)
- OpenJPEG-1.3.0 pclr, cmap and cdef [\#27](https://github.com/uclouvain/openjpeg/issues/27)
- realloc maybe too big \(t2.c\) [\#26](https://github.com/uclouvain/openjpeg/issues/26)
- libopenjpeg/opj\_malloc.h breaks on FreeBSD/Darwin systems [\#20](https://github.com/uclouvain/openjpeg/issues/20)
- image\_to\_j2k not outputting to win32 console properly [\#18](https://github.com/uclouvain/openjpeg/issues/18)
- \[OpenJPEG\] OpenJPEG\_v13: tiled image part 2 [\#17](https://github.com/uclouvain/openjpeg/issues/17)
- JP2 Color Space modification by Matteo Italia [\#13](https://github.com/uclouvain/openjpeg/issues/13)
- Patch submission \( exotic video formats, and a few things \) [\#12](https://github.com/uclouvain/openjpeg/issues/12)
- 16 bits lossy compression [\#10](https://github.com/uclouvain/openjpeg/issues/10)
- pnm file formats not accepting bitdepth greater than 8 bpp [\#8](https://github.com/uclouvain/openjpeg/issues/8)
- Heap corruption in j2k encoder [\#5](https://github.com/uclouvain/openjpeg/issues/5)
- JPWL crash in marker reallocation\(+patch\), segfault while decoding image with main header protection [\#4](https://github.com/uclouvain/openjpeg/issues/4)
- a couple of small errors in libopenjpeg detected by coverity [\#1](https://github.com/uclouvain/openjpeg/issues/1)
**Closed issues:**
- Shared library build broken on ubuntu [\#728](https://github.com/uclouvain/openjpeg/issues/728)
- opj\_includes.h shouldn't define `\_\_attribute\_\_` [\#727](https://github.com/uclouvain/openjpeg/issues/727)
- Possible website problems due to Jekyll upgrade [\#713](https://github.com/uclouvain/openjpeg/issues/713)
- Stable Release? [\#712](https://github.com/uclouvain/openjpeg/issues/712)
- Meta Issue : try to fix some of these critical bugs before thinking about optimizing the library [\#710](https://github.com/uclouvain/openjpeg/issues/710)
- Tiled encoding broken for images with non power of 2 dimensions [\#702](https://github.com/uclouvain/openjpeg/issues/702)
- install\_name \(still\) not set on OS X [\#700](https://github.com/uclouvain/openjpeg/issues/700)
- Add section in wiki describing where one can get test images [\#699](https://github.com/uclouvain/openjpeg/issues/699)
- Make EvenManager into singleton [\#698](https://github.com/uclouvain/openjpeg/issues/698)
- Remove old branches from repo [\#696](https://github.com/uclouvain/openjpeg/issues/696)
- MQ Coder encode: Conditional jump or move depends on uninitialised value\(s\) [\#695](https://github.com/uclouvain/openjpeg/issues/695)
- Can we add these files to our test suite ? [\#688](https://github.com/uclouvain/openjpeg/issues/688)
- -t and -d command line flags for decode are not documented on OpenJPEG website [\#685](https://github.com/uclouvain/openjpeg/issues/685)
- Decoding at the precinct level [\#676](https://github.com/uclouvain/openjpeg/issues/676)
- Support unscaled 10 bit data for 2K cinema @ 48 FPS, as per DCI standard [\#671](https://github.com/uclouvain/openjpeg/issues/671)
- Use parallel jobs in ctest [\#664](https://github.com/uclouvain/openjpeg/issues/664)
- \[Security\]Multiple Memory error [\#663](https://github.com/uclouvain/openjpeg/issues/663)
- lossy encoding a 16 bit TIF file : severe artifiacts in decompressed image [\#660](https://github.com/uclouvain/openjpeg/issues/660)
- opj\_compress and opj\_decompress : get\_next\_file method uses hard-coded unix path separator [\#630](https://github.com/uclouvain/openjpeg/issues/630)
- Uninitialized variable [\#629](https://github.com/uclouvain/openjpeg/issues/629)
- Use of enum variable for bit flags prevents compilation as C++ source [\#619](https://github.com/uclouvain/openjpeg/issues/619)
- Serious problem with quantization during lossy encoding [\#615](https://github.com/uclouvain/openjpeg/issues/615)
- Decompression does not work with sequential data source [\#613](https://github.com/uclouvain/openjpeg/issues/613)
- potential overflow in opj\_tcd\_tile\_t [\#605](https://github.com/uclouvain/openjpeg/issues/605)
- Logical condition [\#596](https://github.com/uclouvain/openjpeg/issues/596)
- file9.jp2 does not dump correctly on 1.5 [\#595](https://github.com/uclouvain/openjpeg/issues/595)
- opj\_compress man page is missing documentation of -jpip option [\#593](https://github.com/uclouvain/openjpeg/issues/593)
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) in 1.5 branch [\#591](https://github.com/uclouvain/openjpeg/issues/591)
- Example: opj\_compress -i image.j2k -o image.pgm [\#577](https://github.com/uclouvain/openjpeg/issues/577)
- Mismatching delete [\#575](https://github.com/uclouvain/openjpeg/issues/575)
- Compilation fails on Win7 [\#546](https://github.com/uclouvain/openjpeg/issues/546)
- NR-JP2-file5.jp2-compare2base fails with third party libcms [\#540](https://github.com/uclouvain/openjpeg/issues/540)
- CTest spits out an error at the end of the test run [\#516](https://github.com/uclouvain/openjpeg/issues/516)
- opj\_uint\_adds\(\) is questionable [\#515](https://github.com/uclouvain/openjpeg/issues/515)
- Might consider renaming this method: [\#491](https://github.com/uclouvain/openjpeg/issues/491)
- opj\_compress run twice gives different fiile sizes for same file [\#490](https://github.com/uclouvain/openjpeg/issues/490)
- Android Support [\#483](https://github.com/uclouvain/openjpeg/issues/483)
- Add SSE2/SSE41 implementations for mct.c [\#451](https://github.com/uclouvain/openjpeg/issues/451)
- Reduce encoder code block memory usage for non 64x64 code block sizes [\#444](https://github.com/uclouvain/openjpeg/issues/444)
- valgrind "Uninitialized Memory Read" & "Uninitialized Memory Conditional" found [\#438](https://github.com/uclouvain/openjpeg/issues/438)
- No way to debug opj\_tcd\_init\_encode\_tile or opj\_tcd\_init\_decode\_tile [\#433](https://github.com/uclouvain/openjpeg/issues/433)
- Add option to call dsymutil on built binaries [\#409](https://github.com/uclouvain/openjpeg/issues/409)
- Allow opj\_compress and opj\_decompress to read/write images over stdin/stdout [\#379](https://github.com/uclouvain/openjpeg/issues/379)
- reduce memory significantly for single tile RGB encoding [\#375](https://github.com/uclouvain/openjpeg/issues/375)
- Switch code repo to github and start using pull request workflow [\#373](https://github.com/uclouvain/openjpeg/issues/373)
- This is a BigTIFF file. This format not supported [\#125](https://github.com/uclouvain/openjpeg/issues/125)
- Add a test suite to check the convert functions [\#99](https://github.com/uclouvain/openjpeg/issues/99)
- Add build config to the dashboard to verify the autotools build [\#88](https://github.com/uclouvain/openjpeg/issues/88)
**Merged pull requests:**
- Correct abi-check.sh for PR [\#791](https://github.com/uclouvain/openjpeg/pull/791) ([mayeut](https://github.com/mayeut))
- Update tcd.c [\#790](https://github.com/uclouvain/openjpeg/pull/790) ([maddin200](https://github.com/maddin200))
- Update lcms2 [\#773](https://github.com/uclouvain/openjpeg/pull/773) ([mayeut](https://github.com/mayeut))
- Use lowercase for cmake commands consistenly [\#769](https://github.com/uclouvain/openjpeg/pull/769) ([julienmalik](https://github.com/julienmalik))
- Ignore clang's summary warning [\#768](https://github.com/uclouvain/openjpeg/pull/768) ([julienmalik](https://github.com/julienmalik))
- Fix UBSan gcc warning for first arg to memset non null [\#767](https://github.com/uclouvain/openjpeg/pull/767) ([julienmalik](https://github.com/julienmalik))
- Update to libtiff-4.0.6 [\#764](https://github.com/uclouvain/openjpeg/pull/764) ([mayeut](https://github.com/mayeut))
- Fix warnings [\#763](https://github.com/uclouvain/openjpeg/pull/763) ([mayeut](https://github.com/mayeut))
- Check SSIZ is valid in opj\_j2k\_read\_siz [\#762](https://github.com/uclouvain/openjpeg/pull/762) ([mayeut](https://github.com/mayeut))
- Fix unsigned int overflow reported by UBSan [\#761](https://github.com/uclouvain/openjpeg/pull/761) ([mayeut](https://github.com/mayeut))
- Fix unsigned int overflow reported by UBSan [\#759](https://github.com/uclouvain/openjpeg/pull/759) ([mayeut](https://github.com/mayeut))
- Fix negative shift left reported by UBSan [\#758](https://github.com/uclouvain/openjpeg/pull/758) ([mayeut](https://github.com/mayeut))
- Fix negative shift left reported by UBSan [\#757](https://github.com/uclouvain/openjpeg/pull/757) ([mayeut](https://github.com/mayeut))
- Add clang 3.9 build to Travis matrix [\#753](https://github.com/uclouvain/openjpeg/pull/753) ([julienmalik](https://github.com/julienmalik))
- Fix implicit floating bool conversion [\#752](https://github.com/uclouvain/openjpeg/pull/752) ([julienmalik](https://github.com/julienmalik))
- Do not define \_\_attribute\_\_ in opj\_includes.h [\#751](https://github.com/uclouvain/openjpeg/pull/751) ([mayeut](https://github.com/mayeut))
- Allow to read/write 3/5/7/9/11/13/15 bpp TIF files [\#750](https://github.com/uclouvain/openjpeg/pull/750) ([mayeut](https://github.com/mayeut))
- Fix heap-buffer-overflow in color\_esycc\_to\_rgb [\#748](https://github.com/uclouvain/openjpeg/pull/748) ([mayeut](https://github.com/mayeut))
- update libpng to from 1.6.17 to 1.6.21 [\#747](https://github.com/uclouvain/openjpeg/pull/747) ([julienmalik](https://github.com/julienmalik))
- Update cmake & jpylyzer for travis builds [\#746](https://github.com/uclouvain/openjpeg/pull/746) ([julienmalik](https://github.com/julienmalik))
- Fix Out-Of-Bounds Read in sycc42x\_to\_rgb function [\#745](https://github.com/uclouvain/openjpeg/pull/745) ([mayeut](https://github.com/mayeut))
- cppcheck fix for openjp2 [\#740](https://github.com/uclouvain/openjpeg/pull/740) ([julienmalik](https://github.com/julienmalik))
- Fix uninitialized variable reported by cppcheck [\#735](https://github.com/uclouvain/openjpeg/pull/735) ([julienmalik](https://github.com/julienmalik))
- Remove dead code in opj\_dump [\#734](https://github.com/uclouvain/openjpeg/pull/734) ([julienmalik](https://github.com/julienmalik))
- issue \#695 MQ Encode: ensure that bp pointer never points to uninitialized memory [\#708](https://github.com/uclouvain/openjpeg/pull/708) ([boxerab](https://github.com/boxerab))
- Fix issue 135 [\#706](https://github.com/uclouvain/openjpeg/pull/706) ([mayeut](https://github.com/mayeut))
- Fix implementation of opj\_calloc [\#705](https://github.com/uclouvain/openjpeg/pull/705) ([stweil](https://github.com/stweil))
- \[git/2.1 regression\] Fix opj\_write\_tile\(\) failure when numresolutions=1 [\#690](https://github.com/uclouvain/openjpeg/pull/690) ([rouault](https://github.com/rouault))
- Fix fatal crash on 64 bit Linux [\#687](https://github.com/uclouvain/openjpeg/pull/687) ([stweil](https://github.com/stweil))
- \[libtiff\] Add missing include statement for ssize\_t [\#686](https://github.com/uclouvain/openjpeg/pull/686) ([mayeut](https://github.com/mayeut))
- Fix duplicate article in comments [\#684](https://github.com/uclouvain/openjpeg/pull/684) ([stweil](https://github.com/stweil))
- Fix grammar in comment [\#679](https://github.com/uclouvain/openjpeg/pull/679) ([stweil](https://github.com/stweil))
- Remove whitespace and CR at line endings [\#678](https://github.com/uclouvain/openjpeg/pull/678) ([stweil](https://github.com/stweil))
- Fix typos [\#665](https://github.com/uclouvain/openjpeg/pull/665) ([jwilk](https://github.com/jwilk))
- Add missing source for the JPIP library and executables \(issue \#658\) [\#659](https://github.com/uclouvain/openjpeg/pull/659) ([stweil](https://github.com/stweil))
- Fix undefined size jp2 box handling [\#654](https://github.com/uclouvain/openjpeg/pull/654) ([mayeut](https://github.com/mayeut))
- opj\_decompress: Update error message [\#651](https://github.com/uclouvain/openjpeg/pull/651) ([stweil](https://github.com/stweil))
- Fix support of posix\_memalloc for Linux [\#648](https://github.com/uclouvain/openjpeg/pull/648) ([stweil](https://github.com/stweil))
- Fix typo in comments [\#647](https://github.com/uclouvain/openjpeg/pull/647) ([stweil](https://github.com/stweil))
- Avoid pointer arithmetic with \(void \*\) pointers [\#644](https://github.com/uclouvain/openjpeg/pull/644) ([smuehlst](https://github.com/smuehlst))
- Fix HP compiler warning about redeclaration of function \(\#640\) [\#641](https://github.com/uclouvain/openjpeg/pull/641) ([smuehlst](https://github.com/smuehlst))
- Fix format strings and unneeded assignment [\#638](https://github.com/uclouvain/openjpeg/pull/638) ([stweil](https://github.com/stweil))
- Fix repository for JPEG2000 test data [\#637](https://github.com/uclouvain/openjpeg/pull/637) ([stweil](https://github.com/stweil))
- Update allocation functions [\#636](https://github.com/uclouvain/openjpeg/pull/636) ([mayeut](https://github.com/mayeut))
- Fix OpenJPEG GitHub issue \#633. [\#634](https://github.com/uclouvain/openjpeg/pull/634) ([smuehlst](https://github.com/smuehlst))
- travis-ci: Include add ons in matrix [\#632](https://github.com/uclouvain/openjpeg/pull/632) ([mayeut](https://github.com/mayeut))
- Add Appveyor [\#627](https://github.com/uclouvain/openjpeg/pull/627) ([mayeut](https://github.com/mayeut))
- Use Travis-ci to run ABI check [\#626](https://github.com/uclouvain/openjpeg/pull/626) ([mayeut](https://github.com/mayeut))
- Fix warnings for C++ [\#623](https://github.com/uclouvain/openjpeg/pull/623) ([stweil](https://github.com/stweil))
- Fixed problem that C++ compilation failed because of enum variable. [\#622](https://github.com/uclouvain/openjpeg/pull/622) ([smuehlst](https://github.com/smuehlst))
- Added missing casts for return values of opj\_malloc\(\)/opj\_calloc\(\). [\#618](https://github.com/uclouvain/openjpeg/pull/618) ([smuehlst](https://github.com/smuehlst))
- Add check for seek support before trying TPsot==TNsot workaround [\#617](https://github.com/uclouvain/openjpeg/pull/617) ([mayeut](https://github.com/mayeut))
- Fix some typos found by codespell [\#610](https://github.com/uclouvain/openjpeg/pull/610) ([stweil](https://github.com/stweil))
- Correct leak in color\_cielab\_to\_rgb [\#590](https://github.com/uclouvain/openjpeg/pull/590) ([mayeut](https://github.com/mayeut))
- Add Travis-ci build matrix [\#584](https://github.com/uclouvain/openjpeg/pull/584) ([mayeut](https://github.com/mayeut))
- Correct lossless issue on linux x86 [\#579](https://github.com/uclouvain/openjpeg/pull/579) ([mayeut](https://github.com/mayeut))
- Travis-ci update [\#578](https://github.com/uclouvain/openjpeg/pull/578) ([mayeut](https://github.com/mayeut))
- Correct CMake version requirements [\#572](https://github.com/uclouvain/openjpeg/pull/572) ([mayeut](https://github.com/mayeut))
- Add tests for CMYK/esYCC/CIELab [\#567](https://github.com/uclouvain/openjpeg/pull/567) ([mayeut](https://github.com/mayeut))
- Add support for CIELab, EYCC and CMYK [\#559](https://github.com/uclouvain/openjpeg/pull/559) ([szukw000](https://github.com/szukw000))
- Remove printf/fprintf to stdout/stderr throughout openjp2 lib [\#558](https://github.com/uclouvain/openjpeg/pull/558) ([mayeut](https://github.com/mayeut))
- better -ffast-math handling [\#555](https://github.com/uclouvain/openjpeg/pull/555) ([rdieter](https://github.com/rdieter))
- Add jpylyzer tests for JP2 compression [\#552](https://github.com/uclouvain/openjpeg/pull/552) ([mayeut](https://github.com/mayeut))
- Add COC/QCC in main header when needed [\#551](https://github.com/uclouvain/openjpeg/pull/551) ([mayeut](https://github.com/mayeut))
- Use \_\_emul under msvc x86 for fast 64 = 32 \* 32 [\#550](https://github.com/uclouvain/openjpeg/pull/550) ([mayeut](https://github.com/mayeut))
- Update convert for PNG output [\#549](https://github.com/uclouvain/openjpeg/pull/549) ([mayeut](https://github.com/mayeut))
- Remove some warnings when building [\#548](https://github.com/uclouvain/openjpeg/pull/548) ([mayeut](https://github.com/mayeut))
- Switch to libpng-1.6.17 [\#547](https://github.com/uclouvain/openjpeg/pull/547) ([mayeut](https://github.com/mayeut))
- Add some missing static keywords [\#545](https://github.com/uclouvain/openjpeg/pull/545) ([mayeut](https://github.com/mayeut))
- Switch to libcms2 mm2/Little-CMS@0e8234e090d6aab33f90e2eb0296f30aa0705e57 [\#544](https://github.com/uclouvain/openjpeg/pull/544) ([mayeut](https://github.com/mayeut))
- Prevent overflow when coding 16 bits images [\#543](https://github.com/uclouvain/openjpeg/pull/543) ([mayeut](https://github.com/mayeut))
- Switch to libcms2-2.6 [\#542](https://github.com/uclouvain/openjpeg/pull/542) ([mayeut](https://github.com/mayeut))
- Update PNG support [\#538](https://github.com/uclouvain/openjpeg/pull/538) ([mayeut](https://github.com/mayeut))
- Various Minor fixes [\#537](https://github.com/uclouvain/openjpeg/pull/537) ([mayeut](https://github.com/mayeut))
- Update TIFF conversion to support more bit depth. [\#535](https://github.com/uclouvain/openjpeg/pull/535) ([mayeut](https://github.com/mayeut))
- Add checks for odd looking cmap & for cmap outside jp2h box [\#534](https://github.com/uclouvain/openjpeg/pull/534) ([mayeut](https://github.com/mayeut))
- Refactor opj\_j2k\_read\_ppm & opj\_j2k\_read\_ppt [\#533](https://github.com/uclouvain/openjpeg/pull/533) ([mayeut](https://github.com/mayeut))
- Add option to force component splitting in imagetopnm [\#531](https://github.com/uclouvain/openjpeg/pull/531) ([mayeut](https://github.com/mayeut))
- fix Suspicious code in j2k.c \#517 [\#529](https://github.com/uclouvain/openjpeg/pull/529) ([renevanderark](https://github.com/renevanderark))
- Update zlib to version 1.2.8 [\#528](https://github.com/uclouvain/openjpeg/pull/528) ([mayeut](https://github.com/mayeut))
- Fix opj\_write\_bytes\_BE \(\#518\) [\#521](https://github.com/uclouvain/openjpeg/pull/521) ([manisandro](https://github.com/manisandro))
- Correctly decode files with incorrect tile-part header fields \(TPsot==TNsot\) [\#514](https://github.com/uclouvain/openjpeg/pull/514) ([mayeut](https://github.com/mayeut))
- Fixed typos [\#510](https://github.com/uclouvain/openjpeg/pull/510) ([radarhere](https://github.com/radarhere))
- Formatted the readme file [\#507](https://github.com/uclouvain/openjpeg/pull/507) ([htmfilho](https://github.com/htmfilho))
## [version.2.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.1) (2014-04-29)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0.1...version.2.1)
## [version.2.0.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0.1) (2014-04-22)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.2...version.2.0.1)
## [version.1.5.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.2) (2014-03-28)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0...version.1.5.2)
## [version.2.0](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0) (2014-03-28)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.1...version.2.0)
## [version.1.5.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.1) (2012-09-13)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5...version.1.5.1)
## [version.1.5](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5) (2012-02-07)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.3...version.1.5)
## [version.1.3](https://github.com/uclouvain/openjpeg/releases/tag/version.1.3) (2011-07-03)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.4...version.1.3)
## [version.1.4](https://github.com/uclouvain/openjpeg/releases/tag/version.1.4) (2011-07-03)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.2...version.1.4)
## [version.1.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.2) (2007-06-04)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.1...version.1.2)
## [version.1.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.1) (2007-01-31)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.0...version.1.1)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

388
CMakeLists.txt Normal file
View File

@ -0,0 +1,388 @@
# Main CMakeLists.txt to build the OpenJPEG project using CMake (www.cmake.org)
# Written by Mathieu Malaterre
# This CMake project will by default create a library called openjpeg
# But if you want to use this project within your own (CMake) project
# you will eventually like to prefix the library to avoid linking confusion
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
# e.g.:
# set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
cmake_minimum_required(VERSION 2.8.2)
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
if (NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
cmake_policy(SET CMP0042 NEW)
endif()
endif()
if(NOT OPENJPEG_NAMESPACE)
set(OPENJPEG_NAMESPACE "OPENJPEG")
set(OPENJPEG_STANDALONE 1)
endif()
# In all cases:
#string(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
set(OPENJPEG_LIBRARY_NAME openjp2)
project(${OPENJPEG_NAMESPACE} C)
# Do full dependency headers.
include_regular_expression("^.*$")
#-----------------------------------------------------------------------------
# OPENJPEG version number, useful for packaging and doxygen doc:
set(OPENJPEG_VERSION_MAJOR 2)
set(OPENJPEG_VERSION_MINOR 2)
set(OPENJPEG_VERSION_BUILD 0)
set(OPENJPEG_VERSION
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
set(PACKAGE_VERSION
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
# Because autotools does not support X.Y notation for SOVERSION, we have to use
# two numbering, one for the openjpeg version and one for openjpeg soversion
# version | soversion
# 1.0 | 0
# 1.1 | 1
# 1.2 | 2
# 1.3 | 3
# 1.4 | 4
# 1.5 | 5
# 1.5.1 | 5
# 2.0 | 6
# 2.0.1 | 6
# 2.1 | 7
# 2.1.1 | 7
# 2.1.2 | 7
# 2.2.0 | 8
# above is the recommendation by the OPJ team. If you really need to override this default,
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
if(NOT OPENJPEG_SOVERSION)
set(OPENJPEG_SOVERSION 7)
endif(NOT OPENJPEG_SOVERSION)
set(OPENJPEG_LIBRARY_PROPERTIES
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
SOVERSION "${OPENJPEG_SOVERSION}"
)
# --------------------------------------------------------------------------
# Path to additional CMake modules
set(CMAKE_MODULE_PATH
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake
${CMAKE_MODULE_PATH})
# --------------------------------------------------------------------------
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
# warnings
if(WIN32)
if(NOT BORLAND)
if(NOT CYGWIN)
if(NOT MINGW)
if(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
add_definitions(
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
-D_CRT_IS_WCTYPE_NO_DEPRECATE
-D_CRT_MANAGED_FP_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE_GLOBALS
-D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE
-D_CRT_TIME_FUNCTIONS_NO_DEPRECATE
-D_CRT_VCCLRIT_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
)
endif()
endif()
endif()
endif()
endif()
# --------------------------------------------------------------------------
# Install directories
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
string(TOLOWER ${PROJECT_NAME} projectname)
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
if(NOT OPENJPEG_INSTALL_BIN_DIR)
set(OPENJPEG_INSTALL_BIN_DIR "bin")
endif()
if(NOT OPENJPEG_INSTALL_LIB_DIR)
set(OPENJPEG_INSTALL_LIB_DIR "lib")
endif()
if(NOT OPENJPEG_INSTALL_SHARE_DIR)
set(OPENJPEG_INSTALL_SHARE_DIR "share")
endif()
if(NOT OPENJPEG_INSTALL_DATA_DIR)
set(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
endif()
if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
endif()
if(BUILD_DOC)
if(NOT OPENJPEG_INSTALL_MAN_DIR)
set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
endif()
if(NOT OPENJPEG_INSTALL_DOC_DIR)
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
endif()
endif()
if(NOT OPENJPEG_INSTALL_JNI_DIR)
if(WIN32)
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
else()
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
endif()
endif()
if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
# We could install *.cmake files in share/ however those files contains
# hardcoded path to libraries on a multi-arch system (fedora/debian) those
# path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
endif()
if (APPLE)
list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}")
option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF)
endif()
#-----------------------------------------------------------------------------
# Big endian test:
include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
#-----------------------------------------------------------------------------
# Setup file for setting custom ctest vars
configure_file(
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/CTestCustom.cmake.in
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/CTestCustom.cmake
@ONLY
)
#-----------------------------------------------------------------------------
# OpenJPEG build configuration options.
option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
set (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
set (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
#-----------------------------------------------------------------------------
# configure name mangling to allow multiple libraries to coexist
# peacefully
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
@ONLY)
endif()
#-----------------------------------------------------------------------------
# Compiler specific flags:
if(CMAKE_COMPILER_IS_GNUCC)
# For all builds, make sure openjpeg is std99 compliant:
# set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
set(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
endif()
#-----------------------------------------------------------------------------
# opj_config.h generation (1/2)
# Check if some include files are provided by the system
include(EnsureFileInclude)
# These files are mandatory
ensure_file_include("string.h" HAVE_STRING_H YES)
ensure_file_include("memory.h" HAVE_MEMORY_H YES)
ensure_file_include("stdlib.h" HAVE_STDLIB_H YES)
ensure_file_include("stdio.h" HAVE_STDIO_H YES)
ensure_file_include("math.h" HAVE_MATH_H YES)
ensure_file_include("float.h" HAVE_FLOAT_H YES)
ensure_file_include("time.h" HAVE_TIME_H YES)
ensure_file_include("stdarg.h" HAVE_STDARG_H YES)
ensure_file_include("ctype.h" HAVE_CTYPE_H YES)
ensure_file_include("assert.h" HAVE_ASSERT_H YES)
# For the following files, we provide an alternative, they are not mandatory
ensure_file_include("stdint.h" OPJ_HAVE_STDINT_H NO)
ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
# why check this one ? for openjpip ?
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
# Enable Large file support
include(TestLargeFiles)
OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES)
# Allocating Aligned Memory Blocks
include(CheckIncludeFiles)
check_include_files(malloc.h OPJ_HAVE_MALLOC_H)
include(CheckSymbolExists)
# _aligned_alloc https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
check_symbol_exists(_aligned_malloc malloc.h OPJ_HAVE__ALIGNED_MALLOC)
# posix_memalign (needs _POSIX_C_SOURCE >= 200112L on Linux)
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L)
check_symbol_exists(posix_memalign stdlib.h OPJ_HAVE_POSIX_MEMALIGN)
unset(CMAKE_REQUIRED_DEFINITIONS)
# memalign (obsolete)
check_symbol_exists(memalign malloc.h OPJ_HAVE_MEMALIGN)
#-----------------------------------------------------------------------------
# Build Library
if(BUILD_JPIP_SERVER)
find_package(CURL REQUIRED)
find_package(FCGI REQUIRED)
find_package(Threads REQUIRED)
if(NOT CMAKE_USE_PTHREADS_INIT)
message(FATAL_ERROR "Only pthread are supported")
endif()
endif()
add_subdirectory(src/lib)
option(BUILD_LUTS_GENERATOR "Build utility to generate t1_luts.h" OFF)
#-----------------------------------------------------------------------------
# Build Applications
option(BUILD_CODEC "Build the CODEC executables" ON)
option(BUILD_MJ2 "Build the MJ2 executables." OFF)
option(BUILD_JPWL "Build the JPWL library and executables" OFF)
option(BUILD_JPIP "Build the JPIP library and executables." OFF)
if(BUILD_JPIP)
option(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
endif()
option(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
option(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
option(BUILD_JP3D "Build the JP3D comp" OFF)
mark_as_advanced(BUILD_VIEWER)
mark_as_advanced(BUILD_JAVA)
mark_as_advanced(BUILD_JP3D)
if(BUILD_CODEC OR BUILD_MJ2)
# OFF: It will only build 3rd party libs if they are not found on the system
# ON: 3rd party libs will ALWAYS be build, and used
option(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
add_subdirectory(thirdparty)
add_subdirectory(src/bin)
endif ()
add_subdirectory(wrapping)
#-----------------------------------------------------------------------------
# opj_config.h generation (2/2)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h
@ONLY
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config_private.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config_private.h
@ONLY
)
#-----------------------------------------------------------------------------
# build documentation in doc subdir:
if(BUILD_DOC)
add_subdirectory(doc)
endif()
#-----------------------------------------------------------------------------
# Buld Testing
option(BUILD_TESTING "Build the tests." OFF)
if(BUILD_TESTING)
if(BUILD_CODEC)
enable_testing()
include(CTest)
# Search openjpeg data needed for the tests
# They could be found via git on the OpenJPEG GitHub code project
# git clone https://github.com/uclouvain/openjpeg-data.git
find_path(OPJ_DATA_ROOT README-OPJ-Data
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
)
# Add repository where to find tests
add_subdirectory(tests)
else()
message(FATAL_ERROR "You need build codec to run the tests")
endif()
endif()
#-----------------------------------------------------------------------------
# install all targets referenced as OPENJPEGTargets
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
@ONLY
)
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
)
#-----------------------------------------------------------------------------
# install CHANGES and LICENSE
if(BUILD_DOC)
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
endif()
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
endif()
include (cmake/OpenJPEGCPack.cmake)
#-----------------------------------------------------------------------------
# pkgconfig support
# enabled by default on Unix, disabled by default on other platforms
if(UNIX)
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" ON)
else()
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" OFF)
endif()
if(BUILD_PKGCONFIG_FILES)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
#
if(BUILD_JPWL)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpwl/libopenjpwl.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
endif()
#
if(BUILD_JPIP)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpip/libopenjpip.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
endif()
#
if(BUILD_JP3D)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp3d/libopenjp3d.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
endif()
endif()
#-----------------------------------------------------------------------------

7
CTestConfig.cmake Normal file
View File

@ -0,0 +1,7 @@
set(CTEST_PROJECT_NAME "OPENJPEG")
set(CTEST_NIGHTLY_START_TIME "3:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=OPENJPEG")
set(CTEST_DROP_SITE_CDASH TRUE)

View File

@ -1,13 +0,0 @@
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'

View File

@ -1,15 +0,0 @@
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,14 +0,0 @@
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no
# Put CVS lock files in this directory rather than directly in the repository.
#LockDir=/var/lock/cvs
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
# history file, or a subset as needed (ie `TMAR' logs all write operations)
#LogHistory=TOFEWGCMAR

View File

@ -1,23 +0,0 @@
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'

View File

@ -1,21 +0,0 @@
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.

View File

@ -1,26 +0,0 @@
# The "loginfo" file controls where "cvs commit" log information
# is sent. The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT. If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter. The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators. The format
# characters are:
#
# s = file name
# V = old version number (pre-checkin)
# v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog

View File

@ -1,26 +0,0 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.

View File

@ -1,12 +0,0 @@
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"

View File

@ -1,13 +0,0 @@
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,20 +0,0 @@
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4-> file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@ -1,21 +0,0 @@
# The "verifymsg" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.

75
INSTALL.md Normal file
View File

@ -0,0 +1,75 @@
# OpenJPEG installation
The build method maintained by OpenJPEG is [CMake](https://cmake.org/).
## UNIX/LINUX - MacOS (terminal) - WINDOWS (cygwin, MinGW)
To build the library, type from source tree directory:
```
mkdir build
cd build
cmake ..
make
```
Binaries are then located in the 'bin' directory.
To install the library, type with root privileges:
```
make install
make clean
```
To build the html documentation, you need doxygen to be installed on your system.
It will create an "html" directory in TOP\_LEVEL/build/doc)
```
make doc
```
Main available cmake flags:
* To specify the install path: '-DCMAKE\_INSTALL\_PREFIX=/path'
* To build the shared libraries and links the executables against it: '-DBUILD\_SHARED\_LIBS:bool=on' (default: 'ON')
> Note: when using this option, static libraries are not built and executables are dynamically linked.
* To build the CODEC executables: '-DBUILD\_CODEC:bool=on' (default: 'ON')
* [OBSOLETE] To build the MJ2 executables: '-DBUILD\_MJ2:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPWL executables and JPWL library: '-DBUILD\_JPWL:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPIP client (java compiler recommended) library and executables: '-DBUILD\_JPIP:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPIP server (need fcgi) library and executables: '-DBUILD\_JPIP\_SERVER:bool=on' (default: 'OFF')
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
```
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory' -DBUILDNAME:STRING='name_of_the_build'
make
make Experimental
```
Note : test data is available on the following github repo: https://github.com/uclouvain/openjpeg-data
If '-DOPJ\_DATA\_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE\_SOURCE\_DIR}/../data'.
Note 2 : to execute the encoding test suite, kakadu binaries are needed to decode encoded image and compare it to the baseline. Kakadu binaries are freely available for non-commercial purposes at http://www.kakadusoftware.com. kdu\_expand will need to be in your PATH for cmake to find it.
Note 3 : OpenJPEG encoder and decoder (not the library itself !) depends on several libraries: png, tiff, lcms, z. If these libraries are not found on the system, they are automatically built from the versions available in the source tree. You can force the use of these embedded version with BUILD\_THIRDPARTY:BOOL=ON. On a Debian-like system you can also simply install these libraries with:
```
sudo apt-get install liblcms2-dev libtiff-dev libpng-dev libz-dev
```
Note 4 : On MacOS, if it does not work, try adding the following flag to the cmake command :
```
-DCMAKE_OSX_ARCHITECTURES:STRING=i386
```
## MacOS (XCode) - WINDOWS (VisualStudio, etc)
You can use cmake to generate the project files for the IDE you are using (VC2010, XCode, etc).
Type 'cmake --help' for available generators on your platform.
# Using OpenJPEG
To use openjpeg exported cmake file, simply create your application doing:
```
$ cat CMakeLists.txt
find_package(OpenJPEG REQUIRED)
include_directories(${OPENJPEG_INCLUDE_DIRS})
add_executable(myapp myapp.c)
target_link_libraries(myapp ${OPENJPEG_LIBRARIES})
```

View File

@ -1,7 +1,19 @@
/*
* Copyright (c) 2001-2003, David Janssens
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2009, Francois-Olivier Devaux
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* Copyright (c) 2012, CS Systemes d'Information, France
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,15 +37,3 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "j2k.h"
int bmptoimage(char *filename, j2k_image_t * img, int subsampling_dx,
int subsampling_dy, int Dim[2]);
int pgxtoimage(char *filename, j2k_image_t * img, int tdy,
int subsampling_dx, int subsampling_dy, int Dim[2],
j2k_cp_t cp);
int pnmtoimage(char *filename, j2k_image_t * img, int subsampling_dx,
int subsampling_dy, int Dim[2]);

72
NEWS.md Normal file
View File

@ -0,0 +1,72 @@
# OpenJPEG NEWS
More details in the [Changelog](https://github.com/uclouvain/openjpeg/blob/master/CHANGELOG.md)
## OpenJPEG 2.1.2
* Bug fixes (including security fixes)
* No API/ABI break compared to v2.1.1
## OpenJPEG 2.1.1
* Huge amount of critical bugfixes
* Speed improvements
* No API/ABI break compared to v2.1
## OpenJPEG 2.1.0
### New Features
* Digital Cinema profiles have been fixed and updated
* New option to disable MCT if needed
* extended RAW support: it is now possible to input raw images
with subsampled color components (422, 420, etc)
* New way to deal with profiles
### API/ABI modifications
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
* Removed deprecated functions
* opj_stream_create_default_file_stream(FILE*,...)
* opj_stream_create_file_stream(FILE*,...)
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data)
* Added
* opj_stream_create_default_file_stream(char*,...)
* opj_stream_create_file_stream(char*,...)
* opj_stream_destroy(opj_stream_t*)
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data,
... opj_stream_free_user_data_fn p_function)
* JPEG 2000 profiles and Part-2 extensions defined through '#define'
* Changed
* 'alpha' field added to 'opj_image_comp' structure
* 'OPJ_CLRSPC_EYCC' added to enum COLOR_SPACE
* 'OPJ_CLRSPC_CMYK' added to enum COLOR_SPACE
* 'OPJ_CODEC_JPP' and 'OPJ_CODEC_JPX' added to CODEC_FORMAT
(not yet used in use)
* 'max_cs_size' and 'rsiz' fields added to opj_cparameters_t
### Misc
* OpenJPEG is now officially conformant with JPEG 2000 Part-1
and will soon become official reference software at the
JPEG committee.
* Huge amount of bug fixes. See CHANGES for details.
## OpenJPEG 2.0.0
### New Features
* streaming capabilities
* merge JP3D
### API modifications
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
* Use a 64bits capable API
### Misc
* removed autotools build system
* folders hierarchies reorganisation
* Huge amount of bug fixes. See CHANGES for details.

82
README.md Normal file
View File

@ -0,0 +1,82 @@
# OPENJPEG Library and Applications
## What is OpenJPEG ?
OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of [JPEG 2000](http://www.jpeg.org/jpeg2000), a still-image compression standard from the Joint Photographic Experts Group ([JPEG](http://www.jpeg.org)). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a [JPEG 2000 Reference Software](http://www.itu.int/rec/T-REC-T.804-201504-I!Amd2).
## Who can use the code ?
[![badge-license]][link-license]
Anyone. As the OpenJPEG code is released under the [BSD 2-clause "Simplified" License][link-license], anyone can use or modify the code, even for commercial applications. The only restriction is to retain the copyright in the sources or in the binaries documentation. Of course, if you modified the code in a way that might be of interest for other users, you are encouraged to share it (through a [github pull request](https://github.com/uclouvain/openjpeg/pulls) or by filling an [issue](https://github.com/uclouvain/openjpeg/issues)) but this is not a requirement.
## How to install and use OpenJPEG ?
API Documentation needs a major refactoring. Meanwhile, you can check [installation](https://github.com/uclouvain/openjpeg/wiki/Installation) instructions and [codec documentation](https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec).
## Current Status
[![badge-build]][link-build]
[![badge-msvc-build]][link-msvc-build]
[![badge-coverity]][link-coverity]
## Who are the developers ?
The library is developed and maintained by the Image and Signal Processing Group ([ISPGroup](http://sites.uclouvain.be/ispgroup/)), in the Université catholique de Louvain ([UCL](http://www.uclouvain.be/en-index.html), with the support of the [CNES](https://cnes.fr/), the [CS](http://www.c-s.fr/) company and the [intoPIX](http://www.intopix.com) company. The JPWL module has been developed by the Digital Signal Processing Lab ([DSPLab](http://dsplab.diei.unipg.it/)) of the University of Perugia, Italy ([UNIPG](http://www.unipg.it/)).
## Details on folders hierarchy
* src
* lib
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
* openjp3d: JP3D implementation
* openmj2: MJ2 implementation
* bin: contains all applications that use the openjpeg library
* common: common files to all applications
* jp2: a basic codec
* mj2: motion jpeg 2000 executables
* jpip: OpenJPIP applications (server and dec server)
* java: a Java client viewer for JPIP
* jp3d: JP3D applications
* tcltk: a test tool for JP3D
* wx
* OPJViewer: gui for displaying j2k files (based on wxWidget)
* wrapping
* java: java jni to use openjpeg in a java program
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
* doc: doxygen documentation setup file and man pages
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in [openjpeg-data](https://github.com/uclouvain/openjpeg-data) repository.
* cmake: cmake related files
See [LICENSE][link-license] for license and copyright information.
See [INSTALL](https://github.com/uclouvain/openjpeg/blob/master/INSTALL.md) for installation procedures.
See [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) for user visible changes in successive releases.
## API/ABI
An API/ABI timeline is automatically updated [here][link-api-timeline].
OpenJPEG strives to provide a stable API/ABI for your applications. As such it
only exposes a limited subset of its functions. It uses a mechanism of
exporting/hiding functions. If you are unsure which functions you can use in
your applications, you should compile OpenJPEG using something similar to gcc:
`-fvisibility=hidden` compilation flag.
See also: http://gcc.gnu.org/wiki/Visibility
On windows, MSVC directly supports export/hiding function and as such the only
API available is the one supported by OpenJPEG.
[comment-license]: https://img.shields.io/github/license/uclouvain/openjpeg.svg "https://img.shields.io/badge/license-BSD--2--Clause-blue.svg"
[badge-license]: https://img.shields.io/badge/license-BSD--2--Clause-blue.svg "BSD 2-clause "Simplified" License"
[link-license]: https://github.com/uclouvain/openjpeg/blob/master/LICENSE "BSD 2-clause "Simplified" License"
[badge-build]: https://travis-ci.org/uclouvain/openjpeg.svg?branch=master "Build Status"
[link-build]: https://travis-ci.org/uclouvain/openjpeg "Build Status"
[badge-msvc-build]: https://ci.appveyor.com/api/projects/status/github/uclouvain/openjpeg?branch=master&svg=true "Windows Build Status"
[link-msvc-build]: https://ci.appveyor.com/project/detonin/openjpeg/branch/master "Windows Build Status"
[badge-coverity]: https://scan.coverity.com/projects/6383/badge.svg "Coverity Scan Build Status"
[link-coverity]: https://scan.coverity.com/projects/uclouvain-openjpeg "Coverity Scan Build Status"
[link-api-timeline]: http://www.openjpeg.org/abi-check/timeline/openjpeg "OpenJPEG API/ABI timeline"

39
THANKS.md Normal file
View File

@ -0,0 +1,39 @@
# OpenJPEG THANKS file
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
or submitting actual code. Here is a list of these people. Help me keep
it complete and exempt of errors.
* Giuseppe Baruffa
* Ben Boeckel
* Aaron Boxer
* David Burken
* Matthieu Darbois
* Rex Dieter
* Herve Drolon
* Antonin Descampe
* Francois-Olivier Devaux
* Parvatha Elangovan
* Jerôme Fimes
* Bob Friesenhahn
* Kaori Hagihara
* Luc Hermitte
* Luis Ibanez
* David Janssens
* Hans Johnson
* Callum Lerwick
* Ke Liu (Tencent's Xuanwu LAB)
* Sebastien Lugan
* Benoit Macq
* Mathieu Malaterre
* Julien Malik
* Arnaud Maye
* Vincent Nicolas
* Aleksander Nikolic (Cisco Talos)
* Glenn Pearson
* Even Rouault
* Dzonatas Sol
* Winfried Szukalski
* Vincent Torri
* Yannick Verschueren
* Peter Wimmer

38
appveyor.yml Normal file
View File

@ -0,0 +1,38 @@
version: 2.1.1.{build}
branches:
except:
- coverity_scan
skip_tags: false
clone_depth: 50
environment:
matrix:
- OPJ_CI_ARCH: x86
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
OPJ_CI_INCLUDE_IF_DEPLOY: 1
- OPJ_CI_ARCH: x64
OPJ_CI_VSCOMNTOOLS: $(VS140COMNTOOLS)
OPJ_CI_INCLUDE_IF_DEPLOY: 1
- OPJ_CI_ARCH: x86
OPJ_CI_VSCOMNTOOLS: $(VS100COMNTOOLS)
install:
- cmd: c:\cygwin\bin\bash ./tools/travis-ci/install.sh
build_script:
- cmd: >-
"%OPJ_CI_VSCOMNTOOLS%..\..\VC\vcvarsall.bat" %OPJ_CI_ARCH%
bash ./tools/travis-ci/run.sh
test: off
#before_deploy:
#- cmd: c:\cygwin\bin\bash ./tools/travis-ci/before_deploy.sh
deploy:
#release: openjpeg-$(appveyor_repo_tag_name)
description: 'OpenJPEG $(appveyor_repo_tag_name) has been released. More info [here](https://github.com/uclouvain/openjpeg/blob/$(appveyor_repo_tag_name)/NEWS) and a detailed view [here](https://github.com/uclouvain/openjpeg/blob/$(appveyor_repo_tag_name)/CHANGES).'
provider: GitHub
auth_token:
secure: Huk03f1heCD/HMyA+4ZeVmICdmKn9rPxK5p8/KxzgL+FtJDHlqcllcCrtN9bDxRH # your encrypted token from GitHub
artifact: /.*\.zip/ # upload all zip packages to release assets
draft: false
prerelease: false
on:
appveyor_repo_tag: true # deploy on tag push only
OPJ_CI_INCLUDE_IF_DEPLOY: 1

View File

@ -0,0 +1,40 @@
#----------------------------------------------------------------------
#
# For further details regarding this file,
# see http://www.cmake.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
#
# and
# http://www.kitware.com/blog/home/post/27
#
#----------------------------------------------------------------------
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
# Exclude files from the Testing directories
".*/tests/.*"
# Exclude files from the ThirdParty Utilities directories
".*/thirdparty/.*"
)
set(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
# Ignore clang's summary warning, assuming prior text has matched some
# other warning expression:
"[0-9,]+ warnings? generated."
# Suppress warning caused by intentional messages about deprecation
".*warning,.* is deprecated"
# java also warns about deprecated API
".*java.*deprecation"
".*deprecation.*"
# suppress warnings caused by 3rd party libs:
".*thirdparty.*"
"libtiff.*has no symbols"
"libpng.*has no symbols"
)

View File

@ -0,0 +1,26 @@
# Ensure that an include file is provided by the system
# Add the check about the mandatory status to the check_include_file macro
# provided by cmake
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
CHECK_INCLUDE_FILE(${INCLUDE_FILENAME} ${VARIABLE_NAME})
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
# "VARIABLE_NAME_VALUE=${${VARIABLE_NAME}} \n"
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
if (NOT ${${VARIABLE_NAME}})
if (${MANDATORY_STATUS})
message(FATAL_ERROR "The file ${INCLUDE_FILENAME} is mandatory but not found on your system")
endif()
endif()
endmacro()

16
cmake/FindCPPCHECK.cmake Normal file
View File

@ -0,0 +1,16 @@
# cppcheck
#
# Copyright (c) 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
find_program(CPPCHECK_EXECUTABLE
cppcheck
)
mark_as_advanced(
CPPCHECK_EXECUTABLE
)

20
cmake/FindFCGI.cmake Normal file
View File

@ -0,0 +1,20 @@
# Look for the header file.
find_path(FCGI_INCLUDE_DIR NAMES fastcgi.h)
# Look for the library.
find_library(FCGI_LIBRARY NAMES fcgi)
# Handle the QUIETLY and REQUIRED arguments and set FCGI_FOUND to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
# Copy the results to the output variables.
if(FCGI_FOUND)
set(FCGI_LIBRARIES ${FCGI_LIBRARY})
set(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
else()
set(FCGI_LIBRARIES)
set(FCGI_INCLUDE_DIRS)
endif()
mark_as_advanced(FCGI_INCLUDE_DIR FCGI_LIBRARY)

12
cmake/FindJPYLYZER.cmake Normal file
View File

@ -0,0 +1,12 @@
#
# this module looks for JPYLYZER
# http://jpylyzer.openpreservation.org
#
find_program(JPYLYZER_EXECUTABLE
jpylyzer
)
mark_as_advanced(
JPYLYZER_EXECUTABLE
)

24
cmake/FindKAKADU.cmake Normal file
View File

@ -0,0 +1,24 @@
#
# this module looks for KAKADU
# http://www.kakadusoftware.com/
#
#
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
find_program(KDU_EXPAND_EXECUTABLE
kdu_expand
)
find_program(KDU_COMPRESS_EXECUTABLE
kdu_compress
)
mark_as_advanced(
KDU_EXPAND_EXECUTABLE
KDU_COMPRESS_EXECUTABLE
)

31
cmake/FindLCMS.cmake Normal file
View File

@ -0,0 +1,31 @@
# - Find LCMS library
# Find the native LCMS includes and library
# Once done this will define
#
# LCMS_INCLUDE_DIR - Where to find lcms.h, etc.
# LCMS_LIBRARIES - Libraries to link against to use LCMS.
# LCMS_FOUND - If false, do not try to use LCMS.
#
# also defined, but not for general use are
# LCMS_LIBRARY, where to find the LCMS library.
#=============================================================================
#=============================================================================
find_path(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
set(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
find_library(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
if(LCMS_FOUND)
set( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
set( LCMS_LIBRARIES ${LCMS_LIBRARY} )
endif()

31
cmake/FindLCMS2.cmake Normal file
View File

@ -0,0 +1,31 @@
# - Find LCMS2 library
# Find the native LCMS2 includes and library
# Once done this will define
#
# LCMS2_INCLUDE_DIR - Where to find lcms2.h, etc.
# LCMS2_LIBRARIES - Libraries to link against to use LCMS2.
# LCMS2_FOUND - If false, do not try to use LCMS2.
#
# also defined, but not for general use are
# LCMS2_LIBRARY - Where to find the LCMS2 library.
#=============================================================================
#=============================================================================
find_path(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
set(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
find_library(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
if(LCMS2_FOUND)
set( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
set( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
endif()

View File

@ -0,0 +1,9 @@
# JPIP test driver
#message(STATUS "${D_URL}")
file(DOWNLOAD
"${D_URL}"
"${D_FILE}"
LOG log
EXPECTED_MD5 "${EXPECTED_MD5}"
)
message(STATUS "LOG: ${log}")

72
cmake/OpenJPEGCPack.cmake Normal file
View File

@ -0,0 +1,72 @@
# package bundler
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
set(CMAKE_INSTALL_MFC_LIBRARIES 0)
set(CMAKE_INSTALL_DEBUG_LIBRARIES 0)
if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
endif()
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
endif()
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${OPJ_PACKAGE_DESCRIPTION_SUMMARY})
set(CPACK_PACKAGE_VENDOR "OpenJPEG Team")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
"${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" COPYONLY
)
# For PackageMaker on MacOSX it is important to have a file extension:
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${OPENJPEG_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${OPENJPEG_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${OPENJPEG_VERSION_BUILD}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "openjpeg-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# Make this explicit here, rather than accepting the CPack default value,
# so we can refer to it:
set(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
if(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name
if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
set(CPACK_SYSTEM_NAME Cygwin)
else()
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
endif()
endif()
if(${CPACK_SYSTEM_NAME} MATCHES Windows)
if(CMAKE_CL_64)
set(CPACK_SYSTEM_NAME win64-x64)
else()
set(CPACK_SYSTEM_NAME win32-x86)
endif()
endif()
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
# default to source package - system, on cygwin system is not
# needed
if(CYGWIN)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
else()
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
endif()
endif()
set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
if(APPLE)
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
set(CPACK_BUNDLE_PLIST
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
#include(BundleUtilities)
endif()
include(CPack)
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

View File

@ -0,0 +1,48 @@
#-----------------------------------------------------------------------------
#
# OPENJPEGConfig.cmake - CMake configuration file for external projects.
#
# This file is configured by OPENJPEG and used by the UseOPENJPEG.cmake
# module to load OPENJPEG's settings for an external project.
@OPENJPEG_CONFIG_INSTALL_ONLY@
# The OPENJPEG version number.
set(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
set(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
set(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
# The libraries.
set(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@")
# The CMake macros dir.
set(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@")
# The configuration options.
set(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
# The "use" file.
set(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
# This is an install tree
include(${SELF_DIR}/OpenJPEGTargets.cmake)
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
else()
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
# This is a build tree
set( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
include(${SELF_DIR}/OpenJPEGExports.cmake)
else()
message(FATAL_ERROR "ooops")
endif()
endif()
set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
# Backward compatible part:
set(OPENJPEG_FOUND TRUE)

View File

@ -0,0 +1,11 @@
#include <sys/types.h>
/* Cause a compile-time error if off_t is smaller than 64 bits */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
int main(int argc, char **argv)
{
return 0;
}

View File

@ -0,0 +1,23 @@
#cmakedefine _LARGEFILE_SOURCE
#cmakedefine _LARGE_FILES
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
/* Cause a compile-time error if off_t is smaller than 64 bits,
* and make sure we have ftello / fseeko.
*/
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
FILE *fp = fopen(argv[0],"r");
off_t offset = ftello( fp );
fseeko( fp, offset, SEEK_CUR );
fclose(fp);
return 0;
}

134
cmake/TestLargeFiles.cmake Normal file
View File

@ -0,0 +1,134 @@
# - Define macro to check large file support
#
# OPJ_TEST_LARGE_FILES(VARIABLE)
#
# VARIABLE will be set to true if off_t is 64 bits, and fseeko/ftello present.
# This macro will also defines the necessary variable enable large file support, for instance
# _LARGE_FILES
# _LARGEFILE_SOURCE
# _FILE_OFFSET_BITS 64
# OPJ_HAVE_FSEEKO
#
# However, it is YOUR job to make sure these defines are set in a #cmakedefine so they
# end up in a config.h file that is included in your source if necessary!
#
# Adapted from Gromacs project (http://www.gromacs.org/)
# by Julien Malik
#
macro(OPJ_TEST_LARGE_FILES VARIABLE)
if(NOT DEFINED ${VARIABLE})
# On most platforms it is probably overkill to first test the flags for 64-bit off_t,
# and then separately fseeko. However, in the future we might have 128-bit filesystems
# (ZFS), so it might be dangerous to indiscriminately set e.g. _FILE_OFFSET_BITS=64.
message(STATUS "Checking for 64-bit off_t")
# First check without any special flags
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c")
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present")
endif()
if(NOT FILE64_OK)
# Test with _FILE_OFFSET_BITS=64
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64" )
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
set(_FILE_OFFSET_BITS 64)
endif()
endif()
if(NOT FILE64_OK)
# Test with _LARGE_FILES
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_LARGE_FILES" )
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
set(_LARGE_FILES 1)
endif()
endif()
if(NOT FILE64_OK)
# Test with _LARGEFILE_SOURCE
try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/cmake/TestFileOffsetBits.c"
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
if(FILE64_OK)
message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
set(_LARGEFILE_SOURCE 1)
endif()
endif()
#if(NOT FILE64_OK)
# # now check for Windows stuff
# try_compile(FILE64_OK "${PROJECT_BINARY_DIR}"
# "${PROJECT_SOURCE_DIR}/cmake/TestWindowsFSeek.c")
# if(FILE64_OK)
# message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
# set(HAVE__FSEEKI64 1)
# endif()
#endif()
if(NOT FILE64_OK)
message(STATUS "Checking for 64-bit off_t - not present")
endif()
set(_FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} CACHE INTERNAL "Result of test for needed _FILE_OFFSET_BITS=64")
set(_LARGE_FILES ${_LARGE_FILES} CACHE INTERNAL "Result of test for needed _LARGE_FILES")
set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
# Set the flags we might have determined to be required above
configure_file("${PROJECT_SOURCE_DIR}/cmake/TestLargeFiles.c.cmake.in"
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
message(STATUS "Checking for fseeko/ftello")
# Test if ftello/fseeko are available
try_compile(FSEEKO_COMPILE_OK
"${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
if(FSEEKO_COMPILE_OK)
message(STATUS "Checking for fseeko/ftello - present")
endif()
if(NOT FSEEKO_COMPILE_OK)
# glibc 2.2 needs _LARGEFILE_SOURCE for fseeko (but not for 64-bit off_t...)
try_compile(FSEEKO_COMPILE_OK
"${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c"
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE" )
if(FSEEKO_COMPILE_OK)
message(STATUS "Checking for fseeko/ftello - present with _LARGEFILE_SOURCE")
set(_LARGEFILE_SOURCE ${_LARGEFILE_SOURCE} CACHE INTERNAL "Result of test for needed _LARGEFILE_SOURCE")
endif()
endif()
if(FSEEKO_COMPILE_OK)
set(OPJ_HAVE_FSEEKO ON CACHE INTERNAL "Result of test for fseeko/ftello")
else()
message(STATUS "Checking for fseeko/ftello - not found")
set(OPJ_HAVE_FSEEKO OFF CACHE INTERNAL "Result of test for fseeko/ftello")
endif()
if(FILE64_OK AND FSEEKO_COMPILE_OK)
message(STATUS "Large File support - found")
set(${VARIABLE} ON CACHE INTERNAL "Result of test for large file support")
else()
message(STATUS "Large File support - not found")
set(${VARIABLE} OFF CACHE INTERNAL "Result of test for large file support")
endif()
endif()
endmacro()

11
cmake/TestWindowsFSeek.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
int main()
{
__int64 off=0;
_fseeki64(NULL, off, SEEK_SET);
return 0;
}

View File

@ -0,0 +1,39 @@
{
<Appears with libpng uses with Ubuntu10.04 (hulk)>
Memcheck:Cond
fun:deflate
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
fun:png_write_row
fun:imagetopng
fun:main
}
{
<Appears with libpng uses with Ubuntu10.04 (hulk)>
Memcheck:Value8
fun:crc32
obj:/lib/libpng12.so.0.42.0
fun:png_write_chunk
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
obj:/lib/libpng12.so.0.42.0
fun:png_write_row
fun:imagetopng
fun:main
}
{
<Appears with libpng uses with Ubuntu10.04 (hulk)>
Memcheck:Param
write(buf)
fun:__write_nocancel
fun:_IO_file_write@@GLIBC_2.2.5
fun:_IO_do_write@@GLIBC_2.2.5
fun:_IO_file_close_it@@GLIBC_2.2.5
fun:fclose@@GLIBC_2.2.5
fun:imagetopng
fun:main
}

View File

@ -1,6 +0,0 @@
obj
obj.w32
bin
bin.w32
lib
lib.w32

View File

@ -1,94 +0,0 @@
# $Id$
#
# makefile for OpenJPEG codec
OPENJPEG_DIR = ../libopenjpeg
ifndef DEBUG
LDFLAGS = -s -lm
else
LDFLAGS = -lm
endif
CFLAGS = -Wall -O3 -fno-strength-reduce -fomit-frame-pointer -I$(OPENJPEG_DIR)
OBJ_DIR_W32 = obj.w32
BIN_DIR_W32 = bin.w32
LIB_DIR_W32 = $(OPENJPEG_DIR)/lib.w32
ifdef MINGW32
CC = i386-mingw32-gcc
CFLAGS += -DDONT_HAVE_GETOPT
OBJ_DIR = $(OBJ_DIR_W32)
BIN_DIR = $(BIN_DIR_W32)
LIB_DIR = lib.w32
all: $(BIN_DIR) $(OBJ_DIR) $(LIB_DIR) \
$(addprefix $(BIN_DIR)/,j2k_to_image.exe image_to_j2k.exe)
else
CC = gcc
OBJ_DIR = obj
BIN_DIR = bin
LIB_DIR = lib
all: $(BIN_DIR) $(OBJ_DIR) $(LIB_DIR) \
$(addprefix $(BIN_DIR)/,j2k_to_image image_to_j2k)
endif
ifdef DYNAMIC
ifdef MINGW32
LIB_OPENJPEG = $(LIB_DIR)/libopenjpeg.dll
LDFLAGS += -L$(LIB_DIR) -lopenjpeg
else
LIB_OPENJPEG = $(OPENJPEG_DIR)/$(LIB_DIR)/libopenjpeg.so
LDFLAGS += -L$(OPENJPEG_DIR)/$(LIB_DIR) -lopenjpeg
endif
else
LIB_OPENJPEG = $(OPENJPEG_DIR)/$(LIB_DIR)/libopenjpeg.a
LDFLAGS += $(LIB_OPENJPEG)
endif
$(BIN_DIR):
mkdir $(BIN_DIR)
$(OBJ_DIR):
mkdir $(OBJ_DIR)
$(LIB_DIR):
mkdir $(LIB_DIR)
$(LIB_DIR)/libopenjpeg.dll: $(OPENJPEG_DIR)/$(LIB_DIR)/libopenjpeg.dll
ln -sf ../$< $@
$(OPENJPEG_DIR)/$(LIB_DIR)/libopenjpeg.dll:
cd $(OPENJPEG_DIR) && \
$(MAKE) $(OBJ_DIR) $(LIB_DIR) $(LIB_DIR)/libopenjpeg.dll
$(OPENJPEG_DIR)/$(LIB_DIR)/libopenjpeg.a:
cd $(OPENJPEG_DIR) && \
$(MAKE) $(OBJ_DIR) $(LIB_DIR) $(LIB_DIR)/libopenjpeg.a
$(OPENJPEG_DIR)/$(LIB_DIR)/libopenjpeg.so:
cd $(OPENJPEG_DIR) && \
$(MAKE) $(LIB_DIR) $(LIB_DIR)/libopenjpeg.so
$(OBJ_DIR)/%.o:
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(OBJ_DIR)/getopt.o: compat/getopt.c
$(OBJ_DIR)/convert.o: convert.c
$(OBJ_DIR)/j2k_to_image.o: j2k_to_image.c
$(OBJ_DIR)/image_to_j2k.o: image_to_j2k.c convert.h
J2I_OBJS = $(addprefix $(OBJ_DIR)/,j2k_to_image.o)
I2J_OBJS = $(addprefix $(OBJ_DIR)/,image_to_j2k.o convert.o)
$(BIN_DIR)/j2k_to_image: $(J2I_OBJS) $(LIB_OPENJPEG)
${CC} -o $@ $(J2I_OBJS) ${LDFLAGS}
$(BIN_DIR)/image_to_j2k: $(I2J_OBJS) $(LIB_OPENJPEG)
${CC} -o $@ $(I2J_OBJS) ${LDFLAGS}
$(BIN_DIR)/j2k_to_image.exe: $(J2I_OBJS) $(LIB_OPENJPEG)
${CC} -o $@ $(J2I_OBJS) ${LDFLAGS}
$(BIN_DIR)/image_to_j2k.exe: $(I2J_OBJS) $(LIB_OPENJPEG) $(OBJ_DIR)/getopt.o
${CC} -o $@ $(I2J_OBJS) ${LDFLAGS} $(OBJ_DIR)/getopt.o
clean:
rm -f $(BIN_DIR_W32)/* $(BIN_DIR)/* $(OBJ_DIR_W32)/* $(OBJ_DIR)/*

View File

@ -1,899 +0,0 @@
/*
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <openjpeg.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <string.h>
/* -->> -->> -->> -->>
BMP IMAGE FORMAT
<<-- <<-- <<-- <<-- */
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
typedef struct {
UINT2 bfType; /* 'BM' for Bitmap (19776) */
UINT4 bfSize; /* Size of the file */
UINT2 bfReserved1; /* Reserved : 0 */
UINT2 bfReserved2; /* Reserved : 0 */
UINT4 bfOffBits; /* Offset */
} BITMAPFILEHEADER_t;
typedef struct {
UINT4 biSize; /* Size of the structure in bytes */
UINT4 biWidth; /* Width of the image in pixels */
UINT4 biHeight; /* Heigth of the image in pixels */
UINT2 biPlanes; /* 1 */
UINT2 biBitCount; /* Number of color bits by pixels */
UINT4 biCompression; /* Type of encoding 0: none 1: RLE8 2: RLE4 */
UINT4 biSizeImage; /* Size of the image in bytes */
UINT4 biXpelsPerMeter; /* Horizontal (X) resolution in pixels/meter */
UINT4 biYpelsPerMeter; /* Vertical (Y) resolution in pixels/meter */
UINT4 biClrUsed; /* Number of color used in the image (0: ALL) */
UINT4 biClrImportant; /* Number of important color (0: ALL) */
} BITMAPINFOHEADER_t;
int bmptoimage(char *filename, j2k_image_t * img, int subsampling_dx,
int subsampling_dy, int Dim[2])
{
FILE *IN;
FILE *Compo0 = NULL, *Compo1 = NULL, *Compo2 = NULL;
BITMAPFILEHEADER_t File_h;
BITMAPINFOHEADER_t Info_h;
unsigned char *RGB;
unsigned char *table_R, *table_G, *table_B;
int i, w, h;
int gray_scale = 1, not_end_file = 1, line = 0, col = 0;
unsigned char v, v2;
UINT4 W, H;
IN = fopen(filename, "rb");
if (!IN) {
fprintf(stderr,
"\033[0;33mFailed to open %s for reading !!\033[0;39m\n",
filename);
return 0;
}
File_h.bfType = getc(IN);
File_h.bfType = (getc(IN) << 8) + File_h.bfType;
if (File_h.bfType != 19778) {
printf("Error, not a BMP file!\n");
return 0;
} else {
/* FILE HEADER */
/* ------------- */
File_h.bfSize = getc(IN);
File_h.bfSize = (getc(IN) << 8) + File_h.bfSize;
File_h.bfSize = (getc(IN) << 16) + File_h.bfSize;
File_h.bfSize = (getc(IN) << 24) + File_h.bfSize;
File_h.bfReserved1 = getc(IN);
File_h.bfReserved1 = (getc(IN) << 8) + File_h.bfReserved1;
File_h.bfReserved2 = getc(IN);
File_h.bfReserved2 = (getc(IN) << 8) + File_h.bfReserved2;
File_h.bfOffBits = getc(IN);
File_h.bfOffBits = (getc(IN) << 8) + File_h.bfOffBits;
File_h.bfOffBits = (getc(IN) << 16) + File_h.bfOffBits;
File_h.bfOffBits = (getc(IN) << 24) + File_h.bfOffBits;
/* INFO HEADER */
/* ------------- */
Info_h.biSize = getc(IN);
Info_h.biSize = (getc(IN) << 8) + Info_h.biSize;
Info_h.biSize = (getc(IN) << 16) + Info_h.biSize;
Info_h.biSize = (getc(IN) << 24) + Info_h.biSize;
Info_h.biWidth = getc(IN);
Info_h.biWidth = (getc(IN) << 8) + Info_h.biWidth;
Info_h.biWidth = (getc(IN) << 16) + Info_h.biWidth;
Info_h.biWidth = (getc(IN) << 24) + Info_h.biWidth;
w = Info_h.biWidth;
Info_h.biHeight = getc(IN);
Info_h.biHeight = (getc(IN) << 8) + Info_h.biHeight;
Info_h.biHeight = (getc(IN) << 16) + Info_h.biHeight;
Info_h.biHeight = (getc(IN) << 24) + Info_h.biHeight;
h = Info_h.biHeight;
Info_h.biPlanes = getc(IN);
Info_h.biPlanes = (getc(IN) << 8) + Info_h.biPlanes;
Info_h.biBitCount = getc(IN);
Info_h.biBitCount = (getc(IN) << 8) + Info_h.biBitCount;
Info_h.biCompression = getc(IN);
Info_h.biCompression = (getc(IN) << 8) + Info_h.biCompression;
Info_h.biCompression = (getc(IN) << 16) + Info_h.biCompression;
Info_h.biCompression = (getc(IN) << 24) + Info_h.biCompression;
Info_h.biSizeImage = getc(IN);
Info_h.biSizeImage = (getc(IN) << 8) + Info_h.biSizeImage;
Info_h.biSizeImage = (getc(IN) << 16) + Info_h.biSizeImage;
Info_h.biSizeImage = (getc(IN) << 24) + Info_h.biSizeImage;
Info_h.biXpelsPerMeter = getc(IN);
Info_h.biXpelsPerMeter = (getc(IN) << 8) + Info_h.biXpelsPerMeter;
Info_h.biXpelsPerMeter = (getc(IN) << 16) + Info_h.biXpelsPerMeter;
Info_h.biXpelsPerMeter = (getc(IN) << 24) + Info_h.biXpelsPerMeter;
Info_h.biYpelsPerMeter = getc(IN);
Info_h.biYpelsPerMeter = (getc(IN) << 8) + Info_h.biYpelsPerMeter;
Info_h.biYpelsPerMeter = (getc(IN) << 16) + Info_h.biYpelsPerMeter;
Info_h.biYpelsPerMeter = (getc(IN) << 24) + Info_h.biYpelsPerMeter;
Info_h.biClrUsed = getc(IN);
Info_h.biClrUsed = (getc(IN) << 8) + Info_h.biClrUsed;
Info_h.biClrUsed = (getc(IN) << 16) + Info_h.biClrUsed;
Info_h.biClrUsed = (getc(IN) << 24) + Info_h.biClrUsed;
Info_h.biClrImportant = getc(IN);
Info_h.biClrImportant = (getc(IN) << 8) + Info_h.biClrImportant;
Info_h.biClrImportant = (getc(IN) << 16) + Info_h.biClrImportant;
Info_h.biClrImportant = (getc(IN) << 24) + Info_h.biClrImportant;
/* Read the data and store them in the OUT file */
if (Info_h.biBitCount == 24) {
img->x0 = Dim[0];
img->y0 = Dim[1];
img->x1 =
!Dim[0] ? (w - 1) * subsampling_dx + 1 : Dim[0] + (w -
1) *
subsampling_dx + 1;
img->y1 =
!Dim[1] ? (h - 1) * subsampling_dy + 1 : Dim[1] + (h -
1) *
subsampling_dy + 1;
img->numcomps = 3;
img->comps =
(j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (i = 0; i < img->numcomps; i++) {
img->comps[i].prec = 8;
img->comps[i].bpp = 8;
img->comps[i].sgnd = 0;
img->comps[i].dx = subsampling_dx;
img->comps[i].dy = subsampling_dy;
}
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
Compo1 = fopen("Compo1", "wb");
if (!Compo1) {
fprintf(stderr,
"\033[0;33mFailed to open Compo1 for writing !\033[0;39m\n");
}
Compo2 = fopen("Compo2", "wb");
if (!Compo2) {
fprintf(stderr,
"\033[0;33mFailed to open Compo2 for writing !\033[0;39m\n");
}
/* Place the cursor at the beginning of the image information */
fseek(IN, 0, SEEK_SET);
fseek(IN, File_h.bfOffBits, SEEK_SET);
W = Info_h.biWidth;
H = Info_h.biHeight;
if (Info_h.biWidth % 2)
W++;
RGB = (unsigned char *) malloc(3 * W * H * sizeof(unsigned char));
fread(RGB, sizeof(unsigned char), 3 * W * H, IN);
for (i = 0; i < W * H; i++) {
unsigned char R, G, B;
B =
RGB[3 * W * H - ((i * 3) / (3 * W) + 1) * 3 * W +
(i * 3) % (W * 3)];
G =
RGB[3 * W * H - ((i * 3 + 1) / (3 * W) + 1) * 3 * W +
(i * 3 + 1) % (W * 3)];
R =
RGB[3 * W * H - ((i * 3 + 2) / (3 * W) + 1) * 3 * W +
(i * 3 + 2) % (W * 3)];
if ((i % W < W - 1 && Info_h.biWidth % 2) || !(Info_h.biWidth % 2)) {
fprintf(Compo0, "%c", R);
fprintf(Compo1, "%c", G);
fprintf(Compo2, "%c", B);
}
}
fclose(Compo0);
fclose(Compo1);
fclose(Compo2);
free(RGB);
} else if (Info_h.biBitCount == 8 && Info_h.biCompression == 0) {
img->x0 = Dim[0];
img->y0 = Dim[1];
img->x1 =
!Dim[0] ? (w - 1) * subsampling_dx + 1 : Dim[0] + (w -
1) *
subsampling_dx + 1;
img->y1 =
!Dim[1] ? (h - 1) * subsampling_dy + 1 : Dim[1] + (h -
1) *
subsampling_dy + 1;
table_R = (unsigned char *) malloc(256 * sizeof(unsigned char));
table_G = (unsigned char *) malloc(256 * sizeof(unsigned char));
table_B = (unsigned char *) malloc(256 * sizeof(unsigned char));
for (i = 0; i < Info_h.biClrUsed; i++) {
table_B[i] = getc(IN);
table_G[i] = getc(IN);
table_R[i] = getc(IN);
getc(IN);
if (table_R[i] != table_G[i] && table_R[i] != table_B[i]
&& table_G[i] != table_B[i])
gray_scale = 0;
}
/* Place the cursor at the beginning of the image information */
fseek(IN, 0, SEEK_SET);
fseek(IN, File_h.bfOffBits, SEEK_SET);
W = Info_h.biWidth;
H = Info_h.biHeight;
if (Info_h.biWidth % 2)
W++;
RGB = (unsigned char *) malloc(W * H * sizeof(unsigned char));
fread(RGB, sizeof(unsigned char), W * H, IN);
if (gray_scale) {
img->numcomps = 1;
img->comps =
(j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
img->comps[0].prec = 8;
img->comps[0].bpp = 8;
img->comps[0].sgnd = 0;
img->comps[0].dx = subsampling_dx;
img->comps[0].dy = subsampling_dy;
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
for (i = 0; i < W * H; i++) {
if ((i % W < W - 1 && Info_h.biWidth % 2)
|| !(Info_h.biWidth % 2))
fprintf(Compo0, "%c",
table_R[RGB[W * H - ((i) / (W) + 1) * W + (i) % (W)]]);
}
fclose(Compo0);
} else {
img->numcomps = 3;
img->comps =
(j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (i = 0; i < img->numcomps; i++) {
img->comps[i].prec = 8;
img->comps[i].bpp = 8;
img->comps[i].sgnd = 0;
img->comps[i].dx = subsampling_dx;
img->comps[i].dy = subsampling_dy;
}
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
Compo1 = fopen("Compo1", "wb");
if (!Compo1) {
fprintf(stderr,
"\033[0;33mFailed to open Compo1 for writing !\033[0;39m\n");
}
Compo2 = fopen("Compo2", "wb");
if (!Compo2) {
fprintf(stderr,
"\033[0;33mFailed to open Compo2 for writing !\033[0;39m\n");
}
for (i = 0; i < W * H; i++) {
if ((i % W < W - 1 && Info_h.biWidth % 2)
|| !(Info_h.biWidth % 2)) {
fprintf(Compo0, "%c",
table_R[RGB[W * H - ((i) / (W) + 1) * W + (i) % (W)]]);
fprintf(Compo1, "%c",
table_G[RGB[W * H - ((i) / (W) + 1) * W + (i) % (W)]]);
fprintf(Compo2, "%c",
table_B[RGB[W * H - ((i) / (W) + 1) * W + (i) % (W)]]);
}
}
fclose(Compo0);
fclose(Compo1);
fclose(Compo2);
}
free(RGB);
} else if (Info_h.biBitCount == 8 && Info_h.biCompression == 1) {
img->x0 = Dim[0];
img->y0 = Dim[1];
img->x1 =
!Dim[0] ? (w - 1) * subsampling_dx + 1 : Dim[0] + (w -
1) *
subsampling_dx + 1;
img->y1 =
!Dim[1] ? (h - 1) * subsampling_dy + 1 : Dim[1] + (h -
1) *
subsampling_dy + 1;
table_R = (unsigned char *) malloc(256 * sizeof(unsigned char));
table_G = (unsigned char *) malloc(256 * sizeof(unsigned char));
table_B = (unsigned char *) malloc(256 * sizeof(unsigned char));
for (i = 0; i < Info_h.biClrUsed; i++) {
table_B[i] = getc(IN);
table_G[i] = getc(IN);
table_R[i] = getc(IN);
getc(IN);
if (table_R[i] != table_G[i] && table_R[i] != table_B[i]
&& table_G[i] != table_B[i])
gray_scale = 0;
}
/* Place the cursor at the beginning of the image information */
fseek(IN, 0, SEEK_SET);
fseek(IN, File_h.bfOffBits, SEEK_SET);
if (gray_scale) {
img->numcomps = 1;
img->comps = (j2k_comp_t *) malloc(sizeof(j2k_comp_t));
img->comps[0].prec = 8;
img->comps[0].bpp = 8;
img->comps[0].sgnd = 0;
img->comps[0].dx = subsampling_dx;
img->comps[0].dy = subsampling_dy;
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
} else {
img->numcomps = 3;
img->comps =
(j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (i = 0; i < img->numcomps; i++) {
img->comps[i].prec = 8;
img->comps[i].bpp = 8;
img->comps[i].sgnd = 0;
img->comps[i].dx = subsampling_dx;
img->comps[i].dy = subsampling_dy;
}
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
Compo1 = fopen("Compo1", "wb");
if (!Compo1) {
fprintf(stderr,
"\033[0;33mFailed to open Compo1 for writing !\033[0;39m\n");
}
Compo2 = fopen("Compo2", "wb");
if (!Compo2) {
fprintf(stderr,
"\033[0;33mFailed to open Compo2 for writing !\033[0;39m\n");
}
}
RGB =
(unsigned char *) malloc(Info_h.biWidth * Info_h.biHeight *
sizeof(unsigned char));
while (not_end_file) {
v = getc(IN);
if (v) {
v2 = getc(IN);
for (i = 0; i < (int) v; i++) {
RGB[line * Info_h.biWidth + col] = v2;
col++;
}
} else {
v = getc(IN);
switch (v) {
case 0:
col = 0;
line++;
break;
case 1:
line++;
not_end_file = 0;
break;
case 2:
printf("No Delta supported\n");
return 1;
break;
default:
for (i = 0; i < v; i++) {
v2 = getc(IN);
RGB[line * Info_h.biWidth + col] = v2;
col++;
}
if (v % 2)
v2 = getc(IN);
}
}
}
if (gray_scale) {
for (line = 0; line < Info_h.biHeight; line++)
for (col = 0; col < Info_h.biWidth; col++)
fprintf(Compo0, "%c",
table_R[(int)
RGB[(Info_h.biHeight - line -
1) * Info_h.biWidth + col]]);
fclose(Compo0);
} else {
for (line = 0; line < Info_h.biHeight; line++)
for (col = 0; col < Info_h.biWidth; col++) {
fprintf(Compo0, "%c",
table_R[(int)
RGB[(Info_h.biHeight - line -
1) * Info_h.biWidth + col]]);
fprintf(Compo1, "%c",
table_G[(int)
RGB[(Info_h.biHeight - line -
1) * Info_h.biWidth + col]]);
fprintf(Compo2, "%c",
table_B[(int)
RGB[(Info_h.biHeight - line -
1) * Info_h.biWidth + col]]);
}
fclose(Compo0);
fclose(Compo1);
fclose(Compo2);
}
free(RGB);
} else
printf
("Other system than 24 bits/pixels or 8 bits (no RLE coding) is not yet implemented [%d]\n",
Info_h.biBitCount);
fclose(IN);
return 1;
}
}
/* -->> -->> -->> -->>
PGX IMAGE FORMAT
<<-- <<-- <<-- <<-- */
unsigned char readuchar(FILE * f)
{
unsigned char c1;
fread(&c1, 1, 1, f);
return c1;
}
unsigned short readushort(FILE * f, int bigendian)
{
unsigned char c1, c2;
fread(&c1, 1, 1, f);
fread(&c2, 1, 1, f);
if (bigendian)
return (c1 << 8) + c2;
else
return (c2 << 8) + c1;
}
unsigned int readuint(FILE * f, int bigendian)
{
unsigned char c1, c2, c3, c4;
fread(&c1, 1, 1, f);
fread(&c2, 1, 1, f);
fread(&c3, 1, 1, f);
fread(&c4, 1, 1, f);
if (bigendian)
return (c1 << 24) + (c2 << 16) + (c3 << 8) + c4;
else
return (c4 << 24) + (c3 << 16) + (c2 << 8) + c1;
}
int pgxtoimage(char *filename, j2k_image_t * img, int tdy,
int subsampling_dx, int subsampling_dy, int Dim[2],
j2k_cp_t cp)
{
FILE *f;
int w, h, prec;
int i, compno, bandno;
char str[256], endian[16];
char sign;
int bigendian;
j2k_comp_t *comp;
img->numcomps = 1;
img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (compno = 0; compno < img->numcomps; compno++) {
FILE *src;
char tmp[16];
int max = 0;
int Y1;
comp = &img->comps[compno];
sprintf(str, "%s", filename);
f = fopen(str, "rb");
if (!f) {
fprintf(stderr, "Failed to open %s for reading !\n", str);
return 0;
}
if (fscanf(f, "PG %s %c %d %d %d", endian, &sign, &prec, &w, &h) == 5)
{
fgetc(f);
if (!strcmp(endian, "ML"))
bigendian = 1;
else
bigendian = 0;
if (compno == 0) {
img->x0 = Dim[0];
img->y0 = Dim[1];
img->x1 =
!Dim[0] ? (w - 1) * subsampling_dx + 1 : Dim[0] + (w -
1) *
subsampling_dx + 1;
img->y1 =
!Dim[1] ? (h - 1) * subsampling_dy + 1 : Dim[1] + (h -
1) *
subsampling_dy + 1;
} else {
if (w != img->x1 || h != img->y1)
return 0;
}
if (sign == '-') {
comp->sgnd = 1;
} else {
comp->sgnd = 0;
}
comp->prec = prec;
comp->dx = subsampling_dx;
comp->dy = subsampling_dy;
bandno = 1;
Y1 =
cp.ty0 + bandno * cp.tdy <
img->y1 ? cp.ty0 + bandno * cp.tdy : img->y1;
Y1 -= img->y0;
sprintf(tmp, "bandtile%d", bandno); /* bandtile file */
src = fopen(tmp, "wb");
if (!src) {
fprintf(stderr, "failed to open %s for writing !\n", tmp);
}
for (i = 0; i < w * h; i++) {
int v;
if (i == Y1 * w / subsampling_dy && tdy != -1) { /* bandtile is full */
fclose(src);
bandno++;
sprintf(tmp, "bandtile%d", bandno);
src = fopen(tmp, "wb");
if (!src) {
fprintf(stderr, "failed to open %s for writing !\n", tmp);
}
Y1 =
cp.ty0 + bandno * cp.tdy <
img->y1 ? cp.ty0 + bandno * cp.tdy : img->y1;
Y1 -= img->y0;
}
if (comp->prec <= 8) {
if (!comp->sgnd) {
v = readuchar(f);
} else {
v = (char) readuchar(f);
}
} else if (comp->prec <= 16) {
if (!comp->sgnd) {
v = readushort(f, bigendian);
} else {
v = (short) readushort(f, bigendian);
}
} else {
if (!comp->sgnd) {
v = readuint(f, bigendian);
} else {
v = (int) readuint(f, bigendian);
}
}
if (v > max)
max = v;
fprintf(src, "%d ", v);
}
} else {
return 0;
}
fclose(f);
fclose(src);
comp->bpp = int_floorlog2(max) + 1;
}
return 1;
}
/* -->> -->> -->> -->>
PNM IMAGE FORMAT
<<-- <<-- <<-- <<-- */
int pnmtoimage(char *filename, j2k_image_t * img, int subsampling_dx,
int subsampling_dy, int Dim[2])
{
FILE *f;
FILE *Compo0, *Compo1, *Compo2;
int w, h;
int i;
char value;
char comment[256];
f = fopen(filename, "rb");
if (!f) {
fprintf(stderr,
"\033[0;33mFailed to open %s for reading !!\033[0;39m\n",
filename);
return 0;
}
if (fgetc(f) != 'P')
return 0;
value = fgetc(f);
if (value == '2') {
fgetc(f);
if (fgetc(f) == '#') {
fseek(f, 0, SEEK_SET);
fscanf(f, "P2\n");
fgets(comment, 256, f);
fscanf(f, "%d %d\n255", &w, &h);
} else {
fseek(f, 0, SEEK_SET);
fscanf(f, "P2\n%d %d\n255", &w, &h);
}
fgetc(f);
img->x0 = Dim[0];
img->y0 = Dim[1];
img->x1 =
!Dim[0] ? (w - 1) * subsampling_dx + 1 : Dim[0] + (w -
1) *
subsampling_dx + 1;
img->y1 =
!Dim[1] ? (h - 1) * subsampling_dy + 1 : Dim[1] + (h -
1) *
subsampling_dy + 1;
img->numcomps = 1;
img->comps = (j2k_comp_t *) malloc(sizeof(j2k_comp_t));
img->comps[0].prec = 8;
img->comps[0].bpp = 8;
img->comps[0].sgnd = 0;
img->comps[0].dx = subsampling_dx;
img->comps[0].dy = subsampling_dy;
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
for (i = 0; i < w * h; i++) {
unsigned int l;
fscanf(f, "%d", &l);
fprintf(Compo0, "%c", l);
}
fclose(Compo0);
} else if (value == '5') {
fgetc(f);
if (fgetc(f) == '#') {
fseek(f, 0, SEEK_SET);
fscanf(f, "P5\n");
fgets(comment, 256, f);
fscanf(f, "%d %d\n255", &w, &h);
} else {
fseek(f, 0, SEEK_SET);
fscanf(f, "P5\n%d %d\n255", &w, &h);
}
fgetc(f);
img->x0 = Dim[0];
img->y0 = Dim[1];
img->x1 =
!Dim[0] ? (w - 1) * subsampling_dx + 1 : Dim[0] + (w -
1) *
subsampling_dx + 1;
img->y1 =
!Dim[1] ? (h - 1) * subsampling_dy + 1 : Dim[1] + (h -
1) *
subsampling_dy + 1;
img->numcomps = 1;
img->comps = (j2k_comp_t *) malloc(sizeof(j2k_comp_t));
img->comps[0].prec = 8;
img->comps[0].bpp = 8;
img->comps[0].sgnd = 0;
img->comps[0].dx = subsampling_dx;
img->comps[0].dy = subsampling_dy;
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
for (i = 0; i < w * h; i++) {
unsigned char l;
fread(&l, 1, 1, f);
fwrite(&l, 1, 1, Compo0);
}
fclose(Compo0);
} else if (value == '3') {
fgetc(f);
if (fgetc(f) == '#') {
fseek(f, 0, SEEK_SET);
fscanf(f, "P3\n");
fgets(comment, 256, f);
fscanf(f, "%d %d\n255", &w, &h);
} else {
fseek(f, 0, SEEK_SET);
fscanf(f, "P3\n%d %d\n255", &w, &h);
}
fgetc(f);
img->x0 = Dim[0];
img->y0 = Dim[1];
img->x1 =
!Dim[0] ? (w - 1) * subsampling_dx + 1 : Dim[0] + (w -
1) *
subsampling_dx + 1;
img->y1 =
!Dim[1] ? (h - 1) * subsampling_dy + 1 : Dim[1] + (h -
1) *
subsampling_dy + 1;
img->numcomps = 3;
img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (i = 0; i < img->numcomps; i++) {
img->comps[i].prec = 8;
img->comps[i].bpp = 8;
img->comps[i].sgnd = 0;
img->comps[i].dx = subsampling_dx;
img->comps[i].dy = subsampling_dy;
}
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
Compo1 = fopen("Compo1", "wb");
if (!Compo1) {
fprintf(stderr,
"\033[0;33mFailed to open Compo1 for writing !\033[0;39m\n");
}
Compo2 = fopen("Compo2", "wb");
if (!Compo2) {
fprintf(stderr,
"\033[0;33mFailed to open Compo2 for writing !\033[0;39m\n");
}
for (i = 0; i < w * h; i++) {
unsigned int r, g, b;
fscanf(f, "%d", &r);
fscanf(f, "%d", &g);
fscanf(f, "%d", &b);
fprintf(Compo0, "%c", r);
fprintf(Compo1, "%c", g);
fprintf(Compo2, "%c", b);
}
fclose(Compo0);
fclose(Compo1);
fclose(Compo2);
} else if (value == '6') {
fgetc(f);
if (fgetc(f) == '#') {
fseek(f, 0, SEEK_SET);
fscanf(f, "P6\n");
fgets(comment, 256, f);
fscanf(f, "%d %d\n255", &w, &h);
} else {
fseek(f, 0, SEEK_SET);
fscanf(f, "P6\n%d %d\n255", &w, &h);
}
fgetc(f);
img->x0 = Dim[0];
img->y0 = Dim[1];
img->x1 =
!Dim[0] ? (w - 1) * subsampling_dx + 1 : Dim[0] + (w -
1) *
subsampling_dx + 1;
img->y1 =
!Dim[1] ? (h - 1) * subsampling_dy + 1 : Dim[1] + (h -
1) *
subsampling_dy + 1;
img->numcomps = 3;
img->comps = (j2k_comp_t *) malloc(img->numcomps * sizeof(j2k_comp_t));
for (i = 0; i < img->numcomps; i++) {
img->comps[i].prec = 8;
img->comps[i].bpp = 8;
img->comps[i].sgnd = 0;
img->comps[i].dx = subsampling_dx;
img->comps[i].dy = subsampling_dy;
}
Compo0 = fopen("Compo0", "wb");
if (!Compo0) {
fprintf(stderr,
"\033[0;33mFailed to open Compo0 for writing !\033[0;39m\n");
}
Compo1 = fopen("Compo1", "wb");
if (!Compo1) {
fprintf(stderr,
"\033[0;33mFailed to open Compo1 for writing !\033[0;39m\n");
}
Compo2 = fopen("Compo2", "wb");
if (!Compo2) {
fprintf(stderr,
"\033[0;33mFailed to open Compo2 for writing !\033[0;39m\n");
}
for (i = 0; i < w * h; i++) {
unsigned char r, g, b;
fread(&r, 1, 1, f);
fread(&g, 1, 1, f);
fread(&b, 1, 1, f);
fwrite(&r, 1, 1, Compo0);
fwrite(&g, 1, 1, Compo1);
fwrite(&b, 1, 1, Compo2);
}
fclose(Compo0);
fclose(Compo1);
fclose(Compo2);
} else {
return 0;
}
fclose(f);
return 1;
}

View File

@ -1,733 +0,0 @@
/*
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <openjpeg.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#ifndef DONT_HAVE_GETOPT
#include <getopt.h>
#else
#include "compat/getopt.h"
#endif
#include "convert.h"
void help_display()
{
printf("HELP\n----\n\n");
printf
("- the option -help displays the readme.txt file on screen\n\n");
printf("List of parameters for the coder JPEG 2000 :\n");
printf("\n");
printf
("- The markers COD and QCD are writed both of two in the main_header and never appear in the tile_header. The markers in the main header are : SOC SIZ COD QCD COM.\n");
printf("\n");
printf
("- This coder can encode mega image, a test was made on a 24000x24000 pixels color image. You need enough disk space memory (twice the original) to encode the image. (i.e. for a 1.5 Gb image you need a minimum of 3Gb of disk memory)\n");
printf("\n");
printf("REMARKS :\n");
printf("---------\n");
printf("\n");
printf
("* the value of rate enter in the code line is the compression factor !\n");
printf("exemple :\n");
printf("\n");
printf
("-r 20,10,1 means quality 1 : compress 20x, quality 2 : compress 10x and quality 3 : compress 1x = lossless\n");
printf("\n");
printf("By default :\n");
printf("------------\n");
printf("\n");
printf(" * lossless\n");
printf(" * 1 tile\n");
printf(" * size of precinct 2^15 x 2^15 (means 1 precinct)\n");
printf(" * size of code-block 64 x 64\n");
printf(" * Number of resolution : 6\n");
printf(" * No SOP marker in the codestream\n");
printf(" * No EPH marker in the codestream\n");
printf(" * No sub-sampling in x and y direction\n");
printf(" * No mode switch activated\n");
printf(" * progression order : LRCP\n");
printf(" * No index file\n");
printf(" * No ROI upshifted\n");
printf(" * No offset of the origin of the image\n");
printf(" * No offset of the origin of the tiles\n");
printf(" * Reversible DWT 5-3\n");
printf("\n");
printf("Parameters :\n");
printf("------------\n");
printf("\n");
printf
("-i : source file (-i source.pnm also *.pgm, *.ppm) required\n");
printf("\n");
printf
("-o : destination file (-o dest.j2k) required\n");
printf("\n");
printf
("-help : Display the help information optional\n ");
printf("\n");
printf
("-r : different rates (-r 20,10,5) optional\n ");
printf("\n");
printf
("-n : Number of resolution (-n 3) optional\n");
printf("\n");
printf
("-b : size of code block (-b 32,32) optional\n");
printf("\n");
printf
("-c : size of precinct (-c 128,128) optional\n");
printf("\n");
printf
("-t : size of tile (-t 512,512) optional\n");
printf("\n");
printf
("-p : progression order (-p LRCP) [LRCP, RLCP, RPCL, PCRL, CPRL] optional\n");
printf("\n");
printf
("-s : subsampling factor (-s 2,2) [-s X,Y] optional\n");
printf("\n");
printf
("-SOP : write SOP marker before each packet optional\n");
printf("\n");
printf
("-EPH : write EPH marker after each header packet optional\n");
printf("\n");
printf
("-M : mode switch (-M 3) [1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL) 8=VSC 16=ERTERM(SEGTERM) 32=SEGMARK(SEGSYM)] optional\n");
printf
(" for several mode switch you have to add the value of each mode you want\n");
printf
(" ex : RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
printf("\n");
printf
("-x : Create an index file *.Idx (-x index_name.Idx) optional\n");
printf("\n");
printf
("-ROI:c=%%d,U=%%d : quantization indices upshifted for component c=%%d [\%%d = 0,1,2]\n");
printf
(" with a value of U=%%d [0 <= %%d <= 37] (i.e. -ROI:c=0,U=25) optional\n");
printf("\n");
printf
("-d : offset of the origin of the image (-d 150,300) optional\n");
printf("\n");
printf
("-T : offset of the origin of the tiles (-T 100,75) optional\n");
printf("\n");
printf
("-I : Use the irreversible DWT 9-7 (-I) optional\n");
printf("\n");
printf("IMPORTANT :\n");
printf("-----------\n");
printf("\n");
printf("* subsampling bigger than 2 can produce error\n");
printf("\n");
printf
("The index file respect the structure below :\n");
printf
("---------------------------------------------\n");
printf("\n");
printf("Image_height Image_width\n");
printf("progression order\n");
printf("Tiles_size_X Tiles_size_Y\n");
printf("Components_nb\n");
printf("Layers_nb\n");
printf("decomposition_levels\n");
printf("Precincts_size_X Precincts_size_Y\n");
printf("Main_header_end_position\n");
printf("Codestream_size\n");
printf("Tile0 start_pos end_Theader end_pos\n");
printf("Tile1 '' '' ''\n");
printf("...\n");
printf("TileN '' '' ''\n");
printf("Tpacket_0 Tile layer res. comp. prec. start_pos end_pos\n");
printf("...\n");
printf("Tpacket_M '' '' '' '' '' '' ''\n");
}
int give_progression(char progression[4])
{
if (progression[0] == 'L' && progression[1] == 'R' && progression[2] == 'C' && progression[3] == 'P')
{
return 0;
} else
{
if (progression[0] == 'R' && progression[1] == 'L' && progression[2] == 'C' && progression[3] == 'P')
{
return 1;
} else
{
if (progression[0] == 'R' && progression[1] == 'P' && progression[2] == 'C' && progression[3] == 'L')
{
return 2;
} else
{
if (progression[0] == 'P' && progression[1] == 'C' && progression[2] == 'R' && progression[3] == 'L')
{
return 3;
} else
{
if (progression[0] == 'C' && progression[1] == 'P' && progression[2] == 'R' && progression[3] == 'L')
{
return 4;
} else
{
return -1;
}
}
}
}
}
}
double dwt_norms_97[4][10] = {
{1.000, 1.965, 4.177, 8.403, 16.90, 33.84, 67.69, 135.3, 270.6, 540.9},
{2.022, 3.989, 8.355, 17.04, 34.27, 68.63, 137.3, 274.6, 549.0},
{2.022, 3.989, 8.355, 17.04, 34.27, 68.63, 137.3, 274.6, 549.0},
{2.080, 3.865, 8.307, 17.18, 34.71, 69.59, 139.3, 278.6, 557.2}
};
int floorlog2(int a)
{
int l;
for (l = 0; a > 1; l++) {
a >>= 1;
}
return l;
}
void encode_stepsize(int stepsize, int numbps, int *expn, int *mant)
{
int p, n;
p = floorlog2(stepsize) - 13;
n = 11 - floorlog2(stepsize);
*mant = (n < 0 ? stepsize >> -n : stepsize << n) & 0x7ff;
*expn = numbps - p;
}
void calc_explicit_stepsizes(j2k_tccp_t * tccp, int prec)
{
int numbands, bandno;
numbands = 3 * tccp->numresolutions - 2;
for (bandno = 0; bandno < numbands; bandno++) {
double stepsize;
int resno, level, orient, gain;
resno = bandno == 0 ? 0 : (bandno - 1) / 3 + 1;
orient = bandno == 0 ? 0 : (bandno - 1) % 3 + 1;
level = tccp->numresolutions - 1 - resno;
gain = tccp->qmfbid == 0 ? 0 : (orient == 0 ? 0 : (orient == 1 || orient == 2 ? 1 : 2));
if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
stepsize = 1.0;
} else {
double norm = dwt_norms_97[orient][level];
stepsize = (1 << (gain + 1)) / norm;
}
encode_stepsize((int) floor(stepsize * 8192.0), prec + gain, &tccp->stepsizes[bandno].expn,
&tccp->stepsizes[bandno].mant);
}
}
int main(int argc, char **argv)
{
int len;
int NumResolution, numD_min; /* NumResolution : number of resolution */
int Tile_arg; /* Tile_arg = 0 (not in argument) ou = 1 (in argument) */
int CSty; /* CSty : coding style */
int Prog_order; /* progression order (default LRCP) */
char progression[4];
int numpocs, numpocs_tile; /* Number of progression order change (POC) default 0 */
int prcw_init, prch_init; /* Initialisation precincts' size */
int cblockw_init, cblockh_init; /* Initialisation codeblocks' size */
int mode, value; /* Mode switch (cblk_style) */
int subsampling_dx, subsampling_dy; /* subsampling value for dx and dy */
int ROI_compno, ROI_shift; /* region of interrest */
int Dim[2]; /* portion of the image coded */
int TX0, TY0; /* tile off-set */
j2k_image_t img;
j2k_cp_t cp, cp_init; /* cp_init is used to initialise in multiple tiles */
j2k_tcp_t *tcp, *tcp_init; /* tcp_init is used to initialise in multiple tile */
j2k_poc_t POC[32]; /* POC : used in case of Progression order change */
j2k_poc_t *tcp_poc;
j2k_tccp_t *tccp;
int i, tileno, j;
char *infile = 0;
char *outfile = 0;
char *index = 0;
char *s, S1, S2, S3;
int ir = 0;
/* default value */
/* ------------- */
NumResolution = 6;
CSty = 0;
cblockw_init = 64;
cblockh_init = 64;
cp.tw = 1;
cp.th = 1;
img.index_on = 0;
Prog_order = 0;
numpocs = 0;
mode = 0;
subsampling_dx = 1;
subsampling_dy = 1;
ROI_compno = -1; /* no ROI */
ROI_shift = 0;
Dim[0] = 0;
Dim[1] = 0;
TX0 = 0;
TY0 = 0;
cp.comment = NULL;
cp.disto_alloc = 0;
cp.fixed_alloc = 0;
/* img.PPT=0; */
Tile_arg = 0;
cp_init.tcps = (j2k_tcp_t *) malloc(sizeof(j2k_tcp_t)); /* initialisation if only one tile */
tcp_init = &cp_init.tcps[0];
tcp_init->numlayers = 0;
while (1) {
int c =
getopt(argc, argv, "i:o:r:q:t:n:c:b:x:p:s:d:h:P:S:E:M:R:T:C:I");
if (c == -1)
break;
switch (c) {
case 'i': /* IN fill */
infile = optarg;
s = optarg;
while (*s) {
s++;
}
s--;
S3 = *s;
s--;
S2 = *s;
s--;
S1 = *s;
if ((S1 == 'p' && S2 == 'g' && S3 == 'x') || (S1 == 'P' && S2 == 'G' && S3 == 'X')) {
cp.image_type = 0;
break;
}
if ((S1 == 'p' && S2 == 'n' && S3 == 'm')|| (S1 == 'P' && S2 == 'N' && S3 == 'M')
|| (S1 == 'p' && S2 == 'g' && S3 == 'm') || (S1 == 'P' && S2 == 'G' && S3 == 'M')
|| (S1 == 'P' && S2 == 'P' && S3 == 'M') || (S1 == 'p' && S2 == 'p' && S3 == 'm')) {
cp.image_type = 1;
break;
}
if ((S1 == 'b' && S2 == 'm' && S3 == 'p') || (S1 == 'B' && S2 == 'M' && S3 == 'P')) {
cp.image_type = 2;
break;
}
fprintf(stderr, "!! Unrecognized format for infile : %c%c%c [accept only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp] !!\n\n",S1,S2,S3);
return 1;
break;
/* ----------------------------------------------------- */
case 'o': /* OUT fill */
outfile = optarg;
break;
/* ----------------------------------------------------- */
case 'r': /* rates rates/distorsion*/
s = optarg;
while (sscanf(s, "%d", &tcp_init->rates[tcp_init->numlayers]) == 1) {
tcp_init->numlayers++;
while (*s && *s != ',') {
s++;
}
if (!*s)
break;
s++;
}
cp.disto_alloc = 1;
cp.matrice = NULL;
break;
/* ----------------------------------------------------- */
case 'q': /* rates fixed */
s=optarg;
sscanf(s, "%d",&tcp_init->numlayers);
s++;
if (tcp_init->numlayers>9) s++;
cp.matrice=(int*)malloc(tcp_init->numlayers*NumResolution*3*sizeof(int));
s=s+2;
for(i=0;i<tcp_init->numlayers;i++)
{
tcp_init->rates[i]=1;
sscanf(s, "%d,", &cp.matrice[i*NumResolution*3]);
s+=2;
if (cp.matrice[i*NumResolution*3]>9) s++;
cp.matrice[i*NumResolution*3+1]=0;
cp.matrice[i*NumResolution*3+2]=0;
for (j=1;j<NumResolution;j++)
{
sscanf(s, "%d,%d,%d", &cp.matrice[i*NumResolution*3+j*3+0],&cp.matrice[i*NumResolution*3+j*3+1],&cp.matrice[i*NumResolution*3+j*3+2]);
s+=6;
if (cp.matrice[i*NumResolution*3+j*3]>9) s++;
if (cp.matrice[i*NumResolution*3+j*3+1]>9) s++;
if (cp.matrice[i*NumResolution*3+j*3+2]>9) s++;
}
if (i<tcp_init->numlayers-1) s++;
}
cp.fixed_alloc=1;
break;
/* ----------------------------------------------------- */
case 't': /* tiles */
sscanf(optarg, "%d,%d", &cp.tdx, &cp.tdy);
Tile_arg = 1;
break;
/* ----------------------------------------------------- */
case 'n': /* resolution */
sscanf(optarg, "%d", &NumResolution);
break;
/* ----------------------------------------------------- */
case 'c': /* precinct dimension */
sscanf(optarg, "%d,%d", &prcw_init, &prch_init);
CSty |= 0x01;
break;
/* ----------------------------------------------------- */
case 'b': /* code-block dimension */
sscanf(optarg, "%d,%d", &cblockw_init, &cblockh_init);
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
|| cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
fprintf(stderr,"!! Size of code_block error (option -b) !!\n\nRestriction :\n * width*height<=4096\n * 4<=width,height<= 1024\n\n");
return 1;
}
break;
/* ----------------------------------------------------- */
case 'x': /* creation of index file */
index = optarg;
img.index_on = 1;
break;
/* ----------------------------------------------------- */
case 'p': /* progression order */
s = optarg;
for (i=0; i<4; i++)
{
progression[i] = *s;
s++;
}
Prog_order = give_progression(progression);
if (Prog_order == -1) {
fprintf(stderr,"Unrecognized progression order [LRCP, RLCP, RPCL, PCRL, CPRL] !!\n");
return 1;
}
break;
/* ----------------------------------------------------- */
case 's': /* subsampling factor */
if (sscanf(optarg, "%d,%d", &subsampling_dx, &subsampling_dy) != 2) {
fprintf(stderr,"'-s' sub-sampling argument error ! [-s dx,dy]\n");
return 1;
}
break;
/* ----------------------------------------------------- */
case 'd': /* coordonnate of the reference grid */
if (sscanf(optarg, "%d,%d", &Dim[0], &Dim[1]) != 2) {
fprintf(stderr,"-d 'coordonnate of the reference grid' argument error !! [-d x0,y0]\n");
return 1;
}
break;
/* ----------------------------------------------------- */
case 'h': /* Display an help description */
help_display();
return 0;
break;
/* ----------------------------------------------------- */
case 'P': /* POC */
fprintf(stderr, "/----------------------------------\\\n");
fprintf(stderr, "| POC option not fully tested !! |\n");
fprintf(stderr, "\\----------------------------------/\n");
s = optarg;
while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%s", &POC[numpocs].tile,
&POC[numpocs].resno0, &POC[numpocs].compno0,
&POC[numpocs].layno1, &POC[numpocs].resno1,
&POC[numpocs].compno1, POC[numpocs].progorder) == 7) {
POC[numpocs].prg = give_progression(POC[numpocs].progorder);
/* POC[numpocs].tile; */
numpocs++;
while (*s && *s != '/') {
s++;
}
if (!*s)
break;
s++;
}
break;
/* ------------------------------------------------------ */
case 'S': /* SOP marker */
CSty |= 0x02;
break;
/* ------------------------------------------------------ */
case 'E': /* EPH marker */
CSty |= 0x04;
break;
/* ------------------------------------------------------ */
case 'M': /* Mode switch pas tous au point !! */
if (sscanf(optarg, "%d", &value) == 1) {
for (i = 0; i <= 5; i++) {
int cache = value & (1 << i);
if (cache)
mode |= (1 << i);
}
}
break;
/* ------------------------------------------------------ */
case 'R': /* ROI */
if (sscanf(optarg, "OI:c=%d,U=%d", &ROI_compno, &ROI_shift) != 2) {
fprintf(stderr,"ROI error !! [-ROI:c='compno',U='shift']\n");
return 1;
}
break;
/* ------------------------------------------------------ */
case 'T': /* Tile offset */
if (sscanf(optarg, "%d,%d", &TX0, &TY0) != 2) {
fprintf(stderr,"-T 'tile offset' argument error !! [-T X0,Y0]");
return 1;
}
break;
/* ------------------------------------------------------ */
case 'C': /* Add a comment */
cp.comment = optarg;
break;
/* ------------------------------------------------------ */
case 'I': /* reversible or not */
ir = 1;
break;
/* ------------------------------------------------------ */
default:
return 1;
}
}
cp.tx0 = TX0;
cp.ty0 = TY0;
/* Error messages */
/* -------------- */
if (!infile || !outfile) {
fprintf(stderr, "usage: pnmtoj2k -i pnm-file -o j2k-file\n");
return 1;
}
if (cp.disto_alloc & cp.fixed_alloc) {
fprintf(stderr, "Error: option -r and -q can not be used together !!\n");
return 1;
}
/* if no rate entered, lossless by default */
if (tcp_init->numlayers == 0) {
tcp_init->rates[tcp_init->numlayers] = 1;
tcp_init->numlayers++;
cp.disto_alloc = 1;
}
if (TX0 > Dim[0] || TY0 > Dim[1]) {
fprintf(stderr, "Error: Tile offset dimension is unnappropriate --> TX0(%d)<=IMG_X0(%d) TYO(%d)<=IMG_Y0(%d) \n",
TX0, Dim[0], TY0, Dim[1]);
return 1;
}
for (i = 0; i < numpocs; i++) {
if (POC[i].prg == -1) {
fprintf(stderr, "Unrecognized progression order in option -P (POC n %d) [LRCP, RLCP, RPCL, PCRL, CPRL] !!\n",
i + 1);
}
}
switch (cp.image_type) {
case 0:
if (Tile_arg) {
if (!pgxtoimage(infile, &img, cp.tdy, subsampling_dx, subsampling_dy, Dim, cp)) {
fprintf(stderr, "not a pgx file\n");
return 1;
}
} else {
if (!pgxtoimage(infile, &img, -1, subsampling_dx, subsampling_dy, Dim, cp)) {
fprintf(stderr, " not a pgx file\n");
return 1;
}
}
break;
case 1:
if (!pnmtoimage(infile, &img, subsampling_dx, subsampling_dy, Dim)) {
fprintf(stderr, " not a pnm file\n");
return 1;
}
break;
case 2:
if (!bmptoimage(infile, &img, subsampling_dx, subsampling_dy, Dim)) {
fprintf(stderr, " not a bmp file\n");
return 1;
}
break;
}
/* to respect profile - 0 */
/* ---------------------- */
numD_min = 0;
/* while (int_ceildiv(img.x1,(1<<numD_min))-int_ceildiv(img.x0,(1<<numD_min))>120 || int_ceildiv(img.y1,(1<<numD_min))-int_ceildiv(img.y0,(1<<numD_min))>160) numD_min++;
if ((numD_min+1)>NumResolution)
{
fprintf(stderr,"\n********************************************************************************\n\n");
fprintf(stderr, "In view to respect Profile-0, the number of resolution used is %d in place of %d\n\n",numD_min+1,NumResolution);
fprintf(stderr, "********************************************************************************\n\n");
NumResolution=numD_min+1;
} */
if (Tile_arg == 1) {
cp.tw = int_ceildiv(img.x1 - cp.tx0, cp.tdx);
cp.th = int_ceildiv(img.y1 - cp.ty0, cp.tdy);
} else {
cp.tdx = img.x1 - cp.tx0;
cp.tdy = img.y1 - cp.ty0;
}
/* Initialization for PPM marker */
cp.ppm=0;
cp.ppm_data=NULL;
cp.ppm_previous=0;
cp.ppm_store=0;
/* Init the mutiple tiles */
/* ---------------------- */
cp.tcps = (j2k_tcp_t *) malloc(cp.tw * cp.th * sizeof(j2k_tcp_t));
for (tileno = 0; tileno < cp.tw * cp.th; tileno++) {
tcp = &cp.tcps[tileno];
tcp->numlayers = tcp_init->numlayers;
for (j = 0; j < tcp->numlayers; j++) {
tcp->rates[j] = tcp_init->rates[j];
}
tcp->csty = CSty;
tcp->prg = Prog_order;
tcp->mct = img.numcomps == 3 ? 1 : 0;
tcp->ppt = 0;
tcp->ppt_data=NULL;
tcp->ppt_store=0;
numpocs_tile = 0;
tcp->POC=0;
if (numpocs) {
/* intialisation of POC */
tcp->POC=1;
for (i = 0; i < numpocs; i++) {
if (tileno == POC[i].tile - 1 || POC[i].tile == -1) {
tcp_poc = &tcp->pocs[numpocs_tile];
tcp_poc->resno0 = POC[numpocs_tile].resno0;
tcp_poc->compno0 = POC[numpocs_tile].compno0;
tcp_poc->layno1 = POC[numpocs_tile].layno1;
tcp_poc->resno1 = POC[numpocs_tile].resno1;
tcp_poc->compno1 = POC[numpocs_tile].compno1;
tcp_poc->prg = POC[numpocs_tile].prg;
tcp_poc->tile = POC[numpocs_tile].tile;
numpocs_tile++;
}
}
}
tcp->numpocs = numpocs_tile;
tcp->tccps = (j2k_tccp_t *) malloc(img.numcomps * sizeof(j2k_tccp_t));
for (i = 0; i < img.numcomps; i++) {
tccp = &tcp->tccps[i];
tccp->csty = CSty & 0x01; /* 0 => one precinct || 1 => custom precinct */
tccp->numresolutions = NumResolution;
tccp->cblkw = int_floorlog2(cblockw_init);
tccp->cblkh = int_floorlog2(cblockh_init);
tccp->cblksty = mode;
tccp->qmfbid = ir ? 0 : 1;
tccp->qntsty = ir ? J2K_CCP_QNTSTY_SEQNT : J2K_CCP_QNTSTY_NOQNT;
tccp->numgbits = 2;
if (i == ROI_compno)
tccp->roishift = ROI_shift;
else
tccp->roishift = 0;
if (CSty & J2K_CCP_CSTY_PRT) {
for (j = 0; j < tccp->numresolutions; j++) {
int size_prcw, size_prch;
size_prcw = prcw_init >> (tccp->numresolutions - j - 1);
size_prch = prch_init >> (tccp->numresolutions - j - 1);
if (size_prcw < 1) {
tccp->prcw[j] = 1;
} else {
tccp->prcw[j] =
int_floorlog2(prcw_init >> (tccp->numresolutions - j - 1));
}
if (size_prch < 1) {
tccp->prch[j] = 1;
} else {
tccp->prch[j] =
int_floorlog2(prch_init >> (tccp->numresolutions - j - 1));
}
}
} else {
for (j = 0; j < tccp->numresolutions; j++) {
tccp->prcw[j] = 15;
tccp->prch[j] = 15;
}
}
calc_explicit_stepsizes(tccp, img.comps[i].prec);
}
}
len = j2k_encode(&img, &cp, outfile, cp.tdx * cp.tdy * 2, index);
if (len == 0) {
fprintf(stderr, "failed to encode image\n");
return 1;
}
/* Remove the temporary files */
/* -------------------------- */
if (cp.image_type) { /* PNM PGM PPM */
for (i = 0; i < img.numcomps; i++) {
char tmp;
sprintf(&tmp, "Compo%d", i);
if (remove(&tmp) == -1) {
fprintf(stderr, "failed to kill %s file !\n", &tmp);
}
}
} else { /* PGX */
for (i = 0; i < cp.th; i++) {
char tmp;
sprintf(&tmp, "bandtile%d", i + 1);
if (remove(&tmp) == -1) {
fprintf(stderr, "failed to kill %s file !\n", &tmp);
}
}
}
return 0;
}

View File

@ -1,376 +0,0 @@
/* Copyright (c) 2001 David Janssens
* Copyright (c) 2002-2003 Yannick Verschueren
* Copyright (c) 2002-2003 Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
*
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <openjpeg.h>
#include <stdio.h>
#include <stdlib.h>
//#include <unistd.h>
int ceildiv(int a, int b)
{
return (a + b - 1) / b;
}
int main(int argc, char **argv)
{
FILE *f;
char *src, *src_name;
char *dest, S1, S2, S3;
int len;
j2k_image_t *img;
j2k_cp_t *cp;
int w, h, max;
int i, image_type = -1, compno;
int adjust;
if (argc < 3) {
fprintf(stderr, "usage: %s j2k-file pnm-file\n", argv[0]);
return 1;
}
f = fopen(argv[1], "rb");
if (!f) {
fprintf(stderr, "failed to open %s for reading\n", argv[1]);
return 1;
}
dest = argv[2];
while (*dest) {
dest++;
}
dest--;
S3 = *dest;
dest--;
S2 = *dest;
dest--;
S1 = *dest;
if ((S1 == 'p' && S2 == 'g' && S3 == 'x') || (S1 == 'P' && S2 == 'G' && S3 == 'X')) {
image_type = 0;
}
if ((S1 == 'p' && S2 == 'n' && S3 == 'm')|| (S1 == 'P' && S2 == 'N' && S3 == 'M') ||
(S1 == 'p' && S2 == 'g' && S3 == 'm')|| (S1 == 'P' && S2 == 'G' && S3 == 'M') ||
(S1 == 'P' && S2 == 'P' && S3 == 'M')|| (S1 == 'p' && S2 == 'p' && S3 == 'm')) {
image_type = 1;
}
if ((S1 == 'b' && S2 == 'm' && S3 == 'p') || (S1 == 'B' && S2 == 'M' && S3 == 'P')) {
image_type = 2;
}
if (image_type == -1) {
fprintf(stderr, "!! Unrecognized format for infile : %c%c%c [accept only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp] !!\n\n",S1,S2,S3);
return 1;
}
fseek(f, 0, SEEK_END);
len = ftell(f);
fseek(f, 0, SEEK_SET);
src = (char *) malloc(len);
fread(src, 1, len, f);
fclose(f);
src_name=argv[1];
while (*src_name) {
src_name++;
}
src_name--;
S3 = *src_name;
src_name--;
S2 = *src_name;
src_name--;
S1 = *src_name;
if (S1 == 'j' && S2 == '2' && S3 == 'k')
{
if (!j2k_decode(src, len, &img, &cp)) {
fprintf(stderr, "j2k_to_image: failed to decode image!\n");
return 1;
}
}
else
{
if (S1 == 'j' && S2 == 'p' && S3 == 't')
{
if (!j2k_decode_jpt_stream(src, len, &img, &cp)) {
fprintf(stderr, "j2k_to_image: failed to decode image!\n");
return 1;
}
}
else
{
fprintf(stderr,"j2k_to_image : Unknown format image *.%c%c%c [only *.j2k or *.jpt]!! \n",S1,S2,S3);
return 1;
}
}
free(src);
/* ------------------ CREATE OUT IMAGE WITH THE RIGHT FORMAT ----------------------- */
/* ---------------------------- / */
/* / / */
/* / FORMAT : PNM, PGM or PPM / */
/* / / */
/* ---------------------------- / */
switch (image_type)
{
case 1: /* PNM PGM PPM*/
if (img->numcomps == 3 && img->comps[0].dx == img->comps[1].dx
&& img->comps[1].dx == img->comps[2].dx
&& img->comps[0].dy == img->comps[1].dy
&& img->comps[1].dy == img->comps[2].dy
&& img->comps[0].prec == img->comps[1].prec
&& img->comps[1].prec == img->comps[2].prec)
{
f = fopen(argv[2], "wb");
w = ceildiv(img->x1 - img->x0, img->comps[0].dx);
h = ceildiv(img->y1 - img->y0, img->comps[0].dy);
//max = (1 << img->comps[0].prec) - 1;
max =img->comps[0].prec>8? 255:(1 << img->comps[0].prec) - 1;
fprintf(f, "P6\n%d %d\n%d\n", w, h, max);
adjust=img->comps[0].prec>8?img->comps[0].prec-8:0;
for (i = 0; i < w * h; i++)
{
char r, g, b;
r = img->comps[0].data[i];
r+=(img->comps[0].sgnd? 1 << (img->comps[0].prec-1):0);
r=r>>adjust;
g = img->comps[1].data[i];
g+=(img->comps[1].sgnd? 1 << (img->comps[1].prec-1):0);
g=g>>adjust;
b = img->comps[2].data[i];
b+=(img->comps[2].sgnd? 1 << (img->comps[2].prec-1):0);
b=b>>adjust;
fprintf(f, "%c%c%c", r, g, b);
}
fclose(f);
} else
{
for (compno = 0; compno < img->numcomps; compno++)
{
char name[256];
if (img->numcomps > 1) {
sprintf(name, "%d.%s", compno, argv[2]);
} else
{
sprintf(name, "%s", argv[2]);
}
f = fopen(name, "wb");
w = ceildiv(img->x1 - img->x0, img->comps[compno].dx);
h = ceildiv(img->y1 - img->y0, img->comps[compno].dy);
max =img->comps[compno].prec>8? 255:(1 << img->comps[compno].prec) - 1;
fprintf(f, "P5\n%d %d\n%d\n", w, h, max);
adjust=img->comps[compno].prec>8?img->comps[compno].prec-8:0;
for (i = 0; i < w * h; i++)
{
char l;
l = img->comps[compno].data[i];
l+=(img->comps[compno].sgnd? 1 << (img->comps[compno].prec-1):0);
l=l>>adjust;
fprintf(f, "%c", l);
}
fclose(f);
}
}
break ;
/* ------------------------ / */
/* / / */
/* / FORMAT : PGX / */
/* / / */
/* /----------------------- / */
case 0: /* PGX */
for (compno = 0; compno < img->numcomps; compno++)
{
j2k_comp_t *comp = &img->comps[compno];
char name[256];
if (img->numcomps>1)
sprintf(name, "%d_%s", compno, argv[2]);
else
sprintf(name, "%s", argv[2]);
f = fopen(name, "wb");
w = ceildiv(img->x1 - img->x0, comp->dx);
h = ceildiv(img->y1 - img->y0, comp->dy);
fprintf(f, "PG LM %c %d %d %d\n", comp->sgnd ? '-' : '+', comp->prec, w, h);
for (i = 0; i < w * h; i++)
{
int v = img->comps[compno].data[i];
if (comp->prec <= 8)
{
char c = (char) v;
fwrite(&c, 1, 1, f);
} else if (comp->prec <= 16)
{
short s = (short) v;
fwrite(&s, 2, 1, f);
} else
{
fwrite(&v, 4, 1, f);
}
}
fclose(f);
}
break ;
/* ------------------------ / */
/* / / */
/* / FORMAT : BMP / */
/* / / */
/* /----------------------- / */
case 2: /* BMP */
if (img->numcomps == 3 && img->comps[0].dx == img->comps[1].dx
&& img->comps[1].dx == img->comps[2].dx
&& img->comps[0].dy == img->comps[1].dy
&& img->comps[1].dy == img->comps[2].dy
&& img->comps[0].prec == img->comps[1].prec
&& img->comps[1].prec == img->comps[2].prec)
{
/* -->> -->> -->> -->>
24 bits color
<<-- <<-- <<-- <<-- */
f = fopen(argv[2], "wb");
w = ceildiv(img->x1 - img->x0, img->comps[0].dx);
h = ceildiv(img->y1 - img->y0, img->comps[0].dy);
fprintf(f, "BM");
/* FILE HEADER */
/* ------------- */
fprintf(f, "%c%c%c%c",
(unsigned char) (h * w * 3 + 3 * h * (w % 2) + 54) & 0xff,
(unsigned char) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 8) & 0xff,
(unsigned char) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 16) & 0xff,
(unsigned char) ((h * w * 3 + 3 * h * (w % 2) + 54) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (54) & 0xff, ((54) >> 8) & 0xff, ((54) >> 16) & 0xff, ((54) >> 24) & 0xff);
/* INFO HEADER */
/* ------------- */
fprintf(f, "%c%c%c%c", (40) & 0xff, ((40) >> 8) & 0xff, ((40) >> 16) & 0xff, ((40) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (unsigned char) ((w) & 0xff),(unsigned char) ((w) >> 8) & 0xff,
(unsigned char) ((w) >> 16) & 0xff, (unsigned char) ((w) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (unsigned char) ((h) & 0xff), (unsigned char) ((h) >> 8) & 0xff,
(unsigned char) ((h) >> 16) & 0xff, (unsigned char) ((h) >> 24) & 0xff);
fprintf(f, "%c%c", (1) & 0xff, ((1) >> 8) & 0xff);
fprintf(f, "%c%c", (24) & 0xff, ((24) >> 8) & 0xff);
fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (unsigned char) (3 * h * w + 3 * h * (w % 2)) & 0xff,
(unsigned char) ((h * w * 3 + 3 * h * (w % 2)) >> 8) & 0xff,
(unsigned char) ((h * w * 3 + 3 * h * (w % 2)) >> 16) & 0xff,
(unsigned char) ((h * w * 3 + 3 * h * (w % 2)) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
for (i = 0; i < w * h; i++)
{
unsigned char R, G, B;
R = img->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
G = img->comps[1].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
B = img->comps[2].data[w * h - ((i) / (w) + 1) * w + (i) % (w)];
fprintf(f, "%c%c%c", B, G, R);
if (((i + 1) % w == 0 && w % 2))
fprintf(f, "%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff);
}
fclose(f);
} else
{ /* Gray-scale */
/* -->> -->> -->> -->>
8 bits non code (Gray scale)
<<-- <<-- <<-- <<-- */
f = fopen(argv[2], "wb");
w = ceildiv(img->x1 - img->x0, img->comps[0].dx);
h = ceildiv(img->y1 - img->y0, img->comps[0].dy);
fprintf(f, "BM");
/* FILE HEADER */
/* ------------- */
fprintf(f, "%c%c%c%c",
(unsigned char) (h * w + 54 + 1024 + h * (w % 2)) & 0xff,
(unsigned char) ((h * w + 54 + 1024 + h * (w % 2)) >> 8) & 0xff,
(unsigned char) ((h * w + 54 + 1024 + h * (w % 2)) >> 16) & 0xff,
(unsigned char) ((h * w + 54 + 1024 + w * (w % 2)) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (54 + 1024) & 0xff, ((54 + 1024) >> 8) & 0xff,
((54 + 1024) >> 16) & 0xff, ((54 + 1024) >> 24) & 0xff);
/* INFO HEADER */
/* ------------- */
fprintf(f, "%c%c%c%c", (40) & 0xff, ((40) >> 8) & 0xff, ((40) >> 16) & 0xff, ((40) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (unsigned char) ((w) & 0xff), (unsigned char) ((w) >> 8) & 0xff,
(unsigned char) ((w) >> 16) & 0xff, (unsigned char) ((w) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (unsigned char) ((h) & 0xff), (unsigned char) ((h) >> 8) & 0xff,
(unsigned char) ((h) >> 16) & 0xff, (unsigned char) ((h) >> 24) & 0xff);
fprintf(f, "%c%c", (1) & 0xff, ((1) >> 8) & 0xff);
fprintf(f, "%c%c", (8) & 0xff, ((8) >> 8) & 0xff);
fprintf(f, "%c%c%c%c", (0) & 0xff, ((0) >> 8) & 0xff, ((0) >> 16) & 0xff, ((0) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (unsigned char) (h * w + h * (w % 2)) & 0xff,
(unsigned char) ((h * w + h * (w % 2)) >> 8) & 0xff,
(unsigned char) ((h * w + h * (w % 2)) >> 16) & 0xff,
(unsigned char) ((h * w + h * (w % 2)) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (7834) & 0xff, ((7834) >> 8) & 0xff, ((7834) >> 16) & 0xff, ((7834) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff);
fprintf(f, "%c%c%c%c", (256) & 0xff, ((256) >> 8) & 0xff, ((256) >> 16) & 0xff, ((256) >> 24) & 0xff);
}
for (i = 0; i < 256; i++)
{
fprintf(f, "%c%c%c%c", i, i, i, 0);
}
for (i = 0; i < w * h; i++)
{
fprintf(f, "%c", img->comps[0].data[w * h - ((i) / (w) + 1) * w + (i) % (w)]);
if (((i + 1) % w == 0 && w % 2))
fprintf(f, "%c", 0);
}
break;
default :
break;
}
return 0;
}

View File

@ -1,105 +0,0 @@
List of parameters for the coder JPEG 2000 :
Date : June the 25th, 2003
Author : Yannick Verschueren
Contact : verschueren@tele.ucl.ac.be
- the option -help displays the readme.txt file on screen
- The markers COD and QCD are writed both of two in the main_header and never appear in the tile_header. The markers in the main header are : SOC SIZ COD QCD COM.
- This coder can encode mega image, a test was made on a 24000x24000 pixels color image. You need enough disk space memory (twice the original) to encode the image. (i.e. for a 1.5 Gb image you need a minimum of 3Gb of disk memory)
REMARKS :
---------
* the value of rate enter in the code line is the compression factor !
exemple :
-r 20,10,1 means quality 1 : compress 20x, quality 2 : compress 10x and quality 3 : compress 1x = lossless
* The number of resolution can be modified by the program in view to respect profile-0 conditions (Taubman, Marcelin (2002), "JPEG2000, image compression fundamentals, standards and practice", p700)
By default :
------------
* lossless
* 1 tile
* size of precinct 2^15 x 2^15 (means 1 precinct)
* size of code-block 64 x 64
* Number of resolution : 6
* No SOP marker in the codestream
* No EPH marker in the codestream
* No sub-sampling in x and y direction
* No mode switch activated
* progression order : LRCP
* No index file
* No ROI upshifted
* No offset of the origin of the image
* No offset of the origin of the tiles
* Reversible DWT 5-3
Parameters :
------------
-i : source file (-i source.pnm also *.pgm, *.ppm) "required"
-o : destination file (-o dest.j2k) "required"
-r : different rates (-r 20,10,5) "optional"
-n : Number of resolution (-n 3) "optional"
-b : size of code block (-b 32,32) "optional"
-c : size of precinct (-c 128,128) "optional"
-t : size of tile (-t 512,512) "optional"
-p : progression order (-p LRCP) [LRCP, RLCP, RPCL, PCRL, CPRL] "optional"
-s : subsampling factor (-s 2,2) [-s X,Y] "optional"
-SOP : write SOP marker before each packet "optional"
-EPH : write EPH marker after each header packet "optional"
-M : mode switch (-M 3) [1= BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL) 8=VSC 16=ERTERM(SEGTERM) 32=SEGMARK(SEGSYM)] "optional"
for several mode switch you have to add the value of each mode you want
ex : RESTART(4) + RESET(2) + SEGMARK(32) = -M 38
-x : Create an index file *.Idx (-x index_name.Idx) "optional"
-ROI:c=%d,U=%d : quantization indices upshifted for component c=%d [%d = 0,1,2]
with a value of U=%d [0 <= %d <= 37] (i.e. -ROI:c=0,U=25) "optional"
-d : offset of the origin of the image (-d 150,300) "optional"
-T : offset of the origin of the tiles (-T 100,75) "optional"
-I : Use the irreversible DWT 9-7 (-I) "optional"
IMPORTANT :
-----------
* subsampling bigger than 2 can produce error
The index file respect the structure below :
---------------------------------------------
Image_height Image_width
progression order
Tiles_size_X Tiles_size_Y
Components_nb
Layers_nb
decomposition_levels
Precincts_size_X Precincts_size_Y
Main_header_end_position
Codestream_size
Tile0 start_pos end_Theader end_pos
Tile1 " " "
...
TileN " " "
Tpacket_0 Tile layer res. comp. prec. start_pos end_pos
...
Tpacket_M " " " " " " "

52
doc/CMakeLists.txt Normal file
View File

@ -0,0 +1,52 @@
# Generate target to build the html documentation through CMake tool
# After having configured the project with the BUILD_DOC option you can run make doc
# to generate the html documentation in the doc/html repository of the build folder.
# Try to find the doxygen tool
find_package(Doxygen)
if(DOXYGEN_FOUND)
# Configure the doxygen config file with variable from CMake and move it
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox.cmake.in
${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox @ONLY)
# Configure the html mainpage file of the doxygen documentation with variable
# from CMake and move it
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/mainpage.dox.in
${CMAKE_BINARY_DIR}/doc/mainpage.dox @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpip.dox.in
${CMAKE_BINARY_DIR}/doc/openjpip.dox @ONLY)
# copy png file to make local (binary tree) documentation valid:
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_architect.png
${CMAKE_BINARY_DIR}/doc/html/jpip_architect.png COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jpip_protocol.png
${CMAKE_BINARY_DIR}/doc/html/jpip_protocol.png COPYONLY)
file(GLOB headers
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.h
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/*.c
${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.h
${OPENJPEG_SOURCE_DIR}/src/lib/openjpip/*.c
)
# Generate new target to build the html documentation
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
DEPENDS ${CMAKE_BINARY_DIR}/doc/Doxyfile-html.dox
${CMAKE_BINARY_DIR}/doc/mainpage.dox
${CMAKE_BINARY_DIR}/doc/openjpip.dox
${headers}
)
add_custom_target(doc ALL
DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html
COMMENT "Building doxygen documentation"
)
# install HTML documentation (install png files too):
install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html
DESTINATION share/doc
PATTERN ".svn" EXCLUDE
)
else()
message(STATUS "Doxygen not found, we cannot generate the documentation")
endif()

285
doc/Doxyfile.dox.cmake.in Normal file
View File

@ -0,0 +1,285 @@
# Doxyfile 1.7.1
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = OpenJPEG
PROJECT_NUMBER = @OPENJPEG_VERSION@
OUTPUT_DIRECTORY = @OPENJPEG_BINARY_DIR@/doc
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH = C://
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @OPENJPEG_SOURCE_DIR@/src/lib/openjp2 \
@OPENJPEG_SOURCE_DIR@/src/lib/openjpip \
@OPENJPEG_BINARY_DIR@/doc
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h \
*.c \
*.dox
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = */.svn/*
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = @OPENJPEG_SOURCE_DIR@/doc
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = ./html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
HTML_ALIGN_MEMBERS = YES
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
USE_INLINE_TREES = NO
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = USE_JPWL \
USE_JPSEC
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES

BIN
doc/jpip_architect.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
doc/jpip_protocol.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

62
doc/mainpage.dox.in Normal file
View File

@ -0,0 +1,62 @@
/*
* $Id$
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2011, Mickael Savinaud, Communications & Systemes <mickael.savinaud@c-s.fr>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*! \mainpage OpenJPEG v@OPENJPEG_VERSION@ Documentation
*
* \section intro Introduction
* This manual documents the low-level OpenJPEG C API.\n
* The OpenJPEG library is an open-source JPEG 2000 library developed in order to promote the use of JPEG 2000.\n
* This documents is focused on the main part of the library which try to implement Part 1 and Part 2 of the JPEG2000 norm.\n
*
* \section home Home page
*
* The Home Page of the OpenJPEG project can be found at:
*
* http://www.openjpeg.org/
*
* The source code repository is available here:
*
* http://github.com/uclouvain/openjpeg
*
* The OpenJPEG mailing list is located here:
*
* http://groups.google.com/group/openjpeg
*
* The test files repository is available here:
*
* http://github.com/uclouvain/openjpeg-data
*
* \section license License
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
* The only restriction is to retain the copyright in the sources or the binaries documentation.\n
* Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage.
*
* \author OpenJPEG Team
*
*/

222
doc/man/man1/opj_compress.1 Normal file
View File

@ -0,0 +1,222 @@
'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
.de EX
.SP
.nf
.ft CW
..
.de EE
.ft R
.SP
.fi
..
.TH opj_compress 1 "Version 2.1.1" "opj_compress" "converts to jpeg2000 files"
.P
.SH NAME
opj_compress \-
This program reads in an image of a certain type and converts it to a
jpeg2000 file. It is part of the OpenJPEG library.
.SP
Valid input image extensions are
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
.SP
Valid output image extensions are
.B .j2k, .jp2
.SH SYNOPSIS
.P
.B opj_compress \-i \fRinfile.bmp \fB-o \fRoutfile.j2k
.P
.B opj_compress \-ImgDir \fRdirectory_name \fB-OutFor \fRjp2
.P
.B opj_compress \-h \fRPrint a help message and exit.
.P
.R See JPWL OPTIONS for special options
.SH OPTIONS
.TP
.B \-\^b " n,n"
(Size of code block (e.g. \-b 32,32). Default: 64 x 64)
.TP
.B \-\^c " n"
(Size of precinct (e.g. \-c 128,128). Default: 2^15 x 2^15)
.TP
.B \-\^cinema2K " fps"
Digital Cinema 2K profile compliant codestream. Valid \fBfps\fR values are 24 or 48.
.TP
.B \-\^cinema4K
Digital Cinema 4K profile compliant codestream. Does not need an fps: default is 24 fps.
.TP
.B \-\^d " X,Y"
(Offset of image origin (e.g. \-d 150,300))
.TP
.B \-\^h
Print a help message and exit.
.TP
.B \-\^i " name"
(input file name)
.TP
.B \-\^n " n"
(Number of resolutions. Default: 6)
.TP
.B \-\^o " name"
(output file name)
.TP
.B \-\^p " name"
Progression order. \fBname\fR can be one out of:LRCP, RLCP, RPCL, PCRL, CPRL. Default: LRCP.
.TP
.B \-\^q " n"
different psnr for successive layers
.br
.B Note: \fR(options \-r and \-q cannot be used together)
.TP
.B \-\^r " n"
different compression ratio(s) for successive layers. The rate specified for each quality level is the desired compression factor.
.br
.B Note: \fR(options \-r and \-q cannot be used together)
.TP
.B \-\^s " X,Y"
sub-sampling factor (e.g. \-s 2,2). Default: No sub-sampling in x or y direction.
.br
.B Remark: \fRsub-sampling bigger than 2 can produce errors.
.TP
.B \-\^t " W,H"
(Size of tile (e.g. \-t 512,512) )
.TP
.B \-\^x " name"
(Create index file and fill it. Default: no index file)
.TP
.B \-\^EPH
(Write EPH marker after each header packet. Default:no EPH)
.TP
.B \-\^F " rawWidth,rawHeight,rawComp,rawBitDepth,s_or_u"
characteristics of the raw input image
.TP
.B \-\^I
(Use the irreversible DWT 9-7. Default: Reversible DWT 5-3)
.TP
.B \-\^ImgDir " directory_name"
(directory containing input files)
.TP
.B \-\^M " n"
mode switch with values: 1, 2, 4, 8, 16, 32. Default:No mode switch activated.
.br
\fIMeaning:\fR
.br
BYPASS(1)
.br
RESET(2)
.br
RESTART(4)
.br
VSC(8)
.br
ERTERM(16)
.br
SEGMARK(32)
.br
Values can be added: RESTART(4) + RESET(2) + SEGMARK(32) = \-M 38
.TP
.B \-\^OutFor "ext"
(extension for output files)
.TP
.B \-\^POC "TtileNr=resolutionStart, componentStart, layerEnd, resolutionEnd, componentEnd, progressionOrder"
(see Examples)
.TP
.B \-\^ROI "c=n,U=n"
quantization indices upshifted for component c (0 or 1 or 2) with a value of U (>= 0 and <= 37)
.br
e.g. \fB-ROI c=0,U=25\fR
.TP
.B \-\^SOP
(Write SOP marker before each packet. Default: No SOP marker in the codestream.)
.TP
.B \-\^T "X,Y"
(Offset of the origin of the tiles (e.g. \-T 100,75) )
.TP
.B \-\^W
(see JPWL OPTIONS)
.P
.SH JPWL OPTIONS
Options usable only if the library has been compiled with \fB-DUSE_JPWL\fR
.P
.B \-W h<tilepart><=type>, s<tilepart><=method>, a=<addr>, z=<size>, g=<range>, p<tilepart:pack><=type>
.P
.B h\fR selects the header error protection (EPB): \fBtype\fR can be
[0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]
if \fBtilepart\fR is absent, it is for main and tile headers
if \fBtilepart\fR is present, it applies from that tile
onwards, up to the next h<> spec, or to the last tilepart
in the codestream (max. 16 specs)
.P
.B p \fRselects the packet error protection (EEP/UEP with EPBs)
to be applied to raw data: \fBtype\fR can be
[0=none 1,absent=predefined 16=CRC-16 32=CRC-32 37-128=RS]
if \fBtilepart:pack\fR is absent, it is from tile 0, packet 0
if \fBtilepart:pack\fR is present, it applies from that tile
and that packet onwards, up to the next packet spec
or to the last packet in the last tilepart in the stream
(max. 16 specs)
.P
.B s \fRenables sensitivity data insertion (ESD): \fBmethod\fR can be
[\-1=NO ESD 0=RELATIVE ERROR 1=MSE 2=MSE REDUCTION 3=PSNR
4=PSNR INCREMENT 5=MAXERR 6=TSE 7=RESERVED]
if \fBtilepart\fR is absent, it is for main header only
if \fBtilepart\fR is present, it applies from that tile
onwards, up to the next s<> spec, or to the last tilepart
in the codestream (max. 16 specs)
.P
.B g \fRdetermines the addressing mode: \fBrange\fR can be
[0=PACKET 1=BYTE RANGE 2=PACKET RANGE]
.P
.B a \fRdetermines the size of data addressing: \fBaddr\fR can be
2/4 bytes (small/large codestreams). If not set, auto-mode
.P
.B z \fRdetermines the size of sensitivity values: \fBsize\fR can be
1/2 bytes, for the transformed pseudo-floating point value
.P
.SH EXAMPLES
.P
.B opj_compress \-i \fRfile.bmp \fB-o \fRfile.j2k \fB-r \fR20,10,1 (compress 20x, then 10x, then lossless).
.P
.B opj_compress \-i \fRfile.ppm \fB-o \fRfile.j2k \fB-q \fR30,40,50
.P
.B opj_compress \-i \fRfile.pgx \fB-o \fRfile.j2k \fB-POC \fRT1=0,0,1,5,3,CPRL
.P
.B opj_compress \-i \fRlena.raw \fB-o \fRlena.j2k \fB-F \fR512,512,3,8,u
.P
.SH AUTHORS
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
.br
Copyright (c) 2002-2014, Professor Benoit Macq
.br
Copyright (c) 2001-2003, David Janssens
.br
Copyright (c) 2002-2003, Yannick Verschueren
.br
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
.br
Copyright (c) 2005, Herve Drolon, FreeImage Team
.br
Copyright (c) 2006-2007, Parvatha Elangovan
.P
.SH "SEE ALSO"
opj_decompress(1) opj_dump(1)

View File

@ -0,0 +1,119 @@
'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
.de EX
.SP
.nf
.ft CW
..
.de EE
.ft R
.SP
.fi
..
.TH opj_decompress 1 "Version 2.1.1" "opj_decompress" "converts jpeg2000 files"
.P
.SH NAME
opj_decompress \-
This program reads in a jpeg2000 image and converts it to another
image type. It is part of the OpenJPEG library.
.SP
Valid input image extensions are
.B .j2k, .jp2, .j2c, .jpt
.SP
Valid output image extensions are
.B .bmp, .pgm, .pgx, .png, .pnm, .ppm, .raw, .tga, .tif \fR. For PNG resp. TIF it needs libpng resp. libtiff .
.SH SYNOPSIS
.P
.B opj_decompress \-i \fRinfile.j2k \fB-o \fRoutfile.png
.P
.B opj_decompress \-ImgDir \fRimages/ \fB-OutFor \fRbmp
.P
.B opj_decompress \-h \fRPrint help message and exit
.P
.R See JPWL OPTIONS for special options
.SH OPTIONS
.TP
.B \-\^i "name"
(jpeg2000 input file name)
.TP
.B \-\^l "n"
n is the maximum number of quality layers to decode. See LAYERS below)
.TP
.B \-\^o "name"
(output file name with extension)
.TP
.B \-\^r "n"
(n is the highest resolution level to be discarded. See REDUCTION below)
.TP
.B \-\^x "name"
(use name as index file and fill it)
.TP
.B \-\^ImgDir "directory_name"
(directory containing input files)
.TP
.B \-\^OutFor "ext"
(extension for output files)
.P
.SH JPIP OPTIONS
Options usable only if the library has been compiled with
.B BUILD_JPIP
.TP
.B -jpip
Embed index table box into the output JP2 file (compulsory for JPIP)
.TP
.B -TP R
Partition a tile into tile parts of different resolution levels (compulsory for JPT-stream)
.P
.SH JPWL OPTIONS
Options usable only if the library has been compiled with
.B BUILD_JPWL
.TP
.B -W c\fR[=Nc] (Nc is the number of expected components in the codestream; default:3)
.TP
.B -W t\fR[=Nt] (Nt is the maximum number of tiles in the codestream; default:8192)
.TP
.B -W c\fR[=Nc]\fB, t\fR[=Nt] \fR(same as above)
.P
.SH REDUCTION
Set the number of highest resolution levels to be discarded.
The image resolution is effectively divided by 2 to the power of the number of discarded levels. The reduce factor is limited by the smallest total number of decomposition levels among tiles.
.SH TILES
Set the maximum number of quality layers to decode. If there are less quality layers than the specified number, all the quality layers are decoded.
.P
'\".SH BUGS
.SH AUTHORS
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
.br
Copyright (c) 2002-2014, Professor Benoit Macq
.br
Copyright (c) 2001-2003, David Janssens
.br
Copyright (c) 2002-2003, Yannick Verschueren
.br
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
.br
Copyright (c) 2005, Herve Drolon, FreeImage Team
.br
Copyright (c) 2006-2007, Parvatha Elangovan
.P
.SH "SEE ALSO"
opj_compress(1) opj_dump(1)

62
doc/man/man1/opj_dump.1 Normal file
View File

@ -0,0 +1,62 @@
'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
.de EX
.SP
.nf
.ft CW
..
.de EE
.ft R
.SP
.fi
..
.TH opj_dump 1 "Version 2.1.1" "opj_dump" "dumps jpeg2000 files"
.P
.SH NAME
opj_dump \-
This program reads in a jpeg2000 image and dumps the contents to stdout. It is part of the OpenJPEG library.
.SP
Valid input image extensions are
.B .j2k, .jp2, .jpt
.SP
.SH SYNOPSIS
.P
.B opj_dump \-i \fRinfile.j2k
.P
.B opj_dump \-ImgDir \fRimages/ \fRDump all files in images/
.P
.B opj_dump \-h \fRPrint help message and exit
.P
.SH OPTIONS
.TP
.B \-\^i "name"
(jpeg2000 input file name)
.TP
.B \-\^ImgDir "directory_name"
(directory containing jpeg2000 input files)
.P
'\".SH BUGS
.SH AUTHORS
Copyright (c) 2010, Mathieu Malaterre
.P
.SH "SEE ALSO"
opj_compress(1) opj_decompress(1)

337
doc/man/man3/libopenjp2.3 Normal file
View File

@ -0,0 +1,337 @@
'\" t
'\" The line above instructs most `man' programs to invoke tbl
'\"
'\" Separate paragraphs; not the same as PP which resets indent level.
.de SP
.if t .sp .5
.if n .sp
..
'\"
'\" Replacement em-dash for nroff (default is too short).
.ie n .ds m " -
.el .ds m \(em
'\"
'\" Placeholder macro for if longer nroff arrow is needed.
.ds RA \(->
'\"
'\" Decimal point set slightly raised
.if t .ds d \v'-.15m'.\v'+.15m'
.if n .ds d .
'\"
'\" Enclosure macro for examples
.de EX
.SP
.nf
.ft CW
..
.de EE
.ft R
.SP
.fi
..
.TH libopenjp2 3 "Oct 2010" "Version 1.4.0" "Oct 2010"
.P
.SH NAME
libopenjp2 -
a library for reading and writing JPEG2000 image files.
.SP
.SH SYNOPSIS
.P
.B #include <openjpeg.h>
.P
.SS CONVERSION FORMATS
.B PGX: imagetopgx() \fR/\fB pgxtoimage()
.P
.B PXM: imagetopnm() \fR/\fB pnmtoimage()
.P
.B BMP: imagetobmp() \fR/\fB bmptoimage()
.P
.B TIF: imagetotif() \fR/\fB tiftoimage()
.P
.B RAW: imagetoraw() \fR/\fB rawtoimage()
.P
.B TGA: imagetotga() \fR/\fB tgatoimage()
.P
.B PNG: imagetopng() \fR/\fB pngtoimage()
.P
.B YUV: imagetoyuv() \fR/\fB yuvtoimage() \fR(MJ2)
.P
.SS READ
.B opj_set_default_decoder_parameters(opj_dparameters_t *\fIparams\fB);
.P
.B opj_dinfo_t *opj_create_decompress(OPJ_CODEC_FORMAT \fIformat\fB);
.P
.B opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr \fIinfo\fB, opj_event_mgr_t *\fIevent_mgr\fB, void *\fIcontext\fB);
.P
.B void opj_setup_decoder(opj_dinfo_t *\fIdinfo\fB, opj_dparameters_t * \fIparams\fB);
.P
.B opj_cio_t *opj_cio_open(opj_common_ptr \fIinfo\fB, unsigned char *\fIbuf\fB, int \fIbuf_len\fB);
.P
.B opj_image_t *opj_decode(opj_dinfo_t *\fIdinfo\fB, opj_cio_t *\fIcio\fB);
.P
.B void opj_cio_close(opj_cio_t *\fIcio\fB);
.P
.B void opj_destroy_decompress(opj_dinfo_t *\fIdinfo\fB);
.P
.B void opj_image_destroy(opj_image_t *\fIimage\fB);
.P
.SS WRITE
.B void opj_set_default_encoder_parameters(opj_cparameters_t *\fIparams\fB);
.P
/*
.B opj_image_t *FORMATtoimage(const char *\fIfname\fB, opj_cparameters_t *\fIparams\fB);
.P
*/
.br
.B opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT \fIformat\fB);
.P
.B opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr \fIinfo\fB, opj_event_mgr_t *\fIevent_mgr\fB, void *\fIcontext\fB);
.P
.B void opj_setup_encoder(opj_cinfo_t *\fIcinfo\fB, opj_cparameters_t *\fIparams\fB, opj_image_t *\fIimage\fB);
.P
.B opj_cio_t *opj_cio_open(opj_common_ptr \fIcinfo\fB, \fINULL\fB, \fI0\fB);
.P
.B bool opj_encode(opj_cinfo_t *\fIcinfo\fB, opj_cio_t *\fIcio\fB, opj_image_t *\fIimage\fB, char *\fIindex\fB);
.P
.B void opj_cio_close(opj_cio_t *\fIcio\fB);
.P
.B void opj_destroy_compress(opj_cinfo_t *\fIcinfo\fB);
.P
.B void opj_image_destroy(opj_image_t *\fIimage\fB);
.P
.SS GENERAL
.P
.B void opj_image_create(int \fInumcmpts\fB, opj_image_cmptparm_t *\fIcmptparms\fB, OPJ_COLOR_SPACE \fIclrspc\fB);
.P
.B int cio_tell(opj_cio_t *\fIcio\fB);
.P
.B void cio_seek(opj_cio_t *\fIcio\fB, int \fIpos\fB);
.P
.B opj_image_t *opj_decode_with_info(opj_dinfo_t *\fIdinfo\fB, opj_cio_t *\fIcio\fB, opj_codestream_info_t *\fIcstr_info\fB);
.P
.B bool opj_encode_with_info(opj_cinfo_t *\fIcinfo\fB, opj_cio_t *\fIcio\fB, opj_image_t *\fIimage\fB, opj_codestream_info_t *\fIcstr_info\fB);
.P
.B void opj_destroy_cstr_info(opj_codestream_info_t *\fIcstr_info\fB);
.P
.B const char *opj_version(\fIvoid\fB);
.P
.SH OPJ_CODEC_FORMAT
.P
.B CODEC_J2K\fR or \fBCODEC_JPT\fR or \fBCODEC_JP2
.P
.SH OPJ_COLOR_SPACE
.P
.B CLRSPC_UNKNOWN\fR or \fBCLRSPC_UNSPECIFIED\fR or \fBCLRSPC_SRGB\fR or \fBCLRSPC_GRAY\fR or \fBCLRSPC_SYCC
.P
.SH DECOMPRESSION PARAMETERS
.p
typedef struct opj_dparameters
.br
{
/*
Set the number of highest resolution levels to be discarded.
The image resolution is effectively divided by 2 to the power
of the number of discarded levels.
The reduce factor is limited by the smallest total number of
decomposition levels among tiles.
if != 0, then original dimension divided by 2^(reduce);
if == 0 or not used, image is decoded to the full resolution
*/
\fBint\fR cp_reduce;
/*
Set the maximum number of quality layers to decode.
If there are less quality layers than the specified number,
all the quality layers are decoded.
if != 0, then only the first "layer" layers are decoded;
if == 0 or not used, all the quality layers are decoded
*/
\fBint\fR cp_layer;
/*command line encoder parameters (not used inside the library) */
/* input file name */
\fBchar\fR infile[OPJ_PATH_LEN];
/* output file name */
\fBchar\fR outfile[OPJ_PATH_LEN];
/* input file format: see OPJ_CODEC_FORMAT */
\fBint\fR decod_format;
/* output file format */
\fBint\fR cod_format;
/*JPWL decoding parameters */
/* activates the JPWL correction capabilities */
\fBbool\fR jpwl_correct;
/* expected number of components */
\fBint\fR jpwl_exp_comps;
/* maximum number of tiles */
\fBint\fR jpwl_max_tiles;
/*
Specify whether the decoding should be done on the entire
codestream, or be limited to the main header
Limiting the decoding to the main header makes it possible
to extract the characteristics of the codestream
if == NO_LIMITATION, the entire codestream is decoded;
if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
*/
\fBOPJ_LIMIT_DECODING\fR cp_limit_decoding;
.br
} opj_dparameters_t;
.SH COMPRESSION PARAMETERS
.P
typedef struct opj_cparameters
.br
{
/* size of tile: tile_size_on = false (not in argument)
or tile_size_on = true (in argument) */
\fBbool\fR tile_size_on;
/* XTOsiz */
\fBint\fR cp_tx0;
/* YTOsiz */
\fBint\fR cp_ty0;
/* XTsiz */
\fBint\fR cp_tdx;
/* YTsiz */
\fBint\fR cp_tdy;
/* allocation by rate/distortion */
\fBint\fR cp_disto_alloc;
/* allocation by fixed layer */
\fBint\fR cp_fixed_alloc;
/* add fixed_quality */
\fBint\fR cp_fixed_quality;
/* fixed layer */
\fBint *\fRcp_matrice;
/* comment for coding */
\fBchar *\fRcp_comment;
/* coding style */
\fBint\fR csty;
/* progression order:
PROG_UNKNOWN, LRCP(default), RLCP, RPCL, PCRL, CPRL */
\fBOPJ_PROG_ORDER\fR prog_order;
/* progression order changes */
\fBopj_poc_t\fR POC[32];
/* number of progression order changes (POC), default: 0 */
\fBint\fR numpocs;
/* number of layers */
\fBint\fR tcp_numlayers;
/* rates of layers */
\fBfloat\fR tcp_rates[100];
/* different psnr for successive layers */
\fBfloat\fR tcp_distoratio[100];
/* number of resolutions */
\fBint\fR numresolution;
/* initial code block width, default: 64 */
\fBint\fR cblockw_init;
/* initial code block height, default: 64 */
\fBint\fR cblockh_init;
/* mode switch (cblk_style) */
/* 1 : use the irreversible DWT 9-7,
0 : use lossless compression (default) */
\fBint\fR irreversible;
/* region of interest: affected component in [0..3],
-1 means no ROI */
\fBint\fR roi_compno;
/* region of interest: upshift value */
\fBint\fR roi_shift;
/* number of precinct size specifications */
\fBint\fR res_spec;
/* initial precinct width */
\fBint\fR prcw_init[J2K_MAXRLVLS];
/* initial precinct height */
\fBint\fR prch_init[J2K_MAXRLVLS];
/*command line encoder parameters (not used inside the library) */
/* input file name */
\fBchar\fR infile[OPJ_PATH_LEN];
/* output file name */
\fBchar\fR outfile[OPJ_PATH_LEN];
/* DEPRECATED. Index generation is now handeld with the
opj_encode_with_info() function. Set to NULL */
\fBint\fR index_on;
/* DEPRECATED. Index generation is now handeld with the
opj_encode_with_info() function. Set to NULL */
\fBchar\fR index[OPJ_PATH_LEN];
/* subimage encoding: origin image offset in x direction */
\fBint\fR image_offset_x0;
/* subimage encoding: origin image offset in y direction */
\fBint\fR image_offset_y0;
/* subsampling value for dx */
\fBint\fR subsampling_dx;
/* subsampling value for dy */
\fBint\fR subsampling_dy;
/* input file format */
\fBint\fR decod_format;
/* output file format: see OPJ_CODEC_FORMAT */
\fBint\fR cod_format;
/*JPWL encoding parameters */
/* enables writing of EPC in MH, thus activating JPWL */
\fBbool\fR jpwl_epc_on;
/* error protection method for MH (0,1,16,32,37-128) */
\fBint\fR jpwl_hprot_MH;
/* tile number of header protection specification (>=0) */
\fBint\fR jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS];
/* error protection methods for TPHs (0,1,16,32,37-128) */
\fBint\fR jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS];
/* tile number of packet protection specification (>=0) */
\fBint\fR jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS];
/* packet number of packet protection specification (>=0) */
\fBint\fR jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS];
/* error protection methods for packets (0,1,16,32,37-128) */
\fBint\fR jpwl_pprot[JPWL_MAX_NO_PACKSPECS];
/* enables writing of ESD, (0=no/1/2 bytes) */
\fBint\fR jpwl_sens_size;
/* sensitivity addressing size (0=auto/2/4 bytes) */
\fBint\fR jpwl_sens_addr;
/* sensitivity range (0-3) */
\fBint\fR jpwl_sens_range;
/* sensitivity method for MH (-1=no,0-7) */
\fBint\fR jpwl_sens_MH;
/* tile number of sensitivity specification (>=0) */
\fBint\fR jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS];
/* sensitivity methods for TPHs (-1=no,0-7) */
\fBint\fR jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS];
/* Digital Cinema compliance: OFF-not compliant,
CINEMA2K_24, CINEMA2K_48, CINEMA4K_24 */
\fBOPJ_CINEMA_MODE\fR cp_cinema;
/* Maximum rate for each component.
If == 0, component size limitation is not considered */
\fBint\fR max_comp_size;
/* Profile name*/
\fBOPJ_RSIZ_CAPABILITIES\fR cp_rsiz;
/* Tile part generation*/
\fBchar\fR tp_on;
/* Flag for Tile part generation*/
\fBchar\fR tp_flag;
/* MCT (multiple component transform) */
\fBchar\fR tcp_mct;
.br
} opj_cparameters_t;
'\".SH OPTIONS
'\".SH BUGS
.SH AUTHORS
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
Copyright (c) 2002-2014, Professor Benoit Macq
Copyright (c) 2001-2003, David Janssens
Copyright (c) 2002-2003, Yannick Verschueren
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
Copyright (c) 2005, Herve Drolon, FreeImage Team
Copyright (c) 2006-2007, Parvatha Elangovan
.P
.SH "SEE ALSO"
\fBimage_to_j2k\fR(1) \fBj2k_to_image\fR(1) \fBj2k_dump\fR(1)
\fBJPWL_image_to_j2k\fR(1) \fBJPWL_j2k_to_image\fR(1)
\fBextract_j2k_from_mj2\fR(1) \fBwrap_j2k_in_mj2\fR(1)
\fBframes_to_mj2\fR(1) \fBmj2_to_frames\fR(1)

94
doc/openjpip.dox.in Normal file
View File

@ -0,0 +1,94 @@
/*
* $Id$
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*! \page openjpippage OpenJPIP v@OPENJPEG_VERSION@ Documentation
*
* \section intro Introduction
* This manual documents the low-level OpenJPIP C API.\n
* OpenJPIP software is an implementation of JPEG 2000 Part9: Interactivity tools, APIs and protocols (JPIP).\n
* ( For more info about JPIP, check the website: http://www.jpeg.org/jpeg2000/j2kpart9.html)\n
*
* This whole documents covers the following six programs.\n
* - opj_server.c JPIP server supporting HTTP connection and JPT/JPP-stream
* - opj_dec_server.c Server to decode JPT/JPP-stream and communicate locally with JPIP client, which is coded in java
* - opj_jpip_addxml.c To Embed metadata into JP2 file
* - opj_jpip_transcode.c To Convert JPT/JPP-stream to JP2 or J2K
* - opj_jpip_test.c To test index code format of a JP2 file
*
* \section license License
* This software is released under the BSD license, anybody can use or modify the library, even for commercial applications.\n
* The only restriction is to retain the copyright in the sources or the binaries documentation.\n
* Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage.
*
*
* \section reqlibs Required libraries
* - OpenJPEG library
* - FastCGI development kit (C libraries) at server (http://www.fastcgi.com)
* - libcURL library
*
* We tested this software with a virtual server running on the same Linux machine as the clients.
*
*
* \section compilenotes Compiling Notes
* When you are making opj_server, set anything (e.g. yes) to the parameter jpipserver to define itself in the Makefile, which enables to make it in server mode.\n
* Otherwise do not define (or do not set to) the parameter jpipserver.\n
* Be sure that any object files and library file libopenjpip.a are not reused to compile in the two different mode (server mode and non server mode).\n
* In other words, do make clean before making new targets which are in different modes as previous make.\n
*
*
* \section sysarchtect System Architecture
* JPIP protocol is implemented between the JPIP server program (opj_server) and the JPIP client java program (opj_viewer).\n
* Figure below represents the overview of our system architecture.\n
* The JPIP server parses JPIP query and sends corresponding JPT/JPP-stream.
* The JPIP client viewer is an image viewer with GUI to publish JPIP requests and receive JPT/JPP-stream.\n
* Particularly, our system has the image decoding module implemented on a server (opj_dec_server, Image decoding Server).
* Image decoding Server and JPIP client viewer communicate closely.
* This specific architecture enables sharing cache of image codestream data among all viewers connected to the same Image decoding Server not only locally but also remotely.
*
* \image html jpip_architect.png "OpenJPIP system architecture"
*
* JPIP server follows up the client cache during a session. \n
* Concretely, the JPIP server models cache in each session, to which Channel IDs are associated.
* A Channel ID identifies a JPIP client viewer.
* And, new viewers can belong to a session by referring to one of its channel ID.
* The Image decoding Server maintains the association between channel IDs and targets, and provides a reference channel ID to a Viewer on demand.\n
*
* Typical requests and replies among JPIP server, JPIP client, and Image decoding server is presented below.\n
* The JPIP server parses HTTP query and sends corresponding JPT/JPP-stream back to the JPIP client (Viewer).
* JPT/JPP-stream is unreadable by JPIP client, and it is directly passed to Image decoding Server, and which provides the image in raw format (PGM or PPM) to the JPIP client.
* The Image decoding Server handles the decoding and caching of JPT/JPP-stream.
* JPIP client can read PGM and PPM images natively.
* Before connecting to the JPIP server, every JPIP client checks local cache data of the requesting image with the image decoding server.
* If its cache exists, the image decoding server provides ChannelID (CID), which identifies the image and its cache model on the JPIP server, and the whole system can continue the session using the CID.
*
* \image html jpip_protocol.png "Message Sequence Chart of OpenJPIP impementation"
*
* \author Kaori Hagihara UCL/SST/ICTM/ELEN
*/

View File

@ -1,23 +0,0 @@
CC = gcc
LDFLAGS = -lm
CFLAGS = -Wall
all: index_create
bio.o : bio.c bio.h
cio.o : cio.c cio.h
int.o : int.c
pi.o : pi.c pi.h int.h
index_create.o : index_create.c j2k.h cio.h tcd.h int.h
t2.o : t2.c t2.h tcd.h bio.h j2k.h pi.h tgt.h int.h cio.h
tgt.o : tgt.c bio.h tgt.h
tcd.o : tcd.c tcd.h t2.h int.h
jpip.o : jpip.c j2k.h cio.h tcd.h int.h
jp2.o : jp2.c j2k.h cio.h tcd.h int.h
index_create : bio.o cio.o int.o pi.o t2.o tgt.o tcd.o index_create.o jpip.o jp2.o
clean:
rm -rf *.o *.*~ *~ core.*

View File

@ -1,125 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "bio.h"
#include <setjmp.h>
static unsigned char *bio_start, *bio_end, *bio_bp;
static unsigned int bio_buf;
static int bio_ct;
extern jmp_buf j2k_error;
/// <summary>
/// Number of bytes written.
/// </summary>
int bio_numbytes() {
return bio_bp-bio_start;
}
/// <summary>
/// Init decoder.
/// </summary>
/// <param name="bp">Input buffer</param>
/// <param name="len">Input buffer length</param>
void bio_init_dec(unsigned char *bp, int len) {
bio_start=bp;
bio_end=bp+len;
bio_bp=bp;
bio_buf=0;
bio_ct=0;
}
int bio_byteout()
{
bio_buf = (bio_buf << 8) & 0xffff;
bio_ct = bio_buf == 0xff00 ? 7 : 8;
if (bio_bp >= bio_end)
return 1;
*bio_bp++ = bio_buf >> 8;
return 0;
}
/// <summary>
/// Read byte.
/// </summary>
int bio_bytein() {
bio_buf=(bio_buf<<8)&0xffff;
bio_ct=bio_buf==0xff00?7:8;
if (bio_bp>=bio_end) return 1; //longjmp(j2k_error, 1);
bio_buf|=*bio_bp++;
return 0;
}
/// <summary>
/// Read bit.
/// </summary>
int bio_getbit() {
if (bio_ct==0) {
bio_bytein();
}
bio_ct--;
return (bio_buf>>bio_ct)&1;
}
/// <summary>
/// Read bits.
/// </summary>
/// <param name="n">Number of bits to read</param>
int bio_read(int n) {
int i, v;
v=0;
for (i=n-1; i>=0; i--) {
v+=bio_getbit()<<i;
}
return v;
}
/// <summary>
/// Flush bits.
/// </summary>
int bio_flush() {
bio_ct=0;
bio_byteout();
if (bio_ct==7) {
bio_ct=0;
if ( bio_byteout()) return 1;;
}
return 0;
}
/// <summary>
/// </summary>
int bio_inalign() {
bio_ct=0;
if ((bio_buf&0xff)==0xff) {
if( bio_bytein()) return 1;
bio_ct=0;
}
return 0;
}

View File

@ -1,129 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "cio.h"
#include <setjmp.h>
static unsigned char *cio_start, *cio_end, *cio_bp;
extern jmp_buf j2k_error;
/// <summary>
/// Number of bytes written.
/// </summary>
int cio_numbytes() {
return cio_bp-cio_start;
}
/// <summary>
/// Get position in byte stream.
/// </summary>
int cio_tell() {
return cio_bp-cio_start;
}
/// <summary>
/// Set position in byte stream.
/// </summary>
void cio_seek(int pos) {
cio_bp=cio_start+pos;
}
/// <summary>
/// Number of bytes left before the end of the stream.
/// </summary>
int cio_numbytesleft() {
return cio_end-cio_bp;
}
/// <summary>
/// Get pointer to the current position in the stream.
/// </summary>
unsigned char *cio_getbp() {
return cio_bp;
}
/// <summary>
/// Initialize byte IO.
/// </summary>
void cio_init(unsigned char *bp, int len) {
cio_start=bp;
cio_end=bp+len;
cio_bp=bp;
}
/// <summary>
/// Write a byte.
/// </summary>
void cio_byteout(unsigned char v) {
if (cio_bp>=cio_end) longjmp(j2k_error, 1);
*cio_bp++=v;
}
/// <summary>
/// Read a byte.
/// </summary>
unsigned char cio_bytein() {
if (cio_bp>=cio_end) longjmp(j2k_error, 1);
return *cio_bp++;
}
/// <summary>
/// Write a byte.
/// </summary>
//void cio_write(unsigned int v, int n) {
void cio_write(long long v, int n) {
int i;
for (i=n-1; i>=0; i--)
{
cio_byteout((unsigned char)((v>>(i<<3))&0xff));
}
}
/// <summary>
/// Read some bytes.
/// </summary>
/* unsigned int cio_read(int n) { */
long long cio_read(int n) {
int i;
/*unsigned int v;*/
long long v;
v=0;
for (i=n-1; i>=0; i--) {
v+=cio_bytein()<<(i<<3);
}
return v;
}
/// <summary>
/// Write some bytes.
/// </summary>
void cio_skip(int n) {
cio_bp+=n;
}

View File

@ -1,34 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __FIX_H
#define __FIX_H
int fix_mul(int a, int b);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,89 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/// <summary>
/// Get the minimum of two integers.
/// </summary>
int int_min(int a, int b) {
return a<b?a:b;
}
/// <summary>
/// Get the maximum of two integers.
/// </summary>
int int_max(int a, int b) {
return a>b?a:b;
}
/// <summary>
/// Clamp an integer inside an interval.
/// </summary>
int int_clamp(int a, int min, int max) {
if (a<min) return min;
if (a>max) return max;
return a;
}
/// <summary>
/// Get absolute value of integer.
/// </summary>
int int_abs(int a) {
return a<0?-a:a;
}
/// <summary>
/// Divide an integer and round upwards.
/// </summary>
int int_ceildiv(int a, int b) {
return (a+b-1)/b;
}
/// <summary>
/// Divide an integer by a power of 2 and round upwards.
/// </summary>
int int_ceildivpow2(int a, int b) {
return (a+(1<<b)-1)>>b;
}
/// <summary>
/// Divide an integer by a power of 2 and round downwards.
/// </summary>
int int_floordivpow2(int a, int b) {
return a>>b;
}
/// <summary>
/// Get logarithm of an integer and round downwards.
/// </summary>
int int_floorlog2(int a) {
int l;
for (l=0; a>1; l++) {
a>>=1;
}
return l;
}

View File

@ -1,41 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __INT_H
#define __INT_H
int int_min(int a, int b);
int int_max(int a, int b);
int int_clamp(int a, int min, int max);
int int_abs(int a);
int int_ceildiv(int a, int b);
int int_ceildivpow2(int a, int b);
int int_floordivpow2(int a, int b);
int int_floorlog2(int a);
#endif

View File

@ -1,289 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003-2004, Yannick Verschueren
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#define VERSION "0.0.8"
#ifdef WIN32
#ifdef LIBJ2K_EXPORTS
#define LIBJ2K_API __declspec(dllexport)
#else
#define LIBJ2K_API __declspec(dllimport)
#endif
#else
#define LIBJ2K_API
#endif
#ifndef __J2K_H
#define __J2K_H
#define J2K_MAXRLVLS 33
#define J2K_MAXBANDS (3*J2K_MAXRLVLS+1)
#define J2K_CP_CSTY_PRT 0x01
#define J2K_CP_CSTY_SOP 0x02
#define J2K_CP_CSTY_EPH 0x04
#define J2K_CCP_CSTY_PRT 0x01
#define J2K_CCP_CBLKSTY_LAZY 0x01
#define J2K_CCP_CBLKSTY_RESET 0x02
#define J2K_CCP_CBLKSTY_TERMALL 0x04
#define J2K_CCP_CBLKSTY_VSC 0x08
#define J2K_CCP_CBLKSTY_PTERM 0x10
#define J2K_CCP_CBLKSTY_SEGSYM 0x20
#define J2K_CCP_QNTSTY_NOQNT 0
#define J2K_CCP_QNTSTY_SIQNT 1
#define J2K_CCP_QNTSTY_SEQNT 2
typedef struct
{
int dx, dy; /* XRsiz, YRsiz */
int prec; /* precision */
int bpp; /* deapth of image in bits */
int sgnd; /* signed */
int *data; /* image-component data */
} j2k_comp_t;
typedef struct {
int version;
int x0, y0; /* XOsiz, YOsiz */
int x1, y1; /* Xsiz, Ysiz */
int numcomps; /* number of components */
int index_on; /* 0 = no index || 1 = index */
j2k_comp_t *comps; /* image-components */
} j2k_image_t;
typedef struct {
int expn; /* exponent */
int mant; /* mantissa */
} j2k_stepsize_t;
typedef struct {
int csty; /* coding style */
int numresolutions; /* number of resolutions */
int cblkw; /* width of code-blocks */
int cblkh; /* height of code-blocks */
int cblksty; /* code-block coding style */
int qmfbid; /* discrete wavelet transform identifier */
int qntsty; /* quantisation style */
j2k_stepsize_t stepsizes[J2K_MAXBANDS]; /* stepsizes used for quantisation */
int numgbits; /* number of guard bits */
int roishift; /* Region of Interest shift */
int prcw[J2K_MAXRLVLS]; /* Precinct width */
int prch[J2K_MAXRLVLS]; /* Precinct height */
} j2k_tccp_t;
typedef struct {
int resno0, compno0;
int layno1, resno1, compno1;
int prg;
int tile;
char progorder[4];
} j2k_poc_t;
typedef struct {
//int first;
int csty; /* coding style */
int prg; /* progression order */
int numlayers; /* number of layers */
int mct; /* multi-component transform identifier */
int rates[100]; /* rates of layers */
int numpocs; /* number of progression order changes */
int POC; /* Precise if a POC marker has been used O:NO, 1:YES */
j2k_poc_t pocs[32]; /* progression order changes */
unsigned char *ppt_data; /* packet header store there for futur use in t2_decode_packet */
int ppt; /* If ppt == 1 --> there was a PPT marker for the present tile */
int ppt_store; /* Use in case of multiple marker PPT (number of info already store) */
j2k_tccp_t *tccps; /* tile-component coding parameters */
} j2k_tcp_t;
typedef struct {
int tx0, ty0; /* XTOsiz, YTOsiz */
int tdx, tdy; /* XTsiz, YTsiz */
int tw, th;
unsigned char *ppm_data; /* packet header store there for futur use in t2_decode_packet */
int ppm; /* If ppm == 1 --> there was a PPM marker for the present tile */
int ppm_store; /* Use in case of multiple marker PPM (number of info already store) */
int ppm_previous; /* Use in case of multiple marker PPM (case on non-finished previous info) */
j2k_tcp_t *tcps; /* tile coding parameters */
} j2k_cp_t;
/* Packet information : Layer level */
typedef struct {
int len; /* Length of the body of the packet */
int len_header; /* Length of the header of the packet */
int offset; /* Offset of the body of the packet */
int offset_header; /* Offset of the header of the packet */
} info_layer_t;
/* Access to packet information : precinct level */
typedef struct {
info_layer_t *layer;
} info_prec_t;
/* Access to packet information : resolution level */
typedef struct {
info_prec_t *prec;
} info_reso_t;
/* Access to packet information : component level */
typedef struct {
info_reso_t *reso;
} info_compo_t;
/* Information about the marker */
typedef struct {
int type; /* type of marker [SIZ, QCD, POC, PPM, CRG, COD] appearing only once */
int start_pos; /* Start position of the marker */
int len; /* Length of the marker */
} info_marker_t;
/* Multiple marker in tile header */
typedef struct{
info_marker_t *COC; /* COC markers */
int num_COC; /* Number of COC marker */
int CzCOC; /* Current size of the vector COC */
info_marker_t *RGN; /* RGN markers */
int num_RGN; /* Number of RGN marker */
int CzRGN; /* Current size of the vector RGN */
info_marker_t *QCC; /* QCC markers */
int num_QCC; /* Number of QCC marker */
int CzQCC; /* Current size of the vector QCC */
info_marker_t *PLT; /* PLT markers */
int num_PLT; /* Number of PLT marker */
int CzPLT; /* Current size of the vector PLT */
info_marker_t *PPT; /* PPT markers */
int num_PPT; /* Number of PPT marker */
int CzPPT; /* Current size of the vector PPT */
info_marker_t *COM; /* COM markers */
int num_COM; /* Number of COM marker */
int CzCOM; /* Current size of the vector COC */
} info_marker_mul_tile_t;
/* Information about each tile_part for a particulary tile */
typedef struct{
int start_pos; /* Start position of the tile_part */
int length; /* Length of the tile_part header + body */
int length_header; /* Length of the header */
int end_pos; /* End position of the tile part */
int end_header; /* End position of the tile part header */
int num_reso_AUX; /* Number of resolution level completed */
} info_tile_part_t;
/* Information about each tile */
typedef struct {
int num_tile; /* Number of Tile */
int pw, ph; /* number of precinct by tile */
int num_packet; /* number of packet in the tile */
info_compo_t *compo; /* component [packet] */
info_marker_t *marker; /* information concerning markers inside image [only one apparition] */
info_marker_mul_tile_t marker_mul; /* information concerning markers inside image [multiple apparition] */
int num_marker; /* number of marker */
int numparts; /* number of tile_part for this tile */
info_tile_part_t *tile_parts; /* Information about each tile_part */
int Cztile_parts; /* Current size of the tile_parts vector */
} info_tile_t; /* index struct */
/* Multiple marker in main header */
typedef struct{
info_marker_t *COC; /* COC markers */
int num_COC; /* Number of COC marker */
int CzCOC; /* Current size of the vector COC */
info_marker_t *RGN; /* RGN markers */
int num_RGN; /* Number of RGN marker */
int CzRGN; /* Current size of the vector RGN */
info_marker_t *QCC; /* QCC markers */
int num_QCC; /* Number of QCC marker */
int CzQCC; /* Current size of the vector QCC */
info_marker_t *TLM; /* TLM markers */
int num_TLM; /* Number of TLM marker */
int CzTLM; /* Current size of the vector TLM */
info_marker_t *PLM; /* PLM markers */
int num_PLM; /* Number of PLM marker */
int CzPLM; /* Current size of the vector PLM */
info_marker_t *PPM; /* PPM markers */
int num_PPM; /* Number of PPM marker */
int CzPPM; /* Current size of the vector PPM */
info_marker_t *COM; /* COM markers */
int num_COM; /* Number of COM marker */
int CzCOM; /* Current size of the vector COM */
} info_marker_mul_t; /* index struct */
/* Information about image */
typedef struct {
int Im_w, Im_h; /* Image width and Height */
int Tile_x, Tile_y; /* Number of Tile in X and Y */
int tw, th;
int pw, ph; /* nombre precinct in X and Y */
int pdx, pdy; /* size of precinct in X and Y */
int Prog; /* progression order */
int Comp; /* Component numbers */
int Layer; /* number of layer */
int Decomposition; /* number of decomposition */
int Main_head_end; /* Main header position */
int codestream_size; /* codestream's size */
info_marker_t *marker; /* information concerning markers inside image [only one apparition] */
info_marker_mul_t marker_mul; /* information concerning markers inside image [multiple apparition] */
int num_marker; /* number of marker */
int num_packet_max; /* Maximum number of packet */
int num_max_tile_parts; /* Maximum number of tile-part */
info_tile_t *tile; /* information concerning tiles inside image */
} info_image_t; /* index struct */
#endif

View File

@ -1,301 +0,0 @@
/*
* Copyright (c) 2003-2004, Yannick Verschueren
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "j2k.h"
#include "cio.h"
#include "tcd.h"
#include "int.h"
#define JPIP_JPIP 0x6a706970
#define JP2_JP 0x6a502020
#define JP2_FTYP 0x66747970
#define JP2_JP2H 0x6a703268
#define JP2_IHDR 0x69686472
#define JP2_COLR 0x636f6c72
#define JP2_JP2C 0x6a703263
#define JP2_URL 0x75726c20
#define JP2_DBTL 0x6474626c
#define JP2_BPCC 0x62706363
#define JP2 0x6a703220
void jp2_write_url(char *Idx_file)
{
int len, lenp, i;
char str[256];
sprintf(str, "%s", Idx_file);
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_URL, 4); // DBTL
cio_write(0,1); // VERS
cio_write(0,3); // FLAG
for (i=0; i<strlen(str); i++) {
cio_write(str[i], 1);
}
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); // L
cio_seek(lenp+len);
}
void jp2_write_dbtl(char *Idx_file)
{
int len, lenp;
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_DBTL, 4); // DBTL
cio_write(1,2); // NDR : Only 1
jp2_write_url(Idx_file); // URL Box
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); // L
cio_seek(lenp+len);
}
int jp2_write_ihdr(j2k_image_t *j2k_img)
{
int len, lenp,i;
int depth_0,depth, sign, BPC_ok=1;
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_IHDR, 4); // IHDR
cio_write(j2k_img->y1-j2k_img->x0,4); // HEIGHT
cio_write(j2k_img->x1-j2k_img->x0,4); // WIDTH
cio_write(j2k_img->numcomps,2); // NC
depth_0=j2k_img->comps[0].prec-1;
sign=j2k_img->comps[0].sgnd;
for(i=1;i<j2k_img->numcomps;i++)
{
depth=j2k_img->comps[i].prec-1;
sign=j2k_img->comps[i].sgnd;
if(depth_0!=depth) BPC_ok=0;
}
if (BPC_ok)
cio_write(depth_0+(sign<<7),1);
else
cio_write(255,1);
cio_write(7,1); // C : Always 7
cio_write(1,1); // UnkC, colorspace unknow
cio_write(0,1); // IPR, no intellectual property
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); // L
cio_seek(lenp+len);
return BPC_ok;
}
void jp2_write_bpcc(j2k_image_t *j2k_img)
{
int len, lenp, i;
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_BPCC, 4); // BPCC
for(i=0;i<j2k_img->numcomps;i++)
cio_write(j2k_img->comps[i].prec-1+(j2k_img->comps[i].sgnd<<7),1);
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); // L
cio_seek(lenp+len);
}
void jp2_write_colr(int BPC_ok, j2k_image_t *j2k_img)
{
int len, lenp, meth;
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_COLR, 4); // COLR
if ((j2k_img->numcomps==1 || j2k_img->numcomps==3) && (BPC_ok && j2k_img->comps[0].prec==8))
meth=1;
else
meth=2;
cio_write(meth,1); // METH
cio_write(0,1); // PREC
cio_write(0,1); // APPROX
if (meth==1)
cio_write(j2k_img->numcomps>1?16:17,4); // EnumCS
if (meth==2)
cio_write(0,1); // PROFILE (??)
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); // L
cio_seek(lenp+len);
}
/*
* Write the JP2H box
*
* JP2 Header box
*
*/
void jp2_write_jp2h(j2k_image_t *j2k_img)
{
int len, lenp, BPC_ok;
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_JP2H, 4); /* JP2H */
BPC_ok=jp2_write_ihdr(j2k_img);
if (!BPC_ok)
jp2_write_bpcc(j2k_img);
jp2_write_colr(BPC_ok, j2k_img);
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); /* L */
cio_seek(lenp+len);
}
/*
* Write the FTYP box
*
* File type box
*
*/
void jp2_write_ftyp()
{
int len, lenp;
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_FTYP, 4); /* FTYP */
cio_write(JP2,4); /* BR */
cio_write(0,4); /* MinV */
cio_write(JP2,4); /* CL0 : JP2 */
cio_write(JPIP_JPIP,4); /* CL1 : JPIP */
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); /* L */
cio_seek(lenp+len);
}
/*
* Read the FTYP box
*
* File type box
*
*/
void jp2_read_ftyp(int length)
{
int BR, MinV, type, i;
BR = cio_read(4); /* BR */
MinV = cio_read(4); /* MinV */
length-=8;
for (i=length/4;i>0;i--)
type = cio_read(4); /* CLi : JP2, JPIP */
}
int jp2_write_jp2c(char *J2K_file)
{
int len, lenp, totlen, i;
FILE *src;
char *j2kfile;
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_JP2C, 4); // JP2C
src=fopen(J2K_file, "rb");
fseek(src, 0, SEEK_END);
totlen=ftell(src);
fseek(src, 0, SEEK_SET);
j2kfile=(char*)malloc(totlen);
fread(j2kfile, 1, totlen, src);
fclose(src);
for (i=0;i<totlen;i++)
cio_write(j2kfile[i],1);
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); // L
cio_seek(lenp+len);
return lenp;
}
void jp2_write_jp()
{
int len, lenp;
lenp=cio_tell();
cio_skip(4);
cio_write(JP2_JP, 4); // JP
cio_write(0x0d0a870a,4);
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len,4); // L
cio_seek(lenp+len);
}
/*
* Read the JP box
*
* JPEG 2000 signature
*
* return 1 if error else 0
*/
int jp2_read_jp()
{
if (0x0d0a870a!=cio_read(4))
return 1;
else
return 0;
}

View File

@ -1,769 +0,0 @@
/*
* Copyright (c) 2003-2004, Yannick Verschueren
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <math.h>
#include <unistd.h>
#include "j2k.h"
#include "cio.h"
#include "tcd.h"
#include "int.h"
#define JPIP_CIDX 0x63696478 /* Codestream index */
#define JPIP_CPTR 0x63707472 /* Codestream Finder Box */
#define JPIP_MANF 0x6d616e66 /* Manifest Box */
#define JPIP_FAIX 0x66616978 /* Fragment array Index box */
#define JPIP_MHIX 0x6d686978 /* Main Header Index Table */
#define JPIP_TPIX 0x74706978 /* Tile-part Index Table box */
#define JPIP_THIX 0x74686978 /* Tile header Index Table box */
#define JPIP_PPIX 0x70706978 /* Precinct Packet Index Table box */
#define JPIP_PHIX 0x70686978 /* Packet Header index Table */
#define JPIP_FIDX 0x66696478 /* File Index */
#define JPIP_FPTR 0x66707472 /* File Finder */
#define JPIP_PRXY 0x70727879 /* Proxy boxes */
#define JPIP_IPTR 0x69707472 /* Index finder box */
#define JPIP_PHLD 0x70686c64 /* Place holder */
#define JP2C 0x6a703263
//static info_marker_t marker_jpip[32], marker_local_jpip[32]; /* SIZE to precise ! */
//static int num_marker_jpip, num_marker_local_jpip;
/*
* Write the CPTR box
*
* Codestream finder box (box)
*
*/
void jpip_write_cptr(int offset, info_image_t img)
{
int len, lenp;
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_CPTR,4); /* T */
cio_write(0,2); /* DR A PRECISER !! */
cio_write(0,2); /* CONT */
cio_write(offset,8); /* COFF A PRECISER !! */
cio_write(img.codestream_size,8); /* CLEN */
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
}
/*
* Read the CPTR box
*
* Codestream finder box (box)
*
*/
void jpip_read_cptr()
{
int DR, CONT;
long long Coff, codestream_size;
DR = cio_read(2); /* DR */
CONT = cio_read(2); /* CONT */
Coff = cio_read(8); /* COFF */
codestream_size = cio_read(8); /* CLEN */
}
/*
* Write the MANF box
*
* Manifest box (box)
*
*/
void jpip_write_manf(int second, int v, info_marker_t *marker)
{
int len, lenp, i;
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_MANF,4); /* T */
if (second) /* Write only during the second pass */
{
for(i=0;i<v;i++)
{
cio_write(marker[i].len,4); /* Marker length */
cio_write(marker[i].type,4); /* Marker type */
}
}
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
}
/*
* Read the MANF box
*
* Manifest box (box)
*
*/
void jpip_read_manf(int len)
{
int i, v, marker_len, marker_type;
v = (len - 8)/ 8;
for(i=0;i<v;i++)
{
marker_len = cio_read(4); /* Marker length */
marker_type = cio_read(4); /* Marker type */
}
}
/*
* Write the MHIX box
*
* Main Header Index Table (box)
*
*/
int jpip_write_mhix(info_image_t img, int status, int tileno)
{
int len, lenp, i;
info_tile_t *tile;
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_MHIX, 4); /* MHIX */
if (status) /* MAIN HEADER */
{
cio_write(img.Main_head_end,8); /* TLEN */
for(i = 0; i < img.num_marker; i++) /* Marker restricted to 1 apparition */
{
cio_write(img.marker[i].type, 2);
cio_write(0, 2);
cio_write(img.marker[i].start_pos, 8);
cio_write(img.marker[i].len, 2);
}
/* Marker NOT restricted to 1 apparition */
for(i = img.marker_mul.num_COC - 1; i >= 0; i--) /* COC */
{
cio_write(img.marker_mul.COC[i].type, 2);
cio_write(i, 2);
cio_write(img.marker_mul.COC[i].start_pos, 8);
cio_write(img.marker_mul.COC[i].len, 2);
}
for(i = img.marker_mul.num_RGN - 1; i >= 0; i--) /* RGN */
{
cio_write(img.marker_mul.RGN[i].type, 2);
cio_write(i, 2);
cio_write(img.marker_mul.RGN[i].start_pos, 8);
cio_write(img.marker_mul.RGN[i].len, 2);
}
for(i = img.marker_mul.num_QCC - 1; i >= 0; i--) /* QCC */
{
cio_write(img.marker_mul.QCC[i].type, 2);
cio_write(i, 2);
cio_write(img.marker_mul.QCC[i].start_pos, 8);
cio_write(img.marker_mul.QCC[i].len, 2);
}
for(i = img.marker_mul.num_TLM - 1; i >= 0; i--) /* TLM */
{
cio_write(img.marker_mul.TLM[i].type, 2);
cio_write(i, 2);
cio_write(img.marker_mul.TLM[i].start_pos, 8);
cio_write(img.marker_mul.TLM[i].len, 2);
}
for(i = img.marker_mul.num_PLM - 1; i >= 0; i--) /* PLM */
{
cio_write(img.marker_mul.PLM[i].type, 2);
cio_write(i, 2);
cio_write(img.marker_mul.PLM[i].start_pos, 8);
cio_write(img.marker_mul.PLM[i].len, 2);
}
for(i = img.marker_mul.num_PPM - 1; i >= 0; i--) /* PPM */
{
cio_write(img.marker_mul.PPM[i].type, 2);
cio_write(i, 2);
cio_write(img.marker_mul.PPM[i].start_pos, 8);
cio_write(img.marker_mul.PPM[i].len, 2);
}
for(i = img.marker_mul.num_COM - 1; i >= 0; i--) /* COM */
{
cio_write(img.marker_mul.COM[i].type, 2);
cio_write(i, 2);
cio_write(img.marker_mul.COM[i].start_pos, 8);
cio_write(img.marker_mul.COM[i].len, 2);
}
}
else /* TILE HEADER */
{
tile = &img.tile[tileno];
cio_write(tile->tile_parts[0].length_header, 8); /* TLEN */
for(i = 0; i < tile->num_marker; i++) /* Marker restricted to 1 apparition */
{
cio_write(tile->marker[i].type, 2);
cio_write(0, 2);
cio_write(tile->marker[i].start_pos, 8);
cio_write(tile->marker[i].len, 2);
}
/* Marker NOT restricted to 1 apparition */
for(i = tile->marker_mul.num_COC - 1; i >= 0; i--) /* COC */
{
cio_write(tile->marker_mul.COC[i].type, 2);
cio_write(i, 2);
cio_write(tile->marker_mul.COC[i].start_pos, 8);
cio_write(tile->marker_mul.COC[i].len, 2);
}
for(i = tile->marker_mul.num_RGN - 1; i >= 0; i--) /* RGN */
{
cio_write(tile->marker_mul.RGN[i].type, 2);
cio_write(i, 2);
cio_write(tile->marker_mul.RGN[i].start_pos, 8);
cio_write(tile->marker_mul.RGN[i].len, 2);
}
for(i = tile->marker_mul.num_QCC - 1; i >= 0; i--) /* QCC */
{
cio_write(tile->marker_mul.QCC[i].type, 2);
cio_write(i, 2);
cio_write(tile->marker_mul.QCC[i].start_pos, 8);
cio_write(tile->marker_mul.QCC[i].len, 2);
}
for(i = tile->marker_mul.num_PLT - 1; i >= 0; i--) /* PLT */
{
cio_write(tile->marker_mul.PLT[i].type,2);
cio_write(i,2);
cio_write(tile->marker_mul.PLT[i].start_pos,8);
cio_write(tile->marker_mul.PLT[i].len,2);
}
for(i = tile->marker_mul.num_PPT - 1; i >= 0; i--) /* PPT */
{
cio_write(tile->marker_mul.PPT[i].type, 2);
cio_write(i, 2);
cio_write(tile->marker_mul.PPT[i].start_pos, 8);
cio_write(tile->marker_mul.PPT[i].len, 2);
}
for(i = tile->marker_mul.num_COM - 1; i >= 0; i--) /* COM */
{
cio_write(tile->marker_mul.COM[i].type, 2);
cio_write(i, 2);
cio_write(tile->marker_mul.COM[i].start_pos, 8);
cio_write(tile->marker_mul.COM[i].len, 2);
}
}
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
return len;
}
/*
* Read the MHIX box
*
* Main Header Index Table (box)
*
*/
void jpip_read_mhix(int len)
{
int i, v, marker_type, marker_start_pos, marker_len, marker_remains;
v = (len - 8) / 14;
for (i=0; i<v ; i++)
{
marker_type = cio_read(2); /* Type of the marker */
marker_remains = cio_read(2); /* Number of same markers following */
marker_start_pos = cio_read(2); /* Start position of the marker */
marker_len = cio_read(2); /* Length of the marker */
}
}
/*
* Write the FAIX box
*
* Fragment array Index box (box)
*
*/
int jpip_write_faix(int v, int compno, info_image_t img, j2k_cp_t *j2k_cp, int version)
{
int len, lenp, i, j;
/*int version = 0;*/
int tileno, resno, precno, layno, num_packet=0;
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_FAIX, 4); /* FAIX */
cio_write(version,1); /* Version 0 = 4 bytes */
switch(v)
{
case 0: /* TPIX */
cio_write(img.num_max_tile_parts,(version & 0x01)?8:4); /* NMAX */
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
for (i = 0; i < img.tw*img.th; i++)
{
for (j = 0; j < img.tile[i].numparts ; j++)
{
cio_write(img.tile[i].tile_parts[j].start_pos,(version & 0x01)?8:4); /* start position */
cio_write(img.tile[i].tile_parts[j].length,(version & 0x01)?8:4); /* length */
if (version & 0x02)
cio_write(img.tile[i].tile_parts[j].num_reso_AUX,4); /* Aux_i,j : Auxiliary value */
//cio_write(0,4);
}
/* PADDING */
while (j < img.num_max_tile_parts)
{
cio_write(0,(version & 0x01)?8:4); /* start position */
cio_write(0,(version & 0x01)?8:4); /* length */
if (version & 0x02)
cio_write(0,4); /* Aux_i,j : Auxiliary value */
j++;
}
}
break;
/* case 1: */ /* THIX */
/* cio_write(1,(version & 0x01)?8:4); */ /* NMAX */
/* cio_write(img.tw*img.th,(version & 0x01)?8:4); */ /* M */
/* for (i=0;i<img.tw*img.th;i++) */
/* { */
/* cio_write(img.tile[i].start_pos,(version & 0x01)?8:4); */ /* start position */
/* cio_write(img.tile[i].end_header-img.tile[i].start_pos,(version & 0x01)?8:4); */ /* length */
/* if (version & 0x02)*/
/* cio_write(0,4); */ /* Aux_i,j : Auxiliary value */
/* } */
/* break; */
case 2: /* PPIX NOT FINISHED !! */
cio_write(img.num_packet_max,(version & 0x01)?8:4); /* NMAX */
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
for(tileno=0;tileno<img.tw*img.th;tileno++)
{
info_tile_t *tile_Idx = &img.tile[tileno];
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
int correction;
num_packet=0;
if(j2k_cp->tcps[tileno].csty&J2K_CP_CSTY_EPH)
correction=3;
else
correction=1;
for(resno=0;resno<img.Decomposition+1;resno++)
{
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
for (precno=0;precno<img.tile[tileno].pw*img.tile[tileno].ph;precno++)
{
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
for(layno=0;layno<img.Layer;layno++)
{
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
cio_write(layer_Idx->offset,(version & 0x01)?8:4); /* start position */
cio_write((layer_Idx->len_header-correction)?0:layer_Idx->len,(version & 0x01)?8:4); /* length */
if (version & 0x02)
cio_write(0,4); /* Aux_i,j : Auxiliary value */
num_packet++;
}
}
}
/* PADDING */
while (num_packet < img.num_packet_max)
{
cio_write(0,(version & 0x01)?8:4); /* start position */
cio_write(0,(version & 0x01)?8:4); /* length */
if (version & 0x02)
cio_write(0,4); /* Aux_i,j : Auxiliary value */
num_packet++;
}
}
break;
case 3: /* PHIX NOT FINISHED !! */
cio_write(img.num_packet_max,(version & 0x01)?8:4); /* NMAX */
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
for(tileno=0;tileno<img.tw*img.th;tileno++)
{
info_tile_t *tile_Idx = &img.tile[tileno];
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
int correction;
num_packet = 0;
if(j2k_cp->tcps[tileno].csty&J2K_CP_CSTY_EPH)
correction=3;
else
correction=1;
for(resno=0;resno<img.Decomposition+1;resno++)
{
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
for (precno=0;precno<img.tile[tileno].pw*img.tile[tileno].ph;precno++)
{
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
for(layno=0;layno<img.Layer;layno++)
{
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
cio_write(layer_Idx->offset_header,(version & 0x01)?8:4); /* start position */
cio_write((layer_Idx->len_header-correction)?0:layer_Idx->len_header,(version & 0x01)?8:4); /* length */
if (version & 0x02)
cio_write(0,4); /* Aux_i,j : Auxiliary value */
num_packet++;
}
}
}
/* PADDING */
while (num_packet<img.num_packet_max)
{
cio_write(0,(version & 0x01)?8:4); /* start position */
cio_write(0,(version & 0x01)?8:4); /* length */
if (version & 0x02)
cio_write(0,4); /* Aux_i,j : Auxiliary value */
num_packet++;
}
}
break;
}
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
return len;
}
/*
* Write the TPIX box
*
* Tile-part Index table box (superbox)
*
*/
int jpip_write_tpix(info_image_t img, j2k_cp_t *j2k_cp, int version)
{
int len, lenp;
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_TPIX, 4); /* TPIX */
jpip_write_faix(0,0,img, j2k_cp, version);
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
return len;
}
/*
* Write the THIX box
*
* Tile header Index table box (superbox)
*
*/
//int jpip_write_thix(info_image_t img, j2k_cp_t *j2k_cp)
// {
// int len, lenp;
// lenp=cio_tell();
// cio_skip(4); /* L [at the end] */
// cio_write(JPIP_THIX, 4); /* THIX */
// jpip_write_faix(1,0,img, j2k_cp);
// len=cio_tell()-lenp;
// cio_seek(lenp);
// cio_write(len, 4); /* L */
// cio_seek(lenp+len);
// return len;
//}
int jpip_write_thix(info_image_t img, j2k_cp_t *j2k_cp)
{
int len, lenp, i;
int tileno;
info_marker_t *marker;
int num_marker_local_jpip;
marker = (info_marker_t*)calloc(sizeof(info_marker_t), j2k_cp->tw*j2k_cp->th);
for ( i = 0; i < 2 ; i++ )
{
if (i) cio_seek(lenp);
lenp = cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_THIX, 4); /* THIX */
jpip_write_manf(i, j2k_cp->tw*j2k_cp->th, marker);
num_marker_local_jpip=img.Comp;
for (tileno = 0; tileno < j2k_cp->tw*j2k_cp->th; tileno++)
{
marker[tileno].len = jpip_write_mhix(img, 1, tileno);
marker[tileno].type = JPIP_MHIX;
}
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
}
free(marker);
return len;
}
/*
* Write the PPIX box
*
* Precinct Packet Index table box (superbox)
*
*/
int jpip_write_ppix(info_image_t img,j2k_cp_t *j2k_cp)
{
int len, lenp, compno, i;
info_marker_t *marker;
int num_marker_local_jpip;
marker = (info_marker_t*)calloc(sizeof(info_marker_t), img.Comp);
for (i=0;i<2;i++)
{
if (i) cio_seek(lenp);
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_PPIX, 4); /* PPIX */
jpip_write_manf(i,img.Comp,marker);
num_marker_local_jpip=img.Comp;
for (compno=0; compno<img.Comp; compno++)
{
marker[compno].len=jpip_write_faix(2,compno,img, j2k_cp, 0);
marker[compno].type=JPIP_FAIX;
}
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
}
free(marker);
return len;
}
/*
* Write the PHIX box
*
* Packet Header Index table box (superbox)
*
*/
int jpip_write_phix(info_image_t img, j2k_cp_t *j2k_cp)
{
int len, lenp=0, compno, i;
info_marker_t *marker;
marker = (info_marker_t*)calloc(sizeof(info_marker_t), img.Comp);
for (i=0;i<2;i++)
{
if (i) cio_seek(lenp);
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_PHIX, 4); /* PHIX */
jpip_write_manf(i,img.Comp,marker);
for (compno=0; compno<img.Comp; compno++)
{
marker[compno].len=jpip_write_faix(3,compno,img, j2k_cp, 0);
marker[compno].type=JPIP_FAIX;
}
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
}
free(marker);
return len;
}
/*
* Write the CIDX box
*
* Codestream Index box (superbox)
*
*/
int jpip_write_cidx(int offset, info_image_t img, j2k_cp_t *j2k_cp, int version)
{
int len, lenp = 0, i;
info_marker_t *marker_jpip;
int num_marker_jpip = 0;
marker_jpip = (info_marker_t*)calloc(sizeof(info_marker_t), 32);
for (i=0;i<2;i++)
{
if(i)
cio_seek(lenp);
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_CIDX, 4); /* CIDX */
jpip_write_cptr(offset, img);
jpip_write_manf(i,num_marker_jpip, marker_jpip);
num_marker_jpip=0;
marker_jpip[num_marker_jpip].len=jpip_write_mhix(img, 0, 0);
marker_jpip[num_marker_jpip].type=JPIP_MHIX;
num_marker_jpip++;
marker_jpip[num_marker_jpip].len=jpip_write_tpix(img, j2k_cp, version);
marker_jpip[num_marker_jpip].type=JPIP_TPIX;
num_marker_jpip++;
marker_jpip[num_marker_jpip].len=jpip_write_thix(img, j2k_cp);
marker_jpip[num_marker_jpip].type=JPIP_THIX;
num_marker_jpip++;
marker_jpip[num_marker_jpip].len=jpip_write_ppix(img, j2k_cp);
marker_jpip[num_marker_jpip].type=JPIP_PPIX;
num_marker_jpip++;
marker_jpip[num_marker_jpip].len=jpip_write_phix(img, j2k_cp);
marker_jpip[num_marker_jpip].type=JPIP_PHIX;
num_marker_jpip++;
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
}
free(marker_jpip);
return len;
}
/*
* Write the IPTR box
*
* Index Finder box
*
*/
void jpip_write_iptr(int offset, int length)
{
int len, lenp;
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_IPTR, 4); /* IPTR */
cio_write(offset,8);
cio_write(length,8);
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
}
/*
* Write the PRXY box
*
* proxy (box)
*
*/
void jpip_write_prxy(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx)
{
int len, lenp;
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_PRXY, 4); /* IPTR */
cio_write(offset_jp2c,8); /* OOFF */
cio_write(length_jp2c,4); /* OBH part 1 */
cio_write(JP2C,4); /* OBH part 2 */
cio_write(1,1); /* NI */
cio_write(offset_idx,8); /* IOFF */
cio_write(length_idx,4); /* IBH part 1 */
cio_write(JPIP_CIDX,4); /* IBH part 2 */
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
}
/*
* Write the FIDX box
*
* File Index (superbox)
*
*/
int jpip_write_fidx(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx)
{
int len, lenp;
lenp=cio_tell();
cio_skip(4); /* L [at the end] */
cio_write(JPIP_FIDX, 4); /* IPTR */
jpip_write_prxy(offset_jp2c, length_jp2c, offset_idx, offset_jp2c);
len=cio_tell()-lenp;
cio_seek(lenp);
cio_write(len, 4); /* L */
cio_seek(lenp+len);
return len;
}

View File

@ -1,465 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003-2004, Yannick Verschueren
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "pi.h"
#include "int.h"
#include <stdlib.h>
#include <stdio.h>
/* <summary> */
/* Create a packet iterator. */
/* </summary> */
pi_iterator_t *pi_create(j2k_image_t * img, j2k_cp_t * cp, int tileno)
{
int p, q;
int compno, resno, pino;
int maxres = 0;
pi_iterator_t *pi;
j2k_tcp_t *tcp;
j2k_tccp_t *tccp;
tcp = &cp->tcps[tileno];
pi = (pi_iterator_t *) malloc((tcp->numpocs + 1) * sizeof(pi_iterator_t));
for (pino = 0; pino < tcp->numpocs + 1; pino++) { /* change */
p = tileno % cp->tw;
q = tileno / cp->tw;
pi[pino].tx0 = int_max(cp->tx0 + p * cp->tdx, img->x0);
pi[pino].ty0 = int_max(cp->ty0 + q * cp->tdy, img->y0);
pi[pino].tx1 = int_min(cp->tx0 + (p + 1) * cp->tdx, img->x1);
pi[pino].ty1 = int_min(cp->ty0 + (q + 1) * cp->tdy, img->y1);
pi[pino].numcomps = img->numcomps;
pi[pino].comps = (pi_comp_t *) malloc(img->numcomps * sizeof(pi_comp_t));
for (compno = 0; compno < pi->numcomps; compno++) {
int tcx0, tcy0, tcx1, tcy1;
pi_comp_t *comp = &pi[pino].comps[compno];
tccp = &tcp->tccps[compno];
comp->dx = img->comps[compno].dx;
comp->dy = img->comps[compno].dy;
comp->numresolutions = tccp->numresolutions;
comp->resolutions =
(pi_resolution_t *) malloc(comp->numresolutions *
sizeof(pi_resolution_t));
tcx0 = int_ceildiv(pi->tx0, comp->dx);
tcy0 = int_ceildiv(pi->ty0, comp->dy);
tcx1 = int_ceildiv(pi->tx1, comp->dx);
tcy1 = int_ceildiv(pi->ty1, comp->dy);
if (comp->numresolutions > maxres) {
maxres = comp->numresolutions;
}
for (resno = 0; resno < comp->numresolutions; resno++) {
int levelno;
int rx0, ry0, rx1, ry1;
int px0, py0, px1, py1;
pi_resolution_t *res = &comp->resolutions[resno];
if (tccp->csty & J2K_CCP_CSTY_PRT) {
res->pdx = tccp->prcw[resno];
res->pdy = tccp->prch[resno];
} else {
res->pdx = 15;
res->pdy = 15;
}
levelno = comp->numresolutions - 1 - resno;
rx0 = int_ceildivpow2(tcx0, levelno);
ry0 = int_ceildivpow2(tcy0, levelno);
rx1 = int_ceildivpow2(tcx1, levelno);
ry1 = int_ceildivpow2(tcy1, levelno);
px0 = int_floordivpow2(rx0, res->pdx) << res->pdx;
py0 = int_floordivpow2(ry0, res->pdy) << res->pdy;
px1 = int_ceildivpow2(rx1, res->pdx) << res->pdx;
py1 = int_ceildivpow2(ry1, res->pdy) << res->pdy;
res->pw = (px1 - px0) >> res->pdx;
res->ph = (py1 - py0) >> res->pdy;
}
}
tccp = &tcp->tccps[0];
pi[pino].step_p=1;
pi[pino].step_c=100*pi[pino].step_p;
pi[pino].step_r=img->numcomps*pi[pino].step_c;
pi[pino].step_l=maxres*pi[pino].step_r;
if (pino==0)
pi[pino].include=(short int*)calloc(img->numcomps*maxres*tcp->numlayers*100,sizeof(short int));
else
pi[pino].include=pi[pino-1].include;
/*if (pino == tcp->numpocs) {*/
if (tcp->POC == 0) {
pi[pino].first = 1;
pi[pino].poc.resno0 = 0;
pi[pino].poc.compno0 = 0;
pi[pino].poc.layno1 = tcp->numlayers;
pi[pino].poc.resno1 = maxres;
pi[pino].poc.compno1 = img->numcomps;
pi[pino].poc.prg = tcp->prg;
} else {
pi[pino].first = 1;
pi[pino].poc.resno0 = tcp->pocs[pino].resno0;
pi[pino].poc.compno0 = tcp->pocs[pino].compno0;
pi[pino].poc.layno1 = tcp->pocs[pino].layno1;
pi[pino].poc.resno1 = tcp->pocs[pino].resno1;
pi[pino].poc.compno1 = tcp->pocs[pino].compno1;
pi[pino].poc.prg = tcp->pocs[pino].prg;
}
}
return pi;
}
/* <summary> */
/* Get next packet in layer=resolution-component-precinct order. */
/* </summary> */
int pi_next_lrcp(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
comp = &pi->comps[pi->compno];
res = &comp->resolutions[pi->resno];
goto skip;
} else {
pi->first = 0;
}
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1;
pi->resno++) {
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
pi->compno++) {
comp = &pi->comps[pi->compno];
if (pi->resno >= comp->numresolutions) {
continue;
}
res = &comp->resolutions[pi->resno];
for (pi->precno = 0; pi->precno < res->pw * res->ph; pi->precno++) {
if (!pi->include[pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p]){
pi->include[pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
return 0;
}
/* <summary> */
/* Get next packet in resolution-layer-component-precinct order. */
/* </summary> */
int pi_next_rlcp(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
comp = &pi->comps[pi->compno];
res = &comp->resolutions[pi->resno];
goto skip;
} else {
pi->first = 0;
}
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
pi->compno++) {
comp = &pi->comps[pi->compno];
if (pi->resno >= comp->numresolutions) {
continue;
}
res = &comp->resolutions[pi->resno];
for (pi->precno = 0; pi->precno < res->pw * res->ph; pi->precno++) {
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
return 0;
}
/* <summary> */
/* Get next packet in resolution-precinct-component-layer order. */
/* </summary> */
int pi_next_rpcl(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
goto skip;
} else {
int compno, resno;
pi->first = 0;
pi->dx = 0;
pi->dy = 0;
for (compno = 0; compno < pi->numcomps; compno++) {
comp = &pi->comps[compno];
for (resno = 0; resno < comp->numresolutions; resno++) {
int dx, dy;
res = &comp->resolutions[resno];
dx =
comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
dy =
comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
}
}
}
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
for (pi->y = pi->ty0; pi->y < pi->ty1;
pi->y += pi->dy - (pi->y % pi->dy)) {
for (pi->x = pi->tx0; pi->x < pi->tx1;
pi->x += pi->dx - (pi->x % pi->dx)) {
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
pi->compno++) {
int levelno;
int trx0, try0;
int rpx, rpy;
int prci, prcj;
comp = &pi->comps[pi->compno];
if (pi->resno >= comp->numresolutions) {
continue;
}
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!
(pi->x % (comp->dx << rpx) == 0
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
continue;
}
if (!
(pi->y % (comp->dy << rpy) == 0
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
continue;
}
prci =
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
res->pdx) - int_floordivpow2(trx0, res->pdx);
prcj =
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
res->pdy) - int_floordivpow2(try0, res->pdy);
pi->precno = prci + prcj * res->pw;
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
}
return 0;
}
/* <summary> */
/* Get next packet in precinct-component-resolution-layer order. */
/* </summary> */
int pi_next_pcrl(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
comp = &pi->comps[pi->compno];
goto skip;
} else {
int compno, resno;
pi->first = 0;
pi->dx = 0;
pi->dy = 0;
for (compno = 0; compno < pi->numcomps; compno++) {
comp = &pi->comps[compno];
for (resno = 0; resno < comp->numresolutions; resno++) {
int dx, dy;
res = &comp->resolutions[resno];
dx =
comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
dy =
comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
}
}
}
for (pi->y = pi->ty0; pi->y < pi->ty1;
pi->y += pi->dy - (pi->y % pi->dy)) {
for (pi->x = pi->tx0; pi->x < pi->tx1;
pi->x += pi->dx - (pi->x % pi->dx)) {
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
pi->compno++) {
comp = &pi->comps[pi->compno];
for (pi->resno = pi->poc.resno0;
pi->resno < int_min(pi->poc.resno1, comp->numresolutions);
pi->resno++) {
int levelno;
int trx0, try0;
int rpx, rpy;
int prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!
(pi->x % (comp->dx << rpx) == 0
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
continue;
}
if (!
(pi->y % (comp->dy << rpy) == 0
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
continue;
}
prci =
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
res->pdx) - int_floordivpow2(trx0, res->pdx);
prcj =
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
res->pdy) - int_floordivpow2(try0, res->pdy);
pi->precno = prci + prcj * res->pw;
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
if (! pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
}
return 0;
}
/* <summary> */
/* Get next packet in component-precinct-resolution-layer order. */
/* </summary> */
int pi_next_cprl(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
comp = &pi->comps[pi->compno];
goto skip;
} else {
pi->first = 0;
}
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
pi->compno++) {
int resno;
comp = &pi->comps[pi->compno];
pi->dx = 0;
pi->dy = 0;
for (resno = 0; resno < comp->numresolutions; resno++) {
int dx, dy;
res = &comp->resolutions[resno];
dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
}
for (pi->y = pi->ty0; pi->y < pi->ty1;
pi->y += pi->dy - (pi->y % pi->dy)) {
for (pi->x = pi->tx0; pi->x < pi->tx1;
pi->x += pi->dx - (pi->x % pi->dx)) {
for (pi->resno = pi->poc.resno0;
pi->resno < int_min(pi->poc.resno1, comp->numresolutions);
pi->resno++) {
int levelno;
int trx0, try0;
int rpx, rpy;
int prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!
(pi->x % (comp->dx << rpx) == 0
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
continue;
}
if (!
(pi->y % (comp->dy << rpy) == 0
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
continue;
}
prci =
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
res->pdx) - int_floordivpow2(trx0, res->pdx);
prcj =
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
res->pdy) - int_floordivpow2(try0, res->pdy);
pi->precno = prci + prcj * res->pw;
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
if (! pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
}
return 0;
}
/* <summary> */
/* Get next packet. */
/* </summary> */
int pi_next(pi_iterator_t * pi)
{
switch (pi->poc.prg) {
case 0:
return pi_next_lrcp(pi);
case 1:
return pi_next_rlcp(pi);
case 2:
return pi_next_rpcl(pi);
case 3:
return pi_next_pcrl(pi);
case 4:
return pi_next_cprl(pi);
}
return 0;
}

View File

@ -1,389 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "t2.h"
#include "tcd.h"
#include "bio.h"
#include "j2k.h"
#include "pi.h"
#include "tgt.h"
#include "int.h"
#include "cio.h"
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include <stdlib.h>
#define RESTART 0x04
extern jmp_buf j2k_error;
int t2_getcommacode() {
int n;
for (n=0; bio_read(1); n++) {}
return n;
}
int t2_getnumpasses()
{
int n;
if (!bio_read(1)) return 1;
if (!bio_read(1)) return 2;
if ((n=bio_read(2))!=3) return 3+n;
if ((n=bio_read(5))!=31) return 6+n;
return 37+bio_read(7);
}
void t2_init_seg(tcd_seg_t *seg, int cblksty) {
seg->numpasses=0;
seg->len=0;
seg->maxpasses=cblksty&J2K_CCP_CBLKSTY_TERMALL?1:100;
}
int t2_decode_packet(unsigned char *src, int len, tcd_tile_t *tile, j2k_cp_t * cp, j2k_tcp_t *tcp, int compno, int resno, int precno, int layno, info_layer_t *layer_Idx) {
int bandno, cblkno;
tcd_tilecomp_t *tilec = &tile->comps[compno];
tcd_resolution_t *res = &tilec->resolutions[resno];
unsigned char *c = src;
unsigned char *d = c;
int e;
int present;
if (layno == 0) {
for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
tgt_reset(prc->incltree);
tgt_reset(prc->imsbtree);
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
tcd_cblk_t *cblk = &prc->cblks[cblkno];
cblk->numsegs = 0;
}
}
}
/* INDEX */
layer_Idx->len_header = 0;
/* When the marker PPT/PPM is used the packet header are store in PPT/PPM marker
This part deal with this caracteristic
step 1: Read packet header in the saved structure
step 2: (futher) return to codestream for decoding */
if (cp->ppm == 1) /* PPM */
{
c = cp->ppm_data;
d = c;
bio_init_dec(c, 1000);
} else
{
if (tcp->ppt == 1) /* PPT */
{
c = tcp->ppt_data;
d = c;
bio_init_dec(c, 1000);
} else /* Normal Case */
{
if (tcp->csty & J2K_CP_CSTY_SOP)
{
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [1]!!!\n");}
c += 6;
}
bio_init_dec(c, src + len - c);
layer_Idx->len_header = -6;
}
}
present = bio_read(1);
if (!present)
{
bio_inalign();
/* Normal case */
c += bio_numbytes();
if (tcp->csty & J2K_CP_CSTY_EPH)
{
if ((*c) != 255 || (*(c+1) != 146)) {printf("Error : expected EPH marker [1]!!!\n");}
c += 2;
}
/* INDEX */
layer_Idx->len_header += (c-d);
/* PPT and PPM dealing */
if (cp->ppm == 1) /* PPM */
{
cp->ppm_data = c;
return 0;
}
if (tcp->ppt == 1) /* PPT */
{
tcp->ppt_data = c;
return 0;
}
return c - src;
}
for (bandno=0; bandno<res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
int included, increment, n;
tcd_cblk_t *cblk = &prc->cblks[cblkno];
tcd_seg_t *seg;
if (!cblk->numsegs) {
included = tgt_decode(prc->incltree, cblkno, layno+1);
} else {
included = bio_read(1);
}
if (!included) {
cblk->numnewpasses = 0;
continue;
}
if (!cblk->numsegs) {
int i, numimsbs;
for (i = 0; !tgt_decode(prc->imsbtree, cblkno, i); i++) {}
numimsbs = i-1;
cblk->numbps = band->numbps - numimsbs;
cblk->numlenbits = 3;
}
cblk->numnewpasses = t2_getnumpasses();
increment = t2_getcommacode();
cblk->numlenbits += increment;
if (!cblk->numsegs) {
seg = &cblk->segs[0];
t2_init_seg(seg, tcp->tccps[compno].cblksty);
} else {
seg = &cblk->segs[cblk->numsegs - 1];
if (seg->numpasses == seg->maxpasses) {
t2_init_seg(++seg, tcp->tccps[compno].cblksty);
}
}
n = cblk->numnewpasses;
do {
seg->numnewpasses = int_min(seg->maxpasses-seg->numpasses, n);
seg->newlen = bio_read(cblk->numlenbits + int_floorlog2(seg->numnewpasses));
n -= seg->numnewpasses;
if (n > 0) {
t2_init_seg(++seg, tcp->tccps[compno].cblksty);
}
} while (n > 0);
}
}
if(bio_inalign()) return -999;
c += bio_numbytes();
if (tcp->csty & J2K_CP_CSTY_EPH) { /* EPH marker */
if ((*c) != 255 || (*(c+1) != 146)) {printf("Error : expected EPH marker [2]!!!\n"); }
c += 2;
}
/* INDEX */
layer_Idx->len_header += (c-d);
/* PPT Step 2 : see above for details */
if (cp->ppm == 1)
{
cp->ppm_data = c; /* Update pointer */
/* INDEX */
layer_Idx->len_header = c-d;
c = src;
d = c;
if (tcp->csty & J2K_CP_CSTY_SOP)
{
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [2] !!!\n"); }
c += 6;
}
bio_init_dec(c, src + len - c);
} else
{
if (tcp->ppt == 1)
{
tcp->ppt_data = c; /* Update pointer */
/* INDEX */
layer_Idx->len_header = c-d;
c = src;
d = c;
if (tcp->csty & J2K_CP_CSTY_SOP) /* SOP marker */
{
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [2] !!!\n"); }
c += 6;
}
bio_init_dec(c, src + len - c);
}
}
for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw*prc->ch; cblkno++) {
tcd_cblk_t *cblk = &prc->cblks[cblkno];
tcd_seg_t *seg;
if (!cblk->numnewpasses) continue;
if (!cblk->numsegs) {
seg = &cblk->segs[cblk->numsegs++];
cblk->len = 0;
} else {
seg = &cblk->segs[cblk->numsegs-1];
if (seg->numpasses == seg->maxpasses) {
seg++;
cblk->numsegs++;
}
}
do {
if (c + seg->newlen > src + len) return -999;
memcpy(cblk->data + cblk->len, c, seg->newlen);
if (seg->numpasses == 0) {
seg->data = cblk->data + cblk->len;
}
c += seg->newlen;
cblk->len += seg->newlen;
seg->len += seg->newlen;
seg->numpasses += seg->numnewpasses;
cblk->numnewpasses -= seg->numnewpasses;
if (cblk->numnewpasses > 0) {
seg++;
cblk->numsegs++;
}
} while (cblk->numnewpasses > 0);
}
}
/* <INDEX> */
e = c-d;
layer_Idx->len = e;
/* </INDEX> */
return c-src;
}
void t2_init_info_packets(info_image_t *img, j2k_cp_t *cp)
{
int compno, tileno, resno, precno, layno;
for(compno = 0; compno < img->Comp; compno++)
{
for(tileno = 0; tileno < img->tw*img->th; tileno++)
{
info_tile_t *tile_Idx = &img->tile[tileno];
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
for(resno = 0; resno < img->Decomposition + 1 ; resno++)
{
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
for (precno = 0; precno < img->tile[tileno].pw * img->tile[tileno].ph; precno++)
{
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
for(layno = 0; layno < img->Layer ; layno++)
{
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
layer_Idx->offset = 0; /* start position */
layer_Idx->len_header = 0; /* length */
}
}
}
}
}
}
int t2_decode_packets(unsigned char *src, int len, j2k_image_t *img, j2k_cp_t *cp, int tileno, tcd_tile_t *tile, info_image_t *imgg) {
unsigned char *c = src;
pi_iterator_t *pi;
int pino, compno,e;
int partno;
info_tile_part_t *tile_part;
int position;
int length_read;
info_tile_t *tile_Idx;
info_compo_t *compo_Idx;
info_reso_t *reso_Idx;
info_prec_t *prec_Idx;
info_layer_t *layer_Idx;
t2_init_info_packets(imgg, cp); /* Initialize the packets information : LEN and OFFSET to 0 */
tile_Idx = &imgg->tile[tileno];
tile_Idx->num_packet = 0;
pi = pi_create(img, cp, tileno);
partno = 0;
tile_part = &tile_Idx->tile_parts[partno];
position = tile_part->end_header + 1;
length_read = 0;
for (pino = 0; pino <= cp->tcps[tileno].numpocs; pino++)
{
while (pi_next(&pi[pino]))
{
compo_Idx = &tile_Idx->compo[pi[pino].compno];
reso_Idx = &compo_Idx->reso[pi[pino].resno];
prec_Idx = &reso_Idx->prec[pi[pino].precno];
layer_Idx = &prec_Idx->layer[pi[pino].layno];
layer_Idx->offset = position;
layer_Idx->offset_header = position;
e = t2_decode_packet(c, src+len-c, tile, cp, &cp->tcps[tileno], pi[pino].compno, pi[pino].resno, pi[pino].precno, pi[pino].layno,layer_Idx);
if (e == -999)
{
break;
} else
c += e;
position += e;
/* Update position in case of multiple tile-parts for a tile >> */
length_read += e;
if (length_read >= (tile_part->end_pos - tile_part->end_header))
{
partno++;
tile_part = &tile_Idx->tile_parts[partno];
position = tile_part->end_header + 1;
length_read = 0;
}
/* << end_update */
tile_Idx->num_packet++;
}
// FREE space memory taken by pi
for (compno = 0; compno < pi[pino].numcomps; compno++)
{
free(pi[pino].comps[compno].resolutions);
}
free(pi[pino].comps);
}
free(pi[0].include);
free(pi);
if (e==-999)
return e;
else
{
imgg->num_packet_max=int_max(imgg->num_packet_max,tile_Idx->num_packet);
return c-src;
}
}

View File

@ -1,285 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "tcd.h"
#include "int.h"
#include "t2.h"
#include <setjmp.h>
#include <float.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
static tcd_image_t tcd_image;
static j2k_image_t *tcd_img;
static j2k_cp_t *tcd_cp;
extern jmp_buf j2k_error;
void tcd_init(j2k_image_t *img, j2k_cp_t *cp, info_image_t *imgg) {
int tileno, compno, resno, bandno, precno, cblkno;
tcd_img=img;
tcd_cp=cp;
tcd_image.tw=cp->tw;
tcd_image.th=cp->th;
tcd_image.tiles=(tcd_tile_t*)malloc(cp->tw*cp->th*sizeof(tcd_tile_t));
for (tileno=0; tileno<cp->tw*cp->th; tileno++) {
j2k_tcp_t *tcp=&cp->tcps[tileno];
tcd_tile_t *tile=&tcd_image.tiles[tileno];
// cfr p59 ISO/IEC FDIS15444-1 : 2000 (18 august 2000)
int p=tileno%cp->tw; // si numerotation matricielle ..
int q=tileno/cp->tw; // .. coordonnees de la tile (q,p) q pour ligne et p pour colonne
info_tile_t *tile_Idx=&imgg->tile[tileno]; // INDEX
// 4 borders of the tile rescale on the image if necessary
tile->x0=int_max(cp->tx0+p*cp->tdx, img->x0);
tile->y0=int_max(cp->ty0+q*cp->tdy, img->y0);
tile->x1=int_min(cp->tx0+(p+1)*cp->tdx, img->x1);
tile->y1=int_min(cp->ty0+(q+1)*cp->tdy, img->y1);
tile->numcomps=img->numcomps;
tile->comps=(tcd_tilecomp_t*)malloc(img->numcomps*sizeof(tcd_tilecomp_t));
tile_Idx->compo=(info_compo_t*)malloc(img->numcomps*sizeof(info_compo_t)); // INDEX
for (compno=0; compno<tile->numcomps; compno++) {
j2k_tccp_t *tccp=&tcp->tccps[compno];
tcd_tilecomp_t *tilec=&tile->comps[compno];
info_compo_t *compo_Idx=&tile_Idx->compo[compno]; // INDEX
// border of each tile component (global)
tilec->x0=int_ceildiv(tile->x0, img->comps[compno].dx);
tilec->y0=int_ceildiv(tile->y0, img->comps[compno].dy);
tilec->x1=int_ceildiv(tile->x1, img->comps[compno].dx);
tilec->y1=int_ceildiv(tile->y1, img->comps[compno].dy);
tilec->data=(int*)malloc(sizeof(int)*(tilec->x1-tilec->x0)*(tilec->y1-tilec->y0));
tilec->numresolutions=tccp->numresolutions;
tilec->resolutions=(tcd_resolution_t*)malloc(tilec->numresolutions*sizeof(tcd_resolution_t));
compo_Idx->reso=(info_reso_t*)malloc(tilec->numresolutions*sizeof(info_reso_t)); // INDEX
for (resno=0; resno<tilec->numresolutions; resno++) {
int pdx, pdy;
int levelno=tilec->numresolutions-1-resno;
int tlprcxstart, tlprcystart, brprcxend, brprcyend;
int tlcbgxstart, tlcbgystart, brcbgxend, brcbgyend;
int cbgwidthexpn, cbgheightexpn;
int cblkwidthexpn, cblkheightexpn;
tcd_resolution_t *res=&tilec->resolutions[resno];
info_reso_t *res_Idx=&compo_Idx->reso[resno]; // INDEX
int precno_Idx; // INDEX
// border for each resolution level (global)
res->x0=int_ceildivpow2(tilec->x0, levelno);
res->y0=int_ceildivpow2(tilec->y0, levelno);
res->x1=int_ceildivpow2(tilec->x1, levelno);
res->y1=int_ceildivpow2(tilec->y1, levelno);
res->numbands=resno==0?1:3;
// p. 35, table A-23, ISO/IEC FDIS154444-1 : 2000 (18 august 2000)
if (tccp->csty&J2K_CCP_CSTY_PRT) {
pdx=tccp->prcw[resno];
pdy=tccp->prch[resno];
} else {
pdx=15;
pdy=15;
}
// p. 64, B.6, ISO/IEC FDIS15444-1 : 2000 (18 august 2000)
tlprcxstart=int_floordivpow2(res->x0, pdx)<<pdx;
tlprcystart=int_floordivpow2(res->y0, pdy)<<pdy;
brprcxend=int_ceildivpow2(res->x1, pdx)<<pdx;
brprcyend=int_ceildivpow2(res->y1, pdy)<<pdy;
res->pw=(brprcxend-tlprcxstart)>>pdx;
res->ph=(brprcyend-tlprcystart)>>pdy;
// <INDEX>
imgg->tile[tileno].pw=res->pw;
imgg->tile[tileno].ph=res->ph;
res_Idx->prec=(info_prec_t*)malloc(res->pw*res->ph*sizeof(info_prec_t));
for (precno_Idx=0;precno_Idx<res->pw*res->ph;precno_Idx++)
{
info_prec_t *prec_Idx = &res_Idx->prec[precno_Idx];
prec_Idx->layer=(info_layer_t*)malloc(imgg->Layer*sizeof(info_layer_t));
}
imgg->pw=res->pw; // old parser version
imgg->ph=res->ph; // old parser version
imgg->pdx=1<<pdx;
imgg->pdy=1<<pdy;
// </INDEX>
if (resno==0) {
tlcbgxstart=tlprcxstart;
tlcbgystart=tlprcystart;
brcbgxend=brprcxend;
brcbgyend=brprcyend;
cbgwidthexpn=pdx;
cbgheightexpn=pdy;
} else {
tlcbgxstart=int_ceildivpow2(tlprcxstart, 1);
tlcbgystart=int_ceildivpow2(tlprcystart, 1);
brcbgxend=int_ceildivpow2(brprcxend, 1);
brcbgyend=int_ceildivpow2(brprcyend, 1);
cbgwidthexpn=pdx-1;
cbgheightexpn=pdy-1;
}
cblkwidthexpn=int_min(tccp->cblkw, cbgwidthexpn);
cblkheightexpn=int_min(tccp->cblkh, cbgheightexpn);
for (bandno=0; bandno<res->numbands; bandno++) {
int x0b, y0b;
tcd_band_t *band=&res->bands[bandno];
band->bandno=resno==0?0:bandno+1;
x0b=(band->bandno==1)||(band->bandno==3)?1:0;
y0b=(band->bandno==2)||(band->bandno==3)?1:0;
if (band->bandno==0) {
// band border (global)
band->x0=int_ceildivpow2(tilec->x0, levelno);
band->y0=int_ceildivpow2(tilec->y0, levelno);
band->x1=int_ceildivpow2(tilec->x1, levelno);
band->y1=int_ceildivpow2(tilec->y1, levelno);
} else {
// band border (global)
band->x0=int_ceildivpow2(tilec->x0-(1<<levelno)*x0b, levelno+1);
band->y0=int_ceildivpow2(tilec->y0-(1<<levelno)*y0b, levelno+1);
band->x1=int_ceildivpow2(tilec->x1-(1<<levelno)*x0b, levelno+1);
band->y1=int_ceildivpow2(tilec->y1-(1<<levelno)*y0b, levelno+1);
}
band->precincts=(tcd_precinct_t*)malloc(res->pw*res->ph*sizeof(tcd_precinct_t));
for (precno=0; precno<res->pw*res->ph; precno++) {
int tlcblkxstart, tlcblkystart, brcblkxend, brcblkyend;
int cbgxstart=tlcbgxstart+(precno%res->pw)*(1<<cbgwidthexpn);
int cbgystart=tlcbgystart+(precno/res->pw)*(1<<cbgheightexpn);
int cbgxend=cbgxstart+(1<<cbgwidthexpn);
int cbgyend=cbgystart+(1<<cbgheightexpn);
tcd_precinct_t *prc=&band->precincts[precno];
// precinct size (global)
prc->x0=int_max(cbgxstart, band->x0);
prc->y0=int_max(cbgystart, band->y0);
prc->x1=int_min(cbgxend, band->x1);
prc->y1=int_min(cbgyend, band->y1);
tlcblkxstart=int_floordivpow2(prc->x0, cblkwidthexpn)<<cblkwidthexpn;
tlcblkystart=int_floordivpow2(prc->y0, cblkheightexpn)<<cblkheightexpn;
brcblkxend=int_ceildivpow2(prc->x1, cblkwidthexpn)<<cblkwidthexpn;
brcblkyend=int_ceildivpow2(prc->y1, cblkheightexpn)<<cblkheightexpn;
prc->cw=(brcblkxend-tlcblkxstart)>>cblkwidthexpn;
prc->ch=(brcblkyend-tlcblkystart)>>cblkheightexpn;
prc->cblks=(tcd_cblk_t*)malloc(prc->cw*prc->ch*sizeof(tcd_cblk_t));
prc->incltree=tgt_create(prc->cw, prc->ch);
prc->imsbtree=tgt_create(prc->cw, prc->ch);
for (cblkno=0; cblkno<prc->cw*prc->ch; cblkno++) {
int cblkxstart=tlcblkxstart+(cblkno%prc->cw)*(1<<cblkwidthexpn);
int cblkystart=tlcblkystart+(cblkno/prc->cw)*(1<<cblkheightexpn);
int cblkxend=cblkxstart+(1<<cblkwidthexpn);
int cblkyend=cblkystart+(1<<cblkheightexpn);
tcd_cblk_t *cblk=&prc->cblks[cblkno];
// code-block size (global)
cblk->x0=int_max(cblkxstart, prc->x0);
cblk->y0=int_max(cblkystart, prc->y0);
cblk->x1=int_min(cblkxend, prc->x1);
cblk->y1=int_min(cblkyend, prc->y1);
}
}
}
}
}
}
}
void tcd_free(j2k_image_t *img, j2k_cp_t *cp) {
int tileno, compno, resno, bandno, precno;
tcd_img=img;
tcd_cp=cp;
tcd_image.tw=cp->tw;
tcd_image.th=cp->th;
for (tileno=0; tileno<tcd_image.tw*tcd_image.th; tileno++)
{
// j2k_tcp_t *tcp=&cp->tcps[curtileno];
tcd_tile_t *tile=&tcd_image.tiles[tileno];
for (compno=0; compno<tile->numcomps; compno++)
{
tcd_tilecomp_t *tilec=&tile->comps[compno];
for (resno=0; resno<tilec->numresolutions; resno++)
{
tcd_resolution_t *res=&tilec->resolutions[resno];
for (bandno=0; bandno<res->numbands; bandno++)
{
tcd_band_t *band=&res->bands[bandno];
for (precno=0; precno<res->pw*res->ph; precno++)
{
tcd_precinct_t *prc=&band->precincts[precno];
if (prc->incltree!=NULL)
tgt_destroy(prc->incltree);
if (prc->imsbtree!=NULL)
tgt_destroy(prc->imsbtree);
free(prc->cblks);
} // for (precno
free(band->precincts);
} // for (bandno
} // for (resno
free(tilec->resolutions);
} // for (compno
free(tile->comps);
} // for (tileno
free(tcd_image.tiles);
}
int tcd_decode_tile(unsigned char *src, int len, int tileno, info_image_t *imgg) {
int l;
int eof=0;
tcd_tile_t *tile;
tile = &tcd_image.tiles[tileno];
l = t2_decode_packets(src, len, tcd_img, tcd_cp, tileno, tile, imgg);
if (l==-999)
{
eof=1;
fprintf(stderr, "tcd_decode: incomplete bistream\n");
}
if (eof) {
longjmp(j2k_error, 1);
}
l=1;
return l;
}

View File

@ -1,137 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __TCD_H
#define __TCD_H
#include "j2k.h"
#include "tgt.h"
typedef struct {
int numpasses;
int len;
unsigned char *data;
int maxpasses;
int numnewpasses;
int newlen;
} tcd_seg_t;
typedef struct {
int rate;
double distortiondec;
} tcd_pass_t;
typedef struct {
int numpasses;
int len;
unsigned char *data;
} tcd_layer_t;
typedef struct {
int x0, y0, x1, y1;
int numbps;
int numlenbits;
int len;
int numpasses;
int numnewpasses;
int numsegs;
tcd_seg_t segs[100];
unsigned char data[8192];
int numpassesinlayers;
tcd_layer_t layers[100];
int totalpasses;
tcd_pass_t passes[100];
} tcd_cblk_t;
typedef struct {
int x0, y0, x1, y1;
int cw, ch;
tcd_cblk_t *cblks;
tgt_tree_t *incltree;
tgt_tree_t *imsbtree;
} tcd_precinct_t;
typedef struct {
int x0, y0, x1, y1;
int bandno;
tcd_precinct_t *precincts;
int numbps;
int stepsize;
} tcd_band_t;
typedef struct {
int x0, y0, x1, y1;
int previous_x0, previous_y0, previous_x1, previous_y1; // usefull for the DWT
int cas_col, cas_row; // usefull for the DWT
int pw, ph;
int numbands;
tcd_band_t bands[3];
} tcd_resolution_t;
typedef struct {
int x0, y0, x1, y1;
int previous_row, previous_col; // usefull for the DWT
int numresolutions;
tcd_resolution_t *resolutions;
int *data;
} tcd_tilecomp_t;
typedef struct {
int x0, y0, x1, y1;
int numcomps;
//int PPT;
//int len_ppt;
tcd_tilecomp_t *comps;
} tcd_tile_t;
typedef struct {
int tw, th;
tcd_tile_t *tiles;
} tcd_image_t;
/*
* Initialize the tile coder/decoder
* img: raw image
* cp: coding parameters
* imgg: creation of index file
*/
void tcd_init(j2k_image_t *img, j2k_cp_t *cp, info_image_t *imgg);
void tcd_free(j2k_image_t *img, j2k_cp_t *cp);
/*
* Decode a tile from a buffer into a raw image
* src: source buffer
* len: length of the source buffer
* tileno: number that identifies the tile that will be decoded
* imgg : Structure for index file
*/
int tcd_decode_tile(unsigned char *src, int len, int tileno, info_image_t *imgg);
#endif

View File

@ -1,170 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "tgt.h"
#include "bio.h"
#include <stdlib.h>
#include <stdio.h>
/// <summary>
/// Reset tag-tree.
/// </summary>
void tgt_reset(tgt_tree_t *tree)
{
int i;
for (i=0; i<tree->numnodes; i++) {
tree->nodes[i].value=999;
tree->nodes[i].low=0;
tree->nodes[i].known=0;
}
}
/// <summary>
/// Create tag-tree.
/// </summary>
tgt_tree_t *tgt_create(int numleafsh, int numleafsv)
{
int nplh[32];
int nplv[32];
tgt_node_t *node;
tgt_node_t *parentnode;
tgt_node_t *parentnode0;
tgt_tree_t *tree;
int i, j, k;
int numlvls;
int n;
tree=(tgt_tree_t*)malloc(sizeof(tgt_tree_t));
tree->numleafsh=numleafsh;
tree->numleafsv=numleafsv;
numlvls=0;
nplh[0]=numleafsh;
nplv[0]=numleafsv;
tree->numnodes=0;
do {
n=nplh[numlvls]*nplv[numlvls];
nplh[numlvls+1]=(nplh[numlvls]+1)/2;
nplv[numlvls+1]=(nplv[numlvls]+1)/2;
tree->numnodes+=n;
++numlvls;
} while (n>1);
tree->nodes=(tgt_node_t*)malloc(tree->numnodes*sizeof(tgt_node_t));
node=tree->nodes;
parentnode=&tree->nodes[tree->numleafsh*tree->numleafsv];
parentnode0=parentnode;
for (i=0; i<numlvls-1; ++i) {
for (j=0; j<nplv[i]; ++j) {
k=nplh[i];
while (--k>=0) {
node->parent=parentnode;
++node;
if (--k >= 0) {
node->parent=parentnode;
++node;
}
++parentnode;
}
if ((j&1)||j==nplv[i]-1) {
parentnode0=parentnode;
} else {
parentnode=parentnode0;
parentnode0+=nplh[i];
}
}
}
node->parent=0;
tgt_reset(tree);
return tree;
}
/// <summary>
/// Destroy tag-tree.
/// </summary>
void tgt_destroy(tgt_tree_t *t) {
free(t->nodes);
free(t);
}
/// <summary>
/// Set the value of a leaf of the tag-tree.
/// </summary>
void tgt_setvalue(tgt_tree_t *tree, int leafno, int value) {
tgt_node_t *node;
node=&tree->nodes[leafno];
while (node && node->value>value) {
node->value=value;
node=node->parent;
}
}
/// <summary>
/// Decode the value of a leaf of the tag-tree.
/// </summary>
int tgt_decode(tgt_tree_t *tree, int leafno, int threshold)
{
tgt_node_t *stk[31];
tgt_node_t **stkptr;
tgt_node_t *node;
int low;
stkptr=stk;
node=&tree->nodes[leafno];
while (node->parent) {
*stkptr++=node;
node=node->parent;
}
low=0;
for (;;) {
if (low>node->low) {
node->low=low;
} else {
low=node->low;
}
while (low<threshold && low<node->value) {
if (bio_read(1)) {
node->value=low;
} else {
++low;
}
}
node->low=low;
if (stkptr==stk) {
break;
}
node=*--stkptr;
}
return (node->value<threshold)?1:0;
}

View File

@ -1,80 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __TGT_H
#define __TGT_H
typedef struct tgt_node {
struct tgt_node *parent;
int value;
int low;
int known;
} tgt_node_t;
typedef struct {
int numleafsh;
int numleafsv;
int numnodes;
tgt_node_t *nodes;
} tgt_tree_t;
/*
* Create a tag-tree
* numleafsh: width of the array of leafs of the tree
* numleafsv: height of the array of leafs of the tree
*/
tgt_tree_t *tgt_create(int numleafsh, int numleafsv);
/*
* Reset a tag-tree (set all leafs to 0)
* tree: tag-tree to reset
*/
void tgt_reset(tgt_tree_t *tree);
/*
* Destroy a tag-tree, liberating memory
* tree: tag-tree to destroy
*/
void tgt_destroy(tgt_tree_t *tree);
/*
* Set the value of a leaf of a tag-tree
* tree: tag-tree to modify
* leafno: number that identifies the leaf to modify
* value: new value of the leaf
*/
void tgt_setvalue(tgt_tree_t *tree, int leafno, int value);
/*
* Decode the value of a leaf of the tag-tree up to a given threshold
* leafno: number that identifies the leaf to decode
* threshold: threshold to use when decoding value of the leaf
*/
int tgt_decode(tgt_tree_t *tree, int leafno, int threshold);
#endif

View File

@ -1,35 +0,0 @@
<project name="seb_j2kviewer" default="dist" basedir=".">
<description>Seb's J2K viewer</description>
<property name="src" location="src" />
<property name="build" location="build"/>
<property name="dist" location="dist" />
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile">
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/seb_j2kviewer-${DSTAMP}.jar"
basedir="${build}" manifest="${dist}/manifest.txt"/>
<exec dir="${dist}" executable="ln">
<arg line="-sf seb_j2kviewer-${DSTAMP}.jar seb_j2kviewer.jar"/>
</exec>
</target>
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="test" depends="dist">
<exec executable="appletviewer"><arg line="dist.html"/></exec>
</target>
<target name="build_test" depends="compile">
<exec executable="appletviewer"><arg line="compile.html"/></exec>
</target>
<target name="build_testj" depends="compile">
<exec executable="java"><arg line="-classpath build ImageViewer girl"/></exec>
</target>
</project>

View File

@ -1,212 +0,0 @@
import java.io.*;
// This appears in Core Web Programming from
// Prentice Hall Publishers, and may be freely used
// or adapted. 1997 Marty Hall, hall@apl.jhu.edu.
/** A class that eases the pain of running external
* processes from applications.
* Lets you run a program three ways:
* <OL>
* <LI><B>exec</B>: Execute the command, returning
* immediately even if the command is still
* running. This would be appropriate
* for printing a file.
* <LI><B>execWait</B>: Execute the command, but
* don't return until the command finishes.
* This would be appropriate for
* sequential commands where the first depends
* on the second having finished (e.g.
* <CODE>javac</CODE> followed by
* <CODE>java</CODE>).
* <LI><B>execPrint</B>: Execute the command and
* print the output. This would be appropriate
* for the UNIX command <CODE>ls</CODE>.
* </OL>
* Note that the PATH is not taken into account,
* so you must specify the <B>full</B> pathname to
* the command, and shell builtin commands
* will not work. For instance, on Unix the above
* three examples might look like:
* <OL>
* <LI><PRE>Exec.exec("/usr/ucb/lpr Some-File");</PRE>
* <LI><PRE>
* Exec.execWait("/usr/local/bin/javac Foo.java");
* Exec.execWait("/usr/local/bin/java Foo");
* </PRE>
* <LI><PRE>Exec.execPrint("/usr/bin/ls -al");</PRE>
* </OL>
*
* @author Marty Hall
* (<A HREF="mailto:hall@apl.jhu.edu">
* hall@apl.jhu.edu</A>)
* @version 1.0 1997
*/
public class Exec {
//----------------------------------------------------
private static boolean verbose = true;
/** Determines if the Exec class should print which
* commands are being executed, and print error
* messages if a problem is found. Default is true.
*
* @param verboseFlag true: print messages.
* false: don't.
*/
public static void setVerbose(boolean verboseFlag) {
verbose = verboseFlag;
}
/** Will Exec print status messages? */
public static boolean getVerbose() {
return(verbose);
}
//----------------------------------------------------
/** Starts a process to execute the command. Returns
* immediately, even if the new process is still
* running.
*
* @param command The <B>full</B> pathname of the
* command to be executed. No shell builtins
* (e.g. "cd") or shell meta-chars (e.g. ">")
* allowed.
* @return false if a problem is known to occur, but
* since this returns immediately, problems
* aren't usually found in time.
* Returns true otherwise.
*/
public static boolean exec(String command) {
return(exec(command, false, false));
}
//----------------------------------------------------
/** Starts a process to execute the command. Waits
* for the process to finish before returning.
*
* @param command The <B>full</B> pathname of the
* command to be executed. No shell builtins
* or shell meta-chars allowed.
* @return false if a problem is known to occur,
* either due to an exception or from the
* subprocess returning a non-zero value.
* Returns true otherwise.
*/
public static boolean execWait(String command) {
return(exec(command, false, true));
}
//----------------------------------------------------
/** Starts a process to execute the command. Prints
* all output the command gives.
*
* @param command The <B>full</B> pathname of the
* command to be executed. No shell builtins
* or shell meta-chars allowed.
* @return false if a problem is known to occur,
* either due to an exception or from the
* subprocess returning a non-zero value.
* Returns true otherwise.
*/
public static boolean execPrint(String command) {
return(exec(command, true, false));
}
//----------------------------------------------------
// This creates a Process object via
// Runtime.getRuntime.exec(). Depending on the
// flags, it may call waitFor on the process
// to avoid continuing until the process terminates,
// or open an input stream from the process to read
// the results.
private static boolean exec(String command,
boolean printResults,
boolean wait) {
if (verbose) {
printSeparator();
System.out.println("Executing '" + command + "'.");
}
try {
// Start running command, returning immediately.
Process p = Runtime.getRuntime().exec(command);
// Print the output. Since we read until
// there is no more input, this causes us
// to wait until the process is completed
if(printResults) {
BufferedInputStream buffer =
new BufferedInputStream(p.getInputStream());
DataInputStream commandResult =
new DataInputStream(buffer);
String s = null;
try {
while ((s = commandResult.readLine()) != null)
System.out.println("Output: " + s);
commandResult.close();
if (p.exitValue() != 0) {
if (verbose)
printError(command +
" -- p.exitValue() != 0");
return(false);
}
// Ignore read errors; they mean process is done
} catch (Exception e) {}
// If you don't print the results, then you
// need to call waitFor to stop until the process
// is completed
} else if (wait) {
try {
System.out.println(" ");
int returnVal = p.waitFor();
if (returnVal != 0) {
if (verbose)
printError(command);
return(false);
}
} catch (Exception e) {
if (verbose)
printError(command, e);
return(false);
}
}
} catch (Exception e) {
if (verbose)
printError(command, e);
return(false);
}
return(true);
}
//----------------------------------------------------
private static void printError(String command,
Exception e) {
System.out.println("Error doing exec(" +
command + "): " + e.getMessage());
System.out.println("Did you specify the full " +
"pathname?");
}
private static void printError(String command) {
System.out.println("Error executing '" +
command + "'.");
}
//----------------------------------------------------
private static void printSeparator() {
System.out.println
("==============================================");
}
//----------------------------------------------------
}

View File

@ -1,222 +0,0 @@
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.image.*;
import java.awt.geom.*;
import java.net.URL;
import javax.swing.border.*;
import java.util.*;
import java.io.*;
public class ImageViewer extends JApplet
{
private class zoomLevel {
int x1, y1, x2, y2, zf;
zoomLevel() {}
zoomLevel(zoomLevel zl)
{
x1 = zl.x1;
y1 = zl.y1;
x2 = zl.x2;
y2 = zl.y2;
zf = zl.zf;
}
}
private BufferedImage bi;
private Graphics2D big;
private MML myMML;
private int iw, ih;
private int selected = 0, imgId;
private Image img;
private PgmImage pgm = new PgmImage();
private String cmdline = new String();
private static String hostname;
private static boolean isApplet = true;
private boolean fullRefresh = false;
private Point offset = new Point(0,0);
private zoomLevel zl = new zoomLevel();
private Rectangle rect = new Rectangle();
private Stack zoomStack = new Stack();
private static String j2kfilename;
public int getX() { return offset.x; }
public int getY() { return offset.y; }
public int getWidth() { return iw; }
public int getHeight() { return ih; }
public void destroy()
{
}
public void zoomIn()
{
Dimension asz = this.getSize();
int maxzf = 3;
int coef = 1;
int r;
cmdline =
"/bin/sh get.sh " + j2kfilename + " " + iw
+ " " + ih + " " + rect.x + " " + rect.y + " "
+ rect.width + " " + rect.height;
Exec.execPrint(cmdline);
rect.x = rect.y = rect.width = rect.height = 0;
img = pgm.open("out.pgm");
iw = img.getWidth(this);
ih = img.getHeight(this);
bi = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
big = bi.createGraphics();
selected = 0;
fullRefresh = true;
repaint();
}
public void zoomOut()
{
}
public void init()
{
String str;
int port;
imgId = 4;
if (isApplet && (((hostname = this.getParameter("hostname")) == null)
|| hostname.equals("")))
hostname = "localhost";
if (!isApplet || ((str = this.getParameter("cmdPort")) == null)) {
port = 3000;
} else {
port = new Integer(str).intValue();
}
this.setSize(512, 512);
Dimension asz = this.getSize();
zl.x2 = asz.width;
zl.y2 = asz.height;
cmdline =
"/bin/sh get.sh " + j2kfilename + " " + asz.width
+ " " + asz.height + " " + zl.x1 + " " + zl.y1 + " "
+ zl.x2 + " " + zl.y2;
Exec.execPrint(cmdline);
img = pgm.open("out.pgm");
iw = img.getWidth(this);
ih = img.getHeight(this);
setBackground(Color.black);
bi = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
big = bi.createGraphics();
myMML = new MML(this);
addMouseListener(myMML);
addMouseMotionListener(myMML);
}
public void setSelected(int state)
{
if (state != selected) {
selected = state;
repaint();
}
}
public boolean isInsideRect(int x, int y)
{
return rect.contains(x - offset.x, y - offset.y);
}
public void setRGeom(int x1, int y1, int x2, int y2)
{
rect.x = Math.min(x1,x2) - offset.x;
rect.y = Math.min(y1,y2) - offset.y;
rect.width = Math.abs(x2-x1);
rect.height = Math.abs(y2-y1);
}
public void paint(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
Dimension asz = this.getSize();
if (fullRefresh) {
g2.clearRect(0, 0, asz.width, asz.height);
fullRefresh = false;
}
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
big.setColor(Color.black);
offset.x = (int) (asz.width - iw) / 2;
offset.y = (int) (asz.height - ih) / 2;
big.drawImage(img, 0, 0, this);
big.setPaint(Color.red);
if ((rect.width > 0) && (rect.height > 0))
big.draw(rect);
if (selected == 1)
shadeExt(big, 0, 0, 0, 64);
else if (selected == 2) {
shadeExt(big, 0, 0, 0, 255);
selected = 1;
}
g2.drawImage(bi, offset.x, offset.y, this);
}
private void shadeRect(Graphics2D g2, int r, int g, int b, int a)
{
g2.setPaint(new Color(r, g, b, a));
g2.fillRect(rect.x + 1, rect.y + 1, rect.width - 1, rect.height - 1);
}
private void shadeExt(Graphics2D g2, int r, int g, int b, int a)
{
g2.setPaint(new Color(r, g, b, a));
g2.fillRect(0, 0, iw, rect.y); /* _N_ */
g2.fillRect(rect.x + rect.width + 1, rect.y,
iw - rect.x - rect.width - 1, rect.height + 1); /* E */
g2.fillRect(0, rect.y, rect.x, rect.height + 1); /* W */
g2.fillRect(0, rect.y + rect.height + 1,
iw, ih - rect.y - rect.height - 1); /* _S_ */
}
protected URL getURL(String filename)
{
URL codeBase = this.getCodeBase();
URL url = null;
try {
url = new URL(codeBase, filename);
} catch (java.net.MalformedURLException e) {
System.out.println("Couldn't create image: badly specified URL");
return null;
}
return url;
}
public static void main(String s[])
{
if (s.length > 0)
j2kfilename = s[0];
else
j2kfilename = "girl";
System.out.println(j2kfilename);
isApplet = false;
JFrame f = new JFrame("ImageViewer");
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
});
JApplet applet = new ImageViewer();
f.getContentPane().add("Center", applet);
applet.init();
f.pack();
f.setSize(new Dimension(550,550));
f.show();
}
}

View File

@ -1,85 +0,0 @@
import java.awt.event.*;
class MML implements MouseMotionListener, MouseListener
{
public void mouseExited(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseClicked(MouseEvent e) {}
private ImageViewer applet;
private int x1, y1, x2, y2, zf, btn;
private boolean zoomrq;
public MML(ImageViewer iv)
{
x1 = y1 = -1;
applet = iv;
zoomrq = false;
zf = 0;
}
private boolean isInside(int x, int y)
{
x -= applet.getX();
y -= applet.getY();
return (x >= 0) && (x < applet.getWidth())
&& (y >= 0) && (y < applet.getHeight());
}
public void mousePressed(MouseEvent e)
{
btn = e.getButton();
if (applet.isInsideRect(e.getX(), e.getY())) {
applet.setSelected(2);
applet.repaint();
zoomrq = true;
} else {
applet.setRGeom(0, 0, 0, 0);
applet.setSelected(0);
applet.repaint();
x1 = y1 = -1;
}
}
public void mouseReleased(MouseEvent e)
{
if (zoomrq && (e.getButton() == 1)) {
applet.zoomIn();
zoomrq = false;
} else if (e.getButton() == 3) {
applet.zoomOut();
zoomrq = false;
}
}
public void mouseMoved(MouseEvent e)
{
applet.setSelected(applet.isInsideRect(e.getX(), e.getY()) ? 1 : 0);
}
public void mouseDragged(MouseEvent e)
{
String str;
if (btn == 1) {
x2 = e.getX();
y2 = e.getY();
applet.setSelected(0);
zoomrq = false;
if (isInside(x2, y2)) {
str = "[IN ]";
if (x1 == -1) {
x1 = x2;
y1 = y2;
} else {
applet.setRGeom(x1, y1, x2, y2);
applet.repaint();
}
} else {
str = "[OUT]";
}
}
}
}

View File

@ -1,93 +0,0 @@
import java.awt.*;
import java.awt.image.*;
import java.net.*;
import java.io.*;
import java.util.regex.*;
class PgmImage extends Component
{
private Socket s;
private BufferedReader in;
private int x, y;
PgmImage()
{
}
private String read()
{
try { return in.readLine(); }
catch (IOException e) {
e.printStackTrace();
return null;
}
}
public Image open(String filename)
{
String str;
Pattern pat;
Matcher mat;
int bytes, width, height, depth;
FileInputStream fis;
try {
in = new BufferedReader(
new InputStreamReader(
fis = new FileInputStream(
new File(filename))));
pat = Pattern.compile("^P5$");
mat = pat.matcher(str = read());
mat.matches();
pat = Pattern.compile("^(\\d+) (\\d+)$");
mat = pat.matcher(str = read());
mat.matches();
x = new Integer(mat.group(1)).intValue();
y = new Integer(mat.group(2)).intValue();
width = x;
height = y;
depth = 1;
pat = Pattern.compile("^255$");
mat = pat.matcher(str = read());
mat.matches();
bytes = x*y;
char[] buf = new char[bytes];
int r, offset = 0;
while (bytes > 0) {
try { r = in.read(buf, offset, bytes); offset += r; bytes -= r; }
catch (IOException e) { e.printStackTrace(); }
}
int[] buf2 = new int[buf.length];
if (depth == 3) {
for (int i = 0; i < buf.length/3; ++i)
buf2[i] = 0xFF << 24 | buf[3*i] << 16 | buf[3*i+1] << 8 | buf[3*i+2];
} else {
for (int i = 0; i < buf.length; ++i)
buf2[i] = 0xFF << 24 | buf[i] << 16 | buf[i] << 8 | buf[i];
}
fis.close();
return createImage(new MemoryImageSource(width, height, buf2, 0, width));
} catch (IOException e) { e.printStackTrace(); }
return null;
}
public void close()
{
}
public boolean bye()
{
return true;
}
public int getXOffset()
{
return x;
}
public int getYOffset()
{
return y;
}
}

View File

@ -1,6 +0,0 @@
obj
obj.w32
bin
bin.w32
lib
lib.w32

View File

@ -1,77 +0,0 @@
# $Id$
#
# makefile for OpenJPEG library
CFLAGS = -Wall -O3 -fno-strength-reduce -fomit-frame-pointer
ifndef DEBUG
LDFLAGS = -s -lm
else
LDFLAGS = -lm
endif
OBJ_DIR_W32 = obj.w32
LIB_DIR_W32 = lib.w32
ifdef MINGW32
CC = i386-mingw32-gcc
AR = i386-mingw32-ar
OBJ_DIR = $(OBJ_DIR_W32)
LIB_DIR = $(LIB_DIR_W32)
all: $(OBJ_DIR) $(LIB_DIR) \
$(LIB_DIR)/libopenjpeg.a $(LIB_DIR)/libopenjpeg.dll
else
CC = gcc
AR = ar
OBJ_DIR = obj
LIB_DIR = lib
all: $(OBJ_DIR) $(LIB_DIR) \
$(LIB_DIR)/libopenjpeg.a $(LIB_DIR)/libopenjpeg.so
endif
$(OBJ_DIR):
mkdir $(OBJ_DIR)
$(LIB_DIR):
mkdir $(LIB_DIR)
$(OBJ_DIR)/%.o:
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(OBJ_DIR)/bio.o: bio.c bio.h
$(OBJ_DIR)/cio.o: cio.c cio.h
$(OBJ_DIR)/dwt.o: dwt.c dwt.h int.h fix.h tcd.h
$(OBJ_DIR)/fix.o: fix.c fix.h
$(OBJ_DIR)/int.o: int.c
$(OBJ_DIR)/j2k.o: j2k.c j2k.h cio.h tcd.h dwt.h int.h
$(OBJ_DIR)/mct.o: mct.c mct.h fix.h
$(OBJ_DIR)/mqc.o: mqc.c mqc.h
$(OBJ_DIR)/pi.o: pi.c pi.h int.h
$(OBJ_DIR)/raw.o: raw.c raw.h
$(OBJ_DIR)/t1.o: t1.c t1.h j2k.h mqc.h raw.h int.h mct.h dwt.h fix.h
$(OBJ_DIR)/t2.o: t2.c t2.h tcd.h bio.h j2k.h pi.h tgt.h int.h cio.h
$(OBJ_DIR)/tcd.o: tcd.c tcd.h int.h t1.h t2.h dwt.h mct.h
$(OBJ_DIR)/tgt.o: tgt.c tgt.h bio.h
$(OBJ_DIR)/jpt.o: jpt.c jpt.h cio.h
COM_OBJS = $(addprefix $(OBJ_DIR)/, j2k.o bio.o cio.o dwt.o fix.o int.o mct.o \
mqc.o pi.o t1.o t2.o tgt.o tcd.o raw.o jpt.o)
$(LIB_DIR)/libopenjpeg.a: ${COM_OBJS}
$(AR) -sr $@ $^
$(LIB_DIR)/libopenjpeg.dll: ${COM_OBJS}
${CC} -s -shared -Wl,-soname,libopenjpeg.dll -o $@ $^
$(LIB_DIR)/libopenjpeg.so.1.0: ${COM_OBJS}
${CC} -s -shared -Wl,-soname,libopenjpeg.so.1 -o $@ $^
$(LIB_DIR)/libopenjpeg.so.1: $(LIB_DIR)/libopenjpeg.so.1.0
ln -s libopenjpeg.so.1.0 $(LIB_DIR)/libopenjpeg.so.1
$(LIB_DIR)/libopenjpeg.so: $(LIB_DIR)/libopenjpeg.so.1
ln -s libopenjpeg.so.1 $(LIB_DIR)/libopenjpeg.so
clean:
rm -f $(OBJ_DIR_W32)/* $(OBJ_DIR)/* $(LIB_DIR_W32)/* $(LIB_DIR)/*

View File

@ -1,194 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "bio.h"
#include <stdio.h>
#include <setjmp.h>
static unsigned char *bio_start; /* pointer to the start of the buffer */
static unsigned char *bio_end; /* pointer to the end of the buffer */
static unsigned char *bio_bp; /* pointer to the present position in the buffer */
static unsigned int bio_buf; /* temporary place where each byte is read or written */
static int bio_ct; /* coder : number of bits free to write // decoder : number of bits read */
extern jmp_buf j2k_error;
/*
* Number of bytes written.
*/
int bio_numbytes()
{
return bio_bp - bio_start;
}
/*
* Init encoder.
*
* bp : Output buffer
* len : Output buffer length
*/
void bio_init_enc(unsigned char *bp, int len)
{
bio_start = bp;
bio_end = bp + len;
bio_bp = bp;
bio_buf = 0;
bio_ct = 8;
}
/*
* Init decoder.
*
* bp : Input buffer
* len : Input buffer length
*/
void bio_init_dec(unsigned char *bp, int len)
{
bio_start = bp;
bio_end = bp + len;
bio_bp = bp;
bio_buf = 0;
bio_ct = 0;
}
/*
* Write byte. --> function modified to eliminate longjmp !!!
*
*/
int bio_byteout()
{
bio_buf = (bio_buf << 8) & 0xffff;
bio_ct = bio_buf == 0xff00 ? 7 : 8;
if (bio_bp >= bio_end)
return 1;
*bio_bp++ = bio_buf >> 8;
return 0;
}
/*
* Read byte. --> function modified to eliminate longjmp !!
*
*/
int bio_bytein()
{
bio_buf = (bio_buf << 8) & 0xffff;
bio_ct = bio_buf == 0xff00 ? 7 : 8;
if (bio_bp >= bio_end)
return 1;
bio_buf |= *bio_bp++;
return 0;
}
/*
* Write bit.
*
* b : Bit to write (0 or 1)
*/
void bio_putbit(int b)
{
if (bio_ct == 0) {
bio_byteout();
}
bio_ct--;
bio_buf |= b << bio_ct;
}
/*
* Read bit.
*
*/
int bio_getbit()
{
if (bio_ct == 0) {
bio_bytein();
}
bio_ct--;
return (bio_buf >> bio_ct) & 1;
}
/*
* Write bits.
*
* v : Value of bits
* n : Number of bits to write
*/
void bio_write(int v, int n)
{
int i;
for (i = n - 1; i >= 0; i--) {
bio_putbit((v >> i) & 1);
}
}
/*
* Read bits.
*
* n : Number of bits to read
*/
int bio_read(int n)
{
int i, v;
v = 0;
for (i = n - 1; i >= 0; i--) {
v += bio_getbit() << i;
}
return v;
}
/*
* Flush bits. Modified to eliminate longjmp !!
*
*/
int bio_flush()
{
bio_ct = 0;
if (bio_byteout())
return 1;
if (bio_ct == 7) {
bio_ct = 0;
if (bio_byteout())
return 1;
}
return 0;
}
/*
* Passes the ending bits (coming from flushing)
*/
int bio_inalign()
{
bio_ct = 0;
if ((bio_buf & 0xff) == 0xff) {
if (bio_bytein())
return 1;
bio_ct = 0;
}
return 0;
}

View File

@ -1,152 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "cio.h"
#include <setjmp.h>
static unsigned char *cio_start; /* pointer to the start of the stream */
static unsigned char *cio_end; /* pointer to the end of the stream */
static unsigned char *cio_bp; /* pointer to the present position */
extern jmp_buf j2k_error;
/*
* Number of bytes written.
*/
int cio_numbytes()
{
return cio_bp - cio_start;
}
/*
* Get position in byte stream.
*/
int cio_tell()
{
return cio_bp - cio_start;
}
/*
* Set position in byte stream.
*
* pos : position, in number of bytes, from the beginning of the stream
*/
void cio_seek(int pos)
{
cio_bp = cio_start + pos;
}
/*
* Number of bytes left before the end of the stream.
*/
int cio_numbytesleft()
{
return cio_end - cio_bp;
}
/*
* Get pointer to the current position in the stream.
*/
unsigned char *cio_getbp()
{
return cio_bp;
}
/*
* Initialize byte IO
*
* bp : destination/source stream
* len : length of the stream
*/
void cio_init(unsigned char *bp, int len)
{
cio_start = bp;
cio_end = bp + len;
cio_bp = bp;
}
/*
* Write a byte.
*/
void cio_byteout(unsigned char v)
{
if (cio_bp >= cio_end)
longjmp(j2k_error, 1);
*cio_bp++ = v;
}
/*
* Read a byte.
*/
unsigned char cio_bytein()
{
if (cio_bp >= cio_end)
longjmp(j2k_error, 1);
return *cio_bp++;
}
/*
* Write some bytes.
*
* v : value to write
* n : number of bytes to write
*/
void cio_write(unsigned int v, int n)
{
int i;
for (i = n - 1; i >= 0; i--) {
cio_byteout((unsigned char) ((v >> (i << 3)) & 0xff));
}
}
/*
* Read some bytes.
*
* n : number of bytes to read
*
* return : value of the n bytes read
*/
unsigned int cio_read(int n)
{
int i;
unsigned int v;
v = 0;
for (i = n - 1; i >= 0; i--) {
v += cio_bytein() << (i << 3);
}
return v;
}
/*
* Skip some bytes.
*
* n : number of bytes to skip
*/
void cio_skip(int n)
{
cio_bp += n;
}

View File

@ -1,444 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2002-2004, Yannick Verschueren
* Copyright (c) 2002-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "dwt.h"
#include "int.h"
#include "fix.h"
#include "tcd.h"
#include <stdlib.h>
#include <stdio.h>
//#include <math.h>
#define S(i) a[x*(i)*2]
#define D(i) a[x*(1+(i)*2)]
#define S_(i) ((i)<0?S(0):((i)>=sn?S(sn-1):S(i)))
#define D_(i) ((i)<0?D(0):((i)>=dn?D(dn-1):D(i)))
/* new */
#define SS_(i) ((i)<0?S(0):((i)>=dn?S(dn-1):S(i)))
#define DD_(i) ((i)<0?D(0):((i)>=sn?D(sn-1):D(i)))
/* <summary> */
/* This table contains the norms of the 5-3 wavelets for different bands. */
/* </summary> */
double dwt_norms[4][10] = {
{1.000, 1.500, 2.750, 5.375, 10.68, 21.34, 42.67, 85.33, 170.7, 341.3},
{1.038, 1.592, 2.919, 5.703, 11.33, 22.64, 45.25, 90.48, 180.9},
{1.038, 1.592, 2.919, 5.703, 11.33, 22.64, 45.25, 90.48, 180.9},
{.7186, .9218, 1.586, 3.043, 6.019, 12.01, 24.00, 47.97, 95.93}
};
/* <summary> */
/* This table contains the norms of the 9-7 wavelets for different bands. */
/* </summary> */
double dwt_norms_real[4][10] = {
{1.000, 1.965, 4.177, 8.403, 16.90, 33.84, 67.69, 135.3, 270.6, 540.9},
{2.022, 3.989, 8.355, 17.04, 34.27, 68.63, 137.3, 274.6, 549.0},
{2.022, 3.989, 8.355, 17.04, 34.27, 68.63, 137.3, 274.6, 549.0},
{2.080, 3.865, 8.307, 17.18, 34.71, 69.59, 139.3, 278.6, 557.2}
};
/* Add Patrick */
static int *b = NULL;
static int lastSizeOfB = 0;
/* <summary> */
/* Claning memory. */
/* </summary> */
void dwt_clean()
{
if (b != NULL) {
free(b);
}
b = NULL;
lastSizeOfB = 0;
}
/* \ Add Patrick */
/* <summary> */
/* Forward lazy transform. */
/* </summary> */
void dwt_deinterleave(int *a, int n, int x, int res, int cas)
{
int dn, sn, i;
sn = res;
dn = n - res;
if (lastSizeOfB != n) {
if (b != NULL)
free(b);
b = (int *) malloc(n * sizeof(int));
lastSizeOfB = n;
}
if (cas) {
for (i = 0; i < sn; i++)
b[i] = a[(2 * i + 1) * x];
for (i = 0; i < dn; i++)
b[sn + i] = a[2 * i * x];
} else {
for (i = 0; i < sn; i++)
b[i] = a[2 * i * x];
for (i = 0; i < dn; i++)
b[sn + i] = a[(2 * i + 1) * x];
}
for (i = 0; i < n; i++)
a[i * x] = b[i];
}
/* <summary> */
/* Inverse lazy transform. */
/* </summary> */
void dwt_interleave(int *a, int n, int x, int res, int cas)
{
int dn, sn, i;
sn = res;
dn = n - res;
if (lastSizeOfB != n) {
if (b != NULL)
free(b);
b = (int *) malloc(n * sizeof(int));
lastSizeOfB = n;
}
if (cas) {
for (i = 0; i < sn; i++)
b[2 * i + 1] = a[i * x];
for (i = 0; i < dn; i++)
b[2 * i] = a[(sn + i) * x];
} else {
for (i = 0; i < sn; i++)
b[2 * i] = a[i * x];
for (i = 0; i < dn; i++)
b[2 * i + 1] = a[(sn + i) * x];
}
for (i = 0; i < n; i++)
a[i * x] = b[i];
}
/* <summary> */
/* Forward 5-3 wavelet tranform in 1-D. */
/* </summary> */
void dwt_encode_1(int *a, int n, int x, int res, int cas)
{
int dn, sn, i = 0;
sn = res;
dn = n - res;
if (cas) {
if (!sn && dn == 1) /* NEW : CASE ONE ELEMENT */
S(i) *= 2;
else {
for (i = 0; i < dn; i++)
S(i) -= (DD_(i) + DD_(i - 1)) >> 1;
for (i = 0; i < sn; i++)
D(i) += (SS_(i) + SS_(i + 1) + 2) >> 2;
}
} else {
if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */
for (i = 0; i < dn; i++)
D(i) -= (S_(i) + S_(i + 1)) >> 1;
for (i = 0; i < sn; i++)
S(i) += (D_(i - 1) + D_(i) + 2) >> 2;
}
}
dwt_deinterleave(a, n, x, res, cas);
}
/* <summary> */
/* Inverse 5-3 wavelet tranform in 1-D. */
/* </summary> */
void dwt_decode_1(int *a, int n, int x, int res, int cas)
{
int dn, sn, i = 0;
sn = res;
dn = n - res;
dwt_interleave(a, n, x, res, cas);
if (cas) {
if (!sn && dn == 1) /* NEW : CASE ONE ELEMENT */
S(i) /= 2;
else {
for (i = 0; i < sn; i++)
D(i) -= (SS_(i) + SS_(i + 1) + 2) >> 2;
for (i = 0; i < dn; i++)
S(i) += (DD_(i) + DD_(i - 1)) >> 1;
}
} else {
if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */
for (i = 0; i < sn; i++)
S(i) -= (D_(i - 1) + D_(i) + 2) >> 2;
for (i = 0; i < dn; i++)
D(i) += (S_(i) + S_(i + 1)) >> 1;
}
}
}
/* <summary> */
/* Forward 5-3 wavelet tranform in 2-D. */
/* </summary> */
void dwt_encode(int *a, int w, int h, tcd_tilecomp_t * tilec, int l)
{
int i, j;
int rw; /* width of the resolution level computed */
int rh; /* heigth of the resolution level computed */
int rw1; /* width of the resolution level once lower than computed one */
int rh1; /* height of the resolution level once lower than computed one */
for (i = 0; i < l; i++) {
int cas_col = 0; /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
int cas_row = 0; /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering */
rw = tilec->resolutions[l - i].x1 - tilec->resolutions[l - i].x0;
rh = tilec->resolutions[l - i].y1 - tilec->resolutions[l - i].y0;
rw1 = tilec->resolutions[l - i - 1].x1 - tilec->resolutions[l - i - 1].x0;
rh1 = tilec->resolutions[l - i - 1].y1 - tilec->resolutions[l - i - 1].y0;
cas_row = tilec->resolutions[l - i].x0 % 2;
cas_col = tilec->resolutions[l - i].y0 % 2;
for (j = 0; j < rw; j++)
dwt_encode_1(a + j, rh, w, rh1, cas_col);
for (j = 0; j < rh; j++)
dwt_encode_1(a + j * w, rw, 1, rw1, cas_row);
}
dwt_clean();
}
/* <summary> */
/* Inverse 5-3 wavelet tranform in 2-D. */
/* </summary> */
void dwt_decode(int *a, int w, int h, tcd_tilecomp_t * tilec, int l)//, tcd_tilecomp_t * row_tilec, tcd_tilecomp_t * col_tilec)
{
int i, j;
int rw; /* width of the resolution level computed */
int rh; /* heigth of the resolution level computed */
int rw1; /* width of the resolution level once lower than computed one */
int rh1; /* height of the resolution level once lower than computed one */
for (i = l - 1; i >= 0; i--) {
int cas_col = 0; /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
int cas_row = 0; /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering */
rw = tilec->resolutions[l - i].x1 - tilec->resolutions[l - i].x0;
rh = tilec->resolutions[l - i].y1 - tilec->resolutions[l - i].y0;
rw1 = tilec->resolutions[l - i - 1].x1 - tilec->resolutions[l - i - 1].x0;
rh1 = tilec->resolutions[l - i - 1].y1 - tilec->resolutions[l - i - 1].y0;
cas_row = tilec->resolutions[l - i].x0 % 2;
cas_col = tilec->resolutions[l - i].y0 % 2;
for (j = 0; j < rh; j++)
dwt_decode_1(a + j * w, rw, 1, rw1, cas_row);
for (j = 0; j < rw; j++)
dwt_decode_1(a + j, rh, w, rh1, cas_col);
}
dwt_clean();
}
/* <summary> */
/* Get gain of 5-3 wavelet transform. */
/* </summary> */
int dwt_getgain(int orient)
{
if (orient == 0)
return 0;
if (orient == 1 || orient == 2)
return 1;
return 2;
}
/* <summary> */
/* Get norm of 5-3 wavelet. */
/* </summary> */
double dwt_getnorm(int level, int orient)
{
return dwt_norms[orient][level];
}
/* <summary> */
/* Forward 9-7 wavelet transform in 1-D. */
/* </summary> */
void dwt_encode_1_real(int *a, int n, int x, int res, int cas)
{
int dn, sn, i = 0;
dn = n - res;
sn = res;
if (cas) {
if ((sn > 0) || (dn > 1)) { /* NEW : CASE ONE ELEMENT */
for (i = 0; i < dn; i++)
S(i) -= fix_mul(DD_(i) + DD_(i - 1), 12993);
for (i = 0; i < sn; i++)
D(i) -= fix_mul(SS_(i) + SS_(i + 1), 434);
for (i = 0; i < dn; i++)
S(i) += fix_mul(DD_(i) + DD_(i - 1), 7233);
for (i = 0; i < sn; i++)
D(i) += fix_mul(SS_(i) + SS_(i + 1), 3633);
for (i = 0; i < dn; i++)
S(i) = fix_mul(S(i), 5038); /*5038*/
for (i = 0; i < sn; i++)
D(i) = fix_mul(D(i), 6659); /*6660*/
}
} else {
if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */
for (i = 0; i < dn; i++)
D(i) -= fix_mul(S_(i) + S_(i + 1), 12993);
for (i = 0; i < sn; i++)
S(i) -= fix_mul(D_(i - 1) + D_(i), 434);
for (i = 0; i < dn; i++)
D(i) += fix_mul(S_(i) + S_(i + 1), 7233);
for (i = 0; i < sn; i++)
S(i) += fix_mul(D_(i - 1) + D_(i), 3633);
for (i = 0; i < dn; i++)
D(i) = fix_mul(D(i), 5038); /*5038*/
for (i = 0; i < sn; i++)
S(i) = fix_mul(S(i), 6659); /*6660*/
}
}
dwt_deinterleave(a, n, x, res, cas);
}
/* <summary> */
/* Inverse 9-7 wavelet transform in 1-D. */
/* </summary> */
void dwt_decode_1_real(int *a, int n, int x, int res, int cas)
{
int dn, sn, i = 0;
dn = n - res;
sn = res;
dwt_interleave(a, n, x, res, cas);
if (cas) {
if ((sn > 0) || (dn > 1)) { /* NEW : CASE ONE ELEMENT */
for (i = 0; i < sn; i++)
D(i) = fix_mul(D(i), 10078); /* 10076 */
for (i = 0; i < dn; i++)
S(i) = fix_mul(S(i), 13318); /* 13320*/
for (i = 0; i < sn; i++)
D(i) -= fix_mul(SS_(i) + SS_(i + 1), 3633);
for (i = 0; i < dn; i++)
S(i) -= fix_mul(DD_(i) + DD_(i - 1), 7233);
for (i = 0; i < sn; i++)
D(i) += fix_mul(SS_(i) + SS_(i + 1), 434);
for (i = 0; i < dn; i++)
S(i) += fix_mul(DD_(i) + DD_(i - 1), 12993);
}
} else {
if ((dn > 0) || (sn > 1)) { /* NEW : CASE ONE ELEMENT */
for (i = 0; i < sn; i++)
S(i) = fix_mul(S(i), 10078); /* 10076 */
for (i = 0; i < dn; i++)
D(i) = fix_mul(D(i), 13318); /* 13320*/
for (i = 0; i < sn; i++)
S(i) -= fix_mul(D_(i - 1) + D_(i), 3633);
for (i = 0; i < dn; i++)
D(i) -= fix_mul(S_(i) + S_(i + 1), 7233);
for (i = 0; i < sn; i++)
S(i) += fix_mul(D_(i - 1) + D_(i), 434);
for (i = 0; i < dn; i++)
D(i) += fix_mul(S_(i) + S_(i + 1), 12993);
}
}
}
/* <summary> */
/* Forward 9-7 wavelet transform in 2-D. */
/* </summary> */
void dwt_encode_real(int *a, int w, int h, tcd_tilecomp_t * tilec, int l)
{
int i, j;
int rw; /* width of the resolution level computed */
int rh; /* heigth of the resolution level computed */
int rw1; /* width of the resolution level once lower than computed one */
int rh1; /* height of the resolution level once lower than computed one */
for (i = 0; i < l; i++) {
int cas_col = 0; /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
int cas_row = 0; /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering */
rw = tilec->resolutions[l - i].x1 - tilec->resolutions[l - i].x0;
rh = tilec->resolutions[l - i].y1 - tilec->resolutions[l - i].y0;
rw1 = tilec->resolutions[l - i - 1].x1 - tilec->resolutions[l - i - 1].x0;
rh1 = tilec->resolutions[l - i - 1].y1 - tilec->resolutions[l - i - 1].y0;
cas_row = tilec->resolutions[l - i].x0 % 2;
cas_col = tilec->resolutions[l - i].y0 % 2;
for (j = 0; j < rw; j++)
dwt_encode_1_real(a + j, rh, w, rh1, cas_col);
for (j = 0; j < rh; j++)
dwt_encode_1_real(a + j * w, rw, 1, rw1, cas_row);
}
}
/* <summary> */
/* Inverse 9-7 wavelet transform in 2-D. */
/* </summary> */
void dwt_decode_real(int *a, int w, int h, tcd_tilecomp_t * tilec, int l)//, tcd_tilecomp_t * row_tilec, tcd_tilecomp_t * col_tilec)
{
int i, j;
int rw; /* width of the resolution level computed */
int rh; /* heigth of the resolution level computed */
int rw1; /* width of the resolution level once lower than computed one */
int rh1; /* height of the resolution level once lower than computed one */
for (i = l - 1; i >= 0; i--) {
int cas_col = 0; /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
int cas_row = 0; /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering */
rw = tilec->resolutions[l - i].x1 - tilec->resolutions[l - i].x0;
rh = tilec->resolutions[l - i].y1 - tilec->resolutions[l - i].y0;
rw1 = tilec->resolutions[l - i - 1].x1 - tilec->resolutions[l - i - 1].x0;
rh1 = tilec->resolutions[l - i - 1].y1 - tilec->resolutions[l - i - 1].y0;
cas_row = tilec->resolutions[l - i].x0 % 2;
cas_col = tilec->resolutions[l - i].y0 % 2;
for (j = 0; j < rh; j++)
dwt_decode_1_real(a + j * w, rw, 1, rw1, cas_row);
for (j = 0; j < rw; j++)
dwt_decode_1_real(a + j, rh, w, rh1, cas_col);
}
}
/* <summary> */
/* Get gain of 9-7 wavelet transform. */
/* </summary> */
int dwt_getgain_real(int orient)
{
return 0;
}
/* <summary> */
/* Get norm of 9-7 wavelet. */
/* </summary> */
double dwt_getnorm_real(int level, int orient)
{
return dwt_norms_real[orient][level];
}

View File

@ -1,99 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "tcd.h"
#ifndef __DWT_H
#define __DWT_H
/*
* Apply a reversible DWT transform to a component of an image
* a: samples of the component
* w: width of the component
* h: height of the component
* tilec : tile component information (present tile)
* l: number of decomposition levels in the DWT
*/
/* void dwt_encode(int* a, int w, int h, int l); */
void dwt_encode(int *a, int w, int h, tcd_tilecomp_t * tilec, int l);
/*
* Apply a reversible inverse DWT transform to a component of an image
* a: samples of the component
* w: width of the component
* h: height of the component
* tilec : tile component information (present tile)
* l: number of decomposition levels in the DWT
* row_tilec : tile component information (previous tile on the same row)
* col_tilec : tile component information (previous tile on the same column)
*/
void dwt_decode(int *a, int w, int h, tcd_tilecomp_t * tilec, int l);//, tcd_tilecomp_t * row_tilec, tcd_tilecomp_t * col_tilec);
/*
* Get the gain of a subband for the reversible DWT
* orient: number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
*/
int dwt_getgain(int orient);
/*
* Get the norm of a wavelet function of a subband at a specified level for the reversible DWT
* level: level of the wavelet function
* orient: band of the wavelet function
*/
double dwt_getnorm(int level, int orient);
/*
* Apply an irreversible DWT transform to a component of an image
* a: samples of the component
* w: width of the component
* h: height of the component
* l: number of decomposition levels in the DWT
*/
void dwt_encode_real(int *a, int w, int h, tcd_tilecomp_t * tilec, int l);
/*
* Apply an irreversible inverse DWT transform to a component of an image
* a: samples of the component
* w: width of the component
* h: height of the component
* l: number of decomposition levels in the DWT
*/
void dwt_decode_real(int *a, int w, int h, tcd_tilecomp_t * tilec, int l);//, tcd_tilecomp_t * row_tilec, tcd_tilecomp_t * col_tilec);
/*
* Get the gain of a subband for the irreversible DWT
* orient: number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
*/
int dwt_getgain_real(int orient);
/*
* Get the norm of a wavelet function of a subband at a specified level for the irreversible DWT
* level: level of the wavelet function
* orient: band of the wavelet function
*/
double dwt_getnorm_real(int level, int orient);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,202 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#define VERSION "0.0.8"
#ifdef DAVID_WIN32
#ifdef LIBJ2K_EXPORTS
#define LIBJ2K_API __declspec(dllexport)
#else
#define LIBJ2K_API __declspec(dllimport)
#endif
#else
#define LIBJ2K_API
#endif
#ifndef __J2K_H
#define __J2K_H
#define J2K_MAXRLVLS 33 /* Number of maximum resolution level authorized */
#define J2K_MAXBANDS (3*J2K_MAXRLVLS+1) /* Number of maximum sub-band linked to number of resolution level */
#define J2K_CP_CSTY_PRT 0x01
#define J2K_CP_CSTY_SOP 0x02
#define J2K_CP_CSTY_EPH 0x04
#define J2K_CCP_CSTY_PRT 0x01
#define J2K_CCP_CBLKSTY_LAZY 0x01
#define J2K_CCP_CBLKSTY_RESET 0x02
#define J2K_CCP_CBLKSTY_TERMALL 0x04
#define J2K_CCP_CBLKSTY_VSC 0x08
#define J2K_CCP_CBLKSTY_PTERM 0x10
#define J2K_CCP_CBLKSTY_SEGSYM 0x20
#define J2K_CCP_QNTSTY_NOQNT 0
#define J2K_CCP_QNTSTY_SIQNT 1
#define J2K_CCP_QNTSTY_SEQNT 2
typedef struct {
int dx, dy; /* XRsiz, YRsiz */
int prec; /* precision */
int bpp; /* deapth of image in bits */
int sgnd; /* signed */
int *data; /* image-component data */
} j2k_comp_t;
typedef struct {
int x0, y0; /* XOsiz, YOsiz */
int x1, y1; /* Xsiz, Ysiz */
int numcomps; /* number of components */
int index_on; /* 0 = no index || 1 = index */
j2k_comp_t *comps; /* image-components */
} j2k_image_t;
typedef struct {
int expn; /* exponent */
int mant; /* mantissa */
} j2k_stepsize_t;
typedef struct {
int csty; /* coding style */
int numresolutions; /* number of resolutions */
int cblkw; /* width of code-blocks */
int cblkh; /* height of code-blocks */
int cblksty; /* code-block coding style */
int qmfbid; /* discrete wavelet transform identifier */
int qntsty; /* quantisation style */
j2k_stepsize_t stepsizes[J2K_MAXBANDS]; /* stepsizes used for quantisation */
int numgbits; /* number of guard bits */
int roishift; /* Region Of Interest shift */
int prcw[J2K_MAXRLVLS]; /* Precinct width */
int prch[J2K_MAXRLVLS]; /* Precinct height */
} j2k_tccp_t;
typedef struct {
int resno0, compno0;
int layno1, resno1, compno1;
int prg;
int tile;
char progorder[4];
} j2k_poc_t;
typedef struct {
int first; /* 1 : first part-tile of a tile */
int csty; /* coding style */
int prg; /* progression order */
int numlayers; /* number of layers */
int mct; /* multi-component transform identifier */
int rates[100]; /* rates of layers */
int numpocs; /* number of progression order changes */
int POC; /* Precise if a POC marker has been used O:NO, 1:YES */
j2k_poc_t pocs[32]; /* progression order changes */
unsigned char *ppt_data; /* packet header store there for futur use in t2_decode_packet */
int ppt; /* If ppt == 1 --> there was a PPT marker for the present tile */
int ppt_store; /* Use in case of multiple marker PPT (number of info already store) */
j2k_tccp_t *tccps; /* tile-component coding parameters */
} j2k_tcp_t;
typedef struct {
int image_type; /* 0: PNM, PGM, PPM 1: PGX */
int disto_alloc; /* Allocation by rate/distortion */
int fixed_alloc; /* Allocation by fixed layer */
int tx0, ty0; /* XTOsiz, YTOsiz */
int tdx, tdy; /* XTsiz, YTsiz */
char *comment; /* comment for coding */
int tw, th;
unsigned char *ppm_data; /* packet header store there for futur use in t2_decode_packet */
int ppm; /* If ppm == 1 --> there was a PPM marker for the present tile */
int ppm_store; /* Use in case of multiple marker PPM (number of info already store) */
int ppm_previous; /* Use in case of multiple marker PPM (case on non-finished previous info) */
j2k_tcp_t *tcps; /* tile coding parameters */
int *matrice; /* Fixed layer */
} j2k_cp_t;
typedef struct {
int start_pos, end_pos; /* start and end position */
double disto; /* ADD for Marcela */
} info_packet; /* Index struct */
typedef struct {
double *thresh; /* value of thresh for each layer by tile cfr. Marcela */
int num_tile; /* Number of Tile */
int start_pos; /* Start position */
int end_header; /* End position of the header */
int end_pos; /* End position */
int pw, ph; /* number of precinct by tile */
info_packet *packet; /* information concerning packets inside tile */
} info_tile; /* index struct */
typedef struct {
int index_on;
double D_max; /* ADD for Marcela */
int num; /* numero of packet */
int index_write; /* writing the packet inthe index with t2_encode_packets */
int Im_w, Im_h; /* Image width and Height */
int Prog; /* progression order */
int Tile_x, Tile_y; /* Number of Tile in X and Y */
int tw, th;
int Comp; /* Component numbers */
int Layer; /* number of layer */
int Decomposition; /* number of decomposition */
int pw, ph; /* nombre precinct in X and Y */
int pdx, pdy; /* size of precinct in X and Y */
int Main_head_end; /* Main header position */
int codestream_size; /* codestream's size */
info_tile *tile; /* information concerning tiles inside image */
} info_image; /* index struct */
/*
* Encode an image into a JPEG-2000 codestream
* i: image to encode
* cp: coding parameters
* dest: destination buffer
* len: length of destination buffer
* index : index file name
*/
LIBJ2K_API int j2k_encode(j2k_image_t * i, j2k_cp_t * cp, char *outfile, int len, char *index);
/* LIBJ2K_API int j2k_encode(j2k_image_t *i, j2k_cp_t *cp,unsigned char *dest, int len); */
/*
* Decode an image from a JPEG-2000 codestream
* src: source buffer
* len: length of source buffer
* i: decode image
* cp: coding parameters that were used to encode the image
*/
LIBJ2K_API int j2k_decode(unsigned char *src, int len, j2k_image_t ** img, j2k_cp_t ** cp);
/*
* Decode an image form a JPT-stream (JPEG 2000, JPIP)
* src: source buffer
* len: length of source buffer
* i: decode image
* cp: coding parameters that were used to encode the image
*
*/
int j2k_decode_jpt_stream(unsigned char *src, int len, j2k_image_t ** img, j2k_cp_t ** cp);
#endif

View File

@ -1,168 +0,0 @@
/*
* Copyright (c) 2004, Yannick Verschueren
* Copyright (c) 2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include "jpt.h"
#include "j2k.h"
#include "cio.h"
/*
* Read the information contains in VBAS [JPP/JPT stream message header]
* Store information (7 bits) in value
*
*/
unsigned int jpt_read_VBAS_info(unsigned int value)
{
unsigned char elmt;
elmt = cio_read(1);
while ((elmt >> 7) == 1)
{
value = (value << 7);
value |= (elmt & 0x7f);
elmt = cio_read(1);
}
value = (value << 7);
value |= (elmt & 0x7f);
return value;
}
/*
* Initialize the value of the message header structure
*
*/
void jpt_init_Msg_Header(jpt_msg_header_struct_t *header)
{
header->Id = 0; /* In-class Identifier */
header->last_byte = 0; /* Last byte information */
header->Class_Id = 0; /* Class Identifier */
header->CSn_Id = 0; /* CSn : index identifier */
header->Msg_offset = 0; /* Message offset */
header->Msg_length = 0; /* Message length */
header->Layer_nb = 0; /* Auxiliary for JPP case */
}
/*
* Re-initialize the value of the message header structure
*
* Only parameters always present in message header
*
*/
void jpt_reinit_Msg_Header(jpt_msg_header_struct_t *header)
{
header->Id = 0; /* In-class Identifier */
header->last_byte = 0; /* Last byte information */
header->Msg_offset = 0; /* Message offset */
header->Msg_length = 0; /* Message length */
}
/*
* Read the message header for a JPP/JPT - stream
*
*/
void jpt_read_Msg_Header(jpt_msg_header_struct_t *header)
{
unsigned char elmt, Class = 0, CSn = 0;
jpt_reinit_Msg_Header(header);
/* ------------- */
/* VBAS : Bin-ID */
/* ------------- */
elmt = cio_read(1);
/* See for Class and CSn */
switch((elmt>>5) & 0x03)
{
case 0:
fprintf(stderr,"Forbidden value encounter in message header !!\n");
break;
case 1:
Class = 0;
CSn = 0;
break;
case 2:
Class = 1;
CSn = 0;
break;
case 3:
Class = 1;
CSn = 1;
break;
default :
break;
}
/* see information on bits 'c' [p 10 : A.2.1 general, ISO/IEC FCD 15444-9] */
if (((elmt>>3) & 0x01) == 1)
header->last_byte = 1;
/* In-class identifier */
header->Id |= (elmt & 0x0f);
if ((elmt>>7)==1)
header->Id = jpt_read_VBAS_info(header->Id);
/* ------------ */
/* VBAS : Class */
/* ------------ */
if (Class==1)
{
header->Class_Id = 0;
header->Class_Id = jpt_read_VBAS_info(header->Class_Id);
}
/* ---------- */
/* VBAS : CSn */
/* ---------- */
if (CSn==1)
{
header->CSn_Id = 0;
header->CSn_Id = jpt_read_VBAS_info(header->CSn_Id);
}
/* ----------------- */
/* VBAS : Msg_offset */
/* ----------------- */
header->Msg_offset = jpt_read_VBAS_info(header->Msg_offset);
/* ----------------- */
/* VBAS : Msg_length */
/* ----------------- */
header->Msg_length = jpt_read_VBAS_info(header->Msg_length);
/* ---------- */
/* VBAS : Aux */
/* ---------- */
if (header->CSn_Id == 1)
{
header->Layer_nb = 0;
header->Layer_nb = jpt_read_VBAS_info(header->Layer_nb);
}
}

View File

@ -1,74 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __MCT_H
#define __MCT_H
/*
* Apply a reversible multi-component transform to an image
* R: samples for red component
* G: samples for green component
* B: samples blue component
* n: number of samples for each component
*/
void mct_encode(int *R, int *G, int *B, int n);
/*
* Apply a reversible multi-component inverse transform to an image
* Y: samples for luminance component
* U: samples for red chrominance component
* V: samples for blue chrominance component
* n: number of samples for each component
*/
void mct_decode(int *V, int *U, int *Y, int n);
/*
* Get norm of the basis function used for the reversible multi-component transform
* compno: number of the component (0->Y, 1->U, 2->V)
*/
double mct_getnorm(int compno);
/*
* Apply an irreversible multi-component transform to an image
* R: samples for red component
* G: samples for green component
* B: samples blue component
* n: number of samples for each component
*/
void mct_encode_real(int *c0, int *c1, int *c2, int n);
/*
* Apply an irreversible multi-component inverse transform to an image
* Y: samples for luminance component
* U: samples for red chrominance component
* V: samples for blue chrominance component
* n: number of samples for each component
*/
void mct_decode_real(int *c0, int *c1, int *c2, int n);
/*
* Get norm of the basis function used for the irreversible multi-component transform
* compno: number of the component (0->Y, 1->U, 2->V)
*/
double mct_getnorm_real(int compno);
#endif

View File

@ -1,589 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "mqc.h"
#include <stdio.h>
/* <summary> */
/* This struct defines the state of a context. */
/* </summary> */
typedef struct mqc_state_s {
unsigned int qeval; /* the probability of the Least Probable Symbol (0.75->0x8000, 1.5->0xffff) */
int mps; /* the Most Probable Symbol (0 or 1) */
struct mqc_state_s *nmps; /* next state if the next encoded symbol is the MPS */
struct mqc_state_s *nlps; /* next state if the next encoded symbol is the LPS */
} mqc_state_t;
/* <summary> */
/* This array defines all the possible states for a context. */
/* </summary> */
mqc_state_t mqc_states[47 * 2] = {
{0x5601, 0, &mqc_states[2], &mqc_states[3]},
{0x5601, 1, &mqc_states[3], &mqc_states[2]},
{0x3401, 0, &mqc_states[4], &mqc_states[12]},
{0x3401, 1, &mqc_states[5], &mqc_states[13]},
{0x1801, 0, &mqc_states[6], &mqc_states[18]},
{0x1801, 1, &mqc_states[7], &mqc_states[19]},
{0x0ac1, 0, &mqc_states[8], &mqc_states[24]},
{0x0ac1, 1, &mqc_states[9], &mqc_states[25]},
{0x0521, 0, &mqc_states[10], &mqc_states[58]},
{0x0521, 1, &mqc_states[11], &mqc_states[59]},
{0x0221, 0, &mqc_states[76], &mqc_states[66]},
{0x0221, 1, &mqc_states[77], &mqc_states[67]},
{0x5601, 0, &mqc_states[14], &mqc_states[13]},
{0x5601, 1, &mqc_states[15], &mqc_states[12]},
{0x5401, 0, &mqc_states[16], &mqc_states[28]},
{0x5401, 1, &mqc_states[17], &mqc_states[29]},
{0x4801, 0, &mqc_states[18], &mqc_states[28]},
{0x4801, 1, &mqc_states[19], &mqc_states[29]},
{0x3801, 0, &mqc_states[20], &mqc_states[28]},
{0x3801, 1, &mqc_states[21], &mqc_states[29]},
{0x3001, 0, &mqc_states[22], &mqc_states[34]},
{0x3001, 1, &mqc_states[23], &mqc_states[35]},
{0x2401, 0, &mqc_states[24], &mqc_states[36]},
{0x2401, 1, &mqc_states[25], &mqc_states[37]},
{0x1c01, 0, &mqc_states[26], &mqc_states[40]},
{0x1c01, 1, &mqc_states[27], &mqc_states[41]},
{0x1601, 0, &mqc_states[58], &mqc_states[42]},
{0x1601, 1, &mqc_states[59], &mqc_states[43]},
{0x5601, 0, &mqc_states[30], &mqc_states[29]},
{0x5601, 1, &mqc_states[31], &mqc_states[28]},
{0x5401, 0, &mqc_states[32], &mqc_states[28]},
{0x5401, 1, &mqc_states[33], &mqc_states[29]},
{0x5101, 0, &mqc_states[34], &mqc_states[30]},
{0x5101, 1, &mqc_states[35], &mqc_states[31]},
{0x4801, 0, &mqc_states[36], &mqc_states[32]},
{0x4801, 1, &mqc_states[37], &mqc_states[33]},
{0x3801, 0, &mqc_states[38], &mqc_states[34]},
{0x3801, 1, &mqc_states[39], &mqc_states[35]},
{0x3401, 0, &mqc_states[40], &mqc_states[36]},
{0x3401, 1, &mqc_states[41], &mqc_states[37]},
{0x3001, 0, &mqc_states[42], &mqc_states[38]},
{0x3001, 1, &mqc_states[43], &mqc_states[39]},
{0x2801, 0, &mqc_states[44], &mqc_states[38]},
{0x2801, 1, &mqc_states[45], &mqc_states[39]},
{0x2401, 0, &mqc_states[46], &mqc_states[40]},
{0x2401, 1, &mqc_states[47], &mqc_states[41]},
{0x2201, 0, &mqc_states[48], &mqc_states[42]},
{0x2201, 1, &mqc_states[49], &mqc_states[43]},
{0x1c01, 0, &mqc_states[50], &mqc_states[44]},
{0x1c01, 1, &mqc_states[51], &mqc_states[45]},
{0x1801, 0, &mqc_states[52], &mqc_states[46]},
{0x1801, 1, &mqc_states[53], &mqc_states[47]},
{0x1601, 0, &mqc_states[54], &mqc_states[48]},
{0x1601, 1, &mqc_states[55], &mqc_states[49]},
{0x1401, 0, &mqc_states[56], &mqc_states[50]},
{0x1401, 1, &mqc_states[57], &mqc_states[51]},
{0x1201, 0, &mqc_states[58], &mqc_states[52]},
{0x1201, 1, &mqc_states[59], &mqc_states[53]},
{0x1101, 0, &mqc_states[60], &mqc_states[54]},
{0x1101, 1, &mqc_states[61], &mqc_states[55]},
{0x0ac1, 0, &mqc_states[62], &mqc_states[56]},
{0x0ac1, 1, &mqc_states[63], &mqc_states[57]},
{0x09c1, 0, &mqc_states[64], &mqc_states[58]},
{0x09c1, 1, &mqc_states[65], &mqc_states[59]},
{0x08a1, 0, &mqc_states[66], &mqc_states[60]},
{0x08a1, 1, &mqc_states[67], &mqc_states[61]},
{0x0521, 0, &mqc_states[68], &mqc_states[62]},
{0x0521, 1, &mqc_states[69], &mqc_states[63]},
{0x0441, 0, &mqc_states[70], &mqc_states[64]},
{0x0441, 1, &mqc_states[71], &mqc_states[65]},
{0x02a1, 0, &mqc_states[72], &mqc_states[66]},
{0x02a1, 1, &mqc_states[73], &mqc_states[67]},
{0x0221, 0, &mqc_states[74], &mqc_states[68]},
{0x0221, 1, &mqc_states[75], &mqc_states[69]},
{0x0141, 0, &mqc_states[76], &mqc_states[70]},
{0x0141, 1, &mqc_states[77], &mqc_states[71]},
{0x0111, 0, &mqc_states[78], &mqc_states[72]},
{0x0111, 1, &mqc_states[79], &mqc_states[73]},
{0x0085, 0, &mqc_states[80], &mqc_states[74]},
{0x0085, 1, &mqc_states[81], &mqc_states[75]},
{0x0049, 0, &mqc_states[82], &mqc_states[76]},
{0x0049, 1, &mqc_states[83], &mqc_states[77]},
{0x0025, 0, &mqc_states[84], &mqc_states[78]},
{0x0025, 1, &mqc_states[85], &mqc_states[79]},
{0x0015, 0, &mqc_states[86], &mqc_states[80]},
{0x0015, 1, &mqc_states[87], &mqc_states[81]},
{0x0009, 0, &mqc_states[88], &mqc_states[82]},
{0x0009, 1, &mqc_states[89], &mqc_states[83]},
{0x0005, 0, &mqc_states[90], &mqc_states[84]},
{0x0005, 1, &mqc_states[91], &mqc_states[85]},
{0x0001, 0, &mqc_states[90], &mqc_states[86]},
{0x0001, 1, &mqc_states[91], &mqc_states[87]},
{0x5601, 0, &mqc_states[92], &mqc_states[92]},
{0x5601, 1, &mqc_states[93], &mqc_states[93]},
};
#define MQC_NUMCTXS 32
unsigned int mqc_c;
unsigned int mqc_a;
unsigned int mqc_ct;
unsigned char *mqc_bp;
unsigned char *mqc_start;
unsigned char *mqc_end;
mqc_state_t *mqc_ctxs[MQC_NUMCTXS];
mqc_state_t **mqc_curctx;
/* <summary> */
/* Return the number of bytes already encoded. */
/* </summary> */
int mqc_numbytes()
{
return mqc_bp - mqc_start;
}
/* <summary> */
/* Output a byte, doing bit-stuffing if necessary. */
/* After a 0xff byte, the next byte must be smaller than 0x90 */
/* </summary> */
void mqc_byteout()
{
if (*mqc_bp == 0xff) {
mqc_bp++;
*mqc_bp = mqc_c >> 20;
mqc_c &= 0xfffff;
mqc_ct = 7;
} else {
if ((mqc_c & 0x8000000) == 0) { /* ((mqc_c&0x8000000)==0) CHANGE */
mqc_bp++;
*mqc_bp = mqc_c >> 19;
mqc_c &= 0x7ffff;
mqc_ct = 8;
} else {
(*mqc_bp)++;
if (*mqc_bp == 0xff) {
mqc_c &= 0x7ffffff;
mqc_bp++;
*mqc_bp = mqc_c >> 20;
mqc_c &= 0xfffff;
mqc_ct = 7;
} else {
mqc_bp++;
*mqc_bp = mqc_c >> 19;
mqc_c &= 0x7ffff;
mqc_ct = 8;
}
}
}
}
/* <summary> */
/* Renormalize mqc_a and mqc_c while encoding, so that mqc_a stays between 0x8000 and 0x10000 */
/* </summary> */
void mqc_renorme()
{
do {
mqc_a <<= 1;
mqc_c <<= 1;
mqc_ct--;
if (mqc_ct == 0) {
mqc_byteout();
}
} while ((mqc_a & 0x8000) == 0);
}
/* <summary> */
/* Encode the most probable symbol. */
/* </summary> */
void mqc_codemps()
{
mqc_a -= (*mqc_curctx)->qeval;
if ((mqc_a & 0x8000) == 0) {
if (mqc_a < (*mqc_curctx)->qeval) {
mqc_a = (*mqc_curctx)->qeval;
} else {
mqc_c += (*mqc_curctx)->qeval;
}
*mqc_curctx = (*mqc_curctx)->nmps;
mqc_renorme();
} else {
mqc_c += (*mqc_curctx)->qeval;
}
}
/* <summary> */
/* Encode the most least symbol. */
/* </summary> */
void mqc_codelps()
{
mqc_a -= (*mqc_curctx)->qeval;
if (mqc_a < (*mqc_curctx)->qeval) {
mqc_c += (*mqc_curctx)->qeval;
} else {
mqc_a = (*mqc_curctx)->qeval;
}
*mqc_curctx = (*mqc_curctx)->nlps;
mqc_renorme();
}
/* <summary> */
/* Initialize encoder. */
/* </summary> */
/* <param name="bp">Output buffer.</param> */
void mqc_init_enc(unsigned char *bp)
{
mqc_setcurctx(0);
mqc_a = 0x8000;
mqc_c = 0;
mqc_bp = bp - 1;
mqc_ct = 12;
if (*mqc_bp == 0xff) {
mqc_ct = 13;
}
mqc_start = bp;
}
/* <summary> */
/* Set current context. */
/* </summary> */
/* <param name="ctxno">Context number.</param> */
void mqc_setcurctx(int ctxno)
{
mqc_curctx = &mqc_ctxs[ctxno];
}
/* <summary> */
/* Encode a symbol using the MQ-coder. */
/* </summary> */
/* <param name="d"> The symbol to be encoded (0 or 1).</param> */
void mqc_encode(int d)
{
if ((*mqc_curctx)->mps == d) {
mqc_codemps();
} else {
mqc_codelps();
}
}
/* <summary> */
/* Fill mqc_c with 1's for flushing */
/* </summary> */
void mqc_setbits()
{
unsigned int tempc = mqc_c + mqc_a;
mqc_c |= 0xffff;
if (mqc_c >= tempc) {
mqc_c -= 0x8000;
}
}
/* <summary> */
/* Flush encoded data. */
/* </summary> */
void mqc_flush()
{
mqc_setbits();
mqc_c <<= mqc_ct;
mqc_byteout();
mqc_c <<= mqc_ct;
mqc_byteout();
if (*mqc_bp != 0xff) {
mqc_bp++;
}
}
/* <summary> */
/* not fully implemented and tested !! */
/* BYPASS mode switch, initialization operation */
/* JPEG 2000 p 505 */
/* </summary> */
void mqc_bypass_init_enc()
{
mqc_c = 0;
mqc_ct = 8;
/*if (*mqc_bp == 0xff) {
mqc_ct = 7;
}*/
}
/* <summary> */
/* not fully implemented and tested !! */
/* BYPASS mode switch, coding operation */
/* JPEG 2000 p 505 */
/* </summary> */
void mqc_bypass_enc(int d)
{
mqc_ct--;
mqc_c = mqc_c + (d << mqc_ct);
if (mqc_ct == 0)
{
mqc_bp++;
*mqc_bp = mqc_c;
mqc_ct = 8;
if (*mqc_bp == 0xff) {
mqc_ct = 7;
}
mqc_c = 0;
}
}
/* <summary> */
/* not fully implemented and tested !! */
/* BYPASS mode switch, flush operation */
/* </summary> */
int mqc_bypass_flush_enc()
{
unsigned char bit_padding;
bit_padding = 0;
if (mqc_ct != 0) {
while (mqc_ct > 0) {
mqc_ct--;
mqc_c += bit_padding << mqc_ct;
bit_padding = (bit_padding + 1) & 0x01;
}
mqc_bp++;
*mqc_bp = mqc_c;
mqc_ct = 8;
mqc_c = 0;
}
return 1;
}
/* <summary> */
/* RESET mode switch */
/* </summary> */
void mqc_reset_enc()
{
mqc_resetstates();
mqc_setstate(18, 0, 46);
mqc_setstate(0, 0, 3);
mqc_setstate(1, 0, 4);
}
/* <summary> */
/* mode switch RESTART (TERMALL) */
/* </summary> */
int mqc_restart_enc()
{
int correction = 1;
/* <flush part> */
int n = 27 - 15 - mqc_ct;
mqc_c <<= mqc_ct;
while (n > 0) {
mqc_byteout();
n -= mqc_ct;
mqc_c <<= mqc_ct;
}
mqc_byteout();
return correction;
}
/* <summary> */
/* mode switch RESTART (TERMALL) reinitialisation */
/* </summary> */
void mqc_restart_init_enc()
{
/* <Re-init part> */
mqc_setcurctx(0);
mqc_a = 0x8000;
mqc_c = 0;
mqc_ct = 12;
mqc_bp--;
if (*mqc_bp == 0xff) {
mqc_ct = 13;
}
}
/* <summary> */
/* ERTERM mode switch */
/* </summary> */
void mqc_erterm_enc()
{
int k = 11 - mqc_ct + 1;
while (k > 0) {
mqc_c <<= mqc_ct;
mqc_ct = 0;
mqc_byteout();
k -= mqc_ct;
}
if (*mqc_bp != 0xff) {
mqc_byteout();
}
}
/* <summary> */
/* SEGMARK mode switch (SEGSYM) */
/* </summary> */
void mqc_segmark_enc()
{
int i;
mqc_setcurctx(18);
for (i = 1; i < 5; i++) {
mqc_encode(i % 2);
}
}
/* <summary> */
/* </summary> */
int mqc_mpsexchange()
{
int d;
if (mqc_a < (*mqc_curctx)->qeval) {
d = 1 - (*mqc_curctx)->mps;
*mqc_curctx = (*mqc_curctx)->nlps;
} else {
d = (*mqc_curctx)->mps;
*mqc_curctx = (*mqc_curctx)->nmps;
}
return d;
}
/* <summary> */
/* </summary> */
int mqc_lpsexchange()
{
int d;
if (mqc_a < (*mqc_curctx)->qeval) {
mqc_a = (*mqc_curctx)->qeval;
d = (*mqc_curctx)->mps;
*mqc_curctx = (*mqc_curctx)->nmps;
} else {
mqc_a = (*mqc_curctx)->qeval;
d = 1 - (*mqc_curctx)->mps;
*mqc_curctx = (*mqc_curctx)->nlps;
}
return d;
}
/* <summary> */
/* Input a byte. */
/* </summary> */
void mqc_bytein()
{
if (mqc_bp != mqc_end) {
unsigned int c;
if (mqc_bp + 1 != mqc_end) {
c = *(mqc_bp + 1);
} else {
c = 0xff;
}
if (*mqc_bp == 0xff) {
if (c > 0x8f) {
mqc_c += 0xff00;
mqc_ct = 8;
} else {
mqc_bp++;
mqc_c += c << 9;
mqc_ct = 7;
}
} else {
mqc_bp++;
mqc_c += c << 8;
mqc_ct = 8;
}
} else {
mqc_c += 0xff00;
mqc_ct = 8;
}
}
/* <summary> */
/* Renormalize mqc_a and mqc_c while decoding. */
/* </summary> */
void mqc_renormd()
{
do {
if (mqc_ct == 0) {
mqc_bytein();
}
mqc_a <<= 1;
mqc_c <<= 1;
mqc_ct--;
} while (mqc_a < 0x8000);
}
/* <summary> */
/* Initialize decoder. */
/* </summary> */
void mqc_init_dec(unsigned char *bp, int len)
{
mqc_setcurctx(0);
mqc_start = bp;
mqc_end = bp + len;
mqc_bp = bp;
mqc_c = *mqc_bp << 16;
mqc_bytein();
mqc_c <<= 7;
mqc_ct -= 7;
mqc_a = 0x8000;
}
/* <summary> */
/* Decode a symbol. */
/* </summary> */
int mqc_decode()
{
int d;
mqc_a -= (*mqc_curctx)->qeval;
if ((mqc_c >> 16) < (*mqc_curctx)->qeval) {
d = mqc_lpsexchange();
mqc_renormd();
} else {
mqc_c -= (*mqc_curctx)->qeval << 16;
if ((mqc_a & 0x8000) == 0) {
d = mqc_mpsexchange();
mqc_renormd();
} else {
d = (*mqc_curctx)->mps;
}
}
return d;
}
/* <summary> */
/* Reset states of all contexts. */
/* </summary> */
void mqc_resetstates()
{
int i;
for (i = 0; i < MQC_NUMCTXS; i++) {
mqc_ctxs[i] = mqc_states;
}
}
/* <summary> */
/* Set the state for a context. */
/* </summary> */
/* <param name="ctxno">Context number</param> */
/* <param name="msb">Most significant bit</param> */
/* <param name="prob">Index to the probability of symbols</param> */
void mqc_setstate(int ctxno, int msb, int prob)
{
mqc_ctxs[ctxno] = &mqc_states[msb + (prob << 1)];
}

View File

@ -1,127 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __MQC_H
#define __MQC_H
/*
* Return the number of bytes written/read since initialisation
*/
int mqc_numbytes();
/*
* Reset the states of all the context of the coder/decoder
* (each context is set to a state where 0 and 1 are more or less equiprobable)
*/
void mqc_resetstates();
/*
* Set the state of a particular context
* ctxno: number that identifies the context
* msb: the MSB of the new state of the context
* prob: number that identifies the probability of the symbols for the new state of the context
*/
void mqc_setstate(int ctxno, int msb, int prob);
/*
* Initialize the encoder
* bp: pointer to the start of the buffer where the bytes will be written
*/
void mqc_init_enc(unsigned char *bp);
/*
* Set the current context used for coding/decoding
* ctxno: number that identifies the context
*/
void mqc_setcurctx(int ctxno);
/*
* Encode a bit
* d: bit to encode (0 or 1)
*/
void mqc_encode(int d);
/*
* Flush the encoder, so that all remaining data is written
*/
void mqc_flush();
/*
* BYPASS mode switch
*/
void mqc_bypass_init_enc();
/*
* BYPASS mode switch
*/
void mqc_bypass_enc(int d);
/*
* BYPASS mode switch
*/
int mqc_bypass_flush_enc();
/*
* RESET mode switch
*/
void mqc_reset_enc();
/*
* RESTART mode switch (TERMALL)
*/
int mqc_restart_enc();
/*
* RESTART mode switch (TERMALL)
*/
void mqc_restart_init_enc();
/*
* ERTERM mode switch (PTERM)
*/
void mqc_erterm_enc();
/*
* SEGMARK mode switch (SEGSYM)
*/
void mqc_segmark_enc();
/*
* Initialize the decoder
* bp: pointer to the start of the buffer from which the bytes will be read
* len: length of the input buffer
*/
void mqc_init_dec(unsigned char *bp, int len);
/*
* Decode a bit (returns 0 or 1)
*/
int mqc_decode();
#endif

View File

@ -1,48 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003, Yannick Verschueren
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __OPENJPEG_H
#define __OPENJPEG_H
#include <j2k.h>
#include <tcd.h>
#include <bio.h>
#include <cio.h>
#include <dwt.h>
#include <fix.h>
#include <int.h>
#include <mct.h>
#include <mqc.h>
#include <pi.h>
#include <raw.h>
#include <t1.h>
#include <t2.h>
#include <tgt.h>
#endif

View File

@ -1,442 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2003-2004, Yannick Verschueren
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "pi.h"
#include "int.h"
#include <stdlib.h>
#include <stdio.h>
/* <summary>
* Create a packet iterator.
* </summary> */
pi_iterator_t *pi_create(j2k_image_t * img, j2k_cp_t * cp, int tileno)
{
int p, q, i;
int compno, resno, pino;
int maxres = 0;
pi_iterator_t *pi;
j2k_tcp_t *tcp;
j2k_tccp_t *tccp;
tcp = &cp->tcps[tileno];
pi = (pi_iterator_t *) malloc((tcp->numpocs + 1) * sizeof(pi_iterator_t));
for (pino = 0; pino < tcp->numpocs + 1; pino++) { /* change */
p = tileno % cp->tw;
q = tileno / cp->tw;
pi[pino].tx0 = int_max(cp->tx0 + p * cp->tdx, img->x0);
pi[pino].ty0 = int_max(cp->ty0 + q * cp->tdy, img->y0);
pi[pino].tx1 = int_min(cp->tx0 + (p + 1) * cp->tdx, img->x1);
pi[pino].ty1 = int_min(cp->ty0 + (q + 1) * cp->tdy, img->y1);
pi[pino].numcomps = img->numcomps;
pi[pino].comps = (pi_comp_t *) malloc(img->numcomps * sizeof(pi_comp_t));
for (compno = 0; compno < pi->numcomps; compno++) {
int tcx0, tcy0, tcx1, tcy1;
pi_comp_t *comp = &pi[pino].comps[compno];
tccp = &tcp->tccps[compno];
comp->dx = img->comps[compno].dx;
comp->dy = img->comps[compno].dy;
comp->numresolutions = tccp->numresolutions;
comp->resolutions = (pi_resolution_t *) malloc(comp->numresolutions * sizeof(pi_resolution_t));
tcx0 = int_ceildiv(pi->tx0, comp->dx);
tcy0 = int_ceildiv(pi->ty0, comp->dy);
tcx1 = int_ceildiv(pi->tx1, comp->dx);
tcy1 = int_ceildiv(pi->ty1, comp->dy);
if (comp->numresolutions > maxres) {
maxres = comp->numresolutions;
}
for (resno = 0; resno < comp->numresolutions; resno++) {
int levelno;
int rx0, ry0, rx1, ry1;
int px0, py0, px1, py1;
pi_resolution_t *res = &comp->resolutions[resno];
if (tccp->csty & J2K_CCP_CSTY_PRT) {
res->pdx = tccp->prcw[resno];
res->pdy = tccp->prch[resno];
} else {
res->pdx = 15;
res->pdy = 15;
}
levelno = comp->numresolutions - 1 - resno;
rx0 = int_ceildivpow2(tcx0, levelno);
ry0 = int_ceildivpow2(tcy0, levelno);
rx1 = int_ceildivpow2(tcx1, levelno);
ry1 = int_ceildivpow2(tcy1, levelno);
px0 = int_floordivpow2(rx0, res->pdx) << res->pdx;
py0 = int_floordivpow2(ry0, res->pdy) << res->pdy;
px1 = int_ceildivpow2(rx1, res->pdx) << res->pdx;
py1 = int_ceildivpow2(ry1, res->pdy) << res->pdy;
res->pw = (px1 - px0) >> res->pdx;
res->ph = (py1 - py0) >> res->pdy;
}
}
tccp = &tcp->tccps[0];
pi[pino].step_p=1;
pi[pino].step_c=100*pi[pino].step_p;
pi[pino].step_r=img->numcomps*pi[pino].step_c;
pi[pino].step_l=maxres*pi[pino].step_r;
if (pino==0)
{
pi[pino].include = (short int*)malloc(img->numcomps*maxres*tcp->numlayers*100*sizeof(short int));
for (i=0 ; i<img->numcomps*maxres*tcp->numlayers*100; i++)
pi[pino].include[i]=0;
}
/* pi[pino].include=(short int*)calloc(img->numcomps*maxres*tcp->numlayers*1000,sizeof(short int));*/
else
pi[pino].include=pi[pino-1].include;
if (tcp->POC == 0) {
pi[pino].first = 1;
pi[pino].poc.resno0 = 0;
pi[pino].poc.compno0 = 0;
pi[pino].poc.layno1 = tcp->numlayers;
pi[pino].poc.resno1 = maxres;
pi[pino].poc.compno1 = img->numcomps;
pi[pino].poc.prg = tcp->prg;
} else {
pi[pino].first = 1;
pi[pino].poc.resno0 = tcp->pocs[pino].resno0;
pi[pino].poc.compno0 = tcp->pocs[pino].compno0;
pi[pino].poc.layno1 = tcp->pocs[pino].layno1;
pi[pino].poc.resno1 = tcp->pocs[pino].resno1;
pi[pino].poc.compno1 = tcp->pocs[pino].compno1;
pi[pino].poc.prg = tcp->pocs[pino].prg;
}
}
return pi;
}
/* <summary>
* Get next packet in layer-resolution-component-precinct order.
*
* pi: packet iterator to modify
* </summary> */
int pi_next_lrcp(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
comp = &pi->comps[pi->compno];
res = &comp->resolutions[pi->resno];
goto skip;
} else {
pi->first = 0;
}
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
comp = &pi->comps[pi->compno];
if (pi->resno >= comp->numresolutions) {
continue;
}
res = &comp->resolutions[pi->resno];
for (pi->precno = 0; pi->precno < res->pw * res->ph; pi->precno++)
{
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
return 0;
}
/* <summary>
* Get next packet in resolution-layer-component-precinct order.
*
* pi: packet iterator to modify
* </summary> */
int pi_next_rlcp(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
comp = &pi->comps[pi->compno];
res = &comp->resolutions[pi->resno];
goto skip;
} else {
pi->first = 0;
}
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
pi->compno++) {
comp = &pi->comps[pi->compno];
if (pi->resno >= comp->numresolutions) {
continue;
}
res = &comp->resolutions[pi->resno];
for (pi->precno = 0; pi->precno < res->pw * res->ph; pi->precno++) {
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
return 0;
}
/* <summary>
* Get next packet in resolution-precinct-component-layer order.
*
* pi: packet iterator to modify
* </summary> */
int pi_next_rpcl(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
goto skip;
} else {
int compno, resno;
pi->first = 0;
pi->dx = 0;
pi->dy = 0;
for (compno = 0; compno < pi->numcomps; compno++) {
comp = &pi->comps[compno];
for (resno = 0; resno < comp->numresolutions; resno++) {
int dx, dy;
res = &comp->resolutions[resno];
dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
}
}
}
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
for (pi->y = pi->ty0; pi->y < pi->ty1; pi->y += pi->dy - (pi->y % pi->dy)) {
for (pi->x = pi->tx0; pi->x < pi->tx1; pi->x += pi->dx - (pi->x % pi->dx)) {
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
int levelno;
int trx0, try0;
int rpx, rpy;
int prci, prcj;
comp = &pi->comps[pi->compno];
if (pi->resno >= comp->numresolutions) {
continue;
}
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!(pi->x % (comp->dx << rpx) == 0 || (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
continue;
}
if (!(pi->y % (comp->dy << rpy) == 0 || (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
continue;
}
prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
res->pdx) - int_floordivpow2(trx0, res->pdx);
prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
res->pdy) - int_floordivpow2(try0, res->pdy);
pi->precno = prci + prcj * res->pw;
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
}
return 0;
}
/* <summary>
* Get next packet in precinct-component-resolution-layer order.
*
* pi: packet iterator to modify
* </summary> */
int pi_next_pcrl(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
comp = &pi->comps[pi->compno];
goto skip;
} else {
int compno, resno;
pi->first = 0;
pi->dx = 0;
pi->dy = 0;
for (compno = 0; compno < pi->numcomps; compno++) {
comp = &pi->comps[compno];
for (resno = 0; resno < comp->numresolutions; resno++) {
int dx, dy;
res = &comp->resolutions[resno];
dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
}
}
}
for (pi->y = pi->ty0; pi->y < pi->ty1; pi->y += pi->dy - (pi->y % pi->dy)) {
for (pi->x = pi->tx0; pi->x < pi->tx1; pi->x += pi->dx - (pi->x % pi->dx)) {
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1; pi->compno++) {
comp = &pi->comps[pi->compno];
for (pi->resno = pi->poc.resno0; pi->resno < int_min(pi->poc.resno1, comp->numresolutions); pi->resno++) {
int levelno;
int trx0, try0;
int rpx, rpy;
int prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!(pi->x % (comp->dx << rpx) == 0 || (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
continue;
}
if (!(pi->y % (comp->dy << rpy) == 0 || (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
continue;
}
prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) - int_floordivpow2(trx0, res->pdx);
prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) - int_floordivpow2(try0, res->pdy);
pi->precno = prci + prcj * res->pw;
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
if (! pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
}
return 0;
}
/* <summary>
* Get next packet in component-precinct-resolution-layer order.
*
* pi: packet iterator to modify
* </summary> */
int pi_next_cprl(pi_iterator_t * pi)
{
pi_comp_t *comp;
pi_resolution_t *res;
if (!pi->first) {
comp = &pi->comps[pi->compno];
goto skip;
} else {
pi->first = 0;
}
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
pi->compno++) {
int resno;
comp = &pi->comps[pi->compno];
pi->dx = 0;
pi->dy = 0;
for (resno = 0; resno < comp->numresolutions; resno++) {
int dx, dy;
res = &comp->resolutions[resno];
dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
}
for (pi->y = pi->ty0; pi->y < pi->ty1;
pi->y += pi->dy - (pi->y % pi->dy)) {
for (pi->x = pi->tx0; pi->x < pi->tx1;
pi->x += pi->dx - (pi->x % pi->dx)) {
for (pi->resno = pi->poc.resno0;
pi->resno < int_min(pi->poc.resno1, comp->numresolutions);
pi->resno++) {
int levelno;
int trx0, try0;
int rpx, rpy;
int prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if (!(pi->x % (comp->dx << rpx) == 0 || (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
continue;
}
if (!(pi->y % (comp->dy << rpy) == 0 || (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
continue;
}
prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) - int_floordivpow2(trx0, res->pdx);
prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) - int_floordivpow2(try0, res->pdy);
pi->precno = prci + prcj * res->pw;
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
if (! pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
return 1;
}
skip:;
}
}
}
}
}
return 0;
}
/* <summary>
* Get next packet.
*
* pi: packet iterator to modify
* </summary> */
int pi_next(pi_iterator_t * pi)
{
switch (pi->poc.prg) {
case 0:
return pi_next_lrcp(pi);
case 1:
return pi_next_rlcp(pi);
case 2:
return pi_next_rpcl(pi);
case 3:
return pi_next_pcrl(pi);
case 4:
return pi_next_cprl(pi);
}
return 0;
}

View File

@ -1,72 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __PI_H
#define __PI_H
#include "j2k.h"
#include "tcd.h"
typedef struct {
int pdx, pdy;
int pw, ph;
} pi_resolution_t;
typedef struct {
int dx, dy;
int numresolutions;
pi_resolution_t *resolutions;
} pi_comp_t;
typedef struct {
short int *include; /* precise if the packet has been already used (usefull for progression order change) */
int step_l, step_r, step_c, step_p; /* different steps (layer, resolution, component, precinct) to localize the packet in the include vector */
int compno, resno, precno, layno; /* component, resolution, precinct and layer that indentify the packet */
int first; /* 0 if the first packet */
j2k_poc_t poc;
int numcomps;
pi_comp_t *comps;
int tx0, ty0, tx1, ty1;
int x, y, dx, dy;
} pi_iterator_t; /* packet iterator */
/*
* Create a packet iterator
* img: raw image for which the packets will be listed
* cp: coding paremeters
* tileno: number that identifies the tile for which to list the packets
* return value: returns a packet iterator that points to the first packet of the tile
*/
pi_iterator_t *pi_create(j2k_image_t * img, j2k_cp_t * cp, int tileno);
/*
* Modify the packet iterator to point to the next packet
* pi: packet iterator to modify
* return value: returns 0 if pi pointed to the last packet or else returns 1
*/
int pi_next(pi_iterator_t * pi);
#endif

View File

@ -1,984 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "t1.h"
#include "j2k.h"
#include "mqc.h"
#include "raw.h" /* Antonin */
#include "int.h"
#include "mct.h"
#include "dwt.h"
#include "fix.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define T1_MAXCBLKW 1024
#define T1_MAXCBLKH 1024
#define T1_SIG_NE 0x0001
#define T1_SIG_SE 0x0002
#define T1_SIG_SW 0x0004
#define T1_SIG_NW 0x0008
#define T1_SIG_N 0x0010
#define T1_SIG_E 0x0020
#define T1_SIG_S 0x0040
#define T1_SIG_W 0x0080
#define T1_SIG_OTH (T1_SIG_N|T1_SIG_NE|T1_SIG_E|T1_SIG_SE|T1_SIG_S|T1_SIG_SW|T1_SIG_W|T1_SIG_NW)
#define T1_SIG_PRIM (T1_SIG_N|T1_SIG_E|T1_SIG_S|T1_SIG_W)
#define T1_SGN_N 0x0100
#define T1_SGN_E 0x0200
#define T1_SGN_S 0x0400
#define T1_SGN_W 0x0800
#define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W)
#define T1_SIG 0x1000
#define T1_REFINE 0x2000
#define T1_VISIT 0x4000
#define T1_NUMCTXS_AGG 1
#define T1_NUMCTXS_ZC 9
#define T1_NUMCTXS_MAG 3
#define T1_NUMCTXS_SC 5
#define T1_NUMCTXS_UNI 1
#define T1_CTXNO_AGG 0
#define T1_CTXNO_ZC (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
#define T1_CTXNO_MAG (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
#define T1_CTXNO_SC (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
#define T1_CTXNO_UNI (T1_CTXNO_SC+T1_NUMCTXS_SC)
#define T1_NUMCTXS (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
#define T1_NMSEDEC_BITS 7
#define T1_NMSEDEC_FRACBITS (T1_NMSEDEC_BITS-1)
/* add TONY */
#define T1_TYPE_MQ 0
#define T1_TYPE_RAW 1
/* dda */
static int t1_lut_ctxno_zc[1024];
static int t1_lut_ctxno_sc[256];
static int t1_lut_ctxno_mag[4096];
static int t1_lut_spb[256];
static int t1_lut_nmsedec_sig[1 << T1_NMSEDEC_BITS];
static int t1_lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS];
static int t1_lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
static int t1_lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
static int t1_data[T1_MAXCBLKH][T1_MAXCBLKH];
static int t1_flags[T1_MAXCBLKH + 2][T1_MAXCBLKH + 2];
int t1_getctxno_zc(int f, int orient)
{
return t1_lut_ctxno_zc[(orient << 8) | (f & T1_SIG_OTH)];
}
int t1_getctxno_sc(int f)
{
return t1_lut_ctxno_sc[(f & (T1_SIG_PRIM | T1_SGN)) >> 4];
}
int t1_getctxno_mag(int f)
{
return t1_lut_ctxno_mag[(f & T1_SIG_OTH) | (((f & T1_REFINE) != 0) << 11)];
}
int t1_getspb(int f)
{
return t1_lut_spb[(f & (T1_SIG_PRIM | T1_SGN)) >> 4];
}
int t1_getnmsedec_sig(int x, int bitpos)
{
if (bitpos > T1_NMSEDEC_FRACBITS)
return t1_lut_nmsedec_sig[(x >> (bitpos - T1_NMSEDEC_FRACBITS)) & ((1 << T1_NMSEDEC_BITS) - 1)];
else
return t1_lut_nmsedec_sig0[x & ((1 << T1_NMSEDEC_BITS) - 1)];
}
int t1_getnmsedec_ref(int x, int bitpos)
{
if (bitpos > T1_NMSEDEC_FRACBITS)
return t1_lut_nmsedec_ref[(x >> (bitpos - T1_NMSEDEC_FRACBITS)) & ((1 << T1_NMSEDEC_BITS) - 1)];
else
return t1_lut_nmsedec_ref0[x & ((1 << T1_NMSEDEC_BITS) - 1)];
}
void t1_updateflags(int *fp, int s)
{
int *np = fp - (T1_MAXCBLKW + 2);
int *sp = fp + (T1_MAXCBLKW + 2);
np[-1] |= T1_SIG_SE;
np[1] |= T1_SIG_SW;
sp[-1] |= T1_SIG_NE;
sp[1] |= T1_SIG_NW;
*np |= T1_SIG_S;
*sp |= T1_SIG_N;
fp[-1] |= T1_SIG_E;
fp[1] |= T1_SIG_W;
if (s) {
*np |= T1_SGN_S;
*sp |= T1_SGN_N;
fp[-1] |= T1_SGN_E;
fp[1] |= T1_SGN_W;
}
}
void t1_enc_sigpass_step(int *fp, int *dp, int orient, int bpno, int one, int *nmsedec, char type, int vsc)
{
int v, flag;
flag = vsc ? ((*fp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*fp);
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
v = int_abs(*dp) & one ? 1 : 0;
if (type == T1_TYPE_RAW) { /* BYPASS/LAZY MODE */
mqc_setcurctx(t1_getctxno_zc(flag, orient)); /* ESSAI */
mqc_bypass_enc(v);
} else {
mqc_setcurctx(t1_getctxno_zc(flag, orient));
mqc_encode(v);
}
if (v) {
v = *dp < 0 ? 1 : 0;
*nmsedec += t1_getnmsedec_sig(int_abs(*dp), bpno + T1_NMSEDEC_FRACBITS);
if (type == T1_TYPE_RAW) { /* BYPASS/LAZY MODE */
mqc_setcurctx(t1_getctxno_sc(flag)); /* ESSAI */
mqc_bypass_enc(v);
} else {
mqc_setcurctx(t1_getctxno_sc(flag));
mqc_encode(v ^ t1_getspb(flag));
}
t1_updateflags(fp, v);
*fp |= T1_SIG;
}
*fp |= T1_VISIT;
}
}
void t1_dec_sigpass_step(int *fp, int *dp, int orient, int oneplushalf, char type, int vsc)
{
int v, flag;
flag =
vsc ? ((*fp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S)))
: (*fp);
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
if (type == T1_TYPE_RAW) {
if (raw_decode()) {
v = raw_decode(); /* ESSAI */
*dp = v ? -oneplushalf : oneplushalf;
t1_updateflags(fp, v);
*fp |= T1_SIG;
}
} else {
mqc_setcurctx(t1_getctxno_zc(flag, orient));
if (mqc_decode()) {
mqc_setcurctx(t1_getctxno_sc(flag));
v = mqc_decode() ^ t1_getspb(flag);
*dp = v ? -oneplushalf : oneplushalf;
t1_updateflags(fp, v);
*fp |= T1_SIG;
}
}
*fp |= T1_VISIT;
}
} /* VSC and BYPASS by Antonin */
void t1_enc_sigpass(int w, int h, int bpno, int orient, int *nmsedec, char type, int cblksty)
{
int i, j, k, one, vsc;
*nmsedec = 0;
one = 1 << (bpno + T1_NMSEDEC_FRACBITS);
for (k = 0; k < h; k += 4) {
for (i = 0; i < w; i++) {
for (j = k; j < k + 4 && j < h; j++) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
t1_enc_sigpass_step(&t1_flags[1 + j][1 + i], &t1_data[j][i], orient, bpno, one, nmsedec, type, vsc);
}
}
}
}
void t1_dec_sigpass(int w, int h, int bpno, int orient, char type, int cblksty)
{
int i, j, k, one, half, oneplushalf, vsc;
one = 1 << bpno;
half = one >> 1;
oneplushalf = one | half;
for (k = 0; k < h; k += 4) {
for (i = 0; i < w; i++) {
for (j = k; j < k + 4 && j < h; j++) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC)
&& (j == k + 3 || j == h - 1)) ? 1 : 0;
t1_dec_sigpass_step(&t1_flags[1 + j][1 + i], &t1_data[j][i], orient, oneplushalf, type, vsc);
}
}
}
} /* VSC and BYPASS by Antonin */
void t1_enc_refpass_step(int *fp, int *dp, int bpno, int one, int *nmsedec, char type, int vsc)
{
int v, flag;
flag = vsc ? ((*fp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*fp);
if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
*nmsedec += t1_getnmsedec_ref(int_abs(*dp), bpno + T1_NMSEDEC_FRACBITS);
v = int_abs(*dp) & one ? 1 : 0;
if (type == T1_TYPE_RAW) { /* BYPASS/LAZY MODE */
mqc_setcurctx(t1_getctxno_mag(flag)); /* ESSAI */
mqc_bypass_enc(v);
} else {
mqc_setcurctx(t1_getctxno_mag(flag));
mqc_encode(v);
}
*fp |= T1_REFINE;
}
}
void t1_dec_refpass_step(int *fp, int *dp, int poshalf, int neghalf, char type, int vsc)
{
int v, t, flag;
flag = vsc ? ((*fp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*fp);
if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
if (type == T1_TYPE_RAW) {
mqc_setcurctx(t1_getctxno_mag(flag)); /* ESSAI */
v = raw_decode();
} else {
mqc_setcurctx(t1_getctxno_mag(flag));
v = mqc_decode();
}
t = v ? poshalf : neghalf;
*dp += *dp < 0 ? -t : t;
*fp |= T1_REFINE;
}
} /* VSC and BYPASS by Antonin */
void t1_enc_refpass(int w, int h, int bpno, int *nmsedec, char type, int cblksty)
{
int i, j, k, one, vsc;
*nmsedec = 0;
one = 1 << (bpno + T1_NMSEDEC_FRACBITS);
for (k = 0; k < h; k += 4) {
for (i = 0; i < w; i++) {
for (j = k; j < k + 4 && j < h; j++) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
t1_enc_refpass_step(&t1_flags[1 + j][1 + i], &t1_data[j][i], bpno, one, nmsedec, type, vsc);
}
}
}
}
void t1_dec_refpass(int w, int h, int bpno, char type, int cblksty)
{
int i, j, k, one, poshalf, neghalf;
int vsc;
one = 1 << bpno;
poshalf = one >> 1;
neghalf = bpno > 0 ? -poshalf : -1;
for (k = 0; k < h; k += 4) {
for (i = 0; i < w; i++) {
for (j = k; j < k + 4 && j < h; j++) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
t1_dec_refpass_step(&t1_flags[1 + j][1 + i], &t1_data[j][i], poshalf, neghalf, type, vsc);
}
}
}
} /* VSC and BYPASS by Antonin */
void t1_enc_clnpass_step(int *fp, int *dp, int orient, int bpno, int one, int *nmsedec, int partial, int vsc)
{
int v, flag;
flag = vsc ? ((*fp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*fp);
if (partial)
goto label_partial;
if (!(*fp & (T1_SIG | T1_VISIT))) {
mqc_setcurctx(t1_getctxno_zc(flag, orient));
v = int_abs(*dp) & one ? 1 : 0;
mqc_encode(v);
if (v) {
label_partial:
*nmsedec += t1_getnmsedec_sig(int_abs(*dp), bpno + T1_NMSEDEC_FRACBITS);
mqc_setcurctx(t1_getctxno_sc(flag));
v = *dp < 0 ? 1 : 0;
mqc_encode(v ^ t1_getspb(flag));
t1_updateflags(fp, v);
*fp |= T1_SIG;
}
}
*fp &= ~T1_VISIT;
}
void t1_dec_clnpass_step(int *fp, int *dp, int orient, int oneplushalf, int partial, int vsc)
{
int v, flag;
flag = vsc ? ((*fp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*fp);
if (partial)
goto label_partial;
if (!(flag & (T1_SIG | T1_VISIT))) {
mqc_setcurctx(t1_getctxno_zc(flag, orient));
if (mqc_decode()) {
label_partial:
mqc_setcurctx(t1_getctxno_sc(flag));
v = mqc_decode() ^ t1_getspb(flag);
*dp = v ? -oneplushalf : oneplushalf;
t1_updateflags(fp, v);
*fp |= T1_SIG;
}
}
*fp &= ~T1_VISIT;
} /* VSC and BYPASS by Antonin */
void t1_enc_clnpass(int w, int h, int bpno, int orient, int *nmsedec, int cblksty)
{
int i, j, k, one, agg, runlen, vsc;
*nmsedec = 0;
one = 1 << (bpno + T1_NMSEDEC_FRACBITS);
for (k = 0; k < h; k += 4) {
for (i = 0; i < w; i++) {
if (k + 3 < h) {
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
agg = !(t1_flags[1 + k][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|| t1_flags[1 + k + 1][1 + i] & (T1_SIG | T1_VISIT |
T1_SIG_OTH) || t1_flags[1 + k + 2][1 + i] & (T1_SIG | T1_VISIT |
T1_SIG_OTH) || (t1_flags[1 + k + 3][1 + i] & (~(T1_SIG_S | T1_SIG_SE
| T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
} else {
agg = !(t1_flags[1 + k][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|| t1_flags[1 + k + 1][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|| t1_flags[1 + k + 2][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|| t1_flags[1 + k + 3][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH));
}
} else {
agg = 0;
}
if (agg) {
for (runlen = 0; runlen < 4; runlen++) {
if (int_abs(t1_data[k + runlen][i]) & one)
break;
}
mqc_setcurctx(T1_CTXNO_AGG);
mqc_encode(runlen != 4);
if (runlen == 4) {
continue;
}
mqc_setcurctx(T1_CTXNO_UNI);
mqc_encode(runlen >> 1);
mqc_encode(runlen & 1);
} else {
runlen = 0;
}
for (j = k + runlen; j < k + 4 && j < h; j++) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
t1_enc_clnpass_step(&t1_flags[1 + j][1 + i], &t1_data[j][i], orient, bpno, one, nmsedec, agg
&& (j == k + runlen), vsc);
}
}
}
}
void t1_dec_clnpass(int w, int h, int bpno, int orient, int cblksty)
{
int i, j, k, one, half, oneplushalf, agg, runlen, vsc;
int segsym = cblksty & J2K_CCP_CBLKSTY_SEGSYM;
one = 1 << bpno;
half = one >> 1;
oneplushalf = one | half;
for (k = 0; k < h; k += 4) {
for (i = 0; i < w; i++) {
if (k + 3 < h) {
if (cblksty & J2K_CCP_CBLKSTY_VSC) {
agg = !(t1_flags[1 + k][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|| t1_flags[1 + k + 1][1 + i] & (T1_SIG | T1_VISIT |
T1_SIG_OTH) || t1_flags[1 + k + 2][1 + i] & (T1_SIG | T1_VISIT |
T1_SIG_OTH) || (t1_flags[1 + k + 3][1 + i] & (~(T1_SIG_S | T1_SIG_SE |
T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH));
} else {
agg = !(t1_flags[1 + k][1 + i] & (T1_SIG | T1_VISIT | T1_SIG_OTH)
|| t1_flags[1 + k + 1][1 + i] & (T1_SIG | T1_VISIT |
T1_SIG_OTH) || t1_flags[1 + k + 2][1 + i] & (T1_SIG | T1_VISIT |
T1_SIG_OTH) || t1_flags[1 + k + 3][1 + i] & (T1_SIG | T1_VISIT |
T1_SIG_OTH));
}
} else {
agg = 0;
}
if (agg) {
mqc_setcurctx(T1_CTXNO_AGG);
if (!mqc_decode()) {
continue;
}
mqc_setcurctx(T1_CTXNO_UNI);
runlen = mqc_decode();
runlen = (runlen << 1) | mqc_decode();
} else {
runlen = 0;
}
for (j = k + runlen; j < k + 4 && j < h; j++) {
vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0;
t1_dec_clnpass_step(&t1_flags[1 + j][1 + i], &t1_data[j][i], orient, oneplushalf,
agg && (j == k + runlen), vsc);
}
}
}
if (segsym) {
int v = 0;
mqc_setcurctx(T1_CTXNO_UNI);
v = mqc_decode();
v = (v << 1) | mqc_decode();
v = (v << 1) | mqc_decode();
v = (v << 1) | mqc_decode();
/* if (v!=0xa)
{
fprintf(stderr, "warning: bad segmentation symbol %x\n",v);
} */
}
} /* VSC and BYPASS by Antonin */
double t1_getwmsedec(int nmsedec, int compno, int level, int orient, int bpno, int qmfbid, double stepsize)
{
double w1, w2, wmsedec;
if (qmfbid == 1) {
w1 = mct_getnorm(compno);
w2 = dwt_getnorm(level, orient);
} else { /* if (qmfbid == 0) */
w1 = mct_getnorm_real(compno);
w2 = dwt_getnorm_real(level, orient);
}
wmsedec = w1 * w2 * stepsize * (1 << bpno);
wmsedec *= wmsedec * nmsedec / 8192.0;
return wmsedec;
}
void t1_encode_cblk(tcd_cblk_t * cblk, int orient, int compno, int level, int qmfbid, double stepsize, int cblksty)
{
int i, j;
int w, h;
int passno;
int bpno, passtype;
int max;
int nmsedec;
double cumwmsedec = 0;
char type = T1_TYPE_MQ;
w = cblk->x1 - cblk->x0;
h = cblk->y1 - cblk->y0;
max = 0;
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
max = int_max(max, int_abs(t1_data[j][i]));
}
}
cblk->numbps = max ? (int_floorlog2(max) + 1) - T1_NMSEDEC_FRACBITS : 0;
for (i = 0; i < sizeof(t1_flags) / sizeof(int); i++)
((int *) t1_flags)[i] = 0;
bpno = cblk->numbps - 1;
passtype = 2;
mqc_resetstates();
mqc_setstate(T1_CTXNO_UNI, 0, 46);
mqc_setstate(T1_CTXNO_AGG, 0, 3);
mqc_setstate(T1_CTXNO_ZC, 0, 4);
mqc_init_enc(cblk->data);
for (passno = 0; bpno >= 0; passno++) {
tcd_pass_t *pass = &cblk->passes[passno];
int correction = 3;
type = ((bpno < (cblk->numbps - 4)) && (passtype < 2)
&& (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
switch (passtype) {
case 0:
t1_enc_sigpass(w, h, bpno, orient, &nmsedec, type, cblksty);
break;
case 1:
t1_enc_refpass(w, h, bpno, &nmsedec, type, cblksty);
break;
case 2:
t1_enc_clnpass(w, h, bpno, orient, &nmsedec, cblksty);
/* code switch SEGMARK (i.e. SEGSYM) */
if (cblksty & J2K_CCP_CBLKSTY_SEGSYM)
mqc_segmark_enc();
break;
}
cumwmsedec += t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid, stepsize);
/* Code switch "RESTART" (i.e. TERMALL) */
if ((cblksty & J2K_CCP_CBLKSTY_TERMALL) && !((passtype == 2) && (bpno - 1 < 0)))
{
if (type == T1_TYPE_RAW)
{
mqc_flush();
correction=1;
/* correction = mqc_bypass_flush_enc();*/
}
else
{ /* correction = mqc_restart_enc(); */
mqc_flush();
correction = 1;
}
pass->term = 1;
} else
{
if (((bpno < (cblk->numbps - 4) && (passtype > 0)) || ((bpno == (cblk->numbps - 4)) && (passtype == 2)))
&& (cblksty & J2K_CCP_CBLKSTY_LAZY))
{
if (type == T1_TYPE_RAW)
{
mqc_flush();
correction=1;
/* correction = mqc_bypass_flush_enc();*/
}
else
{ /* correction = mqc_restart_enc();*/
mqc_flush();
correction=1;
}
pass->term = 1;
} else
{
pass->term = 0;
}
}
if (++passtype == 3)
{
passtype = 0;
bpno--;
}
if (pass->term && bpno > 0) {
type = ((bpno < (cblk->numbps - 4)) && (passtype < 2)
&& (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
if (type == T1_TYPE_RAW)
mqc_bypass_init_enc();
else
mqc_restart_init_enc();
}
pass->distortiondec = cumwmsedec;
pass->rate = mqc_numbytes() + correction; /* FIXME */
pass->len = pass->rate - (passno == 0 ? 0 : cblk->passes[passno - 1].rate);
/* Code-switch "RESET" */
if (cblksty & J2K_CCP_CBLKSTY_RESET)
mqc_reset_enc();
}
/* Code switch "ERTERM" (i.e. PTERM) */
if (cblksty & J2K_CCP_CBLKSTY_PTERM)
mqc_erterm_enc();
else /* Default coding */ if (!(cblksty & J2K_CCP_CBLKSTY_LAZY))
mqc_flush();
cblk->totalpasses = passno;
}
void t1_decode_cblk(tcd_cblk_t * cblk, int orient, int roishift, int cblksty)
{
int i;
int w, h;
int bpno, passtype;
int segno, passno;
/* add TONY */
char type = T1_TYPE_MQ;
/* dda */
for (i = 0; i < sizeof(t1_data) / sizeof(int); i++)
((int *) t1_data)[i] = 0;
for (i = 0; i < sizeof(t1_flags) / sizeof(int); i++)
((int *) t1_flags)[i] = 0;
w = cblk->x1 - cblk->x0;
h = cblk->y1 - cblk->y0;
bpno = roishift + cblk->numbps - 1;
passtype = 2;
mqc_resetstates();
mqc_setstate(T1_CTXNO_UNI, 0, 46);
mqc_setstate(T1_CTXNO_AGG, 0, 3);
mqc_setstate(T1_CTXNO_ZC, 0, 4);
for (segno = 0; segno < cblk->numsegs; segno++) {
tcd_seg_t *seg = &cblk->segs[segno];
/* add TONY */
type = ((bpno <= (cblk->numbps - 1) - 4) && (passtype < 2)
&& (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : T1_TYPE_MQ;
if (type == T1_TYPE_RAW)
raw_init_dec(seg->data, seg->len);
else
mqc_init_dec(seg->data, seg->len);
/* dda */
for (passno = 0; passno < seg->numpasses; passno++) {
switch (passtype) {
case 0:
t1_dec_sigpass(w, h, bpno, orient, type, cblksty);
break;
case 1:
t1_dec_refpass(w, h, bpno, type, cblksty);
break;
case 2:
t1_dec_clnpass(w, h, bpno, orient, cblksty);
break;
}
if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ)
mqc_reset_enc();
if (++passtype == 3) {
passtype = 0;
bpno--;
}
}
}
}
void t1_encode_cblks(tcd_tile_t * tile, j2k_tcp_t * tcp)
{
int compno, resno, bandno, precno, cblkno;
int x, y, i, j, orient;
tcd_tilecomp_t *tilec;
tcd_resolution_t *res;
tcd_band_t *band;
tcd_precinct_t *prc;
tcd_cblk_t *cblk;
for (compno = 0; compno < tile->numcomps; compno++) {
tilec = &tile->comps[compno];
for (resno = 0; resno < tilec->numresolutions; resno++) {
res = &tilec->resolutions[resno];
for (bandno = 0; bandno < res->numbands; bandno++) {
band = &res->bands[bandno];
for (precno = 0; precno < res->pw * res->ph; precno++) {
prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
cblk = &prc->cblks[cblkno];
if (band->bandno == 0) {
x = cblk->x0 - band->x0;
y = cblk->y0 - band->y0;
} else if (band->bandno == 1) {
tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
x = pres->x1 - pres->x0 + cblk->x0 - band->x0;
y = cblk->y0 - band->y0;
} else if (band->bandno == 2) {
tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
x = cblk->x0 - band->x0;
y = pres->y1 - pres->y0 + cblk->y0 - band->y0;
} else { /* if (band->bandno == 3) */
tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
x = pres->x1 - pres->x0 + cblk->x0 - band->x0;
y = pres->y1 - pres->y0 + cblk->y0 - band->y0;
}
if (tcp->tccps[compno].qmfbid == 1) {
for (j = 0; j < cblk->y1 - cblk->y0; j++) {
for (i = 0; i < cblk->x1 - cblk->x0; i++) {
t1_data[j][i] = tilec->data[(x + i) + (y + j) * (tilec->x1 - tilec->x0)] << T1_NMSEDEC_FRACBITS;
}
}
} else if (tcp->tccps[compno].qmfbid == 0) {
for (j = 0; j < cblk->y1 - cblk->y0; j++) {
for (i = 0; i < cblk->x1 - cblk->x0; i++) {
t1_data[j][i] = fix_mul(tilec->data[x + i + (y + j) * (tilec->x1 - tilec->x0)],
8192 * 8192 / band->stepsize) >> (13 - T1_NMSEDEC_FRACBITS);
}
}
}
orient = band->bandno; /* FIXME */
if (orient == 2) {
orient = 1;
} else if (orient == 1) {
orient = 2;
}
t1_encode_cblk(cblk, orient, compno,
tilec->numresolutions - 1 - resno,
tcp->tccps[compno].qmfbid, band->stepsize,
tcp->tccps[compno].cblksty);
} /* cblkno */
} /* precno */
} /* bandno */
} /* resno */
} /* compo */
}
void t1_decode_cblks(tcd_tile_t * tile, j2k_tcp_t * tcp)
{
int compno, resno, bandno, precno, cblkno;
for (compno = 0; compno < tile->numcomps; compno++)
{
tcd_tilecomp_t *tilec = &tile->comps[compno];
for (resno = 0; resno < tilec->numresolutions; resno++)
{
tcd_resolution_t *res = &tilec->resolutions[resno];
for (bandno = 0; bandno < res->numbands; bandno++)
{
tcd_band_t *band = &res->bands[bandno];
for (precno = 0; precno < res->pw * res->ph; precno++)
{
tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++)
{
int x, y, i, j, orient;
tcd_cblk_t *cblk = &prc->cblks[cblkno];
orient = band->bandno; /* FIXME */
if (orient == 2)
orient = 1;
else if (orient == 1)
orient = 2;
t1_decode_cblk(cblk, orient, tcp->tccps[compno].roishift, tcp->tccps[compno].cblksty);
if (band->bandno == 0) {
x = cblk->x0 - band->x0;
y = cblk->y0 - band->y0;
} else if (band->bandno == 1) {
tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
x = pres->x1 - pres->x0 + cblk->x0 - band->x0;
y = cblk->y0 - band->y0;
} else if (band->bandno == 2) {
tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
x = cblk->x0 - band->x0;
y = pres->y1 - pres->y0 + cblk->y0 - band->y0;
} else { /* if (band->bandno == 3) */
tcd_resolution_t *pres = &tilec->resolutions[resno - 1];
x = pres->x1 - pres->x0 + cblk->x0 - band->x0;
y = pres->y1 - pres->y0 + cblk->y0 - band->y0;
}
if (tcp->tccps[compno].roishift)
{
int thresh, val, mag;
thresh = 1 << tcp->tccps[compno].roishift;
for (j = 0; j < cblk->y1 - cblk->y0; j++) {
for (i = 0; i < cblk->x1 - cblk->x0; i++) {
val = t1_data[j][i];
mag = int_abs(val);
if (mag >= thresh) {
mag >>= tcp->tccps[compno].roishift;
t1_data[j][i] = val < 0 ? -mag : mag;
}
}
}
}
if (tcp->tccps[compno].qmfbid == 1) {
for (j = 0; j < cblk->y1 - cblk->y0; j++) {
for (i = 0; i < cblk->x1 - cblk->x0; i++) {
tilec->data[x + i + (y + j) * (tilec->x1 - tilec->x0)] = t1_data[j][i];
}
}
} else /* if (tcp->tccps[compno].qmfbid == 0)*/ {
for (j = 0; j < cblk->y1 - cblk->y0; j++) {
for (i = 0; i < cblk->x1 - cblk->x0; i++) {
if (t1_data[j][i] == 0) {
tilec->data[x + i + (y + j) * (tilec->x1 - tilec->x0)] = 0;
} else {
tilec->data[x + i + (y + j) * (tilec->x1 - tilec->x0)] = fix_mul(t1_data[j][i] << 13, band->stepsize);
}
}
}
}
}
}
}
}
}
}
int t1_init_ctxno_zc(int f, int orient)
{
int h, v, d, n, t, hv;
n = 0;
h = ((f & T1_SIG_W) != 0) + ((f & T1_SIG_E) != 0);
v = ((f & T1_SIG_N) != 0) + ((f & T1_SIG_S) != 0);
d = ((f & T1_SIG_NW) != 0) + ((f & T1_SIG_NE) != 0) + ((f & T1_SIG_SE) != 0) + ((f & T1_SIG_SW) != 0);
switch (orient) {
case 2:
t = h;
h = v;
v = t;
case 0:
case 1:
if (!h) {
if (!v) {
if (!d)
n = 0;
else if (d == 1)
n = 1;
else
n = 2;
} else if (v == 1)
n = 3;
else
n = 4;
} else if (h == 1) {
if (!v) {
if (!d)
n = 5;
else
n = 6;
} else
n = 7;
} else
n = 8;
break;
case 3:
hv = h + v;
if (!d) {
if (!hv)
n = 0;
else if (hv == 1)
n = 1;
else
n = 2;
} else if (d == 1) {
if (!hv)
n = 3;
else if (hv == 1)
n = 4;
else
n = 5;
} else if (d == 2) {
if (!hv)
n = 6;
else
n = 7;
} else
n = 8;
break;
}
return T1_CTXNO_ZC + n;
}
int t1_init_ctxno_sc(int f)
{
int hc, vc, n;
n = 0;
hc = int_min(((f & (T1_SIG_E | T1_SGN_E)) == T1_SIG_E) + ((f & (T1_SIG_W | T1_SGN_W)) == T1_SIG_W),
1) - int_min(((f & (T1_SIG_E | T1_SGN_E)) == (T1_SIG_E | T1_SGN_E)) + ((f & (T1_SIG_W | T1_SGN_W)) ==
(T1_SIG_W | T1_SGN_W)), 1);
vc = int_min(((f & (T1_SIG_N | T1_SGN_N)) == T1_SIG_N) + ((f & (T1_SIG_S | T1_SGN_S)) == T1_SIG_S),
1) - int_min(((f & (T1_SIG_N | T1_SGN_N)) == (T1_SIG_N | T1_SGN_N)) + ((f & (T1_SIG_S | T1_SGN_S)) ==
(T1_SIG_S | T1_SGN_S)), 1);
if (hc < 0) {
hc = -hc;
vc = -vc;
}
if (!hc) {
if (vc == -1)
n = 1;
else if (!vc)
n = 0;
else
n = 1;
} else if (hc == 1) {
if (vc == -1)
n = 2;
else if (!vc)
n = 3;
else
n = 4;
}
return T1_CTXNO_SC + n;
}
int t1_init_ctxno_mag(int f)
{
int n;
if (!(f & T1_REFINE))
n = (f & (T1_SIG_OTH)) ? 1 : 0;
else
n = 2;
return T1_CTXNO_MAG + n;
}
int t1_init_spb(int f)
{
int hc, vc, n;
hc = int_min(((f & (T1_SIG_E | T1_SGN_E)) == T1_SIG_E) + ((f & (T1_SIG_W | T1_SGN_W)) == T1_SIG_W),
1) - int_min(((f & (T1_SIG_E | T1_SGN_E)) == (T1_SIG_E | T1_SGN_E)) + ((f & (T1_SIG_W | T1_SGN_W)) ==
(T1_SIG_W | T1_SGN_W)), 1);
vc = int_min(((f & (T1_SIG_N | T1_SGN_N)) == T1_SIG_N) + ((f & (T1_SIG_S | T1_SGN_S)) == T1_SIG_S),
1) - int_min(((f & (T1_SIG_N | T1_SGN_N)) == (T1_SIG_N | T1_SGN_N)) + ((f & (T1_SIG_S | T1_SGN_S)) ==
(T1_SIG_S | T1_SGN_S)), 1);
if (!hc && !vc)
n = 0;
else
n = (!(hc > 0 || (!hc && vc > 0)));
return n;
}
void t1_init_luts()
{
int i, j;
double u, v, t;
for (j = 0; j < 4; j++) {
for (i = 0; i < 256; ++i) {
t1_lut_ctxno_zc[(j << 8) | i] = t1_init_ctxno_zc(i, j);
}
}
for (i = 0; i < 256; i++) {
t1_lut_ctxno_sc[i] = t1_init_ctxno_sc(i << 4);
}
for (j = 0; j < 2; j++) {
for (i = 0; i < 2048; ++i) {
t1_lut_ctxno_mag[(j << 11) + i] =
t1_init_ctxno_mag((j ? T1_REFINE : 0) | i);
}
}
for (i = 0; i < 256; ++i) {
t1_lut_spb[i] = t1_init_spb(i << 4);
}
/* FIXME FIXME FIXME */
/* printf("nmsedec luts:\n"); */
for (i = 0; i < (1 << T1_NMSEDEC_BITS); i++) {
t = i / pow(2, T1_NMSEDEC_FRACBITS);
u = t;
v = t - 1.5;
t1_lut_nmsedec_sig[i] = int_max(0, (int) (floor((u * u - v * v) * pow(2,T1_NMSEDEC_FRACBITS) +
0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
t1_lut_nmsedec_sig0[i] = int_max(0, (int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) /
pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
u = t - 1.0;
if (i & (1 << (T1_NMSEDEC_BITS - 1))) {
v = t - 1.5;
} else {
v = t - 0.5;
}
t1_lut_nmsedec_ref[i] = int_max(0, (int) (floor((u * u - v * v) * pow(2,T1_NMSEDEC_FRACBITS) +
0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
t1_lut_nmsedec_ref0[i] = int_max(0, (int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) /
pow(2, T1_NMSEDEC_FRACBITS) * 8192.0));
}
}

View File

@ -1,625 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2002-2004, Yannick Verschueren
* Copyright (c) 2002-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "t2.h"
#include "tcd.h"
#include "bio.h"
#include "j2k.h"
#include "pi.h"
#include "tgt.h"
#include "int.h"
#include "cio.h"
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include <stdlib.h>
#define RESTART 0x04
extern jmp_buf j2k_error;
void t2_putcommacode(int n)
{
while (--n >= 0) {
bio_write(1, 1);
}
bio_write(0, 1);
}
int t2_getcommacode()
{
int n;
for (n = 0; bio_read(1); n++) {
}
return n;
}
/* <summary> */
/* Variable length code for signalling delta Zil (truncation point) */
/* <val> n : delta Zil */
/* <\summary> */
void t2_putnumpasses(int n)
{
if (n == 1) {
bio_write(0, 1);
} else if (n == 2) {
bio_write(2, 2);
} else if (n <= 5) {
bio_write(0xc | (n - 3), 4);
} else if (n <= 36) {
bio_write(0x1e0 | (n - 6), 9);
} else if (n <= 164) {
bio_write(0xff80 | (n - 37), 16);
}
}
int t2_getnumpasses()
{
int n;
if (!bio_read(1))
return 1;
if (!bio_read(1))
return 2;
if ((n = bio_read(2)) != 3)
return 3 + n;
if ((n = bio_read(5)) != 31)
return 6 + n;
return 37 + bio_read(7);
}
/*
* Encode a packet of a tile to a destination buffer
*
* Tile : the tile for which to write the packets
* tcp : the tile coding parameters
* compno : Identity of the packet --> component value
* resno : Identity of the packet --> resolution level value
* precno : Identity of the packet --> precinct value
* layno : Identity of the packet --> quality layer value
* dest : the destination buffer
* len : the length of the destination buffer
* info_IM : structure to create an index file
* tileno : number of the tile encoded
*/
int t2_encode_packet(tcd_tile_t * tile, j2k_tcp_t * tcp, int compno, int resno, int precno, int layno, unsigned char *dest,
int len, info_image * info_IM, int tileno)
{
int bandno, cblkno;
unsigned char *sop = 0, *eph = 0;
tcd_tilecomp_t *tilec = &tile->comps[compno];
tcd_resolution_t *res = &tilec->resolutions[resno];
unsigned char *c = dest;
/* <SOP 0xff91> */
if (tcp->csty & J2K_CP_CSTY_SOP) {
sop = (unsigned char *) malloc(6 * sizeof(unsigned char));
sop[0] = 255;
sop[1] = 145;
sop[2] = 0;
sop[3] = 4;
sop[4] = (info_IM->num % 65536) / 256;
sop[5] = (info_IM->num % 65536) % 256;
memcpy(c, sop, 6);
free(sop);
c += 6;
}
/* </SOP> */
if (!layno) {
for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
tgt_reset(prc->incltree);
tgt_reset(prc->imsbtree);
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
tcd_cblk_t *cblk = &prc->cblks[cblkno];
cblk->numpasses = 0;
tgt_setvalue(prc->imsbtree, cblkno, band->numbps - cblk->numbps);
}
}
}
bio_init_enc(c, len);
bio_write(1, 1); /* Empty header bit */
/* Writing Packet header */
for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
tcd_cblk_t *cblk = &prc->cblks[cblkno];
tcd_layer_t *layer = &cblk->layers[layno];
if (!cblk->numpasses && layer->numpasses) {
tgt_setvalue(prc->incltree, cblkno, layno);
}
}
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
tcd_cblk_t *cblk = &prc->cblks[cblkno];
tcd_layer_t *layer = &cblk->layers[layno];
int increment = 0;
int nump = 0;
int len = 0, passno;
/* cblk inclusion bits */
if (!cblk->numpasses) {
tgt_encode(prc->incltree, cblkno, layno + 1);
} else {
bio_write(layer->numpasses != 0, 1);
}
/* if cblk not included, go to the next cblk */
if (!layer->numpasses) {
continue;
}
/* if first instance of cblk --> zero bit-planes information */
if (!cblk->numpasses) {
cblk->numlenbits = 3;
tgt_encode(prc->imsbtree, cblkno, 999);
}
/* number of coding passes included */
t2_putnumpasses(layer->numpasses);
/* computation of the increase of the length indicator and insertion in the header */
for (passno = cblk->numpasses;
passno < cblk->numpasses + layer->numpasses; passno++) {
tcd_pass_t *pass = &cblk->passes[passno];
nump++;
len += pass->len;
if (pass->term || passno == (cblk->numpasses + layer->numpasses) - 1) {
increment = int_max(increment, int_floorlog2(len) + 1 - (cblk->numlenbits + int_floorlog2(nump)));
len = 0;
nump = 0;
}
}
t2_putcommacode(increment);
/* computation of the new Length indicator */
cblk->numlenbits += increment;
/* insertion of the codeword segment length */
for (passno = cblk->numpasses;
passno < cblk->numpasses + layer->numpasses; passno++) {
tcd_pass_t *pass = &cblk->passes[passno];
nump++;
len += pass->len;
if (pass->term || passno == (cblk->numpasses + layer->numpasses) - 1) {
bio_write(len, cblk->numlenbits + int_floorlog2(nump));
len = 0;
nump = 0;
}
}
}
}
if (bio_flush())
return -999; /* modified to eliminate longjmp !! */
c += bio_numbytes();
/* <EPH 0xff92> */
if (tcp->csty & J2K_CP_CSTY_EPH) {
eph = (unsigned char *) malloc(2 * sizeof(unsigned char));
eph[0] = 255;
eph[1] = 146;
memcpy(c, eph, 2);
free(eph);
c += 2;
}
/* </EPH> */
/* Writing the packet body */
for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
tcd_cblk_t *cblk = &prc->cblks[cblkno];
tcd_layer_t *layer = &cblk->layers[layno];
if (!layer->numpasses) { /* ADD for index Cfr. Marcela --> delta disto by packet */
if (info_IM->index_write && info_IM->index_on) {
info_tile *info_TL = &info_IM->tile[tileno];
info_packet *info_PK = &info_TL->packet[info_IM->num];
info_PK->disto = layer->disto;
if (info_IM->D_max < info_PK->disto)
info_IM->D_max = info_PK->disto;
} /* </ADD> */
continue;
}
if (c + layer->len > dest + len) {
return -999;
}
memcpy(c, layer->data, layer->len);
cblk->numpasses += layer->numpasses;
c += layer->len;
/* ADD for index Cfr. Marcela --> delta disto by packet */
if (info_IM->index_write && info_IM->index_on) {
info_tile *info_TL = &info_IM->tile[tileno];
info_packet *info_PK = &info_TL->packet[info_IM->num];
info_PK->disto = layer->disto;
if (info_IM->D_max < info_PK->disto)
info_IM->D_max = info_PK->disto;
} /* </ADD> */
}
}
return c - dest;
}
void t2_init_seg(tcd_seg_t * seg, int cblksty, int first)
{
seg->numpasses = 0;
seg->len = 0;
if (cblksty & J2K_CCP_CBLKSTY_TERMALL)
seg->maxpasses = 1;
else if (cblksty & J2K_CCP_CBLKSTY_LAZY) {
if (first)
seg->maxpasses = 10;
else
seg->maxpasses = (((seg - 1)->maxpasses == 1) || ((seg - 1)->maxpasses == 10)) ? 2 : 1;
} else
seg->maxpasses = 109;
}
/*
* Decode a packet of a tile from a source buffer
*
* src : the source buffer
* len : the length of the source buffer
* tile : the tile for which to write the packets
* cp : the image coding parameters
* tcp : the tile coding parameters
* compno : Identity of the packet --> component value
* resno : Identity of the packet --> resolution level value
* precno : Identity of the packet --> precinct value
* layno : Identity of the packet --> quality layer value
*/
int t2_decode_packet(unsigned char *src, int len, tcd_tile_t * tile, j2k_cp_t * cp, j2k_tcp_t * tcp, int compno, int resno, int precno, int layno)
{
int bandno, cblkno;
tcd_tilecomp_t *tilec = &tile->comps[compno];
tcd_resolution_t *res = &tilec->resolutions[resno];
unsigned char *c = src;
int present;
if (layno == 0) {
for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
tgt_reset(prc->incltree);
tgt_reset(prc->imsbtree);
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
tcd_cblk_t *cblk = &prc->cblks[cblkno];
cblk->numsegs = 0;
}
}
}
/* When the marker PPT/PPM is used the packet header are store in PPT/PPM marker
This part deal with this caracteristic
step 1: Read packet header in the saved structure
step 2: (futher) return to codestream for decoding */
if (cp->ppm == 1) /* PPM */
{
c=cp->ppm_data;
bio_init_dec(c,1000);
} else
{
if (tcp->ppt==1) /* PPT */
{
c=tcp->ppt_data;
bio_init_dec(c,1000);
} else /* Normal Case */
{
if (tcp->csty & J2K_CP_CSTY_SOP)
{
if ((*c)!=255 || (*(c+1)!=145)) {printf("Error : expected SOP marker [1]!!!\n");}
/*printf(" %d %d %d %d %d %d %d\n",*c,*(c+1),*(c+6),*(c+7),*(c+8),*(c+9),*(c+10));*/
c += 6;
}
bio_init_dec(c, src + len - c);
}
}
present = bio_read(1);
if (!present)
{
bio_inalign();
/* Normal case */
c += bio_numbytes();
if (tcp->csty & J2K_CP_CSTY_EPH)
{
if ((*c)!=255 || (*(c+1)!=146)) {printf("Error : expected EPH marker [1]!!!\n");}
c += 2;
}
/* PPT and PPM dealing */
if (cp->ppm == 1) /* PPM */
{
cp->ppm_data=c;
return 0;
}
if (tcp->ppt==1) /* PPT */
{
tcp->ppt_data=c;
return 0;
}
return c - src;
}
for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
int included, increment, n;
tcd_cblk_t *cblk = &prc->cblks[cblkno];
tcd_seg_t *seg;
/* if cblk not yet included before --> inclusion tagtree */
if (!cblk->numsegs) {
included = tgt_decode(prc->incltree, cblkno, layno + 1);
/* else one bit */
} else {
included = bio_read(1);
}
/* if cblk not included */
if (!included) {
cblk->numnewpasses = 0;
continue;
}
/* if cblk not yet included --> zero-bitplane tagtree */
if (!cblk->numsegs) {
int i, numimsbs;
for (i = 0; !tgt_decode(prc->imsbtree, cblkno, i); i++) {
}
numimsbs = i - 1;
cblk->numbps = band->numbps - numimsbs;
cblk->numlenbits = 3;
}
/* number of coding passes */
cblk->numnewpasses = t2_getnumpasses();
increment = t2_getcommacode();
/* length indicator increment */
cblk->numlenbits += increment;
if (!cblk->numsegs) {
seg = &cblk->segs[0];
t2_init_seg(seg, tcp->tccps[compno].cblksty, 1);
} else {
seg = &cblk->segs[cblk->numsegs - 1];
if (seg->numpasses == seg->maxpasses) {
t2_init_seg(++seg, tcp->tccps[compno].cblksty, 0);
}
}
n = cblk->numnewpasses;
do {
seg->numnewpasses = int_min(seg->maxpasses - seg->numpasses, n);
seg->newlen = bio_read(cblk->numlenbits + int_floorlog2(seg->numnewpasses));
n -= seg->numnewpasses;
if (n > 0) {
t2_init_seg(++seg, tcp->tccps[compno].cblksty, 0);
}
} while (n > 0);
}
}
if (bio_inalign())
return -999;
c += bio_numbytes();
if (tcp->csty & J2K_CP_CSTY_EPH) { /* EPH marker */
if ((*c)!=255 || (*(c+1)!=146)) { printf("Error : expected EPH marker [2]!!!\n");
printf(" %d %d %d %d %d %d %d\n",*c,*(c+1),*(c+2),*(c+3),*(c+4),*(c+5),*(c+6));}
c += 2;
}
/* PPT Step 2 : see above for details */
if (cp->ppm==1)
{
cp->ppm_data=c; /* Update pointer */
c=src;
if (tcp->csty & J2K_CP_CSTY_SOP)
{
if ((*c)!=255 || (*(c+1)!=145)) {printf("Error : expected SOP marker [2] !!!\n"); }
c += 6;
}
bio_init_dec(c,src + len - c);
} else
{
if (tcp->ppt==1)
{
tcp->ppt_data=c; /* Update pointer */
c=src;
if (tcp->csty & J2K_CP_CSTY_SOP) /* SOP marker */
{
if ((*c)!=255 || (*(c+1)!=145)) {printf("Error : expected SOP marker [2] !!!\n"); }
c += 6;
}
bio_init_dec(c,src + len - c);
}
}
for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno];
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
tcd_cblk_t *cblk = &prc->cblks[cblkno];
tcd_seg_t *seg;
if (!cblk->numnewpasses)
continue;
if (!cblk->numsegs) {
seg = &cblk->segs[cblk->numsegs++];
cblk->len = 0;
} else {
seg = &cblk->segs[cblk->numsegs - 1];
if (seg->numpasses == seg->maxpasses) {
seg++;
cblk->numsegs++;
}
}
do {
if (c + seg->newlen > src + len){
return -999;}
memcpy(cblk->data + cblk->len, c, seg->newlen);
if (seg->numpasses == 0) {
seg->data = cblk->data + cblk->len;
}
c += seg->newlen;
cblk->len += seg->newlen;
seg->len += seg->newlen;
seg->numpasses += seg->numnewpasses;
cblk->numnewpasses -= seg->numnewpasses;
if (cblk->numnewpasses > 0) {
seg++;
cblk->numsegs++;
}
} while (cblk->numnewpasses > 0);
}
}
return c - src;
}
/*
* Encode the packets of a tile to a destination buffer
*
* img : the source image
* cp : the image coding parameters
* tileno : number of the tile encoded
* tile : the tile for which to write the packets
* maxlayers : maximum number of layers
* dest : the destination buffer
* len : the length of the destination buffer
* info_IM : structure to create an index file
*/
int t2_encode_packets(j2k_image_t * img, j2k_cp_t * cp, int tileno, tcd_tile_t * tile, int maxlayers, unsigned char *dest, int len, info_image * info_IM)
{
unsigned char *c = dest;
int e = 0;
pi_iterator_t *pi;
int pino, compno;
pi = pi_create(img, cp, tileno);
for (pino = 0; pino <= cp->tcps[tileno].numpocs; pino++) {
while (pi_next(&pi[pino])) {
if (pi[pino].layno < maxlayers) {
e = t2_encode_packet(tile, &cp->tcps[tileno], pi[pino].compno,
pi[pino].resno, pi[pino].precno, pi[pino].layno,
c, dest + len - c, info_IM, tileno);
if (e == -999) {
break;
} else
c += e;
/* INDEX >> */
if (info_IM->index_write && info_IM->index_on) {
info_tile *info_TL = &info_IM->tile[tileno];
info_packet *info_PK = &info_TL->packet[info_IM->num];
if (!info_IM->num) {
info_PK->start_pos = info_TL->end_header + 1;
} else {
info_PK->start_pos =
info_TL->packet[info_IM->num - 1].end_pos + 1;
}
info_PK->end_pos = info_PK->start_pos + e - 1;
}
/* << INDEX */
if ((info_IM->index_write
&& cp->tcps[tileno].csty & J2K_CP_CSTY_SOP)
|| (info_IM->index_write && info_IM->index_on)) {
info_IM->num++;
}
}
}
/* FREE space memory taken by pi */
for (compno = 0; compno < pi[pino].numcomps; compno++) {
free(pi[pino].comps[compno].resolutions);
}
free(pi[pino].comps);
}
free(pi[0].include);
free(pi);
if (e == -999)
return e;
else
return c - dest;
}
/*
* Decode the packets of a tile from a source buffer
*
* src: the source buffer
* len: length of the source buffer
* img: destination image
* cp: image coding parameters
* tileno: number that identifies the tile for which to decode the packets
* tile: tile for which to decode the packets
*/
int t2_decode_packets(unsigned char *src, int len, j2k_image_t * img, j2k_cp_t * cp, int tileno, tcd_tile_t * tile)
{
unsigned char *c = src;
pi_iterator_t *pi;
int pino, compno, e = 0;
int n=0;
pi = pi_create(img, cp, tileno);
for (pino = 0; pino <= cp->tcps[tileno].numpocs; pino++) {
while (pi_next(&pi[pino]))
{
// fprintf(stderr,"codeblock %d [%d %d %d %d] pino %d/%d\n",n,pi[pino].layno,pi[pino].resno,pi[pino].compno,pi[pino].precno,pino,cp->tcps[tileno].numpocs);
e = t2_decode_packet(c, src + len - c, tile, cp, &cp->tcps[tileno], pi[pino].compno,
pi[pino].resno, pi[pino].precno, pi[pino].layno);
n++;
if (e == -999) { /* ADD */
break;
} else
c += e;
/* printf("next\n"); */
}
/* FREE space memory taken by pi */
for (compno = 0; compno < pi[pino].numcomps; compno++) {
free(pi[pino].comps[compno].resolutions);
}
free(pi[pino].comps);
}
free(pi[0].include);
free(pi);
if (e == -999)
return e;
else
return c - src;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,175 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2002-2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __TCD_H
#define __TCD_H
#include "j2k.h"
#include "tgt.h"
typedef struct {
int numpasses;
int len;
unsigned char *data;
int maxpasses;
int numnewpasses;
int newlen;
} tcd_seg_t;
typedef struct {
int rate;
double distortiondec;
int term, len;
} tcd_pass_t;
typedef struct {
int numpasses; /* Number of passes in the layer */
int len; /* len of information */
double disto; /* add for index (Cfr. Marcela) */
unsigned char *data; /* data */
} tcd_layer_t;
typedef struct {
int x0, y0, x1, y1; /* dimension of the code-blocks : left upper corner (x0, y0) right low corner (x1,y1) */
int numbps;
int numlenbits;
int len; /* length */
int numpasses; /* number of pass already done for the code-blocks */
int numnewpasses; /* number of pass added to the code-blocks */
int numsegs; /* number of segments */
tcd_seg_t segs[100]; /* segments informations */
unsigned char data[8192]; /* Data */
int numpassesinlayers; /* number of passes in the layer */
tcd_layer_t layers[100]; /* layer information */
int totalpasses; /* total number of passes */
tcd_pass_t passes[100]; /* information about the passes */
} tcd_cblk_t;
typedef struct {
int x0, y0, x1, y1; /* dimension of the precinct : left upper corner (x0, y0) right low corner (x1,y1) */
int cw, ch; /* number of precinct in width and heigth */
tcd_cblk_t *cblks; /* code-blocks informations */
tgt_tree_t *incltree; /* inclusion tree */
tgt_tree_t *imsbtree; /* IMSB tree */
} tcd_precinct_t;
typedef struct {
int x0, y0, x1, y1; /* dimension of the subband : left upper corner (x0, y0) right low corner (x1,y1) */
int bandno;
tcd_precinct_t *precincts; /* precinct information */
int numbps;
int stepsize;
} tcd_band_t;
typedef struct {
int x0, y0, x1, y1; /* dimension of the resolution level : left upper corner (x0, y0) right low corner (x1,y1) */
int pw, ph;
int numbands; /* number sub-band for the resolution level */
tcd_band_t bands[3]; /* subband information */
} tcd_resolution_t;
typedef struct {
int x0, y0, x1, y1; /* dimension of component : left upper corner (x0, y0) right low corner (x1,y1) */
int numresolutions; /* number of resolutions level */
tcd_resolution_t *resolutions; /* resolutions information */
int *data; /* data of the component */
} tcd_tilecomp_t;
typedef struct {
int x0, y0, x1, y1; /* dimension of the tile : left upper corner (x0, y0) right low corner (x1,y1) */
int numcomps; /* number of components in tile */
tcd_tilecomp_t *comps; /* Components information */
} tcd_tile_t;
typedef struct {
int tw, th; /* number of tiles in width and heigth */
tcd_tile_t *tiles; /* Tiles information */
} tcd_image_t;
/*
* Initialize the tile coder (reuses the memory allocated by tcd_malloc_encode)
* img: raw image
* cp: coding parameters
* curtileno : number that identifies the tile that will be encoded
*/
void tcd_init_encode(j2k_image_t * img, j2k_cp_t * cp, int curtileno);
/*
* Initialize the tile coder (allocate the memory)
* img: raw image
* cp: coding parameters
* curtileno : number that identifies the tile that will be encoded
*/
void tcd_malloc_encode(j2k_image_t * img, j2k_cp_t * cp, int curtileno);
/*
* Initialize the tile decoder
* img: raw image
* cp: coding parameters
*/
void tcd_init(j2k_image_t * img, j2k_cp_t * cp);
/*
* Free the memory allocated for encoding
* img: raw image
* cp: coding parameters
* curtileno : number that identifies the tile that will be encoded
*/
void tcd_free_encode(j2k_image_t * img, j2k_cp_t * cp, int curtileno);
/*
* Encode a tile from the raw image into a buffer, format pnm, pgm or ppm
* tileno: number that identifies one of the tiles to be encoded
* dest: destination buffer
* len: length of destination buffer
* info_IM: creation of index file
*/
int tcd_encode_tile_pxm(int tileno, unsigned char *dest, int len, info_image * info_IM);
/*
* Encode a tile from the raw image into a buffer, format pgx
* tileno: number that identifies one of the tiles to be encoded
* dest: destination buffer
* len: length of destination buffer
* info_IM: creation of index file
*/
int tcd_encode_tile_pgx(int tileno, unsigned char *dest, int len, info_image * info_IM);
/*
* Decode a tile from a buffer into a raw image
* src: source buffer
* len: length of the source buffer
* tileno: number that identifies the tile that will be decoded
*/
int tcd_decode_tile(unsigned char *src, int len, int tileno);
#endif

View File

@ -1,87 +0,0 @@
/*
* Copyright (c) 2001-2002, David Janssens
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __TGT_H
#define __TGT_H
typedef struct tgt_node {
struct tgt_node *parent;
int value;
int low;
int known;
} tgt_node_t;
typedef struct {
int numleafsh;
int numleafsv;
int numnodes;
tgt_node_t *nodes;
} tgt_tree_t;
/*
* Reset a tag-tree (set all leaves to 0)
* tree: tag-tree to reset
*/
void tgt_reset(tgt_tree_t * tree);
/*
* Create a tag-tree
* numleafsh: width of the array of leafs of the tree
* numleafsv: height of the array of leafs of the tree
*/
tgt_tree_t *tgt_create(int numleafsh, int numleafsv);
/*
* Destroy a tag-tree, liberating memory
* tree: tag-tree to destroy
*/
void tgt_destroy(tgt_tree_t * tree);
/*
* Set the value of a leaf of a tag-tree
* tree: tag-tree to modify
* leafno: number that identifies the leaf to modify
* value: new value of the leaf
*/
void tgt_setvalue(tgt_tree_t * tree, int leafno, int value);
/*
* Encode the value of a leaf of the tag-tree up to a given threshold
* leafno: number that identifies the leaf to encode
* threshold: threshold to use when encoding value of the leaf
*/
void tgt_encode(tgt_tree_t * tree, int leafno, int threshold);
/*
* Decode the value of a leaf of the tag-tree up to a given threshold
* leafno: number that identifies the leaf to decode
* threshold: threshold to use when decoding value of the leaf
*/
int tgt_decode(tgt_tree_t * tree, int leafno, int threshold);
#endif

12
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,12 @@
# required dep for server:
#if(BUILD_JPIP_SERVER)
# find_package(CURL REQUIRED)
# find_package(FCGI REQUIRED)
# find_package(Threads REQUIRED)
# if(NOT CMAKE_USE_PTHREADS_INIT)
# message(FATAL_ERROR "Only pthread are supported")
# endif()
#endif()
#add_subdirectory(lib)
#add_subdirectory(bin)

21
src/bin/CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
# source code for openjpeg apps:
add_subdirectory(common)
# Part 1 & 2:
add_subdirectory(jp2)
# optionals components:
if(BUILD_JPWL)
add_subdirectory(jpwl)
endif()
if(BUILD_MJ2)
add_subdirectory(mj2)
endif()
if(BUILD_JPIP)
add_subdirectory(jpip)
endif()
if(BUILD_JP3D)
add_subdirectory(jp3d)
endif()
# wx apps:
add_subdirectory(wx)

View File

@ -0,0 +1,7 @@
#-----------------------------------------------------------------------------
# opj_apps_config.h generation
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/opj_apps_config.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/opj_apps_config.h
@ONLY
)

965
src/bin/common/color.c Normal file
View File

@ -0,0 +1,965 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include "opj_apps_config.h"
#include "openjpeg.h"
#include "color.h"
#ifdef OPJ_HAVE_LIBLCMS2
#include <lcms2.h>
#endif
#ifdef OPJ_HAVE_LIBLCMS1
#include <lcms.h>
#endif
#ifdef OPJ_USE_LEGACY
#define OPJ_CLRSPC_GRAY CLRSPC_GRAY
#define OPJ_CLRSPC_SRGB CLRSPC_SRGB
#endif
/*--------------------------------------------------------
Matrix for sYCC, Amendment 1 to IEC 61966-2-1
Y : 0.299 0.587 0.114 :R
Cb: -0.1687 -0.3312 0.5 :G
Cr: 0.5 -0.4187 -0.0812 :B
Inverse:
R: 1 -3.68213e-05 1.40199 :Y
G: 1.00003 -0.344125 -0.714128 :Cb - 2^(prec - 1)
B: 0.999823 1.77204 -8.04142e-06 :Cr - 2^(prec - 1)
-----------------------------------------------------------*/
static void sycc_to_rgb(int offset, int upb, int y, int cb, int cr,
int *out_r, int *out_g, int *out_b)
{
int r, g, b;
cb -= offset; cr -= offset;
r = y + (int)(1.402 * (float)cr);
if(r < 0) r = 0; else if(r > upb) r = upb; *out_r = r;
g = y - (int)(0.344 * (float)cb + 0.714 * (float)cr);
if(g < 0) g = 0; else if(g > upb) g = upb; *out_g = g;
b = y + (int)(1.772 * (float)cb);
if(b < 0) b = 0; else if(b > upb) b = upb; *out_b = b;
}
static void sycc444_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b;
const int *y, *cb, *cr;
size_t maxw, maxh, max, i;
int offset, upb;
upb = (int)img->comps[0].prec;
offset = 1<<(upb - 1); upb = (1<<upb)-1;
maxw = (size_t)img->comps[0].w; maxh = (size_t)img->comps[0].h;
max = maxw * maxh;
y = img->comps[0].data;
cb = img->comps[1].data;
cr = img->comps[2].data;
d0 = r = (int*)malloc(sizeof(int) * max);
d1 = g = (int*)malloc(sizeof(int) * max);
d2 = b = (int*)malloc(sizeof(int) * max);
if(r == NULL || g == NULL || b == NULL) goto fails;
for(i = 0U; i < max; ++i)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++cb; ++cr; ++r; ++g; ++b;
}
free(img->comps[0].data); img->comps[0].data = d0;
free(img->comps[1].data); img->comps[1].data = d1;
free(img->comps[2].data); img->comps[2].data = d2;
img->color_space = OPJ_CLRSPC_SRGB;
return;
fails:
free(r);
free(g);
free(b);
}/* sycc444_to_rgb() */
static void sycc422_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b;
const int *y, *cb, *cr;
size_t maxw, maxh, max, offx, loopmaxw;
int offset, upb;
size_t i;
upb = (int)img->comps[0].prec;
offset = 1<<(upb - 1); upb = (1<<upb)-1;
maxw = (size_t)img->comps[0].w; maxh = (size_t)img->comps[0].h;
max = maxw * maxh;
y = img->comps[0].data;
cb = img->comps[1].data;
cr = img->comps[2].data;
d0 = r = (int*)malloc(sizeof(int) * max);
d1 = g = (int*)malloc(sizeof(int) * max);
d2 = b = (int*)malloc(sizeof(int) * max);
if(r == NULL || g == NULL || b == NULL) goto fails;
/* if img->x0 is odd, then first column shall use Cb/Cr = 0 */
offx = img->x0 & 1U;
loopmaxw = maxw - offx;
for(i=0U; i < maxh; ++i)
{
size_t j;
if (offx > 0U) {
sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
++y; ++r; ++g; ++b;
}
for(j=0U; j < (loopmaxw & ~(size_t)1U); j += 2U)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b; ++cb; ++cr;
}
if (j < loopmaxw) {
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b; ++cb; ++cr;
}
}
free(img->comps[0].data); img->comps[0].data = d0;
free(img->comps[1].data); img->comps[1].data = d1;
free(img->comps[2].data); img->comps[2].data = d2;
img->comps[1].w = img->comps[2].w = img->comps[0].w;
img->comps[1].h = img->comps[2].h = img->comps[0].h;
img->comps[1].dx = img->comps[2].dx = img->comps[0].dx;
img->comps[1].dy = img->comps[2].dy = img->comps[0].dy;
img->color_space = OPJ_CLRSPC_SRGB;
return;
fails:
free(r);
free(g);
free(b);
}/* sycc422_to_rgb() */
static void sycc420_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b, *nr, *ng, *nb;
const int *y, *cb, *cr, *ny;
size_t maxw, maxh, max, offx, loopmaxw, offy, loopmaxh;
int offset, upb;
size_t i;
upb = (int)img->comps[0].prec;
offset = 1<<(upb - 1); upb = (1<<upb)-1;
maxw = (size_t)img->comps[0].w; maxh = (size_t)img->comps[0].h;
max = maxw * maxh;
y = img->comps[0].data;
cb = img->comps[1].data;
cr = img->comps[2].data;
d0 = r = (int*)malloc(sizeof(int) * max);
d1 = g = (int*)malloc(sizeof(int) * max);
d2 = b = (int*)malloc(sizeof(int) * max);
if (r == NULL || g == NULL || b == NULL) goto fails;
/* if img->x0 is odd, then first column shall use Cb/Cr = 0 */
offx = img->x0 & 1U;
loopmaxw = maxw - offx;
/* if img->y0 is odd, then first line shall use Cb/Cr = 0 */
offy = img->y0 & 1U;
loopmaxh = maxh - offy;
if (offy > 0U) {
size_t j;
for(j=0; j < maxw; ++j)
{
sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
++y; ++r; ++g; ++b;
}
}
for(i=0U; i < (loopmaxh & ~(size_t)1U); i += 2U)
{
size_t j;
ny = y + maxw;
nr = r + maxw; ng = g + maxw; nb = b + maxw;
if (offx > 0U) {
sycc_to_rgb(offset, upb, *y, 0, 0, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
++ny; ++nr; ++ng; ++nb;
}
for(j=0; j < (loopmaxw & ~(size_t)1U); j += 2U)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
++ny; ++nr; ++ng; ++nb;
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
}
if(j < loopmaxw)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
}
y += maxw; r += maxw; g += maxw; b += maxw;
}
if(i < loopmaxh)
{
size_t j;
for(j=0U; j < (maxw & ~(size_t)1U); j += 2U)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b; ++cb; ++cr;
}
if(j < maxw)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
}
}
free(img->comps[0].data); img->comps[0].data = d0;
free(img->comps[1].data); img->comps[1].data = d1;
free(img->comps[2].data); img->comps[2].data = d2;
img->comps[1].w = img->comps[2].w = img->comps[0].w;
img->comps[1].h = img->comps[2].h = img->comps[0].h;
img->comps[1].dx = img->comps[2].dx = img->comps[0].dx;
img->comps[1].dy = img->comps[2].dy = img->comps[0].dy;
img->color_space = OPJ_CLRSPC_SRGB;
return;
fails:
free(r);
free(g);
free(b);
}/* sycc420_to_rgb() */
void color_sycc_to_rgb(opj_image_t *img)
{
if(img->numcomps < 3)
{
img->color_space = OPJ_CLRSPC_GRAY;
return;
}
if((img->comps[0].dx == 1)
&& (img->comps[1].dx == 2)
&& (img->comps[2].dx == 2)
&& (img->comps[0].dy == 1)
&& (img->comps[1].dy == 2)
&& (img->comps[2].dy == 2))/* horizontal and vertical sub-sample */
{
sycc420_to_rgb(img);
}
else
if((img->comps[0].dx == 1)
&& (img->comps[1].dx == 2)
&& (img->comps[2].dx == 2)
&& (img->comps[0].dy == 1)
&& (img->comps[1].dy == 1)
&& (img->comps[2].dy == 1))/* horizontal sub-sample only */
{
sycc422_to_rgb(img);
}
else
if((img->comps[0].dx == 1)
&& (img->comps[1].dx == 1)
&& (img->comps[2].dx == 1)
&& (img->comps[0].dy == 1)
&& (img->comps[1].dy == 1)
&& (img->comps[2].dy == 1))/* no sub-sample */
{
sycc444_to_rgb(img);
}
else
{
fprintf(stderr,"%s:%d:color_sycc_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
return;
}
}/* color_sycc_to_rgb() */
#if defined(OPJ_HAVE_LIBLCMS2) || defined(OPJ_HAVE_LIBLCMS1)
#ifdef OPJ_HAVE_LIBLCMS1
/* Bob Friesenhahn proposed:*/
#define cmsSigXYZData icSigXYZData
#define cmsSigLabData icSigLabData
#define cmsSigCmykData icSigCmykData
#define cmsSigYCbCrData icSigYCbCrData
#define cmsSigLuvData icSigLuvData
#define cmsSigGrayData icSigGrayData
#define cmsSigRgbData icSigRgbData
#define cmsUInt32Number DWORD
#define cmsColorSpaceSignature icColorSpaceSignature
#define cmsGetHeaderRenderingIntent cmsTakeRenderingIntent
#endif /* OPJ_HAVE_LIBLCMS1 */
/*#define DEBUG_PROFILE*/
void color_apply_icc_profile(opj_image_t *image)
{
cmsHPROFILE in_prof, out_prof;
cmsHTRANSFORM transform;
cmsColorSpaceSignature in_space, out_space;
cmsUInt32Number intent, in_type, out_type;
int *r, *g, *b;
size_t nr_samples, i, max, max_w, max_h;
int prec, ok = 0;
OPJ_COLOR_SPACE new_space;
in_prof = cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len);
#ifdef DEBUG_PROFILE
FILE *icm = fopen("debug.icm","wb");
fwrite( image->icc_profile_buf,1, image->icc_profile_len,icm);
fclose(icm);
#endif
if(in_prof == NULL) return;
in_space = cmsGetPCS(in_prof);
out_space = cmsGetColorSpace(in_prof);
intent = cmsGetHeaderRenderingIntent(in_prof);
max_w = image->comps[0].w;
max_h = image->comps[0].h;
prec = (int)image->comps[0].prec;
if(out_space == cmsSigRgbData) /* enumCS 16 */
{
if( prec <= 8 )
{
in_type = TYPE_RGB_8;
out_type = TYPE_RGB_8;
}
else
{
in_type = TYPE_RGB_16;
out_type = TYPE_RGB_16;
}
out_prof = cmsCreate_sRGBProfile();
new_space = OPJ_CLRSPC_SRGB;
}
else if(out_space == cmsSigGrayData) /* enumCS 17 */
{
in_type = TYPE_GRAY_8;
out_type = TYPE_RGB_8;
out_prof = cmsCreate_sRGBProfile();
new_space = OPJ_CLRSPC_SRGB;
}
else if(out_space == cmsSigYCbCrData) /* enumCS 18 */
{
in_type = TYPE_YCbCr_16;
out_type = TYPE_RGB_16;
out_prof = cmsCreate_sRGBProfile();
new_space = OPJ_CLRSPC_SRGB;
}
else
{
#ifdef DEBUG_PROFILE
fprintf(stderr,"%s:%d: color_apply_icc_profile\n\tICC Profile has unknown "
"output colorspace(%#x)(%c%c%c%c)\n\tICC Profile ignored.\n",
__FILE__,__LINE__,out_space,
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
(out_space>>8) & 0xff, out_space & 0xff);
#endif
cmsCloseProfile(in_prof);
return;
}
if(out_prof == NULL)
{
cmsCloseProfile(in_prof);
return;
}
#ifdef DEBUG_PROFILE
fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tchannels(%d) prec(%d) w(%d) h(%d)"
"\n\tprofile: in(%p) out(%p)\n",__FILE__,__LINE__,image->numcomps,prec,
max_w,max_h, (void*)in_prof,(void*)out_prof);
fprintf(stderr,"\trender_intent (%u)\n\t"
"color_space: in(%#x)(%c%c%c%c) out:(%#x)(%c%c%c%c)\n\t"
" type: in(%u) out:(%u)\n",
intent,
in_space,
(in_space>>24) & 0xff,(in_space>>16) & 0xff,
(in_space>>8) & 0xff, in_space & 0xff,
out_space,
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
(out_space>>8) & 0xff, out_space & 0xff,
in_type,out_type
);
#else
(void)prec;
(void)in_space;
#endif /* DEBUG_PROFILE */
transform = cmsCreateTransform(in_prof, in_type, out_prof, out_type, intent, 0);
#ifdef OPJ_HAVE_LIBLCMS2
/* Possible for: LCMS_VERSION >= 2000 :*/
cmsCloseProfile(in_prof);
cmsCloseProfile(out_prof);
#endif
if(transform == NULL)
{
#ifdef DEBUG_PROFILE
fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
"ICC Profile ignored.\n",__FILE__,__LINE__);
#endif
#ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in_prof);
cmsCloseProfile(out_prof);
#endif
return;
}
if(image->numcomps > 2)/* RGB, RGBA */
{
if( prec <= 8 )
{
unsigned char *inbuf, *outbuf, *in, *out;
max = max_w * max_h;
nr_samples = (size_t)(max * 3U * sizeof(unsigned char));
in = inbuf = (unsigned char*)malloc(nr_samples);
out = outbuf = (unsigned char*)malloc(nr_samples);
if(inbuf == NULL || outbuf == NULL) goto fails0;
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0U; i < max; ++i)
{
*in++ = (unsigned char)*r++;
*in++ = (unsigned char)*g++;
*in++ = (unsigned char)*b++;
}
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0U; i < max; ++i)
{
*r++ = (int)*out++;
*g++ = (int)*out++;
*b++ = (int)*out++;
}
ok = 1;
fails0:
free(inbuf);
free(outbuf);
}
else /* prec > 8 */
{
unsigned short *inbuf, *outbuf, *in, *out;
max = max_w * max_h;
nr_samples = (size_t)(max * 3U * sizeof(unsigned short));
in = inbuf = (unsigned short*)malloc(nr_samples);
out = outbuf = (unsigned short*)malloc(nr_samples);
if(inbuf == NULL || outbuf == NULL) goto fails1;
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0U ; i < max; ++i)
{
*in++ = (unsigned short)*r++;
*in++ = (unsigned short)*g++;
*in++ = (unsigned short)*b++;
}
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
*r++ = (int)*out++;
*g++ = (int)*out++;
*b++ = (int)*out++;
}
ok = 1;
fails1:
free(inbuf);
free(outbuf);
}
}
else /* image->numcomps <= 2 : GRAY, GRAYA */
{
if(prec <= 8)
{
unsigned char *in, *inbuf, *out, *outbuf;
opj_image_comp_t *new_comps;
max = max_w * max_h;
nr_samples = (size_t)(max * 3 * sizeof(unsigned char));
in = inbuf = (unsigned char*)malloc(nr_samples);
out = outbuf = (unsigned char*)malloc(nr_samples);
g = (int*)calloc((size_t)max, sizeof(int));
b = (int*)calloc((size_t)max, sizeof(int));
if(inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) goto fails2;
new_comps = (opj_image_comp_t*)realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
if(new_comps == NULL) goto fails2;
image->comps = new_comps;
if(image->numcomps == 2)
image->comps[3] = image->comps[1];
image->comps[1] = image->comps[0];
image->comps[2] = image->comps[0];
image->comps[1].data = g;
image->comps[2].data = b;
image->numcomps += 2;
r = image->comps[0].data;
for(i = 0U; i < max; ++i)
{
*in++ = (unsigned char)*r++;
}
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0U; i < max; ++i)
{
*r++ = (int)*out++; *g++ = (int)*out++; *b++ = (int)*out++;
}
r = g = b = NULL;
ok = 1;
fails2:
free(inbuf);
free(outbuf);
free(g);
free(b);
}
else /* prec > 8 */
{
unsigned short *in, *inbuf, *out, *outbuf;
opj_image_comp_t *new_comps;
max = max_w * max_h;
nr_samples = (size_t)(max * 3U * sizeof(unsigned short));
in = inbuf = (unsigned short*)malloc(nr_samples);
out = outbuf = (unsigned short*)malloc(nr_samples);
g = (int*)calloc((size_t)max, sizeof(int));
b = (int*)calloc((size_t)max, sizeof(int));
if(inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) goto fails3;
new_comps = (opj_image_comp_t*)realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
if(new_comps == NULL) goto fails3;
image->comps = new_comps;
if(image->numcomps == 2)
image->comps[3] = image->comps[1];
image->comps[1] = image->comps[0];
image->comps[2] = image->comps[0];
image->comps[1].data = g;
image->comps[2].data = b;
image->numcomps += 2;
r = image->comps[0].data;
for(i = 0U; i < max; ++i)
{
*in++ = (unsigned short)*r++;
}
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
*r++ = (int)*out++; *g++ = (int)*out++; *b++ = (int)*out++;
}
r = g = b = NULL;
ok = 1;
fails3:
free(inbuf);
free(outbuf);
free(g);
free(b);
}
}/* if(image->numcomps > 2) */
cmsDeleteTransform(transform);
#ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in_prof);
cmsCloseProfile(out_prof);
#endif
if(ok)
{
image->color_space = new_space;
}
}/* color_apply_icc_profile() */
void color_cielab_to_rgb(opj_image_t *image)
{
int *row;
int enumcs, numcomps;
OPJ_COLOR_SPACE new_space;
numcomps = (int)image->numcomps;
if(numcomps != 3)
{
fprintf(stderr,"%s:%d:\n\tnumcomps %d not handled. Quitting.\n",
__FILE__,__LINE__,numcomps);
return;
}
row = (int*)image->icc_profile_buf;
enumcs = row[0];
if(enumcs == 14) /* CIELab */
{
int *L, *a, *b, *red, *green, *blue;
int *src0, *src1, *src2, *dst0, *dst1, *dst2;
double rl, ol, ra, oa, rb, ob, prec0, prec1, prec2;
double minL, maxL, mina, maxa, minb, maxb;
unsigned int default_type;
unsigned int i, max;
cmsHPROFILE in, out;
cmsHTRANSFORM transform;
cmsUInt16Number RGB[3];
cmsCIELab Lab;
in = cmsCreateLab4Profile(NULL);
if(in == NULL){
return;
}
out = cmsCreate_sRGBProfile();
if(out == NULL){
cmsCloseProfile(in);
return;
}
transform = cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, INTENT_PERCEPTUAL, 0);
#ifdef OPJ_HAVE_LIBLCMS2
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
if(transform == NULL)
{
#ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
return;
}
new_space = OPJ_CLRSPC_SRGB;
prec0 = (double)image->comps[0].prec;
prec1 = (double)image->comps[1].prec;
prec2 = (double)image->comps[2].prec;
default_type = (unsigned int)row[1];
if(default_type == 0x44454600)/* DEF : default */
{
rl = 100; ra = 170; rb = 200;
ol = 0;
oa = pow(2, prec1 - 1);
ob = pow(2, prec2 - 2) + pow(2, prec2 - 3);
}
else
{
rl = row[2]; ra = row[4]; rb = row[6];
ol = row[3]; oa = row[5]; ob = row[7];
}
L = src0 = image->comps[0].data;
a = src1 = image->comps[1].data;
b = src2 = image->comps[2].data;
max = image->comps[0].w * image->comps[0].h;
red = dst0 = (int*)malloc(max * sizeof(int));
green = dst1 = (int*)malloc(max * sizeof(int));
blue = dst2 = (int*)malloc(max * sizeof(int));
if(red == NULL || green == NULL || blue == NULL) goto fails;
minL = -(rl * ol)/(pow(2, prec0)-1);
maxL = minL + rl;
mina = -(ra * oa)/(pow(2, prec1)-1);
maxa = mina + ra;
minb = -(rb * ob)/(pow(2, prec2)-1);
maxb = minb + rb;
for(i = 0; i < max; ++i)
{
Lab.L = minL + (double)(*L) * (maxL - minL)/(pow(2, prec0)-1); ++L;
Lab.a = mina + (double)(*a) * (maxa - mina)/(pow(2, prec1)-1); ++a;
Lab.b = minb + (double)(*b) * (maxb - minb)/(pow(2, prec2)-1); ++b;
cmsDoTransform(transform, &Lab, RGB, 1);
*red++ = RGB[0];
*green++ = RGB[1];
*blue++ = RGB[2];
}
cmsDeleteTransform(transform);
#ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
free(src0); image->comps[0].data = dst0;
free(src1); image->comps[1].data = dst1;
free(src2); image->comps[2].data = dst2;
image->color_space = new_space;
image->comps[0].prec = 16;
image->comps[1].prec = 16;
image->comps[2].prec = 16;
return;
fails:
cmsDeleteTransform(transform);
#ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
if(red) free(red);
if(green) free(green);
if(blue) free(blue);
return;
}
fprintf(stderr,"%s:%d:\n\tenumCS %d not handled. Ignoring.\n", __FILE__,__LINE__, enumcs);
}/* color_cielab_to_rgb() */
#endif /* OPJ_HAVE_LIBLCMS2 || OPJ_HAVE_LIBLCMS1 */
void color_cmyk_to_rgb(opj_image_t *image)
{
float C, M, Y, K;
float sC, sM, sY, sK;
unsigned int w, h, max, i;
w = image->comps[0].w;
h = image->comps[0].h;
if (
(image->numcomps < 4)
|| (image->comps[0].dx != image->comps[1].dx) || (image->comps[0].dx != image->comps[2].dx) || (image->comps[0].dx != image->comps[3].dx)
|| (image->comps[0].dy != image->comps[1].dy) || (image->comps[0].dy != image->comps[2].dy) || (image->comps[0].dy != image->comps[3].dy)
) {
fprintf(stderr,"%s:%d:color_cmyk_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
return;
}
max = w * h;
sC = 1.0F / (float)((1 << image->comps[0].prec) - 1);
sM = 1.0F / (float)((1 << image->comps[1].prec) - 1);
sY = 1.0F / (float)((1 << image->comps[2].prec) - 1);
sK = 1.0F / (float)((1 << image->comps[3].prec) - 1);
for(i = 0; i < max; ++i)
{
/* CMYK values from 0 to 1 */
C = (float)(image->comps[0].data[i]) * sC;
M = (float)(image->comps[1].data[i]) * sM;
Y = (float)(image->comps[2].data[i]) * sY;
K = (float)(image->comps[3].data[i]) * sK;
/* Invert all CMYK values */
C = 1.0F - C;
M = 1.0F - M;
Y = 1.0F - Y;
K = 1.0F - K;
/* CMYK -> RGB : RGB results from 0 to 255 */
image->comps[0].data[i] = (int)(255.0F * C * K); /* R */
image->comps[1].data[i] = (int)(255.0F * M * K); /* G */
image->comps[2].data[i] = (int)(255.0F * Y * K); /* B */
}
free(image->comps[3].data); image->comps[3].data = NULL;
image->comps[0].prec = 8;
image->comps[1].prec = 8;
image->comps[2].prec = 8;
image->numcomps -= 1;
image->color_space = OPJ_CLRSPC_SRGB;
for (i = 3; i < image->numcomps; ++i) {
memcpy(&(image->comps[i]), &(image->comps[i+1]), sizeof(image->comps[i]));
}
}/* color_cmyk_to_rgb() */
/*
* This code has been adopted from sjpx_openjpeg.c of ghostscript
*/
void color_esycc_to_rgb(opj_image_t *image)
{
int y, cb, cr, sign1, sign2, val;
unsigned int w, h, max, i;
int flip_value = (1 << (image->comps[0].prec-1));
int max_value = (1 << image->comps[0].prec) - 1;
if (
(image->numcomps < 3)
|| (image->comps[0].dx != image->comps[1].dx) || (image->comps[0].dx != image->comps[2].dx)
|| (image->comps[0].dy != image->comps[1].dy) || (image->comps[0].dy != image->comps[2].dy)
) {
fprintf(stderr,"%s:%d:color_esycc_to_rgb\n\tCAN NOT CONVERT\n", __FILE__,__LINE__);
return;
}
w = image->comps[0].w;
h = image->comps[0].h;
sign1 = (int)image->comps[1].sgnd;
sign2 = (int)image->comps[2].sgnd;
max = w * h;
for(i = 0; i < max; ++i)
{
y = image->comps[0].data[i]; cb = image->comps[1].data[i]; cr = image->comps[2].data[i];
if( !sign1) cb -= flip_value;
if( !sign2) cr -= flip_value;
val = (int)
((float)y - (float)0.0000368 * (float)cb
+ (float)1.40199 * (float)cr + (float)0.5);
if(val > max_value) val = max_value; else if(val < 0) val = 0;
image->comps[0].data[i] = val;
val = (int)
((float)1.0003 * (float)y - (float)0.344125 * (float)cb
- (float)0.7141128 * (float)cr + (float)0.5);
if(val > max_value) val = max_value; else if(val < 0) val = 0;
image->comps[1].data[i] = val;
val = (int)
((float)0.999823 * (float)y + (float)1.77204 * (float)cb
- (float)0.000008 *(float)cr + (float)0.5);
if(val > max_value) val = max_value; else if(val < 0) val = 0;
image->comps[2].data[i] = val;
}
image->color_space = OPJ_CLRSPC_SRGB;
}/* color_esycc_to_rgb() */

Some files were not shown because too many files have changed in this diff Show More