summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2018-10-11 09:43:53 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2018-10-15 07:18:33 +0000
commit4783c6dc4441ab833050a08996d40d959960ecff (patch)
treebe41f452117fc01d43298681b5b00ef032d7e0bb
parent5f1bcf869227ebd3071db9b61a80e81effc38b94 (diff)
Remove bundled, unmaintained libjasper source codev5.12.0-beta3
[ChangeLog][Third-Party Code] The unmaintained bundled libjasper has been removed. Building the jp2 handler will require libjasper to be present as a system or external library. Change-Id: Ic48cc6021fc5fb64fb369eb9621fd7a811e8e9f7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/3rdparty/jasper.pri67
-rw-r--r--src/3rdparty/jasper/COPYRIGHT2
-rw-r--r--src/3rdparty/jasper/ChangeLog0
-rw-r--r--src/3rdparty/jasper/INSTALL3
-rw-r--r--src/3rdparty/jasper/LICENSE50
-rw-r--r--src/3rdparty/jasper/NEWS19
-rw-r--r--src/3rdparty/jasper/README21
-rw-r--r--src/3rdparty/jasper/qt_attribution.json16
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_cm.c1282
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_debug.c137
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_getopt.c169
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_icc.c1722
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_iccdata.c517
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_image.c1445
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_init.c162
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_malloc.c131
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_seq.c454
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_stream.c1150
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_string.c96
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_tmr.c148
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_tvp.c237
-rw-r--r--src/3rdparty/jasper/src/libjasper/base/jas_version.c67
-rw-r--r--src/3rdparty/jasper/src/libjasper/bmp/bmp_cod.c135
-rw-r--r--src/3rdparty/jasper/src/libjasper/bmp/bmp_cod.h215
-rw-r--r--src/3rdparty/jasper/src/libjasper/bmp/bmp_dec.c464
-rw-r--r--src/3rdparty/jasper/src/libjasper/bmp/bmp_enc.c395
-rw-r--r--src/3rdparty/jasper/src/libjasper/bmp/bmp_enc.h72
-rw-r--r--src/3rdparty/jasper/src/libjasper/dummy.c3
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_cm.h266
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_config.h172
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_config2.h89
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_debug.h114
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_fix.h358
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_getopt.h131
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_icc.h407
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_image.h564
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_init.h83
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_malloc.h124
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_math.h117
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_seq.h301
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_stream.h464
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_string.h95
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_tmr.h103
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_tvp.h151
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_types.h228
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jas_version.h120
-rw-r--r--src/3rdparty/jasper/src/libjasper/include/jasper/jasper.h93
-rw-r--r--src/3rdparty/jasper/src/libjasper/jp2/jp2_cod.c921
-rw-r--r--src/3rdparty/jasper/src/libjasper/jp2/jp2_cod.h304
-rw-r--r--src/3rdparty/jasper/src/libjasper/jp2/jp2_dec.c603
-rw-r--r--src/3rdparty/jasper/src/libjasper/jp2/jp2_dec.h85
-rw-r--r--src/3rdparty/jasper/src/libjasper/jp2/jp2_enc.c436
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_bs.c440
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_bs.h231
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_cod.h78
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_cs.c1644
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_cs.h763
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_dec.c2305
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_dec.h696
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_enc.c2620
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_enc.h646
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_fix.h144
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_flt.h80
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_math.c121
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_math.h99
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_mct.c291
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_mct.h111
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_mqcod.c179
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_mqcod.h124
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_mqdec.c306
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_mqdec.h271
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_mqenc.c392
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_mqenc.h236
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_qmfb.c3143
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_qmfb.h113
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t1cod.c497
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t1cod.h295
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t1dec.c923
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t1dec.h88
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t1enc.c959
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t1enc.h93
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t2cod.c684
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t2cod.h299
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t2dec.c581
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t2dec.h95
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t2enc.c655
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_t2enc.h106
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_tagtree.c393
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_tagtree.h167
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_tsfb.c288
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_tsfb.h138
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_util.c194
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpc/jpc_util.h77
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpg/README6
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpg/jpg_cod.h82
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpg/jpg_dec.c340
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpg/jpg_dummy.c110
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpg/jpg_enc.c414
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpg/jpg_enc.h70
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpg/jpg_jpeglib.h76
-rw-r--r--src/3rdparty/jasper/src/libjasper/jpg/jpg_val.c111
-rw-r--r--src/3rdparty/jasper/src/libjasper/mif/mif_cod.c752
-rw-r--r--src/3rdparty/jasper/src/libjasper/mif/mif_cod.h123
-rw-r--r--src/3rdparty/jasper/src/libjasper/pgx/pgx_cod.c78
-rw-r--r--src/3rdparty/jasper/src/libjasper/pgx/pgx_cod.h118
-rw-r--r--src/3rdparty/jasper/src/libjasper/pgx/pgx_dec.c414
-rw-r--r--src/3rdparty/jasper/src/libjasper/pgx/pgx_enc.c230
-rw-r--r--src/3rdparty/jasper/src/libjasper/pgx/pgx_enc.h69
-rw-r--r--src/3rdparty/jasper/src/libjasper/pnm/pnm_cod.c146
-rw-r--r--src/3rdparty/jasper/src/libjasper/pnm/pnm_cod.h156
-rw-r--r--src/3rdparty/jasper/src/libjasper/pnm/pnm_dec.c565
-rw-r--r--src/3rdparty/jasper/src/libjasper/pnm/pnm_enc.c452
-rw-r--r--src/3rdparty/jasper/src/libjasper/pnm/pnm_enc.h70
-rw-r--r--src/3rdparty/jasper/src/libjasper/ras/ras_cod.c74
-rw-r--r--src/3rdparty/jasper/src/libjasper/ras/ras_cod.h164
-rw-r--r--src/3rdparty/jasper/src/libjasper/ras/ras_dec.c398
-rw-r--r--src/3rdparty/jasper/src/libjasper/ras/ras_enc.c318
-rw-r--r--src/3rdparty/jasper/src/libjasper/ras/ras_enc.h70
-rw-r--r--src/imageformats/doc/src/qtimageformats.qdoc2
-rw-r--r--src/plugins/imageformats/jp2/jp2.pro8
-rw-r--r--src/plugins/imageformats/jp2/qjp2handler.pri10
121 files changed, 7 insertions, 42492 deletions
diff --git a/src/3rdparty/jasper.pri b/src/3rdparty/jasper.pri
deleted file mode 100644
index ddb5c40..0000000
--- a/src/3rdparty/jasper.pri
+++ /dev/null
@@ -1,67 +0,0 @@
-warning("Using bundled unmaintained copy of libjasper.")
-
-msvc: DEFINES += JAS_WIN_MSVC_BUILD
-INCLUDEPATH += $$PWD/jasper/src/libjasper/include $$PWD/libjasper/include
-SOURCES += \
- $$PWD/jasper/src/libjasper/base/jas_cm.c \
- $$PWD/jasper/src/libjasper/base/jas_debug.c \
- $$PWD/jasper/src/libjasper/base/jas_getopt.c \
- $$PWD/jasper/src/libjasper/base/jas_icc.c \
- $$PWD/jasper/src/libjasper/base/jas_iccdata.c \
- $$PWD/jasper/src/libjasper/base/jas_image.c \
- $$PWD/jasper/src/libjasper/base/jas_init.c \
- $$PWD/jasper/src/libjasper/base/jas_malloc.c \
- $$PWD/jasper/src/libjasper/base/jas_seq.c \
- $$PWD/jasper/src/libjasper/base/jas_stream.c \
- $$PWD/jasper/src/libjasper/base/jas_string.c \
- $$PWD/jasper/src/libjasper/base/jas_tmr.c \
- $$PWD/jasper/src/libjasper/base/jas_tvp.c \
- $$PWD/jasper/src/libjasper/base/jas_version.c \
- $$PWD/jasper/src/libjasper/bmp/bmp_cod.c \
- $$PWD/jasper/src/libjasper/bmp/bmp_dec.c \
- $$PWD/jasper/src/libjasper/bmp/bmp_enc.c \
- $$PWD/jasper/src/libjasper/dummy.c \
- $$PWD/jasper/src/libjasper/jp2/jp2_cod.c \
- $$PWD/jasper/src/libjasper/jp2/jp2_dec.c \
- $$PWD/jasper/src/libjasper/jp2/jp2_enc.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_bs.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_cs.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_dec.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_enc.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_math.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_mct.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_mqcod.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_mqdec.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_mqenc.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_qmfb.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_t1cod.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_t1dec.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_t1enc.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_t2cod.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_t2dec.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_t2enc.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_tagtree.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_tsfb.c \
- $$PWD/jasper/src/libjasper/jpc/jpc_util.c \
- $$PWD/jasper/src/libjasper/jpg/jpg_val.c \
- $$PWD/jasper/src/libjasper/mif/mif_cod.c \
- $$PWD/jasper/src/libjasper/pgx/pgx_cod.c \
- $$PWD/jasper/src/libjasper/pgx/pgx_dec.c \
- $$PWD/jasper/src/libjasper/pgx/pgx_enc.c \
- $$PWD/jasper/src/libjasper/pnm/pnm_cod.c \
- $$PWD/jasper/src/libjasper/pnm/pnm_dec.c \
- $$PWD/jasper/src/libjasper/pnm/pnm_enc.c \
- $$PWD/jasper/src/libjasper/ras/ras_cod.c \
- $$PWD/jasper/src/libjasper/ras/ras_dec.c \
- $$PWD/jasper/src/libjasper/ras/ras_enc.c
-
-LIBJPEG_DEP = $$PWD/../../../qtbase/src/3rdparty/libjpeg.pri
-exists($${LIBJPEG_DEP}) {
- include($${LIBJPEG_DEP})
- SOURCES += \
- $$PWD/jasper/src/libjasper/jpg/jpg_dec.c \
- $$PWD/jasper/src/libjasper/jpg/jpg_enc.c
-} else {
- SOURCES += \
- $$PWD/jasper/src/libjasper/jpg/jpg_dummy.c
-}
diff --git a/src/3rdparty/jasper/COPYRIGHT b/src/3rdparty/jasper/COPYRIGHT
deleted file mode 100644
index db023aa..0000000
--- a/src/3rdparty/jasper/COPYRIGHT
+++ /dev/null
@@ -1,2 +0,0 @@
-The copyright information for the JasPer software accompanies the software
-license, and can be found in the file named "LICENSE".
diff --git a/src/3rdparty/jasper/ChangeLog b/src/3rdparty/jasper/ChangeLog
deleted file mode 100644
index e69de29..0000000
--- a/src/3rdparty/jasper/ChangeLog
+++ /dev/null
diff --git a/src/3rdparty/jasper/INSTALL b/src/3rdparty/jasper/INSTALL
deleted file mode 100644
index 857e21a..0000000
--- a/src/3rdparty/jasper/INSTALL
+++ /dev/null
@@ -1,3 +0,0 @@
-Detailed instructions on how to build and install the JasPer software
-can be found in the JasPer Software Reference Manual which is located
-in the doc directory. (See the section titled "Building the Software".)
diff --git a/src/3rdparty/jasper/LICENSE b/src/3rdparty/jasper/LICENSE
deleted file mode 100644
index 8975f6f..0000000
--- a/src/3rdparty/jasper/LICENSE
+++ /dev/null
@@ -1,50 +0,0 @@
-JasPer License Version 2.0
-
-Copyright (c) 2001-2006 Michael David Adams
-Copyright (c) 1999-2000 Image Power, Inc.
-Copyright (c) 1999-2000 The University of British Columbia
-
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person (the
-"User") obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge,
-publish, distribute, and/or sell copies of the Software, and to permit
-persons to whom the Software is furnished to do so, subject to the
-following conditions:
-
-1. The above copyright notices and this permission notice (which
-includes the disclaimer below) shall be included in all copies or
-substantial portions of the Software.
-
-2. The name of a copyright holder shall not be used to endorse or
-promote products derived from the Software without specific prior
-written permission.
-
-THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
-LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
-THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
-"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
-BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
-EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
-INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
-FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
-PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
-THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
-EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
-BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
-PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
-GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
-ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
-IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
-SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
-AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
-SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
-THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
-PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
-RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
-EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
diff --git a/src/3rdparty/jasper/NEWS b/src/3rdparty/jasper/NEWS
deleted file mode 100644
index 25e1fa9..0000000
--- a/src/3rdparty/jasper/NEWS
+++ /dev/null
@@ -1,19 +0,0 @@
-Dear JasPer Users:
-
-I am pleased to announce the availability of JasPer version 1.900.1.
-
-This release fixes some build problems as well as
-a multiply-defined symbol problem in jpc_qmfb.h.
-
-The new JasPer release is available from the JasPer Project Home Page
-(i.e., http://www.ece.uvic.ca/~mdadams/jasper) and the JPEG web site
-(i.e., http://www.jpeg.org/software).
-
-Regards,
-Michael
-
----
-Michael Adams, Assistant Professor
-Dept. of Elec. and Comp. Engineering, University of Victoria
-P.O. Box 3055 STN CSC, Victoria, BC, V8W 3P6, CANADA
-E-mail: mdadams@ece.uvic.ca, Web: www.ece.uvic.ca/~mdadams
diff --git a/src/3rdparty/jasper/README b/src/3rdparty/jasper/README
deleted file mode 100644
index df33b1b..0000000
--- a/src/3rdparty/jasper/README
+++ /dev/null
@@ -1,21 +0,0 @@
-JasPer Readme
-*************
-
-This is the source code distribution for JasPer. JasPer is a collection
-of software (i.e., a library and application programs) for the coding
-and manipulation of images. This software can handle image data in a
-variety of formats. One such format supported by JasPer is the JPEG-2000
-format defined in ISO/IEC 15444-1.
-
-The complete licensing terms for the JasPer software can be found in
-the file named "LICENSE" in the top level directory of this software
-distribution. Any use of this software contrary to the terms of the
-license is strictly prohibited. The changes made to the software
-since the last release are described in the file "NEWS". Detailed
-documentation on the JasPer software can be found in the JasPer Software
-Reference Manual. This manual is located in the "doc" directory, and
-includes useful information such as: 1) how to build, install, and use
-the software, 2) how to submit report bugs, and 3) where to find
-additional information about the software.
-
-Enjoy! :)
diff --git a/src/3rdparty/jasper/qt_attribution.json b/src/3rdparty/jasper/qt_attribution.json
deleted file mode 100644
index 2cc9d15..0000000
--- a/src/3rdparty/jasper/qt_attribution.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "Id": "jasper",
- "Name": "JasPer",
- "QDocModule": "qtimageformats",
- "QtUsage": "Used in the QJp2 image plugin if no system jasper library is found.",
-
- "Description": "JasPer is a collection of software (i.e., a library and application programs) for the coding and manipulation of images.",
- "Homepage": "http://www.ece.uvic.ca/~mdadams/jasper",
- "Version": "1.900.1",
- "License": "JasPer License",
- "LicenseId": "JasPer-2.0",
- "LicenseFile": "LICENSE",
- "Copyright": "Copyright (c) 1999-2000 Image Power, Inc. and the University of British Columbia.
-Copyright (c) 2001-2006 Michael David Adams.
-"
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_cm.c b/src/3rdparty/jasper/src/libjasper/base/jas_cm.c
deleted file mode 100644
index 6a043e1..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_cm.c
+++ /dev/null
@@ -1,1282 +0,0 @@
-/*
- * Copyright (c) 2002-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Color Management
- *
- * $Id$
- */
-
-#include <jasper/jas_config.h>
-#include <math.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <jasper/jas_cm.h>
-#include <jasper/jas_icc.h>
-#include <jasper/jas_init.h>
-#include <jasper/jas_stream.h>
-#include <jasper/jas_malloc.h>
-#include <jasper/jas_math.h>
-
-static jas_cmprof_t *jas_cmprof_create(void);
-static void jas_cmshapmatlut_cleanup(jas_cmshapmatlut_t *);
-static jas_cmreal_t jas_cmshapmatlut_lookup(jas_cmshapmatlut_t *lut, jas_cmreal_t x);
-
-static void jas_cmpxform_destroy(jas_cmpxform_t *pxform);
-static jas_cmpxform_t *jas_cmpxform_copy(jas_cmpxform_t *pxform);
-
-static void jas_cmshapmat_destroy(jas_cmpxform_t *pxform);
-static int jas_cmshapmat_apply(jas_cmpxform_t *pxform, jas_cmreal_t *in,
- jas_cmreal_t *out, int cnt);
-
-static int jas_cmputint(long **bufptr, int sgnd, int prec, long val);
-static int jas_cmgetint(long **bufptr, int sgnd, int prec, long *val);
-static int jas_cmpxformseq_append(jas_cmpxformseq_t *pxformseq,
- jas_cmpxformseq_t *othpxformseq);
-static int jas_cmpxformseq_appendcnvt(jas_cmpxformseq_t *pxformseq,
- int, int);
-static int jas_cmpxformseq_resize(jas_cmpxformseq_t *pxformseq, int n);
-
-static int mono(jas_iccprof_t *prof, int op, jas_cmpxformseq_t **pxformseq);
-static int triclr(jas_iccprof_t *prof, int op, jas_cmpxformseq_t **retpxformseq);
-
-static void jas_cmpxformseq_destroy(jas_cmpxformseq_t *pxformseq);
-static int jas_cmpxformseq_delete(jas_cmpxformseq_t *pxformseq, int i);
-static jas_cmpxformseq_t *jas_cmpxformseq_create(void);
-static jas_cmpxformseq_t *jas_cmpxformseq_copy(jas_cmpxformseq_t *pxformseq);
-static int jas_cmshapmat_invmat(jas_cmreal_t out[3][4], jas_cmreal_t in[3][4]);
-static int jas_cmpxformseq_insertpxform(jas_cmpxformseq_t *pxformseq,
- int i, jas_cmpxform_t *pxform);
-
-#define SEQFWD(intent) (intent)
-#define SEQREV(intent) (4 + (intent))
-#define SEQSIM(intent) (8 + (intent))
-#define SEQGAM 12
-
-#define fwdpxformseq(prof, intent) \
- (((prof)->pxformseqs[SEQFWD(intent)]) ? \
- ((prof)->pxformseqs[SEQFWD(intent)]) : \
- ((prof)->pxformseqs[SEQFWD(0)]))
-
-#define revpxformseq(prof, intent) \
- (((prof)->pxformseqs[SEQREV(intent)]) ? \
- ((prof)->pxformseqs[SEQREV(intent)]) : \
- ((prof)->pxformseqs[SEQREV(0)]))
-
-#define simpxformseq(prof, intent) \
- (((prof)->pxformseqs[SEQSIM(intent)]) ? \
- ((prof)->pxformseqs[SEQSIM(intent)]) : \
- ((prof)->pxformseqs[SEQSIM(0)]))
-
-#define gampxformseq(prof) ((prof)->pxformseqs[SEQGAM])
-
-static int icctoclrspc(int iccclrspc, int refflag);
-static jas_cmpxform_t *jas_cmpxform_create0(void);
-static jas_cmpxform_t *jas_cmpxform_createshapmat(void);
-static void jas_cmshapmatlut_init(jas_cmshapmatlut_t *lut);
-static int jas_cmshapmatlut_set(jas_cmshapmatlut_t *lut, jas_icccurv_t *curv);
-
-static jas_cmpxformops_t shapmat_ops = {jas_cmshapmat_destroy, jas_cmshapmat_apply, 0};
-static jas_cmprof_t *jas_cmprof_createsycc(void);
-
-/******************************************************************************\
-* Color profile class.
-\******************************************************************************/
-
-jas_cmprof_t *jas_cmprof_createfromclrspc(int clrspc)
-{
- jas_iccprof_t *iccprof;
- jas_cmprof_t *prof;
-
- iccprof = 0;
- prof = 0;
- switch (clrspc) {
- case JAS_CLRSPC_SYCBCR:
- if (!(prof = jas_cmprof_createsycc()))
- goto error;
- break;
- default:
- if (!(iccprof = jas_iccprof_createfromclrspc(clrspc)))
- goto error;
- if (!(prof = jas_cmprof_createfromiccprof(iccprof)))
- goto error;
- jas_iccprof_destroy(iccprof);
- iccprof = 0;
- if (!jas_clrspc_isgeneric(clrspc))
- prof->clrspc = clrspc;
- break;
- }
- return prof;
-error:
- if (iccprof)
- jas_iccprof_destroy(iccprof);
- return 0;
-}
-
-static jas_cmprof_t *jas_cmprof_createsycc()
-{
- jas_cmprof_t *prof;
- jas_cmpxform_t *fwdpxform;
- jas_cmpxform_t *revpxform;
- jas_cmshapmat_t *fwdshapmat;
- jas_cmshapmat_t *revshapmat;
- int i;
- int j;
-
- if (!(prof = jas_cmprof_createfromclrspc(JAS_CLRSPC_SRGB)))
- goto error;
- prof->clrspc = JAS_CLRSPC_SYCBCR;
- assert(prof->numchans == 3 && prof->numrefchans == 3);
- assert(prof->refclrspc == JAS_CLRSPC_CIEXYZ);
- if (!(fwdpxform = jas_cmpxform_createshapmat()))
- goto error;
- fwdpxform->numinchans = 3;
- fwdpxform->numoutchans = 3;
- fwdshapmat = &fwdpxform->data.shapmat;
- fwdshapmat->mono = 0;
- fwdshapmat->order = 0;
- fwdshapmat->useluts = 0;
- fwdshapmat->usemat = 1;
- fwdshapmat->mat[0][0] = 1.0;
- fwdshapmat->mat[0][1] = 0.0;
- fwdshapmat->mat[0][2] = 1.402;
- fwdshapmat->mat[1][0] = 1.0;
- fwdshapmat->mat[1][1] = -0.34413;
- fwdshapmat->mat[1][2] = -0.71414;
- fwdshapmat->mat[2][0] = 1.0;
- fwdshapmat->mat[2][1] = 1.772;
- fwdshapmat->mat[2][2] = 0.0;
- fwdshapmat->mat[0][3] = -0.5 * (1.402);
- fwdshapmat->mat[1][3] = -0.5 * (-0.34413 - 0.71414);
- fwdshapmat->mat[2][3] = -0.5 * (1.772);
- if (!(revpxform = jas_cmpxform_createshapmat()))
- goto error;
- revpxform->numinchans = 3;
- revpxform->numoutchans = 3;
- revshapmat = &revpxform->data.shapmat;
- revshapmat->mono = 0;
- revshapmat->order = 1;
- revshapmat->useluts = 0;
- revshapmat->usemat = 1;
- jas_cmshapmat_invmat(revshapmat->mat, fwdshapmat->mat);
-
- for (i = 0; i < JAS_CMXFORM_NUMINTENTS; ++i) {
- j = SEQFWD(i);
- if (prof->pxformseqs[j]) {
- if (jas_cmpxformseq_insertpxform(prof->pxformseqs[j], 0,
- fwdpxform))
- goto error;
- }
- j = SEQREV(i);
- if (prof->pxformseqs[j]) {
- if (jas_cmpxformseq_insertpxform(prof->pxformseqs[j],
- -1, revpxform))
- goto error;
- }
- }
-
- jas_cmpxform_destroy(fwdpxform);
- jas_cmpxform_destroy(revpxform);
- return prof;
-error:
- return 0;
-}
-
-jas_cmprof_t *jas_cmprof_createfromiccprof(jas_iccprof_t *iccprof)
-{
- jas_cmprof_t *prof;
- jas_icchdr_t icchdr;
- jas_cmpxformseq_t *fwdpxformseq;
- jas_cmpxformseq_t *revpxformseq;
-
- prof = 0;
- fwdpxformseq = 0;
- revpxformseq = 0;
-
- if (!(prof = jas_cmprof_create()))
- goto error;
- jas_iccprof_gethdr(iccprof, &icchdr);
- if (!(prof->iccprof = jas_iccprof_copy(iccprof)))
- goto error;
- prof->clrspc = icctoclrspc(icchdr.colorspc, 0);
- prof->refclrspc = icctoclrspc(icchdr.refcolorspc, 1);
- prof->numchans = jas_clrspc_numchans(prof->clrspc);
- prof->numrefchans = jas_clrspc_numchans(prof->refclrspc);
-
- if (prof->numchans == 1) {
- if (mono(prof->iccprof, 0, &fwdpxformseq))
- goto error;
- if (mono(prof->iccprof, 1, &revpxformseq))
- goto error;
- } else if (prof->numchans == 3) {
- if (triclr(prof->iccprof, 0, &fwdpxformseq))
- goto error;
- if (triclr(prof->iccprof, 1, &revpxformseq))
- goto error;
- }
- prof->pxformseqs[SEQFWD(0)] = fwdpxformseq;
- prof->pxformseqs[SEQREV(0)] = revpxformseq;
-
-#if 0
- if (prof->numchans > 1) {
- lut(prof->iccprof, 0, PER, &pxformseq);
- pxformseqs_set(prof, SEQFWD(PER), pxformseq);
- lut(prof->iccprof, 1, PER, &pxformseq);
- pxformseqs_set(prof, SEQREV(PER), pxformseq);
- lut(prof->iccprof, 0, CLR, &pxformseq);
- pxformseqs_set(prof, SEQREV(CLR), pxformseq);
- lut(prof->iccprof, 1, CLR, &pxformseq);
- pxformseqs_set(prof, SEQREV(CLR), pxformseq);
- lut(prof->iccprof, 0, SAT, &pxformseq);
- pxformseqs_set(prof, SEQREV(SAT), pxformseq);
- lut(prof->iccprof, 1, SAT, &pxformseq);
- pxformseqs_set(prof, SEQREV(SAT), pxformseq);
- }
-#endif
-
- return prof;
-
-error:
- if (fwdpxformseq) {
- jas_cmpxformseq_destroy(fwdpxformseq);
- }
- if (revpxformseq) {
- jas_cmpxformseq_destroy(revpxformseq);
- }
- if (prof) {
- jas_cmprof_destroy(prof);
- }
-
- return 0;
-}
-
-static jas_cmprof_t *jas_cmprof_create()
-{
- int i;
- jas_cmprof_t *prof;
- if (!(prof = jas_malloc(sizeof(jas_cmprof_t))))
- return 0;
- memset(prof, 0, sizeof(jas_cmprof_t));
- prof->iccprof = 0;
- for (i = 0; i < JAS_CMPROF_NUMPXFORMSEQS; ++i)
- prof->pxformseqs[i] = 0;
- return prof;
-}
-
-void jas_cmprof_destroy(jas_cmprof_t *prof)
-{
- int i;
- for (i = 0; i < JAS_CMPROF_NUMPXFORMSEQS; ++i) {
- if (prof->pxformseqs[i]) {
- jas_cmpxformseq_destroy(prof->pxformseqs[i]);
- prof->pxformseqs[i] = 0;
- }
- }
- if (prof->iccprof)
- jas_iccprof_destroy(prof->iccprof);
- jas_free(prof);
-}
-
-jas_cmprof_t *jas_cmprof_copy(jas_cmprof_t *prof)
-{
- jas_cmprof_t *newprof;
- int i;
-
- if (!(newprof = jas_cmprof_create()))
- goto error;
- newprof->clrspc = prof->clrspc;
- newprof->numchans = prof->numchans;
- newprof->refclrspc = prof->refclrspc;
- newprof->numrefchans = prof->numrefchans;
- newprof->iccprof = jas_iccprof_copy(prof->iccprof);
- for (i = 0; i < JAS_CMPROF_NUMPXFORMSEQS; ++i) {
- if (prof->pxformseqs[i]) {
- if (!(newprof->pxformseqs[i] = jas_cmpxformseq_copy(prof->pxformseqs[i])))
- goto error;
- }
- }
- return newprof;
-error:
- return 0;
-}
-
-/******************************************************************************\
-* Transform class.
-\******************************************************************************/
-
-jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof,
- jas_cmprof_t *prfprof, int op, int intent, int optimize)
-{
- jas_cmxform_t *xform;
- jas_cmpxformseq_t *inpxformseq;
- jas_cmpxformseq_t *outpxformseq;
- jas_cmpxformseq_t *altoutpxformseq;
- jas_cmpxformseq_t *prfpxformseq;
- int prfintent;
-
- /* Avoid compiler warnings about unused parameters. */
- optimize = 0;
-
- prfintent = intent;
-
- if (!(xform = jas_malloc(sizeof(jas_cmxform_t))))
- goto error;
- if (!(xform->pxformseq = jas_cmpxformseq_create()))
- goto error;
-
- switch (op) {
- case JAS_CMXFORM_OP_FWD:
- inpxformseq = fwdpxformseq(inprof, intent);
- outpxformseq = revpxformseq(outprof, intent);
- if (!inpxformseq || !outpxformseq)
- goto error;
- if (jas_cmpxformseq_append(xform->pxformseq, inpxformseq) ||
- jas_cmpxformseq_appendcnvt(xform->pxformseq,
- inprof->refclrspc, outprof->refclrspc) ||
- jas_cmpxformseq_append(xform->pxformseq, outpxformseq))
- goto error;
- xform->numinchans = jas_clrspc_numchans(inprof->clrspc);
- xform->numoutchans = jas_clrspc_numchans(outprof->clrspc);
- break;
- case JAS_CMXFORM_OP_REV:
- outpxformseq = fwdpxformseq(outprof, intent);
- inpxformseq = revpxformseq(inprof, intent);
- if (!outpxformseq || !inpxformseq)
- goto error;
- if (jas_cmpxformseq_append(xform->pxformseq, outpxformseq) ||
- jas_cmpxformseq_appendcnvt(xform->pxformseq,
- outprof->refclrspc, inprof->refclrspc) ||
- jas_cmpxformseq_append(xform->pxformseq, inpxformseq))
- goto error;
- xform->numinchans = jas_clrspc_numchans(outprof->clrspc);
- xform->numoutchans = jas_clrspc_numchans(inprof->clrspc);
- break;
- case JAS_CMXFORM_OP_PROOF:
- assert(prfprof);
- inpxformseq = fwdpxformseq(inprof, intent);
- prfpxformseq = fwdpxformseq(prfprof, prfintent);
- if (!inpxformseq || !prfpxformseq)
- goto error;
- outpxformseq = simpxformseq(outprof, intent);
- altoutpxformseq = 0;
- if (!outpxformseq) {
- outpxformseq = revpxformseq(outprof, intent);
- altoutpxformseq = fwdpxformseq(outprof, intent);
- if (!outpxformseq || !altoutpxformseq)
- goto error;
- }
- if (jas_cmpxformseq_append(xform->pxformseq, inpxformseq) ||
- jas_cmpxformseq_appendcnvt(xform->pxformseq,
- inprof->refclrspc, outprof->refclrspc))
- goto error;
- if (altoutpxformseq) {
- if (jas_cmpxformseq_append(xform->pxformseq, outpxformseq) ||
- jas_cmpxformseq_append(xform->pxformseq, altoutpxformseq))
- goto error;
- } else {
- if (jas_cmpxformseq_append(xform->pxformseq, outpxformseq))
- goto error;
- }
- if (jas_cmpxformseq_appendcnvt(xform->pxformseq,
- outprof->refclrspc, inprof->refclrspc) ||
- jas_cmpxformseq_append(xform->pxformseq, prfpxformseq))
- goto error;
- xform->numinchans = jas_clrspc_numchans(inprof->clrspc);
- xform->numoutchans = jas_clrspc_numchans(prfprof->clrspc);
- break;
- case JAS_CMXFORM_OP_GAMUT:
- inpxformseq = fwdpxformseq(inprof, intent);
- outpxformseq = gampxformseq(outprof);
- if (!inpxformseq || !outpxformseq)
- goto error;
- if (jas_cmpxformseq_append(xform->pxformseq, inpxformseq) ||
- jas_cmpxformseq_appendcnvt(xform->pxformseq,
- inprof->refclrspc, outprof->refclrspc) ||
- jas_cmpxformseq_append(xform->pxformseq, outpxformseq))
- goto error;
- xform->numinchans = jas_clrspc_numchans(inprof->clrspc);
- xform->numoutchans = 1;
- break;
- }
- return xform;
-error:
- return 0;
-}
-
-#define APPLYBUFSIZ 2048
-int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in, jas_cmpixmap_t *out)
-{
- jas_cmcmptfmt_t *fmt;
- jas_cmreal_t buf[2][APPLYBUFSIZ];
- jas_cmpxformseq_t *pxformseq;
- int i;
- int j;
- int width;
- int height;
- int total;
- int n;
- jas_cmreal_t *inbuf;
- jas_cmreal_t *outbuf;
- jas_cmpxform_t *pxform;
- long *dataptr;
- int maxchans;
- int bufmax;
- int m;
- int bias;
- jas_cmreal_t scale;
- long v;
- jas_cmreal_t *bufptr;
-
- if (xform->numinchans > in->numcmpts || xform->numoutchans > out->numcmpts)
- goto error;
-
- fmt = &in->cmptfmts[0];
- width = fmt->width;
- height = fmt->height;
- for (i = 1; i < xform->numinchans; ++i) {
- fmt = &in->cmptfmts[i];
- if (fmt->width != width || fmt->height != height) {
- goto error;
- }
- }
- for (i = 0; i < xform->numoutchans; ++i) {
- fmt = &out->cmptfmts[i];
- if (fmt->width != width || fmt->height != height) {
- goto error;
- }
- }
-
- maxchans = 0;
- pxformseq = xform->pxformseq;
- for (i = 0; i < pxformseq->numpxforms; ++i) {
- pxform = pxformseq->pxforms[i];
- if (pxform->numinchans > maxchans) {
- maxchans = pxform->numinchans;
- }
- if (pxform->numoutchans > maxchans) {
- maxchans = pxform->numoutchans;
- }
- }
- bufmax = APPLYBUFSIZ / maxchans;
- assert(bufmax > 0);
-
- total = width * height;
- n = 0;
- while (n < total) {
-
- inbuf = &buf[0][0];
- m = JAS_MIN(total - n, bufmax);
-
- for (i = 0; i < xform->numinchans; ++i) {
- fmt = &in->cmptfmts[i];
- scale = (double)((1 << fmt->prec) - 1);
- bias = fmt->sgnd ? (1 << (fmt->prec - 1)) : 0;
- dataptr = &fmt->buf[n];
- bufptr = &inbuf[i];
- for (j = 0; j < m; ++j) {
- if (jas_cmgetint(&dataptr, fmt->sgnd, fmt->prec, &v))
- goto error;
- *bufptr = (v - bias) / scale;
- bufptr += xform->numinchans;
- }
- }
-
- inbuf = &buf[0][0];
- outbuf = inbuf;
- for (i = 0; i < pxformseq->numpxforms; ++i) {
- pxform = pxformseq->pxforms[i];
- if (pxform->numoutchans > pxform->numinchans) {
- outbuf = (inbuf == &buf[0][0]) ? &buf[1][0] : &buf[0][0];
- } else {
- outbuf = inbuf;
- }
- if ((*pxform->ops->apply)(pxform, inbuf, outbuf, m))
- goto error;
- inbuf = outbuf;
- }
-
- for (i = 0; i < xform->numoutchans; ++i) {
- fmt = &out->cmptfmts[i];
- scale = (double)((1 << fmt->prec) - 1);
- bias = fmt->sgnd ? (1 << (fmt->prec - 1)) : 0;
- bufptr = &outbuf[i];
- dataptr = &fmt->buf[n];
- for (j = 0; j < m; ++j) {
- v = (*bufptr) * scale + bias;
- bufptr += xform->numoutchans;
- if (jas_cmputint(&dataptr, fmt->sgnd, fmt->prec, v))
- goto error;
- }
- }
-
- n += m;
- }
-
- return 0;
-error:
- return -1;
-}
-
-void jas_cmxform_destroy(jas_cmxform_t *xform)
-{
- if (xform->pxformseq)
- jas_cmpxformseq_destroy(xform->pxformseq);
- jas_free(xform);
-}
-
-/******************************************************************************\
-* Primitive transform sequence class.
-\******************************************************************************/
-
-static jas_cmpxformseq_t *jas_cmpxformseq_create()
-{
- jas_cmpxformseq_t *pxformseq;
- pxformseq = 0;
- if (!(pxformseq = jas_malloc(sizeof(jas_cmpxformseq_t))))
- goto error;
- pxformseq->pxforms = 0;
- pxformseq->numpxforms = 0;
- pxformseq->maxpxforms = 0;
- if (jas_cmpxformseq_resize(pxformseq, 16))
- goto error;
- return pxformseq;
-error:
- if (pxformseq)
- jas_cmpxformseq_destroy(pxformseq);
- return 0;
-}
-
-static jas_cmpxformseq_t *jas_cmpxformseq_copy(jas_cmpxformseq_t *pxformseq)
-{
- jas_cmpxformseq_t *newpxformseq;
-
- if (!(newpxformseq = jas_cmpxformseq_create()))
- goto error;
- if (jas_cmpxformseq_append(newpxformseq, pxformseq))
- goto error;
- return newpxformseq;
-error:
- return 0;
-}
-
-static void jas_cmpxformseq_destroy(jas_cmpxformseq_t *pxformseq)
-{
- while (pxformseq->numpxforms > 0)
- jas_cmpxformseq_delete(pxformseq, pxformseq->numpxforms - 1);
- if (pxformseq->pxforms)
- jas_free(pxformseq->pxforms);
- jas_free(pxformseq);
-}
-
-static int jas_cmpxformseq_delete(jas_cmpxformseq_t *pxformseq, int i)
-{
- assert(i >= 0 && i < pxformseq->numpxforms);
- if (i != pxformseq->numpxforms - 1)
- abort();
- jas_cmpxform_destroy(pxformseq->pxforms[i]);
- pxformseq->pxforms[i] = 0;
- --pxformseq->numpxforms;
- return 0;
-}
-
-static int jas_cmpxformseq_appendcnvt(jas_cmpxformseq_t *pxformseq,
- int dstclrspc, int srcclrspc)
-{
- if (dstclrspc == srcclrspc)
- return 0;
- abort();
- /* Avoid compiler warnings about unused parameters. */
- pxformseq = 0;
- return -1;
-}
-
-static int jas_cmpxformseq_insertpxform(jas_cmpxformseq_t *pxformseq,
- int i, jas_cmpxform_t *pxform)
-{
- jas_cmpxform_t *tmppxform;
- int n;
- if (i < 0)
- i = pxformseq->numpxforms;
- assert(i >= 0 && i <= pxformseq->numpxforms);
- if (pxformseq->numpxforms >= pxformseq->maxpxforms) {
- if (jas_cmpxformseq_resize(pxformseq, pxformseq->numpxforms +
- 16))
- goto error;
- }
- assert(pxformseq->numpxforms < pxformseq->maxpxforms);
- if (!(tmppxform = jas_cmpxform_copy(pxform)))
- goto error;
- n = pxformseq->numpxforms - i;
- if (n > 0) {
- memmove(&pxformseq->pxforms[i + 1], &pxformseq->pxforms[i],
- n * sizeof(jas_cmpxform_t *));
- }
- pxformseq->pxforms[i] = tmppxform;
- ++pxformseq->numpxforms;
- return 0;
-error:
- return -1;
-}
-
-static int jas_cmpxformseq_append(jas_cmpxformseq_t *pxformseq,
- jas_cmpxformseq_t *othpxformseq)
-{
- int n;
- int i;
- jas_cmpxform_t *pxform;
- jas_cmpxform_t *othpxform;
- n = pxformseq->numpxforms + othpxformseq->numpxforms;
- if (n > pxformseq->maxpxforms) {
- if (jas_cmpxformseq_resize(pxformseq, n))
- goto error;
- }
- for (i = 0; i < othpxformseq->numpxforms; ++i) {
- othpxform = othpxformseq->pxforms[i];
- if (!(pxform = jas_cmpxform_copy(othpxform)))
- goto error;
- pxformseq->pxforms[pxformseq->numpxforms] = pxform;
- ++pxformseq->numpxforms;
- }
- return 0;
-error:
- return -1;
-}
-
-static int jas_cmpxformseq_resize(jas_cmpxformseq_t *pxformseq, int n)
-{
- jas_cmpxform_t **p;
- assert(n >= pxformseq->numpxforms);
- p = (!pxformseq->pxforms) ? jas_malloc(n * sizeof(jas_cmpxform_t *)) :
- jas_realloc(pxformseq->pxforms, n * sizeof(jas_cmpxform_t *));
- if (!p) {
- return -1;
- }
- pxformseq->pxforms = p;
- pxformseq->maxpxforms = n;
- return 0;
-}
-
-/******************************************************************************\
-* Primitive transform class.
-\******************************************************************************/
-
-static jas_cmpxform_t *jas_cmpxform_create0()
-{
- jas_cmpxform_t *pxform;
- if (!(pxform = jas_malloc(sizeof(jas_cmpxform_t))))
- return 0;
- memset(pxform, 0, sizeof(jas_cmpxform_t));
- pxform->refcnt = 0;
- pxform->ops = 0;
- return pxform;
-}
-
-static void jas_cmpxform_destroy(jas_cmpxform_t *pxform)
-{
- if (--pxform->refcnt <= 0) {
- (*pxform->ops->destroy)(pxform);
- jas_free(pxform);
- }
-}
-
-static jas_cmpxform_t *jas_cmpxform_copy(jas_cmpxform_t *pxform)
-{
- ++pxform->refcnt;
- return pxform;
-}
-
-/******************************************************************************\
-* Shaper matrix class.
-\******************************************************************************/
-
-static jas_cmpxform_t *jas_cmpxform_createshapmat()
-{
- int i;
- int j;
- jas_cmpxform_t *pxform;
- jas_cmshapmat_t *shapmat;
- if (!(pxform = jas_cmpxform_create0()))
- return 0;
- pxform->ops = &shapmat_ops;
- shapmat = &pxform->data.shapmat;
- shapmat->mono = 0;
- shapmat->order = 0;
- shapmat->useluts = 0;
- shapmat->usemat = 0;
- for (i = 0; i < 3; ++i)
- jas_cmshapmatlut_init(&shapmat->luts[i]);
- for (i = 0; i < 3; ++i) {
- for (j = 0; j < 4; ++j)
- shapmat->mat[i][j] = 0.0;
- }
- ++pxform->refcnt;
- return pxform;
-}
-
-static void jas_cmshapmat_destroy(jas_cmpxform_t *pxform)
-{
- jas_cmshapmat_t *shapmat = &pxform->data.shapmat;
- int i;
- for (i = 0; i < 3; ++i)
- jas_cmshapmatlut_cleanup(&shapmat->luts[i]);
-}
-
-static int jas_cmshapmat_apply(jas_cmpxform_t *pxform, jas_cmreal_t *in,
- jas_cmreal_t *out, int cnt)
-{
- jas_cmshapmat_t *shapmat = &pxform->data.shapmat;
- jas_cmreal_t *src;
- jas_cmreal_t *dst;
- jas_cmreal_t a0;
- jas_cmreal_t a1;
- jas_cmreal_t a2;
- jas_cmreal_t b0;
- jas_cmreal_t b1;
- jas_cmreal_t b2;
- src = in;
- dst = out;
- if (!shapmat->mono) {
- while (--cnt >= 0) {
- a0 = *src++;
- a1 = *src++;
- a2 = *src++;
- if (!shapmat->order && shapmat->useluts) {
- a0 = jas_cmshapmatlut_lookup(&shapmat->luts[0], a0);
- a1 = jas_cmshapmatlut_lookup(&shapmat->luts[1], a1);
- a2 = jas_cmshapmatlut_lookup(&shapmat->luts[2], a2);
- }
- if (shapmat->usemat) {
- b0 = shapmat->mat[0][0] * a0
- + shapmat->mat[0][1] * a1
- + shapmat->mat[0][2] * a2
- + shapmat->mat[0][3];
- b1 = shapmat->mat[1][0] * a0
- + shapmat->mat[1][1] * a1
- + shapmat->mat[1][2] * a2
- + shapmat->mat[1][3];
- b2 = shapmat->mat[2][0] * a0
- + shapmat->mat[2][1] * a1
- + shapmat->mat[2][2] * a2
- + shapmat->mat[2][3];
- a0 = b0;
- a1 = b1;
- a2 = b2;
- }
- if (shapmat->order && shapmat->useluts) {
- a0 = jas_cmshapmatlut_lookup(&shapmat->luts[0], a0);
- a1 = jas_cmshapmatlut_lookup(&shapmat->luts[1], a1);
- a2 = jas_cmshapmatlut_lookup(&shapmat->luts[2], a2);
- }
- *dst++ = a0;
- *dst++ = a1;
- *dst++ = a2;
- }
- } else {
- if (!shapmat->order) {
- while (--cnt >= 0) {
- a0 = *src++;
- if (shapmat->useluts)
- a0 = jas_cmshapmatlut_lookup(&shapmat->luts[0], a0);
- a2 = a0 * shapmat->mat[2][0];
- a1 = a0 * shapmat->mat[1][0];
- a0 = a0 * shapmat->mat[0][0];
- *dst++ = a0;
- *dst++ = a1;
- *dst++ = a2;
- }
- } else {
-assert(0);
- while (--cnt >= 0) {
- a0 = *src++;
- src++;
- src++;
- a0 = a0 * shapmat->mat[0][0];
- if (shapmat->useluts)
- a0 = jas_cmshapmatlut_lookup(&shapmat->luts[0], a0);
- *dst++ = a0;
- }
- }
- }
-
- return 0;
-}
-
-static void jas_cmshapmatlut_init(jas_cmshapmatlut_t *lut)
-{
- lut->data = 0;
- lut->size = 0;
-}
-
-static void jas_cmshapmatlut_cleanup(jas_cmshapmatlut_t *lut)
-{
- if (lut->data) {
- jas_free(lut->data);
- lut->data = 0;
- }
- lut->size = 0;
-}
-
-static double gammafn(double x, double gamma)
-{
- if (x == 0.0)
- return 0.0;
- return pow(x, gamma);
-}
-
-static int jas_cmshapmatlut_set(jas_cmshapmatlut_t *lut, jas_icccurv_t *curv)
-{
- jas_cmreal_t gamma;
- int i;
- gamma = 0;
- jas_cmshapmatlut_cleanup(lut);
- if (curv->numents == 0) {
- lut->size = 2;
- if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t))))
- goto error;
- lut->data[0] = 0.0;
- lut->data[1] = 1.0;
- } else if (curv->numents == 1) {
- lut->size = 256;
- if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t))))
- goto error;
- gamma = curv->ents[0] / 256.0;
- for (i = 0; i < lut->size; ++i) {
- lut->data[i] = gammafn(i / (double) (lut->size - 1), gamma);
- }
- } else {
- lut->size = curv->numents;
- if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t))))
- goto error;
- for (i = 0; i < lut->size; ++i) {
- lut->data[i] = curv->ents[i] / 65535.0;
- }
- }
- return 0;
-error:
- return -1;
-}
-
-static jas_cmreal_t jas_cmshapmatlut_lookup(jas_cmshapmatlut_t *lut, jas_cmreal_t x)
-{
- jas_cmreal_t t;
- int lo;
- int hi;
- t = x * (lut->size - 1);
- lo = floor(t);
- if (lo < 0)
- return lut->data[0];
- hi = ceil(t);
- if (hi >= lut->size)
- return lut->data[lut->size - 1];
- return lut->data[lo] + (t - lo) * (lut->data[hi] - lut->data[lo]);
-}
-
-static int jas_cmshapmatlut_invert(jas_cmshapmatlut_t *invlut,
- jas_cmshapmatlut_t *lut, int n)
-{
- int i;
- int j;
- int k;
- jas_cmreal_t ax;
- jas_cmreal_t ay;
- jas_cmreal_t bx;
- jas_cmreal_t by;
- jas_cmreal_t sx;
- jas_cmreal_t sy;
- assert(n >= 2);
- if (invlut->data) {
- jas_free(invlut->data);
- invlut->data = 0;
- }
- /* The sample values should be nondecreasing. */
- for (i = 1; i < lut->size; ++i) {
- if (lut->data[i - 1] > lut->data[i]) {
- assert(0);
- return -1;
- }
- }
- if (!(invlut->data = jas_malloc(n * sizeof(jas_cmreal_t))))
- return -1;
- invlut->size = n;
- for (i = 0; i < invlut->size; ++i) {
- sy = ((double) i) / (invlut->size - 1);
- sx = 1.0;
- for (j = 0; j < lut->size; ++j) {
- ay = lut->data[j];
- if (sy == ay) {
- for (k = j + 1; k < lut->size; ++k) {
- by = lut->data[k];
- if (by != sy)
- break;
-#if 0
-assert(0);
-#endif
- }
- if (k < lut->size) {
- --k;
- ax = ((double) j) / (lut->size - 1);
- bx = ((double) k) / (lut->size - 1);
- sx = (ax + bx) / 2.0;
- }
- break;
- }
- if (j < lut->size - 1) {
- by = lut->data[j + 1];
- if (sy > ay && sy < by) {
- ax = ((double) j) / (lut->size - 1);
- bx = ((double) j + 1) / (lut->size - 1);
- sx = ax +
- (sy - ay) / (by - ay) * (bx - ax);
- break;
- }
- }
- }
- invlut->data[i] = sx;
- }
-#if 0
-for (i=0;i<lut->size;++i)
- jas_eprintf("lut[%d]=%f ", i, lut->data[i]);
-for (i=0;i<invlut->size;++i)
- jas_eprintf("invlut[%d]=%f ", i, invlut->data[i]);
-#endif
- return 0;
-}
-
-static int jas_cmshapmat_invmat(jas_cmreal_t out[3][4], jas_cmreal_t in[3][4])
-{
- jas_cmreal_t d;
- d = in[0][0] * (in[1][1] * in[2][2] - in[1][2] * in[2][1])
- - in[0][1] * (in[1][0] * in[2][2] - in[1][2] * in[2][0])
- + in[0][2] * (in[1][0] * in[2][1] - in[1][1] * in[2][0]);
-#if 0
-jas_eprintf("delta=%f\n", d);
-#endif
- if (JAS_ABS(d) < 1e-6)
- return -1;
- out[0][0] = (in[1][1] * in[2][2] - in[1][2] * in[2][1]) / d;
- out[1][0] = -(in[1][0] * in[2][2] - in[1][2] * in[2][0]) / d;
- out[2][0] = (in[1][0] * in[2][1] - in[1][1] * in[2][0]) / d;
- out[0][1] = -(in[0][1] * in[2][2] - in[0][2] * in[2][1]) / d;
- out[1][1] = (in[0][0] * in[2][2] - in[0][2] * in[2][0]) / d;
- out[2][1] = -(in[0][0] * in[2][1] - in[0][1] * in[2][0]) / d;
- out[0][2] = (in[0][1] * in[1][2] - in[0][2] * in[1][1]) / d;
- out[1][2] = -(in[0][0] * in[1][2] - in[1][0] * in[0][2]) / d;
- out[2][2] = (in[0][0] * in[1][1] - in[0][1] * in[1][0]) / d;
- out[0][3] = -in[0][3];
- out[1][3] = -in[1][3];
- out[2][3] = -in[2][3];
-#if 0
-jas_eprintf("[ %f %f %f %f ]\n[ %f %f %f %f ]\n[ %f %f %f %f ]\n",
-in[0][0], in[0][1], in[0][2], in[0][3],
-in[1][0], in[1][1], in[1][2], in[1][3],
-in[2][0], in[2][1], in[2][2], in[2][3]);
-jas_eprintf("[ %f %f %f %f ]\n[ %f %f %f %f ]\n[ %f %f %f %f ]\n",
-out[0][0], out[0][1], out[0][2], out[0][3],
-out[1][0], out[1][1], out[1][2], out[1][3],
-out[2][0], out[2][1], out[2][2], out[2][3]);
-#endif
- return 0;
-}
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-static int icctoclrspc(int iccclrspc, int refflag)
-{
- if (refflag) {
- switch (iccclrspc) {
- case JAS_ICC_COLORSPC_XYZ:
- return JAS_CLRSPC_CIEXYZ;
- case JAS_ICC_COLORSPC_LAB:
- return JAS_CLRSPC_CIELAB;
- default:
- abort();
- break;
- }
- } else {
- switch (iccclrspc) {
- case JAS_ICC_COLORSPC_YCBCR:
- return JAS_CLRSPC_GENYCBCR;
- case JAS_ICC_COLORSPC_RGB:
- return JAS_CLRSPC_GENRGB;
- case JAS_ICC_COLORSPC_GRAY:
- return JAS_CLRSPC_GENGRAY;
- default:
- abort();
- break;
- }
- }
-}
-
-static int mono(jas_iccprof_t *iccprof, int op, jas_cmpxformseq_t **retpxformseq)
-{
- jas_iccattrval_t *graytrc;
- jas_cmshapmat_t *shapmat;
- jas_cmpxform_t *pxform;
- jas_cmpxformseq_t *pxformseq;
- jas_cmshapmatlut_t lut;
-
- jas_cmshapmatlut_init(&lut);
- if (!(graytrc = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_GRYTRC)) ||
- graytrc->type != JAS_ICC_TYPE_CURV)
- goto error;
- if (!(pxform = jas_cmpxform_createshapmat()))
- goto error;
- shapmat = &pxform->data.shapmat;
- if (!(pxformseq = jas_cmpxformseq_create()))
- goto error;
- if (jas_cmpxformseq_insertpxform(pxformseq, -1, pxform))
- goto error;
-
- pxform->numinchans = 1;
- pxform->numoutchans = 3;
-
- shapmat->mono = 1;
- shapmat->useluts = 1;
- shapmat->usemat = 1;
- if (!op) {
- shapmat->order = 0;
- shapmat->mat[0][0] = 0.9642;
- shapmat->mat[1][0] = 1.0;
- shapmat->mat[2][0] = 0.8249;
- if (jas_cmshapmatlut_set(&shapmat->luts[0], &graytrc->data.curv))
- goto error;
- } else {
- shapmat->order = 1;
- shapmat->mat[0][0] = 1.0 / 0.9642;
- shapmat->mat[1][0] = 1.0;
- shapmat->mat[2][0] = 1.0 / 0.8249;
- jas_cmshapmatlut_init(&lut);
- if (jas_cmshapmatlut_set(&lut, &graytrc->data.curv))
- goto error;
- if (jas_cmshapmatlut_invert(&shapmat->luts[0], &lut, lut.size))
- goto error;
- jas_cmshapmatlut_cleanup(&lut);
- }
- jas_iccattrval_destroy(graytrc);
- jas_cmpxform_destroy(pxform);
- *retpxformseq = pxformseq;
- return 0;
-error:
- return -1;
-}
-
-static int triclr(jas_iccprof_t *iccprof, int op, jas_cmpxformseq_t **retpxformseq)
-{
- int i;
- jas_iccattrval_t *trcs[3];
- jas_iccattrval_t *cols[3];
- jas_cmshapmat_t *shapmat;
- jas_cmpxform_t *pxform;
- jas_cmpxformseq_t *pxformseq;
- jas_cmreal_t mat[3][4];
- jas_cmshapmatlut_t lut;
-
- pxform = 0;
- pxformseq = 0;
- for (i = 0; i < 3; ++i) {
- trcs[i] = 0;
- cols[i] = 0;
- }
- jas_cmshapmatlut_init(&lut);
-
- if (!(trcs[0] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_REDTRC)) ||
- !(trcs[1] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_GRNTRC)) ||
- !(trcs[2] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_BLUTRC)) ||
- !(cols[0] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_REDMATCOL)) ||
- !(cols[1] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_GRNMATCOL)) ||
- !(cols[2] = jas_iccprof_getattr(iccprof, JAS_ICC_TAG_BLUMATCOL)))
- goto error;
- for (i = 0; i < 3; ++i) {
- if (trcs[i]->type != JAS_ICC_TYPE_CURV ||
- cols[i]->type != JAS_ICC_TYPE_XYZ)
- goto error;
- }
- if (!(pxform = jas_cmpxform_createshapmat()))
- goto error;
- pxform->numinchans = 3;
- pxform->numoutchans = 3;
- shapmat = &pxform->data.shapmat;
- if (!(pxformseq = jas_cmpxformseq_create()))
- goto error;
- if (jas_cmpxformseq_insertpxform(pxformseq, -1, pxform))
- goto error;
- shapmat->mono = 0;
- shapmat->useluts = 1;
- shapmat->usemat = 1;
- if (!op) {
- shapmat->order = 0;
- for (i = 0; i < 3; ++i) {
- shapmat->mat[0][i] = cols[i]->data.xyz.x / 65536.0;
- shapmat->mat[1][i] = cols[i]->data.xyz.y / 65536.0;
- shapmat->mat[2][i] = cols[i]->data.xyz.z / 65536.0;
- }
- for (i = 0; i < 3; ++i)
- shapmat->mat[i][3] = 0.0;
- for (i = 0; i < 3; ++i) {
- if (jas_cmshapmatlut_set(&shapmat->luts[i], &trcs[i]->data.curv))
- goto error;
- }
- } else {
- shapmat->order = 1;
- for (i = 0; i < 3; ++i) {
- mat[0][i] = cols[i]->data.xyz.x / 65536.0;
- mat[1][i] = cols[i]->data.xyz.y / 65536.0;
- mat[2][i] = cols[i]->data.xyz.z / 65536.0;
- }
- for (i = 0; i < 3; ++i)
- mat[i][3] = 0.0;
- if (jas_cmshapmat_invmat(shapmat->mat, mat))
- goto error;
- for (i = 0; i < 3; ++i) {
- jas_cmshapmatlut_init(&lut);
- if (jas_cmshapmatlut_set(&lut, &trcs[i]->data.curv))
- goto error;
- if (jas_cmshapmatlut_invert(&shapmat->luts[i], &lut, lut.size))
- goto error;
- jas_cmshapmatlut_cleanup(&lut);
- }
- }
- for (i = 0; i < 3; ++i) {
- jas_iccattrval_destroy(trcs[i]);
- jas_iccattrval_destroy(cols[i]);
- }
- jas_cmpxform_destroy(pxform);
- *retpxformseq = pxformseq;
- return 0;
-
-error:
-
- for (i = 0; i < 3; ++i) {
- if (trcs[i]) {
- jas_iccattrval_destroy(trcs[i]);
- }
- if (cols[i]) {
- jas_iccattrval_destroy(cols[i]);
- }
- }
- if (pxformseq) {
- jas_cmpxformseq_destroy(pxformseq);
- }
- if (pxform) {
- jas_cmpxform_destroy(pxform);
- }
-
- return -1;
-}
-
-static int jas_cmgetint(long **bufptr, int sgnd, int prec, long *val)
-{
- long v;
- int m;
- v = **bufptr;
- if (sgnd) {
- m = (1 << (prec - 1));
- if (v < -m || v >= m)
- return -1;
- } else {
- if (v < 0 || v >= (1 << prec))
- return -1;
- }
- ++(*bufptr);
- *val = v;
- return 0;
-}
-
-static int jas_cmputint(long **bufptr, int sgnd, int prec, long val)
-{
- int m;
- if (sgnd) {
- m = (1 << (prec - 1));
- if (val < -m || val >= m)
- return -1;
- } else {
- if (val < 0 || val >= (1 << prec))
- return -1;
- }
- **bufptr = val;
- ++(*bufptr);
- return 0;
-}
-
-int jas_clrspc_numchans(int clrspc)
-{
- switch (jas_clrspc_fam(clrspc)) {
- case JAS_CLRSPC_FAM_XYZ:
- case JAS_CLRSPC_FAM_LAB:
- case JAS_CLRSPC_FAM_RGB:
- case JAS_CLRSPC_FAM_YCBCR:
- return 3;
- break;
- case JAS_CLRSPC_FAM_GRAY:
- return 1;
- break;
- default:
- abort();
- break;
- }
-}
-
-jas_iccprof_t *jas_iccprof_createfromcmprof(jas_cmprof_t *prof)
-{
- return jas_iccprof_copy(prof->iccprof);
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_debug.c b/src/3rdparty/jasper/src/libjasper/base/jas_debug.c
deleted file mode 100644
index 3d8b3d6..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_debug.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "jasper/jas_types.h"
-#include "jasper/jas_debug.h"
-
-/******************************************************************************\
-* Local data.
-\******************************************************************************/
-
-static int jas_dbglevel = 0;
-/* The debug level. */
-
-/******************************************************************************\
-* Code for getting/setting the debug level.
-\******************************************************************************/
-
-/* Set the library debug level. */
-int jas_setdbglevel(int dbglevel)
-{
- int olddbglevel;
-
- /* Save the old debug level. */
- olddbglevel = jas_dbglevel;
-
- /* Change the debug level. */
- jas_dbglevel = dbglevel;
-
- /* Return the old debug level. */
- return olddbglevel;
-}
-
-/* Get the library debug level. */
-int jas_getdbglevel()
-{
- return jas_dbglevel;
-}
-
-/******************************************************************************\
-* Code.
-\******************************************************************************/
-
-/* Perform formatted output to standard error. */
-int jas_eprintf(const char *fmt, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vfprintf(stderr, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-/* Dump memory to a stream. */
-int jas_memdump(FILE *out, void *data, size_t len)
-{
- size_t i;
- size_t j;
- uchar *dp;
- dp = data;
- for (i = 0; i < len; i += 16) {
- fprintf(out, "%04x:", i);
- for (j = 0; j < 16; ++j) {
- if (i + j < len) {
- fprintf(out, " %02x", dp[i + j]);
- }
- }
- fprintf(out, "\n");
- }
- return 0;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_getopt.c b/src/3rdparty/jasper/src/libjasper/base/jas_getopt.c
deleted file mode 100644
index 6b65a30..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_getopt.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 1999-2000, Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Command Line Option Parsing Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdio.h>
-#include <string.h>
-
-#include "jasper/jas_debug.h"
-#include "jasper/jas_getopt.h"
-#include "jasper/jas_math.h"
-
-/******************************************************************************\
-* Global data.
-\******************************************************************************/
-
-int jas_optind = 0;
-int jas_opterr = 1;
-char *jas_optarg = 0;
-
-/******************************************************************************\
-* Code.
-\******************************************************************************/
-
-static jas_opt_t *jas_optlookup(jas_opt_t *opts, char *name)
-{
- jas_opt_t *opt;
-
- for (opt = opts; opt->id >= 0 && opt->name; ++opt) {
- if (!strcmp(opt->name, name)) {
- return opt;
- }
- }
- return 0;
-}
-
-int jas_getopt(int argc, char **argv, jas_opt_t *opts)
-{
- char *cp;
- int id;
- int hasarg;
- jas_opt_t *opt;
- char *s;
-
- if (!jas_optind) {
- jas_optind = JAS_MIN(1, argc);
- }
- while (jas_optind < argc) {
- s = cp = argv[jas_optind];
- if (*cp == '-') {
- /* We are processing an option. */
- ++jas_optind;
- if (*++cp == '-') {
- /* We are processing a long option. */
- ++cp;
- if (*cp == '\0') {
- /* This is the end of the options. */
- return JAS_GETOPT_EOF;
- }
- if (!(opt = jas_optlookup(opts, cp))) {
- if (jas_opterr) {
- jas_eprintf("unknown long option %s\n", s);
- }
- return JAS_GETOPT_ERR;
- }
- hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
- id = opt->id;
- } else {
- /* We are processing a short option. */
- if (strlen(cp) != 1 ||
- !(opt = jas_optlookup(opts, cp))) {
- if (jas_opterr) {
- jas_eprintf("unknown short option %s\n", s);
- }
- return JAS_GETOPT_ERR;
- }
- hasarg = (opt->flags & JAS_OPT_HASARG) != 0;
- id = opt->id;
- }
- if (hasarg) {
- /* The option has an argument. */
- if (jas_optind >= argc) {
- if (jas_opterr) {
- jas_eprintf("missing argument for option %s\n", s);
- }
- return JAS_GETOPT_ERR;
- }
- jas_optarg = argv[jas_optind];
- ++jas_optind;
- } else {
- /* The option does not have an argument. */
- jas_optarg = 0;
- }
- return id;
- } else {
- /* We are not processing an option. */
- return JAS_GETOPT_EOF;
- }
- }
- return JAS_GETOPT_EOF;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_icc.c b/src/3rdparty/jasper/src/libjasper/base/jas_icc.c
deleted file mode 100644
index 37eb787..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_icc.c
+++ /dev/null
@@ -1,1722 +0,0 @@
-/*
- * Copyright (c) 2002-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#include <assert.h>
-#include <jasper/jas_config.h>
-#include <jasper/jas_types.h>
-#include <jasper/jas_malloc.h>
-#include <jasper/jas_debug.h>
-#include <jasper/jas_icc.h>
-#include <jasper/jas_cm.h>
-#include <jasper/jas_stream.h>
-#include <jasper/jas_string.h>
-
-#include <stdlib.h>
-#include <ctype.h>
-
-#define jas_iccputuint8(out, val) jas_iccputuint(out, 1, val)
-#define jas_iccputuint16(out, val) jas_iccputuint(out, 2, val)
-#define jas_iccputsint32(out, val) jas_iccputsint(out, 4, val)
-#define jas_iccputuint32(out, val) jas_iccputuint(out, 4, val)
-#define jas_iccputuint64(out, val) jas_iccputuint(out, 8, val)
-
-static jas_iccattrval_t *jas_iccattrval_create0(void);
-
-static int jas_iccgetuint(jas_stream_t *in, int n, ulonglong *val);
-static int jas_iccgetuint8(jas_stream_t *in, jas_iccuint8_t *val);
-static int jas_iccgetuint16(jas_stream_t *in, jas_iccuint16_t *val);
-static int jas_iccgetsint32(jas_stream_t *in, jas_iccsint32_t *val);
-static int jas_iccgetuint32(jas_stream_t *in, jas_iccuint32_t *val);
-static int jas_iccgetuint64(jas_stream_t *in, jas_iccuint64_t *val);
-static int jas_iccputuint(jas_stream_t *out, int n, ulonglong val);
-static int jas_iccputsint(jas_stream_t *out, int n, longlong val);
-static jas_iccprof_t *jas_iccprof_create(void);
-static int jas_iccprof_readhdr(jas_stream_t *in, jas_icchdr_t *hdr);
-static int jas_iccprof_writehdr(jas_stream_t *out, jas_icchdr_t *hdr);
-static int jas_iccprof_gettagtab(jas_stream_t *in, jas_icctagtab_t *tagtab);
-static void jas_iccprof_sorttagtab(jas_icctagtab_t *tagtab);
-static int jas_iccattrtab_lookup(jas_iccattrtab_t *attrtab, jas_iccuint32_t name);
-static jas_iccattrtab_t *jas_iccattrtab_copy(jas_iccattrtab_t *attrtab);
-static jas_iccattrvalinfo_t *jas_iccattrvalinfo_lookup(jas_iccsig_t name);
-static int jas_iccgettime(jas_stream_t *in, jas_icctime_t *time);
-static int jas_iccgetxyz(jas_stream_t *in, jas_iccxyz_t *xyz);
-static int jas_icctagtabent_cmp(const void *src, const void *dst);
-
-static void jas_icccurv_destroy(jas_iccattrval_t *attrval);
-static int jas_icccurv_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval);
-static int jas_icccurv_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt);
-static int jas_icccurv_getsize(jas_iccattrval_t *attrval);
-static int jas_icccurv_output(jas_iccattrval_t *attrval, jas_stream_t *out);
-static void jas_icccurv_dump(jas_iccattrval_t *attrval, FILE *out);
-
-static void jas_icctxtdesc_destroy(jas_iccattrval_t *attrval);
-static int jas_icctxtdesc_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval);
-static int jas_icctxtdesc_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt);
-static int jas_icctxtdesc_getsize(jas_iccattrval_t *attrval);
-static int jas_icctxtdesc_output(jas_iccattrval_t *attrval, jas_stream_t *out);
-static void jas_icctxtdesc_dump(jas_iccattrval_t *attrval, FILE *out);
-
-static void jas_icctxt_destroy(jas_iccattrval_t *attrval);
-static int jas_icctxt_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval);
-static int jas_icctxt_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt);
-static int jas_icctxt_getsize(jas_iccattrval_t *attrval);
-static int jas_icctxt_output(jas_iccattrval_t *attrval, jas_stream_t *out);
-static void jas_icctxt_dump(jas_iccattrval_t *attrval, FILE *out);
-
-static int jas_iccxyz_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt);
-static int jas_iccxyz_getsize(jas_iccattrval_t *attrval);
-static int jas_iccxyz_output(jas_iccattrval_t *attrval, jas_stream_t *out);
-static void jas_iccxyz_dump(jas_iccattrval_t *attrval, FILE *out);
-
-static jas_iccattrtab_t *jas_iccattrtab_create(void);
-static void jas_iccattrtab_destroy(jas_iccattrtab_t *tab);
-static int jas_iccattrtab_resize(jas_iccattrtab_t *tab, int maxents);
-static int jas_iccattrtab_add(jas_iccattrtab_t *attrtab, int i,
- jas_iccuint32_t name, jas_iccattrval_t *val);
-static int jas_iccattrtab_replace(jas_iccattrtab_t *attrtab, int i,
- jas_iccuint32_t name, jas_iccattrval_t *val);
-static void jas_iccattrtab_delete(jas_iccattrtab_t *attrtab, int i);
-static long jas_iccpadtomult(long x, long y);
-static int jas_iccattrtab_get(jas_iccattrtab_t *attrtab, int i,
- jas_iccattrname_t *name, jas_iccattrval_t **val);
-static int jas_iccprof_puttagtab(jas_stream_t *out, jas_icctagtab_t *tagtab);
-
-static void jas_icclut16_destroy(jas_iccattrval_t *attrval);
-static int jas_icclut16_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval);
-static int jas_icclut16_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt);
-static int jas_icclut16_getsize(jas_iccattrval_t *attrval);
-static int jas_icclut16_output(jas_iccattrval_t *attrval, jas_stream_t *out);
-static void jas_icclut16_dump(jas_iccattrval_t *attrval, FILE *out);
-
-static void jas_icclut8_destroy(jas_iccattrval_t *attrval);
-static int jas_icclut8_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval);
-static int jas_icclut8_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt);
-static int jas_icclut8_getsize(jas_iccattrval_t *attrval);
-static int jas_icclut8_output(jas_iccattrval_t *attrval, jas_stream_t *out);
-static void jas_icclut8_dump(jas_iccattrval_t *attrval, FILE *out);
-
-static int jas_iccputtime(jas_stream_t *out, jas_icctime_t *ctime);
-static int jas_iccputxyz(jas_stream_t *out, jas_iccxyz_t *xyz);
-
-static long jas_iccpowi(int x, int n);
-
-static char *jas_iccsigtostr(int sig, char *buf);
-
-
-jas_iccattrvalinfo_t jas_iccattrvalinfos[] = {
- {JAS_ICC_TYPE_CURV, {jas_icccurv_destroy, jas_icccurv_copy,
- jas_icccurv_input, jas_icccurv_output, jas_icccurv_getsize,
- jas_icccurv_dump}},
- {JAS_ICC_TYPE_XYZ, {0, 0, jas_iccxyz_input, jas_iccxyz_output,
- jas_iccxyz_getsize, jas_iccxyz_dump}},
- {JAS_ICC_TYPE_TXTDESC, {jas_icctxtdesc_destroy,
- jas_icctxtdesc_copy, jas_icctxtdesc_input, jas_icctxtdesc_output,
- jas_icctxtdesc_getsize, jas_icctxtdesc_dump}},
- {JAS_ICC_TYPE_TXT, {jas_icctxt_destroy, jas_icctxt_copy,
- jas_icctxt_input, jas_icctxt_output, jas_icctxt_getsize,
- jas_icctxt_dump}},
- {JAS_ICC_TYPE_LUT8, {jas_icclut8_destroy, jas_icclut8_copy,
- jas_icclut8_input, jas_icclut8_output, jas_icclut8_getsize,
- jas_icclut8_dump}},
- {JAS_ICC_TYPE_LUT16, {jas_icclut16_destroy, jas_icclut16_copy,
- jas_icclut16_input, jas_icclut16_output, jas_icclut16_getsize,
- jas_icclut16_dump}},
- {0, {0, 0, 0, 0, 0, 0}}
-};
-
-typedef struct {
- jas_iccuint32_t tag;
- char *name;
-} jas_icctaginfo_t;
-
-/******************************************************************************\
-* profile class
-\******************************************************************************/
-
-static jas_iccprof_t *jas_iccprof_create()
-{
- jas_iccprof_t *prof;
- prof = 0;
- if (!(prof = jas_malloc(sizeof(jas_iccprof_t)))) {
- goto error;
- }
- if (!(prof->attrtab = jas_iccattrtab_create()))
- goto error;
- memset(&prof->hdr, 0, sizeof(jas_icchdr_t));
- prof->tagtab.numents = 0;
- prof->tagtab.ents = 0;
- return prof;
-error:
- if (prof)
- jas_iccprof_destroy(prof);
- return 0;
-}
-
-jas_iccprof_t *jas_iccprof_copy(jas_iccprof_t *prof)
-{
- jas_iccprof_t *newprof;
- newprof = 0;
- if (!(newprof = jas_iccprof_create()))
- goto error;
- newprof->hdr = prof->hdr;
- newprof->tagtab.numents = 0;
- newprof->tagtab.ents = 0;
- assert(newprof->attrtab);
- jas_iccattrtab_destroy(newprof->attrtab);
- if (!(newprof->attrtab = jas_iccattrtab_copy(prof->attrtab)))
- goto error;
- return newprof;
-error:
- if (newprof)
- jas_iccprof_destroy(newprof);
- return 0;
-}
-
-void jas_iccprof_destroy(jas_iccprof_t *prof)
-{
- if (prof->attrtab)
- jas_iccattrtab_destroy(prof->attrtab);
- if (prof->tagtab.ents)
- jas_free(prof->tagtab.ents);
- jas_free(prof);
-}
-
-void jas_iccprof_dump(jas_iccprof_t *prof, FILE *out)
-{
- jas_iccattrtab_dump(prof->attrtab, out);
-}
-
-jas_iccprof_t *jas_iccprof_load(jas_stream_t *in)
-{
- jas_iccprof_t *prof;
- int numtags;
- long curoff;
- long reloff;
- long prevoff;
- jas_iccsig_t type;
- jas_iccattrval_t *attrval;
- jas_iccattrval_t *prevattrval;
- jas_icctagtabent_t *tagtabent;
- jas_iccattrvalinfo_t *attrvalinfo;
- int i;
- int len;
-
- prof = 0;
- attrval = 0;
-
- if (!(prof = jas_iccprof_create())) {
- goto error;
- }
-
- if (jas_iccprof_readhdr(in, &prof->hdr)) {
- jas_eprintf("cannot get header\n");
- goto error;
- }
- if (jas_iccprof_gettagtab(in, &prof->tagtab)) {
- jas_eprintf("cannot get tab table\n");
- goto error;
- }
- jas_iccprof_sorttagtab(&prof->tagtab);
-
- numtags = prof->tagtab.numents;
- curoff = JAS_ICC_HDRLEN + 4 + 12 * numtags;
- prevoff = 0;
- prevattrval = 0;
- for (i = 0; i < numtags; ++i) {
- tagtabent = &prof->tagtab.ents[i];
- if (tagtabent->off == JAS_CAST(jas_iccuint32_t, prevoff)) {
- if (prevattrval) {
- if (!(attrval = jas_iccattrval_clone(prevattrval)))
- goto error;
- if (jas_iccprof_setattr(prof, tagtabent->tag, attrval))
- goto error;
- jas_iccattrval_destroy(attrval);
- } else {
-#if 0
- jas_eprintf("warning: skipping unknown tag type\n");
-#endif
- }
- continue;
- }
- reloff = tagtabent->off - curoff;
- if (reloff > 0) {
- if (jas_stream_gobble(in, reloff) != reloff)
- goto error;
- curoff += reloff;
- } else if (reloff < 0) {
- /* This should never happen since we read the tagged
- element data in a single pass. */
- abort();
- }
- prevoff = curoff;
- if (jas_iccgetuint32(in, &type)) {
- goto error;
- }
- if (jas_stream_gobble(in, 4) != 4) {
- goto error;
- }
- curoff += 8;
- if (!(attrvalinfo = jas_iccattrvalinfo_lookup(type))) {
-#if 0
- jas_eprintf("warning: skipping unknown tag type\n");
-#endif
- prevattrval = 0;
- continue;
- }
- if (!(attrval = jas_iccattrval_create(type))) {
- goto error;
- }
- len = tagtabent->len - 8;
- if ((*attrval->ops->input)(attrval, in, len)) {
- goto error;
- }
- curoff += len;
- if (jas_iccprof_setattr(prof, tagtabent->tag, attrval)) {
- goto error;
- }
- prevattrval = attrval; /* This is correct, but slimey. */
- jas_iccattrval_destroy(attrval);
- attrval = 0;
- }
-
- return prof;
-
-error:
- if (prof)
- jas_iccprof_destroy(prof);
- if (attrval)
- jas_iccattrval_destroy(attrval);
- return 0;
-}
-
-int jas_iccprof_save(jas_iccprof_t *prof, jas_stream_t *out)
-{
- long curoff;
- long reloff;
- long newoff;
- int i;
- int j;
- jas_icctagtabent_t *tagtabent;
- jas_icctagtabent_t *sharedtagtabent;
- jas_icctagtabent_t *tmptagtabent;
- jas_iccuint32_t attrname;
- jas_iccattrval_t *attrval;
- jas_icctagtab_t *tagtab;
-
- tagtab = &prof->tagtab;
- if (!(tagtab->ents = jas_malloc(prof->attrtab->numattrs *
- sizeof(jas_icctagtabent_t))))
- goto error;
- tagtab->numents = prof->attrtab->numattrs;
- curoff = JAS_ICC_HDRLEN + 4 + 12 * tagtab->numents;
- for (i = 0; i < JAS_CAST(int, tagtab->numents); ++i) {
- tagtabent = &tagtab->ents[i];
- if (jas_iccattrtab_get(prof->attrtab, i, &attrname, &attrval))
- goto error;
- assert(attrval->ops->output);
- tagtabent->tag = attrname;
- tagtabent->data = &attrval->data;
- sharedtagtabent = 0;
- for (j = 0; j < i; ++j) {
- tmptagtabent = &tagtab->ents[j];
- if (tagtabent->data == tmptagtabent->data) {
- sharedtagtabent = tmptagtabent;
- break;
- }
- }
- if (sharedtagtabent) {
- tagtabent->off = sharedtagtabent->off;
- tagtabent->len = sharedtagtabent->len;
- tagtabent->first = sharedtagtabent;
- } else {
- tagtabent->off = curoff;
- tagtabent->len = (*attrval->ops->getsize)(attrval) + 8;
- tagtabent->first = 0;
- if (i < JAS_CAST(int, tagtab->numents - 1)) {
- curoff = jas_iccpadtomult(curoff + tagtabent->len, 4);
- } else {
- curoff += tagtabent->len;
- }
- }
- jas_iccattrval_destroy(attrval);
- }
- prof->hdr.size = curoff;
- if (jas_iccprof_writehdr(out, &prof->hdr))
- goto error;
- if (jas_iccprof_puttagtab(out, &prof->tagtab))
- goto error;
- curoff = JAS_ICC_HDRLEN + 4 + 12 * tagtab->numents;
- for (i = 0; i < JAS_CAST(int, tagtab->numents);) {
- tagtabent = &tagtab->ents[i];
- assert(curoff == JAS_CAST(long, tagtabent->off));
- if (jas_iccattrtab_get(prof->attrtab, i, &attrname, &attrval))
- goto error;
- if (jas_iccputuint32(out, attrval->type) || jas_stream_pad(out,
- 4, 0) != 4)
- goto error;
- if ((*attrval->ops->output)(attrval, out))
- goto error;
- jas_iccattrval_destroy(attrval);
- curoff += tagtabent->len;
- ++i;
- while (i < JAS_CAST(int, tagtab->numents) &&
- tagtab->ents[i].first)
- ++i;
- newoff = (i < JAS_CAST(int, tagtab->numents)) ?
- tagtab->ents[i].off : prof->hdr.size;
- reloff = newoff - curoff;
- assert(reloff >= 0);
- if (reloff > 0) {
- if (jas_stream_pad(out, reloff, 0) != reloff)
- goto error;
- curoff += reloff;
- }
- }
- return 0;
-error:
- /* XXX - need to free some resources here */
- return -1;
-}
-
-static int jas_iccprof_writehdr(jas_stream_t *out, jas_icchdr_t *hdr)
-{
- if (jas_iccputuint32(out, hdr->size) ||
- jas_iccputuint32(out, hdr->cmmtype) ||
- jas_iccputuint32(out, hdr->version) ||
- jas_iccputuint32(out, hdr->clas) ||
- jas_iccputuint32(out, hdr->colorspc) ||
- jas_iccputuint32(out, hdr->refcolorspc) ||
- jas_iccputtime(out, &hdr->ctime) ||
- jas_iccputuint32(out, hdr->magic) ||
- jas_iccputuint32(out, hdr->platform) ||
- jas_iccputuint32(out, hdr->flags) ||
- jas_iccputuint32(out, hdr->maker) ||
- jas_iccputuint32(out, hdr->model) ||
- jas_iccputuint64(out, hdr->attr) ||
- jas_iccputuint32(out, hdr->intent) ||
- jas_iccputxyz(out, &hdr->illum) ||
- jas_iccputuint32(out, hdr->creator) ||
- jas_stream_pad(out, 44, 0) != 44)
- return -1;
- return 0;
-}
-
-static int jas_iccprof_puttagtab(jas_stream_t *out, jas_icctagtab_t *tagtab)
-{
- int i;
- jas_icctagtabent_t *tagtabent;
- if (jas_iccputuint32(out, tagtab->numents))
- goto error;
- for (i = 0; i < JAS_CAST(int, tagtab->numents); ++i) {
- tagtabent = &tagtab->ents[i];
- if (jas_iccputuint32(out, tagtabent->tag) ||
- jas_iccputuint32(out, tagtabent->off) ||
- jas_iccputuint32(out, tagtabent->len))
- goto error;
- }
- return 0;
-error:
- return -1;
-}
-
-static int jas_iccprof_readhdr(jas_stream_t *in, jas_icchdr_t *hdr)
-{
- if (jas_iccgetuint32(in, &hdr->size) ||
- jas_iccgetuint32(in, &hdr->cmmtype) ||
- jas_iccgetuint32(in, &hdr->version) ||
- jas_iccgetuint32(in, &hdr->clas) ||
- jas_iccgetuint32(in, &hdr->colorspc) ||
- jas_iccgetuint32(in, &hdr->refcolorspc) ||
- jas_iccgettime(in, &hdr->ctime) ||
- jas_iccgetuint32(in, &hdr->magic) ||
- jas_iccgetuint32(in, &hdr->platform) ||
- jas_iccgetuint32(in, &hdr->flags) ||
- jas_iccgetuint32(in, &hdr->maker) ||
- jas_iccgetuint32(in, &hdr->model) ||
- jas_iccgetuint64(in, &hdr->attr) ||
- jas_iccgetuint32(in, &hdr->intent) ||
- jas_iccgetxyz(in, &hdr->illum) ||
- jas_iccgetuint32(in, &hdr->creator) ||
- jas_stream_gobble(in, 44) != 44)
- return -1;
- return 0;
-}
-
-static int jas_iccprof_gettagtab(jas_stream_t *in, jas_icctagtab_t *tagtab)
-{
- int i;
- jas_icctagtabent_t *tagtabent;
-
- if (tagtab->ents) {
- jas_free(tagtab->ents);
- tagtab->ents = 0;
- }
- if (jas_iccgetuint32(in, &tagtab->numents))
- goto error;
- if (!(tagtab->ents = jas_malloc(tagtab->numents *
- sizeof(jas_icctagtabent_t))))
- goto error;
- tagtabent = tagtab->ents;
- for (i = 0; i < JAS_CAST(long, tagtab->numents); ++i) {
- if (jas_iccgetuint32(in, &tagtabent->tag) ||
- jas_iccgetuint32(in, &tagtabent->off) ||
- jas_iccgetuint32(in, &tagtabent->len))
- goto error;
- ++tagtabent;
- }
- return 0;
-error:
- if (tagtab->ents) {
- jas_free(tagtab->ents);
- tagtab->ents = 0;
- }
- return -1;
-}
-
-jas_iccattrval_t *jas_iccprof_getattr(jas_iccprof_t *prof,
- jas_iccattrname_t name)
-{
- int i;
- jas_iccattrval_t *attrval;
- if ((i = jas_iccattrtab_lookup(prof->attrtab, name)) < 0)
- goto error;
- if (!(attrval = jas_iccattrval_clone(prof->attrtab->attrs[i].val)))
- goto error;
- return attrval;
-error:
- return 0;
-}
-
-int jas_iccprof_setattr(jas_iccprof_t *prof, jas_iccattrname_t name,
- jas_iccattrval_t *val)
-{
- int i;
- if ((i = jas_iccattrtab_lookup(prof->attrtab, name)) >= 0) {
- if (val) {
- if (jas_iccattrtab_replace(prof->attrtab, i, name, val))
- goto error;
- } else {
- jas_iccattrtab_delete(prof->attrtab, i);
- }
- } else {
- if (val) {
- if (jas_iccattrtab_add(prof->attrtab, -1, name, val))
- goto error;
- } else {
- /* NOP */
- }
- }
- return 0;
-error:
- return -1;
-}
-
-int jas_iccprof_gethdr(jas_iccprof_t *prof, jas_icchdr_t *hdr)
-{
- *hdr = prof->hdr;
- return 0;
-}
-
-int jas_iccprof_sethdr(jas_iccprof_t *prof, jas_icchdr_t *hdr)
-{
- prof->hdr = *hdr;
- return 0;
-}
-
-static void jas_iccprof_sorttagtab(jas_icctagtab_t *tagtab)
-{
- qsort(tagtab->ents, tagtab->numents, sizeof(jas_icctagtabent_t),
- jas_icctagtabent_cmp);
-}
-
-static int jas_icctagtabent_cmp(const void *src, const void *dst)
-{
- jas_icctagtabent_t *srctagtabent = JAS_CAST(jas_icctagtabent_t *, src);
- jas_icctagtabent_t *dsttagtabent = JAS_CAST(jas_icctagtabent_t *, dst);
- if (srctagtabent->off > dsttagtabent->off) {
- return 1;
- } else if (srctagtabent->off < dsttagtabent->off) {
- return -1;
- }
- return 0;
-}
-
-static jas_iccattrvalinfo_t *jas_iccattrvalinfo_lookup(jas_iccsig_t type)
-{
- jas_iccattrvalinfo_t *info;
- info = jas_iccattrvalinfos;
- for (info = jas_iccattrvalinfos; info->type; ++info) {
- if (info->type == type) {
- return info;
- }
- }
- return 0;
-}
-
-static int jas_iccgettime(jas_stream_t *in, jas_icctime_t *time)
-{
- if (jas_iccgetuint16(in, &time->year) ||
- jas_iccgetuint16(in, &time->month) ||
- jas_iccgetuint16(in, &time->day) ||
- jas_iccgetuint16(in, &time->hour) ||
- jas_iccgetuint16(in, &time->min) ||
- jas_iccgetuint16(in, &time->sec)) {
- return -1;
- }
- return 0;
-}
-
-static int jas_iccgetxyz(jas_stream_t *in, jas_iccxyz_t *xyz)
-{
- if (jas_iccgetsint32(in, &xyz->x) ||
- jas_iccgetsint32(in, &xyz->y) ||
- jas_iccgetsint32(in, &xyz->z)) {
- return -1;
- }
- return 0;
-}
-
-static int jas_iccputtime(jas_stream_t *out, jas_icctime_t *time)
-{
- jas_iccputuint16(out, time->year);
- jas_iccputuint16(out, time->month);
- jas_iccputuint16(out, time->day);
- jas_iccputuint16(out, time->hour);
- jas_iccputuint16(out, time->min);
- jas_iccputuint16(out, time->sec);
- return 0;
-}
-
-static int jas_iccputxyz(jas_stream_t *out, jas_iccxyz_t *xyz)
-{
- jas_iccputuint32(out, xyz->x);
- jas_iccputuint32(out, xyz->y);
- jas_iccputuint32(out, xyz->z);
- return 0;
-}
-
-/******************************************************************************\
-* attribute table class
-\******************************************************************************/
-
-static jas_iccattrtab_t *jas_iccattrtab_create()
-{
- jas_iccattrtab_t *tab;
- tab = 0;
- if (!(tab = jas_malloc(sizeof(jas_iccattrtab_t))))
- goto error;
- tab->maxattrs = 0;
- tab->numattrs = 0;
- tab->attrs = 0;
- if (jas_iccattrtab_resize(tab, 32))
- goto error;
- return tab;
-error:
- if (tab)
- jas_iccattrtab_destroy(tab);
- return 0;
-}
-
-static jas_iccattrtab_t *jas_iccattrtab_copy(jas_iccattrtab_t *attrtab)
-{
- jas_iccattrtab_t *newattrtab;
- int i;
- if (!(newattrtab = jas_iccattrtab_create()))
- goto error;
- for (i = 0; i < attrtab->numattrs; ++i) {
- if (jas_iccattrtab_add(newattrtab, i, attrtab->attrs[i].name,
- attrtab->attrs[i].val))
- goto error;
- }
- return newattrtab;
-error:
- return 0;
-}
-
-static void jas_iccattrtab_destroy(jas_iccattrtab_t *tab)
-{
- if (tab->attrs) {
- while (tab->numattrs > 0) {
- jas_iccattrtab_delete(tab, 0);
- }
- jas_free(tab->attrs);
- }
- jas_free(tab);
-}
-
-void jas_iccattrtab_dump(jas_iccattrtab_t *attrtab, FILE *out)
-{
- int i;
- jas_iccattr_t *attr;
- jas_iccattrval_t *attrval;
- jas_iccattrvalinfo_t *info;
- char buf[16];
- fprintf(out, "numattrs=%d\n", attrtab->numattrs);
- fprintf(out, "---\n");
- for (i = 0; i < attrtab->numattrs; ++i) {
- attr = &attrtab->attrs[i];
- attrval = attr->val;
- info = jas_iccattrvalinfo_lookup(attrval->type);
- if (!info) abort();
- fprintf(out, "attrno=%d; attrname=\"%s\"(0x%08x); attrtype=\"%s\"(0x%08x)\n",
- i,
- jas_iccsigtostr(attr->name, &buf[0]),
- attr->name,
- jas_iccsigtostr(attrval->type, &buf[8]),
- attrval->type
- );
- jas_iccattrval_dump(attrval, out);
- fprintf(out, "---\n");
- }
-}
-
-static int jas_iccattrtab_resize(jas_iccattrtab_t *tab, int maxents)
-{
- jas_iccattr_t *newattrs;
- assert(maxents >= tab->numattrs);
- newattrs = tab->attrs ? jas_realloc(tab->attrs, maxents *
- sizeof(jas_iccattr_t)) : jas_malloc(maxents * sizeof(jas_iccattr_t));
- if (!newattrs)
- return -1;
- tab->attrs = newattrs;
- tab->maxattrs = maxents;
- return 0;
-}
-
-static int jas_iccattrtab_add(jas_iccattrtab_t *attrtab, int i,
- jas_iccuint32_t name, jas_iccattrval_t *val)
-{
- int n;
- jas_iccattr_t *attr;
- jas_iccattrval_t *tmpattrval;
- tmpattrval = 0;
- if (i < 0) {
- i = attrtab->numattrs;
- }
- assert(i >= 0 && i <= attrtab->numattrs);
- if (attrtab->numattrs >= attrtab->maxattrs) {
- if (jas_iccattrtab_resize(attrtab, attrtab->numattrs + 32)) {
- goto error;
- }
- }
- if (!(tmpattrval = jas_iccattrval_clone(val)))
- goto error;
- n = attrtab->numattrs - i;
- if (n > 0)
- memmove(&attrtab->attrs[i + 1], &attrtab->attrs[i],
- n * sizeof(jas_iccattr_t));
- attr = &attrtab->attrs[i];
- attr->name = name;
- attr->val = tmpattrval;
- ++attrtab->numattrs;
- return 0;
-error:
- if (tmpattrval)
- jas_iccattrval_destroy(tmpattrval);
- return -1;
-}
-
-static int jas_iccattrtab_replace(jas_iccattrtab_t *attrtab, int i,
- jas_iccuint32_t name, jas_iccattrval_t *val)
-{
- jas_iccattrval_t *newval;
- jas_iccattr_t *attr;
- if (!(newval = jas_iccattrval_clone(val)))
- goto error;
- attr = &attrtab->attrs[i];
- jas_iccattrval_destroy(attr->val);
- attr->name = name;
- attr->val = newval;
- return 0;
-error:
- return -1;
-}
-
-static void jas_iccattrtab_delete(jas_iccattrtab_t *attrtab, int i)
-{
- int n;
- jas_iccattrval_destroy(attrtab->attrs[i].val);
- if ((n = attrtab->numattrs - i - 1) > 0)
- memmove(&attrtab->attrs[i], &attrtab->attrs[i + 1],
- n * sizeof(jas_iccattr_t));
- --attrtab->numattrs;
-}
-
-static int jas_iccattrtab_get(jas_iccattrtab_t *attrtab, int i,
- jas_iccattrname_t *name, jas_iccattrval_t **val)
-{
- jas_iccattr_t *attr;
- if (i < 0 || i >= attrtab->numattrs)
- goto error;
- attr = &attrtab->attrs[i];
- *name = attr->name;
- if (!(*val = jas_iccattrval_clone(attr->val)))
- goto error;
- return 0;
-error:
- return -1;
-}
-
-static int jas_iccattrtab_lookup(jas_iccattrtab_t *attrtab,
- jas_iccuint32_t name)
-{
- int i;
- jas_iccattr_t *attr;
- for (i = 0; i < attrtab->numattrs; ++i) {
- attr = &attrtab->attrs[i];
- if (attr->name == name)
- return i;
- }
- return -1;
-}
-
-/******************************************************************************\
-* attribute value class
-\******************************************************************************/
-
-jas_iccattrval_t *jas_iccattrval_create(jas_iccuint32_t type)
-{
- jas_iccattrval_t *attrval;
- jas_iccattrvalinfo_t *info;
-
- if (!(info = jas_iccattrvalinfo_lookup(type)))
- goto error;
- if (!(attrval = jas_iccattrval_create0()))
- goto error;
- attrval->ops = &info->ops;
- attrval->type = type;
- ++attrval->refcnt;
- memset(&attrval->data, 0, sizeof(attrval->data));
- return attrval;
-error:
- return 0;
-}
-
-jas_iccattrval_t *jas_iccattrval_clone(jas_iccattrval_t *attrval)
-{
- ++attrval->refcnt;
- return attrval;
-}
-
-void jas_iccattrval_destroy(jas_iccattrval_t *attrval)
-{
-#if 0
-jas_eprintf("refcnt=%d\n", attrval->refcnt);
-#endif
- if (--attrval->refcnt <= 0) {
- if (attrval->ops->destroy)
- (*attrval->ops->destroy)(attrval);
- jas_free(attrval);
- }
-}
-
-void jas_iccattrval_dump(jas_iccattrval_t *attrval, FILE *out)
-{
- char buf[8];
- jas_iccsigtostr(attrval->type, buf);
- fprintf(out, "refcnt = %d; type = 0x%08x %s\n", attrval->refcnt,
- attrval->type, jas_iccsigtostr(attrval->type, &buf[0]));
- if (attrval->ops->dump) {
- (*attrval->ops->dump)(attrval, out);
- }
-}
-
-int jas_iccattrval_allowmodify(jas_iccattrval_t **attrvalx)
-{
- jas_iccattrval_t *newattrval;
- jas_iccattrval_t *attrval = *attrvalx;
- newattrval = 0;
- if (attrval->refcnt > 1) {
- if (!(newattrval = jas_iccattrval_create0()))
- goto error;
- newattrval->ops = attrval->ops;
- newattrval->type = attrval->type;
- ++newattrval->refcnt;
- if (newattrval->ops->copy) {
- if ((*newattrval->ops->copy)(newattrval, attrval))
- goto error;
- } else {
- memcpy(&newattrval->data, &attrval->data,
- sizeof(newattrval->data));
- }
- *attrvalx = newattrval;
- }
- return 0;
-error:
- if (newattrval) {
- jas_free(newattrval);
- }
- return -1;
-}
-
-static jas_iccattrval_t *jas_iccattrval_create0()
-{
- jas_iccattrval_t *attrval;
- if (!(attrval = jas_malloc(sizeof(jas_iccattrval_t))))
- return 0;
- memset(attrval, 0, sizeof(jas_iccattrval_t));
- attrval->refcnt = 0;
- attrval->ops = 0;
- attrval->type = 0;
- return attrval;
-}
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-static int jas_iccxyz_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int len)
-{
- if (len != 4 * 3) abort();
- return jas_iccgetxyz(in, &attrval->data.xyz);
-}
-
-static int jas_iccxyz_output(jas_iccattrval_t *attrval, jas_stream_t *out)
-{
- jas_iccxyz_t *xyz = &attrval->data.xyz;
- if (jas_iccputuint32(out, xyz->x) ||
- jas_iccputuint32(out, xyz->y) ||
- jas_iccputuint32(out, xyz->z))
- return -1;
- return 0;
-}
-
-static int jas_iccxyz_getsize(jas_iccattrval_t *attrval)
-{
- /* Avoid compiler warnings about unused parameters. */
- attrval = 0;
-
- return 12;
-}
-
-static void jas_iccxyz_dump(jas_iccattrval_t *attrval, FILE *out)
-{
- jas_iccxyz_t *xyz = &attrval->data.xyz;
- fprintf(out, "(%f, %f, %f)\n", xyz->x / 65536.0, xyz->y / 65536.0, xyz->z / 65536.0);
-}
-
-/******************************************************************************\
-* attribute table class
-\******************************************************************************/
-
-static void jas_icccurv_destroy(jas_iccattrval_t *attrval)
-{
- jas_icccurv_t *curv = &attrval->data.curv;
- if (curv->ents)
- jas_free(curv->ents);
-}
-
-static int jas_icccurv_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval)
-{
- /* Avoid compiler warnings about unused parameters. */
- attrval = 0;
- othattrval = 0;
-
- /* Not yet implemented. */
- abort();
- return -1;
-}
-
-static int jas_icccurv_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt)
-{
- jas_icccurv_t *curv = &attrval->data.curv;
- unsigned int i;
-
- curv->numents = 0;
- curv->ents = 0;
-
- if (jas_iccgetuint32(in, &curv->numents))
- goto error;
- if (!(curv->ents = jas_malloc(curv->numents * sizeof(jas_iccuint16_t))))
- goto error;
- for (i = 0; i < curv->numents; ++i) {
- if (jas_iccgetuint16(in, &curv->ents[i]))
- goto error;
- }
-
- if (JAS_CAST(int, 4 + 2 * curv->numents) != cnt)
- goto error;
- return 0;
-
-error:
- jas_icccurv_destroy(attrval);
- return -1;
-}
-
-static int jas_icccurv_getsize(jas_iccattrval_t *attrval)
-{
- jas_icccurv_t *curv = &attrval->data.curv;
- return 4 + 2 * curv->numents;
-}
-
-static int jas_icccurv_output(jas_iccattrval_t *attrval, jas_stream_t *out)
-{
- jas_icccurv_t *curv = &attrval->data.curv;
- unsigned int i;
-
- if (jas_iccputuint32(out, curv->numents))
- goto error;
- for (i = 0; i < curv->numents; ++i) {
- if (jas_iccputuint16(out, curv->ents[i]))
- goto error;
- }
- return 0;
-error:
- return -1;
-}
-
-static void jas_icccurv_dump(jas_iccattrval_t *attrval, FILE *out)
-{
- int i;
- jas_icccurv_t *curv = &attrval->data.curv;
- fprintf(out, "number of entires = %d\n", curv->numents);
- if (curv->numents == 1) {
- fprintf(out, "gamma = %f\n", curv->ents[0] / 256.0);
- } else {
- for (i = 0; i < JAS_CAST(int, curv->numents); ++i) {
- if (i < 3 || i >= JAS_CAST(int, curv->numents) - 3) {
- fprintf(out, "entry[%d] = %f\n", i, curv->ents[i] / 65535.0);
- }
- }
- }
-}
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-static void jas_icctxtdesc_destroy(jas_iccattrval_t *attrval)
-{
- jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
- if (txtdesc->ascdata)
- jas_free(txtdesc->ascdata);
- if (txtdesc->ucdata)
- jas_free(txtdesc->ucdata);
-}
-
-static int jas_icctxtdesc_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval)
-{
- jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
-
- /* Avoid compiler warnings about unused parameters. */
- attrval = 0;
- othattrval = 0;
- txtdesc = 0;
-
- /* Not yet implemented. */
- abort();
- return -1;
-}
-
-static int jas_icctxtdesc_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt)
-{
- int n;
- int c;
- jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
- txtdesc->ascdata = 0;
- txtdesc->ucdata = 0;
- if (jas_iccgetuint32(in, &txtdesc->asclen))
- goto error;
- if (!(txtdesc->ascdata = jas_malloc(txtdesc->asclen)))
- goto error;
- if (jas_stream_read(in, txtdesc->ascdata, txtdesc->asclen) !=
- JAS_CAST(int, txtdesc->asclen))
- goto error;
- txtdesc->ascdata[txtdesc->asclen - 1] = '\0';
- if (jas_iccgetuint32(in, &txtdesc->uclangcode) ||
- jas_iccgetuint32(in, &txtdesc->uclen))
- goto error;
- if (!(txtdesc->ucdata = jas_malloc(txtdesc->uclen * 2)))
- goto error;
- if (jas_stream_read(in, txtdesc->ucdata, txtdesc->uclen * 2) !=
- JAS_CAST(int, txtdesc->uclen * 2))
- goto error;
- if (jas_iccgetuint16(in, &txtdesc->sccode))
- goto error;
- if ((c = jas_stream_getc(in)) == EOF)
- goto error;
- txtdesc->maclen = c;
- if (jas_stream_read(in, txtdesc->macdata, 67) != 67)
- goto error;
- txtdesc->asclen = strlen(txtdesc->ascdata) + 1;
-#define WORKAROUND_BAD_PROFILES
-#ifdef WORKAROUND_BAD_PROFILES
- n = txtdesc->asclen + txtdesc->uclen * 2 + 15 + 67;
- if (n > cnt) {
- return -1;
- }
- if (n < cnt) {
- if (jas_stream_gobble(in, cnt - n) != cnt - n)
- goto error;
- }
-#else
- if (txtdesc->asclen + txtdesc->uclen * 2 + 15 + 67 != cnt)
- return -1;
-#endif
- return 0;
-error:
- jas_icctxtdesc_destroy(attrval);
- return -1;
-}
-
-static int jas_icctxtdesc_getsize(jas_iccattrval_t *attrval)
-{
- jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
- return strlen(txtdesc->ascdata) + 1 + txtdesc->uclen * 2 + 15 + 67;
-}
-
-static int jas_icctxtdesc_output(jas_iccattrval_t *attrval, jas_stream_t *out)
-{
- jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
- if (jas_iccputuint32(out, txtdesc->asclen) ||
- jas_stream_puts(out, txtdesc->ascdata) ||
- jas_stream_putc(out, 0) == EOF ||
- jas_iccputuint32(out, txtdesc->uclangcode) ||
- jas_iccputuint32(out, txtdesc->uclen) ||
- jas_stream_write(out, txtdesc->ucdata, txtdesc->uclen * 2) != JAS_CAST(int, txtdesc->uclen * 2) ||
- jas_iccputuint16(out, txtdesc->sccode) ||
- jas_stream_putc(out, txtdesc->maclen) == EOF)
- goto error;
- if (txtdesc->maclen > 0) {
- if (jas_stream_write(out, txtdesc->macdata, 67) != 67)
- goto error;
- } else {
- if (jas_stream_pad(out, 67, 0) != 67)
- goto error;
- }
- return 0;
-error:
- return -1;
-}
-
-static void jas_icctxtdesc_dump(jas_iccattrval_t *attrval, FILE *out)
-{
- jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
- fprintf(out, "ascii = \"%s\"\n", txtdesc->ascdata);
- fprintf(out, "uclangcode = %d; uclen = %d\n", txtdesc->uclangcode,
- txtdesc->uclen);
- fprintf(out, "sccode = %d\n", txtdesc->sccode);
- fprintf(out, "maclen = %d\n", txtdesc->maclen);
-}
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-static void jas_icctxt_destroy(jas_iccattrval_t *attrval)
-{
- jas_icctxt_t *txt = &attrval->data.txt;
- if (txt->string)
- jas_free(txt->string);
-}
-
-static int jas_icctxt_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval)
-{
- jas_icctxt_t *txt = &attrval->data.txt;
- jas_icctxt_t *othtxt = &othattrval->data.txt;
- if (!(txt->string = jas_strdup(othtxt->string)))
- return -1;
- return 0;
-}
-
-static int jas_icctxt_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt)
-{
- jas_icctxt_t *txt = &attrval->data.txt;
- txt->string = 0;
- if (!(txt->string = jas_malloc(cnt)))
- goto error;
- if (jas_stream_read(in, txt->string, cnt) != cnt)
- goto error;
- txt->string[cnt - 1] = '\0';
- if (JAS_CAST(int, strlen(txt->string)) + 1 != cnt)
- goto error;
- return 0;
-error:
- if (txt->string)
- jas_free(txt->string);
- return -1;
-}
-
-static int jas_icctxt_getsize(jas_iccattrval_t *attrval)
-{
- jas_icctxt_t *txt = &attrval->data.txt;
- return strlen(txt->string) + 1;
-}
-
-static int jas_icctxt_output(jas_iccattrval_t *attrval, jas_stream_t *out)
-{
- jas_icctxt_t *txt = &attrval->data.txt;
- if (jas_stream_puts(out, txt->string) ||
- jas_stream_putc(out, 0) == EOF)
- return -1;
- return 0;
-}
-
-static void jas_icctxt_dump(jas_iccattrval_t *attrval, FILE *out)
-{
- jas_icctxt_t *txt = &attrval->data.txt;
- fprintf(out, "string = \"%s\"\n", txt->string);
-}
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-static void jas_icclut8_destroy(jas_iccattrval_t *attrval)
-{
- jas_icclut8_t *lut8 = &attrval->data.lut8;
- if (lut8->clut)
- jas_free(lut8->clut);
- if (lut8->intabs)
- jas_free(lut8->intabs);
- if (lut8->intabsbuf)
- jas_free(lut8->intabsbuf);
- if (lut8->outtabs)
- jas_free(lut8->outtabs);
- if (lut8->outtabsbuf)
- jas_free(lut8->outtabsbuf);
-}
-
-static int jas_icclut8_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval)
-{
- jas_icclut8_t *lut8 = &attrval->data.lut8;
- /* Avoid compiler warnings about unused parameters. */
- attrval = 0;
- othattrval = 0;
- lut8 = 0;
- abort();
- return -1;
-}
-
-static int jas_icclut8_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt)
-{
- int i;
- int j;
- int clutsize;
- jas_icclut8_t *lut8 = &attrval->data.lut8;
- lut8->clut = 0;
- lut8->intabs = 0;
- lut8->intabsbuf = 0;
- lut8->outtabs = 0;
- lut8->outtabsbuf = 0;
- if (jas_iccgetuint8(in, &lut8->numinchans) ||
- jas_iccgetuint8(in, &lut8->numoutchans) ||
- jas_iccgetuint8(in, &lut8->clutlen) ||
- jas_stream_getc(in) == EOF)
- goto error;
- for (i = 0; i < 3; ++i) {
- for (j = 0; j < 3; ++j) {
- if (jas_iccgetsint32(in, &lut8->e[i][j]))
- goto error;
- }
- }
- if (jas_iccgetuint16(in, &lut8->numintabents) ||
- jas_iccgetuint16(in, &lut8->numouttabents))
- goto error;
- clutsize = jas_iccpowi(lut8->clutlen, lut8->numinchans) * lut8->numoutchans;
- if (!(lut8->clut = jas_malloc(clutsize * sizeof(jas_iccuint8_t))) ||
- !(lut8->intabsbuf = jas_malloc(lut8->numinchans *
- lut8->numintabents * sizeof(jas_iccuint8_t))) ||
- !(lut8->intabs = jas_malloc(lut8->numinchans *
- sizeof(jas_iccuint8_t *))))
- goto error;
- for (i = 0; i < lut8->numinchans; ++i)
- lut8->intabs[i] = &lut8->intabsbuf[i * lut8->numintabents];
- if (!(lut8->outtabsbuf = jas_malloc(lut8->numoutchans *
- lut8->numouttabents * sizeof(jas_iccuint8_t))) ||
- !(lut8->outtabs = jas_malloc(lut8->numoutchans *
- sizeof(jas_iccuint8_t *))))
- goto error;
- for (i = 0; i < lut8->numoutchans; ++i)
- lut8->outtabs[i] = &lut8->outtabsbuf[i * lut8->numouttabents];
- for (i = 0; i < lut8->numinchans; ++i) {
- for (j = 0; j < JAS_CAST(int, lut8->numintabents); ++j) {
- if (jas_iccgetuint8(in, &lut8->intabs[i][j]))
- goto error;
- }
- }
- for (i = 0; i < lut8->numoutchans; ++i) {
- for (j = 0; j < JAS_CAST(int, lut8->numouttabents); ++j) {
- if (jas_iccgetuint8(in, &lut8->outtabs[i][j]))
- goto error;
- }
- }
- for (i = 0; i < clutsize; ++i) {
- if (jas_iccgetuint8(in, &lut8->clut[i]))
- goto error;
- }
- if (JAS_CAST(int, 44 + lut8->numinchans * lut8->numintabents +
- lut8->numoutchans * lut8->numouttabents +
- jas_iccpowi(lut8->clutlen, lut8->numinchans) * lut8->numoutchans) !=
- cnt)
- goto error;
- return 0;
-error:
- jas_icclut8_destroy(attrval);
- return -1;
-}
-
-static int jas_icclut8_getsize(jas_iccattrval_t *attrval)
-{
- jas_icclut8_t *lut8 = &attrval->data.lut8;
- return 44 + lut8->numinchans * lut8->numintabents +
- lut8->numoutchans * lut8->numouttabents +
- jas_iccpowi(lut8->clutlen, lut8->numinchans) * lut8->numoutchans;
-}
-
-static int jas_icclut8_output(jas_iccattrval_t *attrval, jas_stream_t *out)
-{
- jas_icclut8_t *lut8 = &attrval->data.lut8;
- int i;
- int j;
- int n;
- lut8->clut = 0;
- lut8->intabs = 0;
- lut8->intabsbuf = 0;
- lut8->outtabs = 0;
- lut8->outtabsbuf = 0;
- if (jas_stream_putc(out, lut8->numinchans) == EOF ||
- jas_stream_putc(out, lut8->numoutchans) == EOF ||
- jas_stream_putc(out, lut8->clutlen) == EOF ||
- jas_stream_putc(out, 0) == EOF)
- goto error;
- for (i = 0; i < 3; ++i) {
- for (j = 0; j < 3; ++j) {
- if (jas_iccputsint32(out, lut8->e[i][j]))
- goto error;
- }
- }
- if (jas_iccputuint16(out, lut8->numintabents) ||
- jas_iccputuint16(out, lut8->numouttabents))
- goto error;
- n = lut8->numinchans * lut8->numintabents;
- for (i = 0; i < n; ++i) {
- if (jas_iccputuint8(out, lut8->intabsbuf[i]))
- goto error;
- }
- n = lut8->numoutchans * lut8->numouttabents;
- for (i = 0; i < n; ++i) {
- if (jas_iccputuint8(out, lut8->outtabsbuf[i]))
- goto error;
- }
- n = jas_iccpowi(lut8->clutlen, lut8->numinchans) * lut8->numoutchans;
- for (i = 0; i < n; ++i) {
- if (jas_iccputuint8(out, lut8->clut[i]))
- goto error;
- }
- return 0;
-error:
- return -1;
-}
-
-static void jas_icclut8_dump(jas_iccattrval_t *attrval, FILE *out)
-{
- jas_icclut8_t *lut8 = &attrval->data.lut8;
- int i;
- int j;
- fprintf(out, "numinchans=%d, numoutchans=%d, clutlen=%d\n",
- lut8->numinchans, lut8->numoutchans, lut8->clutlen);
- for (i = 0; i < 3; ++i) {
- for (j = 0; j < 3; ++j) {
- fprintf(out, "e[%d][%d]=%f ", i, j, lut8->e[i][j] / 65536.0);
- }
- fprintf(out, "\n");
- }
- fprintf(out, "numintabents=%d, numouttabents=%d\n",
- lut8->numintabents, lut8->numouttabents);
-}
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-static void jas_icclut16_destroy(jas_iccattrval_t *attrval)
-{
- jas_icclut16_t *lut16 = &attrval->data.lut16;
- if (lut16->clut)
- jas_free(lut16->clut);
- if (lut16->intabs)
- jas_free(lut16->intabs);
- if (lut16->intabsbuf)
- jas_free(lut16->intabsbuf);
- if (lut16->outtabs)
- jas_free(lut16->outtabs);
- if (lut16->outtabsbuf)
- jas_free(lut16->outtabsbuf);
-}
-
-static int jas_icclut16_copy(jas_iccattrval_t *attrval,
- jas_iccattrval_t *othattrval)
-{
- /* Avoid compiler warnings about unused parameters. */
- attrval = 0;
- othattrval = 0;
- /* Not yet implemented. */
- abort();
- return -1;
-}
-
-static int jas_icclut16_input(jas_iccattrval_t *attrval, jas_stream_t *in,
- int cnt)
-{
- int i;
- int j;
- int clutsize;
- jas_icclut16_t *lut16 = &attrval->data.lut16;
- lut16->clut = 0;
- lut16->intabs = 0;
- lut16->intabsbuf = 0;
- lut16->outtabs = 0;
- lut16->outtabsbuf = 0;
- if (jas_iccgetuint8(in, &lut16->numinchans) ||
- jas_iccgetuint8(in, &lut16->numoutchans) ||
- jas_iccgetuint8(in, &lut16->clutlen) ||
- jas_stream_getc(in) == EOF)
- goto error;
- for (i = 0; i < 3; ++i) {
- for (j = 0; j < 3; ++j) {
- if (jas_iccgetsint32(in, &lut16->e[i][j]))
- goto error;
- }
- }
- if (jas_iccgetuint16(in, &lut16->numintabents) ||
- jas_iccgetuint16(in, &lut16->numouttabents))
- goto error;
- clutsize = jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans;
- if (!(lut16->clut = jas_malloc(clutsize * sizeof(jas_iccuint16_t))) ||
- !(lut16->intabsbuf = jas_malloc(lut16->numinchans *
- lut16->numintabents * sizeof(jas_iccuint16_t))) ||
- !(lut16->intabs = jas_malloc(lut16->numinchans *
- sizeof(jas_iccuint16_t *))))
- goto error;
- for (i = 0; i < lut16->numinchans; ++i)
- lut16->intabs[i] = &lut16->intabsbuf[i * lut16->numintabents];
- if (!(lut16->outtabsbuf = jas_malloc(lut16->numoutchans *
- lut16->numouttabents * sizeof(jas_iccuint16_t))) ||
- !(lut16->outtabs = jas_malloc(lut16->numoutchans *
- sizeof(jas_iccuint16_t *))))
- goto error;
- for (i = 0; i < lut16->numoutchans; ++i)
- lut16->outtabs[i] = &lut16->outtabsbuf[i * lut16->numouttabents];
- for (i = 0; i < lut16->numinchans; ++i) {
- for (j = 0; j < JAS_CAST(int, lut16->numintabents); ++j) {
- if (jas_iccgetuint16(in, &lut16->intabs[i][j]))
- goto error;
- }
- }
- for (i = 0; i < lut16->numoutchans; ++i) {
- for (j = 0; j < JAS_CAST(int, lut16->numouttabents); ++j) {
- if (jas_iccgetuint16(in, &lut16->outtabs[i][j]))
- goto error;
- }
- }
- for (i = 0; i < clutsize; ++i) {
- if (jas_iccgetuint16(in, &lut16->clut[i]))
- goto error;
- }
- if (JAS_CAST(int, 44 + 2 * (lut16->numinchans * lut16->numintabents +
- lut16->numoutchans * lut16->numouttabents +
- jas_iccpowi(lut16->clutlen, lut16->numinchans) *
- lut16->numoutchans)) != cnt)
- goto error;
- return 0;
-error:
- jas_icclut16_destroy(attrval);
- return -1;
-}
-
-static int jas_icclut16_getsize(jas_iccattrval_t *attrval)
-{
- jas_icclut16_t *lut16 = &attrval->data.lut16;
- return 44 + 2 * (lut16->numinchans * lut16->numintabents +
- lut16->numoutchans * lut16->numouttabents +
- jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans);
-}
-
-static int jas_icclut16_output(jas_iccattrval_t *attrval, jas_stream_t *out)
-{
- jas_icclut16_t *lut16 = &attrval->data.lut16;
- int i;
- int j;
- int n;
- if (jas_stream_putc(out, lut16->numinchans) == EOF ||
- jas_stream_putc(out, lut16->numoutchans) == EOF ||
- jas_stream_putc(out, lut16->clutlen) == EOF ||
- jas_stream_putc(out, 0) == EOF)
- goto error;
- for (i = 0; i < 3; ++i) {
- for (j = 0; j < 3; ++j) {
- if (jas_iccputsint32(out, lut16->e[i][j]))
- goto error;
- }
- }
- if (jas_iccputuint16(out, lut16->numintabents) ||
- jas_iccputuint16(out, lut16->numouttabents))
- goto error;
- n = lut16->numinchans * lut16->numintabents;
- for (i = 0; i < n; ++i) {
- if (jas_iccputuint16(out, lut16->intabsbuf[i]))
- goto error;
- }
- n = lut16->numoutchans * lut16->numouttabents;
- for (i = 0; i < n; ++i) {
- if (jas_iccputuint16(out, lut16->outtabsbuf[i]))
- goto error;
- }
- n = jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans;
- for (i = 0; i < n; ++i) {
- if (jas_iccputuint16(out, lut16->clut[i]))
- goto error;
- }
- return 0;
-error:
- return -1;
-}
-
-static void jas_icclut16_dump(jas_iccattrval_t *attrval, FILE *out)
-{
- jas_icclut16_t *lut16 = &attrval->data.lut16;
- int i;
- int j;
- fprintf(out, "numinchans=%d, numoutchans=%d, clutlen=%d\n",
- lut16->numinchans, lut16->numoutchans, lut16->clutlen);
- for (i = 0; i < 3; ++i) {
- for (j = 0; j < 3; ++j) {
- fprintf(out, "e[%d][%d]=%f ", i, j, lut16->e[i][j] / 65536.0);
- }
- fprintf(out, "\n");
- }
- fprintf(out, "numintabents=%d, numouttabents=%d\n",
- lut16->numintabents, lut16->numouttabents);
-}
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-static int jas_iccgetuint(jas_stream_t *in, int n, ulonglong *val)
-{
- int i;
- int c;
- ulonglong v;
- v = 0;
- for (i = n; i > 0; --i) {
- if ((c = jas_stream_getc(in)) == EOF)
- return -1;
- v = (v << 8) | c;
- }
- *val = v;
- return 0;
-}
-
-static int jas_iccgetuint8(jas_stream_t *in, jas_iccuint8_t *val)
-{
- int c;
- if ((c = jas_stream_getc(in)) == EOF)
- return -1;
- *val = c;
- return 0;
-}
-
-static int jas_iccgetuint16(jas_stream_t *in, jas_iccuint16_t *val)
-{
- ulonglong tmp;
- if (jas_iccgetuint(in, 2, &tmp))
- return -1;
- *val = tmp;
- return 0;
-}
-
-static int jas_iccgetsint32(jas_stream_t *in, jas_iccsint32_t *val)
-{
- ulonglong tmp;
- if (jas_iccgetuint(in, 4, &tmp))
- return -1;
- *val = (tmp & 0x80000000) ? (-JAS_CAST(longlong, (((~tmp) &
- 0x7fffffff) + 1))) : JAS_CAST(longlong, tmp);
- return 0;
-}
-
-static int jas_iccgetuint32(jas_stream_t *in, jas_iccuint32_t *val)
-{
- ulonglong tmp;
- if (jas_iccgetuint(in, 4, &tmp))
- return -1;
- *val = tmp;
- return 0;
-}
-
-static int jas_iccgetuint64(jas_stream_t *in, jas_iccuint64_t *val)
-{
- ulonglong tmp;
- if (jas_iccgetuint(in, 8, &tmp))
- return -1;
- *val = tmp;
- return 0;
-}
-
-static int jas_iccputuint(jas_stream_t *out, int n, ulonglong val)
-{
- int i;
- int c;
- for (i = n; i > 0; --i) {
- c = (val >> (8 * (i - 1))) & 0xff;
- if (jas_stream_putc(out, c) == EOF)
- return -1;
- }
- return 0;
-}
-
-static int jas_iccputsint(jas_stream_t *out, int n, longlong val)
-{
- ulonglong tmp;
- tmp = (val < 0) ? (abort(), 0) : val;
- return jas_iccputuint(out, n, tmp);
-}
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-static char *jas_iccsigtostr(int sig, char *buf)
-{
- int n;
- int c;
- char *bufptr;
- bufptr = buf;
- for (n = 4; n > 0; --n) {
- c = (sig >> 24) & 0xff;
- if (isalpha(c) || isdigit(c)) {
- *bufptr++ = c;
- }
- sig <<= 8;
- }
- *bufptr = '\0';
- return buf;
-}
-
-static long jas_iccpadtomult(long x, long y)
-{
- return ((x + y - 1) / y) * y;
-}
-
-static long jas_iccpowi(int x, int n)
-{
- long y;
- y = 1;
- while (--n >= 0)
- y *= x;
- return y;
-}
-
-
-jas_iccprof_t *jas_iccprof_createfrombuf(uchar *buf, int len)
-{
- jas_stream_t *in;
- jas_iccprof_t *prof;
- if (!(in = jas_stream_memopen(JAS_CAST(char *, buf), len)))
- goto error;
- if (!(prof = jas_iccprof_load(in)))
- goto error;
- jas_stream_close(in);
- return prof;
-error:
- return 0;
-}
-
-jas_iccprof_t *jas_iccprof_createfromclrspc(int clrspc)
-{
- jas_iccprof_t *prof;
- switch (clrspc) {
- case JAS_CLRSPC_SRGB:
- prof = jas_iccprof_createfrombuf(jas_iccprofdata_srgb,
- jas_iccprofdata_srgblen);
- break;
- case JAS_CLRSPC_SGRAY:
- prof = jas_iccprof_createfrombuf(jas_iccprofdata_sgray,
- jas_iccprofdata_sgraylen);
- break;
- default:
- prof = 0;
- break;
- }
- return prof;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_iccdata.c b/src/3rdparty/jasper/src/libjasper/base/jas_iccdata.c
deleted file mode 100644
index 5647156..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_iccdata.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * Copyright (c) 2002-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#include <jasper/jas_config.h>
-#include <jasper/jas_types.h>
-
-uchar jas_iccprofdata_srgb[] =
-{
- 0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f,
- 0x02, 0x10, 0x00, 0x00, 0x6d, 0x6e, 0x74, 0x72,
- 0x52, 0x47, 0x42, 0x20, 0x58, 0x59, 0x5a, 0x20,
- 0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06,
- 0x00, 0x31, 0x00, 0x00, 0x61, 0x63, 0x73, 0x70,
- 0x4d, 0x53, 0x46, 0x54, 0x00, 0x00, 0x00, 0x00,
- 0x49, 0x45, 0x43, 0x20, 0x73, 0x52, 0x47, 0x42,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d,
- 0x48, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x11, 0x63, 0x70, 0x72, 0x74,
- 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00, 0x33,
- 0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x01, 0x84,
- 0x00, 0x00, 0x00, 0x6c, 0x77, 0x74, 0x70, 0x74,
- 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x14,
- 0x62, 0x6b, 0x70, 0x74, 0x00, 0x00, 0x02, 0x04,
- 0x00, 0x00, 0x00, 0x14, 0x72, 0x58, 0x59, 0x5a,
- 0x00, 0x00, 0x02, 0x18, 0x00, 0x00, 0x00, 0x14,
- 0x67, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x02, 0x2c,
- 0x00, 0x00, 0x00, 0x14, 0x62, 0x58, 0x59, 0x5a,
- 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x14,
- 0x64, 0x6d, 0x6e, 0x64, 0x00, 0x00, 0x02, 0x54,
- 0x00, 0x00, 0x00, 0x70, 0x64, 0x6d, 0x64, 0x64,
- 0x00, 0x00, 0x02, 0xc4, 0x00, 0x00, 0x00, 0x88,
- 0x76, 0x75, 0x65, 0x64, 0x00, 0x00, 0x03, 0x4c,
- 0x00, 0x00, 0x00, 0x86, 0x76, 0x69, 0x65, 0x77,
- 0x00, 0x00, 0x03, 0xd4, 0x00, 0x00, 0x00, 0x24,
- 0x6c, 0x75, 0x6d, 0x69, 0x00, 0x00, 0x03, 0xf8,
- 0x00, 0x00, 0x00, 0x14, 0x6d, 0x65, 0x61, 0x73,
- 0x00, 0x00, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x24,
- 0x74, 0x65, 0x63, 0x68, 0x00, 0x00, 0x04, 0x30,
- 0x00, 0x00, 0x00, 0x0c, 0x72, 0x54, 0x52, 0x43,
- 0x00, 0x00, 0x04, 0x3c, 0x00, 0x00, 0x08, 0x0c,
- 0x67, 0x54, 0x52, 0x43, 0x00, 0x00, 0x04, 0x3c,
- 0x00, 0x00, 0x08, 0x0c, 0x62, 0x54, 0x52, 0x43,
- 0x00, 0x00, 0x04, 0x3c, 0x00, 0x00, 0x08, 0x0c,
- 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39,
- 0x39, 0x38, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65,
- 0x74, 0x74, 0x2d, 0x50, 0x61, 0x63, 0x6b, 0x61,
- 0x72, 0x64, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x61,
- 0x6e, 0x79, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
- 0x73, 0x52, 0x47, 0x42, 0x20, 0x49, 0x45, 0x43,
- 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32, 0x2e,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x12, 0x73, 0x52, 0x47,
- 0x42, 0x20, 0x49, 0x45, 0x43, 0x36, 0x31, 0x39,
- 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xf3, 0x51, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x01, 0x16, 0xcc, 0x58, 0x59, 0x5a, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x6f, 0xa2, 0x00, 0x00, 0x38, 0xf5,
- 0x00, 0x00, 0x03, 0x90, 0x58, 0x59, 0x5a, 0x20,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x99,
- 0x00, 0x00, 0xb7, 0x85, 0x00, 0x00, 0x18, 0xda,
- 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x24, 0xa0, 0x00, 0x00, 0x0f, 0x84,
- 0x00, 0x00, 0xb6, 0xcf, 0x64, 0x65, 0x73, 0x63,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16,
- 0x49, 0x45, 0x43, 0x20, 0x68, 0x74, 0x74, 0x70,
- 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69,
- 0x65, 0x63, 0x2e, 0x63, 0x68, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x16, 0x49, 0x45, 0x43, 0x20, 0x68, 0x74, 0x74,
- 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e,
- 0x69, 0x65, 0x63, 0x2e, 0x63, 0x68, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e,
- 0x49, 0x45, 0x43, 0x20, 0x36, 0x31, 0x39, 0x36,
- 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x20, 0x44, 0x65,
- 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x52, 0x47,
- 0x42, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x75, 0x72,
- 0x20, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x2d,
- 0x20, 0x73, 0x52, 0x47, 0x42, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x2e, 0x49, 0x45, 0x43, 0x20, 0x36, 0x31, 0x39,
- 0x36, 0x36, 0x2d, 0x32, 0x2e, 0x31, 0x20, 0x44,
- 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x20, 0x52,
- 0x47, 0x42, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x75,
- 0x72, 0x20, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20,
- 0x2d, 0x20, 0x73, 0x52, 0x47, 0x42, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x64, 0x65, 0x73, 0x63,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c,
- 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
- 0x65, 0x20, 0x56, 0x69, 0x65, 0x77, 0x69, 0x6e,
- 0x67, 0x20, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74,
- 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x49,
- 0x45, 0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d,
- 0x32, 0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x52,
- 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
- 0x20, 0x56, 0x69, 0x65, 0x77, 0x69, 0x6e, 0x67,
- 0x20, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69,
- 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x49, 0x45,
- 0x43, 0x36, 0x31, 0x39, 0x36, 0x36, 0x2d, 0x32,
- 0x2e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x76, 0x69, 0x65, 0x77,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xa4, 0xfe,
- 0x00, 0x14, 0x5f, 0x2e, 0x00, 0x10, 0xcf, 0x14,
- 0x00, 0x03, 0xed, 0xcc, 0x00, 0x04, 0x13, 0x0b,
- 0x00, 0x03, 0x5c, 0x9e, 0x00, 0x00, 0x00, 0x01,
- 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x4c, 0x09, 0x56, 0x00, 0x50, 0x00, 0x00,
- 0x00, 0x57, 0x1f, 0xe7, 0x6d, 0x65, 0x61, 0x73,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02, 0x8f, 0x00, 0x00, 0x00, 0x02,
- 0x73, 0x69, 0x67, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x52, 0x54, 0x20, 0x63, 0x75, 0x72, 0x76,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x0f,
- 0x00, 0x14, 0x00, 0x19, 0x00, 0x1e, 0x00, 0x23,
- 0x00, 0x28, 0x00, 0x2d, 0x00, 0x32, 0x00, 0x37,
- 0x00, 0x3b, 0x00, 0x40, 0x00, 0x45, 0x00, 0x4a,
- 0x00, 0x4f, 0x00, 0x54, 0x00, 0x59, 0x00, 0x5e,
- 0x00, 0x63, 0x00, 0x68, 0x00, 0x6d, 0x00, 0x72,
- 0x00, 0x77, 0x00, 0x7c, 0x00, 0x81, 0x00, 0x86,
- 0x00, 0x8b, 0x00, 0x90, 0x00, 0x95, 0x00, 0x9a,
- 0x00, 0x9f, 0x00, 0xa4, 0x00, 0xa9, 0x00, 0xae,
- 0x00, 0xb2, 0x00, 0xb7, 0x00, 0xbc, 0x00, 0xc1,
- 0x00, 0xc6, 0x00, 0xcb, 0x00, 0xd0, 0x00, 0xd5,
- 0x00, 0xdb, 0x00, 0xe0, 0x00, 0xe5, 0x00, 0xeb,
- 0x00, 0xf0, 0x00, 0xf6, 0x00, 0xfb, 0x01, 0x01,
- 0x01, 0x07, 0x01, 0x0d, 0x01, 0x13, 0x01, 0x19,
- 0x01, 0x1f, 0x01, 0x25, 0x01, 0x2b, 0x01, 0x32,
- 0x01, 0x38, 0x01, 0x3e, 0x01, 0x45, 0x01, 0x4c,
- 0x01, 0x52, 0x01, 0x59, 0x01, 0x60, 0x01, 0x67,
- 0x01, 0x6e, 0x01, 0x75, 0x01, 0x7c, 0x01, 0x83,
- 0x01, 0x8b, 0x01, 0x92, 0x01, 0x9a, 0x01, 0xa1,
- 0x01, 0xa9, 0x01, 0xb1, 0x01, 0xb9, 0x01, 0xc1,
- 0x01, 0xc9, 0x01, 0xd1, 0x01, 0xd9, 0x01, 0xe1,
- 0x01, 0xe9, 0x01, 0xf2, 0x01, 0xfa, 0x02, 0x03,
- 0x02, 0x0c, 0x02, 0x14, 0x02, 0x1d, 0x02, 0x26,
- 0x02, 0x2f, 0x02, 0x38, 0x02, 0x41, 0x02, 0x4b,
- 0x02, 0x54, 0x02, 0x5d, 0x02, 0x67, 0x02, 0x71,
- 0x02, 0x7a, 0x02, 0x84, 0x02, 0x8e, 0x02, 0x98,
- 0x02, 0xa2, 0x02, 0xac, 0x02, 0xb6, 0x02, 0xc1,
- 0x02, 0xcb, 0x02, 0xd5, 0x02, 0xe0, 0x02, 0xeb,
- 0x02, 0xf5, 0x03, 0x00, 0x03, 0x0b, 0x03, 0x16,
- 0x03, 0x21, 0x03, 0x2d, 0x03, 0x38, 0x03, 0x43,
- 0x03, 0x4f, 0x03, 0x5a, 0x03, 0x66, 0x03, 0x72,
- 0x03, 0x7e, 0x03, 0x8a, 0x03, 0x96, 0x03, 0xa2,
- 0x03, 0xae, 0x03, 0xba, 0x03, 0xc7, 0x03, 0xd3,
- 0x03, 0xe0, 0x03, 0xec, 0x03, 0xf9, 0x04, 0x06,
- 0x04, 0x13, 0x04, 0x20, 0x04, 0x2d, 0x04, 0x3b,
- 0x04, 0x48, 0x04, 0x55, 0x04, 0x63, 0x04, 0x71,
- 0x04, 0x7e, 0x04, 0x8c, 0x04, 0x9a, 0x04, 0xa8,
- 0x04, 0xb6, 0x04, 0xc4, 0x04, 0xd3, 0x04, 0xe1,
- 0x04, 0xf0, 0x04, 0xfe, 0x05, 0x0d, 0x05, 0x1c,
- 0x05, 0x2b, 0x05, 0x3a, 0x05, 0x49, 0x05, 0x58,
- 0x05, 0x67, 0x05, 0x77, 0x05, 0x86, 0x05, 0x96,
- 0x05, 0xa6, 0x05, 0xb5, 0x05, 0xc5, 0x05, 0xd5,
- 0x05, 0xe5, 0x05, 0xf6, 0x06, 0x06, 0x06, 0x16,
- 0x06, 0x27, 0x06, 0x37, 0x06, 0x48, 0x06, 0x59,
- 0x06, 0x6a, 0x06, 0x7b, 0x06, 0x8c, 0x06, 0x9d,
- 0x06, 0xaf, 0x06, 0xc0, 0x06, 0xd1, 0x06, 0xe3,
- 0x06, 0xf5, 0x07, 0x07, 0x07, 0x19, 0x07, 0x2b,
- 0x07, 0x3d, 0x07, 0x4f, 0x07, 0x61, 0x07, 0x74,
- 0x07, 0x86, 0x07, 0x99, 0x07, 0xac, 0x07, 0xbf,
- 0x07, 0xd2, 0x07, 0xe5, 0x07, 0xf8, 0x08, 0x0b,
- 0x08, 0x1f, 0x08, 0x32, 0x08, 0x46, 0x08, 0x5a,
- 0x08, 0x6e, 0x08, 0x82, 0x08, 0x96, 0x08, 0xaa,
- 0x08, 0xbe, 0x08, 0xd2, 0x08, 0xe7, 0x08, 0xfb,
- 0x09, 0x10, 0x09, 0x25, 0x09, 0x3a, 0x09, 0x4f,
- 0x09, 0x64, 0x09, 0x79, 0x09, 0x8f, 0x09, 0xa4,
- 0x09, 0xba, 0x09, 0xcf, 0x09, 0xe5, 0x09, 0xfb,
- 0x0a, 0x11, 0x0a, 0x27, 0x0a, 0x3d, 0x0a, 0x54,
- 0x0a, 0x6a, 0x0a, 0x81, 0x0a, 0x98, 0x0a, 0xae,
- 0x0a, 0xc5, 0x0a, 0xdc, 0x0a, 0xf3, 0x0b, 0x0b,
- 0x0b, 0x22, 0x0b, 0x39, 0x0b, 0x51, 0x0b, 0x69,
- 0x0b, 0x80, 0x0b, 0x98, 0x0b, 0xb0, 0x0b, 0xc8,
- 0x0b, 0xe1, 0x0b, 0xf9, 0x0c, 0x12, 0x0c, 0x2a,
- 0x0c, 0x43, 0x0c, 0x5c, 0x0c, 0x75, 0x0c, 0x8e,
- 0x0c, 0xa7, 0x0c, 0xc0, 0x0c, 0xd9, 0x0c, 0xf3,
- 0x0d, 0x0d, 0x0d, 0x26, 0x0d, 0x40, 0x0d, 0x5a,
- 0x0d, 0x74, 0x0d, 0x8e, 0x0d, 0xa9, 0x0d, 0xc3,
- 0x0d, 0xde, 0x0d, 0xf8, 0x0e, 0x13, 0x0e, 0x2e,
- 0x0e, 0x49, 0x0e, 0x64, 0x0e, 0x7f, 0x0e, 0x9b,
- 0x0e, 0xb6, 0x0e, 0xd2, 0x0e, 0xee, 0x0f, 0x09,
- 0x0f, 0x25, 0x0f, 0x41, 0x0f, 0x5e, 0x0f, 0x7a,
- 0x0f, 0x96, 0x0f, 0xb3, 0x0f, 0xcf, 0x0f, 0xec,
- 0x10, 0x09, 0x10, 0x26, 0x10, 0x43, 0x10, 0x61,
- 0x10, 0x7e, 0x10, 0x9b, 0x10, 0xb9, 0x10, 0xd7,
- 0x10, 0xf5, 0x11, 0x13, 0x11, 0x31, 0x11, 0x4f,
- 0x11, 0x6d, 0x11, 0x8c, 0x11, 0xaa, 0x11, 0xc9,
- 0x11, 0xe8, 0x12, 0x07, 0x12, 0x26, 0x12, 0x45,
- 0x12, 0x64, 0x12, 0x84, 0x12, 0xa3, 0x12, 0xc3,
- 0x12, 0xe3, 0x13, 0x03, 0x13, 0x23, 0x13, 0x43,
- 0x13, 0x63, 0x13, 0x83, 0x13, 0xa4, 0x13, 0xc5,
- 0x13, 0xe5, 0x14, 0x06, 0x14, 0x27, 0x14, 0x49,
- 0x14, 0x6a, 0x14, 0x8b, 0x14, 0xad, 0x14, 0xce,
- 0x14, 0xf0, 0x15, 0x12, 0x15, 0x34, 0x15, 0x56,
- 0x15, 0x78, 0x15, 0x9b, 0x15, 0xbd, 0x15, 0xe0,
- 0x16, 0x03, 0x16, 0x26, 0x16, 0x49, 0x16, 0x6c,
- 0x16, 0x8f, 0x16, 0xb2, 0x16, 0xd6, 0x16, 0xfa,
- 0x17, 0x1d, 0x17, 0x41, 0x17, 0x65, 0x17, 0x89,
- 0x17, 0xae, 0x17, 0xd2, 0x17, 0xf7, 0x18, 0x1b,
- 0x18, 0x40, 0x18, 0x65, 0x18, 0x8a, 0x18, 0xaf,
- 0x18, 0xd5, 0x18, 0xfa, 0x19, 0x20, 0x19, 0x45,
- 0x19, 0x6b, 0x19, 0x91, 0x19, 0xb7, 0x19, 0xdd,
- 0x1a, 0x04, 0x1a, 0x2a, 0x1a, 0x51, 0x1a, 0x77,
- 0x1a, 0x9e, 0x1a, 0xc5, 0x1a, 0xec, 0x1b, 0x14,
- 0x1b, 0x3b, 0x1b, 0x63, 0x1b, 0x8a, 0x1b, 0xb2,
- 0x1b, 0xda, 0x1c, 0x02, 0x1c, 0x2a, 0x1c, 0x52,
- 0x1c, 0x7b, 0x1c, 0xa3, 0x1c, 0xcc, 0x1c, 0xf5,
- 0x1d, 0x1e, 0x1d, 0x47, 0x1d, 0x70, 0x1d, 0x99,
- 0x1d, 0xc3, 0x1d, 0xec, 0x1e, 0x16, 0x1e, 0x40,
- 0x1e, 0x6a, 0x1e, 0x94, 0x1e, 0xbe, 0x1e, 0xe9,
- 0x1f, 0x13, 0x1f, 0x3e, 0x1f, 0x69, 0x1f, 0x94,
- 0x1f, 0xbf, 0x1f, 0xea, 0x20, 0x15, 0x20, 0x41,
- 0x20, 0x6c, 0x20, 0x98, 0x20, 0xc4, 0x20, 0xf0,
- 0x21, 0x1c, 0x21, 0x48, 0x21, 0x75, 0x21, 0xa1,
- 0x21, 0xce, 0x21, 0xfb, 0x22, 0x27, 0x22, 0x55,
- 0x22, 0x82, 0x22, 0xaf, 0x22, 0xdd, 0x23, 0x0a,
- 0x23, 0x38, 0x23, 0x66, 0x23, 0x94, 0x23, 0xc2,
- 0x23, 0xf0, 0x24, 0x1f, 0x24, 0x4d, 0x24, 0x7c,
- 0x24, 0xab, 0x24, 0xda, 0x25, 0x09, 0x25, 0x38,
- 0x25, 0x68, 0x25, 0x97, 0x25, 0xc7, 0x25, 0xf7,
- 0x26, 0x27, 0x26, 0x57, 0x26, 0x87, 0x26, 0xb7,
- 0x26, 0xe8, 0x27, 0x18, 0x27, 0x49, 0x27, 0x7a,
- 0x27, 0xab, 0x27, 0xdc, 0x28, 0x0d, 0x28, 0x3f,
- 0x28, 0x71, 0x28, 0xa2, 0x28, 0xd4, 0x29, 0x06,
- 0x29, 0x38, 0x29, 0x6b, 0x29, 0x9d, 0x29, 0xd0,
- 0x2a, 0x02, 0x2a, 0x35, 0x2a, 0x68, 0x2a, 0x9b,
- 0x2a, 0xcf, 0x2b, 0x02, 0x2b, 0x36, 0x2b, 0x69,
- 0x2b, 0x9d, 0x2b, 0xd1, 0x2c, 0x05, 0x2c, 0x39,
- 0x2c, 0x6e, 0x2c, 0xa2, 0x2c, 0xd7, 0x2d, 0x0c,
- 0x2d, 0x41, 0x2d, 0x76, 0x2d, 0xab, 0x2d, 0xe1,
- 0x2e, 0x16, 0x2e, 0x4c, 0x2e, 0x82, 0x2e, 0xb7,
- 0x2e, 0xee, 0x2f, 0x24, 0x2f, 0x5a, 0x2f, 0x91,
- 0x2f, 0xc7, 0x2f, 0xfe, 0x30, 0x35, 0x30, 0x6c,
- 0x30, 0xa4, 0x30, 0xdb, 0x31, 0x12, 0x31, 0x4a,
- 0x31, 0x82, 0x31, 0xba, 0x31, 0xf2, 0x32, 0x2a,
- 0x32, 0x63, 0x32, 0x9b, 0x32, 0xd4, 0x33, 0x0d,
- 0x33, 0x46, 0x33, 0x7f, 0x33, 0xb8, 0x33, 0xf1,
- 0x34, 0x2b, 0x34, 0x65, 0x34, 0x9e, 0x34, 0xd8,
- 0x35, 0x13, 0x35, 0x4d, 0x35, 0x87, 0x35, 0xc2,
- 0x35, 0xfd, 0x36, 0x37, 0x36, 0x72, 0x36, 0xae,
- 0x36, 0xe9, 0x37, 0x24, 0x37, 0x60, 0x37, 0x9c,
- 0x37, 0xd7, 0x38, 0x14, 0x38, 0x50, 0x38, 0x8c,
- 0x38, 0xc8, 0x39, 0x05, 0x39, 0x42, 0x39, 0x7f,
- 0x39, 0xbc, 0x39, 0xf9, 0x3a, 0x36, 0x3a, 0x74,
- 0x3a, 0xb2, 0x3a, 0xef, 0x3b, 0x2d, 0x3b, 0x6b,
- 0x3b, 0xaa, 0x3b, 0xe8, 0x3c, 0x27, 0x3c, 0x65,
- 0x3c, 0xa4, 0x3c, 0xe3, 0x3d, 0x22, 0x3d, 0x61,
- 0x3d, 0xa1, 0x3d, 0xe0, 0x3e, 0x20, 0x3e, 0x60,
- 0x3e, 0xa0, 0x3e, 0xe0, 0x3f, 0x21, 0x3f, 0x61,
- 0x3f, 0xa2, 0x3f, 0xe2, 0x40, 0x23, 0x40, 0x64,
- 0x40, 0xa6, 0x40, 0xe7, 0x41, 0x29, 0x41, 0x6a,
- 0x41, 0xac, 0x41, 0xee, 0x42, 0x30, 0x42, 0x72,
- 0x42, 0xb5, 0x42, 0xf7, 0x43, 0x3a, 0x43, 0x7d,
- 0x43, 0xc0, 0x44, 0x03, 0x44, 0x47, 0x44, 0x8a,
- 0x44, 0xce, 0x45, 0x12, 0x45, 0x55, 0x45, 0x9a,
- 0x45, 0xde, 0x46, 0x22, 0x46, 0x67, 0x46, 0xab,
- 0x46, 0xf0, 0x47, 0x35, 0x47, 0x7b, 0x47, 0xc0,
- 0x48, 0x05, 0x48, 0x4b, 0x48, 0x91, 0x48, 0xd7,
- 0x49, 0x1d, 0x49, 0x63, 0x49, 0xa9, 0x49, 0xf0,
- 0x4a, 0x37, 0x4a, 0x7d, 0x4a, 0xc4, 0x4b, 0x0c,
- 0x4b, 0x53, 0x4b, 0x9a, 0x4b, 0xe2, 0x4c, 0x2a,
- 0x4c, 0x72, 0x4c, 0xba, 0x4d, 0x02, 0x4d, 0x4a,
- 0x4d, 0x93, 0x4d, 0xdc, 0x4e, 0x25, 0x4e, 0x6e,
- 0x4e, 0xb7, 0x4f, 0x00, 0x4f, 0x49, 0x4f, 0x93,
- 0x4f, 0xdd, 0x50, 0x27, 0x50, 0x71, 0x50, 0xbb,
- 0x51, 0x06, 0x51, 0x50, 0x51, 0x9b, 0x51, 0xe6,
- 0x52, 0x31, 0x52, 0x7c, 0x52, 0xc7, 0x53, 0x13,
- 0x53, 0x5f, 0x53, 0xaa, 0x53, 0xf6, 0x54, 0x42,
- 0x54, 0x8f, 0x54, 0xdb, 0x55, 0x28, 0x55, 0x75,
- 0x55, 0xc2, 0x56, 0x0f, 0x56, 0x5c, 0x56, 0xa9,
- 0x56, 0xf7, 0x57, 0x44, 0x57, 0x92, 0x57, 0xe0,
- 0x58, 0x2f, 0x58, 0x7d, 0x58, 0xcb, 0x59, 0x1a,
- 0x59, 0x69, 0x59, 0xb8, 0x5a, 0x07, 0x5a, 0x56,
- 0x5a, 0xa6, 0x5a, 0xf5, 0x5b, 0x45, 0x5b, 0x95,
- 0x5b, 0xe5, 0x5c, 0x35, 0x5c, 0x86, 0x5c, 0xd6,
- 0x5d, 0x27, 0x5d, 0x78, 0x5d, 0xc9, 0x5e, 0x1a,
- 0x5e, 0x6c, 0x5e, 0xbd, 0x5f, 0x0f, 0x5f, 0x61,
- 0x5f, 0xb3, 0x60, 0x05, 0x60, 0x57, 0x60, 0xaa,
- 0x60, 0xfc, 0x61, 0x4f, 0x61, 0xa2, 0x61, 0xf5,
- 0x62, 0x49, 0x62, 0x9c, 0x62, 0xf0, 0x63, 0x43,
- 0x63, 0x97, 0x63, 0xeb, 0x64, 0x40, 0x64, 0x94,
- 0x64, 0xe9, 0x65, 0x3d, 0x65, 0x92, 0x65, 0xe7,
- 0x66, 0x3d, 0x66, 0x92, 0x66, 0xe8, 0x67, 0x3d,
- 0x67, 0x93, 0x67, 0xe9, 0x68, 0x3f, 0x68, 0x96,
- 0x68, 0xec, 0x69, 0x43, 0x69, 0x9a, 0x69, 0xf1,
- 0x6a, 0x48, 0x6a, 0x9f, 0x6a, 0xf7, 0x6b, 0x4f,
- 0x6b, 0xa7, 0x6b, 0xff, 0x6c, 0x57, 0x6c, 0xaf,
- 0x6d, 0x08, 0x6d, 0x60, 0x6d, 0xb9, 0x6e, 0x12,
- 0x6e, 0x6b, 0x6e, 0xc4, 0x6f, 0x1e, 0x6f, 0x78,
- 0x6f, 0xd1, 0x70, 0x2b, 0x70, 0x86, 0x70, 0xe0,
- 0x71, 0x3a, 0x71, 0x95, 0x71, 0xf0, 0x72, 0x4b,
- 0x72, 0xa6, 0x73, 0x01, 0x73, 0x5d, 0x73, 0xb8,
- 0x74, 0x14, 0x74, 0x70, 0x74, 0xcc, 0x75, 0x28,
- 0x75, 0x85, 0x75, 0xe1, 0x76, 0x3e, 0x76, 0x9b,
- 0x76, 0xf8, 0x77, 0x56, 0x77, 0xb3, 0x78, 0x11,
- 0x78, 0x6e, 0x78, 0xcc, 0x79, 0x2a, 0x79, 0x89,
- 0x79, 0xe7, 0x7a, 0x46, 0x7a, 0xa5, 0x7b, 0x04,
- 0x7b, 0x63, 0x7b, 0xc2, 0x7c, 0x21, 0x7c, 0x81,
- 0x7c, 0xe1, 0x7d, 0x41, 0x7d, 0xa1, 0x7e, 0x01,
- 0x7e, 0x62, 0x7e, 0xc2, 0x7f, 0x23, 0x7f, 0x84,
- 0x7f, 0xe5, 0x80, 0x47, 0x80, 0xa8, 0x81, 0x0a,
- 0x81, 0x6b, 0x81, 0xcd, 0x82, 0x30, 0x82, 0x92,
- 0x82, 0xf4, 0x83, 0x57, 0x83, 0xba, 0x84, 0x1d,
- 0x84, 0x80, 0x84, 0xe3, 0x85, 0x47, 0x85, 0xab,
- 0x86, 0x0e, 0x86, 0x72, 0x86, 0xd7, 0x87, 0x3b,
- 0x87, 0x9f, 0x88, 0x04, 0x88, 0x69, 0x88, 0xce,
- 0x89, 0x33, 0x89, 0x99, 0x89, 0xfe, 0x8a, 0x64,
- 0x8a, 0xca, 0x8b, 0x30, 0x8b, 0x96, 0x8b, 0xfc,
- 0x8c, 0x63, 0x8c, 0xca, 0x8d, 0x31, 0x8d, 0x98,
- 0x8d, 0xff, 0x8e, 0x66, 0x8e, 0xce, 0x8f, 0x36,
- 0x8f, 0x9e, 0x90, 0x06, 0x90, 0x6e, 0x90, 0xd6,
- 0x91, 0x3f, 0x91, 0xa8, 0x92, 0x11, 0x92, 0x7a,
- 0x92, 0xe3, 0x93, 0x4d, 0x93, 0xb6, 0x94, 0x20,
- 0x94, 0x8a, 0x94, 0xf4, 0x95, 0x5f, 0x95, 0xc9,
- 0x96, 0x34, 0x96, 0x9f, 0x97, 0x0a, 0x97, 0x75,
- 0x97, 0xe0, 0x98, 0x4c, 0x98, 0xb8, 0x99, 0x24,
- 0x99, 0x90, 0x99, 0xfc, 0x9a, 0x68, 0x9a, 0xd5,
- 0x9b, 0x42, 0x9b, 0xaf, 0x9c, 0x1c, 0x9c, 0x89,
- 0x9c, 0xf7, 0x9d, 0x64, 0x9d, 0xd2, 0x9e, 0x40,
- 0x9e, 0xae, 0x9f, 0x1d, 0x9f, 0x8b, 0x9f, 0xfa,
- 0xa0, 0x69, 0xa0, 0xd8, 0xa1, 0x47, 0xa1, 0xb6,
- 0xa2, 0x26, 0xa2, 0x96, 0xa3, 0x06, 0xa3, 0x76,
- 0xa3, 0xe6, 0xa4, 0x56, 0xa4, 0xc7, 0xa5, 0x38,
- 0xa5, 0xa9, 0xa6, 0x1a, 0xa6, 0x8b, 0xa6, 0xfd,
- 0xa7, 0x6e, 0xa7, 0xe0, 0xa8, 0x52, 0xa8, 0xc4,
- 0xa9, 0x37, 0xa9, 0xa9, 0xaa, 0x1c, 0xaa, 0x8f,
- 0xab, 0x02, 0xab, 0x75, 0xab, 0xe9, 0xac, 0x5c,
- 0xac, 0xd0, 0xad, 0x44, 0xad, 0xb8, 0xae, 0x2d,
- 0xae, 0xa1, 0xaf, 0x16, 0xaf, 0x8b, 0xb0, 0x00,
- 0xb0, 0x75, 0xb0, 0xea, 0xb1, 0x60, 0xb1, 0xd6,
- 0xb2, 0x4b, 0xb2, 0xc2, 0xb3, 0x38, 0xb3, 0xae,
- 0xb4, 0x25, 0xb4, 0x9c, 0xb5, 0x13, 0xb5, 0x8a,
- 0xb6, 0x01, 0xb6, 0x79, 0xb6, 0xf0, 0xb7, 0x68,
- 0xb7, 0xe0, 0xb8, 0x59, 0xb8, 0xd1, 0xb9, 0x4a,
- 0xb9, 0xc2, 0xba, 0x3b, 0xba, 0xb5, 0xbb, 0x2e,
- 0xbb, 0xa7, 0xbc, 0x21, 0xbc, 0x9b, 0xbd, 0x15,
- 0xbd, 0x8f, 0xbe, 0x0a, 0xbe, 0x84, 0xbe, 0xff,
- 0xbf, 0x7a, 0xbf, 0xf5, 0xc0, 0x70, 0xc0, 0xec,
- 0xc1, 0x67, 0xc1, 0xe3, 0xc2, 0x5f, 0xc2, 0xdb,
- 0xc3, 0x58, 0xc3, 0xd4, 0xc4, 0x51, 0xc4, 0xce,
- 0xc5, 0x4b, 0xc5, 0xc8, 0xc6, 0x46, 0xc6, 0xc3,
- 0xc7, 0x41, 0xc7, 0xbf, 0xc8, 0x3d, 0xc8, 0xbc,
- 0xc9, 0x3a, 0xc9, 0xb9, 0xca, 0x38, 0xca, 0xb7,
- 0xcb, 0x36, 0xcb, 0xb6, 0xcc, 0x35, 0xcc, 0xb5,
- 0xcd, 0x35, 0xcd, 0xb5, 0xce, 0x36, 0xce, 0xb6,
- 0xcf, 0x37, 0xcf, 0xb8, 0xd0, 0x39, 0xd0, 0xba,
- 0xd1, 0x3c, 0xd1, 0xbe, 0xd2, 0x3f, 0xd2, 0xc1,
- 0xd3, 0x44, 0xd3, 0xc6, 0xd4, 0x49, 0xd4, 0xcb,
- 0xd5, 0x4e, 0xd5, 0xd1, 0xd6, 0x55, 0xd6, 0xd8,
- 0xd7, 0x5c, 0xd7, 0xe0, 0xd8, 0x64, 0xd8, 0xe8,
- 0xd9, 0x6c, 0xd9, 0xf1, 0xda, 0x76, 0xda, 0xfb,
- 0xdb, 0x80, 0xdc, 0x05, 0xdc, 0x8a, 0xdd, 0x10,
- 0xdd, 0x96, 0xde, 0x1c, 0xde, 0xa2, 0xdf, 0x29,
- 0xdf, 0xaf, 0xe0, 0x36, 0xe0, 0xbd, 0xe1, 0x44,
- 0xe1, 0xcc, 0xe2, 0x53, 0xe2, 0xdb, 0xe3, 0x63,
- 0xe3, 0xeb, 0xe4, 0x73, 0xe4, 0xfc, 0xe5, 0x84,
- 0xe6, 0x0d, 0xe6, 0x96, 0xe7, 0x1f, 0xe7, 0xa9,
- 0xe8, 0x32, 0xe8, 0xbc, 0xe9, 0x46, 0xe9, 0xd0,
- 0xea, 0x5b, 0xea, 0xe5, 0xeb, 0x70, 0xeb, 0xfb,
- 0xec, 0x86, 0xed, 0x11, 0xed, 0x9c, 0xee, 0x28,
- 0xee, 0xb4, 0xef, 0x40, 0xef, 0xcc, 0xf0, 0x58,
- 0xf0, 0xe5, 0xf1, 0x72, 0xf1, 0xff, 0xf2, 0x8c,
- 0xf3, 0x19, 0xf3, 0xa7, 0xf4, 0x34, 0xf4, 0xc2,
- 0xf5, 0x50, 0xf5, 0xde, 0xf6, 0x6d, 0xf6, 0xfb,
- 0xf7, 0x8a, 0xf8, 0x19, 0xf8, 0xa8, 0xf9, 0x38,
- 0xf9, 0xc7, 0xfa, 0x57, 0xfa, 0xe7, 0xfb, 0x77,
- 0xfc, 0x07, 0xfc, 0x98, 0xfd, 0x29, 0xfd, 0xba,
- 0xfe, 0x4b, 0xfe, 0xdc, 0xff, 0x6d, 0xff, 0xff
-};
-
-int jas_iccprofdata_srgblen = sizeof(jas_iccprofdata_srgb);
-
-uchar jas_iccprofdata_sgray[] = {
- 0x00, 0x00, 0x01, 0x8a, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x20, 0x00, 0x00, 0x73, 0x63, 0x6e, 0x72,
- 0x47, 0x52, 0x41, 0x59, 0x58, 0x59, 0x5a, 0x20,
- 0x07, 0xd3, 0x00, 0x01, 0x00, 0x1f, 0x00, 0x0d,
- 0x00, 0x35, 0x00, 0x21, 0x61, 0x63, 0x73, 0x70,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
- 0x4b, 0x4f, 0x44, 0x41, 0x73, 0x47, 0x72, 0x79,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d,
- 0x4a, 0x50, 0x45, 0x47, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x64, 0x65, 0x73, 0x63,
- 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x86,
- 0x63, 0x70, 0x72, 0x74, 0x00, 0x00, 0x01, 0x3c,
- 0x00, 0x00, 0x00, 0x2b, 0x77, 0x74, 0x70, 0x74,
- 0x00, 0x00, 0x01, 0x68, 0x00, 0x00, 0x00, 0x14,
- 0x6b, 0x54, 0x52, 0x43, 0x00, 0x00, 0x01, 0x7c,
- 0x00, 0x00, 0x00, 0x0e, 0x64, 0x65, 0x73, 0x63,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c,
- 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74,
- 0x65, 0x64, 0x20, 0x49, 0x43, 0x43, 0x20, 0x70,
- 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x64,
- 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x69, 0x6e,
- 0x67, 0x20, 0x73, 0x52, 0x47, 0x42, 0x2d, 0x67,
- 0x72, 0x65, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x74,
- 0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70, 0x79,
- 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x30,
- 0x30, 0x33, 0x20, 0x73, 0x52, 0x47, 0x42, 0x2d,
- 0x67, 0x72, 0x65, 0x79, 0x20, 0x52, 0x65, 0x66,
- 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x00, 0x00,
- 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xf3, 0x54, 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x01, 0x16, 0xcf, 0x63, 0x75, 0x72, 0x76,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
- 0x01, 0xcd
-};
-
-int jas_iccprofdata_sgraylen = sizeof(jas_iccprofdata_sgray);
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_image.c b/src/3rdparty/jasper/src/libjasper/base/jas_image.c
deleted file mode 100644
index fff2c24..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_image.c
+++ /dev/null
@@ -1,1445 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Image Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <ctype.h>
-
-#include "jasper/jas_math.h"
-#include "jasper/jas_image.h"
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_string.h"
-
-/******************************************************************************\
-* Types.
-\******************************************************************************/
-
-#define FLOORDIV(x, y) ((x) / (y))
-
-/******************************************************************************\
-* Local prototypes.
-\******************************************************************************/
-
-static jas_image_cmpt_t *jas_image_cmpt_create0(void);
-static void jas_image_cmpt_destroy(jas_image_cmpt_t *cmpt);
-static jas_image_cmpt_t *jas_image_cmpt_create(uint_fast32_t tlx, uint_fast32_t tly,
- uint_fast32_t hstep, uint_fast32_t vstep, uint_fast32_t width, uint_fast32_t
- height, uint_fast16_t depth, bool sgnd, uint_fast32_t inmem);
-static void jas_image_setbbox(jas_image_t *image);
-static jas_image_cmpt_t *jas_image_cmpt_copy(jas_image_cmpt_t *cmpt);
-static int jas_image_growcmpts(jas_image_t *image, int maxcmpts);
-static uint_fast32_t inttobits(jas_seqent_t v, int prec, bool sgnd);
-static jas_seqent_t bitstoint(uint_fast32_t v, int prec, bool sgnd);
-static int putint(jas_stream_t *out, int sgnd, int prec, long val);
-static int getint(jas_stream_t *in, int sgnd, int prec, long *val);
-static void jas_image_calcbbox2(jas_image_t *image, jas_image_coord_t *tlx,
- jas_image_coord_t *tly, jas_image_coord_t *brx, jas_image_coord_t *bry);
-static long uptomult(long x, long y);
-static long downtomult(long x, long y);
-static long convert(long val, int oldsgnd, int oldprec, int newsgnd,
- int newprec);
-static void jas_image_calcbbox2(jas_image_t *image, jas_image_coord_t *tlx,
- jas_image_coord_t *tly, jas_image_coord_t *brx, jas_image_coord_t *bry);
-
-/******************************************************************************\
-* Global data.
-\******************************************************************************/
-
-static int jas_image_numfmts = 0;
-static jas_image_fmtinfo_t jas_image_fmtinfos[JAS_IMAGE_MAXFMTS];
-
-/******************************************************************************\
-* Create and destroy operations.
-\******************************************************************************/
-
-jas_image_t *jas_image_create(int numcmpts, jas_image_cmptparm_t *cmptparms,
- int clrspc)
-{
- jas_image_t *image;
- uint_fast32_t rawsize;
- uint_fast32_t inmem;
- int cmptno;
- jas_image_cmptparm_t *cmptparm;
-
- if (!(image = jas_image_create0())) {
- return 0;
- }
-
- image->clrspc_ = clrspc;
- image->maxcmpts_ = numcmpts;
- image->inmem_ = true;
-
- /* Allocate memory for the per-component information. */
- if (!(image->cmpts_ = jas_malloc(image->maxcmpts_ *
- sizeof(jas_image_cmpt_t *)))) {
- jas_image_destroy(image);
- return 0;
- }
- /* Initialize in case of failure. */
- for (cmptno = 0; cmptno < image->maxcmpts_; ++cmptno) {
- image->cmpts_[cmptno] = 0;
- }
-
- /* Compute the approximate raw size of the image. */
- rawsize = 0;
- for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,
- ++cmptparm) {
- rawsize += cmptparm->width * cmptparm->height *
- (cmptparm->prec + 7) / 8;
- }
- /* Decide whether to buffer the image data in memory, based on the
- raw size of the image. */
- inmem = (rawsize < JAS_IMAGE_INMEMTHRESH);
-
- /* Create the individual image components. */
- for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,
- ++cmptparm) {
- if (!(image->cmpts_[cmptno] = jas_image_cmpt_create(cmptparm->tlx,
- cmptparm->tly, cmptparm->hstep, cmptparm->vstep,
- cmptparm->width, cmptparm->height, cmptparm->prec,
- cmptparm->sgnd, inmem))) {
- jas_image_destroy(image);
- return 0;
- }
- ++image->numcmpts_;
- }
-
- /* Determine the bounding box for all of the components on the
- reference grid (i.e., the image area) */
- jas_image_setbbox(image);
-
- return image;
-}
-
-jas_image_t *jas_image_create0()
-{
- jas_image_t *image;
-
- if (!(image = jas_malloc(sizeof(jas_image_t)))) {
- return 0;
- }
-
- image->tlx_ = 0;
- image->tly_ = 0;
- image->brx_ = 0;
- image->bry_ = 0;
- image->clrspc_ = JAS_CLRSPC_UNKNOWN;
- image->numcmpts_ = 0;
- image->maxcmpts_ = 0;
- image->cmpts_ = 0;
- image->inmem_ = true;
- image->cmprof_ = 0;
-
- return image;
-}
-
-jas_image_t *jas_image_copy(jas_image_t *image)
-{
- jas_image_t *newimage;
- int cmptno;
-
- newimage = jas_image_create0();
- if (jas_image_growcmpts(newimage, image->numcmpts_)) {
- goto error;
- }
- for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
- if (!(newimage->cmpts_[cmptno] = jas_image_cmpt_copy(image->cmpts_[cmptno]))) {
- goto error;
- }
- ++newimage->numcmpts_;
- }
-
- jas_image_setbbox(newimage);
-
- if (image->cmprof_) {
- if (!(newimage->cmprof_ = jas_cmprof_copy(image->cmprof_)))
- goto error;
- }
-
- return newimage;
-error:
- if (newimage) {
- jas_image_destroy(newimage);
- }
- return 0;
-}
-
-static jas_image_cmpt_t *jas_image_cmpt_create0()
-{
- jas_image_cmpt_t *cmpt;
- if (!(cmpt = jas_malloc(sizeof(jas_image_cmpt_t)))) {
- return 0;
- }
- memset(cmpt, 0, sizeof(jas_image_cmpt_t));
- cmpt->type_ = JAS_IMAGE_CT_UNKNOWN;
- return cmpt;
-}
-
-static jas_image_cmpt_t *jas_image_cmpt_copy(jas_image_cmpt_t *cmpt)
-{
- jas_image_cmpt_t *newcmpt;
-
- if (!(newcmpt = jas_image_cmpt_create0())) {
- return 0;
- }
- newcmpt->tlx_ = cmpt->tlx_;
- newcmpt->tly_ = cmpt->tly_;
- newcmpt->hstep_ = cmpt->hstep_;
- newcmpt->vstep_ = cmpt->vstep_;
- newcmpt->width_ = cmpt->width_;
- newcmpt->height_ = cmpt->height_;
- newcmpt->prec_ = cmpt->prec_;
- newcmpt->sgnd_ = cmpt->sgnd_;
- newcmpt->cps_ = cmpt->cps_;
- newcmpt->type_ = cmpt->type_;
- if (!(newcmpt->stream_ = jas_stream_memopen(0, 0))) {
- return 0;
- }
- if (jas_stream_seek(cmpt->stream_, 0, SEEK_SET)) {
- return 0;
- }
- if (jas_stream_copy(newcmpt->stream_, cmpt->stream_, -1)) {
- return 0;
- }
- if (jas_stream_seek(newcmpt->stream_, 0, SEEK_SET)) {
- return 0;
- }
- return newcmpt;
-}
-
-void jas_image_destroy(jas_image_t *image)
-{
- int i;
-
- if (image->cmpts_) {
- for (i = 0; i < image->numcmpts_; ++i) {
- jas_image_cmpt_destroy(image->cmpts_[i]);
- image->cmpts_[i] = 0;
- }
- jas_free(image->cmpts_);
- }
- if (image->cmprof_)
- jas_cmprof_destroy(image->cmprof_);
- jas_free(image);
-}
-
-static jas_image_cmpt_t *jas_image_cmpt_create(uint_fast32_t tlx, uint_fast32_t tly,
- uint_fast32_t hstep, uint_fast32_t vstep, uint_fast32_t width, uint_fast32_t
- height, uint_fast16_t depth, bool sgnd, uint_fast32_t inmem)
-{
- jas_image_cmpt_t *cmpt;
- long size;
-
- if (!(cmpt = jas_malloc(sizeof(jas_image_cmpt_t)))) {
- return 0;
- }
-
- cmpt->type_ = JAS_IMAGE_CT_UNKNOWN;
- cmpt->tlx_ = tlx;
- cmpt->tly_ = tly;
- cmpt->hstep_ = hstep;
- cmpt->vstep_ = vstep;
- cmpt->width_ = width;
- cmpt->height_ = height;
- cmpt->prec_ = depth;
- cmpt->sgnd_ = sgnd;
- cmpt->stream_ = 0;
- cmpt->cps_ = (depth + 7) / 8;
-
- size = cmpt->width_ * cmpt->height_ * cmpt->cps_;
- cmpt->stream_ = (inmem) ? jas_stream_memopen(0, size) : jas_stream_tmpfile();
- if (!cmpt->stream_) {
- jas_image_cmpt_destroy(cmpt);
- return 0;
- }
-
- /* Zero the component data. This isn't necessary, but it is
- convenient for debugging purposes. */
- if (jas_stream_seek(cmpt->stream_, size - 1, SEEK_SET) < 0 ||
- jas_stream_putc(cmpt->stream_, 0) == EOF ||
- jas_stream_seek(cmpt->stream_, 0, SEEK_SET) < 0) {
- jas_image_cmpt_destroy(cmpt);
- return 0;
- }
-
- return cmpt;
-}
-
-static void jas_image_cmpt_destroy(jas_image_cmpt_t *cmpt)
-{
- if (cmpt->stream_) {
- jas_stream_close(cmpt->stream_);
- }
- jas_free(cmpt);
-}
-
-/******************************************************************************\
-* Load and save operations.
-\******************************************************************************/
-
-jas_image_t *jas_image_decode(jas_stream_t *in, int fmt, char *optstr)
-{
- jas_image_fmtinfo_t *fmtinfo;
- jas_image_t *image;
-
- image = 0;
-
- /* If possible, try to determine the format of the input data. */
- if (fmt < 0) {
- if ((fmt = jas_image_getfmt(in)) < 0)
- goto error;
- }
-
- /* Is it possible to decode an image represented in this format? */
- if (!(fmtinfo = jas_image_lookupfmtbyid(fmt)))
- goto error;
- if (!fmtinfo->ops.decode)
- goto error;
-
- /* Decode the image. */
- if (!(image = (*fmtinfo->ops.decode)(in, optstr)))
- goto error;
-
- /* Create a color profile if needed. */
- if (!jas_clrspc_isunknown(image->clrspc_) &&
- !jas_clrspc_isgeneric(image->clrspc_) && !image->cmprof_) {
- if (!(image->cmprof_ =
- jas_cmprof_createfromclrspc(jas_image_clrspc(image))))
- goto error;
- }
-
- return image;
-error:
- if (image)
- jas_image_destroy(image);
- return 0;
-}
-
-int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt, char *optstr)
-{
- jas_image_fmtinfo_t *fmtinfo;
- if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) {
- return -1;
- }
- return (fmtinfo->ops.encode) ? (*fmtinfo->ops.encode)(image, out,
- optstr) : (-1);
-}
-
-/******************************************************************************\
-* Component read and write operations.
-\******************************************************************************/
-
-int jas_image_readcmpt(jas_image_t *image, int cmptno, jas_image_coord_t x,
- jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
- jas_matrix_t *data)
-{
- jas_image_cmpt_t *cmpt;
- jas_image_coord_t i;
- jas_image_coord_t j;
- int k;
- jas_seqent_t v;
- int c;
- jas_seqent_t *dr;
- jas_seqent_t *d;
- int drs;
-
- if (cmptno < 0 || cmptno >= image->numcmpts_) {
- return -1;
- }
-
- cmpt = image->cmpts_[cmptno];
- if (x >= cmpt->width_ || y >= cmpt->height_ ||
- x + width > cmpt->width_ ||
- y + height > cmpt->height_) {
- return -1;
- }
-
- if (jas_matrix_numrows(data) != height || jas_matrix_numcols(data) != width) {
- if (jas_matrix_resize(data, height, width)) {
- return -1;
- }
- }
-
- dr = jas_matrix_getref(data, 0, 0);
- drs = jas_matrix_rowstep(data);
- for (i = 0; i < height; ++i, dr += drs) {
- d = dr;
- if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x)
- * cmpt->cps_, SEEK_SET) < 0) {
- return -1;
- }
- for (j = width; j > 0; --j, ++d) {
- v = 0;
- for (k = cmpt->cps_; k > 0; --k) {
- if ((c = jas_stream_getc(cmpt->stream_)) == EOF) {
- return -1;
- }
- v = (v << 8) | (c & 0xff);
- }
- *d = bitstoint(v, cmpt->prec_, cmpt->sgnd_);
- }
- }
-
- return 0;
-}
-
-int jas_image_writecmpt(jas_image_t *image, int cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width,
- jas_image_coord_t height, jas_matrix_t *data)
-{
- jas_image_cmpt_t *cmpt;
- jas_image_coord_t i;
- jas_image_coord_t j;
- jas_seqent_t *d;
- jas_seqent_t *dr;
- int drs;
- jas_seqent_t v;
- int k;
- int c;
-
- if (cmptno < 0 || cmptno >= image->numcmpts_) {
- return -1;
- }
-
- cmpt = image->cmpts_[cmptno];
- if (x >= cmpt->width_ || y >= cmpt->height_ ||
- x + width > cmpt->width_ ||
- y + height > cmpt->height_) {
- return -1;
- }
-
- if (jas_matrix_numrows(data) != height || jas_matrix_numcols(data) != width) {
- return -1;
- }
-
- dr = jas_matrix_getref(data, 0, 0);
- drs = jas_matrix_rowstep(data);
- for (i = 0; i < height; ++i, dr += drs) {
- d = dr;
- if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x)
- * cmpt->cps_, SEEK_SET) < 0) {
- return -1;
- }
- for (j = width; j > 0; --j, ++d) {
- v = inttobits(*d, cmpt->prec_, cmpt->sgnd_);
- for (k = cmpt->cps_; k > 0; --k) {
- c = (v >> (8 * (cmpt->cps_ - 1))) & 0xff;
- if (jas_stream_putc(cmpt->stream_,
- (unsigned char) c) == EOF) {
- return -1;
- }
- v <<= 8;
- }
- }
- }
-
- return 0;
-}
-
-/******************************************************************************\
-* File format operations.
-\******************************************************************************/
-
-void jas_image_clearfmts()
-{
- int i;
- jas_image_fmtinfo_t *fmtinfo;
- for (i = 0; i < jas_image_numfmts; ++i) {
- fmtinfo = &jas_image_fmtinfos[i];
- if (fmtinfo->name) {
- jas_free(fmtinfo->name);
- fmtinfo->name = 0;
- }
- if (fmtinfo->ext) {
- jas_free(fmtinfo->ext);
- fmtinfo->ext = 0;
- }
- if (fmtinfo->desc) {
- jas_free(fmtinfo->desc);
- fmtinfo->desc = 0;
- }
- }
- jas_image_numfmts = 0;
-}
-
-int jas_image_addfmt(int id, char *name, char *ext, char *desc,
- jas_image_fmtops_t *ops)
-{
- jas_image_fmtinfo_t *fmtinfo;
- assert(id >= 0 && name && ext && ops);
- if (jas_image_numfmts >= JAS_IMAGE_MAXFMTS) {
- return -1;
- }
- fmtinfo = &jas_image_fmtinfos[jas_image_numfmts];
- fmtinfo->id = id;
- if (!(fmtinfo->name = jas_strdup(name))) {
- return -1;
- }
- if (!(fmtinfo->ext = jas_strdup(ext))) {
- jas_free(fmtinfo->name);
- return -1;
- }
- if (!(fmtinfo->desc = jas_strdup(desc))) {
- jas_free(fmtinfo->name);
- jas_free(fmtinfo->ext);
- return -1;
- }
- fmtinfo->ops = *ops;
- ++jas_image_numfmts;
- return 0;
-}
-
-int jas_image_strtofmt(char *name)
-{
- jas_image_fmtinfo_t *fmtinfo;
- if (!(fmtinfo = jas_image_lookupfmtbyname(name))) {
- return -1;
- }
- return fmtinfo->id;
-}
-
-char *jas_image_fmttostr(int fmt)
-{
- jas_image_fmtinfo_t *fmtinfo;
- if (!(fmtinfo = jas_image_lookupfmtbyid(fmt))) {
- return 0;
- }
- return fmtinfo->name;
-}
-
-int jas_image_getfmt(jas_stream_t *in)
-{
- jas_image_fmtinfo_t *fmtinfo;
- int found;
- int i;
-
- /* Check for data in each of the supported formats. */
- found = 0;
- for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i,
- ++fmtinfo) {
- if (fmtinfo->ops.validate) {
- /* Is the input data valid for this format? */
- if (!(*fmtinfo->ops.validate)(in)) {
- found = 1;
- break;
- }
- }
- }
- return found ? fmtinfo->id : (-1);
-}
-
-int jas_image_fmtfromname(char *name)
-{
- int i;
- char *ext;
- jas_image_fmtinfo_t *fmtinfo;
- /* Get the file name extension. */
- if (!(ext = strrchr(name, '.'))) {
- return -1;
- }
- ++ext;
- /* Try to find a format that uses this extension. */
- for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i,
- ++fmtinfo) {
- /* Do we have a match? */
- if (!strcmp(ext, fmtinfo->ext)) {
- return fmtinfo->id;
- }
- }
- return -1;
-}
-
-/******************************************************************************\
-* Miscellaneous operations.
-\******************************************************************************/
-
-uint_fast32_t jas_image_rawsize(jas_image_t *image)
-{
- uint_fast32_t rawsize;
- int cmptno;
- jas_image_cmpt_t *cmpt;
-
- rawsize = 0;
- for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
- cmpt = image->cmpts_[cmptno];
- rawsize += (cmpt->width_ * cmpt->height_ * cmpt->prec_ +
- 7) / 8;
- }
- return rawsize;
-}
-
-void jas_image_delcmpt(jas_image_t *image, int cmptno)
-{
- if (cmptno >= image->numcmpts_) {
- return;
- }
- jas_image_cmpt_destroy(image->cmpts_[cmptno]);
- if (cmptno < image->numcmpts_) {
- memmove(&image->cmpts_[cmptno], &image->cmpts_[cmptno + 1],
- (image->numcmpts_ - 1 - cmptno) * sizeof(jas_image_cmpt_t *));
- }
- --image->numcmpts_;
-
- jas_image_setbbox(image);
-}
-
-int jas_image_addcmpt(jas_image_t *image, int cmptno,
- jas_image_cmptparm_t *cmptparm)
-{
- jas_image_cmpt_t *newcmpt;
- if (cmptno < 0)
- cmptno = image->numcmpts_;
- assert(cmptno >= 0 && cmptno <= image->numcmpts_);
- if (image->numcmpts_ >= image->maxcmpts_) {
- if (jas_image_growcmpts(image, image->maxcmpts_ + 128)) {
- return -1;
- }
- }
- if (!(newcmpt = jas_image_cmpt_create(cmptparm->tlx,
- cmptparm->tly, cmptparm->hstep, cmptparm->vstep,
- cmptparm->width, cmptparm->height, cmptparm->prec,
- cmptparm->sgnd, 1))) {
- return -1;
- }
- if (cmptno < image->numcmpts_) {
- memmove(&image->cmpts_[cmptno + 1], &image->cmpts_[cmptno],
- (image->numcmpts_ - cmptno) * sizeof(jas_image_cmpt_t *));
- }
- image->cmpts_[cmptno] = newcmpt;
- ++image->numcmpts_;
-
- jas_image_setbbox(image);
-
- return 0;
-}
-
-jas_image_fmtinfo_t *jas_image_lookupfmtbyid(int id)
-{
- int i;
- jas_image_fmtinfo_t *fmtinfo;
-
- for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i, ++fmtinfo) {
- if (fmtinfo->id == id) {
- return fmtinfo;
- }
- }
- return 0;
-}
-
-jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name)
-{
- int i;
- jas_image_fmtinfo_t *fmtinfo;
-
- for (i = 0, fmtinfo = jas_image_fmtinfos; i < jas_image_numfmts; ++i, ++fmtinfo) {
- if (!strcmp(fmtinfo->name, name)) {
- return fmtinfo;
- }
- }
- return 0;
-}
-
-
-
-
-
-static uint_fast32_t inttobits(jas_seqent_t v, int prec, bool sgnd)
-{
- uint_fast32_t ret;
- ret = ((sgnd && v < 0) ? ((1 << prec) + v) : v) & JAS_ONES(prec);
- return ret;
-}
-
-static jas_seqent_t bitstoint(uint_fast32_t v, int prec, bool sgnd)
-{
- jas_seqent_t ret;
- v &= JAS_ONES(prec);
- ret = (sgnd && (v & (1 << (prec - 1)))) ? (v - (1 << prec)) : v;
- return ret;
-}
-
-static void jas_image_setbbox(jas_image_t *image)
-{
- jas_image_cmpt_t *cmpt;
- int cmptno;
- int_fast32_t x;
- int_fast32_t y;
-
- if (image->numcmpts_ > 0) {
- /* Determine the bounding box for all of the components on the
- reference grid (i.e., the image area) */
- cmpt = image->cmpts_[0];
- image->tlx_ = cmpt->tlx_;
- image->tly_ = cmpt->tly_;
- image->brx_ = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1) + 1;
- image->bry_ = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1) + 1;
- for (cmptno = 1; cmptno < image->numcmpts_; ++cmptno) {
- cmpt = image->cmpts_[cmptno];
- if (image->tlx_ > cmpt->tlx_) {
- image->tlx_ = cmpt->tlx_;
- }
- if (image->tly_ > cmpt->tly_) {
- image->tly_ = cmpt->tly_;
- }
- x = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1) + 1;
- if (image->brx_ < x) {
- image->brx_ = x;
- }
- y = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1) + 1;
- if (image->bry_ < y) {
- image->bry_ = y;
- }
- }
- } else {
- image->tlx_ = 0;
- image->tly_ = 0;
- image->brx_ = 0;
- image->bry_ = 0;
- }
-}
-
-static int jas_image_growcmpts(jas_image_t *image, int maxcmpts)
-{
- jas_image_cmpt_t **newcmpts;
- int cmptno;
-
- newcmpts = (!image->cmpts_) ? jas_malloc(maxcmpts * sizeof(jas_image_cmpt_t *)) :
- jas_realloc(image->cmpts_, maxcmpts * sizeof(jas_image_cmpt_t *));
- if (!newcmpts) {
- return -1;
- }
- image->cmpts_ = newcmpts;
- image->maxcmpts_ = maxcmpts;
- for (cmptno = image->numcmpts_; cmptno < image->maxcmpts_; ++cmptno) {
- image->cmpts_[cmptno] = 0;
- }
- return 0;
-}
-
-int jas_image_copycmpt(jas_image_t *dstimage, int dstcmptno, jas_image_t *srcimage,
- int srccmptno)
-{
- jas_image_cmpt_t *newcmpt;
- if (dstimage->numcmpts_ >= dstimage->maxcmpts_) {
- if (jas_image_growcmpts(dstimage, dstimage->maxcmpts_ + 128)) {
- return -1;
- }
- }
- if (!(newcmpt = jas_image_cmpt_copy(srcimage->cmpts_[srccmptno]))) {
- return -1;
- }
- if (dstcmptno < dstimage->numcmpts_) {
- memmove(&dstimage->cmpts_[dstcmptno + 1], &dstimage->cmpts_[dstcmptno],
- (dstimage->numcmpts_ - dstcmptno) * sizeof(jas_image_cmpt_t *));
- }
- dstimage->cmpts_[dstcmptno] = newcmpt;
- ++dstimage->numcmpts_;
-
- jas_image_setbbox(dstimage);
- return 0;
-}
-
-void jas_image_dump(jas_image_t *image, FILE *out)
-{
- long buf[1024];
- int cmptno;
- int n;
- int i;
- int width;
- int height;
- jas_image_cmpt_t *cmpt;
- for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
- cmpt = image->cmpts_[cmptno];
- fprintf(out, "prec=%d, sgnd=%d, cmpttype=%d\n", cmpt->prec_,
- cmpt->sgnd_, cmpt->type_);
- width = jas_image_cmptwidth(image, cmptno);
- height = jas_image_cmptheight(image, cmptno);
- n = JAS_MIN(16, width);
- if (jas_image_readcmpt2(image, cmptno, 0, 0, n, 1, buf)) {
- abort();
- }
- for (i = 0; i < n; ++i) {
- fprintf(out, " f(%d,%d)=%ld", i, 0, buf[i]);
- }
- fprintf(out, "\n");
- if (jas_image_readcmpt2(image, cmptno, width - n, height - 1, n, 1, buf)) {
- abort();
- }
- for (i = 0; i < n; ++i) {
- fprintf(out, " f(%d,%d)=%ld", width - n + i, height - 1, buf[i]);
- }
- fprintf(out, "\n");
- }
-}
-
-int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
- int_fast32_t *lutents, int dtype, int newcmptno)
-{
- jas_image_cmptparm_t cmptparms;
- int_fast32_t v;
- int i;
- int j;
- jas_image_cmpt_t *cmpt;
-
- cmpt = image->cmpts_[cmptno];
- cmptparms.tlx = cmpt->tlx_;
- cmptparms.tly = cmpt->tly_;
- cmptparms.hstep = cmpt->hstep_;
- cmptparms.vstep = cmpt->vstep_;
- cmptparms.width = cmpt->width_;
- cmptparms.height = cmpt->height_;
- cmptparms.prec = JAS_IMAGE_CDT_GETPREC(dtype);
- cmptparms.sgnd = JAS_IMAGE_CDT_GETSGND(dtype);
-
- if (jas_image_addcmpt(image, newcmptno, &cmptparms)) {
- return -1;
- }
- if (newcmptno <= cmptno) {
- ++cmptno;
- cmpt = image->cmpts_[cmptno];
- }
-
- for (j = 0; j < cmpt->height_; ++j) {
- for (i = 0; i < cmpt->width_; ++i) {
- v = jas_image_readcmptsample(image, cmptno, i, j);
- if (v < 0) {
- v = 0;
- } else if (v >= numlutents) {
- v = numlutents - 1;
- }
- jas_image_writecmptsample(image, newcmptno, i, j,
- lutents[v]);
- }
- }
- return 0;
-}
-
-int jas_image_readcmptsample(jas_image_t *image, int cmptno, int x, int y)
-{
- jas_image_cmpt_t *cmpt;
- uint_fast32_t v;
- int k;
- int c;
-
- cmpt = image->cmpts_[cmptno];
-
- if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_,
- SEEK_SET) < 0) {
- return -1;
- }
- v = 0;
- for (k = cmpt->cps_; k > 0; --k) {
- if ((c = jas_stream_getc(cmpt->stream_)) == EOF) {
- return -1;
- }
- v = (v << 8) | (c & 0xff);
- }
- return bitstoint(v, cmpt->prec_, cmpt->sgnd_);
-}
-
-void jas_image_writecmptsample(jas_image_t *image, int cmptno, int x, int y,
- int_fast32_t v)
-{
- jas_image_cmpt_t *cmpt;
- uint_fast32_t t;
- int k;
- int c;
-
- cmpt = image->cmpts_[cmptno];
-
- if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * y + x) * cmpt->cps_,
- SEEK_SET) < 0) {
- return;
- }
- t = inttobits(v, cmpt->prec_, cmpt->sgnd_);
- for (k = cmpt->cps_; k > 0; --k) {
- c = (t >> (8 * (cmpt->cps_ - 1))) & 0xff;
- if (jas_stream_putc(cmpt->stream_, (unsigned char) c) == EOF) {
- return;
- }
- t <<= 8;
- }
-}
-
-int jas_image_getcmptbytype(jas_image_t *image, int ctype)
-{
- int cmptno;
-
- for (cmptno = 0; cmptno < image->numcmpts_; ++cmptno) {
- if (image->cmpts_[cmptno]->type_ == ctype) {
- return cmptno;
- }
- }
- return -1;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/***********************************************/
-/***********************************************/
-/***********************************************/
-/***********************************************/
-
-int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x,
- jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
- long *buf)
-{
- jas_image_cmpt_t *cmpt;
- jas_image_coord_t i;
- jas_image_coord_t j;
- long v;
- long *bufptr;
-
- if (cmptno < 0 || cmptno >= image->numcmpts_)
- goto error;
- cmpt = image->cmpts_[cmptno];
- if (x < 0 || x >= cmpt->width_ || y < 0 || y >= cmpt->height_ ||
- width < 0 || height < 0 || x + width > cmpt->width_ ||
- y + height > cmpt->height_)
- goto error;
-
- bufptr = buf;
- for (i = 0; i < height; ++i) {
- if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x)
- * cmpt->cps_, SEEK_SET) < 0)
- goto error;
- for (j = 0; j < width; ++j) {
- if (getint(cmpt->stream_, cmpt->sgnd_, cmpt->prec_, &v))
- goto error;
- *bufptr++ = v;
- }
- }
-
- return 0;
-error:
- return -1;
-}
-
-int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x,
- jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
- long *buf)
-{
- jas_image_cmpt_t *cmpt;
- jas_image_coord_t i;
- jas_image_coord_t j;
- long v;
- long *bufptr;
-
- if (cmptno < 0 || cmptno >= image->numcmpts_)
- goto error;
- cmpt = image->cmpts_[cmptno];
- if (x < 0 || x >= cmpt->width_ || y < 0 || y >= cmpt->height_ ||
- width < 0 || height < 0 || x + width > cmpt->width_ ||
- y + height > cmpt->height_)
- goto error;
-
- bufptr = buf;
- for (i = 0; i < height; ++i) {
- if (jas_stream_seek(cmpt->stream_, (cmpt->width_ * (y + i) + x)
- * cmpt->cps_, SEEK_SET) < 0)
- goto error;
- for (j = 0; j < width; ++j) {
- v = *bufptr++;
- if (putint(cmpt->stream_, cmpt->sgnd_, cmpt->prec_, v))
- goto error;
- }
- }
-
- return 0;
-error:
- return -1;
-}
-
-int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno,
- jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs,
- jas_image_coord_t vs, int sgnd, int prec)
-{
- jas_image_cmpt_t *oldcmpt;
- jas_image_cmpt_t *newcmpt;
- int width;
- int height;
- jas_image_coord_t tlx;
- jas_image_coord_t tly;
- jas_image_coord_t brx;
- jas_image_coord_t bry;
- int i;
- int j;
- jas_image_cmptparm_t cmptparm;
- jas_image_coord_t ax;
- jas_image_coord_t ay;
- jas_image_coord_t bx;
- jas_image_coord_t by;
- jas_image_coord_t d0;
- jas_image_coord_t d1;
- jas_image_coord_t d2;
- jas_image_coord_t d3;
- jas_image_coord_t oldx;
- jas_image_coord_t oldy;
- jas_image_coord_t x;
- jas_image_coord_t y;
- long v;
- jas_image_coord_t cmptbrx;
- jas_image_coord_t cmptbry;
-
- assert(cmptno >= 0 && cmptno < image->numcmpts_);
- oldcmpt = image->cmpts_[cmptno];
- assert(oldcmpt->tlx_ == 0 && oldcmpt->tly_ == 0);
- jas_image_calcbbox2(image, &tlx, &tly, &brx, &bry);
- width = FLOORDIV(brx - ho + hs, hs);
- height = FLOORDIV(bry - vo + vs, vs);
- cmptparm.tlx = ho;
- cmptparm.tly = vo;
- cmptparm.hstep = hs;
- cmptparm.vstep = vs;
- cmptparm.width = width;
- cmptparm.height = height;
- cmptparm.prec = prec;
- cmptparm.sgnd = sgnd;
- if (jas_image_addcmpt(image, newcmptno, &cmptparm))
- goto error;
-cmptbrx = oldcmpt->tlx_ + (oldcmpt->width_ - 1) * oldcmpt->hstep_;
-cmptbry = oldcmpt->tly_ + (oldcmpt->height_ - 1) * oldcmpt->vstep_;
- newcmpt = image->cmpts_[newcmptno];
- jas_stream_rewind(newcmpt->stream_);
- for (i = 0; i < height; ++i) {
- y = newcmpt->tly_ + newcmpt->vstep_ * i;
- for (j = 0; j < width; ++j) {
- x = newcmpt->tlx_ + newcmpt->hstep_ * j;
- ax = downtomult(x - oldcmpt->tlx_, oldcmpt->hstep_) + oldcmpt->tlx_;
- ay = downtomult(y - oldcmpt->tly_, oldcmpt->vstep_) + oldcmpt->tly_;
- bx = uptomult(x - oldcmpt->tlx_, oldcmpt->hstep_) + oldcmpt->tlx_;
- if (bx > cmptbrx)
- bx = cmptbrx;
- by = uptomult(y - oldcmpt->tly_, oldcmpt->vstep_) + oldcmpt->tly_;
- if (by > cmptbry)
- by = cmptbry;
- d0 = (ax - x) * (ax - x) + (ay - y) * (ay - y);
- d1 = (bx - x) * (bx - x) + (ay - y) * (ay - y);
- d2 = (bx - x) * (bx - x) + (by - y) * (by - y);
- d3 = (ax - x) * (ax - x) + (by - y) * (by - y);
- if (d0 <= d1 && d0 <= d2 && d0 <= d3) {
- oldx = (ax - oldcmpt->tlx_) / oldcmpt->hstep_;
- oldy = (ay - oldcmpt->tly_) / oldcmpt->vstep_;
- } else if (d1 <= d0 && d1 <= d2 && d1 <= d3) {
- oldx = (bx - oldcmpt->tlx_) / oldcmpt->hstep_;
- oldy = (ay - oldcmpt->tly_) / oldcmpt->vstep_;
- } else if (d2 <= d0 && d2 <= d1 && d1 <= d3) {
- oldx = (bx - oldcmpt->tlx_) / oldcmpt->hstep_;
- oldy = (by - oldcmpt->tly_) / oldcmpt->vstep_;
- } else {
- oldx = (ax - oldcmpt->tlx_) / oldcmpt->hstep_;
- oldy = (by - oldcmpt->tly_) / oldcmpt->vstep_;
- }
- assert(oldx >= 0 && oldx < oldcmpt->width_ &&
- oldy >= 0 && oldy < oldcmpt->height_);
- if (jas_stream_seek(oldcmpt->stream_, oldcmpt->cps_ *
- (oldy * oldcmpt->width_ + oldx), SEEK_SET) < 0)
- goto error;
- if (getint(oldcmpt->stream_, oldcmpt->sgnd_,
- oldcmpt->prec_, &v))
- goto error;
- if (newcmpt->prec_ != oldcmpt->prec_ ||
- newcmpt->sgnd_ != oldcmpt->sgnd_) {
- v = convert(v, oldcmpt->sgnd_, oldcmpt->prec_,
- newcmpt->sgnd_, newcmpt->prec_);
- }
- if (putint(newcmpt->stream_, newcmpt->sgnd_,
- newcmpt->prec_, v))
- goto error;
- }
- }
- return 0;
-error:
- return -1;
-}
-
-int jas_image_ishomosamp(jas_image_t *image)
-{
- jas_image_coord_t hstep;
- jas_image_coord_t vstep;
- int result;
- int i;
- hstep = jas_image_cmpthstep(image, 0);
- vstep = jas_image_cmptvstep(image, 0);
- result = 1;
- for (i = 0; i < image->numcmpts_; ++i) {
- if (jas_image_cmpthstep(image, i) != hstep ||
- jas_image_cmptvstep(image, i) != vstep) {
- result = 0;
- break;
- }
- }
- return result;
-}
-
-/* Note: This function defines a bounding box differently. */
-static void jas_image_calcbbox2(jas_image_t *image, jas_image_coord_t *tlx,
- jas_image_coord_t *tly, jas_image_coord_t *brx, jas_image_coord_t *bry)
-{
- jas_image_cmpt_t *cmpt;
- jas_image_coord_t tmptlx;
- jas_image_coord_t tmptly;
- jas_image_coord_t tmpbrx;
- jas_image_coord_t tmpbry;
- jas_image_coord_t t;
- int i;
- if (image->numcmpts_ > 0) {
- cmpt = image->cmpts_[0];
- tmptlx = cmpt->tlx_;
- tmptly = cmpt->tly_;
- tmpbrx = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1);
- tmpbry = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1);
- for (i = 0; i < image->numcmpts_; ++i) {
- cmpt = image->cmpts_[i];
- if (cmpt->tlx_ < tmptlx)
- tmptlx = cmpt->tlx_;
- if (cmpt->tly_ < tmptly)
- tmptly = cmpt->tly_;
- t = cmpt->tlx_ + cmpt->hstep_ * (cmpt->width_ - 1);
- if (t > tmpbrx)
- tmpbrx = t;
- t = cmpt->tly_ + cmpt->vstep_ * (cmpt->height_ - 1);
- if (t > tmpbry)
- tmpbry = t;
- }
- } else {
- tmptlx = 0;
- tmptly = 0;
- tmpbrx = -1;
- tmpbry = -1;
- }
- *tlx = tmptlx;
- *tly = tmptly;
- *brx = tmpbrx;
- *bry = tmpbry;
-}
-
-
-
-static int getint(jas_stream_t *in, int sgnd, int prec, long *val)
-{
- long v;
- int n;
- int c;
- n = (prec + 7) / 8;
- v = 0;
- while (--n >= 0) {
- if ((c = jas_stream_getc(in)) == EOF)
- return -1;
- v = (v << 8) | c;
- }
- v &= ((1 << prec) - 1);
- if (sgnd) {
- /* XXX - Do something here. */
- abort();
- } else {
- *val = v;
- }
- return 0;
-}
-
-static int putint(jas_stream_t *out, int sgnd, int prec, long val)
-{
- int n;
- int c;
- if (sgnd) {
- /* XXX - Do something here. */
- abort();
- }
- val &= (1 << prec) - 1;
- n = (prec + 7) / 8;
- while (--n >= 0) {
- c = (val >> (n * 8)) & 0xff;
- if (jas_stream_putc(out, c) != c)
- return -1;
- }
- return 0;
-}
-
-static long convert(long val, int oldsgnd, int oldprec, int newsgnd,
- int newprec)
-{
- if (newsgnd != oldsgnd) {
- }
- if (newprec != oldprec) {
- if (newprec > oldprec) {
- val <<= newprec - oldprec;
- } else if (oldprec > newprec) {
- val >>= oldprec - newprec;
- }
- }
- return val;
-}
-
-static long downtomult(long x, long y)
-{
- assert(x >= 0);
- return (x / y) * y;
-}
-
-static long uptomult(long x, long y)
-{
- assert(x >= 0);
- return ((x + y - 1) / y) * y;
-}
-
-jas_image_t *jas_image_chclrspc(jas_image_t *image, jas_cmprof_t *outprof,
- int intent)
-{
- jas_image_t *inimage;
- int minhstep;
- int minvstep;
- int i;
- int j;
- int k;
- int n;
- int hstep;
- int vstep;
- int numinauxchans;
- int numoutauxchans;
- int numinclrchans;
- int numoutclrchans;
- int prec;
- jas_image_t *outimage;
- int cmpttype;
- int numoutchans;
- jas_cmprof_t *inprof;
- jas_cmprof_t *tmpprof;
- jas_image_cmptparm_t cmptparm;
- int width;
- int height;
- jas_cmxform_t *xform;
- jas_cmpixmap_t inpixmap;
- jas_cmpixmap_t outpixmap;
- jas_cmcmptfmt_t *incmptfmts;
- jas_cmcmptfmt_t *outcmptfmts;
-
-#if 0
-jas_eprintf("IMAGE\n");
-jas_image_dump(image, stderr);
-#endif
-
- if (!(inimage = jas_image_copy(image)))
- goto error;
- image = 0;
-
- if (!jas_image_ishomosamp(inimage)) {
- minhstep = jas_image_cmpthstep(inimage, 0);
- minvstep = jas_image_cmptvstep(inimage, 0);
- for (i = 1; i < jas_image_numcmpts(inimage); ++i) {
- hstep = jas_image_cmpthstep(inimage, i);
- vstep = jas_image_cmptvstep(inimage, i);
- if (hstep < minhstep)
- minhstep = hstep;
- if (vstep < minvstep)
- minvstep = vstep;
- }
- n = jas_image_numcmpts(inimage);
- for (i = 0; i < n; ++i) {
- cmpttype = jas_image_cmpttype(inimage, i);
- if (jas_image_sampcmpt(inimage, i, i + 1, 0, 0, minhstep, minvstep, jas_image_cmptsgnd(inimage, i), jas_image_cmptprec(inimage, i)))
- goto error;
- jas_image_setcmpttype(inimage, i + 1, cmpttype);
- jas_image_delcmpt(inimage, i);
- }
- }
-
- width = jas_image_cmptwidth(inimage, 0);
- height = jas_image_cmptheight(inimage, 0);
- hstep = jas_image_cmpthstep(inimage, 0);
- vstep = jas_image_cmptvstep(inimage, 0);
-
- inprof = jas_image_cmprof(inimage);
- assert(inprof);
- numinclrchans = jas_clrspc_numchans(jas_cmprof_clrspc(inprof));
- numinauxchans = jas_image_numcmpts(inimage) - numinclrchans;
- numoutclrchans = jas_clrspc_numchans(jas_cmprof_clrspc(outprof));
- numoutauxchans = 0;
- numoutchans = numoutclrchans + numoutauxchans;
- prec = 8;
-
- if (!(outimage = jas_image_create0()))
- goto error;
-
- /* Create a component for each of the colorants. */
- for (i = 0; i < numoutclrchans; ++i) {
- cmptparm.tlx = 0;
- cmptparm.tly = 0;
- cmptparm.hstep = hstep;
- cmptparm.vstep = vstep;
- cmptparm.width = width;
- cmptparm.height = height;
- cmptparm.prec = prec;
- cmptparm.sgnd = 0;
- if (jas_image_addcmpt(outimage, -1, &cmptparm))
- goto error;
- jas_image_setcmpttype(outimage, i, JAS_IMAGE_CT_COLOR(i));
- }
-#if 0
- /* Copy the auxiliary components without modification. */
- for (i = 0; i < jas_image_numcmpts(inimage); ++i) {
- if (!ISCOLOR(jas_image_cmpttype(inimage, i))) {
- jas_image_copycmpt(outimage, -1, inimage, i);
-/* XXX - need to specify laydown of component on ref. grid */
- }
- }
-#endif
-
- if (!(tmpprof = jas_cmprof_copy(outprof)))
- goto error;
- assert(!jas_image_cmprof(outimage));
- jas_image_setcmprof(outimage, tmpprof);
- tmpprof = 0;
- jas_image_setclrspc(outimage, jas_cmprof_clrspc(outprof));
-
- if (!(xform = jas_cmxform_create(inprof, outprof, 0, JAS_CMXFORM_OP_FWD, intent, 0)))
- goto error;
-
- inpixmap.numcmpts = numinclrchans;
- incmptfmts = malloc(numinclrchans * sizeof(jas_cmcmptfmt_t));
- assert(incmptfmts);
- inpixmap.cmptfmts = incmptfmts;
- for (i = 0; i < numinclrchans; ++i) {
- j = jas_image_getcmptbytype(inimage, JAS_IMAGE_CT_COLOR(i));
- assert(j >= 0);
- if (!(incmptfmts[i].buf = malloc(width * sizeof(long))))
- goto error;
- incmptfmts[i].prec = jas_image_cmptprec(inimage, j);
- incmptfmts[i].sgnd = jas_image_cmptsgnd(inimage, j);
- incmptfmts[i].width = width;
- incmptfmts[i].height = 1;
- }
-
- outpixmap.numcmpts = numoutclrchans;
- outcmptfmts = malloc(numoutclrchans * sizeof(jas_cmcmptfmt_t));
- assert(outcmptfmts);
- outpixmap.cmptfmts = outcmptfmts;
-
- for (i = 0; i < numoutclrchans; ++i) {
- j = jas_image_getcmptbytype(outimage, JAS_IMAGE_CT_COLOR(i));
- assert(j >= 0);
- if (!(outcmptfmts[i].buf = malloc(width * sizeof(long))))
- goto error;
- outcmptfmts[i].prec = jas_image_cmptprec(outimage, j);
- outcmptfmts[i].sgnd = jas_image_cmptsgnd(outimage, j);
- outcmptfmts[i].width = width;
- outcmptfmts[i].height = 1;
- }
-
- for (i = 0; i < height; ++i) {
- for (j = 0; j < numinclrchans; ++j) {
- k = jas_image_getcmptbytype(inimage, JAS_IMAGE_CT_COLOR(j));
- if (jas_image_readcmpt2(inimage, k, 0, i, width, 1, incmptfmts[j].buf))
- goto error;
- }
- jas_cmxform_apply(xform, &inpixmap, &outpixmap);
- for (j = 0; j < numoutclrchans; ++j) {
- k = jas_image_getcmptbytype(outimage, JAS_IMAGE_CT_COLOR(j));
- if (jas_image_writecmpt2(outimage, k, 0, i, width, 1, outcmptfmts[j].buf))
- goto error;
- }
- }
-
- for (i = 0; i < numoutclrchans; ++i)
- jas_free(outcmptfmts[i].buf);
- jas_free(outcmptfmts);
- for (i = 0; i < numinclrchans; ++i)
- jas_free(incmptfmts[i].buf);
- jas_free(incmptfmts);
- jas_cmxform_destroy(xform);
- jas_image_destroy(inimage);
-
-#if 0
-jas_eprintf("INIMAGE\n");
-jas_image_dump(inimage, stderr);
-jas_eprintf("OUTIMAGE\n");
-jas_image_dump(outimage, stderr);
-#endif
- return outimage;
-error:
- return 0;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_init.c b/src/3rdparty/jasper/src/libjasper/base/jas_init.c
deleted file mode 100644
index c100190..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_init.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include "jasper/jas_types.h"
-#include "jasper/jas_image.h"
-#include "jasper/jas_init.h"
-
-/******************************************************************************\
-* Code.
-\******************************************************************************/
-
-/* Initialize the image format table. */
-int jas_init()
-{
- jas_image_fmtops_t fmtops;
- int fmtid;
-
- fmtid = 0;
-
-#if !defined(EXCLUDE_MIF_SUPPORT)
- fmtops.decode = mif_decode;
- fmtops.encode = mif_encode;
- fmtops.validate = mif_validate;
- jas_image_addfmt(fmtid, "mif", "mif", "My Image Format (MIF)", &fmtops);
- ++fmtid;
-#endif
-
-#if !defined(EXCLUDE_PNM_SUPPORT)
- fmtops.decode = pnm_decode;
- fmtops.encode = pnm_encode;
- fmtops.validate = pnm_validate;
- jas_image_addfmt(fmtid, "pnm", "pnm", "Portable Graymap/Pixmap (PNM)",
- &fmtops);
- jas_image_addfmt(fmtid, "pnm", "pgm", "Portable Graymap/Pixmap (PNM)",
- &fmtops);
- jas_image_addfmt(fmtid, "pnm", "ppm", "Portable Graymap/Pixmap (PNM)",
- &fmtops);
- ++fmtid;
-#endif
-
-#if !defined(EXCLUDE_BMP_SUPPORT)
- fmtops.decode = bmp_decode;
- fmtops.encode = bmp_encode;
- fmtops.validate = bmp_validate;
- jas_image_addfmt(fmtid, "bmp", "bmp", "Microsoft Bitmap (BMP)", &fmtops);
- ++fmtid;
-#endif
-
-#if !defined(EXCLUDE_RAS_SUPPORT)
- fmtops.decode = ras_decode;
- fmtops.encode = ras_encode;
- fmtops.validate = ras_validate;
- jas_image_addfmt(fmtid, "ras", "ras", "Sun Rasterfile (RAS)", &fmtops);
- ++fmtid;
-#endif
-
-#if !defined(EXCLUDE_JP2_SUPPORT)
- fmtops.decode = jp2_decode;
- fmtops.encode = jp2_encode;
- fmtops.validate = jp2_validate;
- jas_image_addfmt(fmtid, "jp2", "jp2",
- "JPEG-2000 JP2 File Format Syntax (ISO/IEC 15444-1)", &fmtops);
- ++fmtid;
- fmtops.decode = jpc_decode;
- fmtops.encode = jpc_encode;
- fmtops.validate = jpc_validate;
- jas_image_addfmt(fmtid, "jpc", "jpc",
- "JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1)", &fmtops);
- ++fmtid;
-#endif
-
-#if !defined(EXCLUDE_JPG_SUPPORT)
- fmtops.decode = jpg_decode;
- fmtops.encode = jpg_encode;
- fmtops.validate = jpg_validate;
- jas_image_addfmt(fmtid, "jpg", "jpg", "JPEG (ISO/IEC 10918-1)", &fmtops);
- ++fmtid;
-#endif
-
-#if !defined(EXCLUDE_PGX_SUPPORT)
- fmtops.decode = pgx_decode;
- fmtops.encode = pgx_encode;
- fmtops.validate = pgx_validate;
- jas_image_addfmt(fmtid, "pgx", "pgx", "JPEG-2000 VM Format (PGX)", &fmtops);
- ++fmtid;
-#endif
-
- /* We must not register the JasPer library exit handler until after
- at least one memory allocation is performed. This is desirable
- as it ensures that the JasPer exit handler is called before the
- debug memory allocator exit handler. */
- atexit(jas_cleanup);
-
- return 0;
-}
-
-void jas_cleanup()
-{
- jas_image_clearfmts();
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_malloc.c b/src/3rdparty/jasper/src/libjasper/base/jas_malloc.c
deleted file mode 100644
index df60818..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_malloc.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Memory Allocator
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-
-/* We need the prototype for memset. */
-#include <string.h>
-
-#include "jasper/jas_malloc.h"
-
-/******************************************************************************\
-* Code.
-\******************************************************************************/
-
-#if defined(DEBUG_MEMALLOC)
-#include "../../../local/src/memalloc.c"
-#endif
-
-#if !defined(DEBUG_MEMALLOC)
-
-#define MEMALLOC_ALIGNMENT 32
-#define MEMALLOC_ALIGN2
-#undef MEMALLOC_ALIGN2
-
-void *jas_malloc(size_t size)
-{
-#if defined(MEMALLOC_ALIGN2)
- void *ptr;
-abort();
- if (posix_memalign(&ptr, MEMALLOC_ALIGNMENT, size)) {
- return 0;
- }
- return ptr;
-#endif
- return malloc(size);
-}
-
-void jas_free(void *ptr)
-{
- free(ptr);
-}
-
-void *jas_realloc(void *ptr, size_t size)
-{
- return realloc(ptr, size);
-}
-
-void *jas_calloc(size_t nmemb, size_t size)
-{
- void *ptr;
- size_t n;
- n = nmemb * size;
- if (!(ptr = jas_malloc(n * sizeof(char)))) {
- return 0;
- }
- memset(ptr, 0, n);
- return ptr;
-}
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_seq.c b/src/3rdparty/jasper/src/libjasper/base/jas_seq.c
deleted file mode 100644
index 0dc4196..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_seq.c
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Sequence/Matrix Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdlib.h>
-#include <assert.h>
-#include <math.h>
-
-#include "jasper/jas_seq.h"
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_math.h"
-
-/******************************************************************************\
-* Constructors and destructors.
-\******************************************************************************/
-
-jas_matrix_t *jas_seq2d_create(int xstart, int ystart, int xend, int yend)
-{
- jas_matrix_t *matrix;
- assert(xstart <= xend && ystart <= yend);
- if (!(matrix = jas_matrix_create(yend - ystart, xend - xstart))) {
- return 0;
- }
- matrix->xstart_ = xstart;
- matrix->ystart_ = ystart;
- matrix->xend_ = xend;
- matrix->yend_ = yend;
- return matrix;
-}
-
-jas_matrix_t *jas_matrix_create(int numrows, int numcols)
-{
- jas_matrix_t *matrix;
- int i;
-
- if (!(matrix = jas_malloc(sizeof(jas_matrix_t)))) {
- return 0;
- }
- matrix->flags_ = 0;
- matrix->numrows_ = numrows;
- matrix->numcols_ = numcols;
- matrix->rows_ = 0;
- matrix->maxrows_ = numrows;
- matrix->data_ = 0;
- matrix->datasize_ = numrows * numcols;
-
- if (matrix->maxrows_ > 0) {
- if (!(matrix->rows_ = jas_malloc(matrix->maxrows_ *
- sizeof(jas_seqent_t *)))) {
- jas_matrix_destroy(matrix);
- return 0;
- }
- }
-
- if (matrix->datasize_ > 0) {
- if (!(matrix->data_ = jas_malloc(matrix->datasize_ *
- sizeof(jas_seqent_t)))) {
- jas_matrix_destroy(matrix);
- return 0;
- }
- }
-
- for (i = 0; i < numrows; ++i) {
- matrix->rows_[i] = &matrix->data_[i * matrix->numcols_];
- }
-
- for (i = 0; i < matrix->datasize_; ++i) {
- matrix->data_[i] = 0;
- }
-
- matrix->xstart_ = 0;
- matrix->ystart_ = 0;
- matrix->xend_ = matrix->numcols_;
- matrix->yend_ = matrix->numrows_;
-
- return matrix;
-}
-
-void jas_matrix_destroy(jas_matrix_t *matrix)
-{
- if (matrix->data_) {
- assert(!(matrix->flags_ & JAS_MATRIX_REF));
- jas_free(matrix->data_);
- matrix->data_ = 0;
- }
- if (matrix->rows_) {
- jas_free(matrix->rows_);
- matrix->rows_ = 0;
- }
- jas_free(matrix);
-}
-
-jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x)
-{
- jas_matrix_t *y;
- int i;
- int j;
- y = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x),
- jas_seq2d_yend(x));
- assert(y);
- for (i = 0; i < x->numrows_; ++i) {
- for (j = 0; j < x->numcols_; ++j) {
- *jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
- }
- }
- return y;
-}
-
-jas_matrix_t *jas_matrix_copy(jas_matrix_t *x)
-{
- jas_matrix_t *y;
- int i;
- int j;
- y = jas_matrix_create(x->numrows_, x->numcols_);
- for (i = 0; i < x->numrows_; ++i) {
- for (j = 0; j < x->numcols_; ++j) {
- *jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j);
- }
- }
- return y;
-}
-
-/******************************************************************************\
-* Bind operations.
-\******************************************************************************/
-
-void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart, int ystart,
- int xend, int yend)
-{
- jas_matrix_bindsub(s, s1, ystart - s1->ystart_, xstart - s1->xstart_,
- yend - s1->ystart_ - 1, xend - s1->xstart_ - 1);
-}
-
-void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0,
- int r1, int c1)
-{
- int i;
-
- if (mat0->data_) {
- if (!(mat0->flags_ & JAS_MATRIX_REF)) {
- jas_free(mat0->data_);
- }
- mat0->data_ = 0;
- mat0->datasize_ = 0;
- }
- if (mat0->rows_) {
- jas_free(mat0->rows_);
- mat0->rows_ = 0;
- }
- mat0->flags_ |= JAS_MATRIX_REF;
- mat0->numrows_ = r1 - r0 + 1;
- mat0->numcols_ = c1 - c0 + 1;
- mat0->maxrows_ = mat0->numrows_;
- mat0->rows_ = jas_malloc(mat0->maxrows_ * sizeof(jas_seqent_t *));
- for (i = 0; i < mat0->numrows_; ++i) {
- mat0->rows_[i] = mat1->rows_[r0 + i] + c0;
- }
-
- mat0->xstart_ = mat1->xstart_ + c0;
- mat0->ystart_ = mat1->ystart_ + r0;
- mat0->xend_ = mat0->xstart_ + mat0->numcols_;
- mat0->yend_ = mat0->ystart_ + mat0->numrows_;
-}
-
-/******************************************************************************\
-* Arithmetic operations.
-\******************************************************************************/
-
-int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1)
-{
- int i;
- int j;
-
- if (mat0->numrows_ != mat1->numrows_ || mat0->numcols_ !=
- mat1->numcols_) {
- return 1;
- }
- for (i = 0; i < mat0->numrows_; i++) {
- for (j = 0; j < mat0->numcols_; j++) {
- if (jas_matrix_get(mat0, i, j) != jas_matrix_get(mat1, i, j)) {
- return 1;
- }
- }
- }
- return 0;
-}
-
-void jas_matrix_divpow2(jas_matrix_t *matrix, int n)
-{
- int i;
- int j;
- jas_seqent_t *rowstart;
- int rowstep;
- jas_seqent_t *data;
-
- rowstep = jas_matrix_rowstep(matrix);
- for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
- rowstart += rowstep) {
- for (j = matrix->numcols_, data = rowstart; j > 0; --j,
- ++data) {
- *data = (*data >= 0) ? ((*data) >> n) :
- (-((-(*data)) >> n));
- }
- }
-}
-
-void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval)
-{
- int i;
- int j;
- jas_seqent_t v;
- jas_seqent_t *rowstart;
- jas_seqent_t *data;
- int rowstep;
-
- rowstep = jas_matrix_rowstep(matrix);
- for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
- rowstart += rowstep) {
- data = rowstart;
- for (j = matrix->numcols_, data = rowstart; j > 0; --j,
- ++data) {
- v = *data;
- if (v < minval) {
- *data = minval;
- } else if (v > maxval) {
- *data = maxval;
- }
- }
- }
-}
-
-void jas_matrix_asr(jas_matrix_t *matrix, int n)
-{
- int i;
- int j;
- jas_seqent_t *rowstart;
- int rowstep;
- jas_seqent_t *data;
-
- assert(n >= 0);
- rowstep = jas_matrix_rowstep(matrix);
- for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
- rowstart += rowstep) {
- for (j = matrix->numcols_, data = rowstart; j > 0; --j,
- ++data) {
- *data >>= n;
- }
- }
-}
-
-void jas_matrix_asl(jas_matrix_t *matrix, int n)
-{
- int i;
- int j;
- jas_seqent_t *rowstart;
- int rowstep;
- jas_seqent_t *data;
-
- rowstep = jas_matrix_rowstep(matrix);
- for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
- rowstart += rowstep) {
- for (j = matrix->numcols_, data = rowstart; j > 0; --j,
- ++data) {
- *data <<= n;
- }
- }
-}
-
-/******************************************************************************\
-* Code.
-\******************************************************************************/
-
-int jas_matrix_resize(jas_matrix_t *matrix, int numrows, int numcols)
-{
- int size;
- int i;
-
- size = numrows * numcols;
- if (size > matrix->datasize_ || numrows > matrix->maxrows_) {
- return -1;
- }
-
- matrix->numrows_ = numrows;
- matrix->numcols_ = numcols;
-
- for (i = 0; i < numrows; ++i) {
- matrix->rows_[i] = &matrix->data_[numcols * i];
- }
-
- return 0;
-}
-
-void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val)
-{
- int i;
- int j;
- jas_seqent_t *rowstart;
- int rowstep;
- jas_seqent_t *data;
-
- rowstep = jas_matrix_rowstep(matrix);
- for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,
- rowstart += rowstep) {
- for (j = matrix->numcols_, data = rowstart; j > 0; --j,
- ++data) {
- *data = val;
- }
- }
-}
-
-jas_matrix_t *jas_seq2d_input(FILE *in)
-{
- jas_matrix_t *matrix;
- int i;
- int j;
- long x;
- int numrows;
- int numcols;
- int xoff;
- int yoff;
-
- if (fscanf(in, "%d %d", &xoff, &yoff) != 2)
- return 0;
- if (fscanf(in, "%d %d", &numcols, &numrows) != 2)
- return 0;
- if (!(matrix = jas_seq2d_create(xoff, yoff, xoff + numcols, yoff + numrows)))
- return 0;
-
- if (jas_matrix_numrows(matrix) != numrows || jas_matrix_numcols(matrix) != numcols) {
- abort();
- }
-
- /* Get matrix data. */
- for (i = 0; i < jas_matrix_numrows(matrix); i++) {
- for (j = 0; j < jas_matrix_numcols(matrix); j++) {
- if (fscanf(in, "%ld", &x) != 1) {
- jas_matrix_destroy(matrix);
- return 0;
- }
- jas_matrix_set(matrix, i, j, JAS_CAST(jas_seqent_t, x));
- }
- }
-
- return matrix;
-}
-
-int jas_seq2d_output(jas_matrix_t *matrix, FILE *out)
-{
-#define MAXLINELEN 80
- int i;
- int j;
- jas_seqent_t x;
- char buf[MAXLINELEN + 1];
- char sbuf[MAXLINELEN + 1];
- int n;
-
- fprintf(out, "%d %d\n", jas_seq2d_xstart(matrix),
- jas_seq2d_ystart(matrix));
- fprintf(out, "%d %d\n", jas_matrix_numcols(matrix),
- jas_matrix_numrows(matrix));
-
- buf[0] = '\0';
- for (i = 0; i < jas_matrix_numrows(matrix); ++i) {
- for (j = 0; j < jas_matrix_numcols(matrix); ++j) {
- x = jas_matrix_get(matrix, i, j);
- sprintf(sbuf, "%s%4ld", (strlen(buf) > 0) ? " " : "",
- JAS_CAST(long, x));
- n = strlen(buf);
- if (n + strlen(sbuf) > MAXLINELEN) {
- fputs(buf, out);
- fputs("\n", out);
- buf[0] = '\0';
- }
- strcat(buf, sbuf);
- if (j == jas_matrix_numcols(matrix) - 1) {
- fputs(buf, out);
- fputs("\n", out);
- buf[0] = '\0';
- }
- }
- }
- fputs(buf, out);
-
- return 0;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_stream.c b/src/3rdparty/jasper/src/libjasper/base/jas_stream.c
deleted file mode 100644
index 87eecc7..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_stream.c
+++ /dev/null
@@ -1,1150 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * I/O Stream Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <assert.h>
-#if defined(HAVE_FCNTL_H)
-#include <fcntl.h>
-#endif
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <ctype.h>
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-#if defined(WIN32) || defined(HAVE_IO_H)
-#include <io.h>
-#endif
-
-#include "jasper/jas_types.h"
-#include "jasper/jas_stream.h"
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_math.h"
-
-/******************************************************************************\
-* Local function prototypes.
-\******************************************************************************/
-
-static int jas_strtoopenmode(const char *s);
-static void jas_stream_destroy(jas_stream_t *stream);
-static jas_stream_t *jas_stream_create(void);
-static void jas_stream_initbuf(jas_stream_t *stream, int bufmode, char *buf,
- int bufsize);
-
-static int mem_read(jas_stream_obj_t *obj, char *buf, int cnt);
-static int mem_write(jas_stream_obj_t *obj, char *buf, int cnt);
-static long mem_seek(jas_stream_obj_t *obj, long offset, int origin);
-static int mem_close(jas_stream_obj_t *obj);
-
-static int sfile_read(jas_stream_obj_t *obj, char *buf, int cnt);
-static int sfile_write(jas_stream_obj_t *obj, char *buf, int cnt);
-static long sfile_seek(jas_stream_obj_t *obj, long offset, int origin);
-static int sfile_close(jas_stream_obj_t *obj);
-
-static int file_read(jas_stream_obj_t *obj, char *buf, int cnt);
-static int file_write(jas_stream_obj_t *obj, char *buf, int cnt);
-static long file_seek(jas_stream_obj_t *obj, long offset, int origin);
-static int file_close(jas_stream_obj_t *obj);
-
-/******************************************************************************\
-* Local data.
-\******************************************************************************/
-
-static jas_stream_ops_t jas_stream_fileops = {
- file_read,
- file_write,
- file_seek,
- file_close
-};
-
-static jas_stream_ops_t jas_stream_sfileops = {
- sfile_read,
- sfile_write,
- sfile_seek,
- sfile_close
-};
-
-static jas_stream_ops_t jas_stream_memops = {
- mem_read,
- mem_write,
- mem_seek,
- mem_close
-};
-
-/******************************************************************************\
-* Code for opening and closing streams.
-\******************************************************************************/
-
-static jas_stream_t *jas_stream_create()
-{
- jas_stream_t *stream;
-
- if (!(stream = jas_malloc(sizeof(jas_stream_t)))) {
- return 0;
- }
- stream->openmode_ = 0;
- stream->bufmode_ = 0;
- stream->flags_ = 0;
- stream->bufbase_ = 0;
- stream->bufstart_ = 0;
- stream->bufsize_ = 0;
- stream->ptr_ = 0;
- stream->cnt_ = 0;
- stream->ops_ = 0;
- stream->obj_ = 0;
- stream->rwcnt_ = 0;
- stream->rwlimit_ = -1;
-
- return stream;
-}
-
-jas_stream_t *jas_stream_memopen(char *buf, int bufsize)
-{
- jas_stream_t *stream;
- jas_stream_memobj_t *obj;
-
- if (!(stream = jas_stream_create())) {
- return 0;
- }
-
- /* A stream associated with a memory buffer is always opened
- for both reading and writing in binary mode. */
- stream->openmode_ = JAS_STREAM_READ | JAS_STREAM_WRITE | JAS_STREAM_BINARY;
-
- /* Since the stream data is already resident in memory, buffering
- is not necessary. */
- /* But... It still may be faster to use buffering anyways. */
- jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
-
- /* Select the operations for a memory stream. */
- stream->ops_ = &jas_stream_memops;
-
- /* Allocate memory for the underlying memory stream object. */
- if (!(obj = jas_malloc(sizeof(jas_stream_memobj_t)))) {
- jas_stream_destroy(stream);
- return 0;
- }
- stream->obj_ = (void *) obj;
-
- /* Initialize a few important members of the memory stream object. */
- obj->myalloc_ = 0;
- obj->buf_ = 0;
-
- /* If the buffer size specified is nonpositive, then the buffer
- is allocated internally and automatically grown as needed. */
- if (bufsize <= 0) {
- obj->bufsize_ = 1024;
- obj->growable_ = 1;
- } else {
- obj->bufsize_ = bufsize;
- obj->growable_ = 0;
- }
- if (buf) {
- obj->buf_ = (unsigned char *) buf;
- } else {
- obj->buf_ = jas_malloc(obj->bufsize_ * sizeof(char));
- obj->myalloc_ = 1;
- }
- if (!obj->buf_) {
- jas_stream_close(stream);
- return 0;
- }
-
- if (bufsize > 0 && buf) {
- /* If a buffer was supplied by the caller and its length is positive,
- make the associated buffer data appear in the stream initially. */
- obj->len_ = bufsize;
- } else {
- /* The stream is initially empty. */
- obj->len_ = 0;
- }
- obj->pos_ = 0;
-
- return stream;
-}
-
-jas_stream_t *jas_stream_fopen(const char *filename, const char *mode)
-{
- jas_stream_t *stream;
- jas_stream_fileobj_t *obj;
- int openflags;
-
- /* Allocate a stream object. */
- if (!(stream = jas_stream_create())) {
- return 0;
- }
-
- /* Parse the mode string. */
- stream->openmode_ = jas_strtoopenmode(mode);
-
- /* Determine the correct flags to use for opening the file. */
- if ((stream->openmode_ & JAS_STREAM_READ) &&
- (stream->openmode_ & JAS_STREAM_WRITE)) {
- openflags = O_RDWR;
- } else if (stream->openmode_ & JAS_STREAM_READ) {
- openflags = O_RDONLY;
- } else if (stream->openmode_ & JAS_STREAM_WRITE) {
- openflags = O_WRONLY;
- } else {
- openflags = 0;
- }
- if (stream->openmode_ & JAS_STREAM_APPEND) {
- openflags |= O_APPEND;
- }
- if (stream->openmode_ & JAS_STREAM_BINARY) {
- openflags |= O_BINARY;
- }
- if (stream->openmode_ & JAS_STREAM_CREATE) {
- openflags |= O_CREAT | O_TRUNC;
- }
-
- /* Allocate space for the underlying file stream object. */
- if (!(obj = jas_malloc(sizeof(jas_stream_fileobj_t)))) {
- jas_stream_destroy(stream);
- return 0;
- }
- obj->fd = -1;
- obj->flags = 0;
- obj->pathname[0] = '\0';
- stream->obj_ = (void *) obj;
-
- /* Select the operations for a file stream object. */
- stream->ops_ = &jas_stream_fileops;
-
- /* Open the underlying file. */
- if ((obj->fd = open(filename, openflags, JAS_STREAM_PERMS)) < 0) {
- jas_stream_destroy(stream);
- return 0;
- }
-
- /* By default, use full buffering for this type of stream. */
- jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
-
- return stream;
-}
-
-jas_stream_t *jas_stream_freopen(const char *path, const char *mode, FILE *fp)
-{
- jas_stream_t *stream;
- int openflags;
-
- /* Eliminate compiler warning about unused variable. */
- path = 0;
-
- /* Allocate a stream object. */
- if (!(stream = jas_stream_create())) {
- return 0;
- }
-
- /* Parse the mode string. */
- stream->openmode_ = jas_strtoopenmode(mode);
-
- /* Determine the correct flags to use for opening the file. */
- if ((stream->openmode_ & JAS_STREAM_READ) &&
- (stream->openmode_ & JAS_STREAM_WRITE)) {
- openflags = O_RDWR;
- } else if (stream->openmode_ & JAS_STREAM_READ) {
- openflags = O_RDONLY;
- } else if (stream->openmode_ & JAS_STREAM_WRITE) {
- openflags = O_WRONLY;
- } else {
- openflags = 0;
- }
- if (stream->openmode_ & JAS_STREAM_APPEND) {
- openflags |= O_APPEND;
- }
- if (stream->openmode_ & JAS_STREAM_BINARY) {
- openflags |= O_BINARY;
- }
- if (stream->openmode_ & JAS_STREAM_CREATE) {
- openflags |= O_CREAT | O_TRUNC;
- }
-
- stream->obj_ = JAS_CAST(void *, fp);
-
- /* Select the operations for a file stream object. */
- stream->ops_ = &jas_stream_sfileops;
-
- /* By default, use full buffering for this type of stream. */
- jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
-
- return stream;
-}
-
-jas_stream_t *jas_stream_tmpfile()
-{
- jas_stream_t *stream;
- jas_stream_fileobj_t *obj;
-
- if (!(stream = jas_stream_create())) {
- return 0;
- }
-
- /* A temporary file stream is always opened for both reading and
- writing in binary mode. */
- stream->openmode_ = JAS_STREAM_READ | JAS_STREAM_WRITE | JAS_STREAM_BINARY;
-
- /* Allocate memory for the underlying temporary file object. */
- if (!(obj = jas_malloc(sizeof(jas_stream_fileobj_t)))) {
- jas_stream_destroy(stream);
- return 0;
- }
- obj->fd = -1;
- obj->flags = 0;
- obj->pathname[0] = '\0';
- stream->obj_ = obj;
-
- /* Choose a file name. */
- tmpnam(obj->pathname);
-
- /* Open the underlying file. */
- if ((obj->fd = open(obj->pathname, O_CREAT | O_EXCL | O_RDWR | O_TRUNC | O_BINARY,
- JAS_STREAM_PERMS)) < 0) {
- jas_stream_destroy(stream);
- return 0;
- }
-
- /* Unlink the file so that it will disappear if the program
- terminates abnormally. */
- /* Under UNIX, one can unlink an open file and continue to do I/O
- on it. Not all operating systems support this functionality, however.
- For example, under Microsoft Windows the unlink operation will fail,
- since the file is open. */
- if (unlink(obj->pathname)) {
- /* We will try unlinking the file again after it is closed. */
- obj->flags |= JAS_STREAM_FILEOBJ_DELONCLOSE;
- }
-
- /* Use full buffering. */
- jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
-
- stream->ops_ = &jas_stream_fileops;
-
- return stream;
-}
-
-jas_stream_t *jas_stream_fdopen(int fd, const char *mode)
-{
- jas_stream_t *stream;
- jas_stream_fileobj_t *obj;
-
- /* Allocate a stream object. */
- if (!(stream = jas_stream_create())) {
- return 0;
- }
-
- /* Parse the mode string. */
- stream->openmode_ = jas_strtoopenmode(mode);
-
-#if defined(WIN32)
- /* Argh!!! Someone ought to banish text mode (i.e., O_TEXT) to the
- greatest depths of purgatory! */
- /* Ensure that the file descriptor is in binary mode, if the caller
- has specified the binary mode flag. Arguably, the caller ought to
- take care of this, but text mode is a ugly wart anyways, so we save
- the caller some grief by handling this within the stream library. */
- /* This ugliness is mainly for the benefit of those who run the
- JasPer software under Windows from shells that insist on opening
- files in text mode. For example, in the Cygwin environment,
- shells often open files in text mode when I/O redirection is
- used. Grr... */
- if (stream->openmode_ & JAS_STREAM_BINARY) {
- setmode(fd, O_BINARY);
- }
-#endif
-
- /* Allocate space for the underlying file stream object. */
- if (!(obj = jas_malloc(sizeof(jas_stream_fileobj_t)))) {
- jas_stream_destroy(stream);
- return 0;
- }
- obj->fd = fd;
- obj->flags = 0;
- obj->pathname[0] = '\0';
- stream->obj_ = (void *) obj;
-
- /* Do not close the underlying file descriptor when the stream is
- closed. */
- obj->flags |= JAS_STREAM_FILEOBJ_NOCLOSE;
-
- /* By default, use full buffering for this type of stream. */
- jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
-
- /* Select the operations for a file stream object. */
- stream->ops_ = &jas_stream_fileops;
-
- return stream;
-}
-
-static void jas_stream_destroy(jas_stream_t *stream)
-{
- /* If the memory for the buffer was allocated with malloc, free
- this memory. */
- if ((stream->bufmode_ & JAS_STREAM_FREEBUF) && stream->bufbase_) {
- jas_free(stream->bufbase_);
- stream->bufbase_ = 0;
- }
- jas_free(stream);
-}
-
-int jas_stream_close(jas_stream_t *stream)
-{
- /* Flush buffer if necessary. */
- jas_stream_flush(stream);
-
- /* Close the underlying stream object. */
- (*stream->ops_->close_)(stream->obj_);
-
- jas_stream_destroy(stream);
-
- return 0;
-}
-
-/******************************************************************************\
-* Code for reading and writing streams.
-\******************************************************************************/
-
-int jas_stream_getc_func(jas_stream_t *stream)
-{
- assert(stream->ptr_ - stream->bufbase_ <= stream->bufsize_ +
- JAS_STREAM_MAXPUTBACK);
- return jas_stream_getc_macro(stream);
-}
-
-int jas_stream_putc_func(jas_stream_t *stream, int c)
-{
- assert(stream->ptr_ - stream->bufstart_ <= stream->bufsize_);
- return jas_stream_putc_macro(stream, c);
-}
-
-int jas_stream_ungetc(jas_stream_t *stream, int c)
-{
- if (!stream->ptr_ || stream->ptr_ == stream->bufbase_) {
- return -1;
- }
-
- /* Reset the EOF indicator (since we now have at least one character
- to read). */
- stream->flags_ &= ~JAS_STREAM_EOF;
-
- --stream->rwcnt_;
- --stream->ptr_;
- ++stream->cnt_;
- *stream->ptr_ = c;
- return 0;
-}
-
-int jas_stream_read(jas_stream_t *stream, void *buf, int cnt)
-{
- int n;
- int c;
- char *bufptr;
-
- bufptr = buf;
-
- n = 0;
- while (n < cnt) {
- if ((c = jas_stream_getc(stream)) == EOF) {
- return n;
- }
- *bufptr++ = c;
- ++n;
- }
-
- return n;
-}
-
-int jas_stream_write(jas_stream_t *stream, const void *buf, int cnt)
-{
- int n;
- const char *bufptr;
-
- bufptr = buf;
-
- n = 0;
- while (n < cnt) {
- if (jas_stream_putc(stream, *bufptr) == EOF) {
- return n;
- }
- ++bufptr;
- ++n;
- }
-
- return n;
-}
-
-/* Note: This function uses a fixed size buffer. Therefore, it cannot
- handle invocations that will produce more output than can be held
- by the buffer. */
-int jas_stream_printf(jas_stream_t *stream, const char *fmt, ...)
-{
- va_list ap;
- char buf[4096];
- int ret;
-
- va_start(ap, fmt);
- ret = vsprintf(buf, fmt, ap);
- jas_stream_puts(stream, buf);
- va_end(ap);
- return ret;
-}
-
-int jas_stream_puts(jas_stream_t *stream, const char *s)
-{
- while (*s != '\0') {
- if (jas_stream_putc_macro(stream, *s) == EOF) {
- return -1;
- }
- ++s;
- }
- return 0;
-}
-
-char *jas_stream_gets(jas_stream_t *stream, char *buf, int bufsize)
-{
- int c;
- char *bufptr;
- assert(bufsize > 0);
-
- bufptr = buf;
- while (bufsize > 1) {
- if ((c = jas_stream_getc(stream)) == EOF) {
- break;
- }
- *bufptr++ = c;
- --bufsize;
- if (c == '\n') {
- break;
- }
- }
- *bufptr = '\0';
- return buf;
-}
-
-int jas_stream_gobble(jas_stream_t *stream, int n)
-{
- int m;
- m = n;
- for (m = n; m > 0; --m) {
- if (jas_stream_getc(stream) == EOF) {
- return n - m;
- }
- }
- return n;
-}
-
-int jas_stream_pad(jas_stream_t *stream, int n, int c)
-{
- int m;
- m = n;
- for (m = n; m > 0; --m) {
- if (jas_stream_putc(stream, c) == EOF)
- return n - m;
- }
- return n;
-}
-
-/******************************************************************************\
-* Code for getting and setting the stream position.
-\******************************************************************************/
-
-int jas_stream_isseekable(jas_stream_t *stream)
-{
- if (stream->ops_ == &jas_stream_memops) {
- return 1;
- } else if (stream->ops_ == &jas_stream_fileops) {
- if ((*stream->ops_->seek_)(stream->obj_, 0, SEEK_CUR) < 0) {
- return 0;
- }
- return 1;
- } else {
- return 0;
- }
-}
-
-int jas_stream_rewind(jas_stream_t *stream)
-{
- return jas_stream_seek(stream, 0, SEEK_SET);
-}
-
-long jas_stream_seek(jas_stream_t *stream, long offset, int origin)
-{
- long newpos;
-
- /* The buffer cannot be in use for both reading and writing. */
- assert(!((stream->bufmode_ & JAS_STREAM_RDBUF) && (stream->bufmode_ &
- JAS_STREAM_WRBUF)));
-
- /* Reset the EOF indicator (since we may not be at the EOF anymore). */
- stream->flags_ &= ~JAS_STREAM_EOF;
-
- if (stream->bufmode_ & JAS_STREAM_RDBUF) {
- if (origin == SEEK_CUR) {
- offset -= stream->cnt_;
- }
- } else if (stream->bufmode_ & JAS_STREAM_WRBUF) {
- if (jas_stream_flush(stream)) {
- return -1;
- }
- }
- stream->cnt_ = 0;
- stream->ptr_ = stream->bufstart_;
- stream->bufmode_ &= ~(JAS_STREAM_RDBUF | JAS_STREAM_WRBUF);
-
- if ((newpos = (*stream->ops_->seek_)(stream->obj_, offset, origin))
- < 0) {
- return -1;
- }
-
- return newpos;
-}
-
-long jas_stream_tell(jas_stream_t *stream)
-{
- int adjust;
- int offset;
-
- if (stream->bufmode_ & JAS_STREAM_RDBUF) {
- adjust = -stream->cnt_;
- } else if (stream->bufmode_ & JAS_STREAM_WRBUF) {
- adjust = stream->ptr_ - stream->bufstart_;
- } else {
- adjust = 0;
- }
-
- if ((offset = (*stream->ops_->seek_)(stream->obj_, 0, SEEK_CUR)) < 0) {
- return -1;
- }
-
- return offset + adjust;
-}
-
-/******************************************************************************\
-* Buffer initialization code.
-\******************************************************************************/
-
-static void jas_stream_initbuf(jas_stream_t *stream, int bufmode, char *buf,
- int bufsize)
-{
- /* If this function is being called, the buffer should not have been
- initialized yet. */
- assert(!stream->bufbase_);
-
- if (bufmode != JAS_STREAM_UNBUF) {
- /* The full- or line-buffered mode is being employed. */
- if (!buf) {
- /* The caller has not specified a buffer to employ, so allocate
- one. */
- if ((stream->bufbase_ = jas_malloc(JAS_STREAM_BUFSIZE +
- JAS_STREAM_MAXPUTBACK))) {
- stream->bufmode_ |= JAS_STREAM_FREEBUF;
- stream->bufsize_ = JAS_STREAM_BUFSIZE;
- } else {
- /* The buffer allocation has failed. Resort to unbuffered
- operation. */
- stream->bufbase_ = stream->tinybuf_;
- stream->bufsize_ = 1;
- }
- } else {
- /* The caller has specified a buffer to employ. */
- /* The buffer must be large enough to accommodate maximum
- putback. */
- assert(bufsize > JAS_STREAM_MAXPUTBACK);
- stream->bufbase_ = JAS_CAST(uchar *, buf);
- stream->bufsize_ = bufsize - JAS_STREAM_MAXPUTBACK;
- }
- } else {
- /* The unbuffered mode is being employed. */
- /* A buffer should not have been supplied by the caller. */
- assert(!buf);
- /* Use a trivial one-character buffer. */
- stream->bufbase_ = stream->tinybuf_;
- stream->bufsize_ = 1;
- }
- stream->bufstart_ = &stream->bufbase_[JAS_STREAM_MAXPUTBACK];
- stream->ptr_ = stream->bufstart_;
- stream->cnt_ = 0;
- stream->bufmode_ |= bufmode & JAS_STREAM_BUFMODEMASK;
-}
-
-/******************************************************************************\
-* Buffer filling and flushing code.
-\******************************************************************************/
-
-int jas_stream_flush(jas_stream_t *stream)
-{
- if (stream->bufmode_ & JAS_STREAM_RDBUF) {
- return 0;
- }
- return jas_stream_flushbuf(stream, EOF);
-}
-
-int jas_stream_fillbuf(jas_stream_t *stream, int getflag)
-{
- int c;
-
- /* The stream must not be in an error or EOF state. */
- if ((stream->flags_ & (JAS_STREAM_ERRMASK)) != 0) {
- return EOF;
- }
-
- /* The stream must be open for reading. */
- if ((stream->openmode_ & JAS_STREAM_READ) == 0) {
- return EOF;
- }
-
- /* Make a half-hearted attempt to confirm that the buffer is not
- currently being used for writing. This check is not intended
- to be foolproof! */
- assert((stream->bufmode_ & JAS_STREAM_WRBUF) == 0);
-
- assert(stream->ptr_ - stream->bufstart_ <= stream->bufsize_);
-
- /* Mark the buffer as being used for reading. */
- stream->bufmode_ |= JAS_STREAM_RDBUF;
-
- /* Read new data into the buffer. */
- stream->ptr_ = stream->bufstart_;
- if ((stream->cnt_ = (*stream->ops_->read_)(stream->obj_,
- (char *) stream->bufstart_, stream->bufsize_)) <= 0) {
- if (stream->cnt_ < 0) {
- stream->flags_ |= JAS_STREAM_ERR;
- } else {
- stream->flags_ |= JAS_STREAM_EOF;
- }
- stream->cnt_ = 0;
- return EOF;
- }
-
- assert(stream->cnt_ > 0);
- /* Get or peek at the first character in the buffer. */
- c = (getflag) ? jas_stream_getc2(stream) : (*stream->ptr_);
-
- return c;
-}
-
-int jas_stream_flushbuf(jas_stream_t *stream, int c)
-{
- int len;
- int n;
-
- /* The stream should not be in an error or EOF state. */
- if ((stream->flags_ & (JAS_STREAM_ERRMASK)) != 0) {
- return EOF;
- }
-
- /* The stream must be open for writing. */
- if ((stream->openmode_ & (JAS_STREAM_WRITE | JAS_STREAM_APPEND)) == 0) {
- return EOF;
- }
-
- /* The buffer should not currently be in use for reading. */
- assert(!(stream->bufmode_ & JAS_STREAM_RDBUF));
-
- /* Note: Do not use the quantity stream->cnt to determine the number
- of characters in the buffer! Depending on how this function was
- called, the stream->cnt value may be "off-by-one". */
- len = stream->ptr_ - stream->bufstart_;
- if (len > 0) {
- n = (*stream->ops_->write_)(stream->obj_, (char *)
- stream->bufstart_, len);
- if (n != len) {
- stream->flags_ |= JAS_STREAM_ERR;
- return EOF;
- }
- }
- stream->cnt_ = stream->bufsize_;
- stream->ptr_ = stream->bufstart_;
-
- stream->bufmode_ |= JAS_STREAM_WRBUF;
-
- if (c != EOF) {
- assert(stream->cnt_ > 0);
- return jas_stream_putc2(stream, c);
- }
-
- return 0;
-}
-
-/******************************************************************************\
-* Miscellaneous code.
-\******************************************************************************/
-
-static int jas_strtoopenmode(const char *s)
-{
- int openmode = 0;
- while (*s != '\0') {
- switch (*s) {
- case 'r':
- openmode |= JAS_STREAM_READ;
- break;
- case 'w':
- openmode |= JAS_STREAM_WRITE | JAS_STREAM_CREATE;
- break;
- case 'b':
- openmode |= JAS_STREAM_BINARY;
- break;
- case 'a':
- openmode |= JAS_STREAM_APPEND;
- break;
- case '+':
- openmode |= JAS_STREAM_READ | JAS_STREAM_WRITE;
- break;
- default:
- break;
- }
- ++s;
- }
- return openmode;
-}
-
-int jas_stream_copy(jas_stream_t *out, jas_stream_t *in, int n)
-{
- int all;
- int c;
- int m;
-
- all = (n < 0) ? 1 : 0;
-
- m = n;
- while (all || m > 0) {
- if ((c = jas_stream_getc_macro(in)) == EOF) {
- /* The next character of input could not be read. */
- /* Return with an error if an I/O error occured
- (not including EOF) or if an explicit copy count
- was specified. */
- return (!all || jas_stream_error(in)) ? (-1) : 0;
- }
- if (jas_stream_putc_macro(out, c) == EOF) {
- return -1;
- }
- --m;
- }
- return 0;
-}
-
-long jas_stream_setrwcount(jas_stream_t *stream, long rwcnt)
-{
- int old;
-
- old = stream->rwcnt_;
- stream->rwcnt_ = rwcnt;
- return old;
-}
-
-int jas_stream_display(jas_stream_t *stream, FILE *fp, int n)
-{
- unsigned char buf[16];
- int i;
- int j;
- int m;
- int c;
- int display;
- int cnt;
-
- cnt = n - (n % 16);
- display = 1;
-
- for (i = 0; i < n; i += 16) {
- if (n > 16 && i > 0) {
- display = (i >= cnt) ? 1 : 0;
- }
- if (display) {
- fprintf(fp, "%08x:", i);
- }
- m = JAS_MIN(n - i, 16);
- for (j = 0; j < m; ++j) {
- if ((c = jas_stream_getc(stream)) == EOF) {
- abort();
- return -1;
- }
- buf[j] = c;
- }
- if (display) {
- for (j = 0; j < m; ++j) {
- fprintf(fp, " %02x", buf[j]);
- }
- fputc(' ', fp);
- for (; j < 16; ++j) {
- fprintf(fp, " ");
- }
- for (j = 0; j < m; ++j) {
- if (isprint(buf[j])) {
- fputc(buf[j], fp);
- } else {
- fputc(' ', fp);
- }
- }
- fprintf(fp, "\n");
- }
-
-
- }
- return 0;
-}
-
-long jas_stream_length(jas_stream_t *stream)
-{
- long oldpos;
- long pos;
- if ((oldpos = jas_stream_tell(stream)) < 0) {
- return -1;
- }
- if (jas_stream_seek(stream, 0, SEEK_END) < 0) {
- return -1;
- }
- if ((pos = jas_stream_tell(stream)) < 0) {
- return -1;
- }
- if (jas_stream_seek(stream, oldpos, SEEK_SET) < 0) {
- return -1;
- }
- return pos;
-}
-
-/******************************************************************************\
-* Memory stream object.
-\******************************************************************************/
-
-static int mem_read(jas_stream_obj_t *obj, char *buf, int cnt)
-{
- int n;
- jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
- n = m->len_ - m->pos_;
- cnt = JAS_MIN(n, cnt);
- memcpy(buf, &m->buf_[m->pos_], cnt);
- m->pos_ += cnt;
- return cnt;
-}
-
-static int mem_resize(jas_stream_memobj_t *m, int bufsize)
-{
- unsigned char *buf;
-
- assert(m->buf_);
- if (!(buf = jas_realloc(m->buf_, bufsize * sizeof(unsigned char)))) {
- return -1;
- }
- m->buf_ = buf;
- m->bufsize_ = bufsize;
- return 0;
-}
-
-static int mem_write(jas_stream_obj_t *obj, char *buf, int cnt)
-{
- int n;
- int ret;
- jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
- long newbufsize;
- long newpos;
-
- newpos = m->pos_ + cnt;
- if (newpos > m->bufsize_ && m->growable_) {
- newbufsize = m->bufsize_;
- while (newbufsize < newpos) {
- newbufsize <<= 1;
- assert(newbufsize >= 0);
- }
- if (mem_resize(m, newbufsize)) {
- return -1;
- }
- }
- if (m->pos_ > m->len_) {
- /* The current position is beyond the end of the file, so
- pad the file to the current position with zeros. */
- n = JAS_MIN(m->pos_, m->bufsize_) - m->len_;
- if (n > 0) {
- memset(&m->buf_[m->len_], 0, n);
- m->len_ += n;
- }
- if (m->pos_ != m->len_) {
- /* The buffer is not big enough. */
- return 0;
- }
- }
- n = m->bufsize_ - m->pos_;
- ret = JAS_MIN(n, cnt);
- if (ret > 0) {
- memcpy(&m->buf_[m->pos_], buf, ret);
- m->pos_ += ret;
- }
- if (m->pos_ > m->len_) {
- m->len_ = m->pos_;
- }
-assert(ret == cnt);
- return ret;
-}
-
-static long mem_seek(jas_stream_obj_t *obj, long offset, int origin)
-{
- jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
- long newpos;
-
- switch (origin) {
- case SEEK_SET:
- newpos = offset;
- break;
- case SEEK_END:
- newpos = m->len_ - offset;
- break;
- case SEEK_CUR:
- newpos = m->pos_ + offset;
- break;
- default:
- abort();
- break;
- }
- if (newpos < 0) {
- return -1;
- }
- m->pos_ = newpos;
-
- return m->pos_;
-}
-
-static int mem_close(jas_stream_obj_t *obj)
-{
- jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
- if (m->myalloc_ && m->buf_) {
- jas_free(m->buf_);
- m->buf_ = 0;
- }
- jas_free(obj);
- return 0;
-}
-
-/******************************************************************************\
-* File stream object.
-\******************************************************************************/
-
-static int file_read(jas_stream_obj_t *obj, char *buf, int cnt)
-{
- jas_stream_fileobj_t *fileobj = JAS_CAST(jas_stream_fileobj_t *, obj);
- return read(fileobj->fd, buf, cnt);
-}
-
-static int file_write(jas_stream_obj_t *obj, char *buf, int cnt)
-{
- jas_stream_fileobj_t *fileobj = JAS_CAST(jas_stream_fileobj_t *, obj);
- return write(fileobj->fd, buf, cnt);
-}
-
-static long file_seek(jas_stream_obj_t *obj, long offset, int origin)
-{
- jas_stream_fileobj_t *fileobj = JAS_CAST(jas_stream_fileobj_t *, obj);
- return lseek(fileobj->fd, offset, origin);
-}
-
-static int file_close(jas_stream_obj_t *obj)
-{
- jas_stream_fileobj_t *fileobj = JAS_CAST(jas_stream_fileobj_t *, obj);
- int ret;
- ret = close(fileobj->fd);
- if (fileobj->flags & JAS_STREAM_FILEOBJ_DELONCLOSE) {
- unlink(fileobj->pathname);
- }
- jas_free(fileobj);
- return ret;
-}
-
-/******************************************************************************\
-* Stdio file stream object.
-\******************************************************************************/
-
-static int sfile_read(jas_stream_obj_t *obj, char *buf, int cnt)
-{
- FILE *fp;
- fp = JAS_CAST(FILE *, obj);
- return fread(buf, 1, cnt, fp);
-}
-
-static int sfile_write(jas_stream_obj_t *obj, char *buf, int cnt)
-{
- FILE *fp;
- fp = JAS_CAST(FILE *, obj);
- return fwrite(buf, 1, cnt, fp);
-}
-
-static long sfile_seek(jas_stream_obj_t *obj, long offset, int origin)
-{
- FILE *fp;
- fp = JAS_CAST(FILE *, obj);
- return fseek(fp, offset, origin);
-}
-
-static int sfile_close(jas_stream_obj_t *obj)
-{
- FILE *fp;
- fp = JAS_CAST(FILE *, obj);
- return fclose(fp);
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_string.c b/src/3rdparty/jasper/src/libjasper/base/jas_string.c
deleted file mode 100644
index 3534a5e..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_string.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * String Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes
-\******************************************************************************/
-
-#include <string.h>
-
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_string.h"
-
-/******************************************************************************\
-* Miscellaneous Functions
-\******************************************************************************/
-
-/* This function is equivalent to the popular but non-standard (and
- not-always-available) strdup function. */
-
-char *jas_strdup(const char *s)
-{
- int n;
- char *p;
- n = strlen(s) + 1;
- if (!(p = jas_malloc(n * sizeof(char)))) {
- return 0;
- }
- strcpy(p, s);
- return p;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_tmr.c b/src/3rdparty/jasper/src/libjasper/base/jas_tmr.c
deleted file mode 100644
index 029dace..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_tmr.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2004 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Timing Routines
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include "jasper/jas_tmr.h"
-
-/******************************************************************************\
-* Code.
-\******************************************************************************/
-
-#if defined(HAVE_GETTIMEOFDAY)
-
-void jas_tmr_start(jas_tmr_t *tmr)
-{
- if (gettimeofday(&tmr->start, 0)) {
- abort();
- }
-}
-
-void jas_tmr_stop(jas_tmr_t *tmr)
-{
- if (gettimeofday(&tmr->stop, 0)) {
- abort();
- }
-}
-
-double jas_tmr_get(jas_tmr_t *tmr)
-{
- double t0;
- double t1;
- t0 = ((double) tmr->start.tv_sec) + ((double) tmr->start.tv_usec) / 1e6;
- t1 = ((double) tmr->stop.tv_sec) + ((double) tmr->stop.tv_usec) / 1e6;
- return t1 - t0;
-}
-
-#elif defined(HAVE_GETRUSAGE)
-
-void jas_tmr_start(jas_tmr_t *tmr)
-{
- if (getrusage(RUSAGE_SELF, &tmr->start) < 0) {
- abort();
- }
-}
-
-void jas_tmr_stop(jas_tmr_t *tmr)
-{
- if (getrusage(RUSAGE_SELF, &tmr->stop) < 0) {
- abort();
- }
-}
-
-double jas_tmr_get(jas_tmr_t *tmr)
-{
- double t;
- t = ((tmr->stop.ru_utime.tv_sec * 1e6 + tmr->stop.ru_utime.tv_usec) -
- (tmr->start.ru_utime.tv_sec * 1e6 + tmr->start.ru_utime.tv_usec)) / 1e6;
- t += ((tmr->stop.ru_stime.tv_sec * 1e6 + tmr->stop.ru_stime.tv_usec) -
- (tmr->start.ru_stime.tv_sec * 1e6 + tmr->start.ru_stime.tv_usec)) / 1e6;
- return t;
-}
-
-#else
-
-void jas_tmr_start(jas_tmr_t *tmr)
-{
-}
-
-void jas_tmr_stop(jas_tmr_t *tmr)
-{
-}
-
-double jas_tmr_get(jas_tmr_t *tmr)
-{
- return 0.0;
-}
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_tvp.c b/src/3rdparty/jasper/src/libjasper/base/jas_tvp.c
deleted file mode 100644
index 1ca2438..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_tvp.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Tag-Value Parser Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <assert.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_string.h"
-#include "jasper/jas_tvp.h"
-
-/******************************************************************************\
-* Macros.
-\******************************************************************************/
-
-/* Is the specified character valid for a tag name? */
-#define JAS_TVP_ISTAG(x) \
- (isalpha(x) || (x) == '_' || isdigit(x))
-
-/******************************************************************************\
-* Code for creating and destroying a tag-value parser.
-\******************************************************************************/
-
-jas_tvparser_t *jas_tvparser_create(const char *s)
-{
- jas_tvparser_t *tvp;
- if (!(tvp = jas_malloc(sizeof(jas_tvparser_t)))) {
- return 0;
- }
- if (!(tvp->buf = jas_strdup(s))) {
- jas_tvparser_destroy(tvp);
- return 0;
- }
- tvp->pos = tvp->buf;
- tvp->tag = 0;
- tvp->val = 0;
- return tvp;
-}
-
-void jas_tvparser_destroy(jas_tvparser_t *tvp)
-{
- if (tvp->buf) {
- jas_free(tvp->buf);
- }
- jas_free(tvp);
-}
-
-/******************************************************************************\
-* Main parsing code.
-\******************************************************************************/
-
-/* Get the next tag-value pair. */
-int jas_tvparser_next(jas_tvparser_t *tvp)
-{
- char *p;
- char *tag;
- char *val;
-
- /* Skip any leading whitespace. */
- p = tvp->pos;
- while (*p != '\0' && isspace(*p)) {
- ++p;
- }
-
- /* Has the end of the input data been reached? */
- if (*p == '\0') {
- /* No more tags are present. */
- tvp->pos = p;
- return 1;
- }
-
- /* Does the tag name begin with a valid character? */
- if (!JAS_TVP_ISTAG(*p)) {
- return -1;
- }
-
- /* Remember where the tag name begins. */
- tag = p;
-
- /* Find the end of the tag name. */
- while (*p != '\0' && JAS_TVP_ISTAG(*p)) {
- ++p;
- }
-
- /* Has the end of the input data been reached? */
- if (*p == '\0') {
- /* The value field is empty. */
- tvp->tag = tag;
- tvp->val = "";
- tvp->pos = p;
- return 0;
- }
-
- /* Is a value field not present? */
- if (*p != '=') {
- if (*p != '\0' && !isspace(*p)) {
- return -1;
- }
- *p++ = '\0';
- tvp->tag = tag;
- tvp->val = "";
- tvp->pos = p;
- return 0;
- }
-
- *p++ = '\0';
-
- val = p;
- while (*p != '\0' && !isspace(*p)) {
- ++p;
- }
-
- if (*p != '\0') {
- *p++ = '\0';
- }
-
- tvp->pos = p;
- tvp->tag = tag;
- tvp->val = val;
-
- return 0;
-}
-
-/******************************************************************************\
-* Code for querying the current tag/value.
-\******************************************************************************/
-
-/* Get the current tag. */
-char *jas_tvparser_gettag(jas_tvparser_t *tvp)
-{
- return tvp->tag;
-}
-
-/* Get the current value. */
-char *jas_tvparser_getval(jas_tvparser_t *tvp)
-{
- return tvp->val;
-}
-
-/******************************************************************************\
-* Miscellaneous code.
-\******************************************************************************/
-
-/* Lookup a tag by name. */
-jas_taginfo_t *jas_taginfos_lookup(jas_taginfo_t *taginfos, const char *name)
-{
- jas_taginfo_t *taginfo;
- taginfo = taginfos;
- while (taginfo->id >= 0) {
- if (!strcmp(taginfo->name, name)) {
- return taginfo;
- }
- ++taginfo;
- }
- return 0;
-}
-
-/* This function is simply for convenience. */
-/* One can avoid testing for the special case of a null pointer, by
- using this function. This function never returns a null pointer. */
-jas_taginfo_t *jas_taginfo_nonull(jas_taginfo_t *taginfo)
-{
- static jas_taginfo_t invalidtaginfo = {
- -1, 0
- };
-
- return taginfo ? taginfo : &invalidtaginfo;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/base/jas_version.c b/src/3rdparty/jasper/src/libjasper/base/jas_version.c
deleted file mode 100644
index a87f966..0000000
--- a/src/3rdparty/jasper/src/libjasper/base/jas_version.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#include "jasper/jas_version.h"
-
-const char *jas_getversion()
-{
- return JAS_VERSION;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/bmp/bmp_cod.c b/src/3rdparty/jasper/src/libjasper/bmp/bmp_cod.c
deleted file mode 100644
index b281e2a..0000000
--- a/src/3rdparty/jasper/src/libjasper/bmp/bmp_cod.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Windows Bitmap File Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <assert.h>
-
-#include "jasper/jas_types.h"
-#include "jasper/jas_image.h"
-#include "jasper/jas_malloc.h"
-
-#include "bmp_cod.h"
-
-/******************************************************************************\
-* Constructors and destructors.
-\******************************************************************************/
-
-bmp_info_t *bmp_info_create()
-{
- bmp_info_t *info;
- if (!(info = jas_malloc(sizeof(bmp_info_t)))) {
- return 0;
- }
- info->palents = 0;
- return info;
-}
-
-void bmp_info_destroy(bmp_info_t *info)
-{
- if (info->palents) {
- jas_free(info->palents);
- }
- jas_free(info);
-}
-
-/******************************************************************************\
-* Miscellaneous functions.
-\******************************************************************************/
-
-int bmp_isgrayscalepal(bmp_palent_t *palents, int numpalents)
-{
- bmp_palent_t *palent;
- int i;
-
- for (i = numpalents, palent = palents; i > 0; --i, ++palent) {
- if (palent->red != palent->grn || palent->red != palent->blu) {
- return 0;
- }
- }
- return 1;
-}
-
-int bmp_numcmpts(bmp_info_t *info)
-{
- int numcmpts;
-
- if (info->depth == 24) {
- numcmpts = 3;
- } else if (info->depth == 8) {
- numcmpts = bmp_isgrayscalepal(info->palents, info->numcolors) ?
- 1 : 3;
- } else {
- numcmpts = 0;
- abort();
- }
- return numcmpts;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/bmp/bmp_cod.h b/src/3rdparty/jasper/src/libjasper/bmp/bmp_cod.h
deleted file mode 100644
index 674aa6e..0000000
--- a/src/3rdparty/jasper/src/libjasper/bmp/bmp_cod.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Windows Bitmap File Library
- *
- * $Id$
- */
-
-#ifndef BMP_COD_H
-#define BMP_COD_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include "jasper/jas_types.h"
-
-/******************************************************************************\
-* Constants and macros.
-\******************************************************************************/
-
-#define BMP_MAGIC 0x4d42
-/* The signature for a BMP file. */
-
-#define BMP_HDRLEN 14
-/* The nominal header length. */
-
-#define BMP_INFOLEN 40
-/* The nominal info length. */
-
-#define BMP_PALLEN(info) ((info)->numcolors * 4)
-/* The length of the palette. */
-
-#define BMP_HASPAL(info) ((info)->numcolors > 0)
-/* Is this a palettized image? */
-
-/* Encoding types. */
-#define BMP_ENC_RGB 0 /* No special encoding. */
-#define BMP_ENC_RLE8 1 /* Run length encoding. */
-#define BMP_ENC_RLE4 2 /* Run length encoding. */
-
-/******************************************************************************\
-* Types.
-\******************************************************************************/
-
-/* BMP header. */
-typedef struct {
-
- int_fast16_t magic;
- /* The signature (a.k.a. the magic number). */
-
- int_fast32_t siz;
- /* The size of the file in 32-bit words. */
-
- int_fast16_t reserved1;
- /* Ask Bill Gates what this is all about. */
-
- int_fast16_t reserved2;
- /* Ditto. */
-
- int_fast32_t off;
- /* The offset of the bitmap data from the bitmap file header in bytes. */
-
-} bmp_hdr_t;
-
-/* Palette entry. */
-typedef struct {
-
- int_fast16_t red;
- /* The red component. */
-
- int_fast16_t grn;
- /* The green component. */
-
- int_fast16_t blu;
- /* The blue component. */
-
- int_fast16_t res;
- /* Reserved. */
-
-} bmp_palent_t;
-
-/* BMP info. */
-typedef struct {
-
- int_fast32_t len;
- /* The length of the bitmap information header in bytes. */
-
- int_fast32_t width;
- /* The width of the bitmap in pixels. */
-
- int_fast32_t height;
- /* The height of the bitmap in pixels. */
-
- int_fast8_t topdown;
- /* The bitmap data is specified in top-down order. */
-
- int_fast16_t numplanes;
- /* The number of planes. This must be set to a value of one. */
-
- int_fast16_t depth;
- /* The number of bits per pixel. */
-
- int_fast32_t enctype;
- /* The type of compression used. */
-
- int_fast32_t siz;
- /* The size of the image in bytes. */
-
- int_fast32_t hres;
- /* The horizontal resolution in pixels/metre. */
-
- int_fast32_t vres;
- /* The vertical resolution in pixels/metre. */
-
- int_fast32_t numcolors;
- /* The number of color indices used by the bitmap. */
-
- int_fast32_t mincolors;
- /* The number of color indices important for displaying the bitmap. */
-
- bmp_palent_t *palents;
- /* The colors should be listed in order of importance. */
-
-} bmp_info_t;
-
-/******************************************************************************\
-* Functions and macros.
-\******************************************************************************/
-
-#define bmp_issupported(hdr, info) \
- ((hdr)->magic == BMP_MAGIC && !(hdr)->reserved1 && \
- !(hdr)->reserved2 && (info)->numplanes == 1 && \
- ((info)->depth == 8 || (info)->depth == 24) && \
- (info)->enctype == BMP_ENC_RGB)
-/* Is this type of BMP file supported? */
-
-#define bmp_haspal(info) \
- ((info)->depth == 8)
-/* Is there a palette? */
-
-int bmp_numcmpts(bmp_info_t *info);
-/* Get the number of components. */
-
-bmp_info_t *bmp_info_create(void);
-/* Create BMP information. */
-
-void bmp_info_destroy(bmp_info_t *info);
-/* Destroy BMP information. */
-
-int bmp_isgrayscalepal(bmp_palent_t *palents, int numpalents);
-/* Does the specified palette correspond to a grayscale image? */
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/bmp/bmp_dec.c b/src/3rdparty/jasper/src/libjasper/bmp/bmp_dec.c
deleted file mode 100644
index b1ff065..0000000
--- a/src/3rdparty/jasper/src/libjasper/bmp/bmp_dec.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Windows Bitmap File Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <assert.h>
-
-#include "jasper/jas_debug.h"
-#include "jasper/jas_types.h"
-#include "jasper/jas_stream.h"
-#include "jasper/jas_image.h"
-#include "jasper/jas_malloc.h"
-
-#include "bmp_cod.h"
-
-/******************************************************************************\
-* Local prototypes.
-\******************************************************************************/
-
-static int bmp_gethdr(jas_stream_t *in, bmp_hdr_t *hdr);
-static bmp_info_t *bmp_getinfo(jas_stream_t *in);
-static int bmp_getdata(jas_stream_t *in, bmp_info_t *info, jas_image_t *image);
-static int bmp_getint16(jas_stream_t *in, int_fast16_t *val);
-static int bmp_getint32(jas_stream_t *in, int_fast32_t *val);
-static int bmp_gobble(jas_stream_t *in, long n);
-
-/******************************************************************************\
-* Interface functions.
-\******************************************************************************/
-
-jas_image_t *bmp_decode(jas_stream_t *in, char *optstr)
-{
- jas_image_t *image;
- bmp_hdr_t hdr;
- bmp_info_t *info;
- uint_fast16_t cmptno;
- jas_image_cmptparm_t cmptparms[3];
- jas_image_cmptparm_t *cmptparm;
- uint_fast16_t numcmpts;
- long n;
-
- if (optstr) {
- jas_eprintf("warning: ignoring BMP decoder options\n");
- }
-
- jas_eprintf(
- "THE BMP FORMAT IS NOT FULLY SUPPORTED!\n"
- "THAT IS, THE JASPER SOFTWARE CANNOT DECODE ALL TYPES OF BMP DATA.\n"
- "IF YOU HAVE ANY PROBLEMS, PLEASE TRY CONVERTING YOUR IMAGE DATA\n"
- "TO THE PNM FORMAT, AND USING THIS FORMAT INSTEAD.\n"
- );
-
- /* Read the bitmap header. */
- if (bmp_gethdr(in, &hdr)) {
- jas_eprintf("cannot get header\n");
- return 0;
- }
-
- /* Read the bitmap information. */
- if (!(info = bmp_getinfo(in))) {
- jas_eprintf("cannot get info\n");
- return 0;
- }
-
- /* Ensure that we support this type of BMP file. */
- if (!bmp_issupported(&hdr, info)) {
- jas_eprintf("error: unsupported BMP encoding\n");
- bmp_info_destroy(info);
- return 0;
- }
-
- /* Skip over any useless data between the end of the palette
- and start of the bitmap data. */
- if ((n = hdr.off - (BMP_HDRLEN + BMP_INFOLEN + BMP_PALLEN(info))) < 0) {
- jas_eprintf("error: possibly bad bitmap offset?\n");
- return 0;
- }
- if (n > 0) {
- jas_eprintf("skipping unknown data in BMP file\n");
- if (bmp_gobble(in, n)) {
- bmp_info_destroy(info);
- return 0;
- }
- }
-
- /* Get the number of components. */
- numcmpts = bmp_numcmpts(info);
-
- for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,
- ++cmptparm) {
- cmptparm->tlx = 0;
- cmptparm->tly = 0;
- cmptparm->hstep = 1;
- cmptparm->vstep = 1;
- cmptparm->width = info->width;
- cmptparm->height = info->height;
- cmptparm->prec = 8;
- cmptparm->sgnd = false;
- }
-
- /* Create image object. */
- if (!(image = jas_image_create(numcmpts, cmptparms,
- JAS_CLRSPC_UNKNOWN))) {
- bmp_info_destroy(info);
- return 0;
- }
-
- if (numcmpts == 3) {
- jas_image_setclrspc(image, JAS_CLRSPC_SRGB);
- jas_image_setcmpttype(image, 0,
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R));
- jas_image_setcmpttype(image, 1,
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G));
- jas_image_setcmpttype(image, 2,
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B));
- } else {
- jas_image_setclrspc(image, JAS_CLRSPC_SGRAY);
- jas_image_setcmpttype(image, 0,
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y));
- }
-
- /* Read the bitmap data. */
- if (bmp_getdata(in, info, image)) {
- bmp_info_destroy(info);
- jas_image_destroy(image);
- return 0;
- }
-
- bmp_info_destroy(info);
-
- return image;
-}
-
-int bmp_validate(jas_stream_t *in)
-{
- int n;
- int i;
- uchar buf[2];
-
- assert(JAS_STREAM_MAXPUTBACK >= 2);
-
- /* Read the first two characters that constitute the signature. */
- if ((n = jas_stream_read(in, (char *) buf, 2)) < 0) {
- return -1;
- }
- /* Put the characters read back onto the stream. */
- for (i = n - 1; i >= 0; --i) {
- if (jas_stream_ungetc(in, buf[i]) == EOF) {
- return -1;
- }
- }
- /* Did we read enough characters? */
- if (n < 2) {
- return -1;
- }
- /* Is the signature correct for the BMP format? */
- if (buf[0] == (BMP_MAGIC & 0xff) && buf[1] == (BMP_MAGIC >> 8)) {
- return 0;
- }
- return -1;
-}
-
-/******************************************************************************\
-* Code for aggregate types.
-\******************************************************************************/
-
-static int bmp_gethdr(jas_stream_t *in, bmp_hdr_t *hdr)
-{
- if (bmp_getint16(in, &hdr->magic) || hdr->magic != BMP_MAGIC ||
- bmp_getint32(in, &hdr->siz) || bmp_getint16(in, &hdr->reserved1) ||
- bmp_getint16(in, &hdr->reserved2) || bmp_getint32(in, &hdr->off)) {
- return -1;
- }
- return 0;
-}
-
-static bmp_info_t *bmp_getinfo(jas_stream_t *in)
-{
- bmp_info_t *info;
- int i;
- bmp_palent_t *palent;
-
- if (!(info = bmp_info_create())) {
- return 0;
- }
-
- if (bmp_getint32(in, &info->len) || info->len != 40 ||
- bmp_getint32(in, &info->width) || bmp_getint32(in, &info->height) ||
- bmp_getint16(in, &info->numplanes) ||
- bmp_getint16(in, &info->depth) || bmp_getint32(in, &info->enctype) ||
- bmp_getint32(in, &info->siz) ||
- bmp_getint32(in, &info->hres) || bmp_getint32(in, &info->vres) ||
- bmp_getint32(in, &info->numcolors) ||
- bmp_getint32(in, &info->mincolors)) {
- bmp_info_destroy(info);
- return 0;
- }
-
- if (info->height < 0) {
- info->topdown = 1;
- info->height = -info->height;
- } else {
- info->topdown = 0;
- }
-
- if (info->width <= 0 || info->height <= 0 || info->numplanes <= 0 ||
- info->depth <= 0 || info->numcolors < 0 || info->mincolors < 0) {
- bmp_info_destroy(info);
- return 0;
- }
-
- if (info->enctype != BMP_ENC_RGB) {
- jas_eprintf("unsupported BMP encoding\n");
- bmp_info_destroy(info);
- return 0;
- }
-
- if (info->numcolors > 0) {
- if (!(info->palents = jas_malloc(info->numcolors *
- sizeof(bmp_palent_t)))) {
- bmp_info_destroy(info);
- return 0;
- }
- } else {
- info->palents = 0;
- }
-
- for (i = 0; i < info->numcolors; ++i) {
- palent = &info->palents[i];
- if ((palent->blu = jas_stream_getc(in)) == EOF ||
- (palent->grn = jas_stream_getc(in)) == EOF ||
- (palent->red = jas_stream_getc(in)) == EOF ||
- (palent->res = jas_stream_getc(in)) == EOF) {
- bmp_info_destroy(info);
- return 0;
- }
- }
-
- return info;
-}
-
-static int bmp_getdata(jas_stream_t *in, bmp_info_t *info, jas_image_t *image)
-{
- int i;
- int j;
- int y;
- jas_matrix_t *cmpts[3];
- int numpad;
- int red;
- int grn;
- int blu;
- int ret;
- int numcmpts;
- int cmptno;
- int ind;
- bmp_palent_t *palent;
- int mxind;
- int haspal;
-
- assert(info->depth == 8 || info->depth == 24);
- assert(info->enctype == BMP_ENC_RGB);
-
- numcmpts = bmp_numcmpts(info);
- haspal = bmp_haspal(info);
-
- ret = 0;
- for (i = 0; i < numcmpts; ++i) {
- cmpts[i] = 0;
- }
-
- /* Create temporary matrices to hold component data. */
- for (i = 0; i < numcmpts; ++i) {
- if (!(cmpts[i] = jas_matrix_create(1, info->width))) {
- ret = -1;
- goto bmp_getdata_done;
- }
- }
-
- /* Calculate number of padding bytes per row of image data. */
- numpad = (numcmpts * info->width) % 4;
- if (numpad) {
- numpad = 4 - numpad;
- }
-
- mxind = (1 << info->depth) - 1;
- for (i = 0; i < info->height; ++i) {
- for (j = 0; j < info->width; ++j) {
- if (haspal) {
- if ((ind = jas_stream_getc(in)) == EOF) {
- ret = -1;
- goto bmp_getdata_done;
- }
- if (ind > mxind) {
- ret = -1;
- goto bmp_getdata_done;
- }
- if (ind < info->numcolors) {
- palent = &info->palents[ind];
- red = palent->red;
- grn = palent->grn;
- blu = palent->blu;
- } else {
- red = ind;
- grn = ind;
- blu = ind;
- }
- } else {
- if ((blu = jas_stream_getc(in)) == EOF ||
- (grn = jas_stream_getc(in)) == EOF ||
- (red = jas_stream_getc(in)) == EOF) {
- ret = -1;
- goto bmp_getdata_done;
- }
- }
- if (numcmpts == 3) {
- jas_matrix_setv(cmpts[0], j, red);
- jas_matrix_setv(cmpts[1], j, grn);
- jas_matrix_setv(cmpts[2], j, blu);
- } else {
- jas_matrix_setv(cmpts[0], j, red);
- }
- }
- for (j = numpad; j > 0; --j) {
- if (jas_stream_getc(in) == EOF) {
- ret = -1;
- goto bmp_getdata_done;
- }
- }
- for (cmptno = 0; cmptno < numcmpts; ++cmptno) {
- y = info->topdown ? i : (info->height - 1 - i);
- if (jas_image_writecmpt(image, cmptno, 0, y, info->width,
- 1, cmpts[cmptno])) {
- ret = -1;
- goto bmp_getdata_done;
- }
- }
- }
-
-bmp_getdata_done:
- /* Destroy the temporary matrices. */
- for (i = 0; i < numcmpts; ++i) {
- if (cmpts[i]) {
- jas_matrix_destroy(cmpts[i]);
- }
- }
-
- return ret;
-}
-
-/******************************************************************************\
-* Code for primitive types.
-\******************************************************************************/
-
-static int bmp_getint16(jas_stream_t *in, int_fast16_t *val)
-{
- int lo;
- int hi;
- if ((lo = jas_stream_getc(in)) == EOF || (hi = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- if (val) {
- *val = (hi << 8) | lo;
- }
- return 0;
-}
-
-static int bmp_getint32(jas_stream_t *in, int_fast32_t *val)
-{
- int n;
- uint_fast32_t v;
- int c;
- for (n = 4, v = 0;;) {
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- v |= (c << 24);
- if (--n <= 0) {
- break;
- }
- v >>= 8;
- }
- if (val) {
- *val = v;
- }
- return 0;
-}
-
-static int bmp_gobble(jas_stream_t *in, long n)
-{
- while (--n >= 0) {
- if (jas_stream_getc(in) == EOF) {
- return -1;
- }
- }
- return 0;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/bmp/bmp_enc.c b/src/3rdparty/jasper/src/libjasper/bmp/bmp_enc.c
deleted file mode 100644
index e156b01..0000000
--- a/src/3rdparty/jasper/src/libjasper/bmp/bmp_enc.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Windows Bitmap File Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <assert.h>
-
-#include "jasper/jas_types.h"
-#include "jasper/jas_stream.h"
-#include "jasper/jas_image.h"
-#include "jasper/jas_debug.h"
-
-#include "bmp_enc.h"
-#include "bmp_cod.h"
-
-/******************************************************************************\
-* Local prototypes.
-\******************************************************************************/
-
-static int bmp_puthdr(jas_stream_t *out, bmp_hdr_t *hdr);
-static int bmp_putinfo(jas_stream_t *out, bmp_info_t *info);
-static int bmp_putdata(jas_stream_t *out, bmp_info_t *info, jas_image_t *image, int *cmpts);
-static int bmp_putint16(jas_stream_t *in, int_fast16_t val);
-static int bmp_putint32(jas_stream_t *out, int_fast32_t val);
-
-/******************************************************************************\
-* Interface functions.
-\******************************************************************************/
-
-int bmp_encode(jas_image_t *image, jas_stream_t *out, char *optstr)
-{
- jas_image_coord_t width;
- jas_image_coord_t height;
- int depth;
- int cmptno;
- bmp_hdr_t hdr;
- bmp_info_t *info;
- int_fast32_t datalen;
- int numpad;
- bmp_enc_t encbuf;
- bmp_enc_t *enc = &encbuf;
- jas_clrspc_t clrspc;
-
- if (optstr) {
- jas_eprintf("warning: ignoring BMP encoder options\n");
- }
-
- clrspc = jas_image_clrspc(image);
- switch (jas_clrspc_fam(clrspc)) {
- case JAS_CLRSPC_FAM_RGB:
- if (clrspc != JAS_CLRSPC_SRGB)
- jas_eprintf("warning: inaccurate color\n");
- break;
- case JAS_CLRSPC_FAM_GRAY:
- if (clrspc != JAS_CLRSPC_SGRAY)
- jas_eprintf("warning: inaccurate color\n");
- break;
- default:
- jas_eprintf("error: BMP format does not support color space\n");
- return -1;
- break;
- }
-
- switch (jas_clrspc_fam(clrspc)) {
- case JAS_CLRSPC_FAM_RGB:
- enc->numcmpts = 3;
- if ((enc->cmpts[0] = jas_image_getcmptbytype(image,
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R))) < 0 ||
- (enc->cmpts[1] = jas_image_getcmptbytype(image,
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G))) < 0 ||
- (enc->cmpts[2] = jas_image_getcmptbytype(image,
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B))) < 0) {
- jas_eprintf("error: missing color component\n");
- return -1;
- }
- break;
- case JAS_CLRSPC_FAM_GRAY:
- enc->numcmpts = 1;
- if ((enc->cmpts[0] = jas_image_getcmptbytype(image,
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y))) < 0) {
- jas_eprintf("error: missing color component\n");
- return -1;
- }
- break;
- default:
- abort();
- break;
- }
-
- width = jas_image_cmptwidth(image, enc->cmpts[0]);
- height = jas_image_cmptheight(image, enc->cmpts[0]);
- depth = jas_image_cmptprec(image, enc->cmpts[0]);
-
- /* Check to ensure that the image to be saved can actually be represented
- using the BMP format. */
- for (cmptno = 0; cmptno < enc->numcmpts; ++cmptno) {
- if (jas_image_cmptwidth(image, enc->cmpts[cmptno]) != width ||
- jas_image_cmptheight(image, enc->cmpts[cmptno]) != height ||
- jas_image_cmptprec(image, enc->cmpts[cmptno]) != depth ||
- jas_image_cmptsgnd(image, enc->cmpts[cmptno]) != false ||
- jas_image_cmpttlx(image, enc->cmpts[cmptno]) != 0 ||
- jas_image_cmpttly(image, enc->cmpts[cmptno]) != 0) {
- jas_eprintf("The BMP format cannot be used to represent an image with this geometry.\n");
- return -1;
- }
- }
-
- /* The component depths must be 1, 4, or 8. */
- if (depth != 1 && depth != 4 && depth != 8) {
- return -1;
- }
-
- numpad = (width * enc->numcmpts) % 4;
- if (numpad) {
- numpad = 4 - numpad;
- }
- datalen = (enc->numcmpts * width + numpad) * height;
-
- if (!(info = bmp_info_create())) {
- return -1;
- }
- info->len = BMP_INFOLEN;
- info->width = width;
- info->height = height;
- info->numplanes = 1;
- info->depth = enc->numcmpts * depth;
- info->enctype = BMP_ENC_RGB;
- info->siz = datalen;
- info->hres = 0;
- info->vres = 0;
- info->numcolors = (enc->numcmpts == 1) ? 256 : 0;
- info->mincolors = 0;
-
- hdr.magic = BMP_MAGIC;
- hdr.siz = BMP_HDRLEN + BMP_INFOLEN + 0 + datalen;
- hdr.off = BMP_HDRLEN + BMP_INFOLEN + BMP_PALLEN(info);
-
- /* Write the bitmap header. */
- if (bmp_puthdr(out, &hdr)) {
- return -1;
- }
-
- /* Write the bitmap information. */
- if (bmp_putinfo(out, info)) {
- return -1;
- }
-
- /* Write the bitmap data. */
- if (bmp_putdata(out, info, image, enc->cmpts)) {
- return -1;
- }
-
- bmp_info_destroy(info);
-
- return 0;
-}
-
-/******************************************************************************\
-* Code for aggregate types.
-\******************************************************************************/
-
-static int bmp_puthdr(jas_stream_t *out, bmp_hdr_t *hdr)
-{
- assert(hdr->magic == BMP_MAGIC);
- if (bmp_putint16(out, hdr->magic) || bmp_putint32(out, hdr->siz) ||
- bmp_putint32(out, 0) || bmp_putint32(out, hdr->off)) {
- return -1;
- }
- return 0;
-}
-
-static int bmp_putinfo(jas_stream_t *out, bmp_info_t *info)
-{
- int i;
-
- info->len = 40;
- if (bmp_putint32(out, info->len) ||
- bmp_putint32(out, info->width) ||
- bmp_putint32(out, info->height) ||
- bmp_putint16(out, info->numplanes) ||
- bmp_putint16(out, info->depth) ||
- bmp_putint32(out, info->enctype) ||
- bmp_putint32(out, info->siz) ||
- bmp_putint32(out, info->hres) ||
- bmp_putint32(out, info->vres) ||
- bmp_putint32(out, info->numcolors) ||
- bmp_putint32(out, info->mincolors)) {
- return -1;
- }
-
- for (i = 0; i < info->numcolors; ++i)
- {
- if (jas_stream_putc(out, i) == EOF ||
- jas_stream_putc(out, i) == EOF ||
- jas_stream_putc(out, i) == EOF ||
- jas_stream_putc(out, 0) == EOF)
- {
- return -1;
- }
- }
-
- return 0;
-}
-
-static int bmp_putdata(jas_stream_t *out, bmp_info_t *info, jas_image_t *image,
- int *cmpts)
-{
- int i;
- int j;
- jas_matrix_t *bufs[3];
- int numpad;
- unsigned char red;
- unsigned char grn;
- unsigned char blu;
- int ret;
- int numcmpts;
- int v;
- int cmptno;
-
- numcmpts = (info->depth == 24) ? 3:1;
-
- /* We do not support palettized images. */
- if (BMP_HASPAL(info) && numcmpts == 3) {
- jas_eprintf("no palettized image support for BMP format\n");
- return -1;
- }
-
- ret = 0;
- for (i = 0; i < numcmpts; ++i) {
- bufs[i] = 0;
- }
-
- /* Create temporary matrices to hold component data. */
- for (i = 0; i < numcmpts; ++i) {
- if (!(bufs[i] = jas_matrix_create(1, info->width))) {
- ret = -1;
- goto bmp_putdata_done;
- }
- }
-
- /* Calculate number of padding bytes per row of image data. */
- numpad = (numcmpts * info->width) % 4;
- if (numpad) {
- numpad = 4 - numpad;
- }
-
- /* Put the image data. */
- for (i = info->height - 1; i >= 0; --i) {
- for (cmptno = 0; cmptno < numcmpts; ++cmptno) {
- if (jas_image_readcmpt(image, cmptno, 0, i, info->width,
- 1, bufs[cmpts[cmptno]])) {
- ret = -1;
- goto bmp_putdata_done;
- }
- }
- for (j = 0; j < info->width; ++j) {
- if (numcmpts == 3) {
- red = (jas_matrix_getv(bufs[0], j));
- grn = (jas_matrix_getv(bufs[1], j));
- blu = (jas_matrix_getv(bufs[2], j));
- if (jas_stream_putc(out, blu) == EOF ||
- jas_stream_putc(out, grn) == EOF ||
- jas_stream_putc(out, red) == EOF) {
- ret = -1;
- goto bmp_putdata_done;
- }
- } else if (numcmpts == 1) {
- v = (jas_matrix_getv(bufs[cmpts[0]], j));
- if (jas_stream_putc(out, v) == EOF) {
- ret = -1;
- goto bmp_putdata_done;
- }
- } else {
- abort();
- }
- }
- for (j = numpad; j > 0; --j) {
- if (jas_stream_putc(out, 0) == EOF) {
- ret = -1;
- goto bmp_putdata_done;
- }
- }
- }
-
-bmp_putdata_done:
- /* Destroy the temporary matrices. */
- for (i = 0; i < numcmpts; ++i) {
- if (bufs[i]) {
- jas_matrix_destroy(bufs[i]);
- }
- }
-
- return ret;
-}
-
-/******************************************************************************\
-* Code for primitive types.
-\******************************************************************************/
-
-static int bmp_putint16(jas_stream_t *in, int_fast16_t val)
-{
- if (jas_stream_putc(in, val & 0xff) == EOF || jas_stream_putc(in, (val >> 8) &
- 0xff) == EOF) {
- return -1;
- }
- return 0;
-}
-
-static int bmp_putint32(jas_stream_t *out, int_fast32_t val)
-{
- int n;
- int_fast32_t v;
-
- /* This code needs to be changed if we want to handle negative values. */
- assert(val >= 0);
- v = val;
- for (n = 4;;) {
- if (jas_stream_putc(out, v & 0xff) == EOF) {
- return -1;
- }
- if (--n <= 0) {
- break;
- }
- v >>= 8;
- }
- return 0;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/bmp/bmp_enc.h b/src/3rdparty/jasper/src/libjasper/bmp/bmp_enc.h
deleted file mode 100644
index 1fb50e8..0000000
--- a/src/3rdparty/jasper/src/libjasper/bmp/bmp_enc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#ifndef BMP_ENC_H
-#define BMP_ENC_H
-
-typedef struct {
-
- int numcmpts;
- int cmpts[4];
-
-} bmp_enc_t;
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/dummy.c b/src/3rdparty/jasper/src/libjasper/dummy.c
deleted file mode 100644
index 9344920..0000000
--- a/src/3rdparty/jasper/src/libjasper/dummy.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* This source file only exists to keep libtool happy. */
-
-char jas_dummy;
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_cm.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_cm.h
deleted file mode 100644
index 35cf9f0..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_cm.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (c) 2002-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Color Management
- *
- * $Id$
- */
-
-#ifndef JAS_CM_H
-#define JAS_CM_H
-
-#include <jasper/jas_config.h>
-#include <jasper/jas_icc.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef int jas_clrspc_t;
-
-/* transform operations */
-#define JAS_CMXFORM_OP_FWD 0
-#define JAS_CMXFORM_OP_REV 1
-#define JAS_CMXFORM_OP_PROOF 2
-#define JAS_CMXFORM_OP_GAMUT 3
-
-/* rendering intents */
-#define JAS_CMXFORM_INTENT_PER 0
-#define JAS_CMXFORM_INTENT_RELCLR 1
-#define JAS_CMXFORM_INTENT_ABSCLR 2
-#define JAS_CMXFORM_INTENT_SAT 3
-#define JAS_CMXFORM_NUMINTENTS 4
-
-#define JAS_CMXFORM_OPTM_SPEED 0
-#define JAS_CMXFORM_OPTM_SIZE 1
-#define JAS_CMXFORM_OPTM_ACC 2
-
-
-#define jas_clrspc_create(fam, mbr) (((fam) << 8) | (mbr))
-#define jas_clrspc_fam(clrspc) ((clrspc) >> 8)
-#define jas_clrspc_mbr(clrspc) ((clrspc) & 0xff)
-#define jas_clrspc_isgeneric(clrspc) (!jas_clrspc_mbr(clrspc))
-#define jas_clrspc_isunknown(clrspc) ((clrspc) & JAS_CLRSPC_UNKNOWNMASK)
-
-#define JAS_CLRSPC_UNKNOWNMASK 0x4000
-
-/* color space families */
-#define JAS_CLRSPC_FAM_UNKNOWN 0
-#define JAS_CLRSPC_FAM_XYZ 1
-#define JAS_CLRSPC_FAM_LAB 2
-#define JAS_CLRSPC_FAM_GRAY 3
-#define JAS_CLRSPC_FAM_RGB 4
-#define JAS_CLRSPC_FAM_YCBCR 5
-
-/* specific color spaces */
-#define JAS_CLRSPC_UNKNOWN JAS_CLRSPC_UNKNOWNMASK
-#define JAS_CLRSPC_CIEXYZ jas_clrspc_create(JAS_CLRSPC_FAM_XYZ, 1)
-#define JAS_CLRSPC_CIELAB jas_clrspc_create(JAS_CLRSPC_FAM_LAB, 1)
-#define JAS_CLRSPC_SGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 1)
-#define JAS_CLRSPC_SRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 1)
-#define JAS_CLRSPC_SYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 1)
-
-/* generic color spaces */
-#define JAS_CLRSPC_GENRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 0)
-#define JAS_CLRSPC_GENGRAY jas_clrspc_create(JAS_CLRSPC_FAM_GRAY, 0)
-#define JAS_CLRSPC_GENYCBCR jas_clrspc_create(JAS_CLRSPC_FAM_YCBCR, 0)
-
-#define JAS_CLRSPC_CHANIND_YCBCR_Y 0
-#define JAS_CLRSPC_CHANIND_YCBCR_CB 1
-#define JAS_CLRSPC_CHANIND_YCBCR_CR 2
-
-#define JAS_CLRSPC_CHANIND_RGB_R 0
-#define JAS_CLRSPC_CHANIND_RGB_G 1
-#define JAS_CLRSPC_CHANIND_RGB_B 2
-
-#define JAS_CLRSPC_CHANIND_GRAY_Y 0
-
-typedef double jas_cmreal_t;
-
-struct jas_cmpxform_s;
-
-typedef struct {
- long *buf;
- int prec;
- int sgnd;
- int width;
- int height;
-} jas_cmcmptfmt_t;
-
-typedef struct {
- int numcmpts;
- jas_cmcmptfmt_t *cmptfmts;
-} jas_cmpixmap_t;
-
-typedef struct {
- void (*destroy)(struct jas_cmpxform_s *pxform);
- int (*apply)(struct jas_cmpxform_s *pxform, jas_cmreal_t *in, jas_cmreal_t *out, int cnt);
- void (*dump)(struct jas_cmpxform_s *pxform);
-} jas_cmpxformops_t;
-
-typedef struct {
- jas_cmreal_t *data;
- int size;
-} jas_cmshapmatlut_t;
-
-typedef struct {
- int mono;
- int order;
- int useluts;
- int usemat;
- jas_cmshapmatlut_t luts[3];
- jas_cmreal_t mat[3][4];
-} jas_cmshapmat_t;
-
-typedef struct {
- int order;
-} jas_cmshaplut_t;
-
-typedef struct {
- int inclrspc;
- int outclrspc;
-} jas_cmclrspcconv_t;
-
-#define jas_align_t double
-
-typedef struct jas_cmpxform_s {
- int refcnt;
- jas_cmpxformops_t *ops;
- int numinchans;
- int numoutchans;
- union {
- jas_align_t dummy;
- jas_cmshapmat_t shapmat;
- jas_cmshaplut_t shaplut;
- jas_cmclrspcconv_t clrspcconv;
- } data;
-} jas_cmpxform_t;
-
-typedef struct {
- int numpxforms;
- int maxpxforms;
- jas_cmpxform_t **pxforms;
-} jas_cmpxformseq_t;
-
-typedef struct {
- int numinchans;
- int numoutchans;
- jas_cmpxformseq_t *pxformseq;
-} jas_cmxform_t;
-
-#define JAS_CMPROF_TYPE_DEV 1
-#define JAS_CMPROF_TYPE_CLRSPC 2
-
-#define JAS_CMPROF_NUMPXFORMSEQS 13
-
-typedef struct {
- int clrspc;
- int numchans;
- int refclrspc;
- int numrefchans;
- jas_iccprof_t *iccprof;
- jas_cmpxformseq_t *pxformseqs[JAS_CMPROF_NUMPXFORMSEQS];
-} jas_cmprof_t;
-
-/* Create a profile. */
-
-/* Destroy a profile. */
-void jas_cmprof_destroy(jas_cmprof_t *prof);
-
-#if 0
-typedef int_fast32_t jas_cmattrname_t;
-typedef int_fast32_t jas_cmattrval_t;
-typedef int_fast32_t jas_cmattrtype_t;
-/* Load a profile. */
-int jas_cmprof_load(jas_cmprof_t *prof, jas_stream_t *in, int fmt);
-/* Save a profile. */
-int jas_cmprof_save(jas_cmprof_t *prof, jas_stream_t *out, int fmt);
-/* Set an attribute of a profile. */
-int jas_cm_prof_setattr(jas_cm_prof_t *prof, jas_cm_attrname_t name, void *val);
-/* Get an attribute of a profile. */
-void *jas_cm_prof_getattr(jas_cm_prof_t *prof, jas_cm_attrname_t name);
-#endif
-
-jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof,
- jas_cmprof_t *proofprof, int op, int intent, int optimize);
-
-void jas_cmxform_destroy(jas_cmxform_t *xform);
-
-/* Apply a transform to data. */
-int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in,
- jas_cmpixmap_t *out);
-
-int jas_cxform_optimize(jas_cmxform_t *xform, int optimize);
-
-int jas_clrspc_numchans(int clrspc);
-jas_cmprof_t *jas_cmprof_createfromiccprof(jas_iccprof_t *iccprof);
-jas_cmprof_t *jas_cmprof_createfromclrspc(int clrspc);
-jas_iccprof_t *jas_iccprof_createfromcmprof(jas_cmprof_t *prof);
-
-#define jas_cmprof_clrspc(prof) ((prof)->clrspc)
-jas_cmprof_t *jas_cmprof_copy(jas_cmprof_t *prof);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_config.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_config.h
deleted file mode 100644
index d862a5c..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_config.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* src/libjasper/include/jasper/jas_config.h. Generated by configure. */
-/* src/libjasper/include/jasper/jas_config.h.in. Generated from configure.ac by autoheader. */
-
-
-/* Avoid problems due to multiple inclusion. */
-#ifndef JAS_CONFIG_H
-#define JAS_CONFIG_H
-
-/* This preprocessor symbol identifies the version of JasPer. */
-#define JAS_VERSION "1.900.1"
-/* If configure is being used, this symbol will be defined automatically
- at this point in the configuration header file. */
-
-/* The preprocessor symbol JAS_WIN_MSVC_BUILD should not be defined
- unless the JasPer software is being built under Microsoft Windows
- using Microsoft Visual C. */
-#if !defined(JAS_WIN_MSVC_BUILD)
-/* A configure-based build is being used. */
-
-
-
-/* Extra debugging support */
-/* #undef DEBUG */
-
-/* Debugging memory allocator */
-/* #undef DEBUG_MEMALLOC */
-
-/* Debugging overflow detection */
-/* #undef DEBUG_OVERFLOW */
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
-/* #undef HAVE_DOPRNT */
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define to 1 if you have the `getrusage' function. */
-#define HAVE_GETRUSAGE 1
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the <io.h> header file. */
-/* #undef HAVE_IO_H */
-
-/* Define to 1 if you have the `m' library (-lm). */
-#define HAVE_LIBM 1
-
-/* Define to 1 if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the <stdbool.h> header file. */
-#define HAVE_STDBOOL_H 1
-
-/* Define to 1 if you have the <stddef.h> header file. */
-#define HAVE_STDDEF_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#define HAVE_SYS_TIME_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Have variable length arrays */
-#define HAVE_VLA 1
-
-/* Define to 1 if you have the `vprintf' function. */
-#define HAVE_VPRINTF 1
-
-/* Define to 1 if you have the <windows.h> header file. */
-/* #undef HAVE_WINDOWS_H */
-
-/* JasPer configure */
-#define JAS_CONFIGURE 1
-
-/* JasPer version */
-#define JAS_VERSION "1.900.1"
-
-/* Name of package */
-#define PACKAGE "jasper"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "jasper"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "jasper 1.900.1"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "jasper"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.900.1"
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#define VERSION "1.900.1"
-
-/* Define to 1 if the X Window System is missing or not being used. */
-/* #undef X_DISPLAY_MISSING */
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define to `long long' if <sys/types.h> does not define. */
-#define longlong long long
-
-/* Define to `unsigned' if <sys/types.h> does not define. */
-/* #undef size_t */
-
-/* Define to `int' if <sys/types.h> does not define. */
-/* #undef ssize_t */
-
-/* Define to `unsigned char' if <sys/types.h> does not define. */
-#define uchar unsigned char
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef uint */
-
-/* Define to `unsigned long' if <sys/types.h> does not define. */
-/* #undef ulong */
-
-/* Define to `unsigned long long' if <sys/types.h> does not define. */
-#define ulonglong unsigned long long
-
-/* Define to `unsigned short' if <sys/types.h> does not define. */
-/* #undef ushort */
-
-
-#else
-/* A configure-based build is not being used. */
-#include <jasper/jas_config2.h>
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_config2.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_config2.h
deleted file mode 100644
index 90fb728..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_config2.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2002-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#ifndef JAS_CONFIG2_H
-#define JAS_CONFIG2_H
-
-/*
- * Configuration for Microsoft Windows and Microsoft Visual C.
- *
- * We are not using a configure-based build.
- * Try to compensate for this here, by specifying the preprocessor symbols
- * normally defined by configure.
- */
-
-#define uchar unsigned char
-#define ushort unsigned short
-#define uint unsigned int
-#define ulong unsigned long
-#define longlong long long
-#define ulonglong unsigned long long
-/*#define ssize_t int*/
-
-#define HAVE_FCNTL_H 1
-#define HAVE_LIMITS_H 1
-#define HAVE_IO_H 1
-#define HAVE_WINDOWS_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDDEF_H 1
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_debug.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_debug.h
deleted file mode 100644
index 334beeb..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_debug.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Debugging-Related Code
- *
- * $Id$
- */
-
-#ifndef JAS_DEBUG_H
-#define JAS_DEBUG_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdio.h>
-
-#include <jasper/jas_config.h>
-#include "jasper/jas_types.h"
-#include "jasper/jas_debug.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Macros and functions.
-\******************************************************************************/
-
-/* Output debugging information to standard error provided that the debug
- level is set sufficiently high. */
-#if defined(DEBUG)
-#define JAS_DBGLOG(n, x) \
- ((jas_getdbglevel() >= (n)) ? (jas_eprintf x) : 0)
-#else
-#define JAS_DBGLOG(n, x)
-#endif
-
-/* Get the library debug level. */
-int jas_getdbglevel(void);
-
-/* Set the library debug level. */
-int jas_setdbglevel(int dbglevel);
-
-/* Perform formatted output to standard error. */
-int jas_eprintf(const char *fmt, ...);
-
-/* Dump memory to a stream. */
-int jas_memdump(FILE *out, void *data, size_t len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_fix.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_fix.h
deleted file mode 100644
index 8081f20..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_fix.h
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Fixed-Point Number Class
- *
- * $Id$
- */
-
-#ifndef JAS_FIX_H
-#define JAS_FIX_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include <jasper/jas_config.h>
-#include <jasper/jas_types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Constants.
-\******************************************************************************/
-
-/* The representation of the value zero. */
-#define JAS_FIX_ZERO(fix_t, fracbits) \
- JAS_CAST(fix_t, 0)
-
-/* The representation of the value one. */
-#define JAS_FIX_ONE(fix_t, fracbits) \
- (JAS_CAST(fix_t, 1) << (fracbits))
-
-/* The representation of the value one half. */
-#define JAS_FIX_HALF(fix_t, fracbits) \
- (JAS_CAST(fix_t, 1) << ((fracbits) - 1))
-
-/******************************************************************************\
-* Conversion operations.
-\******************************************************************************/
-
-/* Convert an int to a fixed-point number. */
-#define JAS_INTTOFIX(fix_t, fracbits, x) \
- JAS_CAST(fix_t, (x) << (fracbits))
-
-/* Convert a fixed-point number to an int. */
-#define JAS_FIXTOINT(fix_t, fracbits, x) \
- JAS_CAST(int, (x) >> (fracbits))
-
-/* Convert a fixed-point number to a double. */
-#define JAS_FIXTODBL(fix_t, fracbits, x) \
- (JAS_CAST(double, x) / (JAS_CAST(fix_t, 1) << (fracbits)))
-
-/* Convert a double to a fixed-point number. */
-#define JAS_DBLTOFIX(fix_t, fracbits, x) \
- JAS_CAST(fix_t, ((x) * JAS_CAST(double, JAS_CAST(fix_t, 1) << (fracbits))))
-
-/******************************************************************************\
-* Basic arithmetic operations.
-* All other arithmetic operations are synthesized from these basic operations.
-* There are three macros for each type of arithmetic operation.
-* One macro always performs overflow/underflow checking, one never performs
-* overflow/underflow checking, and one is generic with its behavior
-* depending on compile-time flags.
-* Only the generic macros should be invoked directly by application code.
-\******************************************************************************/
-
-/* Calculate the sum of two fixed-point numbers. */
-#if !defined(DEBUG_OVERFLOW)
-#define JAS_FIX_ADD JAS_FIX_ADD_FAST
-#else
-#define JAS_FIX_ADD JAS_FIX_ADD_OFLOW
-#endif
-
-/* Calculate the sum of two fixed-point numbers without overflow checking. */
-#define JAS_FIX_ADD_FAST(fix_t, fracbits, x, y) ((x) + (y))
-
-/* Calculate the sum of two fixed-point numbers with overflow checking. */
-#define JAS_FIX_ADD_OFLOW(fix_t, fracbits, x, y) \
- ((x) >= 0) ? \
- (((y) >= 0) ? ((x) + (y) >= 0 || JAS_FIX_OFLOW(), (x) + (y)) : \
- ((x) + (y))) : \
- (((y) >= 0) ? ((x) + (y)) : ((x) + (y) < 0 || JAS_FIX_OFLOW(), \
- (x) + (y)))
-
-/* Calculate the product of two fixed-point numbers. */
-#if !defined(DEBUG_OVERFLOW)
-#define JAS_FIX_MUL JAS_FIX_MUL_FAST
-#else
-#define JAS_FIX_MUL JAS_FIX_MUL_OFLOW
-#endif
-
-/* Calculate the product of two fixed-point numbers without overflow
- checking. */
-#define JAS_FIX_MUL_FAST(fix_t, fracbits, bigfix_t, x, y) \
- JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y)) >> \
- (fracbits))
-
-/* Calculate the product of two fixed-point numbers with overflow
- checking. */
-#define JAS_FIX_MUL_OFLOW(fix_t, fracbits, bigfix_t, x, y) \
- ((JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> (fracbits)) == \
- JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> \
- (fracbits))) ? \
- JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) * JAS_CAST(bigfix_t, y) >> \
- (fracbits))) : JAS_FIX_OFLOW())
-
-/* Calculate the product of a fixed-point number and an int. */
-#if !defined(DEBUG_OVERFLOW)
-#define JAS_FIX_MULBYINT JAS_FIX_MULBYINT_FAST
-#else
-#define JAS_FIX_MULBYINT JAS_FIX_MULBYINT_OFLOW
-#endif
-
-/* Calculate the product of a fixed-point number and an int without overflow
- checking. */
-#define JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) \
- JAS_CAST(fix_t, ((x) * (y)))
-
-/* Calculate the product of a fixed-point number and an int with overflow
- checking. */
-#define JAS_FIX_MULBYINT_OFLOW(fix_t, fracbits, x, y) \
- JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y)
-
-/* Calculate the quotient of two fixed-point numbers. */
-#if !defined(DEBUG_OVERFLOW)
-#define JAS_FIX_DIV JAS_FIX_DIV_FAST
-#else
-#define JAS_FIX_DIV JAS_FIX_DIV_UFLOW
-#endif
-
-/* Calculate the quotient of two fixed-point numbers without underflow
- checking. */
-#define JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) \
- JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) << (fracbits)) / (y))
-
-/* Calculate the quotient of two fixed-point numbers with underflow
- checking. */
-#define JAS_FIX_DIV_UFLOW(fix_t, fracbits, bigfix_t, x, y) \
- JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y)
-
-/* Negate a fixed-point number. */
-#if !defined(DEBUG_OVERFLOW)
-#define JAS_FIX_NEG JAS_FIX_NEG_FAST
-#else
-#define JAS_FIX_NEG JAS_FIX_NEG_OFLOW
-#endif
-
-/* Negate a fixed-point number without overflow checking. */
-#define JAS_FIX_NEG_FAST(fix_t, fracbits, x) \
- (-(x))
-
-/* Negate a fixed-point number with overflow checking. */
-/* Yes, overflow is actually possible for two's complement representations,
- although highly unlikely to occur. */
-#define JAS_FIX_NEG_OFLOW(fix_t, fracbits, x) \
- (((x) < 0) ? (-(x) > 0 || JAS_FIX_OFLOW(), -(x)) : (-(x)))
-
-/* Perform an arithmetic shift left of a fixed-point number. */
-#if !defined(DEBUG_OVERFLOW)
-#define JAS_FIX_ASL JAS_FIX_ASL_FAST
-#else
-#define JAS_FIX_ASL JAS_FIX_ASL_OFLOW
-#endif
-
-/* Perform an arithmetic shift left of a fixed-point number without overflow
- checking. */
-#define JAS_FIX_ASL_FAST(fix_t, fracbits, x, n) \
- ((x) << (n))
-
-/* Perform an arithmetic shift left of a fixed-point number with overflow
- checking. */
-#define JAS_FIX_ASL_OFLOW(fix_t, fracbits, x, n) \
- ((((x) << (n)) >> (n)) == (x) || JAS_FIX_OFLOW(), (x) << (n))
-
-/* Perform an arithmetic shift right of a fixed-point number. */
-#if !defined(DEBUG_OVERFLOW)
-#define JAS_FIX_ASR JAS_FIX_ASR_FAST
-#else
-#define JAS_FIX_ASR JAS_FIX_ASR_UFLOW
-#endif
-
-/* Perform an arithmetic shift right of a fixed-point number without underflow
- checking. */
-#define JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) \
- ((x) >> (n))
-
-/* Perform an arithmetic shift right of a fixed-point number with underflow
- checking. */
-#define JAS_FIX_ASR_UFLOW(fix_t, fracbits, x, n) \
- JAS_FIX_ASR_FAST(fix_t, fracbits, x, n)
-
-/******************************************************************************\
-* Other basic arithmetic operations.
-\******************************************************************************/
-
-/* Calculate the difference between two fixed-point numbers. */
-#define JAS_FIX_SUB(fix_t, fracbits, x, y) \
- JAS_FIX_ADD(fix_t, fracbits, x, JAS_FIX_NEG(fix_t, fracbits, y))
-
-/* Add one fixed-point number to another. */
-#define JAS_FIX_PLUSEQ(fix_t, fracbits, x, y) \
- ((x) = JAS_FIX_ADD(fix_t, fracbits, x, y))
-
-/* Subtract one fixed-point number from another. */
-#define JAS_FIX_MINUSEQ(fix_t, fracbits, x, y) \
- ((x) = JAS_FIX_SUB(fix_t, fracbits, x, y))
-
-/* Multiply one fixed-point number by another. */
-#define JAS_FIX_MULEQ(fix_t, fracbits, bigfix_t, x, y) \
- ((x) = JAS_FIX_MUL(fix_t, fracbits, bigfix_t, x, y))
-
-/******************************************************************************\
-* Miscellaneous operations.
-\******************************************************************************/
-
-/* Calculate the absolute value of a fixed-point number. */
-#define JAS_FIX_ABS(fix_t, fracbits, x) \
- (((x) >= 0) ? (x) : (JAS_FIX_NEG(fix_t, fracbits, x)))
-
-/* Is a fixed-point number an integer? */
-#define JAS_FIX_ISINT(fix_t, fracbits, x) \
- (JAS_FIX_FLOOR(fix_t, fracbits, x) == (x))
-
-/* Get the sign of a fixed-point number. */
-#define JAS_FIX_SGN(fix_t, fracbits, x) \
- ((x) >= 0 ? 1 : (-1))
-
-/******************************************************************************\
-* Relational operations.
-\******************************************************************************/
-
-/* Compare two fixed-point numbers. */
-#define JAS_FIX_CMP(fix_t, fracbits, x, y) \
- ((x) > (y) ? 1 : (((x) == (y)) ? 0 : (-1)))
-
-/* Less than. */
-#define JAS_FIX_LT(fix_t, fracbits, x, y) \
- ((x) < (y))
-
-/* Less than or equal. */
-#define JAS_FIX_LTE(fix_t, fracbits, x, y) \
- ((x) <= (y))
-
-/* Greater than. */
-#define JAS_FIX_GT(fix_t, fracbits, x, y) \
- ((x) > (y))
-
-/* Greater than or equal. */
-#define JAS_FIX_GTE(fix_t, fracbits, x, y) \
- ((x) >= (y))
-
-/******************************************************************************\
-* Rounding functions.
-\******************************************************************************/
-
-/* Round a fixed-point number to the nearest integer. */
-#define JAS_FIX_ROUND(fix_t, fracbits, x) \
- (((x) < 0) ? JAS_FIX_FLOOR(fix_t, fracbits, JAS_FIX_ADD(fix_t, fracbits, \
- (x), JAS_FIX_HALF(fix_t, fracbits))) : \
- JAS_FIX_NEG(fix_t, fracbits, JAS_FIX_FLOOR(fix_t, fracbits, \
- JAS_FIX_ADD(fix_t, fracbits, (-(x)), JAS_FIX_HALF(fix_t, fracbits)))))
-
-/* Round a fixed-point number to the nearest integer in the direction of
- negative infinity (i.e., the floor function). */
-#define JAS_FIX_FLOOR(fix_t, fracbits, x) \
- ((x) & (~((JAS_CAST(fix_t, 1) << (fracbits)) - 1)))
-
-/* Round a fixed-point number to the nearest integer in the direction
- of zero. */
-#define JAS_FIX_TRUNC(fix_t, fracbits, x) \
- (((x) >= 0) ? JAS_FIX_FLOOR(fix_t, fracbits, x) : \
- JAS_FIX_CEIL(fix_t, fracbits, x))
-
-/******************************************************************************\
-* The below macros are for internal library use only. Do not invoke them
-* directly in application code.
-\******************************************************************************/
-
-/* Handle overflow. */
-#define JAS_FIX_OFLOW() \
- jas_eprintf("overflow error: file %s, line %d\n", __FILE__, __LINE__)
-
-/* Handle underflow. */
-#define JAS_FIX_UFLOW() \
- jas_eprintf("underflow error: file %s, line %d\n", __FILE__, __LINE__)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_getopt.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_getopt.h
deleted file mode 100644
index c1788ae..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_getopt.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Command Line Option Parsing Code
- *
- * $Id$
- */
-
-#ifndef JAS_GETOPT_H
-#define JAS_GETOPT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <jasper/jas_config.h>
-
-/******************************************************************************\
-* Constants.
-\******************************************************************************/
-
-#define JAS_GETOPT_EOF (-1)
-#define JAS_GETOPT_ERR '?'
-
-/* option flags. */
-#define JAS_OPT_HASARG 0x01 /* option has argument */
-
-/******************************************************************************\
-* Types.
-\******************************************************************************/
-
-/* Command line option type. */
-typedef struct {
-
- int id;
- /* The unique identifier for this option. */
-
- char *name;
- /* The name of this option. */
-
- int flags;
- /* option flags. */
-
-} jas_opt_t;
-
-/******************************************************************************\
-* External data.
-\******************************************************************************/
-
-/* The current option index. */
-extern int jas_optind;
-
-/* The current option argument. */
-extern char *jas_optarg;
-
-/* The debug level. */
-extern int jas_opterr;
-
-/******************************************************************************\
-* Prototypes.
-\******************************************************************************/
-
-/* Get the next option. */
-int jas_getopt(int argc, char **argv, jas_opt_t *opts);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_icc.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_icc.h
deleted file mode 100644
index 744f757..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_icc.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Copyright (c) 2002-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#ifndef JAS_ICC_H
-#define JAS_ICC_H
-
-#include <jasper/jas_config.h>
-#include <jasper/jas_types.h>
-#include <jasper/jas_stream.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Profile file signature. */
-#define JAS_ICC_MAGIC 0x61637370
-
-#define JAS_ICC_HDRLEN 128
-
-/* Profile/device class signatures. */
-#define JAS_ICC_CLAS_IN 0x73636e72 /* input device */
-#define JAS_ICC_CLAS_DPY 0x6d6e7472 /* display device */
-#define JAS_ICC_CLAS_OUT 0x70727472 /* output device */
-#define JAS_ICC_CLAS_LNK 0x6c696e6b /* device link */
-#define JAS_ICC_CLAS_CNV 0x73706163 /* color space conversion */
-#define JAS_ICC_CLAS_ABS 0x61627374 /* abstract */
-#define JAS_ICC_CLAS_NAM 0x6e6d636c /* named color */
-
-/* Color space signatures. */
-#define JAS_ICC_COLORSPC_XYZ 0x58595a20 /* XYZ */
-#define JAS_ICC_COLORSPC_LAB 0x4c616220 /* LAB */
-#define JAS_ICC_COLORSPC_LUV 0x4c757620 /* LUV */
-#define JAS_ICC_COLORSPC_YCBCR 0x59436272 /* YCbCr */
-#define JAS_ICC_COLORSPC_YXY 0x59787920 /* Yxy */
-#define JAS_ICC_COLORSPC_RGB 0x52474220 /* RGB */
-#define JAS_ICC_COLORSPC_GRAY 0x47524159 /* Gray */
-#define JAS_ICC_COLORSPC_HSV 0x48535620 /* HSV */
-#define JAS_ICC_COLORSPC_HLS 0x484c5320 /* HLS */
-#define JAS_ICC_COLORSPC_CMYK 0x434d594b /* CMYK */
-#define JAS_ICC_COLORSPC_CMY 0x434d5920 /* CMY */
-#define JAS_ICC_COLORSPC_2 0x32434c52 /* 2 channel color */
-#define JAS_ICC_COLORSPC_3 0x33434c52 /* 3 channel color */
-#define JAS_ICC_COLORSPC_4 0x34434c52 /* 4 channel color */
-#define JAS_ICC_COLORSPC_5 0x35434c52 /* 5 channel color */
-#define JAS_ICC_COLORSPC_6 0x36434c52 /* 6 channel color */
-#define JAS_ICC_COLORSPC_7 0x37434c52 /* 7 channel color */
-#define JAS_ICC_COLORSPC_8 0x38434c52 /* 8 channel color */
-#define JAS_ICC_COLORSPC_9 0x39434c52 /* 9 channel color */
-#define JAS_ICC_COLORSPC_10 0x41434c52 /* 10 channel color */
-#define JAS_ICC_COLORSPC_11 0x42434c52 /* 11 channel color */
-#define JAS_ICC_COLORSPC_12 0x43434c52 /* 12 channel color */
-#define JAS_ICC_COLORSPC_13 0x44434c52 /* 13 channel color */
-#define JAS_ICC_COLORSPC_14 0x45434c52 /* 14 channel color */
-#define JAS_ICC_COLORSPC_15 0x46434c52 /* 15 channel color */
-
-/* Profile connection color space (PCS) signatures. */
-#define JAS_ICC_REFCOLORSPC_XYZ 0x58595a20 /* CIE XYZ */
-#define JAS_ICC_REFCOLORSPC_LAB 0x4c616220 /* CIE Lab */
-
-/* Primary platform signatures. */
-#define JAS_ICC_PLATFORM_APPL 0x4150504c /* Apple Computer */
-#define JAS_ICC_PLATFORM_MSFT 0x4d534654 /* Microsoft */
-#define JAS_ICC_PLATFORM_SGI 0x53474920 /* Silicon Graphics */
-#define JAS_ICC_PLATFORM_SUNW 0x53554e57 /* Sun Microsystems */
-#define JAS_ICC_PLATFORM_TGNT 0x54474e54 /* Taligent */
-
-/* Profile flags. */
-#define JAS_ICC_FLAGS_EMBED 0x01 /* embedded */
-#define JAS_ICC_FLAGS_NOSEP 0x02 /* no separate use */
-
-/* Attributes. */
-#define JAS_ICC_ATTR_TRANS 0x01 /* transparent */
-#define JAS_ICC_ATTR_MATTE 0x02 /* matte */
-
-/* Rendering intents. */
-#define JAS_ICC_INTENT_PER 0 /* perceptual */
-#define JAS_ICC_INTENT_REL 1 /* relative colorimetric */
-#define JAS_ICC_INTENT_SAT 2 /* saturation */
-#define JAS_ICC_INTENT_ABS 3 /* absolute colorimetric */
-
-/* Tag signatures. */
-#define JAS_ICC_TAG_ATOB0 0x41324230 /* */
-#define JAS_ICC_TAG_ATOB1 0x41324231 /* */
-#define JAS_ICC_TAG_ATOB2 0x41324232 /* */
-#define JAS_ICC_TAG_BLUMATCOL 0x6258595a /* */
-#define JAS_ICC_TAG_BLUTRC 0x62545243 /* */
-#define JAS_ICC_TAG_BTOA0 0x42324130 /* */
-#define JAS_ICC_TAG_BTOA1 0x42324131 /* */
-#define JAS_ICC_TAG_BTOA2 0x42324132 /* */
-#define JAS_ICC_TAG_CALTIME 0x63616c74 /* */
-#define JAS_ICC_TAG_CHARTARGET 0x74617267 /* */
-#define JAS_ICC_TAG_CPYRT 0x63707274 /* */
-#define JAS_ICC_TAG_CRDINFO 0x63726469 /* */
-#define JAS_ICC_TAG_DEVMAKERDESC 0x646d6e64 /* */
-#define JAS_ICC_TAG_DEVMODELDESC 0x646d6464 /* */
-#define JAS_ICC_TAG_DEVSET 0x64657673 /* */
-#define JAS_ICC_TAG_GAMUT 0x67616d74 /* */
-#define JAS_ICC_TAG_GRYTRC 0x6b545243 /* */
-#define JAS_ICC_TAG_GRNMATCOL 0x6758595a /* */
-#define JAS_ICC_TAG_GRNTRC 0x67545243 /* */
-#define JAS_ICC_TAG_LUM 0x6c756d69 /* */
-#define JAS_ICC_TAG_MEASURE 0x6d656173 /* */
-#define JAS_ICC_TAG_MEDIABLKPT 0x626b7074 /* */
-#define JAS_ICC_TAG_MEDIAWHIPT 0x77747074 /* */
-#define JAS_ICC_TAG_NAMCOLR 0x6e636f6c /* */
-#define JAS_ICC_TAG_NAMCOLR2 0x6e636c32 /* */
-#define JAS_ICC_TAG_OUTRESP 0x72657370 /* */
-#define JAS_ICC_TAG_PREVIEW0 0x70726530 /* */
-#define JAS_ICC_TAG_PREVIEW1 0x70726531 /* */
-#define JAS_ICC_TAG_PREVIEW2 0x70726532 /* */
-#define JAS_ICC_TAG_PROFDESC 0x64657363 /* */
-#define JAS_ICC_TAG_PROFSEQDESC 0x70736571 /* */
-#define JAS_ICC_TAG_PSDCRD0 0x70736430 /* */
-#define JAS_ICC_TAG_PSCRDD1 0x70736431 /* */
-#define JAS_ICC_TAG_PSCRDD2 0x70736432 /* */
-#define JAS_ICC_TAG_PSCRDD3 0x70736433 /* */
-#define JAS_ICC_TAG_PS2CSA 0x70733273 /* */
-#define JAS_ICC_TAG_PS2RENINTENT 0x70733269 /* */
-#define JAS_ICC_TAG_REDMATCOL 0x7258595a /* */
-#define JAS_ICC_TAG_REDTRC 0x72545243 /* */
-#define JAS_ICC_TAG_SCRNGDES 0x73637264 /* */
-#define JAS_ICC_TAG_SCRNG 0x7363726e /* */
-#define JAS_ICC_TAG_TECH 0x74656368 /* */
-#define JAS_ICC_TAG_UCRBG 0x62666420 /* */
-#define JAS_ICC_TAG_VIEWCONDDESC 0x76756564 /* */
-#define JAS_ICC_TAG_VIEWCOND 0x76696577 /* */
-
-/* Type signatures. */
-#define JAS_ICC_TYPE_CRDINFO 0x63726469 /* CRD information */
-#define JAS_ICC_TYPE_CURV 0x63757276 /* curve */
-#define JAS_ICC_TYPE_DATA 0x64617461 /* data */
-#define JAS_ICC_TYPE_TIME 0x6474696d /* date/time */
-#define JAS_ICC_TYPE_DEVSET 0x64657673 /* device settings */
-#define JAS_ICC_TYPE_LUT16 0x6d667432 /* */
-#define JAS_ICC_TYPE_LUT8 0x6d667431 /* */
-#define JAS_ICC_TYPE_MEASURE 0x6d656173 /* */
-#define JAS_ICC_TYPE_NAMCOLR 0x6e636f6c /* */
-#define JAS_ICC_TYPE_NAMCOLR2 0x6e636c32 /* */
-#define JAS_ICC_TYPE_PROFSEQDESC 0x70736571 /* profile sequence description */
-#define JAS_ICC_TYPE_RESPCURVSET16 0x72637332 /* response curve set 16 */
-#define JAS_ICC_TYPE_SF32 0x73663332 /* signed 32-bit fixed-point */
-#define JAS_ICC_TYPE_SCRNG 0x7363726e /* screening */
-#define JAS_ICC_TYPE_SIG 0x73696720 /* signature */
-#define JAS_ICC_TYPE_TXTDESC 0x64657363 /* text description */
-#define JAS_ICC_TYPE_TXT 0x74657874 /* text */
-#define JAS_ICC_TYPE_UF32 0x75663332 /* unsigned 32-bit fixed-point */
-#define JAS_ICC_TYPE_UCRBG 0x62666420 /* */
-#define JAS_ICC_TYPE_UI16 0x75693136 /* */
-#define JAS_ICC_TYPE_UI32 0x75693332 /* */
-#define JAS_ICC_TYPE_UI8 0x75693038 /* */
-#define JAS_ICC_TYPE_UI64 0x75693634 /* */
-#define JAS_ICC_TYPE_VIEWCOND 0x76696577 /* */
-#define JAS_ICC_TYPE_XYZ 0x58595a20 /* XYZ */
-
-typedef uint_fast8_t jas_iccuint8_t;
-typedef uint_fast16_t jas_iccuint16_t;
-typedef uint_fast32_t jas_iccuint32_t;
-typedef int_fast32_t jas_iccsint32_t;
-typedef int_fast32_t jas_iccs15fixed16_t;
-typedef uint_fast32_t jas_iccu16fixed16_t;
-typedef uint_fast64_t jas_iccuint64_t;
-typedef uint_fast32_t jas_iccsig_t;
-
-typedef jas_iccsig_t jas_icctagsig_t;
-typedef jas_iccsig_t jas_icctagtype_t;
-typedef jas_iccsig_t jas_iccattrname_t;
-
-/* Date/time type. */
-typedef struct {
- jas_iccuint16_t year;
- jas_iccuint16_t month;
- jas_iccuint16_t day;
- jas_iccuint16_t hour;
- jas_iccuint16_t min;
- jas_iccuint16_t sec;
-} jas_icctime_t;
-
-/* XYZ type. */
-typedef struct {
- jas_iccs15fixed16_t x;
- jas_iccs15fixed16_t y;
- jas_iccs15fixed16_t z;
-} jas_iccxyz_t;
-
-/* Curve type. */
-typedef struct {
- jas_iccuint32_t numents;
- jas_iccuint16_t *ents;
-} jas_icccurv_t;
-
-/* Text description type. */
-typedef struct {
- jas_iccuint32_t asclen;
- char *ascdata; /* ASCII invariant description */
- jas_iccuint32_t uclangcode; /* Unicode language code */
- jas_iccuint32_t uclen; /* Unicode localizable description count */
- uchar *ucdata; /* Unicode localizable description */
- jas_iccuint16_t sccode; /* ScriptCode code */
- jas_iccuint8_t maclen; /* Localizable Macintosh description count */
- uchar macdata[69]; /* Localizable Macintosh description */
-} jas_icctxtdesc_t;
-
-/* Text type. */
-typedef struct {
- char *string; /* ASCII character string */
-} jas_icctxt_t;
-
-typedef struct {
- jas_iccuint8_t numinchans;
- jas_iccuint8_t numoutchans;
- jas_iccsint32_t e[3][3];
- jas_iccuint8_t clutlen;
- jas_iccuint8_t *clut;
- jas_iccuint16_t numintabents;
- jas_iccuint8_t **intabs;
- jas_iccuint8_t *intabsbuf;
- jas_iccuint16_t numouttabents;
- jas_iccuint8_t **outtabs;
- jas_iccuint8_t *outtabsbuf;
-} jas_icclut8_t;
-
-typedef struct {
- jas_iccuint8_t numinchans;
- jas_iccuint8_t numoutchans;
- jas_iccsint32_t e[3][3];
- jas_iccuint8_t clutlen;
- jas_iccuint16_t *clut;
- jas_iccuint16_t numintabents;
- jas_iccuint16_t **intabs;
- jas_iccuint16_t *intabsbuf;
- jas_iccuint16_t numouttabents;
- jas_iccuint16_t **outtabs;
- jas_iccuint16_t *outtabsbuf;
-} jas_icclut16_t;
-
-struct jas_iccattrval_s;
-
-typedef struct {
- void (*destroy)(struct jas_iccattrval_s *);
- int (*copy)(struct jas_iccattrval_s *, struct jas_iccattrval_s *);
- int (*input)(struct jas_iccattrval_s *, jas_stream_t *, int);
- int (*output)(struct jas_iccattrval_s *, jas_stream_t *);
- int (*getsize)(struct jas_iccattrval_s *);
- void (*dump)(struct jas_iccattrval_s *, FILE *);
-} jas_iccattrvalops_t;
-
-/* Attribute value type (type and value information). */
-typedef struct jas_iccattrval_s {
- int refcnt; /* reference count */
- jas_iccsig_t type; /* type */
- jas_iccattrvalops_t *ops; /* type-dependent operations */
- union {
- jas_iccxyz_t xyz;
- jas_icccurv_t curv;
- jas_icctxtdesc_t txtdesc;
- jas_icctxt_t txt;
- jas_icclut8_t lut8;
- jas_icclut16_t lut16;
- } data; /* value */
-} jas_iccattrval_t;
-
-/* Header type. */
-typedef struct {
- jas_iccuint32_t size; /* profile size */
- jas_iccsig_t cmmtype; /* CMM type signature */
- jas_iccuint32_t version; /* profile version */
- jas_iccsig_t clas; /* profile/device class signature */
- jas_iccsig_t colorspc; /* color space of data */
- jas_iccsig_t refcolorspc; /* profile connection space */
- jas_icctime_t ctime; /* creation time */
- jas_iccsig_t magic; /* profile file signature */
- jas_iccsig_t platform; /* primary platform */
- jas_iccuint32_t flags; /* profile flags */
- jas_iccsig_t maker; /* device manufacturer signature */
- jas_iccsig_t model; /* device model signature */
- jas_iccuint64_t attr; /* device setup attributes */
- jas_iccsig_t intent; /* rendering intent */
- jas_iccxyz_t illum; /* illuminant */
- jas_iccsig_t creator; /* profile creator signature */
-} jas_icchdr_t;
-
-typedef struct {
- jas_iccsig_t name;
- jas_iccattrval_t *val;
-} jas_iccattr_t;
-
-typedef struct {
- int numattrs;
- int maxattrs;
- jas_iccattr_t *attrs;
-} jas_iccattrtab_t;
-
-typedef struct jas_icctagtabent_s {
- jas_iccuint32_t tag;
- jas_iccuint32_t off;
- jas_iccuint32_t len;
- void *data;
- struct jas_icctagtabent_s *first;
-} jas_icctagtabent_t;
-
-typedef struct {
- jas_iccuint32_t numents;
- jas_icctagtabent_t *ents;
-} jas_icctagtab_t;
-
-/* ICC profile type. */
-typedef struct {
- jas_icchdr_t hdr;
- jas_icctagtab_t tagtab;
- jas_iccattrtab_t *attrtab;
-} jas_iccprof_t;
-
-typedef struct {
- jas_iccuint32_t type;
- jas_iccattrvalops_t ops;
-} jas_iccattrvalinfo_t;
-
-jas_iccprof_t *jas_iccprof_load(jas_stream_t *in);
-int jas_iccprof_save(jas_iccprof_t *prof, jas_stream_t *out);
-void jas_iccprof_destroy(jas_iccprof_t *prof);
-jas_iccattrval_t *jas_iccprof_getattr(jas_iccprof_t *prof,
- jas_iccattrname_t name);
-int jas_iccprof_setattr(jas_iccprof_t *prof, jas_iccattrname_t name,
- jas_iccattrval_t *val);
-void jas_iccprof_dump(jas_iccprof_t *prof, FILE *out);
-jas_iccprof_t *jas_iccprof_copy(jas_iccprof_t *prof);
-int jas_iccprof_gethdr(jas_iccprof_t *prof, jas_icchdr_t *hdr);
-int jas_iccprof_sethdr(jas_iccprof_t *prof, jas_icchdr_t *hdr);
-
-void jas_iccattrval_destroy(jas_iccattrval_t *attrval);
-void jas_iccattrval_dump(jas_iccattrval_t *attrval, FILE *out);
-int jas_iccattrval_allowmodify(jas_iccattrval_t **attrval);
-jas_iccattrval_t *jas_iccattrval_clone(jas_iccattrval_t *attrval);
-jas_iccattrval_t *jas_iccattrval_create(jas_iccuint32_t type);
-
-void jas_iccattrtab_dump(jas_iccattrtab_t *attrtab, FILE *out);
-
-extern uchar jas_iccprofdata_srgb[];
-extern int jas_iccprofdata_srgblen;
-extern uchar jas_iccprofdata_sgray[];
-extern int jas_iccprofdata_sgraylen;
-jas_iccprof_t *jas_iccprof_createfrombuf(uchar *buf, int len);
-jas_iccprof_t *jas_iccprof_createfromclrspc(int clrspc);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_image.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_image.h
deleted file mode 100644
index 2a2885c..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_image.h
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Image Class
- *
- * $Id$
- */
-
-#ifndef JAS_IMAGE_H
-#define JAS_IMAGE_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <jasper/jas_config.h>
-#include <jasper/jas_stream.h>
-#include <jasper/jas_seq.h>
-#include <jasper/jas_cm.h>
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Constants.
-\******************************************************************************/
-
-/*
- * Miscellaneous constants.
- */
-
-/* The threshold at which image data is no longer stored in memory. */
-#define JAS_IMAGE_INMEMTHRESH (16 * 1024 * 1024)
-
-/*
- * Component types
- */
-
-#define JAS_IMAGE_CT_UNKNOWN 0x10000
-#define JAS_IMAGE_CT_COLOR(n) ((n) & 0x7fff)
-#define JAS_IMAGE_CT_OPACITY 0x08000
-
-#define JAS_IMAGE_CT_RGB_R 0
-#define JAS_IMAGE_CT_RGB_G 1
-#define JAS_IMAGE_CT_RGB_B 2
-
-#define JAS_IMAGE_CT_YCBCR_Y 0
-#define JAS_IMAGE_CT_YCBCR_CB 1
-#define JAS_IMAGE_CT_YCBCR_CR 2
-
-#define JAS_IMAGE_CT_GRAY_Y 0
-
-/******************************************************************************\
-* Simple types.
-\******************************************************************************/
-
-/* Image coordinate. */
-typedef int_fast32_t jas_image_coord_t;
-
-/* Color space (e.g., RGB, YCbCr). */
-typedef int_fast16_t jas_image_colorspc_t;
-
-/* Component type (e.g., color, opacity). */
-typedef int_fast32_t jas_image_cmpttype_t;
-
-/* Component sample data format (e.g., real/integer, signedness, precision). */
-typedef int_fast16_t jas_image_smpltype_t;
-
-/******************************************************************************\
-* Image class and supporting classes.
-\******************************************************************************/
-
-/* Image component class. */
-
-typedef struct {
-
- jas_image_coord_t tlx_;
- /* The x-coordinate of the top-left corner of the component. */
-
- jas_image_coord_t tly_;
- /* The y-coordinate of the top-left corner of the component. */
-
- jas_image_coord_t hstep_;
- /* The horizontal sampling period in units of the reference grid. */
-
- jas_image_coord_t vstep_;
- /* The vertical sampling period in units of the reference grid. */
-
- jas_image_coord_t width_;
- /* The component width in samples. */
-
- jas_image_coord_t height_;
- /* The component height in samples. */
-
-#ifdef FIX_ME
- int smpltype_;
-#else
- int prec_;
- /* The precision of the sample data (i.e., the number of bits per
- sample). If the samples are signed values, this quantity
- includes the sign bit. */
-
- int sgnd_;
- /* The signedness of the sample data. */
-#endif
-
- jas_stream_t *stream_;
- /* The stream containing the component data. */
-
- int cps_;
- /* The number of characters per sample in the stream. */
-
- jas_image_cmpttype_t type_;
- /* The type of component (e.g., opacity, red, green, blue, luma). */
-
-} jas_image_cmpt_t;
-
-/* Image class. */
-
-typedef struct {
-
- jas_image_coord_t tlx_;
- /* The x-coordinate of the top-left corner of the image bounding box. */
-
- jas_image_coord_t tly_;
- /* The y-coordinate of the top-left corner of the image bounding box. */
-
- jas_image_coord_t brx_;
- /* The x-coordinate of the bottom-right corner of the image bounding
- box (plus one). */
-
- jas_image_coord_t bry_;
- /* The y-coordinate of the bottom-right corner of the image bounding
- box (plus one). */
-
- int numcmpts_;
- /* The number of components. */
-
- int maxcmpts_;
- /* The maximum number of components that this image can have (i.e., the
- allocated size of the components array). */
-
- jas_image_cmpt_t **cmpts_;
- /* Per-component information. */
-
- jas_clrspc_t clrspc_;
-
- jas_cmprof_t *cmprof_;
-
- bool inmem_;
-
-} jas_image_t;
-
-/* Component parameters class. */
-/* This data type exists solely/mainly for the purposes of the
- jas_image_create function. */
-
-typedef struct {
-
- jas_image_coord_t tlx;
- /* The x-coordinate of the top-left corner of the component. */
-
- jas_image_coord_t tly;
- /* The y-coordinate of the top-left corner of the component. */
-
- jas_image_coord_t hstep;
- /* The horizontal sampling period in units of the reference grid. */
-
- jas_image_coord_t vstep;
- /* The vertical sampling period in units of the reference grid. */
-
- jas_image_coord_t width;
- /* The width of the component in samples. */
-
- jas_image_coord_t height;
- /* The height of the component in samples. */
-
-#ifdef FIX_ME
- int smpltype;
-#else
- int prec;
- /* The precision of the component sample data. */
-
- int sgnd;
- /* The signedness of the component sample data. */
-#endif
-
-} jas_image_cmptparm_t;
-
-/******************************************************************************\
-* File format related classes.
-\******************************************************************************/
-
-#define JAS_IMAGE_MAXFMTS 32
-/* The maximum number of image data formats supported. */
-
-/* Image format-dependent operations. */
-
-typedef struct {
-
- jas_image_t *(*decode)(jas_stream_t *in, char *opts);
- /* Decode image data from a stream. */
-
- int (*encode)(jas_image_t *image, jas_stream_t *out, char *opts);
- /* Encode image data to a stream. */
-
- int (*validate)(jas_stream_t *in);
- /* Determine if stream data is in a particular format. */
-
-} jas_image_fmtops_t;
-
-/* Image format information. */
-
-typedef struct {
-
- int id;
- /* The ID for this format. */
-
- char *name;
- /* The name by which this format is identified. */
-
- char *ext;
- /* The file name extension associated with this format. */
-
- char *desc;
- /* A brief description of the format. */
-
- jas_image_fmtops_t ops;
- /* The operations for this format. */
-
-} jas_image_fmtinfo_t;
-
-/******************************************************************************\
-* Image operations.
-\******************************************************************************/
-
-/* Create an image. */
-jas_image_t *jas_image_create(int numcmpts,
- jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc);
-
-/* Create an "empty" image. */
-jas_image_t *jas_image_create0(void);
-
-/* Clone an image. */
-jas_image_t *jas_image_copy(jas_image_t *image);
-
-/* Deallocate any resources associated with an image. */
-void jas_image_destroy(jas_image_t *image);
-
-/* Get the width of the image in units of the image reference grid. */
-#define jas_image_width(image) \
- ((image)->brx_ - (image)->tlx_)
-
-/* Get the height of the image in units of the image reference grid. */
-#define jas_image_height(image) \
- ((image)->bry_ - (image)->tly_)
-
-/* Get the x-coordinate of the top-left corner of the image bounding box
- on the reference grid. */
-#define jas_image_tlx(image) \
- ((image)->tlx_)
-
-/* Get the y-coordinate of the top-left corner of the image bounding box
- on the reference grid. */
-#define jas_image_tly(image) \
- ((image)->tly_)
-
-/* Get the x-coordinate of the bottom-right corner of the image bounding box
- on the reference grid (plus one). */
-#define jas_image_brx(image) \
- ((image)->brx_)
-
-/* Get the y-coordinate of the bottom-right corner of the image bounding box
- on the reference grid (plus one). */
-#define jas_image_bry(image) \
- ((image)->bry_)
-
-/* Get the number of image components. */
-#define jas_image_numcmpts(image) \
- ((image)->numcmpts_)
-
-/* Get the color model used by the image. */
-#define jas_image_clrspc(image) \
- ((image)->clrspc_)
-
-/* Set the color model for an image. */
-#define jas_image_setclrspc(image, clrspc) \
- ((image)->clrspc_ = (clrspc))
-
-#define jas_image_cmpttype(image, cmptno) \
- ((image)->cmpts_[(cmptno)]->type_)
-#define jas_image_setcmpttype(image, cmptno, type) \
- ((image)->cmpts_[(cmptno)]->type_ = (type))
-
-/* Get the width of a component. */
-#define jas_image_cmptwidth(image, cmptno) \
- ((image)->cmpts_[cmptno]->width_)
-
-/* Get the height of a component. */
-#define jas_image_cmptheight(image, cmptno) \
- ((image)->cmpts_[cmptno]->height_)
-
-/* Get the signedness of the sample data for a component. */
-#define jas_image_cmptsgnd(image, cmptno) \
- ((image)->cmpts_[cmptno]->sgnd_)
-
-/* Get the precision of the sample data for a component. */
-#define jas_image_cmptprec(image, cmptno) \
- ((image)->cmpts_[cmptno]->prec_)
-
-/* Get the horizontal subsampling factor for a component. */
-#define jas_image_cmpthstep(image, cmptno) \
- ((image)->cmpts_[cmptno]->hstep_)
-
-/* Get the vertical subsampling factor for a component. */
-#define jas_image_cmptvstep(image, cmptno) \
- ((image)->cmpts_[cmptno]->vstep_)
-
-/* Get the x-coordinate of the top-left corner of a component. */
-#define jas_image_cmpttlx(image, cmptno) \
- ((image)->cmpts_[cmptno]->tlx_)
-
-/* Get the y-coordinate of the top-left corner of a component. */
-#define jas_image_cmpttly(image, cmptno) \
- ((image)->cmpts_[cmptno]->tly_)
-
-/* Get the x-coordinate of the bottom-right corner of a component
- (plus "one"). */
-#define jas_image_cmptbrx(image, cmptno) \
- ((image)->cmpts_[cmptno]->tlx_ + (image)->cmpts_[cmptno]->width_ * \
- (image)->cmpts_[cmptno]->hstep_)
-
-/* Get the y-coordinate of the bottom-right corner of a component
- (plus "one"). */
-#define jas_image_cmptbry(image, cmptno) \
- ((image)->cmpts_[cmptno]->tly_ + (image)->cmpts_[cmptno]->height_ * \
- (image)->cmpts_[cmptno]->vstep_)
-
-/* Get the raw size of an image (i.e., the nominal size of the image without
- any compression. */
-uint_fast32_t jas_image_rawsize(jas_image_t *image);
-
-/* Create an image from a stream in some specified format. */
-jas_image_t *jas_image_decode(jas_stream_t *in, int fmt, char *optstr);
-
-/* Write an image to a stream in a specified format. */
-int jas_image_encode(jas_image_t *image, jas_stream_t *out, int fmt,
- char *optstr);
-
-/* Read a rectangular region of an image component. */
-/* The position and size of the rectangular region to be read is specified
-relative to the component's coordinate system. */
-int jas_image_readcmpt(jas_image_t *image, int cmptno,
- jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
- jas_matrix_t *data);
-
-/* Write a rectangular region of an image component. */
-int jas_image_writecmpt(jas_image_t *image, int cmptno,
- jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
- jas_matrix_t *data);
-
-/* Delete a component from an image. */
-void jas_image_delcmpt(jas_image_t *image, int cmptno);
-
-/* Add a component to an image. */
-int jas_image_addcmpt(jas_image_t *image, int cmptno,
- jas_image_cmptparm_t *cmptparm);
-
-/* Copy a component from one image to another. */
-int jas_image_copycmpt(jas_image_t *dstimage, int dstcmptno,
- jas_image_t *srcimage, int srccmptno);
-
-#define JAS_IMAGE_CDT_GETSGND(dtype) (((dtype) >> 7) & 1)
-#define JAS_IMAGE_CDT_SETSGND(dtype) (((dtype) & 1) << 7)
-#define JAS_IMAGE_CDT_GETPREC(dtype) ((dtype) & 0x7f)
-#define JAS_IMAGE_CDT_SETPREC(dtype) ((dtype) & 0x7f)
-
-#define jas_image_cmptdtype(image, cmptno) \
- (JAS_IMAGE_CDT_SETSGND((image)->cmpts_[cmptno]->sgnd_) | JAS_IMAGE_CDT_SETPREC((image)->cmpts_[cmptno]->prec_))
-
-int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
- int_fast32_t *lutents, int dtype, int newcmptno);
-
-int jas_image_readcmptsample(jas_image_t *image, int cmptno, int x, int y);
-void jas_image_writecmptsample(jas_image_t *image, int cmptno, int x, int y,
- int_fast32_t v);
-
-int jas_image_getcmptbytype(jas_image_t *image, int ctype);
-
-/******************************************************************************\
-* Image format-related operations.
-\******************************************************************************/
-
-/* Clear the table of image formats. */
-void jas_image_clearfmts(void);
-
-/* Add entry to table of image formats. */
-int jas_image_addfmt(int id, char *name, char *ext, char *desc,
- jas_image_fmtops_t *ops);
-
-/* Get the ID for the image format with the specified name. */
-int jas_image_strtofmt(char *s);
-
-/* Get the name of the image format with the specified ID. */
-char *jas_image_fmttostr(int fmt);
-
-/* Lookup image format information by the format ID. */
-jas_image_fmtinfo_t *jas_image_lookupfmtbyid(int id);
-
-/* Lookup image format information by the format name. */
-jas_image_fmtinfo_t *jas_image_lookupfmtbyname(const char *name);
-
-/* Guess the format of an image file based on its name. */
-int jas_image_fmtfromname(char *filename);
-
-/* Get the format of image data in a stream. */
-int jas_image_getfmt(jas_stream_t *in);
-
-
-#define jas_image_cmprof(image) ((image)->cmprof_)
-int jas_image_ishomosamp(jas_image_t *image);
-int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno,
- jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs,
- jas_image_coord_t vs, int sgnd, int prec);
-int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x,
- jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
- long *buf);
-int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x,
- jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height,
- long *buf);
-
-#define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof)
-jas_image_t *jas_image_chclrspc(jas_image_t *image, jas_cmprof_t *outprof,
- int intent);
-void jas_image_dump(jas_image_t *image, FILE *out);
-
-/******************************************************************************\
-* Image format-dependent operations.
-\******************************************************************************/
-
-#if !defined(EXCLUDE_JPG_SUPPORT)
-/* Format-dependent operations for JPG support. */
-jas_image_t *jpg_decode(jas_stream_t *in, char *optstr);
-int jpg_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
-int jpg_validate(jas_stream_t *in);
-#endif
-
-#if !defined(EXCLUDE_MIF_SUPPORT)
-/* Format-dependent operations for MIF support. */
-jas_image_t *mif_decode(jas_stream_t *in, char *optstr);
-int mif_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
-int mif_validate(jas_stream_t *in);
-#endif
-
-#if !defined(EXCLUDE_PNM_SUPPORT)
-/* Format-dependent operations for PNM support. */
-jas_image_t *pnm_decode(jas_stream_t *in, char *optstr);
-int pnm_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
-int pnm_validate(jas_stream_t *in);
-#endif
-
-#if !defined(EXCLUDE_RAS_SUPPORT)
-/* Format-dependent operations for Sun Rasterfile support. */
-jas_image_t *ras_decode(jas_stream_t *in, char *optstr);
-int ras_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
-int ras_validate(jas_stream_t *in);
-#endif
-
-#if !defined(EXCLUDE_BMP_SUPPORT)
-/* Format-dependent operations for BMP support. */
-jas_image_t *bmp_decode(jas_stream_t *in, char *optstr);
-int bmp_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
-int bmp_validate(jas_stream_t *in);
-#endif
-
-#if !defined(EXCLUDE_JP2_SUPPORT)
-/* Format-dependent operations for JP2 support. */
-jas_image_t *jp2_decode(jas_stream_t *in, char *optstr);
-int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
-int jp2_validate(jas_stream_t *in);
-#endif
-
-#if !defined(EXCLUDE_JPC_SUPPORT)
-/* Format-dependent operations for JPEG-2000 code stream support. */
-jas_image_t *jpc_decode(jas_stream_t *in, char *optstr);
-int jpc_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
-int jpc_validate(jas_stream_t *in);
-#endif
-
-#if !defined(EXCLUDE_PGX_SUPPORT)
-/* Format-dependent operations for PGX support. */
-jas_image_t *pgx_decode(jas_stream_t *in, char *optstr);
-int pgx_encode(jas_image_t *image, jas_stream_t *out, char *optstr);
-int pgx_validate(jas_stream_t *in);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_init.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_init.h
deleted file mode 100644
index 16b99fe..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_init.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#ifndef JAS_INIT_H
-#define JAS_INIT_H
-
-#include <jasper/jas_config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Functions.
-\******************************************************************************/
-
-int jas_init(void);
-
-void jas_cleanup(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_malloc.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_malloc.h
deleted file mode 100644
index 5f05155..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_malloc.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Memory Allocator
- *
- * $Id$
- */
-
-#ifndef JAS_MALLOC_H
-#define JAS_MALLOC_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <jasper/jas_config.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Hack follows...
-\******************************************************************************/
-
-#if defined(DEBUG_MEMALLOC)
-/* This is somewhat of a hack, but it's a useful hack. :-) */
-/* Use my own custom memory allocator for debugging. */
-#include "../../../../local/src/memalloc.h"
-#define jas_malloc MEMALLOC
-#define jas_free MEMFREE
-#define jas_realloc MEMREALLOC
-#define jas_calloc MEMCALLOC
-#endif
-
-/******************************************************************************\
-* Functions.
-\******************************************************************************/
-
-#if !defined(DEBUG_MEMALLOC)
-
-/* Allocate memory. */
-void *jas_malloc(size_t size);
-
-/* Free memory. */
-void jas_free(void *ptr);
-
-/* Resize a block of allocated memory. */
-void *jas_realloc(void *ptr, size_t size);
-
-/* Allocate a block of memory and initialize the contents to zero. */
-void *jas_calloc(size_t nmemb, size_t size);
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_math.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_math.h
deleted file mode 100644
index 417c2b9..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_math.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Math-Related Code
- *
- * $Id$
- */
-
-#ifndef JAS_MATH_H
-#define JAS_MATH_H
-
-/******************************************************************************\
-* Includes
-\******************************************************************************/
-
-#include <jasper/jas_config.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Macros
-\******************************************************************************/
-
-/* Compute the absolute value. */
-#define JAS_ABS(x) \
- (((x) >= 0) ? (x) : (-(x)))
-
-/* Compute the minimum of two values. */
-#define JAS_MIN(x, y) \
- (((x) < (y)) ? (x) : (y))
-
-/* Compute the maximum of two values. */
-#define JAS_MAX(x, y) \
- (((x) > (y)) ? (x) : (y))
-
-/* Compute the remainder from division (where division is defined such
- that the remainder is always nonnegative). */
-#define JAS_MOD(x, y) \
- (((x) < 0) ? (((-x) % (y)) ? ((y) - ((-(x)) % (y))) : (0)) : ((x) % (y)))
-
-/* Compute the integer with the specified number of least significant bits
- set to one. */
-#define JAS_ONES(n) \
- ((1 << (n)) - 1)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_seq.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_seq.h
deleted file mode 100644
index 7ece8a8..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_seq.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Sequence/Matrix Library
- *
- * $Id$
- */
-
-#ifndef JAS_SEQ_H
-#define JAS_SEQ_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <jasper/jas_config.h>
-
-#include <jasper/jas_stream.h>
-#include <jasper/jas_types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Constants.
-\******************************************************************************/
-
-/* This matrix is a reference to another matrix. */
-#define JAS_MATRIX_REF 0x0001
-
-/******************************************************************************\
-* Types.
-\******************************************************************************/
-
-/* An element in a sequence. */
-typedef int_fast32_t jas_seqent_t;
-
-/* An element in a matrix. */
-typedef int_fast32_t jas_matent_t;
-
-/* Matrix. */
-
-typedef struct {
-
- /* Additional state information. */
- int flags_;
-
- /* The starting horizontal index. */
- int_fast32_t xstart_;
-
- /* The starting vertical index. */
- int_fast32_t ystart_;
-
- /* The ending horizontal index. */
- int_fast32_t xend_;
-
- /* The ending vertical index. */
- int_fast32_t yend_;
-
- /* The number of rows in the matrix. */
- int_fast32_t numrows_;
-
- /* The number of columns in the matrix. */
- int_fast32_t numcols_;
-
- /* Pointers to the start of each row. */
- jas_seqent_t **rows_;
-
- /* The allocated size of the rows array. */
- int_fast32_t maxrows_;
-
- /* The matrix data buffer. */
- jas_seqent_t *data_;
-
- /* The allocated size of the data array. */
- int_fast32_t datasize_;
-
-} jas_matrix_t;
-
-typedef jas_matrix_t jas_seq2d_t;
-typedef jas_matrix_t jas_seq_t;
-
-/******************************************************************************\
-* Functions/macros for matrix class.
-\******************************************************************************/
-
-/* Get the number of rows. */
-#define jas_matrix_numrows(matrix) \
- ((matrix)->numrows_)
-
-/* Get the number of columns. */
-#define jas_matrix_numcols(matrix) \
- ((matrix)->numcols_)
-
-/* Get a matrix element. */
-#define jas_matrix_get(matrix, i, j) \
- ((matrix)->rows_[i][j])
-
-/* Set a matrix element. */
-#define jas_matrix_set(matrix, i, j, v) \
- ((matrix)->rows_[i][j] = (v))
-
-/* Get an element from a matrix that is known to be a row or column vector. */
-#define jas_matrix_getv(matrix, i) \
- (((matrix)->numrows_ == 1) ? ((matrix)->rows_[0][i]) : \
- ((matrix)->rows_[i][0]))
-
-/* Set an element in a matrix that is known to be a row or column vector. */
-#define jas_matrix_setv(matrix, i, v) \
- (((matrix)->numrows_ == 1) ? ((matrix)->rows_[0][i] = (v)) : \
- ((matrix)->rows_[i][0] = (v)))
-
-/* Get the address of an element in a matrix. */
-#define jas_matrix_getref(matrix, i, j) \
- (&(matrix)->rows_[i][j])
-
-#define jas_matrix_getvref(matrix, i) \
- (((matrix)->numrows_ > 1) ? jas_matrix_getref(matrix, i, 0) : jas_matrix_getref(matrix, 0, i))
-
-#define jas_matrix_length(matrix) \
- (max((matrix)->numrows_, (matrix)->numcols_))
-
-/* Create a matrix with the specified dimensions. */
-jas_matrix_t *jas_matrix_create(int numrows, int numcols);
-
-/* Destroy a matrix. */
-void jas_matrix_destroy(jas_matrix_t *matrix);
-
-/* Resize a matrix. The previous contents of the matrix are lost. */
-int jas_matrix_resize(jas_matrix_t *matrix, int numrows, int numcols);
-
-int jas_matrix_output(jas_matrix_t *matrix, FILE *out);
-
-/* Create a matrix that references part of another matrix. */
-void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0,
- int r1, int c1);
-
-/* Create a matrix that is a reference to a row of another matrix. */
-#define jas_matrix_bindrow(mat0, mat1, r) \
- (jas_matrix_bindsub((mat0), (mat1), (r), 0, (r), (mat1)->numcols_ - 1))
-
-/* Create a matrix that is a reference to a column of another matrix. */
-#define jas_matrix_bindcol(mat0, mat1, c) \
- (jas_matrix_bindsub((mat0), (mat1), 0, (c), (mat1)->numrows_ - 1, (c)))
-
-/* Clip the values of matrix elements to the specified range. */
-void jas_matrix_clip(jas_matrix_t *matrix, jas_seqent_t minval,
- jas_seqent_t maxval);
-
-/* Arithmetic shift left of all elements in a matrix. */
-void jas_matrix_asl(jas_matrix_t *matrix, int n);
-
-/* Arithmetic shift right of all elements in a matrix. */
-void jas_matrix_asr(jas_matrix_t *matrix, int n);
-
-/* Almost-but-not-quite arithmetic shift right of all elements in a matrix. */
-void jas_matrix_divpow2(jas_matrix_t *matrix, int n);
-
-/* Set all elements of a matrix to the specified value. */
-void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val);
-
-/* The spacing between rows of a matrix. */
-#define jas_matrix_rowstep(matrix) \
- (((matrix)->numrows_ > 1) ? ((matrix)->rows_[1] - (matrix)->rows_[0]) : (0))
-
-/* The spacing between columns of a matrix. */
-#define jas_matrix_step(matrix) \
- (((matrix)->numrows_ > 1) ? (jas_matrix_rowstep(matrix)) : (1))
-
-/* Compare two matrices for equality. */
-int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1);
-
-jas_matrix_t *jas_matrix_copy(jas_matrix_t *x);
-
-jas_matrix_t *jas_matrix_input(FILE *);
-
-/******************************************************************************\
-* Functions/macros for 2-D sequence class.
-\******************************************************************************/
-
-jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x);
-
-jas_matrix_t *jas_seq2d_create(int xstart, int ystart, int xend, int yend);
-
-#define jas_seq2d_destroy(s) \
- jas_matrix_destroy(s)
-
-#define jas_seq2d_xstart(s) \
- ((s)->xstart_)
-#define jas_seq2d_ystart(s) \
- ((s)->ystart_)
-#define jas_seq2d_xend(s) \
- ((s)->xend_)
-#define jas_seq2d_yend(s) \
- ((s)->yend_)
-#define jas_seq2d_getref(s, x, y) \
- (jas_matrix_getref(s, (y) - (s)->ystart_, (x) - (s)->xstart_))
-#define jas_seq2d_get(s, x, y) \
- (jas_matrix_get(s, (y) - (s)->ystart_, (x) - (s)->xstart_))
-#define jas_seq2d_rowstep(s) \
- jas_matrix_rowstep(s)
-#define jas_seq2d_width(s) \
- ((s)->xend_ - (s)->xstart_)
-#define jas_seq2d_height(s) \
- ((s)->yend_ - (s)->ystart_)
-#define jas_seq2d_setshift(s, x, y) \
- ((s)->xstart_ = (x), (s)->ystart_ = (y), \
- (s)->xend_ = (s)->xstart_ + (s)->numcols_, \
- (s)->yend_ = (s)->ystart_ + (s)->numrows_)
-
-void jas_seq2d_bindsub(jas_matrix_t *s, jas_matrix_t *s1, int xstart,
- int ystart, int xend, int yend);
-
-/******************************************************************************\
-* Functions/macros for 1-D sequence class.
-\******************************************************************************/
-
-#define jas_seq_create(start, end) \
- (jas_seq2d_create(start, 0, end, 1))
-
-#define jas_seq_destroy(seq) \
- (jas_seq2d_destroy(seq))
-
-#define jas_seq_set(seq, i, v) \
- ((seq)->rows_[0][(i) - (seq)->xstart_] = (v))
-#define jas_seq_getref(seq, i) \
- (&(seq)->rows_[0][(i) - (seq)->xstart_])
-#define jas_seq_get(seq, i) \
- ((seq)->rows_[0][(i) - (seq)->xstart_])
-#define jas_seq_start(seq) \
- ((seq)->xstart_)
-#define jas_seq_end(seq) \
- ((seq)->xend_)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_stream.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_stream.h
deleted file mode 100644
index b45baa5..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_stream.h
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * I/O Stream Class
- *
- * $Id$
- */
-
-#ifndef JAS_STREAM_H
-#define JAS_STREAM_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <jasper/jas_config.h>
-
-#include <stdio.h>
-#if defined(HAVE_FCNTL_H)
-#include <fcntl.h>
-#endif
-#include <string.h>
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-#include <jasper/jas_types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Constants.
-\******************************************************************************/
-
-/* On most UNIX systems, we probably need to define O_BINARY ourselves. */
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-/*
- * Stream open flags.
- */
-
-/* The stream was opened for reading. */
-#define JAS_STREAM_READ 0x0001
-/* The stream was opened for writing. */
-#define JAS_STREAM_WRITE 0x0002
-/* The stream was opened for appending. */
-#define JAS_STREAM_APPEND 0x0004
-/* The stream was opened in binary mode. */
-#define JAS_STREAM_BINARY 0x0008
-/* The stream should be created/truncated. */
-#define JAS_STREAM_CREATE 0x0010
-
-
-/*
- * Stream buffering flags.
- */
-
-/* The stream is unbuffered. */
-#define JAS_STREAM_UNBUF 0x0000
-/* The stream is line buffered. */
-#define JAS_STREAM_LINEBUF 0x0001
-/* The stream is fully buffered. */
-#define JAS_STREAM_FULLBUF 0x0002
-/* The buffering mode mask. */
-#define JAS_STREAM_BUFMODEMASK 0x000f
-
-/* The memory associated with the buffer needs to be deallocated when the
- stream is destroyed. */
-#define JAS_STREAM_FREEBUF 0x0008
-/* The buffer is currently being used for reading. */
-#define JAS_STREAM_RDBUF 0x0010
-/* The buffer is currently being used for writing. */
-#define JAS_STREAM_WRBUF 0x0020
-
-/*
- * Stream error flags.
- */
-
-/* The end-of-file has been encountered (on reading). */
-#define JAS_STREAM_EOF 0x0001
-/* An I/O error has been encountered on the stream. */
-#define JAS_STREAM_ERR 0x0002
-/* The read/write limit has been exceeded. */
-#define JAS_STREAM_RWLIMIT 0x0004
-/* The error mask. */
-#define JAS_STREAM_ERRMASK \
- (JAS_STREAM_EOF | JAS_STREAM_ERR | JAS_STREAM_RWLIMIT)
-
-/*
- * Other miscellaneous constants.
- */
-
-/* The default buffer size (for fully-buffered operation). */
-#define JAS_STREAM_BUFSIZE 8192
-/* The default permission mask for file creation. */
-#define JAS_STREAM_PERMS 0666
-
-/* The maximum number of characters that can always be put back on a stream. */
-#define JAS_STREAM_MAXPUTBACK 16
-
-/******************************************************************************\
-* Types.
-\******************************************************************************/
-
-/*
- * Generic file object.
- */
-
-typedef void jas_stream_obj_t;
-
-/*
- * Generic file object operations.
- */
-
-typedef struct {
-
- /* Read characters from a file object. */
- int (*read_)(jas_stream_obj_t *obj, char *buf, int cnt);
-
- /* Write characters to a file object. */
- int (*write_)(jas_stream_obj_t *obj, char *buf, int cnt);
-
- /* Set the position for a file object. */
- long (*seek_)(jas_stream_obj_t *obj, long offset, int origin);
-
- /* Close a file object. */
- int (*close_)(jas_stream_obj_t *obj);
-
-} jas_stream_ops_t;
-
-/*
- * Stream object.
- */
-
-typedef struct {
-
- /* The mode in which the stream was opened. */
- int openmode_;
-
- /* The buffering mode. */
- int bufmode_;
-
- /* The stream status. */
- int flags_;
-
- /* The start of the buffer area to use for reading/writing. */
- uchar *bufbase_;
-
- /* The start of the buffer area excluding the extra initial space for
- character putback. */
- uchar *bufstart_;
-
- /* The buffer size. */
- int bufsize_;
-
- /* The current position in the buffer. */
- uchar *ptr_;
-
- /* The number of characters that must be read/written before
- the buffer needs to be filled/flushed. */
- int cnt_;
-
- /* A trivial buffer to be used for unbuffered operation. */
- uchar tinybuf_[JAS_STREAM_MAXPUTBACK + 1];
-
- /* The operations for the underlying stream file object. */
- jas_stream_ops_t *ops_;
-
- /* The underlying stream file object. */
- jas_stream_obj_t *obj_;
-
- /* The number of characters read/written. */
- long rwcnt_;
-
- /* The maximum number of characters that may be read/written. */
- long rwlimit_;
-
-} jas_stream_t;
-
-/*
- * Regular file object.
- */
-
-/*
- * File descriptor file object.
- */
-typedef struct {
- int fd;
- int flags;
- char pathname[L_tmpnam + 1];
-} jas_stream_fileobj_t;
-
-#define JAS_STREAM_FILEOBJ_DELONCLOSE 0x01
-#define JAS_STREAM_FILEOBJ_NOCLOSE 0x02
-
-/*
- * Memory file object.
- */
-
-typedef struct {
-
- /* The data associated with this file. */
- uchar *buf_;
-
- /* The allocated size of the buffer for holding file data. */
- int bufsize_;
-
- /* The length of the file. */
- int_fast32_t len_;
-
- /* The seek position. */
- int_fast32_t pos_;
-
- /* Is the buffer growable? */
- int growable_;
-
- /* Was the buffer allocated internally? */
- int myalloc_;
-
-} jas_stream_memobj_t;
-
-/******************************************************************************\
-* Macros/functions for opening and closing streams.
-\******************************************************************************/
-
-/* Open a file as a stream. */
-jas_stream_t *jas_stream_fopen(const char *filename, const char *mode);
-
-/* Open a memory buffer as a stream. */
-jas_stream_t *jas_stream_memopen(char *buf, int bufsize);
-
-/* Open a file descriptor as a stream. */
-jas_stream_t *jas_stream_fdopen(int fd, const char *mode);
-
-/* Open a stdio stream as a stream. */
-jas_stream_t *jas_stream_freopen(const char *path, const char *mode, FILE *fp);
-
-/* Open a temporary file as a stream. */
-jas_stream_t *jas_stream_tmpfile(void);
-
-/* Close a stream. */
-int jas_stream_close(jas_stream_t *stream);
-
-/******************************************************************************\
-* Macros/functions for getting/setting the stream state.
-\******************************************************************************/
-
-/* Get the EOF indicator for a stream. */
-#define jas_stream_eof(stream) \
- (((stream)->flags_ & JAS_STREAM_EOF) != 0)
-
-/* Get the error indicator for a stream. */
-#define jas_stream_error(stream) \
- (((stream)->flags_ & JAS_STREAM_ERR) != 0)
-
-/* Clear the error indicator for a stream. */
-#define jas_stream_clearerr(stream) \
- ((stream)->flags_ &= ~(JAS_STREAM_ERR | JAS_STREAM_EOF))
-
-/* Get the read/write limit for a stream. */
-#define jas_stream_getrwlimit(stream) \
- (((const jas_stream_t *)(stream))->rwlimit_)
-
-/* Set the read/write limit for a stream. */
-int jas_stream_setrwlimit(jas_stream_t *stream, long rwlimit);
-
-/* Get the read/write count for a stream. */
-#define jas_stream_getrwcount(stream) \
- (((const jas_stream_t *)(stream))->rwcnt_)
-
-/* Set the read/write count for a stream. */
-long jas_stream_setrwcount(jas_stream_t *stream, long rwcnt);
-
-/******************************************************************************\
-* Macros/functions for I/O.
-\******************************************************************************/
-
-/* Read a character from a stream. */
-#if defined(DEBUG)
-#define jas_stream_getc(stream) jas_stream_getc_func(stream)
-#else
-#define jas_stream_getc(stream) jas_stream_getc_macro(stream)
-#endif
-
-/* Write a character to a stream. */
-#if defined(DEBUG)
-#define jas_stream_putc(stream, c) jas_stream_putc_func(stream, c)
-#else
-#define jas_stream_putc(stream, c) jas_stream_putc_macro(stream, c)
-#endif
-
-/* Read characters from a stream into a buffer. */
-int jas_stream_read(jas_stream_t *stream, void *buf, int cnt);
-
-/* Write characters from a buffer to a stream. */
-int jas_stream_write(jas_stream_t *stream, const void *buf, int cnt);
-
-/* Write formatted output to a stream. */
-int jas_stream_printf(jas_stream_t *stream, const char *fmt, ...);
-
-/* Write a string to a stream. */
-int jas_stream_puts(jas_stream_t *stream, const char *s);
-
-/* Read a line of input from a stream. */
-char *jas_stream_gets(jas_stream_t *stream, char *buf, int bufsize);
-
-/* Look at the next character to be read from a stream without actually
- removing it from the stream. */
-#define jas_stream_peekc(stream) \
- (((stream)->cnt_ <= 0) ? jas_stream_fillbuf(stream, 0) : \
- ((int)(*(stream)->ptr_)))
-
-/* Put a character back on a stream. */
-int jas_stream_ungetc(jas_stream_t *stream, int c);
-
-/******************************************************************************\
-* Macros/functions for getting/setting the stream position.
-\******************************************************************************/
-
-/* Is it possible to seek on this stream? */
-int jas_stream_isseekable(jas_stream_t *stream);
-
-/* Set the current position within the stream. */
-long jas_stream_seek(jas_stream_t *stream, long offset, int origin);
-
-/* Get the current position within the stream. */
-long jas_stream_tell(jas_stream_t *stream);
-
-/* Seek to the beginning of a stream. */
-int jas_stream_rewind(jas_stream_t *stream);
-
-/******************************************************************************\
-* Macros/functions for flushing.
-\******************************************************************************/
-
-/* Flush any pending output to a stream. */
-int jas_stream_flush(jas_stream_t *stream);
-
-/******************************************************************************\
-* Miscellaneous macros/functions.
-\******************************************************************************/
-
-/* Copy data from one stream to another. */
-int jas_stream_copy(jas_stream_t *dst, jas_stream_t *src, int n);
-
-/* Display stream contents (for debugging purposes). */
-int jas_stream_display(jas_stream_t *stream, FILE *fp, int n);
-
-/* Consume (i.e., discard) characters from stream. */
-int jas_stream_gobble(jas_stream_t *stream, int n);
-
-/* Write a character multiple times to a stream. */
-int jas_stream_pad(jas_stream_t *stream, int n, int c);
-
-/* Get the size of the file associated with the specified stream.
- The specified stream must be seekable. */
-long jas_stream_length(jas_stream_t *stream);
-
-/******************************************************************************\
-* Internal functions.
-\******************************************************************************/
-
-/* The following functions are for internal use only! If you call them
-directly, you will die a horrible, miserable, and painful death! */
-
-/* Read a character from a stream. */
-#define jas_stream_getc_macro(stream) \
- ((!((stream)->flags_ & (JAS_STREAM_ERR | JAS_STREAM_EOF | \
- JAS_STREAM_RWLIMIT))) ? \
- (((stream)->rwlimit_ >= 0 && (stream)->rwcnt_ >= (stream)->rwlimit_) ? \
- (stream->flags_ |= JAS_STREAM_RWLIMIT, EOF) : \
- jas_stream_getc2(stream)) : EOF)
-#define jas_stream_getc2(stream) \
- ((--(stream)->cnt_ < 0) ? jas_stream_fillbuf(stream, 1) : \
- (++(stream)->rwcnt_, (int)(*(stream)->ptr_++)))
-
-/* Write a character to a stream. */
-#define jas_stream_putc_macro(stream, c) \
- ((!((stream)->flags_ & (JAS_STREAM_ERR | JAS_STREAM_EOF | \
- JAS_STREAM_RWLIMIT))) ? \
- (((stream)->rwlimit_ >= 0 && (stream)->rwcnt_ >= (stream)->rwlimit_) ? \
- (stream->flags_ |= JAS_STREAM_RWLIMIT, EOF) : \
- jas_stream_putc2(stream, c)) : EOF)
-#define jas_stream_putc2(stream, c) \
- (((stream)->bufmode_ |= JAS_STREAM_WRBUF, --(stream)->cnt_ < 0) ? \
- jas_stream_flushbuf((stream), (uchar)(c)) : \
- (++(stream)->rwcnt_, (int)(*(stream)->ptr_++ = (c))))
-
-/* These prototypes need to be here for the sake of the stream_getc and
-stream_putc macros. */
-int jas_stream_fillbuf(jas_stream_t *stream, int getflag);
-int jas_stream_flushbuf(jas_stream_t *stream, int c);
-int jas_stream_getc_func(jas_stream_t *stream);
-int jas_stream_putc_func(jas_stream_t *stream, int c);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_string.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_string.h
deleted file mode 100644
index c123253..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_string.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * String Library
- *
- * $Id$
- */
-
-#ifndef JAS_STRING_H
-#define JAS_STRING_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <jasper/jas_config.h>
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Functions.
-\******************************************************************************/
-
-/* Copy a string (a la strdup). */
-char *jas_strdup(const char *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_tmr.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_tmr.h
deleted file mode 100644
index 8b0de11..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_tmr.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2004 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#ifndef JAS_TMR_H
-#define JAS_TMR_H
-
-#include<time.h>
-#include <jasper/jas_config.h>
-#if defined(HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(HAVE_GETTIMEOFDAY)
-
-typedef struct {
- struct timeval start;
- struct timeval stop;
-} jas_tmr_t;
-
-#elif defined(HAVE_GETRUSAGE)
-
-typedef struct {
- struct rusage start;
- struct rusage stop;
-} jas_tmr_t;
-
-#else
-
-typedef int jas_tmr_t;
-
-#endif
-
-void jas_tmr_start(jas_tmr_t *tmr);
-void jas_tmr_stop(jas_tmr_t *tmr);
-double jas_tmr_get(jas_tmr_t *tmr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_tvp.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_tvp.h
deleted file mode 100644
index 1c0429d..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_tvp.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Tag/Value Parser
- *
- * $Id$
- */
-
-#ifndef JAS_TVP_H
-#define JAS_TVP_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <jasper/jas_config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Types.
-\******************************************************************************/
-
-/* Tag information type. */
-
-typedef struct {
-
- int id;
- /* The ID for the tag. */
-
- char *name;
- /* The name of the tag. */
-
-} jas_taginfo_t;
-
-/* Tag-value parser type. */
-
-typedef struct {
-
- char *buf;
- /* The parsing buffer. */
-
- char *tag;
- /* The current tag name. */
-
- char *val;
- /* The current value. */
-
- char *pos;
- /* The current position in the parsing buffer. */
-
-} jas_tvparser_t;
-
-/******************************************************************************\
-* Tag information functions.
-\******************************************************************************/
-
-/* Lookup a tag by name. */
-jas_taginfo_t *jas_taginfos_lookup(jas_taginfo_t *taginfos, const char *name);
-
-/* This function returns a pointer to the specified taginfo object if it
- exists (i.e., the pointer is nonnull); otherwise, a pointer to a dummy
- object is returned. This is useful in some situations to avoid checking
- for a null pointer. */
-jas_taginfo_t *jas_taginfo_nonull(jas_taginfo_t *taginfo);
-
-/******************************************************************************\
-* Tag-value parser functions.
-\******************************************************************************/
-
-/* Create a tag-value parser for the specified string. */
-jas_tvparser_t *jas_tvparser_create(const char *s);
-
-/* Destroy a tag-value parser. */
-void jas_tvparser_destroy(jas_tvparser_t *tvparser);
-
-/* Get the next tag-value pair. */
-int jas_tvparser_next(jas_tvparser_t *tvparser);
-
-/* Get the tag name for the current tag-value pair. */
-char *jas_tvparser_gettag(jas_tvparser_t *tvparser);
-
-/* Get the value for the current tag-value pair. */
-char *jas_tvparser_getval(jas_tvparser_t *tvparser);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_types.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_types.h
deleted file mode 100644
index 596e9f0..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_types.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Primitive Types
- *
- * $Id$
- */
-
-#ifndef JAS_TYPES_H
-#define JAS_TYPES_H
-
-#include <jasper/jas_config.h>
-
-#if !defined(JAS_CONFIGURE)
-
-#if defined(WIN32) || defined(HAVE_WINDOWS_H)
-/*
- We are dealing with Microsoft Windows and most likely Microsoft
- Visual C (MSVC). (Heaven help us.) Sadly, MSVC does not correctly
- define some of the standard types specified in ISO/IEC 9899:1999.
- In particular, it does not define the "long long" and "unsigned long
- long" types. So, we work around this problem by using the "INT64"
- and "UINT64" types that are defined in the header file "windows.h".
- */
-#include <windows.h>
-#undef longlong
-#define longlong INT64
-#undef ulonglong
-#define ulonglong UINT64
-#endif
-
-#endif
-
-#if defined(HAVE_STDLIB_H)
-#undef false
-#undef true
-#include <stdlib.h>
-#endif
-#if defined(HAVE_STDDEF_H)
-#include <stddef.h>
-#endif
-#if defined(HAVE_SYS_TYPES_H)
-#include <sys/types.h>
-#endif
-
-#ifndef __cplusplus
-#if defined(HAVE_STDBOOL_H)
-/*
- * The C language implementation does correctly provide the standard header
- * file "stdbool.h".
- */
-#include <stdbool.h>
-#else
-
-/*
- * The C language implementation does not provide the standard header file
- * "stdbool.h" as required by ISO/IEC 9899:1999. Try to compensate for this
- * braindamage below.
- */
-#if !defined(bool)
-#define bool int
-#endif
-#if !defined(true)
-#define true 1
-#endif
-#if !defined(false)
-#define false 0
-#endif
-#endif
-
-#endif
-
-#if defined(HAVE_STDINT_H)
-/*
- * The C language implementation does correctly provide the standard header
- * file "stdint.h".
- */
-#include <stdint.h>
-#else
-/*
- * The C language implementation does not provide the standard header file
- * "stdint.h" as required by ISO/IEC 9899:1999. Try to compensate for this
- * braindamage below.
- */
-#include <limits.h>
-/**********/
-#if !defined(INT_FAST8_MIN)
-typedef signed char int_fast8_t;
-#define INT_FAST8_MIN (-127)
-#define INT_FAST8_MAX 128
-#endif
-/**********/
-#if !defined(UINT_FAST8_MAX)
-typedef unsigned char uint_fast8_t;
-#define UINT_FAST8_MAX 255
-#endif
-/**********/
-#if !defined(INT_FAST16_MIN)
-typedef short int_fast16_t;
-#define INT_FAST16_MIN SHRT_MIN
-#define INT_FAST16_MAX SHRT_MAX
-#endif
-/**********/
-#if !defined(UINT_FAST16_MAX)
-typedef unsigned short uint_fast16_t;
-#define UINT_FAST16_MAX USHRT_MAX
-#endif
-/**********/
-#if !defined(INT_FAST32_MIN)
-typedef int int_fast32_t;
-#define INT_FAST32_MIN INT_MIN
-#define INT_FAST32_MAX INT_MAX
-#endif
-/**********/
-#if !defined(UINT_FAST32_MAX)
-typedef unsigned int uint_fast32_t;
-#define UINT_FAST32_MAX UINT_MAX
-#endif
-/**********/
-#if !defined(INT_FAST64_MIN)
-typedef longlong int_fast64_t;
-#define INT_FAST64_MIN LLONG_MIN
-#define INT_FAST64_MAX LLONG_MAX
-#endif
-/**********/
-#if !defined(UINT_FAST64_MAX)
-typedef ulonglong uint_fast64_t;
-#define UINT_FAST64_MAX ULLONG_MAX
-#endif
-/**********/
-#endif
-
-/* Hopefully, these macro definitions will fix more problems than they cause. */
-#if !defined(uchar)
-#define uchar unsigned char
-#endif
-#if !defined(ushort)
-#define ushort unsigned short
-#endif
-#if !defined(uint)
-#define uint unsigned int
-#endif
-#if !defined(ulong)
-#define ulong unsigned long
-#endif
-#if !defined(longlong)
-#define longlong long long
-#endif
-#if !defined(ulonglong)
-#define ulonglong unsigned long long
-#endif
-
-/* The below macro is intended to be used for type casts. By using this
- macro, type casts can be easily located in the source code with
- tools like "grep". */
-#define JAS_CAST(t, e) \
- ((t) (e))
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_version.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jas_version.h
deleted file mode 100644
index 004ecf1..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jas_version.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * $Id$
- */
-
-#ifndef JAS_VERSION_H
-#define JAS_VERSION_H
-
-#include <jasper/jas_config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************\
-* Constants and types.
-\******************************************************************************/
-
-#if !defined(JAS_VERSION)
-/* The version information below should match that specified in
- the "configure.in" file! */
-#define JAS_VERSION "unknown"
-#endif
-
-#define JAS_COPYRIGHT \
- "Copyright (c) 2001-2006 Michael David Adams.\n" \
- "Copyright (c) 1999-2000 Image Power, Inc. and the University of\n" \
- " British Columbia.\n" \
- "All rights reserved.\n"
-
-#define JAS_NOTES \
- "For more information about this software, please visit the following\n" \
- "web sites/pages:\n" \
- " http://www.ece.uvic.ca/~mdadams/jasper\n" \
- " http://www.jpeg.org/software\n" \
- "To be added to the (moderated) JasPer software announcements\n" \
- "mailing list, send an email to:\n" \
- " jasper-announce-subscribe@yahoogroups.com\n" \
- "To be added to the (unmoderated) JasPer software discussion\n" \
- "mailing list, send an email to:\n" \
- " jasper-discussion-subscribe@yahoogroups.com\n" \
- "Please send any bug reports to:\n" \
- " mdadams@ieee.org\n"
-
-/******************************************************************************\
-* Functions.
-\******************************************************************************/
-
-const char *jas_getversion(void);
-/* Get the version information for the JasPer library. */
-/* Note: Since libjasper can be built as a shared library, the version
- returned by this function may not necessarily correspond to JAS_VERSION. */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/include/jasper/jasper.h b/src/3rdparty/jasper/src/libjasper/include/jasper/jasper.h
deleted file mode 100644
index 9edfcb0..0000000
--- a/src/3rdparty/jasper/src/libjasper/include/jasper/jasper.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#ifndef JAS_JASPER_H
-#define JAS_JASPER_H
-
-#include <jasper/jas_config.h>
-#include <jasper/jas_types.h>
-#include <jasper/jas_version.h>
-
-#include <jasper/jas_init.h>
-#include <jasper/jas_cm.h>
-#include <jasper/jas_icc.h>
-#include <jasper/jas_fix.h>
-#include <jasper/jas_debug.h>
-#include <jasper/jas_getopt.h>
-#include <jasper/jas_image.h>
-#include <jasper/jas_icc.h>
-#include <jasper/jas_math.h>
-#include <jasper/jas_malloc.h>
-#include <jasper/jas_seq.h>
-#include <jasper/jas_stream.h>
-#include <jasper/jas_string.h>
-#include <jasper/jas_tmr.h>
-#include <jasper/jas_tvp.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/jp2/jp2_cod.c b/src/3rdparty/jasper/src/libjasper/jp2/jp2_cod.c
deleted file mode 100644
index 3f09eed..0000000
--- a/src/3rdparty/jasper/src/libjasper/jp2/jp2_cod.c
+++ /dev/null
@@ -1,921 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * JP2 Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include "jasper/jas_stream.h"
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_debug.h"
-
-#include "jp2_cod.h"
-
-/******************************************************************************\
-* Function prototypes.
-\******************************************************************************/
-
-#define ONES(n) ((1 << (n)) - 1)
-
-jp2_boxinfo_t *jp2_boxinfolookup(int type);
-
-static int jp2_getuint8(jas_stream_t *in, uint_fast8_t *val);
-static int jp2_getuint16(jas_stream_t *in, uint_fast16_t *val);
-static int jp2_getuint32(jas_stream_t *in, uint_fast32_t *val);
-static int jp2_getuint64(jas_stream_t *in, uint_fast64_t *val);
-static int jp2_putuint8(jas_stream_t *out, uint_fast8_t val);
-static int jp2_putuint16(jas_stream_t *out, uint_fast16_t val);
-static int jp2_putuint32(jas_stream_t *out, uint_fast32_t val);
-static int jp2_putuint64(jas_stream_t *out, uint_fast64_t val);
-
-static int jp2_getint(jas_stream_t *in, int s, int n, int_fast32_t *val);
-
-jp2_box_t *jp2_box_get(jas_stream_t *in);
-void jp2_box_dump(jp2_box_t *box, FILE *out);
-
-static int jp2_jp_getdata(jp2_box_t *box, jas_stream_t *in);
-static int jp2_jp_putdata(jp2_box_t *box, jas_stream_t *out);
-static int jp2_ftyp_getdata(jp2_box_t *box, jas_stream_t *in);
-static int jp2_ftyp_putdata(jp2_box_t *box, jas_stream_t *out);
-static int jp2_ihdr_getdata(jp2_box_t *box, jas_stream_t *in);
-static int jp2_ihdr_putdata(jp2_box_t *box, jas_stream_t *out);
-static void jp2_bpcc_destroy(jp2_box_t *box);
-static int jp2_bpcc_getdata(jp2_box_t *box, jas_stream_t *in);
-static int jp2_bpcc_putdata(jp2_box_t *box, jas_stream_t *out);
-static int jp2_colr_getdata(jp2_box_t *box, jas_stream_t *in);
-static int jp2_colr_putdata(jp2_box_t *box, jas_stream_t *out);
-static void jp2_colr_dumpdata(jp2_box_t *box, FILE *out);
-static void jp2_colr_destroy(jp2_box_t *box);
-static void jp2_cdef_destroy(jp2_box_t *box);
-static int jp2_cdef_getdata(jp2_box_t *box, jas_stream_t *in);
-static int jp2_cdef_putdata(jp2_box_t *box, jas_stream_t *out);
-static void jp2_cdef_dumpdata(jp2_box_t *box, FILE *out);
-static void jp2_cmap_destroy(jp2_box_t *box);
-static int jp2_cmap_getdata(jp2_box_t *box, jas_stream_t *in);
-static int jp2_cmap_putdata(jp2_box_t *box, jas_stream_t *out);
-static void jp2_cmap_dumpdata(jp2_box_t *box, FILE *out);
-static void jp2_pclr_destroy(jp2_box_t *box);
-static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in);
-static int jp2_pclr_putdata(jp2_box_t *box, jas_stream_t *out);
-static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out);
-
-/******************************************************************************\
-* Local data.
-\******************************************************************************/
-
-jp2_boxinfo_t jp2_boxinfos[] = {
- {JP2_BOX_JP, "JP", 0,
- {0, 0, jp2_jp_getdata, jp2_jp_putdata, 0}},
- {JP2_BOX_FTYP, "FTYP", 0,
- {0, 0, jp2_ftyp_getdata, jp2_ftyp_putdata, 0}},
- {JP2_BOX_JP2H, "JP2H", JP2_BOX_SUPER,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_IHDR, "IHDR", 0,
- {0, 0, jp2_ihdr_getdata, jp2_ihdr_putdata, 0}},
- {JP2_BOX_BPCC, "BPCC", 0,
- {0, jp2_bpcc_destroy, jp2_bpcc_getdata, jp2_bpcc_putdata, 0}},
- {JP2_BOX_COLR, "COLR", 0,
- {0, jp2_colr_destroy, jp2_colr_getdata, jp2_colr_putdata, jp2_colr_dumpdata}},
- {JP2_BOX_PCLR, "PCLR", 0,
- {0, jp2_pclr_destroy, jp2_pclr_getdata, jp2_pclr_putdata, jp2_pclr_dumpdata}},
- {JP2_BOX_CMAP, "CMAP", 0,
- {0, jp2_cmap_destroy, jp2_cmap_getdata, jp2_cmap_putdata, jp2_cmap_dumpdata}},
- {JP2_BOX_CDEF, "CDEF", 0,
- {0, jp2_cdef_destroy, jp2_cdef_getdata, jp2_cdef_putdata, jp2_cdef_dumpdata}},
- {JP2_BOX_RES, "RES", JP2_BOX_SUPER,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_RESC, "RESC", 0,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_RESD, "RESD", 0,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_JP2C, "JP2C", JP2_BOX_NODATA,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_JP2I, "JP2I", 0,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_XML, "XML", 0,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_UUID, "UUID", 0,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_UINF, "UINF", JP2_BOX_SUPER,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_ULST, "ULST", 0,
- {0, 0, 0, 0, 0}},
- {JP2_BOX_URL, "URL", 0,
- {0, 0, 0, 0, 0}},
- {0, 0, 0, {0, 0, 0, 0, 0}},
-};
-
-jp2_boxinfo_t jp2_boxinfo_unk = {
- 0, "Unknown", 0, {0, 0, 0, 0, 0}
-};
-
-/******************************************************************************\
-* Box constructor.
-\******************************************************************************/
-
-jp2_box_t *jp2_box_create(int type)
-{
- jp2_box_t *box;
- jp2_boxinfo_t *boxinfo;
-
- if (!(box = jas_malloc(sizeof(jp2_box_t)))) {
- return 0;
- }
- memset(box, 0, sizeof(jp2_box_t));
- box->type = type;
- box->len = 0;
- if (!(boxinfo = jp2_boxinfolookup(type))) {
- return 0;
- }
- box->info = boxinfo;
- box->ops = &boxinfo->ops;
- return box;
-}
-
-/******************************************************************************\
-* Box destructor.
-\******************************************************************************/
-
-void jp2_box_destroy(jp2_box_t *box)
-{
- if (box->ops->destroy) {
- (*box->ops->destroy)(box);
- }
- jas_free(box);
-}
-
-static void jp2_bpcc_destroy(jp2_box_t *box)
-{
- jp2_bpcc_t *bpcc = &box->data.bpcc;
- if (bpcc->bpcs) {
- jas_free(bpcc->bpcs);
- bpcc->bpcs = 0;
- }
-}
-
-static void jp2_cdef_destroy(jp2_box_t *box)
-{
- jp2_cdef_t *cdef = &box->data.cdef;
- if (cdef->ents) {
- jas_free(cdef->ents);
- cdef->ents = 0;
- }
-}
-
-/******************************************************************************\
-* Box input.
-\******************************************************************************/
-
-jp2_box_t *jp2_box_get(jas_stream_t *in)
-{
- jp2_box_t *box;
- jp2_boxinfo_t *boxinfo;
- jas_stream_t *tmpstream;
- uint_fast32_t len;
- uint_fast64_t extlen;
- bool dataflag;
-
- box = 0;
- tmpstream = 0;
-
- if (!(box = jas_malloc(sizeof(jp2_box_t)))) {
- goto error;
- }
- box->ops = &jp2_boxinfo_unk.ops;
- if (jp2_getuint32(in, &len) || jp2_getuint32(in, &box->type)) {
- goto error;
- }
- boxinfo = jp2_boxinfolookup(box->type);
- box->info = boxinfo;
- box->ops = &boxinfo->ops;
- box->len = len;
- if (box->len == 1) {
- if (jp2_getuint64(in, &extlen)) {
- goto error;
- }
- if (extlen > 0xffffffffUL) {
- jas_eprintf("warning: cannot handle large 64-bit box length\n");
- extlen = 0xffffffffUL;
- }
- box->len = extlen;
- box->datalen = extlen - JP2_BOX_HDRLEN(true);
- } else {
- box->datalen = box->len - JP2_BOX_HDRLEN(false);
- }
- if (box->len != 0 && box->len < 8) {
- goto error;
- }
-
- dataflag = !(box->info->flags & (JP2_BOX_SUPER | JP2_BOX_NODATA));
-
- if (dataflag) {
- if (!(tmpstream = jas_stream_memopen(0, 0))) {
- goto error;
- }
- if (jas_stream_copy(tmpstream, in, box->datalen)) {
- jas_eprintf("cannot copy box data\n");
- goto error;
- }
- jas_stream_rewind(tmpstream);
-
- if (box->ops->getdata) {
- if ((*box->ops->getdata)(box, tmpstream)) {
- jas_eprintf("cannot parse box data\n");
- goto error;
- }
- }
- jas_stream_close(tmpstream);
- }
-
- if (jas_getdbglevel() >= 1) {
- jp2_box_dump(box, stderr);
- }
-
- return box;
- abort();
-
-error:
- if (box) {
- jp2_box_destroy(box);
- }
- if (tmpstream) {
- jas_stream_close(tmpstream);
- }
- return 0;
-}
-
-void jp2_box_dump(jp2_box_t *box, FILE *out)
-{
- jp2_boxinfo_t *boxinfo;
- boxinfo = jp2_boxinfolookup(box->type);
- assert(boxinfo);
-
- fprintf(out, "JP2 box: ");
- fprintf(out, "type=%c%s%c (0x%08x); length=%d\n", '"', boxinfo->name,
- '"', box->type, box->len);
- if (box->ops->dumpdata) {
- (*box->ops->dumpdata)(box, out);
- }
-}
-
-static int jp2_jp_getdata(jp2_box_t *box, jas_stream_t *in)
-{
- jp2_jp_t *jp = &box->data.jp;
- if (jp2_getuint32(in, &jp->magic)) {
- return -1;
- }
- return 0;
-}
-
-static int jp2_ftyp_getdata(jp2_box_t *box, jas_stream_t *in)
-{
- jp2_ftyp_t *ftyp = &box->data.ftyp;
- unsigned int i;
- if (jp2_getuint32(in, &ftyp->majver) || jp2_getuint32(in, &ftyp->minver)) {
- return -1;
- }
- ftyp->numcompatcodes = (box->datalen - 8) / 4;
- if (ftyp->numcompatcodes > JP2_FTYP_MAXCOMPATCODES) {
- return -1;
- }
- for (i = 0; i < ftyp->numcompatcodes; ++i) {
- if (jp2_getuint32(in, &ftyp->compatcodes[i])) {
- return -1;
- }
- }
- return 0;
-}
-
-static int jp2_ihdr_getdata(jp2_box_t *box, jas_stream_t *in)
-{
- jp2_ihdr_t *ihdr = &box->data.ihdr;
- if (jp2_getuint32(in, &ihdr->height) || jp2_getuint32(in, &ihdr->width) ||
- jp2_getuint16(in, &ihdr->numcmpts) || jp2_getuint8(in, &ihdr->bpc) ||
- jp2_getuint8(in, &ihdr->comptype) || jp2_getuint8(in, &ihdr->csunk) ||
- jp2_getuint8(in, &ihdr->ipr)) {
- return -1;
- }
- return 0;
-}
-
-static int jp2_bpcc_getdata(jp2_box_t *box, jas_stream_t *in)
-{
- jp2_bpcc_t *bpcc = &box->data.bpcc;
- unsigned int i;
- bpcc->numcmpts = box->datalen;
- if (!(bpcc->bpcs = jas_malloc(bpcc->numcmpts * sizeof(uint_fast8_t)))) {
- return -1;
- }
- for (i = 0; i < bpcc->numcmpts; ++i) {
- if (jp2_getuint8(in, &bpcc->bpcs[i])) {
- return -1;
- }
- }
- return 0;
-}
-
-static void jp2_colr_dumpdata(jp2_box_t *box, FILE *out)
-{
- jp2_colr_t *colr = &box->data.colr;
- fprintf(out, "method=%d; pri=%d; approx=%d\n", (int)colr->method, (int)colr->pri, (int)colr->approx);
- switch (colr->method) {
- case JP2_COLR_ENUM:
- fprintf(out, "csid=%d\n", (int)colr->csid);
- break;
- case JP2_COLR_ICC:
- jas_memdump(out, colr->iccp, colr->iccplen);
- break;
- }
-}
-
-static int jp2_colr_getdata(jp2_box_t *box, jas_stream_t *in)
-{
- jp2_colr_t *colr = &box->data.colr;
- colr->csid = 0;
- colr->iccp = 0;
- colr->iccplen = 0;
-
- if (jp2_getuint8(in, &colr->method) || jp2_getuint8(in, &colr->pri) ||
- jp2_getuint8(in, &colr->approx)) {
- return -1;
- }
- switch (colr->method) {
- case JP2_COLR_ENUM:
- if (jp2_getuint32(in, &colr->csid)) {
- return -1;
- }
- break;
- case JP2_COLR_ICC:
- colr->iccplen = box->datalen - 3;
- if (!(colr->iccp = jas_malloc(colr->iccplen * sizeof(uint_fast8_t)))) {
- return -1;
- }
- if (jas_stream_read(in, colr->iccp, colr->iccplen) != colr->iccplen) {
- return -1;
- }
- break;
- }
- return 0;
-}
-
-static void jp2_cdef_dumpdata(jp2_box_t *box, FILE *out)
-{
- jp2_cdef_t *cdef = &box->data.cdef;
- unsigned int i;
- for (i = 0; i < cdef->numchans; ++i) {
- fprintf(out, "channo=%d; type=%d; assoc=%d\n",
- cdef->ents[i].channo, cdef->ents[i].type, cdef->ents[i].assoc);
- }
-}
-
-static void jp2_colr_destroy(jp2_box_t *box)
-{
- jp2_colr_t *colr = &box->data.colr;
- if (colr->iccp) {
- jas_free(colr->iccp);
- }
-}
-
-static int jp2_cdef_getdata(jp2_box_t *box, jas_stream_t *in)
-{
- jp2_cdef_t *cdef = &box->data.cdef;
- jp2_cdefchan_t *chan;
- unsigned int channo;
- if (jp2_getuint16(in, &cdef->numchans)) {
- return -1;
- }
- if (!(cdef->ents = jas_malloc(cdef->numchans * sizeof(jp2_cdefchan_t)))) {
- return -1;
- }
- for (channo = 0; channo < cdef->numchans; ++channo) {
- chan = &cdef->ents[channo];
- if (jp2_getuint16(in, &chan->channo) || jp2_getuint16(in, &chan->type) ||
- jp2_getuint16(in, &chan->assoc)) {
- return -1;
- }
- }
- return 0;
-}
-
-/******************************************************************************\
-* Box output.
-\******************************************************************************/
-
-int jp2_box_put(jp2_box_t *box, jas_stream_t *out)
-{
- jas_stream_t *tmpstream;
- bool extlen;
- bool dataflag;
-
- tmpstream = 0;
-
- dataflag = !(box->info->flags & (JP2_BOX_SUPER | JP2_BOX_NODATA));
-
- if (dataflag) {
- tmpstream = jas_stream_memopen(0, 0);
- if (box->ops->putdata) {
- if ((*box->ops->putdata)(box, tmpstream)) {
- goto error;
- }
- }
- box->len = jas_stream_tell(tmpstream) + JP2_BOX_HDRLEN(false);
- jas_stream_rewind(tmpstream);
- }
- extlen = (box->len >= (((uint_fast64_t)1) << 32)) != 0;
- if (jp2_putuint32(out, extlen ? 1 : box->len)) {
- goto error;
- }
- if (jp2_putuint32(out, box->type)) {
- goto error;
- }
- if (extlen) {
- if (jp2_putuint64(out, box->len)) {
- goto error;
- }
- }
-
- if (dataflag) {
- if (jas_stream_copy(out, tmpstream, box->len - JP2_BOX_HDRLEN(false))) {
- goto error;
- }
- jas_stream_close(tmpstream);
- }
-
- return 0;
- abort();
-
-error:
-
- if (tmpstream) {
- jas_stream_close(tmpstream);
- }
- return -1;
-}
-
-static int jp2_jp_putdata(jp2_box_t *box, jas_stream_t *out)
-{
- jp2_jp_t *jp = &box->data.jp;
- if (jp2_putuint32(out, jp->magic)) {
- return -1;
- }
- return 0;
-}
-
-static int jp2_ftyp_putdata(jp2_box_t *box, jas_stream_t *out)
-{
- jp2_ftyp_t *ftyp = &box->data.ftyp;
- unsigned int i;
- if (jp2_putuint32(out, ftyp->majver) || jp2_putuint32(out, ftyp->minver)) {
- return -1;
- }
- for (i = 0; i < ftyp->numcompatcodes; ++i) {
- if (jp2_putuint32(out, ftyp->compatcodes[i])) {
- return -1;
- }
- }
- return 0;
-}
-
-static int jp2_ihdr_putdata(jp2_box_t *box, jas_stream_t *out)
-{
- jp2_ihdr_t *ihdr = &box->data.ihdr;
- if (jp2_putuint32(out, ihdr->height) || jp2_putuint32(out, ihdr->width) ||
- jp2_putuint16(out, ihdr->numcmpts) || jp2_putuint8(out, ihdr->bpc) ||
- jp2_putuint8(out, ihdr->comptype) || jp2_putuint8(out, ihdr->csunk) ||
- jp2_putuint8(out, ihdr->ipr)) {
- return -1;
- }
- return 0;
-}
-
-static int jp2_bpcc_putdata(jp2_box_t *box, jas_stream_t *out)
-{
- jp2_bpcc_t *bpcc = &box->data.bpcc;
- unsigned int i;
- for (i = 0; i < bpcc->numcmpts; ++i) {
- if (jp2_putuint8(out, bpcc->bpcs[i])) {
- return -1;
- }
- }
- return 0;
-}
-
-static int jp2_colr_putdata(jp2_box_t *box, jas_stream_t *out)
-{
- jp2_colr_t *colr = &box->data.colr;
- if (jp2_putuint8(out, colr->method) || jp2_putuint8(out, colr->pri) ||
- jp2_putuint8(out, colr->approx)) {
- return -1;
- }
- switch (colr->method) {
- case JP2_COLR_ENUM:
- if (jp2_putuint32(out, colr->csid)) {
- return -1;
- }
- break;
- case JP2_COLR_ICC:
- if (jas_stream_write(out, colr->iccp,
- JAS_CAST(int, colr->iccplen)) != JAS_CAST(int, colr->iccplen))
- return -1;
- break;
- }
- return 0;
-}
-
-static int jp2_cdef_putdata(jp2_box_t *box, jas_stream_t *out)
-{
- jp2_cdef_t *cdef = &box->data.cdef;
- unsigned int i;
- jp2_cdefchan_t *ent;
-
- if (jp2_putuint16(out, cdef->numchans)) {
- return -1;
- }
-
- for (i = 0; i < cdef->numchans; ++i) {
- ent = &cdef->ents[i];
- if (jp2_putuint16(out, ent->channo) ||
- jp2_putuint16(out, ent->type) ||
- jp2_putuint16(out, ent->assoc)) {
- return -1;
- }
- }
- return 0;
-}
-
-/******************************************************************************\
-* Input operations for primitive types.
-\******************************************************************************/
-
-static int jp2_getuint8(jas_stream_t *in, uint_fast8_t *val)
-{
- int c;
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- if (val) {
- *val = c;
- }
- return 0;
-}
-
-static int jp2_getuint16(jas_stream_t *in, uint_fast16_t *val)
-{
- uint_fast16_t v;
- int c;
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- v = c;
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- v = (v << 8) | c;
- if (val) {
- *val = v;
- }
- return 0;
-}
-
-static int jp2_getuint32(jas_stream_t *in, uint_fast32_t *val)
-{
- uint_fast32_t v;
- int c;
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- v = c;
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- v = (v << 8) | c;
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- v = (v << 8) | c;
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- v = (v << 8) | c;
- if (val) {
- *val = v;
- }
- return 0;
-}
-
-static int jp2_getuint64(jas_stream_t *in, uint_fast64_t *val)
-{
- uint_fast64_t tmpval;
- int i;
- int c;
-
- tmpval = 0;
- for (i = 0; i < 8; ++i) {
- tmpval <<= 8;
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- tmpval |= (c & 0xff);
- }
- *val = tmpval;
-
- return 0;
-}
-
-/******************************************************************************\
-* Output operations for primitive types.
-\******************************************************************************/
-
-static int jp2_putuint8(jas_stream_t *out, uint_fast8_t val)
-{
- if (jas_stream_putc(out, val & 0xff) == EOF) {
- return -1;
- }
- return 0;
-}
-
-static int jp2_putuint16(jas_stream_t *out, uint_fast16_t val)
-{
- if (jas_stream_putc(out, (val >> 8) & 0xff) == EOF ||
- jas_stream_putc(out, val & 0xff) == EOF) {
- return -1;
- }
- return 0;
-}
-
-static int jp2_putuint32(jas_stream_t *out, uint_fast32_t val)
-{
- if (jas_stream_putc(out, (val >> 24) & 0xff) == EOF ||
- jas_stream_putc(out, (val >> 16) & 0xff) == EOF ||
- jas_stream_putc(out, (val >> 8) & 0xff) == EOF ||
- jas_stream_putc(out, val & 0xff) == EOF) {
- return -1;
- }
- return 0;
-}
-
-static int jp2_putuint64(jas_stream_t *out, uint_fast64_t val)
-{
- if (jp2_putuint32(out, (val >> 32) & 0xffffffffUL) ||
- jp2_putuint32(out, val & 0xffffffffUL)) {
- return -1;
- }
- return 0;
-}
-
-/******************************************************************************\
-* Miscellaneous code.
-\******************************************************************************/
-
-jp2_boxinfo_t *jp2_boxinfolookup(int type)
-{
- jp2_boxinfo_t *boxinfo;
- for (boxinfo = jp2_boxinfos; boxinfo->name; ++boxinfo) {
- if (boxinfo->type == type) {
- return boxinfo;
- }
- }
- return &jp2_boxinfo_unk;
-}
-
-
-
-
-
-static void jp2_cmap_destroy(jp2_box_t *box)
-{
- jp2_cmap_t *cmap = &box->data.cmap;
- if (cmap->ents) {
- jas_free(cmap->ents);
- }
-}
-
-static int jp2_cmap_getdata(jp2_box_t *box, jas_stream_t *in)
-{
- jp2_cmap_t *cmap = &box->data.cmap;
- jp2_cmapent_t *ent;
- unsigned int i;
-
- cmap->numchans = (box->datalen) / 4;
- if (!(cmap->ents = jas_malloc(cmap->numchans * sizeof(jp2_cmapent_t)))) {
- return -1;
- }
- for (i = 0; i < cmap->numchans; ++i) {
- ent = &cmap->ents[i];
- if (jp2_getuint16(in, &ent->cmptno) ||
- jp2_getuint8(in, &ent->map) ||
- jp2_getuint8(in, &ent->pcol)) {
- return -1;
- }
- }
-
- return 0;
-}
-
-static int jp2_cmap_putdata(jp2_box_t *box, jas_stream_t *out)
-{
- /* Eliminate compiler warning about unused variables. */
- box = 0;
- out = 0;
-
- return -1;
-}
-
-static void jp2_cmap_dumpdata(jp2_box_t *box, FILE *out)
-{
- jp2_cmap_t *cmap = &box->data.cmap;
- unsigned int i;
- jp2_cmapent_t *ent;
- fprintf(out, "numchans = %d\n", (int) cmap->numchans);
- for (i = 0; i < cmap->numchans; ++i) {
- ent = &cmap->ents[i];
- fprintf(out, "cmptno=%d; map=%d; pcol=%d\n",
- (int) ent->cmptno, (int) ent->map, (int) ent->pcol);
- }
-}
-
-static void jp2_pclr_destroy(jp2_box_t *box)
-{
- jp2_pclr_t *pclr = &box->data.pclr;
- if (pclr->lutdata) {
- jas_free(pclr->lutdata);
- }
- if (pclr->bpc)
- jas_free(pclr->bpc);
-}
-
-static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in)
-{
- jp2_pclr_t *pclr = &box->data.pclr;
- int lutsize;
- unsigned int i;
- unsigned int j;
- int_fast32_t x;
-
- pclr->lutdata = 0;
-
- if (jp2_getuint16(in, &pclr->numlutents) ||
- jp2_getuint8(in, &pclr->numchans)) {
- return -1;
- }
- lutsize = pclr->numlutents * pclr->numchans;
- if (!(pclr->lutdata = jas_malloc(lutsize * sizeof(int_fast32_t)))) {
- return -1;
- }
- if (!(pclr->bpc = jas_malloc(pclr->numchans * sizeof(uint_fast8_t)))) {
- return -1;
- }
- for (i = 0; i < pclr->numchans; ++i) {
- if (jp2_getuint8(in, &pclr->bpc[i])) {
- return -1;
- }
- }
- for (i = 0; i < pclr->numlutents; ++i) {
- for (j = 0; j < pclr->numchans; ++j) {
- if (jp2_getint(in, (pclr->bpc[j] & 0x80) != 0,
- (pclr->bpc[j] & 0x7f) + 1, &x)) {
- return -1;
- }
- pclr->lutdata[i * pclr->numchans + j] = x;
- }
- }
- return 0;
-}
-
-static int jp2_pclr_putdata(jp2_box_t *box, jas_stream_t *out)
-{
-#if 0
- jp2_pclr_t *pclr = &box->data.pclr;
-#endif
-/* Eliminate warning about unused variable. */
-box = 0;
-out = 0;
- return -1;
-}
-
-static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out)
-{
- jp2_pclr_t *pclr = &box->data.pclr;
- unsigned int i;
- int j;
- fprintf(out, "numents=%d; numchans=%d\n", (int) pclr->numlutents,
- (int) pclr->numchans);
- for (i = 0; i < pclr->numlutents; ++i) {
- for (j = 0; j < pclr->numchans; ++j) {
- fprintf(out, "LUT[%d][%d]=%d\n", i, j, pclr->lutdata[i * pclr->numchans + j]);
- }
- }
-}
-
-static int jp2_getint(jas_stream_t *in, int s, int n, int_fast32_t *val)
-{
- int c;
- int i;
- uint_fast32_t v;
- int m;
-
- m = (n + 7) / 8;
-
- v = 0;
- for (i = 0; i < m; ++i) {
- if ((c = jas_stream_getc(in)) == EOF) {
- return -1;
- }
- v = (v << 8) | c;
- }
- v &= ONES(n);
- if (s) {
- int sb;
- sb = v & (1 << (8 * m - 1));
- *val = ((~v) + 1) & ONES(8 * m);
- if (sb) {
- *val = -*val;
- }
- } else {
- *val = v;
- }
-
- return 0;
-}
-
-jp2_cdefchan_t *jp2_cdef_lookup(jp2_cdef_t *cdef, int channo)
-{
- unsigned int i;
- jp2_cdefchan_t *cdefent;
- for (i = 0; i < cdef->numchans; ++i) {
- cdefent = &cdef->ents[i];
- if (cdefent->channo == JAS_CAST(unsigned int, channo)) {
- return cdefent;
- }
- }
- return 0;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/jp2/jp2_cod.h b/src/3rdparty/jasper/src/libjasper/jp2/jp2_cod.h
deleted file mode 100644
index 9699d49..0000000
--- a/src/3rdparty/jasper/src/libjasper/jp2/jp2_cod.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * JP2 Library
- *
- * $Id$
- */
-
-#ifndef JP2_COD_H
-#define JP2_COD_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include "jasper/jas_types.h"
-
-/******************************************************************************\
-* Macros.
-\******************************************************************************/
-
-#define JP2_SPTOBPC(s, p) \
- ((((p) - 1) & 0x7f) | (((s) & 1) << 7))
-
-/******************************************************************************\
-* Box class.
-\******************************************************************************/
-
-#define JP2_BOX_HDRLEN(ext) ((ext) ? 16 : 8)
-
-/* Box types. */
-#define JP2_BOX_JP 0x6a502020 /* Signature */
-#define JP2_BOX_FTYP 0x66747970 /* File Type */
-#define JP2_BOX_JP2H 0x6a703268 /* JP2 Header */
-#define JP2_BOX_IHDR 0x69686472 /* Image Header */
-#define JP2_BOX_BPCC 0x62706363 /* Bits Per Component */
-#define JP2_BOX_COLR 0x636f6c72 /* Color Specification */
-#define JP2_BOX_PCLR 0x70636c72 /* Palette */
-#define JP2_BOX_CMAP 0x636d6170 /* Component Mapping */
-#define JP2_BOX_CDEF 0x63646566 /* Channel Definition */
-#define JP2_BOX_RES 0x72657320 /* Resolution */
-#define JP2_BOX_RESC 0x72657363 /* Capture Resolution */
-#define JP2_BOX_RESD 0x72657364 /* Default Display Resolution */
-#define JP2_BOX_JP2C 0x6a703263 /* Contiguous Code Stream */
-#define JP2_BOX_JP2I 0x6a703269 /* Intellectual Property */
-#define JP2_BOX_XML 0x786d6c20 /* XML */
-#define JP2_BOX_UUID 0x75756964 /* UUID */
-#define JP2_BOX_UINF 0x75696e66 /* UUID Info */
-#define JP2_BOX_ULST 0x75637374 /* UUID List */
-#define JP2_BOX_URL 0x75726c20 /* URL */
-
-#define JP2_BOX_SUPER 0x01
-#define JP2_BOX_NODATA 0x02
-
-/* JP box data. */
-
-#define JP2_JP_MAGIC 0x0d0a870a
-#define JP2_JP_LEN 12
-
-typedef struct {
- uint_fast32_t magic;
-} jp2_jp_t;
-
-/* FTYP box data. */
-
-#define JP2_FTYP_MAXCOMPATCODES 32
-#define JP2_FTYP_MAJVER 0x6a703220
-#define JP2_FTYP_MINVER 0
-#define JP2_FTYP_COMPATCODE JP2_FTYP_MAJVER
-
-typedef struct {
- uint_fast32_t majver;
- uint_fast32_t minver;
- uint_fast32_t numcompatcodes;
- uint_fast32_t compatcodes[JP2_FTYP_MAXCOMPATCODES];
-} jp2_ftyp_t;
-
-/* IHDR box data. */
-
-#define JP2_IHDR_COMPTYPE 7
-#define JP2_IHDR_BPCNULL 255
-
-typedef struct {
- uint_fast32_t width;
- uint_fast32_t height;
- uint_fast16_t numcmpts;
- uint_fast8_t bpc;
- uint_fast8_t comptype;
- uint_fast8_t csunk;
- uint_fast8_t ipr;
-} jp2_ihdr_t;
-
-/* BPCC box data. */
-
-typedef struct {
- uint_fast16_t numcmpts;
- uint_fast8_t *bpcs;
-} jp2_bpcc_t;
-
-/* COLR box data. */
-
-#define JP2_COLR_ENUM 1
-#define JP2_COLR_ICC 2
-#define JP2_COLR_PRI 0
-
-#define JP2_COLR_SRGB 16
-#define JP2_COLR_SGRAY 17
-#define JP2_COLR_SYCC 18
-
-typedef struct {
- uint_fast8_t method;
- uint_fast8_t pri;
- uint_fast8_t approx;
- uint_fast32_t csid;
- uint_fast8_t *iccp;
- int iccplen;
- /* XXX - Someday we ought to add ICC profile data here. */
-} jp2_colr_t;
-
-/* PCLR box data. */
-
-typedef struct {
- uint_fast16_t numlutents;
- uint_fast8_t numchans;
- int_fast32_t *lutdata;
- uint_fast8_t *bpc;
-} jp2_pclr_t;
-
-/* CDEF box per-channel data. */
-
-#define JP2_CDEF_RGB_R 1
-#define JP2_CDEF_RGB_G 2
-#define JP2_CDEF_RGB_B 3
-
-#define JP2_CDEF_YCBCR_Y 1
-#define JP2_CDEF_YCBCR_CB 2
-#define JP2_CDEF_YCBCR_CR 3
-
-#define JP2_CDEF_GRAY_Y 1
-
-#define JP2_CDEF_TYPE_COLOR 0
-#define JP2_CDEF_TYPE_OPACITY 1
-#define JP2_CDEF_TYPE_UNSPEC 65535
-#define JP2_CDEF_ASOC_ALL 0
-#define JP2_CDEF_ASOC_NONE 65535
-
-typedef struct {
- uint_fast16_t channo;
- uint_fast16_t type;
- uint_fast16_t assoc;
-} jp2_cdefchan_t;
-
-/* CDEF box data. */
-
-typedef struct {
- uint_fast16_t numchans;
- jp2_cdefchan_t *ents;
-} jp2_cdef_t;
-
-typedef struct {
- uint_fast16_t cmptno;
- uint_fast8_t map;
- uint_fast8_t pcol;
-} jp2_cmapent_t;
-
-typedef struct {
- uint_fast16_t numchans;
- jp2_cmapent_t *ents;
-} jp2_cmap_t;
-
-#define JP2_CMAP_DIRECT 0
-#define JP2_CMAP_PALETTE 1
-
-/* Generic box. */
-
-struct jp2_boxops_s;
-typedef struct {
-
- struct jp2_boxops_s *ops;
- struct jp2_boxinfo_s *info;
-
- uint_fast32_t type;
-
- /* The length of the box including the (variable-length) header. */
- uint_fast32_t len;
-
- /* The length of the box data. */
- uint_fast32_t datalen;
-
- union {
- jp2_jp_t jp;
- jp2_ftyp_t ftyp;
- jp2_ihdr_t ihdr;
- jp2_bpcc_t bpcc;
- jp2_colr_t colr;
- jp2_pclr_t pclr;
- jp2_cdef_t cdef;
- jp2_cmap_t cmap;
- } data;
-
-} jp2_box_t;
-
-typedef struct jp2_boxops_s {
- void (*init)(jp2_box_t *box);
- void (*destroy)(jp2_box_t *box);
- int (*getdata)(jp2_box_t *box, jas_stream_t *in);
- int (*putdata)(jp2_box_t *box, jas_stream_t *out);
- void (*dumpdata)(jp2_box_t *box, FILE *out);
-} jp2_boxops_t;
-
-/******************************************************************************\
-*
-\******************************************************************************/
-
-typedef struct jp2_boxinfo_s {
- int type;
- char *name;
- int flags;
- jp2_boxops_t ops;
-} jp2_boxinfo_t;
-
-/******************************************************************************\
-* Box class.
-\******************************************************************************/
-
-jp2_box_t *jp2_box_create(int type);
-void jp2_box_destroy(jp2_box_t *box);
-jp2_box_t *jp2_box_get(jas_stream_t *in);
-int jp2_box_put(jp2_box_t *box, jas_stream_t *out);
-
-#define JP2_DTYPETOBPC(dtype) \
- ((JAS_IMAGE_CDT_GETSGND(dtype) << 7) | (JAS_IMAGE_CDT_GETPREC(dtype) - 1))
-#define JP2_BPCTODTYPE(bpc) \
- (JAS_IMAGE_CDT_SETSGND(bpc >> 7) | JAS_IMAGE_CDT_SETPREC((bpc & 0x7f) + 1))
-
-#define ICC_CS_RGB 0x52474220
-#define ICC_CS_YCBCR 0x59436272
-#define ICC_CS_GRAY 0x47524159
-
-jp2_cdefchan_t *jp2_cdef_lookup(jp2_cdef_t *cdef, int channo);
-
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/jp2/jp2_dec.c b/src/3rdparty/jasper/src/libjasper/jp2/jp2_dec.c
deleted file mode 100644
index b11b881..0000000
--- a/src/3rdparty/jasper/src/libjasper/jp2/jp2_dec.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * JP2 Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include "jasper/jas_image.h"
-#include "jasper/jas_stream.h"
-#include "jasper/jas_math.h"
-#include "jasper/jas_debug.h"
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_version.h"
-
-#include "jp2_cod.h"
-#include "jp2_dec.h"
-
-#define JP2_VALIDATELEN (JAS_MIN(JP2_JP_LEN + 16, JAS_STREAM_MAXPUTBACK))
-
-static jp2_dec_t *jp2_dec_create(void);
-static void jp2_dec_destroy(jp2_dec_t *dec);
-static int jp2_getcs(jp2_colr_t *colr);
-static int fromiccpcs(int cs);
-static int jp2_getct(int colorspace, int type, int assoc);
-
-/******************************************************************************\
-* Functions.
-\******************************************************************************/
-
-jas_image_t *jp2_decode(jas_stream_t *in, char *optstr)
-{
- jp2_box_t *box;
- int found;
- jas_image_t *image;
- jp2_dec_t *dec;
- bool samedtype;
- int dtype;
- unsigned int i;
- jp2_cmap_t *cmapd;
- jp2_pclr_t *pclrd;
- jp2_cdef_t *cdefd;
- unsigned int channo;
- int newcmptno;
- int_fast32_t *lutents;
-#if 0
- jp2_cdefchan_t *cdefent;
- int cmptno;
-#endif
- jp2_cmapent_t *cmapent;
- jas_icchdr_t icchdr;
- jas_iccprof_t *iccprof;
-
- dec = 0;
- box = 0;
- image = 0;
-
- if (!(dec = jp2_dec_create())) {
- goto error;
- }
-
- /* Get the first box. This should be a JP box. */
- if (!(box = jp2_box_get(in))) {
- jas_eprintf("error: cannot get box\n");
- goto error;
- }
- if (box->type != JP2_BOX_JP) {
- jas_eprintf("error: expecting signature box\n");
- goto error;
- }
- if (box->data.jp.magic != JP2_JP_MAGIC) {
- jas_eprintf("incorrect magic number\n");
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
-
- /* Get the second box. This should be a FTYP box. */
- if (!(box = jp2_box_get(in))) {
- goto error;
- }
- if (box->type != JP2_BOX_FTYP) {
- jas_eprintf("expecting file type box\n");
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
-
- /* Get more boxes... */
- found = 0;
- while ((box = jp2_box_get(in))) {
- if (jas_getdbglevel() >= 1) {
- jas_eprintf("box type %s\n", box->info->name);
- }
- switch (box->type) {
- case JP2_BOX_JP2C:
- found = 1;
- break;
- case JP2_BOX_IHDR:
- if (!dec->ihdr) {
- dec->ihdr = box;
- box = 0;
- }
- break;
- case JP2_BOX_BPCC:
- if (!dec->bpcc) {
- dec->bpcc = box;
- box = 0;
- }
- break;
- case JP2_BOX_CDEF:
- if (!dec->cdef) {
- dec->cdef = box;
- box = 0;
- }
- break;
- case JP2_BOX_PCLR:
- if (!dec->pclr) {
- dec->pclr = box;
- box = 0;
- }
- break;
- case JP2_BOX_CMAP:
- if (!dec->cmap) {
- dec->cmap = box;
- box = 0;
- }
- break;
- case JP2_BOX_COLR:
- if (!dec->colr) {
- dec->colr = box;
- box = 0;
- }
- break;
- }
- if (box) {
- jp2_box_destroy(box);
- box = 0;
- }
- if (found) {
- break;
- }
- }
-
- if (!found) {
- jas_eprintf("error: no code stream found\n");
- goto error;
- }
-
- if (!(dec->image = jpc_decode(in, optstr))) {
- jas_eprintf("error: cannot decode code stream\n");
- goto error;
- }
-
- /* An IHDR box must be present. */
- if (!dec->ihdr) {
- jas_eprintf("error: missing IHDR box\n");
- goto error;
- }
-
- /* Does the number of components indicated in the IHDR box match
- the value specified in the code stream? */
- if (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(uint, jas_image_numcmpts(dec->image))) {
- jas_eprintf("warning: number of components mismatch\n");
- }
-
- /* At least one component must be present. */
- if (!jas_image_numcmpts(dec->image)) {
- jas_eprintf("error: no components\n");
- goto error;
- }
-
- /* Determine if all components have the same data type. */
- samedtype = true;
- dtype = jas_image_cmptdtype(dec->image, 0);
- for (i = 1; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
- if (jas_image_cmptdtype(dec->image, i) != dtype) {
- samedtype = false;
- break;
- }
- }
-
- /* Is the component data type indicated in the IHDR box consistent
- with the data in the code stream? */
- if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||
- (!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {
- jas_eprintf("warning: component data type mismatch\n");
- }
-
- /* Is the compression type supported? */
- if (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {
- jas_eprintf("error: unsupported compression type\n");
- goto error;
- }
-
- if (dec->bpcc) {
- /* Is the number of components indicated in the BPCC box
- consistent with the code stream data? */
- if (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(uint, jas_image_numcmpts(
- dec->image))) {
- jas_eprintf("warning: number of components mismatch\n");
- }
- /* Is the component data type information indicated in the BPCC
- box consistent with the code stream data? */
- if (!samedtype) {
- for (i = 0; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
- if (jas_image_cmptdtype(dec->image, i) != JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {
- jas_eprintf("warning: component data type mismatch\n");
- }
- }
- } else {
- jas_eprintf("warning: superfluous BPCC box\n");
- }
- }
-
- /* A COLR box must be present. */
- if (!dec->colr) {
- jas_eprintf("error: no COLR box\n");
- goto error;
- }
-
- switch (dec->colr->data.colr.method) {
- case JP2_COLR_ENUM:
- jas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));
- break;
- case JP2_COLR_ICC:
- iccprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,
- dec->colr->data.colr.iccplen);
- assert(iccprof);
- jas_iccprof_gethdr(iccprof, &icchdr);
- jas_eprintf("ICC Profile CS %08x\n", icchdr.colorspc);
- jas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));
- dec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);
- assert(dec->image->cmprof_);
- jas_iccprof_destroy(iccprof);
- break;
- }
-
- /* If a CMAP box is present, a PCLR box must also be present. */
- if (dec->cmap && !dec->pclr) {
- jas_eprintf("warning: missing PCLR box or superfluous CMAP box\n");
- jp2_box_destroy(dec->cmap);
- dec->cmap = 0;
- }
-
- /* If a CMAP box is not present, a PCLR box must not be present. */
- if (!dec->cmap && dec->pclr) {
- jas_eprintf("warning: missing CMAP box or superfluous PCLR box\n");
- jp2_box_destroy(dec->pclr);
- dec->pclr = 0;
- }
-
- /* Determine the number of channels (which is essentially the number
- of components after any palette mappings have been applied). */
- dec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans : JAS_CAST(uint, jas_image_numcmpts(dec->image));
-
- /* Perform a basic sanity check on the CMAP box if present. */
- if (dec->cmap) {
- for (i = 0; i < dec->numchans; ++i) {
- /* Is the component number reasonable? */
- if (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(uint, jas_image_numcmpts(dec->image))) {
- jas_eprintf("error: invalid component number in CMAP box\n");
- goto error;
- }
- /* Is the LUT index reasonable? */
- if (dec->cmap->data.cmap.ents[i].pcol >= dec->pclr->data.pclr.numchans) {
- jas_eprintf("error: invalid CMAP LUT index\n");
- goto error;
- }
- }
- }
-
- /* Allocate space for the channel-number to component-number LUT. */
- if (!(dec->chantocmptlut = jas_malloc(dec->numchans * sizeof(uint_fast16_t)))) {
- jas_eprintf("error: no memory\n");
- goto error;
- }
-
- if (!dec->cmap) {
- for (i = 0; i < dec->numchans; ++i) {
- dec->chantocmptlut[i] = i;
- }
- } else {
- cmapd = &dec->cmap->data.cmap;
- pclrd = &dec->pclr->data.pclr;
- cdefd = &dec->cdef->data.cdef;
- for (channo = 0; channo < cmapd->numchans; ++channo) {
- cmapent = &cmapd->ents[channo];
- if (cmapent->map == JP2_CMAP_DIRECT) {
- dec->chantocmptlut[channo] = channo;
- } else if (cmapent->map == JP2_CMAP_PALETTE) {
- lutents = jas_malloc(pclrd->numlutents * sizeof(int_fast32_t));
- for (i = 0; i < pclrd->numlutents; ++i) {
- lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];
- }
- newcmptno = jas_image_numcmpts(dec->image);
- jas_image_depalettize(dec->image, cmapent->cmptno, pclrd->numlutents, lutents, JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);
- dec->chantocmptlut[channo] = newcmptno;
- jas_free(lutents);
-#if 0
- if (dec->cdef) {
- cdefent = jp2_cdef_lookup(cdefd, channo);
- if (!cdefent) {
- abort();
- }
- jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));
- } else {
- jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));
- }
-#endif
- }
- }
- }
-
- /* Mark all components as being of unknown type. */
-
- for (i = 0; i < JAS_CAST(uint, jas_image_numcmpts(dec->image)); ++i) {
- jas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);
- }
-
- /* Determine the type of each component. */
- if (dec->cdef) {
- for (i = 0; i < dec->numchans; ++i) {
- jas_image_setcmpttype(dec->image,
- dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],
- jp2_getct(jas_image_clrspc(dec->image),
- dec->cdef->data.cdef.ents[i].type, dec->cdef->data.cdef.ents[i].assoc));
- }
- } else {
- for (i = 0; i < dec->numchans; ++i) {
- jas_image_setcmpttype(dec->image, dec->chantocmptlut[i],
- jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));
- }
- }
-
- /* Delete any components that are not of interest. */
- for (i = jas_image_numcmpts(dec->image); i > 0; --i) {
- if (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {
- jas_image_delcmpt(dec->image, i - 1);
- }
- }
-
- /* Ensure that some components survived. */
- if (!jas_image_numcmpts(dec->image)) {
- jas_eprintf("error: no components\n");
- goto error;
- }
-#if 0
-jas_eprintf("no of components is %d\n", jas_image_numcmpts(dec->image));
-#endif
-
- /* Prevent the image from being destroyed later. */
- image = dec->image;
- dec->image = 0;
-
- jp2_dec_destroy(dec);
-
- return image;
-
-error:
- if (box) {
- jp2_box_destroy(box);
- }
- if (dec) {
- jp2_dec_destroy(dec);
- }
- return 0;
-}
-
-int jp2_validate(jas_stream_t *in)
-{
- char buf[JP2_VALIDATELEN];
- int i;
- int n;
-#if 0
- jas_stream_t *tmpstream;
- jp2_box_t *box;
-#endif
-
- assert(JAS_STREAM_MAXPUTBACK >= JP2_VALIDATELEN);
-
- /* Read the validation data (i.e., the data used for detecting
- the format). */
- if ((n = jas_stream_read(in, buf, JP2_VALIDATELEN)) < 0) {
- return -1;
- }
-
- /* Put the validation data back onto the stream, so that the
- stream position will not be changed. */
- for (i = n - 1; i >= 0; --i) {
- if (jas_stream_ungetc(in, buf[i]) == EOF) {
- return -1;
- }
- }
-
- /* Did we read enough data? */
- if (n < JP2_VALIDATELEN) {
- return -1;
- }
-
- /* Is the box type correct? */
- if (((buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7]) !=
- JP2_BOX_JP)
- {
- return -1;
- }
-
- return 0;
-}
-
-static jp2_dec_t *jp2_dec_create(void)
-{
- jp2_dec_t *dec;
-
- if (!(dec = jas_malloc(sizeof(jp2_dec_t)))) {
- return 0;
- }
- dec->ihdr = 0;
- dec->bpcc = 0;
- dec->cdef = 0;
- dec->pclr = 0;
- dec->image = 0;
- dec->chantocmptlut = 0;
- dec->cmap = 0;
- dec->colr = 0;
- return dec;
-}
-
-static void jp2_dec_destroy(jp2_dec_t *dec)
-{
- if (dec->ihdr) {
- jp2_box_destroy(dec->ihdr);
- }
- if (dec->bpcc) {
- jp2_box_destroy(dec->bpcc);
- }
- if (dec->cdef) {
- jp2_box_destroy(dec->cdef);
- }
- if (dec->pclr) {
- jp2_box_destroy(dec->pclr);
- }
- if (dec->image) {
- jas_image_destroy(dec->image);
- }
- if (dec->cmap) {
- jp2_box_destroy(dec->cmap);
- }
- if (dec->colr) {
- jp2_box_destroy(dec->colr);
- }
- if (dec->chantocmptlut) {
- jas_free(dec->chantocmptlut);
- }
- jas_free(dec);
-}
-
-static int jp2_getct(int colorspace, int type, int assoc)
-{
- if (type == 1 && assoc == 0) {
- return JAS_IMAGE_CT_OPACITY;
- }
- if (type == 0 && assoc >= 1 && assoc <= 65534) {
- switch (colorspace) {
- case JAS_CLRSPC_FAM_RGB:
- switch (assoc) {
- case JP2_CDEF_RGB_R:
- return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R);
- break;
- case JP2_CDEF_RGB_G:
- return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G);
- break;
- case JP2_CDEF_RGB_B:
- return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B);
- break;
- }
- break;
- case JAS_CLRSPC_FAM_YCBCR:
- switch (assoc) {
- case JP2_CDEF_YCBCR_Y:
- return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_Y);
- break;
- case JP2_CDEF_YCBCR_CB:
- return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CB);
- break;
- case JP2_CDEF_YCBCR_CR:
- return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CR);
- break;
- }
- break;
- case JAS_CLRSPC_FAM_GRAY:
- switch (assoc) {
- case JP2_CDEF_GRAY_Y:
- return JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y);
- break;
- }
- break;
- default:
- return JAS_IMAGE_CT_COLOR(assoc - 1);
- break;
- }
- }
- return JAS_IMAGE_CT_UNKNOWN;
-}
-
-static int jp2_getcs(jp2_colr_t *colr)
-{
- if (colr->method == JP2_COLR_ENUM) {
- switch (colr->csid) {
- case JP2_COLR_SRGB:
- return JAS_CLRSPC_SRGB;
- break;
- case JP2_COLR_SYCC:
- return JAS_CLRSPC_SYCBCR;
- break;
- case JP2_COLR_SGRAY:
- return JAS_CLRSPC_SGRAY;
- break;
- }
- }
- return JAS_CLRSPC_UNKNOWN;
-}
-
-static int fromiccpcs(int cs)
-{
- switch (cs) {
- case ICC_CS_RGB:
- return JAS_CLRSPC_GENRGB;
- break;
- case ICC_CS_YCBCR:
- return JAS_CLRSPC_GENYCBCR;
- break;
- case ICC_CS_GRAY:
- return JAS_CLRSPC_GENGRAY;
- break;
- }
- return JAS_CLRSPC_UNKNOWN;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/jp2/jp2_dec.h b/src/3rdparty/jasper/src/libjasper/jp2/jp2_dec.h
deleted file mode 100644
index 63fe6e0..0000000
--- a/src/3rdparty/jasper/src/libjasper/jp2/jp2_dec.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-#ifndef JP2_DEC_H
-#define JP2_DEC_H
-
-#include "jasper/jas_image.h"
-#include "jasper/jas_stream.h"
-#include "jp2_cod.h"
-
-typedef struct {
-
- jp2_box_t *pclr;
- jp2_box_t *cdef;
- jp2_box_t *ihdr;
- jp2_box_t *bpcc;
- jp2_box_t *cmap;
- jp2_box_t *colr;
- jas_image_t *image;
- uint_fast16_t numchans;
- uint_fast16_t *chantocmptlut;
-
-} jp2_dec_t;
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/jp2/jp2_enc.c b/src/3rdparty/jasper/src/libjasper/jp2/jp2_enc.c
deleted file mode 100644
index d9c25ce..0000000
--- a/src/3rdparty/jasper/src/libjasper/jp2/jp2_enc.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * JP2 Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <assert.h>
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_image.h"
-#include "jasper/jas_stream.h"
-#include "jasper/jas_cm.h"
-#include "jasper/jas_icc.h"
-#include "jp2_cod.h"
-
-static uint_fast32_t jp2_gettypeasoc(int colorspace, int ctype);
-static int clrspctojp2(jas_clrspc_t clrspc);
-
-/******************************************************************************\
-* Functions.
-\******************************************************************************/
-
-int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr)
-{
- jp2_box_t *box;
- jp2_ftyp_t *ftyp;
- jp2_ihdr_t *ihdr;
- jas_stream_t *tmpstream;
- int allcmptssame;
- jp2_bpcc_t *bpcc;
- long len;
- uint_fast16_t cmptno;
- jp2_colr_t *colr;
- char buf[4096];
- uint_fast32_t overhead;
- jp2_cdefchan_t *cdefchanent;
- jp2_cdef_t *cdef;
- int i;
- uint_fast32_t typeasoc;
-jas_iccprof_t *iccprof;
-jas_stream_t *iccstream;
-int pos;
-int needcdef;
-int prec;
-int sgnd;
-
- box = 0;
- tmpstream = 0;
-
- allcmptssame = 1;
- sgnd = jas_image_cmptsgnd(image, 0);
- prec = jas_image_cmptprec(image, 0);
- for (i = 1; i < jas_image_numcmpts(image); ++i) {
- if (jas_image_cmptsgnd(image, i) != sgnd ||
- jas_image_cmptprec(image, i) != prec) {
- allcmptssame = 0;
- break;
- }
- }
-
- /* Output the signature box. */
-
- if (!(box = jp2_box_create(JP2_BOX_JP))) {
- goto error;
- }
- box->data.jp.magic = JP2_JP_MAGIC;
- if (jp2_box_put(box, out)) {
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
-
- /* Output the file type box. */
-
- if (!(box = jp2_box_create(JP2_BOX_FTYP))) {
- goto error;
- }
- ftyp = &box->data.ftyp;
- ftyp->majver = JP2_FTYP_MAJVER;
- ftyp->minver = JP2_FTYP_MINVER;
- ftyp->numcompatcodes = 1;
- ftyp->compatcodes[0] = JP2_FTYP_COMPATCODE;
- if (jp2_box_put(box, out)) {
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
-
- /*
- * Generate the data portion of the JP2 header box.
- * We cannot simply output the header for this box
- * since we do not yet know the correct value for the length
- * field.
- */
-
- if (!(tmpstream = jas_stream_memopen(0, 0))) {
- goto error;
- }
-
- /* Generate image header box. */
-
- if (!(box = jp2_box_create(JP2_BOX_IHDR))) {
- goto error;
- }
- ihdr = &box->data.ihdr;
- ihdr->width = jas_image_width(image);
- ihdr->height = jas_image_height(image);
- ihdr->numcmpts = jas_image_numcmpts(image);
- ihdr->bpc = allcmptssame ? JP2_SPTOBPC(jas_image_cmptsgnd(image, 0),
- jas_image_cmptprec(image, 0)) : JP2_IHDR_BPCNULL;
- ihdr->comptype = JP2_IHDR_COMPTYPE;
- ihdr->csunk = 0;
- ihdr->ipr = 0;
- if (jp2_box_put(box, tmpstream)) {
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
-
- /* Generate bits per component box. */
-
- if (!allcmptssame) {
- if (!(box = jp2_box_create(JP2_BOX_BPCC))) {
- goto error;
- }
- bpcc = &box->data.bpcc;
- bpcc->numcmpts = jas_image_numcmpts(image);
- if (!(bpcc->bpcs = jas_malloc(bpcc->numcmpts *
- sizeof(uint_fast8_t)))) {
- goto error;
- }
- for (cmptno = 0; cmptno < bpcc->numcmpts; ++cmptno) {
- bpcc->bpcs[cmptno] = JP2_SPTOBPC(jas_image_cmptsgnd(image,
- cmptno), jas_image_cmptprec(image, cmptno));
- }
- if (jp2_box_put(box, tmpstream)) {
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
- }
-
- /* Generate color specification box. */
-
- if (!(box = jp2_box_create(JP2_BOX_COLR))) {
- goto error;
- }
- colr = &box->data.colr;
- switch (jas_image_clrspc(image)) {
- case JAS_CLRSPC_SRGB:
- case JAS_CLRSPC_SYCBCR:
- case JAS_CLRSPC_SGRAY:
- colr->method = JP2_COLR_ENUM;
- colr->csid = clrspctojp2(jas_image_clrspc(image));
- colr->pri = JP2_COLR_PRI;
- colr->approx = 0;
- break;
- default:
- colr->method = JP2_COLR_ICC;
- colr->pri = JP2_COLR_PRI;
- colr->approx = 0;
- iccprof = jas_iccprof_createfromcmprof(jas_image_cmprof(image));
- assert(iccprof);
- iccstream = jas_stream_memopen(0, 0);
- assert(iccstream);
- if (jas_iccprof_save(iccprof, iccstream))
- abort();
- if ((pos = jas_stream_tell(iccstream)) < 0)
- abort();
- colr->iccplen = pos;
- colr->iccp = jas_malloc(pos);
- assert(colr->iccp);
- jas_stream_rewind(iccstream);
- if (jas_stream_read(iccstream, colr->iccp, colr->iccplen) != colr->iccplen)
- abort();
- jas_stream_close(iccstream);
- jas_iccprof_destroy(iccprof);
- break;
- }
- if (jp2_box_put(box, tmpstream)) {
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
-
- needcdef = 1;
- switch (jas_clrspc_fam(jas_image_clrspc(image))) {
- case JAS_CLRSPC_FAM_RGB:
- if (jas_image_cmpttype(image, 0) ==
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R) &&
- jas_image_cmpttype(image, 1) ==
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G) &&
- jas_image_cmpttype(image, 2) ==
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B))
- needcdef = 0;
- break;
- case JAS_CLRSPC_FAM_YCBCR:
- if (jas_image_cmpttype(image, 0) ==
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_Y) &&
- jas_image_cmpttype(image, 1) ==
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CB) &&
- jas_image_cmpttype(image, 2) ==
- JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_YCBCR_CR))
- needcdef = 0;
- break;
- case JAS_CLRSPC_FAM_GRAY:
- if (jas_image_cmpttype(image, 0) ==
- JAS_IMAGE_CT_COLOR(JAS_IMAGE_CT_GRAY_Y))
- needcdef = 0;
- break;
- default:
- abort();
- break;
- }
-
- if (needcdef) {
- if (!(box = jp2_box_create(JP2_BOX_CDEF))) {
- goto error;
- }
- cdef = &box->data.cdef;
- cdef->numchans = jas_image_numcmpts(image);
- cdef->ents = jas_malloc(cdef->numchans * sizeof(jp2_cdefchan_t));
- for (i = 0; i < jas_image_numcmpts(image); ++i) {
- cdefchanent = &cdef->ents[i];
- cdefchanent->channo = i;
- typeasoc = jp2_gettypeasoc(jas_image_clrspc(image), jas_image_cmpttype(image, i));
- cdefchanent->type = typeasoc >> 16;
- cdefchanent->assoc = typeasoc & 0x7fff;
- }
- if (jp2_box_put(box, tmpstream)) {
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
- }
-
- /* Determine the total length of the JP2 header box. */
-
- len = jas_stream_tell(tmpstream);
- jas_stream_rewind(tmpstream);
-
- /*
- * Output the JP2 header box and all of the boxes which it contains.
- */
-
- if (!(box = jp2_box_create(JP2_BOX_JP2H))) {
- goto error;
- }
- box->len = len + JP2_BOX_HDRLEN(false);
- if (jp2_box_put(box, out)) {
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
-
- if (jas_stream_copy(out, tmpstream, len)) {
- goto error;
- }
-
- jas_stream_close(tmpstream);
- tmpstream = 0;
-
- /*
- * Output the contiguous code stream box.
- */
-
- if (!(box = jp2_box_create(JP2_BOX_JP2C))) {
- goto error;
- }
- box->len = 0;
- if (jp2_box_put(box, out)) {
- goto error;
- }
- jp2_box_destroy(box);
- box = 0;
-
- /* Output the JPEG-2000 code stream. */
-
- overhead = jas_stream_getrwcount(out);
- sprintf(buf, "%s\n_jp2overhead=%lu\n", (optstr ? optstr : ""),
- (unsigned long) overhead);
-
- if (jpc_encode(image, out, buf)) {
- goto error;
- }
-
- return 0;
- abort();
-
-error:
-
- if (box) {
- jp2_box_destroy(box);
- }
- if (tmpstream) {
- jas_stream_close(tmpstream);
- }
- return -1;
-}
-
-static uint_fast32_t jp2_gettypeasoc(int colorspace, int ctype)
-{
- int type;
- int asoc;
-
- if (ctype & JAS_IMAGE_CT_OPACITY) {
- type = JP2_CDEF_TYPE_OPACITY;
- asoc = JP2_CDEF_ASOC_ALL;
- goto done;
- }
-
- type = JP2_CDEF_TYPE_UNSPEC;
- asoc = JP2_CDEF_ASOC_NONE;
- switch (jas_clrspc_fam(colorspace)) {
- case JAS_CLRSPC_FAM_RGB:
- switch (JAS_IMAGE_CT_COLOR(ctype)) {
- case JAS_IMAGE_CT_RGB_R:
- type = JP2_CDEF_TYPE_COLOR;
- asoc = JP2_CDEF_RGB_R;
- break;
- case JAS_IMAGE_CT_RGB_G:
- type = JP2_CDEF_TYPE_COLOR;
- asoc = JP2_CDEF_RGB_G;
- break;
- case JAS_IMAGE_CT_RGB_B:
- type = JP2_CDEF_TYPE_COLOR;
- asoc = JP2_CDEF_RGB_B;
- break;
- }
- break;
- case JAS_CLRSPC_FAM_YCBCR:
- switch (JAS_IMAGE_CT_COLOR(ctype)) {
- case JAS_IMAGE_CT_YCBCR_Y:
- type = JP2_CDEF_TYPE_COLOR;
- asoc = JP2_CDEF_YCBCR_Y;
- break;
- case JAS_IMAGE_CT_YCBCR_CB:
- type = JP2_CDEF_TYPE_COLOR;
- asoc = JP2_CDEF_YCBCR_CB;
- break;
- case JAS_IMAGE_CT_YCBCR_CR:
- type = JP2_CDEF_TYPE_COLOR;
- asoc = JP2_CDEF_YCBCR_CR;
- break;
- }
- break;
- case JAS_CLRSPC_FAM_GRAY:
- type = JP2_CDEF_TYPE_COLOR;
- asoc = JP2_CDEF_GRAY_Y;
- break;
- }
-
-done:
- return (type << 16) | asoc;
-}
-
-static int clrspctojp2(jas_clrspc_t clrspc)
-{
- switch (clrspc) {
- case JAS_CLRSPC_SRGB:
- return JP2_COLR_SRGB;
- case JAS_CLRSPC_SYCBCR:
- return JP2_COLR_SYCC;
- case JAS_CLRSPC_SGRAY:
- return JP2_COLR_SGRAY;
- default:
- abort();
- break;
- }
-}
diff --git a/src/3rdparty/jasper/src/libjasper/jpc/jpc_bs.c b/src/3rdparty/jasper/src/libjasper/jpc/jpc_bs.c
deleted file mode 100644
index fb56398..0000000
--- a/src/3rdparty/jasper/src/libjasper/jpc/jpc_bs.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * Copyright (c) 1999-2000, Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2003 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Bit Stream Class
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_math.h"
-#include "jasper/jas_debug.h"
-
-#include "jpc_bs.h"
-
-/******************************************************************************\
-* Local function prototypes.
-\******************************************************************************/
-
-static jpc_bitstream_t *jpc_bitstream_alloc(void);
-
-/******************************************************************************\
-* Code for opening and closing bit streams.
-\******************************************************************************/
-
-/* Open a bit stream from a stream. */
-jpc_bitstream_t *jpc_bitstream_sopen(jas_stream_t *stream, char *mode)
-{
- jpc_bitstream_t *bitstream;
-
- /* Ensure that the open mode is valid. */
-#if 1
-/* This causes a string literal too long error (with c99 pedantic mode). */
- assert(!strcmp(mode, "r") || !strcmp(mode, "w") || !strcmp(mode, "r+")
- || !strcmp(mode, "w+"));
-#endif
-
- if (!(bitstream = jpc_bitstream_alloc())) {
- return 0;
- }
-
- /* By default, do not close the underlying (character) stream, upon
- the close of the bit stream. */
- bitstream->flags_ = JPC_BITSTREAM_NOCLOSE;
-
- bitstream->stream_ = stream;
- bitstream->openmode_ = (mode[0] == 'w') ? JPC_BITSTREAM_WRITE :
- JPC_BITSTREAM_READ;
-
- /* Mark the data buffer as empty. */
- bitstream->cnt_ = (bitstream->openmode_ == JPC_BITSTREAM_READ) ? 0 : 8;
- bitstream->buf_ = 0;
-
- return bitstream;
-}
-
-/* Close a bit stream. */
-int jpc_bitstream_close(jpc_bitstream_t *bitstream)
-{
- int ret = 0;
-
- /* Align to the next byte boundary while considering the effects of
- bit stuffing. */
- if (jpc_bitstream_align(bitstream)) {
- ret = -1;
- }
-
- /* If necessary, close the underlying (character) stream. */
- if (!(bitstream->flags_ & JPC_BITSTREAM_NOCLOSE) && bitstream->stream_) {
- if (jas_stream_close(bitstream->stream_)) {
- ret = -1;
- }
- bitstream->stream_ = 0;
- }
-
- jas_free(bitstream);
- return ret;
-}
-
-/* Allocate a new bit stream. */
-static jpc_bitstream_t *jpc_bitstream_alloc()
-{
- jpc_bitstream_t *bitstream;
-
- /* Allocate memory for the new bit stream object. */
- if (!(bitstream = jas_malloc(sizeof(jpc_bitstream_t)))) {
- return 0;
- }
- /* Initialize all of the data members. */
- bitstream->stream_ = 0;
- bitstream->cnt_ = 0;
- bitstream->flags_ = 0;
- bitstream->openmode_ = 0;
-
- return bitstream;
-}
-
-/******************************************************************************\
-* Code for reading/writing from/to bit streams.
-\******************************************************************************/
-
-/* Get a bit from a bit stream. */
-int jpc_bitstream_getbit_func(jpc_bitstream_t *bitstream)
-{
- int ret;
- JAS_DBGLOG(1000, ("jpc_bitstream_getbit_func(%p)\n", bitstream));
- ret = jpc_bitstream_getbit_macro(bitstream);
- JAS_DBGLOG(1000, ("jpc_bitstream_getbit_func -> %d\n", ret));
- return ret;
-}
-
-/* Put a bit to a bit stream. */
-int jpc_bitstream_putbit_func(jpc_bitstream_t *bitstream, int b)
-{
- int ret;
- JAS_DBGLOG(1000, ("jpc_bitstream_putbit_func(%p, %d)\n", bitstream, b));
- ret = jpc_bitstream_putbit_macro(bitstream, b);
- JAS_DBGLOG(1000, ("jpc_bitstream_putbit_func() -> %d\n", ret));
- return ret;
-}
-
-/* Get one or more bits from a bit stream. */
-long jpc_bitstream_getbits(jpc_bitstream_t *bitstream, int n)
-{
- long v;
- int u;
-
- /* We can reliably get at most 31 bits since ISO/IEC 9899 only
- guarantees that a long can represent values up to 2^31-1. */
- assert(n >= 0 && n < 32);
-
- /* Get the number of bits requested from the specified bit stream. */
- v = 0;
- while (--n >= 0) {
- if ((u = jpc_bitstream_getbit(bitstream)) < 0) {
- return -1;
- }
- v = (v << 1) | u;
- }
- return v;
-}
-
-/* Put one or more bits to a bit stream. */
-int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v)
-{
- int m;
-
- /* We can reliably put at most 31 bits since ISO/IEC 9899 only
- guarantees that a long can represent values up to 2^31-1. */
- assert(n >= 0 && n < 32);
- /* Ensure that only the bits to be output are nonzero. */
- assert(!(v & (~JAS_ONES(n))));
-
- /* Put the desired number of bits to the specified bit stream. */
- m = n - 1;
- while (--n >= 0) {
- if (jpc_bitstream_putbit(bitstream, (v >> m) & 1) == EOF) {
- return EOF;
- }
- v <<= 1;
- }
- return 0;
-}
-
-/******************************************************************************\
-* Code for buffer filling and flushing.
-\******************************************************************************/
-
-/* Fill the buffer for a bit stream. */
-int jpc_bitstream_fillbuf(jpc_bitstream_t *bitstream)
-{
- int c;
- /* Note: The count has already been decremented by the caller. */
- assert(bitstream->openmode_ & JPC_BITSTREAM_READ);
- assert(bitstream->cnt_ <= 0);
-
- if (bitstream->flags_ & JPC_BITSTREAM_ERR) {
- bitstream->cnt_ = 0;
- return -1;
- }
-
- if (bitstream->flags_ & JPC_BITSTREAM_EOF) {
- bitstream->buf_ = 0x7f;
- bitstream->cnt_ = 7;
- return 1;
- }
-
- bitstream->buf_ = (bitstream->buf_ << 8) & 0xffff;
- if ((c = jas_stream_getc((bitstream)->stream_)) == EOF) {
- bitstream->flags_ |= JPC_BITSTREAM_EOF;
- return 1;
- }
- bitstream->cnt_ = (bitstream->buf_ == 0xff00) ? 6 : 7;
- bitstream->buf_ |= c & ((1 << (bitstream->cnt_ + 1)) - 1);
- return (bitstream->buf_ >> bitstream->cnt_) & 1;
-}
-
-
-/******************************************************************************\
-* Code related to flushing.
-\******************************************************************************/
-
-/* Does the bit stream need to be aligned to a byte boundary (considering
- the effects of bit stuffing)? */
-int jpc_bitstream_needalign(jpc_bitstream_t *bitstream)
-{
- if (bitstream->openmode_ & JPC_BITSTREAM_READ) {
- /* The bit stream is open for reading. */
- /* If there are any bits buffered for reading, or the
- previous byte forced a stuffed bit, alignment is
- required. */
- if ((bitstream->cnt_ < 8 && bitstream->cnt_ > 0) ||
- ((bitstream->buf_ >> 8) & 0xff) == 0xff) {
- return 1;
- }
- } else if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
- /* The bit stream is open for writing. */
- /* If there are any bits buffered for writing, or the
- previous byte forced a stuffed bit, alignment is
- required. */
- if ((bitstream->cnt_ < 8 && bitstream->cnt_ >= 0) ||
- ((bitstream->buf_ >> 8) & 0xff) == 0xff) {
- return 1;
- }
- } else {
- /* This should not happen. Famous last words, eh? :-) */
- assert(0);
- return -1;
- }
- return 0;
-}
-
-/* How many additional bytes would be output if we align the bit stream? */
-int jpc_bitstream_pending(jpc_bitstream_t *bitstream)
-{
- if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
- /* The bit stream is being used for writing. */
-#if 1
- /* XXX - Is this really correct? Check someday... */
- if (bitstream->cnt_ < 8) {
- return 1;
- }
-#else
- if (bitstream->cnt_ < 8) {
- if (((bitstream->buf_ >> 8) & 0xff) == 0xff) {
- return 2;
- }
- return 1;
- }
-#endif
- return 0;
- } else {
- /* This operation should not be invoked on a bit stream that
- is being used for reading. */
- return -1;
- }
-}
-
-/* Align the bit stream to a byte boundary. */
-int jpc_bitstream_align(jpc_bitstream_t *bitstream)
-{
- int ret;
- if (bitstream->openmode_ & JPC_BITSTREAM_READ) {
- ret = jpc_bitstream_inalign(bitstream, 0, 0);
- } else if (bitstream->openmode_ & JPC_BITSTREAM_WRITE) {
- ret = jpc_bitstream_outalign(bitstream, 0);
- } else {
- abort();
- }
- return ret;
-}
-
-/* Align a bit stream in the input case. */
-int jpc_bitstream_inalign(jpc_bitstream_t *bitstream, int fillmask,
- int filldata)
-{
- int n;
- int v;
- int u;
- int numfill;
- int m;
-
- numfill = 7;
- m = 0;
- v = 0;
- if (bitstream->cnt_ > 0) {
- n = bitstream->cnt_;
- } else if (!bitstream->cnt_) {
- n = ((bitstream->buf_ & 0xff) == 0xff) ? 7 : 0;
- } else {
- n = 0;
- }
- if (n > 0) {
- if ((u = jpc_bitstream_getbits(bitstream, n)) < 0) {
- return -1;
- }
- m += n;
- v = (v << n) | u;
- }
- if ((bitstream->buf_ & 0xff) == 0xff) {
- if ((u = jpc_bitstream_getbits(bitstream, 7)) < 0) {
- return -1;
- }
- v = (v << 7) | u;
- m += 7;
- }
- if (m > numfill) {
- v >>= m - numfill;
- } else {
- filldata >>= numfill - m;
- fillmask >>= numfill - m;
- }
- if (((~(v ^ filldata)) & fillmask) != fillmask) {
- /* The actual fill pattern does not match the expected one. */
- return 1;
- }
-
- return 0;
-}
-
-/* Align a bit stream in the output case. */
-int jpc_bitstream_outalign(jpc_bitstream_t *bitstream, int filldata)
-{
- int n;
- int v;
-
- /* Ensure that this bit stream is open for writing. */
- assert(bitstream->openmode_ & JPC_BITSTREAM_WRITE);
-
- /* Ensure that the first bit of fill data is zero. */
- /* Note: The first bit of fill data must be zero. If this were not
- the case, the fill data itself could cause further bit stuffing to
- be required (which would cause numerous complications). */
- assert(!(filldata & (~0x3f)));
-
- if (!bitstream->cnt_) {
- if ((bitstream->buf_ & 0xff) == 0xff) {
- n = 7;
- v = filldata;
- } else {
- n = 0;
- v = 0;
- }
- } else if (bitstream->cnt_ > 0 && bitstream->cnt_ < 8) {
- n = bitstream->cnt_;
- v = filldata >> (7 - n);
- } else {
- n = 0;
- v = 0;
- return 0;
- }
-
- /* Write the appropriate fill data to the bit stream. */
- if (n > 0) {
- if (jpc_bitstream_putbits(bitstream, n, v)) {
- return -1;
- }
- }
- if (bitstream->cnt_ < 8) {
- assert(bitstream->cnt_ >= 0 && bitstream->cnt_ < 8);
- assert((bitstream->buf_ & 0xff) != 0xff);
- /* Force the pending byte of output to be written to the
- underlying (character) stream. */
- if (jas_stream_putc(bitstream->stream_, bitstream->buf_ & 0xff) == EOF) {
- return -1;
- }
- bitstream->cnt_ = 8;
- bitstream->buf_ = (bitstream->buf_ << 8) & 0xffff;
- }
-
- return 0;
-}
diff --git a/src/3rdparty/jasper/src/libjasper/jpc/jpc_bs.h b/src/3rdparty/jasper/src/libjasper/jpc/jpc_bs.h
deleted file mode 100644
index ef6a556..0000000
--- a/src/3rdparty/jasper/src/libjasper/jpc/jpc_bs.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * Bit Stream Class
- *
- * $Id$
- */
-
-#ifndef JPC_BS_H
-#define JPC_BS_H
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdio.h>
-
-#include "jasper/jas_types.h"
-#include "jasper/jas_stream.h"
-
-/******************************************************************************\
-* Constants.
-\******************************************************************************/
-
-/*
- * Bit stream open mode flags.
- */
-
-/* Bit stream open for reading. */
-#define JPC_BITSTREAM_READ 0x01
-/* Bit stream open for writing. */
-#define JPC_BITSTREAM_WRITE 0x02
-
-/*
- * Bit stream flags.
- */
-
-/* Do not close underlying character stream. */
-#define JPC_BITSTREAM_NOCLOSE 0x01
-/* End of file has been reached while reading. */
-#define JPC_BITSTREAM_EOF 0x02
-/* An I/O error has occured. */
-#define JPC_BITSTREAM_ERR 0x04
-
-/******************************************************************************\
-* Types.
-\******************************************************************************/
-
-/* Bit stream class. */
-
-typedef struct {
-
- /* Some miscellaneous flags. */
- int flags_;
-
- /* The input/output buffer. */
- uint_fast16_t buf_;
-
- /* The number of bits remaining in the byte being read/written. */
- int cnt_;
-
- /* The underlying stream associated with this bit stream. */
- jas_stream_t *stream_;
-
- /* The mode in which this bit stream was opened. */
- int openmode_;
-
-} jpc_bitstream_t;
-
-/******************************************************************************\
-* Functions/macros for opening and closing bit streams..
-\******************************************************************************/
-
-/* Open a stream as a bit stream. */
-jpc_bitstream_t *jpc_bitstream_sopen(jas_stream_t *stream, char *mode);
-
-/* Close a bit stream. */
-int jpc_bitstream_close(jpc_bitstream_t *bitstream);
-
-/******************************************************************************\
-* Functions/macros for reading from and writing to bit streams..
-\******************************************************************************/
-
-/* Read a bit from a bit stream. */
-#if defined(DEBUG)
-#define jpc_bitstream_getbit(bitstream) \
- jpc_bitstream_getbit_func(bitstream)
-#else
-#define jpc_bitstream_getbit(bitstream) \
- jpc_bitstream_getbit_macro(bitstream)
-#endif
-
-/* Write a bit to a bit stream. */
-#if defined(DEBUG)
-#define jpc_bitstream_putbit(bitstream, v) \
- jpc_bitstream_putbit_func(bitstream, v)
-#else
-#define jpc_bitstream_putbit(bitstream, v) \
- jpc_bitstream_putbit_macro(bitstream, v)
-#endif
-
-/* Read one or more bits from a bit stream. */
-long jpc_bitstream_getbits(jpc_bitstream_t *bitstream, int n);
-
-/* Write one or more bits to a bit stream. */
-int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v);
-
-/******************************************************************************\
-* Functions/macros for flushing and aligning bit streams.
-\******************************************************************************/
-
-/* Align the current position within the bit stream to the next byte
- boundary. */
-int jpc_bitstream_align(jpc_bitstream_t *bitstream);
-
-/* Align the current position in the bit stream with the next byte boundary,
- ensuring that certain bits consumed in the process match a particular
- pattern. */
-int jpc_bitstream_inalign(jpc_bitstream_t *bitstream, int fillmask,
- int filldata);
-
-/* Align the current position in the bit stream with the next byte boundary,
- writing bits from the specified pattern (if necessary) in the process. */
-int jpc_bitstream_outalign(jpc_bitstream_t *bitstream, int filldata);
-
-/* Check if a bit stream needs alignment. */
-int jpc_bitstream_needalign(jpc_bitstream_t *bitstream);
-
-/* How many additional bytes would be output if the bit stream was aligned? */
-int jpc_bitstream_pending(jpc_bitstream_t *bitstream);
-
-/******************************************************************************\
-* Functions/macros for querying state information for bit streams.
-\******************************************************************************/
-
-/* Has EOF been encountered on a bit stream? */
-#define jpc_bitstream_eof(bitstream) \
- ((bitstream)->flags_ & JPC_BITSTREAM_EOF)
-
-/******************************************************************************\
-* Internals.
-\******************************************************************************/
-
-/* DO NOT DIRECTLY INVOKE ANY OF THE MACROS OR FUNCTIONS BELOW. THEY ARE
- FOR INTERNAL USE ONLY. */
-
-int jpc_bitstream_getbit_func(jpc_bitstream_t *bitstream);
-
-int jpc_bitstream_putbit_func(jpc_bitstream_t *bitstream, int v);
-
-int jpc_bitstream_fillbuf(jpc_bitstream_t *bitstream);
-
-#define jpc_bitstream_getbit_macro(bitstream) \
- (assert((bitstream)->openmode_ & JPC_BITSTREAM_READ), \
- (--(bitstream)->cnt_ >= 0) ? \
- ((int)(((bitstream)->buf_ >> (bitstream)->cnt_) & 1)) : \
- jpc_bitstream_fillbuf(bitstream))
-
-#define jpc_bitstream_putbit_macro(bitstream, bit) \
- (assert((bitstream)->openmode_ & JPC_BITSTREAM_WRITE), \
- (--(bitstream)->cnt_ < 0) ? \
- ((bitstream)->buf_ = ((bitstream)->buf_ << 8) & 0xffff, \
- (bitstream)->cnt_ = ((bitstream)->buf_ == 0xff00) ? 6 : 7, \
- (bitstream)->buf_ |= ((bit) & 1) << (bitstream)->cnt_, \
- (jas_stream_putc((bitstream)->stream_, (bitstream)->buf_ >> 8) == EOF) \
- ? (EOF) : ((bit) & 1)) : \
- ((bitstream)->buf_ |= ((bit) & 1) << (bitstream)->cnt_, \
- (bit) & 1))
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/jpc/jpc_cod.h b/src/3rdparty/jasper/src/libjasper/jpc/jpc_cod.h
deleted file mode 100644
index 7cef38c..0000000
--- a/src/3rdparty/jasper/src/libjasper/jpc/jpc_cod.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * $Id$
- */
-
-#ifndef JPC_COD_H
-#define JPC_COD_H
-
-/******************************************************************************\
-* Constants.
-\******************************************************************************/
-
-/* The nominal word size used by this implementation. */
-#define JPC_PREC 32
-
-#endif
diff --git a/src/3rdparty/jasper/src/libjasper/jpc/jpc_cs.c b/src/3rdparty/jasper/src/libjasper/jpc/jpc_cs.c
deleted file mode 100644
index f0f8e4d..0000000
--- a/src/3rdparty/jasper/src/libjasper/jpc/jpc_cs.c
+++ /dev/null
@@ -1,1644 +0,0 @@
-/*
- * Copyright (c) 1999-2000 Image Power, Inc. and the University of
- * British Columbia.
- * Copyright (c) 2001-2002 Michael David Adams.
- * All rights reserved.
- */
-
-/* __START_OF_JASPER_LICENSE__
- *
- * JasPer License Version 2.0
- *
- * Copyright (c) 2001-2006 Michael David Adams
- * Copyright (c) 1999-2000 Image Power, Inc.
- * Copyright (c) 1999-2000 The University of British Columbia
- *
- * All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person (the
- * "User") obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, and/or sell copies of the Software, and to permit
- * persons to whom the Software is furnished to do so, subject to the
- * following conditions:
- *
- * 1. The above copyright notices and this permission notice (which
- * includes the disclaimer below) shall be included in all copies or
- * substantial portions of the Software.
- *
- * 2. The name of a copyright holder shall not be used to endorse or
- * promote products derived from the Software without specific prior
- * written permission.
- *
- * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
- * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
- * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
- * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
- * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
- * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
- * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
- * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
- * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
- * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
- * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
- * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
- * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
- * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
- * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
- * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
- * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
- * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
- * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
- *
- * __END_OF_JASPER_LICENSE__
- */
-
-/*
- * JPEG-2000 Code Stream Library
- *
- * $Id$
- */
-
-/******************************************************************************\
-* Includes.
-\******************************************************************************/
-
-#include <stdlib.h>
-#include <assert.h>
-#include <ctype.h>
-
-#include "jasper/jas_malloc.h"
-#include "jasper/jas_debug.h"
-
-#include "jpc_cs.h"
-
-/******************************************************************************\
-* Types.
-\******************************************************************************/
-
-/* Marker segment table entry. */
-typedef struct {
- int id;
- char *name;
- jpc_msops_t ops;
-} jpc_mstabent_t;
-
-/******************************************************************************\
-* Local prototypes.
-\******************************************************************************/
-
-static jpc_mstabent_t *jpc_mstab_lookup(int id);
-
-static int jpc_poc_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_poc_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_poc_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static void jpc_poc_destroyparms(jpc_ms_t *ms);
-
-static int jpc_unk_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_sot_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_siz_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_cod_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_coc_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_qcd_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_qcc_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_rgn_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_sop_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_ppm_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_ppt_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_crg_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-static int jpc_com_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in);
-
-static int jpc_sot_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_siz_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_cod_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_coc_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_qcd_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_qcc_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_rgn_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_unk_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_sop_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_ppm_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_ppt_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_crg_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-static int jpc_com_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out);
-
-static int jpc_sot_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_siz_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_cod_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_coc_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_qcd_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_qcc_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_rgn_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_unk_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_sop_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_ppm_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_ppt_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_crg_dumpparms(jpc_ms_t *ms, FILE *out);
-static int jpc_com_dumpparms(jpc_ms_t *ms, FILE *out);
-
-static void jpc_siz_destroyparms(jpc_ms_t *ms);
-static void jpc_qcd_destroyparms(jpc_ms_t *ms);
-static void jpc_qcc_destroyparms(jpc_ms_t *ms);
-static void jpc_cod_destroyparms(jpc_ms_t *ms);
-static void jpc_coc_destroyparms(jpc_ms_t *ms);
-static void jpc_unk_destroyparms(jpc_ms_t *ms);
-static void jpc_ppm_destroyparms(jpc_ms_t *ms);
-static void jpc_ppt_destroyparms(jpc_ms_t *ms);
-static void jpc_crg_destroyparms(jpc_ms_t *ms);
-static void jpc_com_destroyparms(jpc_ms_t *ms);
-
-static void jpc_qcx_destroycompparms(jpc_qcxcp_t *compparms);
-static int jpc_qcx_getcompparms(jpc_qcxcp_t *compparms, jpc_cstate_t *cstate,
- jas_stream_t *in, uint_fast16_t len);
-static int jpc_qcx_putcompparms(jpc_qcxcp_t *compparms, jpc_cstate_t *cstate,
- jas_stream_t *out);
-static void jpc_cox_destroycompparms(jpc_coxcp_t *compparms);
-static int jpc_cox_getcompparms(jpc_ms_t *ms, jpc_cstate_t *cstate,
- jas_stream_t *in, int prtflag, jpc_coxcp_t *compparms);
-static int jpc_cox_putcompparms(jpc_ms_t *ms, jpc_cstate_t *cstate,
- jas_stream_t *out, int prtflag, jpc_coxcp_t *compparms);
-
-/******************************************************************************\
-* Global data.
-\******************************************************************************/
-
-static jpc_mstabent_t jpc_mstab[] = {
- {JPC_MS_SOC, "SOC", {0, 0, 0, 0}},
- {JPC_MS_SOT, "SOT", {0, jpc_sot_getparms, jpc_sot_putparms,
- jpc_sot_dumpparms}},
- {JPC_MS_SOD, "SOD", {0, 0, 0, 0}},
- {JPC_MS_EOC, "EOC", {0, 0, 0, 0}},
- {JPC_MS_SIZ, "SIZ", {jpc_siz_destroyparms, jpc_siz_getparms,
- jpc_siz_putparms, jpc_siz_dumpparms}},
- {JPC_MS_COD, "COD", {jpc_cod_destroyparms, jpc_cod_getparms,
- jpc_cod_putparms, jpc_cod_dumpparms}},
- {JPC_MS_COC, "COC", {jpc_coc_destroyparms, jpc_coc_getparms,
- jpc_coc_putparms, jpc_coc_dumpparms}},
- {JPC_MS_RGN, "RGN", {0, jpc_rgn_getparms, jpc_rgn_putparms,
- jpc_rgn_dumpparms}},
- {JPC_MS_QCD, "QCD", {jpc_qcd_destroyparms, jpc_qcd_getparms,
- jpc_qcd_putparms, jpc_qcd_dumpparms}},
- {JPC_MS_QCC, "QCC", {jpc_qcc_destroyparms, jpc_qcc_getparms,
- jpc_qcc_putparms, jpc_qcc_dumpparms}},
- {JPC_MS_POC, "POC", {jpc_poc_destroyparms, jpc_poc_getparms,
- jpc_poc_putparms, jpc_poc_dumpparms}},
- {JPC_MS_TLM, "TLM", {0, jpc_unk_getparms, jpc_unk_putparms, 0}},
- {JPC_MS_PLM, "PLM", {0, jpc_unk_getparms, jpc_unk_putparms, 0}},
- {JPC_MS_PPM, "PPM", {jpc_ppm_destroyparms, jpc_ppm_getparms,
- jpc_ppm_putparms, jpc_ppm_dumpparms}},
- {JPC_MS_PPT, "PPT", {jpc_ppt_destroyparms, jpc_ppt_getparms,
- jpc_ppt_putparms, jpc_ppt_dumpparms}},
- {JPC_MS_SOP, "SOP", {0, jpc_sop_getparms, jpc_sop_putparms,
- jpc_sop_dumpparms}},
- {JPC_MS_EPH, "EPH", {0, 0, 0, 0}},
- {JPC_MS_CRG, "CRG", {0, jpc_crg_getparms, jpc_crg_putparms,
- jpc_crg_dumpparms}},
- {JPC_MS_COM, "COM", {jpc_com_destroyparms, jpc_com_getparms,
- jpc_com_putparms, jpc_com_dumpparms}},
- {-1, "UNKNOWN", {jpc_unk_destroyparms, jpc_unk_getparms,
- jpc_unk_putparms, jpc_unk_dumpparms}}
-};
-
-/******************************************************************************\
-* Code stream manipulation functions.
-\******************************************************************************/
-
-/* Create a code stream state object. */
-jpc_cstate_t *jpc_cstate_create()
-{
- jpc_cstate_t *cstate;
- if (!(cstate = jas_malloc(sizeof(jpc_cstate_t)))) {
- return 0;
- }
- cstate->numcomps = 0;
- return cstate;
-}
-
-/* Destroy a code stream state object. */
-void jpc_cstate_destroy(jpc_cstate_t *cstate)
-{
- jas_free(cstate);
-}
-
-/* Read a marker segment from a stream. */
-jpc_ms_t *jpc_getms(jas_stream_t *in, jpc_cstate_t *cstate)
-{
- jpc_ms_t *ms;
- jpc_mstabent_t *mstabent;
- jas_stream_t *tmpstream;
-
- if (!(ms = jpc_ms_create(0))) {
- return 0;
- }
-
- /* Get the marker type. */
- if (jpc_getuint16(in, &ms->id) || ms->id < JPC_MS_MIN ||
- ms->id > JPC_MS_MAX) {
- jpc_ms_destroy(ms);
- return 0;
- }
-
- mstabent = jpc_mstab_lookup(ms->id);
- ms->ops = &mstabent->ops;
-
- /* Get the marker segment length and parameters if present. */
- /* Note: It is tacitly assumed that a marker segment cannot have
- parameters unless it has a length field. That is, there cannot
- be a parameters field without a length field and vice versa. */
- if (JPC_MS_HASPARMS(ms->id)) {
- /* Get the length of the marker segment. */
- if (jpc_getuint16(in, &ms->len) || ms->len < 3) {
- jpc_ms_destroy(ms);
- return 0;
- }
- /* Calculate the length of the marker segment parameters. */
- ms->len -= 2;
- /* Create and prepare a temporary memory stream from which to
- read the marker segment parameters. */
- /* Note: This approach provides a simple way of ensuring that
- we never read beyond the end of the marker segment (even if
- the marker segment length is errantly set too small). */
- if (!(tmpstream = jas_stream_memopen(0, 0))) {
- jpc_ms_destroy(ms);
- return 0;
- }
- if (jas_stream_copy(tmpstream, in, ms->len) ||
- jas_stream_seek(tmpstream, 0, SEEK_SET) < 0) {
- jas_stream_close(tmpstream);
- jpc_ms_destroy(ms);
- return 0;
- }
- /* Get the marker segment parameters. */
- if ((*ms->ops->getparms)(ms, cstate, tmpstream)) {
- ms->ops = 0;
- jpc_ms_destroy(ms);
- jas_stream_close(tmpstream);
- return 0;
- }
-
- if (jas_getdbglevel() > 0) {
- jpc_ms_dump(ms, stderr);
- }
-
- if (JAS_CAST(ulong, jas_stream_tell(tmpstream)) != ms->len) {
- jas_eprintf("warning: trailing garbage in marker segment (%ld bytes)\n",
- ms->len - jas_stream_tell(tmpstream));
- }
-
- /* Close the temporary stream. */
- jas_stream_close(tmpstream);
-
- } else {
- /* There are no marker segment parameters. */
- ms->len = 0;
-
- if (jas_getdbglevel() > 0) {
- jpc_ms_dump(ms, stderr);
- }
- }
-
- /* Update the code stream state information based on the type of
- marker segment read. */
- /* Note: This is a bit of a hack, but I'm not going to define another
- type of virtual function for this one special case. */
- if (ms->id == JPC_MS_SIZ) {
- cstate->numcomps = ms->parms.siz.numcomps;
- }
-
- return ms;
-}
-
-/* Write a marker segment to a stream. */
-int jpc_putms(jas_stream_t *out, jpc_cstate_t *cstate, jpc_ms_t *ms)
-{
- jas_stream_t *tmpstream;
- int len;
-
- /* Output the marker segment type. */
- if (jpc_putuint16(out, ms->id)) {
- return -1;
- }
-
- /* Output the marker segment length and parameters if necessary. */
- if (ms->ops->putparms) {
- /* Create a temporary stream in which to buffer the
- parameter data. */
- if (!(tmpstream = jas_stream_memopen(0, 0))) {
- return -1;
- }
- if ((*ms->ops->putparms)(ms, cstate, tmpstream)) {
- jas_stream_close(tmpstream);
- return -1;
- }
- /* Get the number of bytes of parameter data written. */
- if ((len = jas_stream_tell(tmpstream)) < 0) {
- jas_stream_close(tmpstream);
- return -1;
- }
- ms->len = len;
- /* Write the marker segment length and parameter data to
- the output stream. */
- if (jas_stream_seek(tmpstream, 0, SEEK_SET) < 0 ||
- jpc_putuint16(out, ms->len + 2) ||
- jas_stream_copy(out, tmpstream, ms->len) < 0) {
- jas_stream_close(tmpstream);
- return -1;
- }
- /* Close the temporary stream. */
- jas_stream_close(tmpstream);
- }
-
- /* This is a bit of a hack, but I'm not going to define another
- type of virtual function for this one special case. */
- if (ms->id == JPC_MS_SIZ) {
- cstate->numcomps = ms->parms.siz.numcomps;
- }
-
- if (jas_getdbglevel() > 0) {
- jpc_ms_dump(ms, stderr);
- }
-
- return 0;
-}
-
-/******************************************************************************\
-* Marker segment operations.
-\******************************************************************************/
-
-/* Create a marker segment of the specified type. */
-jpc_ms_t *jpc_ms_create(int type)
-{
- jpc_ms_t *ms;
- jpc_mstabent_t *mstabent;
-
- if (!(ms = jas_malloc(sizeof(jpc_ms_t)))) {
- return 0;
- }
- ms->id = type;
- ms->len = 0;
- mstabent = jpc_mstab_lookup(ms->id);
- ms->ops = &mstabent->ops;
- memset(&ms->parms, 0, sizeof(jpc_msparms_t));
- return ms;
-}
-
-/* Destroy a marker segment. */
-void jpc_ms_destroy(jpc_ms_t *ms)
-{
- if (ms->ops && ms->ops->destroyparms) {
- (*ms->ops->destroyparms)(ms);
- }
- jas_free(ms);
-}
-
-/* Dump a marker segment to a stream for debugging. */
-void jpc_ms_dump(jpc_ms_t *ms, FILE *out)
-{
- jpc_mstabent_t *mstabent;
- mstabent = jpc_mstab_lookup(ms->id);
- fprintf(out, "type = 0x%04x (%s);", ms->id, mstabent->name);
- if (JPC_MS_HASPARMS(ms->id)) {
- fprintf(out, " len = %d;", ms->len + 2);
- if (ms->ops->dumpparms) {
- (*ms->ops->dumpparms)(ms, out);
- } else {
- fprintf(out, "\n");
- }
- } else {
- fprintf(out, "\n");
- }
-}
-
-/******************************************************************************\
-* SOT marker segment operations.
-\******************************************************************************/
-
-static int jpc_sot_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in)
-{
- jpc_sot_t *sot = &ms->parms.sot;
-
- /* Eliminate compiler warning about unused variables. */
- cstate = 0;
-
- if (jpc_getuint16(in, &sot->tileno) ||
- jpc_getuint32(in, &sot->len) ||
- jpc_getuint8(in, &sot->partno) ||
- jpc_getuint8(in, &sot->numparts)) {
- return -1;
- }
- if (jas_stream_eof(in)) {
- return -1;
- }
- return 0;
-}
-
-static int jpc_sot_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out)
-{
- jpc_sot_t *sot = &ms->parms.sot;
-
- /* Eliminate compiler warning about unused variables. */
- cstate = 0;
-
- if (jpc_putuint16(out, sot->tileno) ||
- jpc_putuint32(out, sot->len) ||
- jpc_putuint8(out, sot->partno) ||
- jpc_putuint8(out, sot->numparts)) {
- return -1;
- }
- return 0;
-}
-
-static int jpc_sot_dumpparms(jpc_ms_t *ms, FILE *out)
-{
- jpc_sot_t *sot = &ms->parms.sot;
- fprintf(out, "tileno = %d; len = %d; partno = %d; numparts = %d\n",
- sot->tileno, sot->len, sot->partno, sot->numparts);
- return 0;
-}
-
-/******************************************************************************\
-* SIZ marker segment operations.
-\******************************************************************************/
-
-static void jpc_siz_destroyparms(jpc_ms_t *ms)
-{
- jpc_siz_t *siz = &ms->parms.siz;
- if (siz->comps) {
- jas_free(siz->comps);
- }
-}
-
-static int jpc_siz_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate,
- jas_stream_t *in)
-{
- jpc_siz_t *siz = &ms->parms.siz;
- unsigned int i;
- uint_fast8_t tmp;
-
- /* Eliminate compiler warning about unused variables. */
- cstate = 0;
-
- if (jpc_getuint16(in, &siz->caps) ||
- jpc_getuint32(in, &siz->width) ||
- jpc_getuint32(in, &siz->height) ||
- jpc_getuint32(in, &siz->xoff) ||
- jpc_getuint32(in, &siz->yoff) ||
- jpc_getuint32(in, &siz->tilewidth) ||
- jpc_getuint32(in, &siz->tileheight) ||
- jpc_getuint32(in, &siz->tilexoff) ||
- jpc_getuint32(in, &siz->tileyoff) ||
- jpc_getuint16(in, &siz->numcomps)) {
- return -1;
- }
- if (!siz->width || !siz->height || !siz->tilewidth ||
- !siz->tileheight || !siz->numcomps) {
- return -1;
- }
- if (!(siz->comps = jas_malloc(siz->numcomps * sizeof(jpc_sizcomp_t)))) {
- return -1;
- }
- for (i = 0; i < siz->numcomps; ++i) {
- if (jpc_getuint8(in, &tmp) ||
- jpc_getuint8(in, &siz->comps[i].hsamp) ||
- jpc_getuint8(in, &siz->comps[i].vsamp)) {
- jas_free(siz->comps);
- return -1;
- }
- siz->comps[i].sgnd = (tmp >> 7) & 1;
- siz->comps[i].prec = (tmp & 0x7f) + 1;
- }
- if (jas_stream_eof(in)) {
- jas_free(siz->comps);
- return -1;
- }
- return 0;
-}
-
-static int jpc_siz_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out)
-{
- jpc_siz_t *siz = &ms->parms.siz;
- unsigned int i;
-
- /* Eliminate compiler warning about unused variables. */
- cstate = 0;
-
- assert(siz->width && siz->height && siz->tilewidth &&
- siz->tileheight && siz->numcomps);
- if (jpc_putuint16(out, siz->caps) ||
- jpc_putuint32(out, siz->width) ||
- jpc_putuint32(out, siz->height) ||
- jpc_putuint32(out, siz->xoff) ||
- jpc_putuint32(out, siz->yoff) ||
- jpc_putuint32(out, siz->tilewidth) ||
- jpc_putuint32(out, siz->tileheight) ||
- jpc_putuint32(out, siz->tilexoff) ||
- jpc_putuint32(out, siz->tileyoff) ||
- jpc_putuint16(out, siz->numcomps)) {
- return -1;
- }
- for (i = 0; i < siz->numcomps; ++i) {
- if (jpc_putuint8(out, ((siz->comps[i].sgnd & 1) << 7) |
- ((siz->comps[i].prec - 1) & 0x7f)) ||
- jpc_putuint8(out, siz->comps[i].hsamp) ||
- jpc_putuint8(out, siz->comps[i].vsamp)) {
- return -1;
- }
- }
- return 0;
-}
-
-static int jpc_siz_dumpparms(jpc_ms_t *ms, FILE *out)
-{
- jpc_siz_t *siz = &ms->parms.siz;
- unsigned int i;
- fprintf(out, "caps = 0x%02x;\n", siz->caps);
- fprintf(out, "width = %d; height = %d; xoff = %d; yoff = %d;\n",
- siz->width, siz->height, siz->xoff, siz->yoff);
- fprintf(out, "tilewidth = %d; tileheight = %d; tilexoff = %d; "
- "tileyoff = %d;\n", siz->tilewidth, siz->tileheight, siz->tilexoff,
- siz->tileyoff);
- for (i = 0; i < siz->numcomps; ++i) {
- fprintf(out, "prec[%d] = %d; sgnd[%d] = %d; hsamp[%d] = %d; "
- "vsamp[%d] = %d\n", i, siz->comps[i].prec, i,
- siz->comps[i].sgnd, i, siz->comps[i].hsamp, i,
- siz->comps[i].vsamp);
- }
- return 0;
-}
-
-/******************************************************************************\
-* COD marker segment operations.
-\******************************************************************************/
-
-static void jpc_cod_destroyparms(jpc_ms_t *ms)
-{
- jpc_cod_t *cod = &ms->parms.cod;
- jpc_cox_destroycompparms(&cod->compparms);
-}
-
-static int jpc_cod_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in)
-{
- jpc_cod_t *cod = &ms->parms.cod;
- if (jpc_getuint8(in, &cod->csty)) {
- return -1;
- }
- if (jpc_getuint8(in, &cod->prg) ||
- jpc_getuint16(in, &cod->numlyrs) ||
- jpc_getuint8(in, &cod->mctrans)) {
- return -1;
- }
- if (jpc_cox_getcompparms(ms, cstate, in,
- (cod->csty & JPC_COX_PRT) != 0, &cod->compparms)) {
- return -1;
- }
- if (jas_stream_eof(in)) {
- jpc_cod_destroyparms(ms);
- return -1;
- }
- return 0;
-}
-
-static int jpc_cod_putparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *out)
-{
- jpc_cod_t *cod = &ms->parms.cod;
- assert(cod->numlyrs > 0 && cod->compparms.numdlvls <= 32);
- assert(cod->compparms.numdlvls == cod->compparms.numrlvls - 1);
- if (jpc_putuint8(out, cod->compparms.csty) ||
- jpc_putuint8(out, cod->prg) ||
- jpc_putuint16(out, cod->numlyrs) ||
- jpc_putuint8(out, cod->mctrans)) {
- return -1;
- }
- if (jpc_cox_putcompparms(ms, cstate, out,
- (cod->csty & JPC_COX_PRT) != 0, &cod->compparms)) {
- return -1;
- }
- return 0;
-}
-
-static int