@depz/camera-sdk-win32-x64 0.0.0-stage → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +182 -0
- package/README.md +2 -2
- package/depz-engines/depz_engine_onnx.dll +0 -0
- package/depz-engines/depz_engine_openvino.dll +0 -0
- package/depz-engines/depz_engine_tensorrt.dll +0 -0
- package/depz.dll +0 -0
- package/depz_depth.dll +0 -0
- package/depz_inference.dll +0 -0
- package/depz_node.node +0 -0
- package/doc/EULA +182 -0
- package/doc/LICENSE +202 -0
- package/doc/NOTICE +41 -0
- package/doc/c/api.md +5022 -0
- package/doc/c/clarity/api.md +17 -0
- package/doc/c/clarity/guide.md +73 -0
- package/doc/c/clarity/introduction.md +24 -0
- package/doc/c/guide.md +125 -0
- package/doc/c/intro.md +62 -0
- package/doc/c/minima/api.md +17 -0
- package/doc/c/minima/guide.md +83 -0
- package/doc/c/minima/introduction.md +26 -0
- package/doc/c/odin/api.md +17 -0
- package/doc/c/odin/guide.md +44 -0
- package/doc/c/odin/introduction.md +24 -0
- package/doc/c/odin-mini/api.md +17 -0
- package/doc/c/odin-mini/guide.md +44 -0
- package/doc/c/odin-mini/introduction.md +24 -0
- package/doc/c/varius/api.md +17 -0
- package/doc/c/varius/guide.md +83 -0
- package/doc/c/varius/introduction.md +70 -0
- package/doc/c/varius-v/api.md +17 -0
- package/doc/c/varius-v/guide.md +85 -0
- package/doc/c/varius-v/introduction.md +32 -0
- package/doc/cpp/api.md +1924 -0
- package/doc/cpp/clarity/api.md +14 -0
- package/doc/cpp/clarity/guide.md +73 -0
- package/doc/cpp/clarity/introduction.md +24 -0
- package/doc/cpp/guide.md +88 -0
- package/doc/cpp/intro.md +29 -0
- package/doc/cpp/minima/api.md +14 -0
- package/doc/cpp/minima/guide.md +83 -0
- package/doc/cpp/minima/introduction.md +26 -0
- package/doc/cpp/odin/api.md +14 -0
- package/doc/cpp/odin/guide.md +44 -0
- package/doc/cpp/odin/introduction.md +24 -0
- package/doc/cpp/odin-mini/api.md +14 -0
- package/doc/cpp/odin-mini/guide.md +44 -0
- package/doc/cpp/odin-mini/introduction.md +24 -0
- package/doc/cpp/varius/api.md +14 -0
- package/doc/cpp/varius/guide.md +83 -0
- package/doc/cpp/varius/introduction.md +70 -0
- package/doc/cpp/varius-v/api.md +14 -0
- package/doc/cpp/varius-v/guide.md +85 -0
- package/doc/cpp/varius-v/introduction.md +32 -0
- package/doc/third_party/eigen/COPYING.MPL2 +373 -0
- package/doc/third_party/eigen/COPYING.README +18 -0
- package/doc/third_party/miniz/LICENSE +22 -0
- package/doc/third_party/nlohmann_json/LICENSE.MIT +21 -0
- package/doc/third_party/opencv/SoftFloat-COPYING.txt +36 -0
- package/doc/third_party/opencv/dlpack-LICENSE +201 -0
- package/doc/third_party/opencv/features2d-LICENSE.AKAZE +26 -0
- package/doc/third_party/opencv/features2d-LICENSE.KAZE +26 -0
- package/doc/third_party/opencv/libjpeg-turbo-LICENSE.md +135 -0
- package/doc/third_party/opencv/libjpeg-turbo-README.ijg +260 -0
- package/doc/third_party/opencv/libjpeg-turbo-README.md +375 -0
- package/doc/third_party/opencv/mscr-chi_table_LICENSE.txt +28 -0
- package/doc/third_party/opencv/zlib-LICENSE +22 -0
- package/package.json +25 -4
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
libjpeg-turbo note: This file has been modified by The libjpeg-turbo Project
|
|
2
|
+
to include only information relevant to libjpeg-turbo, to wordsmith certain
|
|
3
|
+
sections, and to remove impolitic language that existed in the libjpeg v8
|
|
4
|
+
README. It is included only for reference. Please see README.md for
|
|
5
|
+
information specific to libjpeg-turbo.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
The Independent JPEG Group's JPEG software
|
|
9
|
+
==========================================
|
|
10
|
+
|
|
11
|
+
This distribution contains a release of the Independent JPEG Group's free JPEG
|
|
12
|
+
software. You are welcome to redistribute this software and to use it for any
|
|
13
|
+
purpose, subject to the conditions under LEGAL ISSUES, below.
|
|
14
|
+
|
|
15
|
+
This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone,
|
|
16
|
+
Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson,
|
|
17
|
+
Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers,
|
|
18
|
+
and other members of the Independent JPEG Group.
|
|
19
|
+
|
|
20
|
+
IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee
|
|
21
|
+
(also known as JPEG, together with ITU-T SG16).
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
DOCUMENTATION ROADMAP
|
|
25
|
+
=====================
|
|
26
|
+
|
|
27
|
+
This file contains the following sections:
|
|
28
|
+
|
|
29
|
+
OVERVIEW General description of JPEG and the IJG software.
|
|
30
|
+
LEGAL ISSUES Copyright, lack of warranty, terms of distribution.
|
|
31
|
+
REFERENCES Where to learn more about JPEG.
|
|
32
|
+
ARCHIVE LOCATIONS Where to find newer versions of this software.
|
|
33
|
+
FILE FORMAT WARS Software *not* to get.
|
|
34
|
+
TO DO Plans for future IJG releases.
|
|
35
|
+
|
|
36
|
+
Other documentation files in the distribution are:
|
|
37
|
+
|
|
38
|
+
User documentation:
|
|
39
|
+
doc/usage.txt Usage instructions for cjpeg, djpeg, jpegtran,
|
|
40
|
+
rdjpgcom, and wrjpgcom.
|
|
41
|
+
doc/*.1 Unix-style man pages for programs (same info as
|
|
42
|
+
usage.txt).
|
|
43
|
+
doc/wizard.txt Advanced usage instructions for JPEG wizards only.
|
|
44
|
+
doc/change.log Version-to-version change highlights.
|
|
45
|
+
Programmer and internal documentation:
|
|
46
|
+
doc/libjpeg.txt How to use the JPEG library in your own programs.
|
|
47
|
+
src/example.c Sample code for calling the JPEG library.
|
|
48
|
+
doc/structure.txt Overview of the JPEG library's internal structure.
|
|
49
|
+
doc/coderules.txt Coding style rules --- please read if you contribute
|
|
50
|
+
code.
|
|
51
|
+
|
|
52
|
+
Please read at least usage.txt. Some information can also be found in the JPEG
|
|
53
|
+
FAQ (Frequently Asked Questions) article. See ARCHIVE LOCATIONS below to find
|
|
54
|
+
out where to obtain the FAQ article.
|
|
55
|
+
|
|
56
|
+
If you want to understand how the JPEG code works, we suggest reading one or
|
|
57
|
+
more of the REFERENCES, then looking at the documentation files (in roughly
|
|
58
|
+
the order listed) before diving into the code.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
OVERVIEW
|
|
62
|
+
========
|
|
63
|
+
|
|
64
|
+
This package contains C software to implement JPEG image encoding, decoding,
|
|
65
|
+
and transcoding. JPEG (pronounced "jay-peg") is a standardized compression
|
|
66
|
+
method for full-color and grayscale images. JPEG's strong suit is compressing
|
|
67
|
+
photographic images or other types of images that have smooth color and
|
|
68
|
+
brightness transitions between neighboring pixels. Images with sharp lines or
|
|
69
|
+
other abrupt features may not compress well with JPEG, and a higher JPEG
|
|
70
|
+
quality may have to be used to avoid visible compression artifacts with such
|
|
71
|
+
images.
|
|
72
|
+
|
|
73
|
+
JPEG is normally lossy, meaning that the output pixels are not necessarily
|
|
74
|
+
identical to the input pixels. However, on photographic content and other
|
|
75
|
+
"smooth" images, very good compression ratios can be obtained with no visible
|
|
76
|
+
compression artifacts, and extremely high compression ratios are possible if
|
|
77
|
+
you are willing to sacrifice image quality (by reducing the "quality" setting
|
|
78
|
+
in the compressor.)
|
|
79
|
+
|
|
80
|
+
This software implements JPEG baseline, extended-sequential, progressive, and
|
|
81
|
+
lossless compression processes. Provision is made for supporting all variants
|
|
82
|
+
of these processes, although some uncommon parameter settings aren't
|
|
83
|
+
implemented yet. We have made no provision for supporting the hierarchical
|
|
84
|
+
processes defined in the standard.
|
|
85
|
+
|
|
86
|
+
We provide a set of library routines for reading and writing JPEG image files,
|
|
87
|
+
plus two sample applications "cjpeg" and "djpeg", which use the library to
|
|
88
|
+
perform conversion between JPEG and some other popular image file formats.
|
|
89
|
+
The library is intended to be reused in other applications.
|
|
90
|
+
|
|
91
|
+
In order to support file conversion and viewing software, we have included
|
|
92
|
+
considerable functionality beyond the bare JPEG coding/decoding capability;
|
|
93
|
+
for example, the color quantization modules are not strictly part of JPEG
|
|
94
|
+
decoding, but they are essential for output to colormapped file formats. These
|
|
95
|
+
extra functions can be compiled out of the library if not required for a
|
|
96
|
+
particular application.
|
|
97
|
+
|
|
98
|
+
We have also included "jpegtran", a utility for lossless transcoding between
|
|
99
|
+
different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple
|
|
100
|
+
applications for inserting and extracting textual comments in JFIF files.
|
|
101
|
+
|
|
102
|
+
The emphasis in designing this software has been on achieving portability and
|
|
103
|
+
flexibility, while also making it fast enough to be useful. In particular,
|
|
104
|
+
the software is not intended to be read as a tutorial on JPEG. (See the
|
|
105
|
+
REFERENCES section for introductory material.) Rather, it is intended to
|
|
106
|
+
be reliable, portable, industrial-strength code. We do not claim to have
|
|
107
|
+
achieved that goal in every aspect of the software, but we strive for it.
|
|
108
|
+
|
|
109
|
+
We welcome the use of this software as a component of commercial products.
|
|
110
|
+
No royalty is required, but we do ask for an acknowledgement in product
|
|
111
|
+
documentation, as described under LEGAL ISSUES.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
LEGAL ISSUES
|
|
115
|
+
============
|
|
116
|
+
|
|
117
|
+
In plain English:
|
|
118
|
+
|
|
119
|
+
1. We don't promise that this software works. (But if you find any bugs,
|
|
120
|
+
please let us know!)
|
|
121
|
+
2. You can use this software for whatever you want. You don't have to pay us.
|
|
122
|
+
3. You may not pretend that you wrote this software. If you use it in a
|
|
123
|
+
program, you must acknowledge somewhere in your documentation that
|
|
124
|
+
you've used the IJG code.
|
|
125
|
+
|
|
126
|
+
In legalese:
|
|
127
|
+
|
|
128
|
+
The authors make NO WARRANTY or representation, either express or implied,
|
|
129
|
+
with respect to this software, its quality, accuracy, merchantability, or
|
|
130
|
+
fitness for a particular purpose. This software is provided "AS IS", and you,
|
|
131
|
+
its user, assume the entire risk as to its quality and accuracy.
|
|
132
|
+
|
|
133
|
+
This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
|
|
134
|
+
All Rights Reserved except as specified below.
|
|
135
|
+
|
|
136
|
+
Permission is hereby granted to use, copy, modify, and distribute this
|
|
137
|
+
software (or portions thereof) for any purpose, without fee, subject to these
|
|
138
|
+
conditions:
|
|
139
|
+
(1) If any part of the source code for this software is distributed, then this
|
|
140
|
+
README file must be included, with this copyright and no-warranty notice
|
|
141
|
+
unaltered; and any additions, deletions, or changes to the original files
|
|
142
|
+
must be clearly indicated in accompanying documentation.
|
|
143
|
+
(2) If only executable code is distributed, then the accompanying
|
|
144
|
+
documentation must state that "this software is based in part on the work of
|
|
145
|
+
the Independent JPEG Group".
|
|
146
|
+
(3) Permission for use of this software is granted only if the user accepts
|
|
147
|
+
full responsibility for any undesirable consequences; the authors accept
|
|
148
|
+
NO LIABILITY for damages of any kind.
|
|
149
|
+
|
|
150
|
+
These conditions apply to any software derived from or based on the IJG code,
|
|
151
|
+
not just to the unmodified library. If you use our work, you ought to
|
|
152
|
+
acknowledge us.
|
|
153
|
+
|
|
154
|
+
Permission is NOT granted for the use of any IJG author's name or company name
|
|
155
|
+
in advertising or publicity relating to this software or products derived from
|
|
156
|
+
it. This software may be referred to only as "the Independent JPEG Group's
|
|
157
|
+
software".
|
|
158
|
+
|
|
159
|
+
We specifically permit and encourage the use of this software as the basis of
|
|
160
|
+
commercial products, provided that all warranty or liability claims are
|
|
161
|
+
assumed by the product vendor.
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
REFERENCES
|
|
165
|
+
==========
|
|
166
|
+
|
|
167
|
+
We recommend reading one or more of these references before trying to
|
|
168
|
+
understand the innards of the JPEG software.
|
|
169
|
+
|
|
170
|
+
The best short technical introduction to the JPEG compression algorithm is
|
|
171
|
+
Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
|
|
172
|
+
Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
|
|
173
|
+
(Adjacent articles in that issue discuss MPEG motion picture compression,
|
|
174
|
+
applications of JPEG, and related topics.) If you don't have the CACM issue
|
|
175
|
+
handy, a PDF file containing a revised version of Wallace's article is
|
|
176
|
+
available at http://www.ijg.org/files/Wallace.JPEG.pdf. The file (actually
|
|
177
|
+
a preprint for an article that appeared in IEEE Trans. Consumer Electronics)
|
|
178
|
+
omits the sample images that appeared in CACM, but it includes corrections
|
|
179
|
+
and some added material. Note: the Wallace article is copyright ACM and IEEE,
|
|
180
|
+
and it may not be used for commercial purposes.
|
|
181
|
+
|
|
182
|
+
A somewhat less technical, more leisurely introduction to JPEG can be found in
|
|
183
|
+
"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by
|
|
184
|
+
M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides
|
|
185
|
+
good explanations and example C code for a multitude of compression methods
|
|
186
|
+
including JPEG. It is an excellent source if you are comfortable reading C
|
|
187
|
+
code but don't know much about data compression in general. The book's JPEG
|
|
188
|
+
sample code is far from industrial-strength, but when you are ready to look
|
|
189
|
+
at a full implementation, you've got one here...
|
|
190
|
+
|
|
191
|
+
The best currently available description of JPEG is the textbook "JPEG Still
|
|
192
|
+
Image Data Compression Standard" by William B. Pennebaker and Joan L.
|
|
193
|
+
Mitchell, published by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1.
|
|
194
|
+
Price US$59.95, 638 pp. The book includes the complete text of the ISO JPEG
|
|
195
|
+
standards (DIS 10918-1 and draft DIS 10918-2).
|
|
196
|
+
|
|
197
|
+
The original JPEG standard is divided into two parts, Part 1 being the actual
|
|
198
|
+
specification, while Part 2 covers compliance testing methods. Part 1 is
|
|
199
|
+
titled "Digital Compression and Coding of Continuous-tone Still Images,
|
|
200
|
+
Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS
|
|
201
|
+
10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of
|
|
202
|
+
Continuous-tone Still Images, Part 2: Compliance testing" and has document
|
|
203
|
+
numbers ISO/IEC IS 10918-2, ITU-T T.83.
|
|
204
|
+
|
|
205
|
+
The JPEG standard does not specify all details of an interchangeable file
|
|
206
|
+
format. For the omitted details, we follow the "JFIF" conventions, revision
|
|
207
|
+
1.02. JFIF version 1 has been adopted as ISO/IEC 10918-5 (05/2013) and
|
|
208
|
+
Recommendation ITU-T T.871 (05/2011): Information technology - Digital
|
|
209
|
+
compression and coding of continuous-tone still images: JPEG File Interchange
|
|
210
|
+
Format (JFIF). It is available as a free download in PDF file format from
|
|
211
|
+
https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871.
|
|
212
|
+
A PDF file of the older JFIF 1.02 specification is available at
|
|
213
|
+
http://www.w3.org/Graphics/JPEG/jfif3.pdf.
|
|
214
|
+
|
|
215
|
+
The TIFF 6.0 file format specification can be obtained from
|
|
216
|
+
http://mirrors.ctan.org/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation
|
|
217
|
+
scheme found in the TIFF 6.0 spec of 3-June-92 has a number of serious
|
|
218
|
+
problems. IJG does not recommend use of the TIFF 6.0 design (TIFF Compression
|
|
219
|
+
tag 6). Instead, we recommend the JPEG design proposed by TIFF Technical Note
|
|
220
|
+
#2 (Compression tag 7). Copies of this Note can be obtained from
|
|
221
|
+
http://www.ijg.org/files/. It is expected that the next revision
|
|
222
|
+
of the TIFF spec will replace the 6.0 JPEG design with the Note's design.
|
|
223
|
+
Although IJG's own code does not support TIFF/JPEG, the free libtiff library
|
|
224
|
+
uses our library to implement TIFF/JPEG per the Note.
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
ARCHIVE LOCATIONS
|
|
228
|
+
=================
|
|
229
|
+
|
|
230
|
+
The "official" archive site for this software is www.ijg.org.
|
|
231
|
+
The most recent released version can always be found there in
|
|
232
|
+
directory "files".
|
|
233
|
+
|
|
234
|
+
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
|
235
|
+
general information about JPEG. It is available at
|
|
236
|
+
http://www.faqs.org/faqs/jpeg-faq.
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
FILE FORMAT COMPATIBILITY
|
|
240
|
+
=========================
|
|
241
|
+
|
|
242
|
+
This software implements ITU T.81 | ISO/IEC 10918 with some extensions from
|
|
243
|
+
ITU T.871 | ISO/IEC 10918-5 (JPEG File Interchange Format-- see REFERENCES).
|
|
244
|
+
Informally, the term "JPEG image" or "JPEG file" most often refers to JFIF or
|
|
245
|
+
a subset thereof, but there are other formats containing the name "JPEG" that
|
|
246
|
+
are incompatible with the original JPEG standard or with JFIF (for instance,
|
|
247
|
+
JPEG 2000 and JPEG XR). This software therefore does not support these
|
|
248
|
+
formats. Indeed, one of the original reasons for developing this free software
|
|
249
|
+
was to help force convergence on a common, interoperable format standard for
|
|
250
|
+
JPEG files.
|
|
251
|
+
|
|
252
|
+
JFIF is a minimal or "low end" representation. TIFF/JPEG (TIFF revision 6.0 as
|
|
253
|
+
modified by TIFF Technical Note #2) can be used for "high end" applications
|
|
254
|
+
that need to record a lot of additional data about an image.
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
TO DO
|
|
258
|
+
=====
|
|
259
|
+
|
|
260
|
+
Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org.
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
Background
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
libjpeg-turbo is a JPEG image codec that uses SIMD instructions to accelerate
|
|
5
|
+
baseline JPEG compression and decompression on x86, x86-64, Arm, PowerPC, and
|
|
6
|
+
MIPS systems, as well as progressive JPEG compression on x86, x86-64, and Arm
|
|
7
|
+
systems. On such systems, libjpeg-turbo is generally 2-6x as fast as libjpeg,
|
|
8
|
+
all else being equal. On other types of systems, libjpeg-turbo can still
|
|
9
|
+
outperform libjpeg by a significant amount, by virtue of its highly-optimized
|
|
10
|
+
Huffman coding routines. In many cases, the performance of libjpeg-turbo
|
|
11
|
+
rivals that of proprietary high-speed JPEG codecs.
|
|
12
|
+
|
|
13
|
+
libjpeg-turbo implements both the traditional libjpeg API as well as the less
|
|
14
|
+
powerful but more straightforward TurboJPEG API. libjpeg-turbo also features
|
|
15
|
+
colorspace extensions that allow it to compress from/decompress to 32-bit and
|
|
16
|
+
big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java
|
|
17
|
+
interface.
|
|
18
|
+
|
|
19
|
+
libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated
|
|
20
|
+
derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and
|
|
21
|
+
VirtualGL projects made numerous enhancements to the codec in 2009, and in
|
|
22
|
+
early 2010, libjpeg-turbo spun off into an independent project, with the goal
|
|
23
|
+
of making high-speed JPEG compression/decompression technology available to a
|
|
24
|
+
broader range of users and developers. libjpeg-turbo is an ISO/IEC and ITU-T
|
|
25
|
+
reference implementation of the JPEG standard.
|
|
26
|
+
|
|
27
|
+
More information about libjpeg-turbo can be found at
|
|
28
|
+
<https://libjpeg-turbo.org>.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Funding
|
|
32
|
+
=======
|
|
33
|
+
|
|
34
|
+
libjpeg-turbo is an independent open source project, but we rely on patronage
|
|
35
|
+
and funded development in order to maintain that independence. The easiest way
|
|
36
|
+
to ensure that libjpeg-turbo remains community-focused and free of any one
|
|
37
|
+
organization's agenda is to
|
|
38
|
+
[sponsor our project through GitHub](https://github.com/sponsors/libjpeg-turbo).
|
|
39
|
+
All sponsorship money goes directly toward funding the labor necessary to
|
|
40
|
+
maintain libjpeg-turbo, support the user community, and implement bug fixes and
|
|
41
|
+
strategically important features.
|
|
42
|
+
|
|
43
|
+
[](https://github.com/sponsors/libjpeg-turbo)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
License
|
|
47
|
+
=======
|
|
48
|
+
|
|
49
|
+
libjpeg-turbo is covered by three compatible BSD-style open source licenses.
|
|
50
|
+
Refer to [LICENSE.md](LICENSE.md) for a roll-up of license terms.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
Building libjpeg-turbo
|
|
54
|
+
======================
|
|
55
|
+
|
|
56
|
+
Refer to [BUILDING.md](BUILDING.md) for complete instructions.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
Using libjpeg-turbo
|
|
60
|
+
===================
|
|
61
|
+
|
|
62
|
+
libjpeg-turbo includes two APIs that can be used to compress and decompress
|
|
63
|
+
JPEG images:
|
|
64
|
+
|
|
65
|
+
- **TurboJPEG API**<br>
|
|
66
|
+
This API provides an easy-to-use interface for compressing and decompressing
|
|
67
|
+
JPEG images in memory. It also provides some functionality that would not be
|
|
68
|
+
straightforward to achieve using the underlying libjpeg API, such as
|
|
69
|
+
generating planar YUV images and performing multiple simultaneous lossless
|
|
70
|
+
transforms on an image. The Java interface for libjpeg-turbo is written on
|
|
71
|
+
top of the TurboJPEG API. The TurboJPEG API is recommended for first-time
|
|
72
|
+
users of libjpeg-turbo. Refer to [tjcomp.c](src/tjcomp.c),
|
|
73
|
+
[tjdecomp.c](src/tjdecomp.c), [tjtran.c](src/tjtran.c),
|
|
74
|
+
[TJComp.java](java/TJComp.java), [TJDecomp.java](java/TJDecomp.java), and
|
|
75
|
+
[TJTran.java](java/TJTran.java) for examples of its usage and to
|
|
76
|
+
<https://libjpeg-turbo.org/Documentation/Documentation> for API
|
|
77
|
+
documentation.
|
|
78
|
+
|
|
79
|
+
- **libjpeg API**<br>
|
|
80
|
+
This is the de facto industry-standard API for compressing and decompressing
|
|
81
|
+
JPEG images. It is more difficult to use than the TurboJPEG API but also
|
|
82
|
+
more powerful. The libjpeg API implementation in libjpeg-turbo is both
|
|
83
|
+
API/ABI-compatible and mathematically compatible with libjpeg v6b. It can
|
|
84
|
+
also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8
|
|
85
|
+
(see below.) Refer to [cjpeg.c](src/cjpeg.c) and [djpeg.c](src/djpeg.c) for
|
|
86
|
+
examples of its usage and to [libjpeg.txt](doc/libjpeg.txt) for API
|
|
87
|
+
documentation.
|
|
88
|
+
|
|
89
|
+
There is no significant performance advantage to either API when both are used
|
|
90
|
+
to perform similar operations.
|
|
91
|
+
|
|
92
|
+
Colorspace Extensions
|
|
93
|
+
---------------------
|
|
94
|
+
|
|
95
|
+
libjpeg-turbo includes extensions that allow JPEG images to be compressed
|
|
96
|
+
directly from (and decompressed directly to) buffers that use BGR, BGRX,
|
|
97
|
+
RGBX, XBGR, and XRGB pixel ordering. This is implemented with ten new
|
|
98
|
+
colorspace constants:
|
|
99
|
+
|
|
100
|
+
JCS_EXT_RGB /* red/green/blue */
|
|
101
|
+
JCS_EXT_RGBX /* red/green/blue/x */
|
|
102
|
+
JCS_EXT_BGR /* blue/green/red */
|
|
103
|
+
JCS_EXT_BGRX /* blue/green/red/x */
|
|
104
|
+
JCS_EXT_XBGR /* x/blue/green/red */
|
|
105
|
+
JCS_EXT_XRGB /* x/red/green/blue */
|
|
106
|
+
JCS_EXT_RGBA /* red/green/blue/alpha */
|
|
107
|
+
JCS_EXT_BGRA /* blue/green/red/alpha */
|
|
108
|
+
JCS_EXT_ABGR /* alpha/blue/green/red */
|
|
109
|
+
JCS_EXT_ARGB /* alpha/red/green/blue */
|
|
110
|
+
|
|
111
|
+
Setting `cinfo.in_color_space` (compression) or `cinfo.out_color_space`
|
|
112
|
+
(decompression) to one of these values will cause libjpeg-turbo to read the
|
|
113
|
+
red, green, and blue values from (or write them to) the appropriate position in
|
|
114
|
+
the pixel when compressing from/decompressing to an RGB buffer.
|
|
115
|
+
|
|
116
|
+
Your application can check for the existence of these extensions at compile
|
|
117
|
+
time with:
|
|
118
|
+
|
|
119
|
+
#ifdef JCS_EXTENSIONS
|
|
120
|
+
|
|
121
|
+
At run time, attempting to use these extensions with a libjpeg implementation
|
|
122
|
+
that does not support them will result in a "Bogus input colorspace" error.
|
|
123
|
+
Applications can trap this error in order to test whether run-time support is
|
|
124
|
+
available for the colorspace extensions.
|
|
125
|
+
|
|
126
|
+
When using the RGBX, BGRX, XBGR, and XRGB colorspaces during decompression, the
|
|
127
|
+
X byte is undefined, and in order to ensure the best performance, libjpeg-turbo
|
|
128
|
+
can set that byte to whatever value it wishes. If an application expects the X
|
|
129
|
+
byte to be used as an alpha channel, then it should specify `JCS_EXT_RGBA`,
|
|
130
|
+
`JCS_EXT_BGRA`, `JCS_EXT_ABGR`, or `JCS_EXT_ARGB`. When these colorspace
|
|
131
|
+
constants are used, the X byte is guaranteed to be 0xFF, which is interpreted
|
|
132
|
+
as opaque.
|
|
133
|
+
|
|
134
|
+
Your application can check for the existence of the alpha channel colorspace
|
|
135
|
+
extensions at compile time with:
|
|
136
|
+
|
|
137
|
+
#ifdef JCS_ALPHA_EXTENSIONS
|
|
138
|
+
|
|
139
|
+
[jcstest.c](src/jcstest.c), located in the libjpeg-turbo source tree,
|
|
140
|
+
demonstrates how to check for the existence of the colorspace extensions at
|
|
141
|
+
compile time and run time.
|
|
142
|
+
|
|
143
|
+
libjpeg v7 and v8 API/ABI Emulation
|
|
144
|
+
-----------------------------------
|
|
145
|
+
|
|
146
|
+
With libjpeg v7 and v8, new features were added that necessitated extending the
|
|
147
|
+
compression and decompression structures. Unfortunately, due to the exposed
|
|
148
|
+
nature of those structures, extending them also necessitated breaking backward
|
|
149
|
+
ABI compatibility with previous libjpeg releases. Thus, programs that were
|
|
150
|
+
built to use libjpeg v7 or v8 did not work with libjpeg-turbo, since it is
|
|
151
|
+
based on the libjpeg v6b code base. Although libjpeg v7 and v8 are not
|
|
152
|
+
as widely used as v6b, enough programs (including a few Linux distros) made
|
|
153
|
+
the switch that there was a demand to emulate the libjpeg v7 and v8 ABIs
|
|
154
|
+
in libjpeg-turbo. It should be noted, however, that this feature was added
|
|
155
|
+
primarily so that applications that had already been compiled to use libjpeg
|
|
156
|
+
v7+ could take advantage of accelerated baseline JPEG encoding/decoding
|
|
157
|
+
without recompiling. libjpeg-turbo does not claim to support all of the
|
|
158
|
+
libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all
|
|
159
|
+
cases (see below.)
|
|
160
|
+
|
|
161
|
+
By passing an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you
|
|
162
|
+
can build a version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so
|
|
163
|
+
that programs that are built against libjpeg v7 or v8 can be run with
|
|
164
|
+
libjpeg-turbo. The following section describes which libjpeg v7+ features are
|
|
165
|
+
supported and which aren't.
|
|
166
|
+
|
|
167
|
+
### Support for libjpeg v7 and v8 Features
|
|
168
|
+
|
|
169
|
+
#### Fully supported
|
|
170
|
+
|
|
171
|
+
- **libjpeg API: IDCT scaling extensions in decompressor**<br>
|
|
172
|
+
libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
|
|
173
|
+
1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
|
|
174
|
+
and 1/2 are SIMD-accelerated.)
|
|
175
|
+
|
|
176
|
+
- **libjpeg API: Arithmetic coding**
|
|
177
|
+
|
|
178
|
+
- **libjpeg API: In-memory source and destination managers**<br>
|
|
179
|
+
See notes below.
|
|
180
|
+
|
|
181
|
+
- **cjpeg: Separate quality settings for luminance and chrominance**<br>
|
|
182
|
+
Note that the libpjeg v7+ API was extended to accommodate this feature only
|
|
183
|
+
for convenience purposes. It has always been possible to implement this
|
|
184
|
+
feature with libjpeg v6b (see rdswitch.c for an example.)
|
|
185
|
+
|
|
186
|
+
- **cjpeg: 32-bit BMP support**
|
|
187
|
+
|
|
188
|
+
- **cjpeg: `-rgb` option**
|
|
189
|
+
|
|
190
|
+
- **jpegtran: Lossless cropping**
|
|
191
|
+
|
|
192
|
+
- **jpegtran: `-perfect` option**
|
|
193
|
+
|
|
194
|
+
- **jpegtran: Forcing width/height when performing lossless crop**
|
|
195
|
+
|
|
196
|
+
- **rdjpgcom: `-raw` option**
|
|
197
|
+
|
|
198
|
+
- **rdjpgcom: Locale awareness**
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
#### Not supported
|
|
202
|
+
|
|
203
|
+
NOTE: As of this writing, extensive research has been conducted into the
|
|
204
|
+
usefulness of DCT scaling as a means of data reduction and SmartScale as a
|
|
205
|
+
means of quality improvement. Readers are invited to peruse the research at
|
|
206
|
+
<https://libjpeg-turbo.org/About/SmartScale> and draw their own conclusions,
|
|
207
|
+
but it is the general belief of our project that these features have not
|
|
208
|
+
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
|
209
|
+
|
|
210
|
+
- **libjpeg API: DCT scaling in compressor**<br>
|
|
211
|
+
`cinfo.scale_num` and `cinfo.scale_denom` are silently ignored.
|
|
212
|
+
There is no technical reason why DCT scaling could not be supported when
|
|
213
|
+
emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
|
|
214
|
+
below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
|
|
215
|
+
8/9 would be available, which is of limited usefulness.
|
|
216
|
+
|
|
217
|
+
- **libjpeg API: SmartScale**<br>
|
|
218
|
+
`cinfo.block_size` is silently ignored.
|
|
219
|
+
SmartScale is an extension to the JPEG format that allows for DCT block
|
|
220
|
+
sizes other than 8x8. Providing support for this new format would be
|
|
221
|
+
feasible (particularly without full acceleration.) However, until/unless
|
|
222
|
+
the format becomes either an official industry standard or, at minimum, an
|
|
223
|
+
accepted solution in the community, we are hesitant to implement it, as
|
|
224
|
+
there is no sense of whether or how it might change in the future. It is
|
|
225
|
+
our belief that SmartScale has not demonstrated sufficient usefulness as a
|
|
226
|
+
lossless format nor as a means of quality enhancement, and thus our primary
|
|
227
|
+
interest in providing this feature would be as a means of supporting
|
|
228
|
+
additional DCT scaling factors.
|
|
229
|
+
|
|
230
|
+
- **libjpeg API: Fancy downsampling in compressor**<br>
|
|
231
|
+
`cinfo.do_fancy_downsampling` is silently ignored.
|
|
232
|
+
This requires the DCT scaling feature, which is not supported.
|
|
233
|
+
|
|
234
|
+
- **jpegtran: Scaling**<br>
|
|
235
|
+
This requires both the DCT scaling and SmartScale features, which are not
|
|
236
|
+
supported.
|
|
237
|
+
|
|
238
|
+
- **Lossless RGB JPEG files**<br>
|
|
239
|
+
This requires the SmartScale feature, which is not supported.
|
|
240
|
+
|
|
241
|
+
### What About libjpeg v9?
|
|
242
|
+
|
|
243
|
+
libjpeg v9 introduced yet another field to the JPEG compression structure
|
|
244
|
+
(`color_transform`), thus making the ABI backward incompatible with that of
|
|
245
|
+
libjpeg v8. This new field was introduced solely for the purpose of supporting
|
|
246
|
+
lossless SmartScale encoding. Furthermore, there was actually no reason to
|
|
247
|
+
extend the API in this manner, as the color transform could have just as easily
|
|
248
|
+
been activated by way of a new JPEG colorspace constant, thus preserving
|
|
249
|
+
backward ABI compatibility.
|
|
250
|
+
|
|
251
|
+
Our research (see link above) has shown that lossless SmartScale does not
|
|
252
|
+
generally accomplish anything that can't already be accomplished better with
|
|
253
|
+
existing, standard lossless formats. Therefore, at this time it is our belief
|
|
254
|
+
that there is not sufficient technical justification for software projects to
|
|
255
|
+
upgrade from libjpeg v8 to libjpeg v9, and thus there is not sufficient
|
|
256
|
+
technical justification for us to emulate the libjpeg v9 ABI.
|
|
257
|
+
|
|
258
|
+
In-Memory Source/Destination Managers
|
|
259
|
+
-------------------------------------
|
|
260
|
+
|
|
261
|
+
By default, libjpeg-turbo 1.3 and later includes the `jpeg_mem_src()` and
|
|
262
|
+
`jpeg_mem_dest()` functions, even when not emulating the libjpeg v8 API/ABI.
|
|
263
|
+
Previously, it was necessary to build libjpeg-turbo from source with libjpeg v8
|
|
264
|
+
API/ABI emulation in order to use the in-memory source/destination managers,
|
|
265
|
+
but several projects requested that those functions be included when emulating
|
|
266
|
+
the libjpeg v6b API/ABI as well. This allows the use of those functions by
|
|
267
|
+
programs that need them, without breaking ABI compatibility for programs that
|
|
268
|
+
don't, and it allows those functions to be provided in the "official"
|
|
269
|
+
libjpeg-turbo binaries.
|
|
270
|
+
|
|
271
|
+
Note that, on most Un*x systems, the dynamic linker will not look for a
|
|
272
|
+
function in a library until that function is actually used. Thus, if a program
|
|
273
|
+
is built against libjpeg-turbo 1.3+ and uses `jpeg_mem_src()` or
|
|
274
|
+
`jpeg_mem_dest()`, that program will not fail if run against an older version
|
|
275
|
+
of libjpeg-turbo or against libjpeg v7- until the program actually tries to
|
|
276
|
+
call `jpeg_mem_src()` or `jpeg_mem_dest()`. Such is not the case on Windows.
|
|
277
|
+
If a program is built against the libjpeg-turbo 1.3+ DLL and uses
|
|
278
|
+
`jpeg_mem_src()` or `jpeg_mem_dest()`, then it must use the libjpeg-turbo 1.3+
|
|
279
|
+
DLL at run time.
|
|
280
|
+
|
|
281
|
+
Both cjpeg and djpeg have been extended to allow testing the in-memory
|
|
282
|
+
source/destination manager functions. See their respective man pages for more
|
|
283
|
+
details.
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
Mathematical Compatibility
|
|
287
|
+
==========================
|
|
288
|
+
|
|
289
|
+
For the most part, libjpeg-turbo should produce identical output to libjpeg
|
|
290
|
+
v6b. There are two exceptions:
|
|
291
|
+
|
|
292
|
+
1. When decompressing a JPEG image that uses 4:4:0 chrominance subsampling, the
|
|
293
|
+
outputs of libjpeg v6b and libjpeg-turbo can differ because libjpeg-turbo
|
|
294
|
+
implements a "fancy" (smooth) 4:4:0 upsampling algorithm and libjpeg did not.
|
|
295
|
+
|
|
296
|
+
2. When using the floating point DCT/IDCT, the outputs of libjpeg v6b and
|
|
297
|
+
libjpeg-turbo can differ for the following reasons:
|
|
298
|
+
|
|
299
|
+
- The SSE/SSE2 floating point DCT implementation in libjpeg-turbo is ever
|
|
300
|
+
so slightly more accurate than the implementation in libjpeg v6b, but not
|
|
301
|
+
by any amount perceptible to human vision (generally in the range of 0.01
|
|
302
|
+
to 0.08 dB gain in PNSR.)
|
|
303
|
+
|
|
304
|
+
- When not using the SIMD extensions, libjpeg-turbo uses the more accurate
|
|
305
|
+
(and slightly faster) floating point IDCT algorithm introduced in libjpeg
|
|
306
|
+
v8a as opposed to the algorithm used in libjpeg v6b. It should be noted,
|
|
307
|
+
however, that this algorithm basically brings the accuracy of the
|
|
308
|
+
floating point IDCT in line with the accuracy of the accurate integer
|
|
309
|
+
IDCT. The floating point DCT/IDCT algorithms are mainly a legacy
|
|
310
|
+
feature, and they do not produce significantly more accuracy than the
|
|
311
|
+
accurate integer algorithms. (To put numbers on this, the typical
|
|
312
|
+
difference in PNSR between the two algorithms is less than 0.10 dB,
|
|
313
|
+
whereas changing the quality level by 1 in the upper range of the quality
|
|
314
|
+
scale is typically more like a 1.0 dB difference.)
|
|
315
|
+
|
|
316
|
+
- If the floating point algorithms in libjpeg-turbo are not implemented
|
|
317
|
+
using SIMD instructions on a particular platform, then the accuracy of
|
|
318
|
+
the floating point DCT/IDCT can depend on the compiler settings.
|
|
319
|
+
|
|
320
|
+
While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood it is
|
|
321
|
+
still using the same algorithms as libjpeg v6b, so there are several specific
|
|
322
|
+
cases in which libjpeg-turbo cannot be expected to produce the same output as
|
|
323
|
+
libjpeg v8:
|
|
324
|
+
|
|
325
|
+
- When decompressing using scaling factors of 1/2 and 1/4, because libjpeg v8
|
|
326
|
+
implements those scaling algorithms differently than libjpeg v6b does, and
|
|
327
|
+
libjpeg-turbo's SIMD extensions are based on the libjpeg v6b behavior.
|
|
328
|
+
|
|
329
|
+
- When using chrominance subsampling, because libjpeg v8 implements this
|
|
330
|
+
with its DCT/IDCT scaling algorithms rather than with a separate
|
|
331
|
+
downsampling/upsampling algorithm. In our testing, the subsampled/upsampled
|
|
332
|
+
output of libjpeg v8 is less accurate than that of libjpeg v6b for this
|
|
333
|
+
reason.
|
|
334
|
+
|
|
335
|
+
- When decompressing using a scaling factor > 1 and merged (AKA "non-fancy" or
|
|
336
|
+
"non-smooth") chrominance upsampling, because libjpeg v8 does not support
|
|
337
|
+
merged upsampling with scaling factors > 1.
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
Performance Pitfalls
|
|
341
|
+
====================
|
|
342
|
+
|
|
343
|
+
Restart Markers
|
|
344
|
+
---------------
|
|
345
|
+
|
|
346
|
+
The optimized Huffman decoder in libjpeg-turbo does not handle restart markers
|
|
347
|
+
in a way that makes the rest of the libjpeg infrastructure happy, so it is
|
|
348
|
+
necessary to use the slow Huffman decoder when decompressing a JPEG image that
|
|
349
|
+
has restart markers. This can cause the decompression performance to drop by
|
|
350
|
+
as much as 20%, but the performance will still be much greater than that of
|
|
351
|
+
libjpeg. Many consumer packages, such as Photoshop, use restart markers when
|
|
352
|
+
generating JPEG images, so images generated by those programs will experience
|
|
353
|
+
this issue.
|
|
354
|
+
|
|
355
|
+
Fast Integer Forward DCT at High Quality Levels
|
|
356
|
+
-----------------------------------------------
|
|
357
|
+
|
|
358
|
+
The algorithm used by the SIMD-accelerated quantization function cannot produce
|
|
359
|
+
correct results whenever the fast integer forward DCT is used along with a JPEG
|
|
360
|
+
quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization
|
|
361
|
+
function in those cases. This causes performance to drop by as much as 40%.
|
|
362
|
+
It is therefore strongly advised that you use the accurate integer forward DCT
|
|
363
|
+
whenever encoding images with a JPEG quality of 98 or higher.
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
Memory Debugger Pitfalls
|
|
367
|
+
========================
|
|
368
|
+
|
|
369
|
+
Valgrind and Memory Sanitizer (MSan) can generate false positives
|
|
370
|
+
(specifically, incorrect reports of uninitialized memory accesses) when used
|
|
371
|
+
with libjpeg-turbo's SIMD extensions. It is generally recommended that the
|
|
372
|
+
SIMD extensions be disabled, either by passing an argument of `-DWITH_SIMD=0`
|
|
373
|
+
to `cmake` when configuring the build or by setting the environment variable
|
|
374
|
+
`JSIMD_FORCENONE` to `1` at run time, when testing libjpeg-turbo with Valgrind,
|
|
375
|
+
MSan, or other memory debuggers.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
License Agreement
|
|
2
|
+
For chi_table.h
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Per-Erik Forssen, all rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
7
|
+
are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistribution's of source code must retain the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistribution's in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
* The name of the copyright holders may not be used to endorse or promote products
|
|
17
|
+
derived from this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
This software is provided by the copyright holders and contributors "as is" and
|
|
20
|
+
any express or implied warranties, including, but not limited to, the implied
|
|
21
|
+
warranties of merchantability and fitness for a particular purpose are disclaimed.
|
|
22
|
+
In no event shall the Intel Corporation or contributors be liable for any direct,
|
|
23
|
+
indirect, incidental, special, exemplary, or consequential damages
|
|
24
|
+
(including, but not limited to, procurement of substitute goods or services;
|
|
25
|
+
loss of use, data, or profits; or business interruption) however caused
|
|
26
|
+
and on any theory of liability, whether in contract, strict liability,
|
|
27
|
+
or tort (including negligence or otherwise) arising in any way out of
|
|
28
|
+
the use of this software, even if advised of the possibility of such damage.
|