Update bundled libjpeg-turbo to version 3.1.0
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 3.1.0 Pick-to: 6.5 5.15 Change-Id: I321ae095b4ed826ceb940cbf13a63ec1a836acb3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 1a5afe625be1ed936d2fc4da98ed1c8fa574ee7b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit a994bc80fe6674a35aa3f2060f31b4c391942725)
This commit is contained in:
parent
596278c7cb
commit
d5544a6d0d
@ -1,3 +1,122 @@
|
||||
3.1.0
|
||||
=====
|
||||
|
||||
### Significant changes relative to 3.1 beta1:
|
||||
|
||||
1. Fixed an issue in the TurboJPEG API whereby, when generating a
|
||||
lossless JPEG image with more than 8 bits per sample, specifying a point
|
||||
transform value greater than 7 resulted in an error ("Parameter value out of
|
||||
range") unless `TJPARAM_PRECISION`/`TJ.PARAM_PRECISION` was specified before
|
||||
`TJPARAM_LOSSLESSPT`/`TJ.PARAM_LOSSLESSPT`.
|
||||
|
||||
2. Fixed a regression introduced by 1.4 beta1[3] that prevented
|
||||
`jpeg_set_defaults()` from resetting the Huffman tables to default (baseline)
|
||||
values if Huffman table optimization or progressive mode was previously enabled
|
||||
in the same libjpeg instance.
|
||||
|
||||
3. Fixed an issue whereby lossless JPEG compression could not be disabled if it
|
||||
was previously enabled in a libjpeg or TurboJPEG instance.
|
||||
`jpeg_set_defaults()` now disables lossless JPEG compression in a libjpeg
|
||||
instance, and setting `TJPARAM_LOSSLESS`/`TJ.PARAM_LOSSLESS` to `0` now
|
||||
disables lossless JPEG compression in a TurboJPEG instance.
|
||||
|
||||
|
||||
3.1 beta1
|
||||
=========
|
||||
|
||||
### Significant changes relative to 3.0.4:
|
||||
|
||||
1. The libjpeg-turbo source tree has been reorganized to make it easier to find
|
||||
the README files, license information, and build instructions. The
|
||||
documentation for the libjpeg API library and associated programs has been
|
||||
moved into the **doc/** subdirectory, all C source code and headers have been
|
||||
moved into a new **src/** subdirectory, and test scripts have been moved into a
|
||||
new **test/** subdirectory.
|
||||
|
||||
2. cjpeg no longer allows GIF input files to be converted into
|
||||
12-bit-per-sample JPEG files. That was never a useful feature, since GIF
|
||||
images have at most 256 colors referenced from a palette of 8-bit-per-component
|
||||
RGB values.
|
||||
|
||||
3. Added support for lossless JPEG images with 2 to 15 bits per sample to the
|
||||
libjpeg and TurboJPEG APIs. When creating or decompressing a lossless JPEG
|
||||
image and when loading or saving a PBMPLUS image, functions/methods specific to
|
||||
8-bit samples now handle 8-bit samples with 2 to 8 bits of data precision
|
||||
(specified using the `data_precision` field in `jpeg_compress_struct` or
|
||||
`jpeg_decompress_struct` or using `TJPARAM_PRECISION`/`TJ.PARAM_PRECISION`),
|
||||
functions/methods specific to 12-bit samples now handle 12-bit samples with 9
|
||||
to 12 bits of data precision, and functions/methods specific to 16-bit samples
|
||||
now handle 16-bit samples with 13 to 16 bits of data precision. Refer to
|
||||
[libjpeg.txt](doc/libjpeg.txt), [usage.txt](doc/usage.txt), and the TurboJPEG
|
||||
API documentation for more details.
|
||||
|
||||
4. All deprecated constants and methods in the TurboJPEG Java API have been
|
||||
removed.
|
||||
|
||||
5. TJBench command-line arguments are now more consistent with those of cjpeg,
|
||||
djpeg, and jpegtran. More specifically:
|
||||
|
||||
- `-copynone` has been replaced with `-copy none`.
|
||||
- `-fastdct` has been replaced with `-dct fast`.
|
||||
- `-fastupsample` has been replaced with `-nosmooth`.
|
||||
- `-hflip` and `-vflip` have been replaced with
|
||||
`-flip {horizontal|vertical}`.
|
||||
- `-limitscans` has been replaced with `-maxscans`, which allows the scan
|
||||
limit to be specified.
|
||||
- `-rgb`, `-bgr`, `-rgbx`, `-bgrx`, `-xbgr`, `-xrgb`, and `-cmyk` have
|
||||
been replaced with `-pixelformat {rgb|bgr|rgbx|bgrx|xbgr|xrgb|cmyk}`.
|
||||
- `-rot90`, `-rot180`, and `-rot270` have been replaced with
|
||||
`-rotate {90|180|270}`.
|
||||
- `-stoponwarning` has been replaced with `-strict`.
|
||||
- British spellings for `gray` (`grey`) and `optimize` (`optimise`) are
|
||||
now allowed.
|
||||
|
||||
The old command-line arguments are deprecated and will be removed in a
|
||||
future release. TJBench command-line arguments can now be abbreviated as well.
|
||||
(Where possible, the abbreviations are the same as those supported by cjpeg,
|
||||
djpeg, and jpegtran.)
|
||||
|
||||
6. Added a new TJBench option (`-pixelformat gray`) that can be used to test
|
||||
the performance of compressing/decompressing a grayscale JPEG image from/to a
|
||||
packed-pixel grayscale image.
|
||||
|
||||
7. Fixed an issue whereby, if `TJPARAM_NOREALLOC` was set, TurboJPEG
|
||||
compression and lossless transformation functions ignored the JPEG buffer
|
||||
size(s) passed to them and assumed that the JPEG buffer(s) had been allocated
|
||||
to a worst-case size returned by `tj3JPEGBufSize()`. This behavior was never
|
||||
documented, although the documentation was unclear regarding whether the JPEG
|
||||
buffer size should be specified if a JPEG buffer is pre-allocated to a
|
||||
worst-case size.
|
||||
|
||||
8. The TurboJPEG C and Java APIs have been improved in the following ways:
|
||||
|
||||
- New image I/O methods (`TJCompressor.loadSourceImage()` and
|
||||
`TJDecompressor.saveImage()`) have been added to the Java API. These methods
|
||||
work similarly to the `tj3LoadImage*()` and `tj3SaveImage*()` functions in the
|
||||
C API.
|
||||
- The TurboJPEG lossless transformation function and methods now add
|
||||
restart markers to all destination images if
|
||||
`TJPARAM_RESTARTBLOCKS`/`TJ.PARAM_RESTARTBLOCKS` or
|
||||
`TJPARAM_RESTARTROWS`/`TJ.PARAM_RESTARTROWS` is set.
|
||||
- New functions/methods (`tj3SetICCProfile()` /
|
||||
`TJCompressor.setICCProfile()` / `TJTransformer.setICCProfile()` and
|
||||
`tj3GetICCProfile()` / `TJDecompressor.getICCProfile()`) can be used to embed
|
||||
and retrieve ICC profiles.
|
||||
- A new parameter (`TJPARAM_SAVEMARKERS`/`TJ.PARAM_SAVEMARKERS`) can be
|
||||
used to specify the types of markers that will be copied from the source image
|
||||
to the destination image during lossless transformation if
|
||||
`TJXOPT_COPYNONE`/`TJTransform.OPT_COPYNONE` is not specified.
|
||||
- A new convenience function/method (`tj3TransformBufSize()` /
|
||||
`TJTransformer.bufSize()`) can be used to compute the worst-case destination
|
||||
buffer size for a given lossless transform, taking into account cropping,
|
||||
transposition of the width and height, grayscale conversion, and the embedded
|
||||
or extracted ICC profile.
|
||||
|
||||
9. TJExample has been replaced with three programs (TJComp, TJDecomp, and
|
||||
TJTran) that demonstrate how to approximate the functionality of cjpeg, djpeg,
|
||||
and jpegtran using the TurboJPEG C and Java APIs.
|
||||
|
||||
|
||||
3.0.4
|
||||
=====
|
||||
|
||||
@ -51,7 +170,11 @@ cropping regions to be unduly rejected when performing 90-degree rotation,
|
||||
270-degree rotation, transposition, transverse transposition, or grayscale
|
||||
conversion.
|
||||
|
||||
8. Fixed an issue whereby the TurboJPEG lossless transformation function and
|
||||
8. Fixed a regression, introduced by 3.0 beta2[4], that prevented the
|
||||
`tjTransform()` backward compatibility function from copying extra markers from
|
||||
the source image to the destination image.
|
||||
|
||||
9. Fixed an issue whereby the TurboJPEG lossless transformation function and
|
||||
methods did not honor `TJXOPT_COPYNONE`/`TJTransform.OPT_COPYNONE` unless it
|
||||
was specified for all lossless transforms.
|
||||
|
||||
@ -302,8 +425,8 @@ information.
|
||||
`TJPARAM_LOSSLESSPT`/`TJ.PARAM_LOSSLESSPT`), and a cjpeg/TJBench option
|
||||
(`-lossless`) can be used to create a lossless JPEG image. (Decompression of
|
||||
lossless JPEG images is handled automatically.) Refer to
|
||||
[libjpeg.txt](libjpeg.txt), [usage.txt](usage.txt), and the TurboJPEG API
|
||||
documentation for more details.
|
||||
[libjpeg.txt](doc/libjpeg.txt), [usage.txt](doc/usage.txt), and the TurboJPEG
|
||||
API documentation for more details.
|
||||
|
||||
6. Added support for 12-bit-per-component (lossy and lossless) and
|
||||
16-bit-per-component (lossless) JPEG images to the libjpeg and TurboJPEG APIs:
|
||||
@ -330,8 +453,8 @@ to create a 12-bit-per-component or 16-bit-per-component JPEG image.
|
||||
(Decompression and transformation of 12-bit-per-component and
|
||||
16-bit-per-component JPEG images is handled automatically.)
|
||||
|
||||
Refer to [libjpeg.txt](libjpeg.txt), [usage.txt](usage.txt), and the
|
||||
TurboJPEG API documentation for more details.
|
||||
Refer to [libjpeg.txt](doc/libjpeg.txt), [usage.txt](doc/usage.txt), and
|
||||
the TurboJPEG API documentation for more details.
|
||||
|
||||
|
||||
2.1.5.1
|
||||
@ -1392,7 +1515,7 @@ use of AltiVec instructions.
|
||||
|
||||
2. Added two new libjpeg API functions (`jpeg_skip_scanlines()` and
|
||||
`jpeg_crop_scanline()`) that can be used to partially decode a JPEG image. See
|
||||
[libjpeg.txt](libjpeg.txt) for more details.
|
||||
[libjpeg.txt](doc/libjpeg.txt) for more details.
|
||||
|
||||
3. The TJCompressor and TJDecompressor classes in the TurboJPEG Java API now
|
||||
implement the Closeable interface, so those classes can be used with a
|
2
src/3rdparty/libjpeg/LICENSE
vendored
2
src/3rdparty/libjpeg/LICENSE
vendored
@ -94,7 +94,7 @@ intended solely for clarification.
|
||||
The Modified (3-clause) BSD License
|
||||
===================================
|
||||
|
||||
Copyright (C)2009-2023 D. R. Commander. All Rights Reserved.<br>
|
||||
Copyright (C)2009-2024 D. R. Commander. All Rights Reserved.<br>
|
||||
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -36,16 +36,18 @@ TO DO Plans for future IJG releases.
|
||||
Other documentation files in the distribution are:
|
||||
|
||||
User documentation:
|
||||
usage.txt Usage instructions for cjpeg, djpeg, jpegtran,
|
||||
doc/usage.txt Usage instructions for cjpeg, djpeg, jpegtran,
|
||||
rdjpgcom, and wrjpgcom.
|
||||
*.1 Unix-style man pages for programs (same info as usage.txt).
|
||||
wizard.txt Advanced usage instructions for JPEG wizards only.
|
||||
change.log Version-to-version change highlights.
|
||||
doc/*.1 Unix-style man pages for programs (same info as
|
||||
usage.txt).
|
||||
doc/wizard.txt Advanced usage instructions for JPEG wizards only.
|
||||
doc/change.log Version-to-version change highlights.
|
||||
Programmer and internal documentation:
|
||||
libjpeg.txt How to use the JPEG library in your own programs.
|
||||
example.c Sample code for calling the JPEG library.
|
||||
structure.txt Overview of the JPEG library's internal structure.
|
||||
coderules.txt Coding style rules --- please read if you contribute code.
|
||||
doc/libjpeg.txt How to use the JPEG library in your own programs.
|
||||
src/example.c Sample code for calling the JPEG library.
|
||||
doc/structure.txt Overview of the JPEG library's internal structure.
|
||||
doc/coderules.txt Coding style rules --- please read if you contribute
|
||||
code.
|
||||
|
||||
Please read at least usage.txt. Some information can also be found in the JPEG
|
||||
FAQ (Frequently Asked Questions) article. See ARCHIVE LOCATIONS below to find
|
@ -69,8 +69,10 @@ JPEG images:
|
||||
generating planar YUV images and performing multiple simultaneous lossless
|
||||
transforms on an image. The Java interface for libjpeg-turbo is written on
|
||||
top of the TurboJPEG API. The TurboJPEG API is recommended for first-time
|
||||
users of libjpeg-turbo. Refer to [tjexample.c](tjexample.c) and
|
||||
[TJExample.java](java/TJExample.java) for examples of its usage and to
|
||||
users of libjpeg-turbo. Refer to [tjcomp.c](src/tjcomp.c),
|
||||
[tjdecomp.c](src/tjdecomp.c), [tjtran.c](src/tjtran.c),
|
||||
[TJComp.java](java/TJComp.java), [TJDecomp.java](java/TJDecomp.java), and
|
||||
[TJTran.java](java/TJTran.java) for examples of its usage and to
|
||||
<https://libjpeg-turbo.org/Documentation/Documentation> for API
|
||||
documentation.
|
||||
|
||||
@ -80,8 +82,9 @@ JPEG images:
|
||||
more powerful. The libjpeg API implementation in libjpeg-turbo is both
|
||||
API/ABI-compatible and mathematically compatible with libjpeg v6b. It can
|
||||
also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8
|
||||
(see below.) Refer to [cjpeg.c](cjpeg.c) and [djpeg.c](djpeg.c) for examples
|
||||
of its usage and to [libjpeg.txt](libjpeg.txt) for API documentation.
|
||||
(see below.) Refer to [cjpeg.c](src/cjpeg.c) and [djpeg.c](src/djpeg.c) for
|
||||
examples of its usage and to [libjpeg.txt](doc/libjpeg.txt) for API
|
||||
documentation.
|
||||
|
||||
There is no significant performance advantage to either API when both are used
|
||||
to perform similar operations.
|
||||
@ -133,9 +136,9 @@ extensions at compile time with:
|
||||
|
||||
#ifdef JCS_ALPHA_EXTENSIONS
|
||||
|
||||
[jcstest.c](jcstest.c), located in the libjpeg-turbo source tree, demonstrates
|
||||
how to check for the existence of the colorspace extensions at compile time and
|
||||
run time.
|
||||
[jcstest.c](src/jcstest.c), located in the libjpeg-turbo source tree,
|
||||
demonstrates how to check for the existence of the colorspace extensions at
|
||||
compile time and run time.
|
||||
|
||||
libjpeg v7 and v8 API/ABI Emulation
|
||||
-----------------------------------
|
@ -40,12 +40,11 @@ copy_file() {
|
||||
}
|
||||
|
||||
copy_file "LICENSE.md" "LICENSE"
|
||||
copy_file "ChangeLog.md" "ChangeLog.md"
|
||||
copy_file "README.md" "README.md"
|
||||
copy_file "README.ijg" "README.ijg"
|
||||
|
||||
FILES="
|
||||
change.log
|
||||
ChangeLog.md
|
||||
README.md
|
||||
README.ijg
|
||||
jconfig.h.in
|
||||
jconfigint.h.in
|
||||
|
||||
@ -136,9 +135,9 @@ FILES="
|
||||
"
|
||||
|
||||
for i in $FILES; do
|
||||
copy_file "$i" "src/$i"
|
||||
copy_file "src/$i" "src/$i"
|
||||
done
|
||||
copy_file "jversion.h.in" "src/jversion.h"
|
||||
copy_file "src/jversion.h.in" "src/jversion.h"
|
||||
|
||||
cyear=$(grep COPYRIGHT_YEAR $LIBJPEG_DIR/CMakeLists.txt | sed -e 's/.*"\(.*\)".*/\1/')
|
||||
sed -i -e "s/@COPYRIGHT_YEAR@/$cyear/" $TARGET_DIR/src/jversion.h
|
||||
|
8
src/3rdparty/libjpeg/qt_attribution.json
vendored
8
src/3rdparty/libjpeg/qt_attribution.json
vendored
@ -7,10 +7,10 @@
|
||||
|
||||
"Description": "The Independent JPEG Group's JPEG software",
|
||||
"Homepage": "http://libjpeg-turbo.virtualgl.org/",
|
||||
"Version": "3.0.4",
|
||||
"DownloadLocation": "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.4/libjpeg-turbo-3.0.4.tar.gz",
|
||||
"PURL": "pkg:github/libjpeg-turbo/libjpeg-turbo@3.0.4",
|
||||
"CPE": "cpe:2.3:a:libjpeg-turbo:libjpeg-turbo:3.0.4:*:*:*:*:*:*:*",
|
||||
"Version": "3.1.0",
|
||||
"DownloadLocation": "https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.0/libjpeg-turbo-3.1.0.tar.gz",
|
||||
"PURL": "pkg:github/libjpeg-turbo/libjpeg-turbo@3.1.0",
|
||||
"CPE": "cpe:2.3:a:libjpeg-turbo:libjpeg-turbo:3.1.0:*:*:*:*:*:*:*",
|
||||
|
||||
"License": "Independent JPEG Group License and BSD 3-Clause \"New\" or \"Revised\" License",
|
||||
"LicenseId": "IJG AND BSD-3-Clause",
|
||||
|
16
src/3rdparty/libjpeg/src/jcapimin.c
vendored
16
src/3rdparty/libjpeg/src/jcapimin.c
vendored
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||
* Modified 2003-2010 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -194,19 +194,19 @@ jpeg_finish_compress(j_compress_ptr cinfo)
|
||||
/* We bypass the main controller and invoke coef controller directly;
|
||||
* all work is being done from the coefficient buffer.
|
||||
*/
|
||||
if (cinfo->data_precision == 16) {
|
||||
if (cinfo->data_precision <= 8) {
|
||||
if (!(*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE)NULL))
|
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||
} else if (cinfo->data_precision <= 12) {
|
||||
if (!(*cinfo->coef->compress_data_12) (cinfo, (J12SAMPIMAGE)NULL))
|
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||
} else {
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (!(*cinfo->coef->compress_data_16) (cinfo, (J16SAMPIMAGE)NULL))
|
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||
#else
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
#endif
|
||||
} else if (cinfo->data_precision == 12) {
|
||||
if (!(*cinfo->coef->compress_data_12) (cinfo, (J12SAMPIMAGE)NULL))
|
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||
} else {
|
||||
if (!(*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE)NULL))
|
||||
ERREXIT(cinfo, JERR_CANT_SUSPEND);
|
||||
}
|
||||
}
|
||||
(*cinfo->master->finish_pass) (cinfo);
|
||||
|
15
src/3rdparty/libjpeg/src/jcapistd.c
vendored
15
src/3rdparty/libjpeg/src/jcapistd.c
vendored
@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -88,8 +88,21 @@ _jpeg_write_scanlines(j_compress_ptr cinfo, _JSAMPARRAY scanlines,
|
||||
#if BITS_IN_JSAMPLE != 16 || defined(C_LOSSLESS_SUPPORTED)
|
||||
JDIMENSION row_ctr, rows_left;
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
if (cinfo->global_state != CSTATE_SCANNING)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
25
src/3rdparty/libjpeg/src/jccolor.c
vendored
25
src/3rdparty/libjpeg/src/jccolor.c
vendored
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009-2012, 2015, 2022, D. R. Commander.
|
||||
* Copyright (C) 2009-2012, 2015, 2022, 2024, D. R. Commander.
|
||||
* Copyright (C) 2014, MIPS Technologies, Inc., California.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@ -552,8 +552,21 @@ _jinit_color_converter(j_compress_ptr cinfo)
|
||||
{
|
||||
my_cconvert_ptr cconvert;
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
cconvert = (my_cconvert_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
@ -607,9 +620,11 @@ _jinit_color_converter(j_compress_ptr cinfo)
|
||||
*/
|
||||
switch (cinfo->jpeg_color_space) {
|
||||
case JCS_GRAYSCALE:
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless &&
|
||||
cinfo->in_color_space != cinfo->jpeg_color_space)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
if (cinfo->num_components != 1)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (cinfo->in_color_space == JCS_GRAYSCALE)
|
||||
@ -631,8 +646,10 @@ _jinit_color_converter(j_compress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case JCS_RGB:
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless && !IsExtRGB(cinfo->in_color_space))
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
if (cinfo->num_components != 3)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (rgb_red[cinfo->in_color_space] == 0 &&
|
||||
@ -652,9 +669,11 @@ _jinit_color_converter(j_compress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case JCS_YCbCr:
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless &&
|
||||
cinfo->in_color_space != cinfo->jpeg_color_space)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
if (cinfo->num_components != 3)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (IsExtRGB(cinfo->in_color_space)) {
|
||||
@ -679,9 +698,11 @@ _jinit_color_converter(j_compress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case JCS_CMYK:
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless &&
|
||||
cinfo->in_color_space != cinfo->jpeg_color_space)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
if (cinfo->num_components != 4)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (cinfo->in_color_space == JCS_CMYK) {
|
||||
@ -696,9 +717,11 @@ _jinit_color_converter(j_compress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case JCS_YCCK:
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless &&
|
||||
cinfo->in_color_space != cinfo->jpeg_color_space)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
if (cinfo->num_components != 4)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (cinfo->in_color_space == JCS_CMYK) {
|
||||
|
10
src/3rdparty/libjpeg/src/jcdiffct.c
vendored
10
src/3rdparty/libjpeg/src/jcdiffct.c
vendored
@ -6,7 +6,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -346,6 +346,14 @@ _jinit_c_diff_controller(j_compress_ptr cinfo, boolean need_full_buffer)
|
||||
int ci, row;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
|
||||
diff = (my_diff_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
sizeof(my_diff_controller));
|
||||
|
56
src/3rdparty/libjpeg/src/jcinit.c
vendored
56
src/3rdparty/libjpeg/src/jcinit.c
vendored
@ -6,7 +6,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2020, 2022, D. R. Commander.
|
||||
* Copyright (C) 2020, 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -40,7 +40,16 @@ jinit_compress_master(j_compress_ptr cinfo)
|
||||
|
||||
/* Preprocessing */
|
||||
if (!cinfo->raw_data_in) {
|
||||
if (cinfo->data_precision == 16) {
|
||||
if (cinfo->data_precision <= 8) {
|
||||
jinit_color_converter(cinfo);
|
||||
jinit_downsampler(cinfo);
|
||||
jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
} else if (cinfo->data_precision <= 12) {
|
||||
j12init_color_converter(cinfo);
|
||||
j12init_downsampler(cinfo);
|
||||
j12init_c_prep_controller(cinfo,
|
||||
FALSE /* never need full buffer here */);
|
||||
} else {
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
j16init_color_converter(cinfo);
|
||||
j16init_downsampler(cinfo);
|
||||
@ -49,27 +58,18 @@ jinit_compress_master(j_compress_ptr cinfo)
|
||||
#else
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
#endif
|
||||
} else if (cinfo->data_precision == 12) {
|
||||
j12init_color_converter(cinfo);
|
||||
j12init_downsampler(cinfo);
|
||||
j12init_c_prep_controller(cinfo,
|
||||
FALSE /* never need full buffer here */);
|
||||
} else {
|
||||
jinit_color_converter(cinfo);
|
||||
jinit_downsampler(cinfo);
|
||||
jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
}
|
||||
}
|
||||
|
||||
if (cinfo->master->lossless) {
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
/* Prediction, sample differencing, and point transform */
|
||||
if (cinfo->data_precision == 16)
|
||||
j16init_lossless_compressor(cinfo);
|
||||
else if (cinfo->data_precision == 12)
|
||||
if (cinfo->data_precision <= 8)
|
||||
jinit_lossless_compressor(cinfo);
|
||||
else if (cinfo->data_precision <= 12)
|
||||
j12init_lossless_compressor(cinfo);
|
||||
else
|
||||
jinit_lossless_compressor(cinfo);
|
||||
j16init_lossless_compressor(cinfo);
|
||||
/* Entropy encoding: either Huffman or arithmetic coding. */
|
||||
if (cinfo->arith_code) {
|
||||
ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
|
||||
@ -78,26 +78,26 @@ jinit_compress_master(j_compress_ptr cinfo)
|
||||
}
|
||||
|
||||
/* Need a full-image difference buffer in any multi-pass mode. */
|
||||
if (cinfo->data_precision == 16)
|
||||
j16init_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
|
||||
if (cinfo->data_precision <= 8)
|
||||
jinit_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
|
||||
cinfo->optimize_coding));
|
||||
else if (cinfo->data_precision == 12)
|
||||
else if (cinfo->data_precision <= 12)
|
||||
j12init_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
|
||||
cinfo->optimize_coding));
|
||||
else
|
||||
jinit_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
|
||||
j16init_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
|
||||
cinfo->optimize_coding));
|
||||
#else
|
||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||
#endif
|
||||
} else {
|
||||
if (cinfo->data_precision == 16)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
/* Forward DCT */
|
||||
if (cinfo->data_precision == 12)
|
||||
if (cinfo->data_precision == 8)
|
||||
jinit_forward_dct(cinfo);
|
||||
else if (cinfo->data_precision == 12)
|
||||
j12init_forward_dct(cinfo);
|
||||
else
|
||||
jinit_forward_dct(cinfo);
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
/* Entropy encoding: either Huffman or arithmetic coding. */
|
||||
if (cinfo->arith_code) {
|
||||
#ifdef C_ARITH_CODING_SUPPORTED
|
||||
@ -125,16 +125,16 @@ jinit_compress_master(j_compress_ptr cinfo)
|
||||
cinfo->optimize_coding));
|
||||
}
|
||||
|
||||
if (cinfo->data_precision == 16)
|
||||
if (cinfo->data_precision <= 8)
|
||||
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
else if (cinfo->data_precision <= 12)
|
||||
j12init_c_main_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
else
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
j16init_c_main_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
#else
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
#endif
|
||||
else if (cinfo->data_precision == 12)
|
||||
j12init_c_main_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
else
|
||||
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
|
||||
jinit_marker_writer(cinfo);
|
||||
|
||||
|
10
src/3rdparty/libjpeg/src/jclossls.c
vendored
10
src/3rdparty/libjpeg/src/jclossls.c
vendored
@ -6,7 +6,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -308,6 +308,14 @@ _jinit_lossless_compressor(j_compress_ptr cinfo)
|
||||
{
|
||||
lossless_comp_ptr losslessc;
|
||||
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
|
||||
/* Create subobject in permanent pool */
|
||||
losslessc = (lossless_comp_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
|
||||
|
15
src/3rdparty/libjpeg/src/jcmainct.c
vendored
15
src/3rdparty/libjpeg/src/jcmainct.c
vendored
@ -6,7 +6,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -140,8 +140,21 @@ _jinit_c_main_controller(j_compress_ptr cinfo, boolean need_full_buffer)
|
||||
jpeg_component_info *compptr;
|
||||
int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
main_ptr = (my_main_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
|
18
src/3rdparty/libjpeg/src/jcmaster.c
vendored
18
src/3rdparty/libjpeg/src/jcmaster.c
vendored
@ -190,13 +190,19 @@ initial_setup(j_compress_ptr cinfo, boolean transcode_only)
|
||||
if ((long)jd_samplesperrow != samplesperrow)
|
||||
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
||||
|
||||
/* Lossy JPEG images must have 8 or 12 bits per sample. Lossless JPEG images
|
||||
* can have 2 to 16 bits per sample.
|
||||
*/
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->data_precision != 8 && cinfo->data_precision != 12 &&
|
||||
cinfo->data_precision != 16)
|
||||
#else
|
||||
if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
|
||||
#endif
|
||||
if (cinfo->master->lossless) {
|
||||
if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
/* Check that number of components won't exceed internal array sizes */
|
||||
if (cinfo->num_components > MAX_COMPONENTS)
|
||||
@ -731,6 +737,7 @@ jinit_c_master_control(j_compress_ptr cinfo, boolean transcode_only)
|
||||
cinfo->num_scans = 1;
|
||||
}
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
/* Disable smoothing and subsampling in lossless mode, since those are lossy
|
||||
* algorithms. Set the JPEG colorspace to the input colorspace. Disable raw
|
||||
* (downsampled) data input, because it isn't particularly useful without
|
||||
@ -747,6 +754,7 @@ jinit_c_master_control(j_compress_ptr cinfo, boolean transcode_only)
|
||||
ci++, compptr++)
|
||||
compptr->h_samp_factor = compptr->v_samp_factor = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Validate parameters, determine derived values */
|
||||
initial_setup(cinfo, transcode_only);
|
||||
|
9
src/3rdparty/libjpeg/src/jcparam.c
vendored
9
src/3rdparty/libjpeg/src/jcparam.c
vendored
@ -7,7 +7,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2011, 2018, 2023, D. R. Commander.
|
||||
* Copyright (C) 2009-2011, 2018, 2023-2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -220,6 +220,9 @@ jpeg_set_defaults(j_compress_ptr cinfo)
|
||||
cinfo->scan_info = NULL;
|
||||
cinfo->num_scans = 0;
|
||||
|
||||
/* Default is lossy output */
|
||||
cinfo->master->lossless = FALSE;
|
||||
|
||||
/* Expect normal source image, not raw downsampled data */
|
||||
cinfo->raw_data_in = FALSE;
|
||||
|
||||
@ -297,9 +300,11 @@ jpeg_default_colorspace(j_compress_ptr cinfo)
|
||||
case JCS_EXT_BGRA:
|
||||
case JCS_EXT_ABGR:
|
||||
case JCS_EXT_ARGB:
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless)
|
||||
jpeg_set_colorspace(cinfo, JCS_RGB);
|
||||
else
|
||||
#endif
|
||||
jpeg_set_colorspace(cinfo, JCS_YCbCr);
|
||||
break;
|
||||
case JCS_YCbCr:
|
||||
@ -479,10 +484,12 @@ jpeg_simple_progression(j_compress_ptr cinfo)
|
||||
if (cinfo->global_state != CSTATE_START)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
cinfo->master->lossless = FALSE;
|
||||
jpeg_default_colorspace(cinfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Figure space needed for script. Calculation must match code below! */
|
||||
if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
|
||||
|
15
src/3rdparty/libjpeg/src/jcprepct.c
vendored
15
src/3rdparty/libjpeg/src/jcprepct.c
vendored
@ -6,7 +6,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -324,8 +324,21 @@ _jinit_c_prep_controller(j_compress_ptr cinfo, boolean need_full_buffer)
|
||||
jpeg_component_info *compptr;
|
||||
int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
if (need_full_buffer) /* safety check */
|
||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||
|
15
src/3rdparty/libjpeg/src/jcsample.c
vendored
15
src/3rdparty/libjpeg/src/jcsample.c
vendored
@ -8,7 +8,7 @@
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2014, MIPS Technologies, Inc., California.
|
||||
* Copyright (C) 2015, 2019, 2022, D. R. Commander.
|
||||
* Copyright (C) 2015, 2019, 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -470,8 +470,21 @@ _jinit_downsampler(j_compress_ptr cinfo)
|
||||
jpeg_component_info *compptr;
|
||||
boolean smoothok = TRUE;
|
||||
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
downsample = (my_downsample_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
|
4
src/3rdparty/libjpeg/src/jdapimin.c
vendored
4
src/3rdparty/libjpeg/src/jdapimin.c
vendored
@ -161,17 +161,21 @@ default_decompress_parms(j_decompress_ptr cinfo)
|
||||
int cid2 = cinfo->comp_info[2].component_id;
|
||||
|
||||
if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless)
|
||||
cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
|
||||
else
|
||||
#endif
|
||||
cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
|
||||
} else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
|
||||
cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
|
||||
else {
|
||||
TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless)
|
||||
cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
|
||||
else
|
||||
#endif
|
||||
cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
|
||||
}
|
||||
}
|
||||
|
32
src/3rdparty/libjpeg/src/jdapistd.c
vendored
32
src/3rdparty/libjpeg/src/jdapistd.c
vendored
@ -128,20 +128,19 @@ output_pass_setup(j_decompress_ptr cinfo)
|
||||
}
|
||||
/* Process some data */
|
||||
last_scanline = cinfo->output_scanline;
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->data_precision == 16)
|
||||
(*cinfo->main->process_data_16) (cinfo, (J16SAMPARRAY)NULL,
|
||||
&cinfo->output_scanline,
|
||||
(JDIMENSION)0);
|
||||
else
|
||||
#endif
|
||||
if (cinfo->data_precision == 12)
|
||||
if (cinfo->data_precision <= 8)
|
||||
(*cinfo->main->process_data) (cinfo, (JSAMPARRAY)NULL,
|
||||
&cinfo->output_scanline, (JDIMENSION)0);
|
||||
else if (cinfo->data_precision <= 12)
|
||||
(*cinfo->main->process_data_12) (cinfo, (J12SAMPARRAY)NULL,
|
||||
&cinfo->output_scanline,
|
||||
(JDIMENSION)0);
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
else
|
||||
(*cinfo->main->process_data) (cinfo, (JSAMPARRAY)NULL,
|
||||
&cinfo->output_scanline, (JDIMENSION)0);
|
||||
(*cinfo->main->process_data_16) (cinfo, (J16SAMPARRAY)NULL,
|
||||
&cinfo->output_scanline,
|
||||
(JDIMENSION)0);
|
||||
#endif
|
||||
if (cinfo->output_scanline == last_scanline)
|
||||
return FALSE; /* No progress made, must suspend */
|
||||
}
|
||||
@ -314,8 +313,21 @@ _jpeg_read_scanlines(j_decompress_ptr cinfo, _JSAMPARRAY scanlines,
|
||||
#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
|
||||
JDIMENSION row_ctr;
|
||||
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
if (cinfo->global_state != DSTATE_SCANNING)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
23
src/3rdparty/libjpeg/src/jdcolor.c
vendored
23
src/3rdparty/libjpeg/src/jdcolor.c
vendored
@ -6,7 +6,7 @@
|
||||
* Modified 2011 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009, 2011-2012, 2014-2015, 2022, D. R. Commander.
|
||||
* Copyright (C) 2009, 2011-2012, 2014-2015, 2022, 2024, D. R. Commander.
|
||||
* Copyright (C) 2013, Linaro Limited.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@ -759,8 +759,21 @@ _jinit_color_deconverter(j_decompress_ptr cinfo)
|
||||
my_cconvert_ptr cconvert;
|
||||
int ci;
|
||||
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
cconvert = (my_cconvert_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
@ -802,9 +815,11 @@ _jinit_color_deconverter(j_decompress_ptr cinfo)
|
||||
|
||||
switch (cinfo->out_color_space) {
|
||||
case JCS_GRAYSCALE:
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless &&
|
||||
cinfo->jpeg_color_space != cinfo->out_color_space)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
cinfo->out_color_components = 1;
|
||||
if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
|
||||
cinfo->jpeg_color_space == JCS_YCbCr) {
|
||||
@ -830,8 +845,10 @@ _jinit_color_deconverter(j_decompress_ptr cinfo)
|
||||
case JCS_EXT_BGRA:
|
||||
case JCS_EXT_ABGR:
|
||||
case JCS_EXT_ARGB:
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
|
||||
if (cinfo->jpeg_color_space == JCS_YCbCr) {
|
||||
#ifdef WITH_SIMD
|
||||
@ -858,8 +875,10 @@ _jinit_color_deconverter(j_decompress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case JCS_RGB565:
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
cinfo->out_color_components = 3;
|
||||
if (cinfo->dither_mode == JDITHER_NONE) {
|
||||
if (cinfo->jpeg_color_space == JCS_YCbCr) {
|
||||
@ -893,9 +912,11 @@ _jinit_color_deconverter(j_decompress_ptr cinfo)
|
||||
break;
|
||||
|
||||
case JCS_CMYK:
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless &&
|
||||
cinfo->jpeg_color_space != cinfo->out_color_space)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
#endif
|
||||
cinfo->out_color_components = 4;
|
||||
if (cinfo->jpeg_color_space == JCS_YCCK) {
|
||||
cconvert->pub._color_convert = ycck_cmyk_convert;
|
||||
|
10
src/3rdparty/libjpeg/src/jddiffct.c
vendored
10
src/3rdparty/libjpeg/src/jddiffct.c
vendored
@ -6,7 +6,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -350,6 +350,14 @@ _jinit_d_diff_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
|
||||
diff = (my_diff_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
sizeof(my_diff_controller));
|
||||
|
19
src/3rdparty/libjpeg/src/jdinput.c
vendored
19
src/3rdparty/libjpeg/src/jdinput.c
vendored
@ -6,7 +6,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2016, 2018, 2022, D. R. Commander.
|
||||
* Copyright (C) 2010, 2016, 2018, 2022, 2024, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@ -56,14 +56,19 @@ initial_setup(j_decompress_ptr cinfo)
|
||||
(long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
|
||||
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
|
||||
|
||||
/* For now, precision must match compiled-in value... */
|
||||
/* Lossy JPEG images must have 8 or 12 bits per sample. Lossless JPEG images
|
||||
* can have 2 to 16 bits per sample.
|
||||
*/
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->data_precision != 8 && cinfo->data_precision != 12 &&
|
||||
cinfo->data_precision != 16)
|
||||
#else
|
||||
if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
|
||||
#endif
|
||||
if (cinfo->master->lossless) {
|
||||
if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
/* Check that number of components won't exceed internal array sizes */
|
||||
if (cinfo->num_components > MAX_COMPONENTS)
|
||||
|
10
src/3rdparty/libjpeg/src/jdlossls.c
vendored
10
src/3rdparty/libjpeg/src/jdlossls.c
vendored
@ -6,7 +6,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022, D. R. Commander.
|
||||
* Copyright (C) 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -278,6 +278,14 @@ _jinit_lossless_decompressor(j_decompress_ptr cinfo)
|
||||
{
|
||||
lossless_decomp_ptr losslessd;
|
||||
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
|
||||
/* Create subobject in permanent pool */
|
||||
losslessd = (lossless_decomp_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
|
||||
|
15
src/3rdparty/libjpeg/src/jdmainct.c
vendored
15
src/3rdparty/libjpeg/src/jdmainct.c
vendored
@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2016, 2022, D. R. Commander.
|
||||
* Copyright (C) 2010, 2016, 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -431,8 +431,21 @@ _jinit_d_main_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
int ci, rgroup, ngroups;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
main_ptr = (my_main_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
|
170
src/3rdparty/libjpeg/src/jdmaster.c
vendored
170
src/3rdparty/libjpeg/src/jdmaster.c
vendored
@ -7,7 +7,7 @@
|
||||
* Lossless JPEG Modifications:
|
||||
* Copyright (C) 1999, Ken Murchison.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2011, 2016, 2019, 2022-2023, D. R. Commander.
|
||||
* Copyright (C) 2009-2011, 2016, 2019, 2022-2024, D. R. Commander.
|
||||
* Copyright (C) 2013, Linaro Limited.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
@ -422,7 +422,50 @@ prepare_range_limit_table(j_decompress_ptr cinfo)
|
||||
#endif
|
||||
int i;
|
||||
|
||||
if (cinfo->data_precision == 16) {
|
||||
if (cinfo->data_precision <= 8) {
|
||||
table = (JSAMPLE *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
(5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
|
||||
table += (MAXJSAMPLE + 1); /* allow negative subscripts of simple table */
|
||||
cinfo->sample_range_limit = table;
|
||||
/* First segment of "simple" table: limit[x] = 0 for x < 0 */
|
||||
memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
|
||||
/* Main part of "simple" table: limit[x] = x */
|
||||
for (i = 0; i <= MAXJSAMPLE; i++)
|
||||
table[i] = (JSAMPLE)i;
|
||||
table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */
|
||||
/* End of simple table, rest of first half of post-IDCT table */
|
||||
for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
|
||||
table[i] = MAXJSAMPLE;
|
||||
/* Second half of post-IDCT table */
|
||||
memset(table + (2 * (MAXJSAMPLE + 1)), 0,
|
||||
(2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
|
||||
memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
|
||||
cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
|
||||
} else if (cinfo->data_precision <= 12) {
|
||||
table12 = (J12SAMPLE *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
(5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
|
||||
sizeof(J12SAMPLE));
|
||||
table12 += (MAXJ12SAMPLE + 1); /* allow negative subscripts of simple
|
||||
table */
|
||||
cinfo->sample_range_limit = (JSAMPLE *)table12;
|
||||
/* First segment of "simple" table: limit[x] = 0 for x < 0 */
|
||||
memset(table12 - (MAXJ12SAMPLE + 1), 0,
|
||||
(MAXJ12SAMPLE + 1) * sizeof(J12SAMPLE));
|
||||
/* Main part of "simple" table: limit[x] = x */
|
||||
for (i = 0; i <= MAXJ12SAMPLE; i++)
|
||||
table12[i] = (J12SAMPLE)i;
|
||||
table12 += CENTERJ12SAMPLE; /* Point to where post-IDCT table starts */
|
||||
/* End of simple table, rest of first half of post-IDCT table */
|
||||
for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
|
||||
table12[i] = MAXJ12SAMPLE;
|
||||
/* Second half of post-IDCT table */
|
||||
memset(table12 + (2 * (MAXJ12SAMPLE + 1)), 0,
|
||||
(2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
|
||||
memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
|
||||
cinfo->sample_range_limit, CENTERJ12SAMPLE * sizeof(J12SAMPLE));
|
||||
} else {
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
table16 = (J16SAMPLE *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
@ -449,49 +492,6 @@ prepare_range_limit_table(j_decompress_ptr cinfo)
|
||||
#else
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
#endif
|
||||
} else if (cinfo->data_precision == 12) {
|
||||
table12 = (J12SAMPLE *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
(5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
|
||||
sizeof(J12SAMPLE));
|
||||
table12 += (MAXJ12SAMPLE + 1); /* allow negative subscripts of simple
|
||||
table */
|
||||
cinfo->sample_range_limit = (JSAMPLE *)table12;
|
||||
/* First segment of "simple" table: limit[x] = 0 for x < 0 */
|
||||
memset(table12 - (MAXJ12SAMPLE + 1), 0,
|
||||
(MAXJ12SAMPLE + 1) * sizeof(J12SAMPLE));
|
||||
/* Main part of "simple" table: limit[x] = x */
|
||||
for (i = 0; i <= MAXJ12SAMPLE; i++)
|
||||
table12[i] = (J12SAMPLE)i;
|
||||
table12 += CENTERJ12SAMPLE; /* Point to where post-IDCT table starts */
|
||||
/* End of simple table, rest of first half of post-IDCT table */
|
||||
for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
|
||||
table12[i] = MAXJ12SAMPLE;
|
||||
/* Second half of post-IDCT table */
|
||||
memset(table12 + (2 * (MAXJ12SAMPLE + 1)), 0,
|
||||
(2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
|
||||
memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
|
||||
cinfo->sample_range_limit, CENTERJ12SAMPLE * sizeof(J12SAMPLE));
|
||||
} else {
|
||||
table = (JSAMPLE *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
(5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
|
||||
table += (MAXJSAMPLE + 1); /* allow negative subscripts of simple table */
|
||||
cinfo->sample_range_limit = table;
|
||||
/* First segment of "simple" table: limit[x] = 0 for x < 0 */
|
||||
memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
|
||||
/* Main part of "simple" table: limit[x] = x */
|
||||
for (i = 0; i <= MAXJSAMPLE; i++)
|
||||
table[i] = (JSAMPLE)i;
|
||||
table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */
|
||||
/* End of simple table, rest of first half of post-IDCT table */
|
||||
for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
|
||||
table[i] = MAXJSAMPLE;
|
||||
/* Second half of post-IDCT table */
|
||||
memset(table + (2 * (MAXJSAMPLE + 1)), 0,
|
||||
(2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
|
||||
memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
|
||||
cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,10 +521,12 @@ master_selection(j_decompress_ptr cinfo)
|
||||
* particularly useful without subsampling and has not been tested in
|
||||
* lossless mode.
|
||||
*/
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
cinfo->raw_data_out = FALSE;
|
||||
cinfo->scale_num = cinfo->scale_denom = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize dimensions and other stuff */
|
||||
jpeg_calc_output_dimensions(cinfo);
|
||||
@ -570,12 +572,12 @@ master_selection(j_decompress_ptr cinfo)
|
||||
|
||||
if (cinfo->enable_1pass_quant) {
|
||||
#ifdef QUANT_1PASS_SUPPORTED
|
||||
if (cinfo->data_precision == 16)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
if (cinfo->data_precision == 8)
|
||||
jinit_1pass_quantizer(cinfo);
|
||||
else if (cinfo->data_precision == 12)
|
||||
j12init_1pass_quantizer(cinfo);
|
||||
else
|
||||
jinit_1pass_quantizer(cinfo);
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
master->quantizer_1pass = cinfo->cquantize;
|
||||
#else
|
||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||
@ -585,12 +587,12 @@ master_selection(j_decompress_ptr cinfo)
|
||||
/* We use the 2-pass code to map to external colormaps. */
|
||||
if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {
|
||||
#ifdef QUANT_2PASS_SUPPORTED
|
||||
if (cinfo->data_precision == 16)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
if (cinfo->data_precision == 8)
|
||||
jinit_2pass_quantizer(cinfo);
|
||||
else if (cinfo->data_precision == 12)
|
||||
j12init_2pass_quantizer(cinfo);
|
||||
else
|
||||
jinit_2pass_quantizer(cinfo);
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
master->quantizer_2pass = cinfo->cquantize;
|
||||
#else
|
||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||
@ -605,41 +607,41 @@ master_selection(j_decompress_ptr cinfo)
|
||||
if (!cinfo->raw_data_out) {
|
||||
if (master->using_merged_upsample) {
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
if (cinfo->data_precision == 16)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
if (cinfo->data_precision == 8)
|
||||
jinit_merged_upsampler(cinfo); /* does color conversion too */
|
||||
else if (cinfo->data_precision == 12)
|
||||
j12init_merged_upsampler(cinfo); /* does color conversion too */
|
||||
else
|
||||
jinit_merged_upsampler(cinfo); /* does color conversion too */
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
#else
|
||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||
#endif
|
||||
} else {
|
||||
if (cinfo->data_precision == 16) {
|
||||
if (cinfo->data_precision <= 8) {
|
||||
jinit_color_deconverter(cinfo);
|
||||
jinit_upsampler(cinfo);
|
||||
} else if (cinfo->data_precision <= 12) {
|
||||
j12init_color_deconverter(cinfo);
|
||||
j12init_upsampler(cinfo);
|
||||
} else {
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
j16init_color_deconverter(cinfo);
|
||||
j16init_upsampler(cinfo);
|
||||
#else
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
#endif
|
||||
} else if (cinfo->data_precision == 12) {
|
||||
j12init_color_deconverter(cinfo);
|
||||
j12init_upsampler(cinfo);
|
||||
} else {
|
||||
jinit_color_deconverter(cinfo);
|
||||
jinit_upsampler(cinfo);
|
||||
}
|
||||
}
|
||||
if (cinfo->data_precision == 16)
|
||||
if (cinfo->data_precision <= 8)
|
||||
jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
|
||||
else if (cinfo->data_precision <= 12)
|
||||
j12init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
|
||||
else
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
j16init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
|
||||
#else
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
#endif
|
||||
else if (cinfo->data_precision == 12)
|
||||
j12init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
|
||||
else
|
||||
jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
|
||||
}
|
||||
|
||||
if (cinfo->master->lossless) {
|
||||
@ -647,12 +649,12 @@ master_selection(j_decompress_ptr cinfo)
|
||||
/* Prediction, sample undifferencing, point transform, and sample size
|
||||
* scaling
|
||||
*/
|
||||
if (cinfo->data_precision == 16)
|
||||
j16init_lossless_decompressor(cinfo);
|
||||
else if (cinfo->data_precision == 12)
|
||||
if (cinfo->data_precision <= 8)
|
||||
jinit_lossless_decompressor(cinfo);
|
||||
else if (cinfo->data_precision <= 12)
|
||||
j12init_lossless_decompressor(cinfo);
|
||||
else
|
||||
jinit_lossless_decompressor(cinfo);
|
||||
j16init_lossless_decompressor(cinfo);
|
||||
/* Entropy decoding: either Huffman or arithmetic coding. */
|
||||
if (cinfo->arith_code) {
|
||||
ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
|
||||
@ -663,23 +665,23 @@ master_selection(j_decompress_ptr cinfo)
|
||||
/* Initialize principal buffer controllers. */
|
||||
use_c_buffer = cinfo->inputctl->has_multiple_scans ||
|
||||
cinfo->buffered_image;
|
||||
if (cinfo->data_precision == 16)
|
||||
j16init_d_diff_controller(cinfo, use_c_buffer);
|
||||
else if (cinfo->data_precision == 12)
|
||||
if (cinfo->data_precision <= 8)
|
||||
jinit_d_diff_controller(cinfo, use_c_buffer);
|
||||
else if (cinfo->data_precision <= 12)
|
||||
j12init_d_diff_controller(cinfo, use_c_buffer);
|
||||
else
|
||||
jinit_d_diff_controller(cinfo, use_c_buffer);
|
||||
j16init_d_diff_controller(cinfo, use_c_buffer);
|
||||
#else
|
||||
ERREXIT(cinfo, JERR_NOT_COMPILED);
|
||||
#endif
|
||||
} else {
|
||||
if (cinfo->data_precision == 16)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
/* Inverse DCT */
|
||||
if (cinfo->data_precision == 12)
|
||||
if (cinfo->data_precision == 8)
|
||||
jinit_inverse_dct(cinfo);
|
||||
else if (cinfo->data_precision == 12)
|
||||
j12init_inverse_dct(cinfo);
|
||||
else
|
||||
jinit_inverse_dct(cinfo);
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
/* Entropy decoding: either Huffman or arithmetic coding. */
|
||||
if (cinfo->arith_code) {
|
||||
#ifdef D_ARITH_CODING_SUPPORTED
|
||||
@ -708,18 +710,18 @@ master_selection(j_decompress_ptr cinfo)
|
||||
}
|
||||
|
||||
if (!cinfo->raw_data_out) {
|
||||
if (cinfo->data_precision == 16)
|
||||
if (cinfo->data_precision <= 8)
|
||||
jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
else if (cinfo->data_precision <= 12)
|
||||
j12init_d_main_controller(cinfo,
|
||||
FALSE /* never need full buffer here */);
|
||||
else
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
j16init_d_main_controller(cinfo,
|
||||
FALSE /* never need full buffer here */);
|
||||
#else
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
#endif
|
||||
else if (cinfo->data_precision == 12)
|
||||
j12init_d_main_controller(cinfo,
|
||||
FALSE /* never need full buffer here */);
|
||||
else
|
||||
jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
|
||||
}
|
||||
|
||||
/* We can now tell the memory manager to allocate virtual arrays. */
|
||||
|
15
src/3rdparty/libjpeg/src/jdpostct.c
vendored
15
src/3rdparty/libjpeg/src/jdpostct.c
vendored
@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2022-2023, D. R. Commander.
|
||||
* Copyright (C) 2022-2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -267,8 +267,21 @@ _jinit_d_post_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
{
|
||||
my_post_ptr post;
|
||||
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
post = (my_post_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
|
15
src/3rdparty/libjpeg/src/jdsample.c
vendored
15
src/3rdparty/libjpeg/src/jdsample.c
vendored
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2010, 2015-2016, 2022, D. R. Commander.
|
||||
* Copyright (C) 2010, 2015-2016, 2022, 2024, D. R. Commander.
|
||||
* Copyright (C) 2014, MIPS Technologies, Inc., California.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* Copyright (C) 2019-2020, Arm Limited.
|
||||
@ -421,8 +421,21 @@ _jinit_upsampler(j_decompress_ptr cinfo)
|
||||
boolean need_buffer, do_fancy;
|
||||
int h_in_group, v_in_group, h_out_group, v_out_group;
|
||||
|
||||
#ifdef D_LOSSLESS_SUPPORTED
|
||||
if (cinfo->master->lossless) {
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
|
||||
#else
|
||||
if (cinfo->data_precision > BITS_IN_JSAMPLE ||
|
||||
cinfo->data_precision < BITS_IN_JSAMPLE - 3)
|
||||
#endif
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
}
|
||||
|
||||
if (!cinfo->master->jinit_upsampler_no_alloc) {
|
||||
upsample = (my_upsample_ptr)
|
||||
|
141
src/3rdparty/libjpeg/src/jmemmgr.c
vendored
141
src/3rdparty/libjpeg/src/jmemmgr.c
vendored
@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2016, 2021-2022, D. R. Commander.
|
||||
* Copyright (C) 2016, 2021-2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -156,8 +156,9 @@ typedef my_memory_mgr *my_mem_ptr;
|
||||
|
||||
struct jvirt_sarray_control {
|
||||
JSAMPARRAY mem_buffer; /* => the in-memory buffer (if
|
||||
cinfo->data_precision is 12, then this is
|
||||
actually a J12SAMPARRAY) */
|
||||
cinfo->data_precision > 8, then this is
|
||||
actually a J12SAMPARRAY or a
|
||||
J16SAMPARRAY) */
|
||||
JDIMENSION rows_in_array; /* total virtual array height */
|
||||
JDIMENSION samplesperrow; /* width of array (and of memory buffer) */
|
||||
JDIMENSION maxaccess; /* max rows accessed by access_virt_sarray */
|
||||
@ -449,8 +450,8 @@ alloc_sarray(j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow,
|
||||
int data_precision = cinfo->is_decompressor ?
|
||||
((j_decompress_ptr)cinfo)->data_precision :
|
||||
((j_compress_ptr)cinfo)->data_precision;
|
||||
size_t sample_size = data_precision == 16 ?
|
||||
sizeof(J16SAMPLE) : (data_precision == 12 ?
|
||||
size_t sample_size = data_precision > 12 ?
|
||||
sizeof(J16SAMPLE) : (data_precision > 8 ?
|
||||
sizeof(J12SAMPLE) :
|
||||
sizeof(JSAMPLE));
|
||||
|
||||
@ -477,7 +478,44 @@ alloc_sarray(j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow,
|
||||
rowsperchunk = numrows;
|
||||
mem->last_rowsperchunk = rowsperchunk;
|
||||
|
||||
if (data_precision == 16) {
|
||||
if (data_precision <= 8) {
|
||||
/* Get space for row pointers (small object) */
|
||||
result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
|
||||
(size_t)(numrows * sizeof(JSAMPROW)));
|
||||
|
||||
/* Get the rows themselves (large objects) */
|
||||
currow = 0;
|
||||
while (currow < numrows) {
|
||||
rowsperchunk = MIN(rowsperchunk, numrows - currow);
|
||||
workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
|
||||
(size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
|
||||
for (i = rowsperchunk; i > 0; i--) {
|
||||
result[currow++] = workspace;
|
||||
workspace += samplesperrow;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} else if (data_precision <= 12) {
|
||||
/* Get space for row pointers (small object) */
|
||||
result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
|
||||
(size_t)(numrows *
|
||||
sizeof(J12SAMPROW)));
|
||||
|
||||
/* Get the rows themselves (large objects) */
|
||||
currow = 0;
|
||||
while (currow < numrows) {
|
||||
rowsperchunk = MIN(rowsperchunk, numrows - currow);
|
||||
workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
|
||||
(size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
|
||||
for (i = rowsperchunk; i > 0; i--) {
|
||||
result12[currow++] = workspace12;
|
||||
workspace12 += samplesperrow;
|
||||
}
|
||||
}
|
||||
|
||||
return (JSAMPARRAY)result12;
|
||||
} else {
|
||||
#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
|
||||
/* Get space for row pointers (small object) */
|
||||
result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
|
||||
@ -501,43 +539,6 @@ alloc_sarray(j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow,
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
|
||||
return NULL;
|
||||
#endif
|
||||
} else if (data_precision == 12) {
|
||||
/* Get space for row pointers (small object) */
|
||||
result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
|
||||
(size_t)(numrows *
|
||||
sizeof(J12SAMPROW)));
|
||||
|
||||
/* Get the rows themselves (large objects) */
|
||||
currow = 0;
|
||||
while (currow < numrows) {
|
||||
rowsperchunk = MIN(rowsperchunk, numrows - currow);
|
||||
workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
|
||||
(size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
|
||||
for (i = rowsperchunk; i > 0; i--) {
|
||||
result12[currow++] = workspace12;
|
||||
workspace12 += samplesperrow;
|
||||
}
|
||||
}
|
||||
|
||||
return (JSAMPARRAY)result12;
|
||||
} else {
|
||||
/* Get space for row pointers (small object) */
|
||||
result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
|
||||
(size_t)(numrows * sizeof(JSAMPROW)));
|
||||
|
||||
/* Get the rows themselves (large objects) */
|
||||
currow = 0;
|
||||
while (currow < numrows) {
|
||||
rowsperchunk = MIN(rowsperchunk, numrows - currow);
|
||||
workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
|
||||
(size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
|
||||
for (i = rowsperchunk; i > 0; i--) {
|
||||
result[currow++] = workspace;
|
||||
workspace += samplesperrow;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -703,8 +704,8 @@ realize_virt_arrays(j_common_ptr cinfo)
|
||||
int data_precision = cinfo->is_decompressor ?
|
||||
((j_decompress_ptr)cinfo)->data_precision :
|
||||
((j_compress_ptr)cinfo)->data_precision;
|
||||
size_t sample_size = data_precision == 16 ?
|
||||
sizeof(J16SAMPLE) : (data_precision == 12 ?
|
||||
size_t sample_size = data_precision > 12 ?
|
||||
sizeof(J16SAMPLE) : (data_precision > 8 ?
|
||||
sizeof(J12SAMPLE) :
|
||||
sizeof(JSAMPLE));
|
||||
|
||||
@ -821,8 +822,8 @@ do_sarray_io(j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
|
||||
int data_precision = cinfo->is_decompressor ?
|
||||
((j_decompress_ptr)cinfo)->data_precision :
|
||||
((j_compress_ptr)cinfo)->data_precision;
|
||||
size_t sample_size = data_precision == 16 ?
|
||||
sizeof(J16SAMPLE) : (data_precision == 12 ?
|
||||
size_t sample_size = data_precision > 12 ?
|
||||
sizeof(J16SAMPLE) : (data_precision > 8 ?
|
||||
sizeof(J12SAMPLE) :
|
||||
sizeof(JSAMPLE));
|
||||
|
||||
@ -840,7 +841,27 @@ do_sarray_io(j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
|
||||
if (rows <= 0) /* this chunk might be past end of file! */
|
||||
break;
|
||||
byte_count = rows * bytesperrow;
|
||||
if (data_precision == 16) {
|
||||
if (data_precision <= 8) {
|
||||
if (writing)
|
||||
(*ptr->b_s_info.write_backing_store) (cinfo, &ptr->b_s_info,
|
||||
(void *)ptr->mem_buffer[i],
|
||||
file_offset, byte_count);
|
||||
else
|
||||
(*ptr->b_s_info.read_backing_store) (cinfo, &ptr->b_s_info,
|
||||
(void *)ptr->mem_buffer[i],
|
||||
file_offset, byte_count);
|
||||
} else if (data_precision <= 12) {
|
||||
J12SAMPARRAY mem_buffer12 = (J12SAMPARRAY)ptr->mem_buffer;
|
||||
|
||||
if (writing)
|
||||
(*ptr->b_s_info.write_backing_store) (cinfo, &ptr->b_s_info,
|
||||
(void *)mem_buffer12[i],
|
||||
file_offset, byte_count);
|
||||
else
|
||||
(*ptr->b_s_info.read_backing_store) (cinfo, &ptr->b_s_info,
|
||||
(void *)mem_buffer12[i],
|
||||
file_offset, byte_count);
|
||||
} else {
|
||||
#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
|
||||
J16SAMPARRAY mem_buffer16 = (J16SAMPARRAY)ptr->mem_buffer;
|
||||
|
||||
@ -855,26 +876,6 @@ do_sarray_io(j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
|
||||
#else
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
|
||||
#endif
|
||||
} else if (data_precision == 12) {
|
||||
J12SAMPARRAY mem_buffer12 = (J12SAMPARRAY)ptr->mem_buffer;
|
||||
|
||||
if (writing)
|
||||
(*ptr->b_s_info.write_backing_store) (cinfo, &ptr->b_s_info,
|
||||
(void *)mem_buffer12[i],
|
||||
file_offset, byte_count);
|
||||
else
|
||||
(*ptr->b_s_info.read_backing_store) (cinfo, &ptr->b_s_info,
|
||||
(void *)mem_buffer12[i],
|
||||
file_offset, byte_count);
|
||||
} else {
|
||||
if (writing)
|
||||
(*ptr->b_s_info.write_backing_store) (cinfo, &ptr->b_s_info,
|
||||
(void *)ptr->mem_buffer[i],
|
||||
file_offset, byte_count);
|
||||
else
|
||||
(*ptr->b_s_info.read_backing_store) (cinfo, &ptr->b_s_info,
|
||||
(void *)ptr->mem_buffer[i],
|
||||
file_offset, byte_count);
|
||||
}
|
||||
file_offset += byte_count;
|
||||
}
|
||||
@ -926,8 +927,8 @@ access_virt_sarray(j_common_ptr cinfo, jvirt_sarray_ptr ptr,
|
||||
int data_precision = cinfo->is_decompressor ?
|
||||
((j_decompress_ptr)cinfo)->data_precision :
|
||||
((j_compress_ptr)cinfo)->data_precision;
|
||||
size_t sample_size = data_precision == 16 ?
|
||||
sizeof(J16SAMPLE) : (data_precision == 12 ?
|
||||
size_t sample_size = data_precision > 12 ?
|
||||
sizeof(J16SAMPLE) : (data_precision > 8 ?
|
||||
sizeof(J12SAMPLE) :
|
||||
sizeof(JSAMPLE));
|
||||
|
||||
|
41
src/3rdparty/libjpeg/src/jpeglib.h
vendored
41
src/3rdparty/libjpeg/src/jpeglib.h
vendored
@ -86,22 +86,26 @@ extern "C" {
|
||||
/* Data structures for images (arrays of samples and of DCT coefficients).
|
||||
*/
|
||||
|
||||
typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */
|
||||
typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
|
||||
typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
|
||||
typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples with
|
||||
2-bit through 8-bit data precision. */
|
||||
typedef JSAMPROW *JSAMPARRAY; /* ptr to some JSAMPLE rows (a 2-D JSAMPLE
|
||||
array) */
|
||||
typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D JSAMPLE array: top index is color */
|
||||
|
||||
typedef J12SAMPLE *J12SAMPROW; /* ptr to one image row of 12-bit pixel
|
||||
samples. */
|
||||
typedef J12SAMPROW *J12SAMPARRAY; /* ptr to some 12-bit sample rows (a 2-D
|
||||
12-bit sample array) */
|
||||
typedef J12SAMPARRAY *J12SAMPIMAGE; /* a 3-D 12-bit sample array: top index is
|
||||
typedef J12SAMPLE *J12SAMPROW; /* ptr to one image row of pixel samples
|
||||
with 9-bit through 12-bit data
|
||||
precision. */
|
||||
typedef J12SAMPROW *J12SAMPARRAY; /* ptr to some J12SAMPLE rows (a 2-D
|
||||
J12SAMPLE array) */
|
||||
typedef J12SAMPARRAY *J12SAMPIMAGE; /* a 3-D J12SAMPLE array: top index is
|
||||
color */
|
||||
|
||||
typedef J16SAMPLE *J16SAMPROW; /* ptr to one image row of 16-bit pixel
|
||||
samples. */
|
||||
typedef J16SAMPROW *J16SAMPARRAY; /* ptr to some 16-bit sample rows (a 2-D
|
||||
16-bit sample array) */
|
||||
typedef J16SAMPARRAY *J16SAMPIMAGE; /* a 3-D 16-bit sample array: top index is
|
||||
typedef J16SAMPLE *J16SAMPROW; /* ptr to one image row of pixel samples
|
||||
with 13-bit through 16-bit data
|
||||
precision. */
|
||||
typedef J16SAMPROW *J16SAMPARRAY; /* ptr to some J16SAMPLE rows (a 2-D
|
||||
J16SAMPLE array) */
|
||||
typedef J16SAMPARRAY *J16SAMPIMAGE; /* a 3-D J16SAMPLE array: top index is
|
||||
color */
|
||||
|
||||
typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
|
||||
@ -708,11 +712,12 @@ struct jpeg_decompress_struct {
|
||||
*/
|
||||
|
||||
JSAMPLE *sample_range_limit; /* table for fast range-limiting
|
||||
If data_precision is 12 or 16, then this is
|
||||
actually a J12SAMPLE pointer or a J16SAMPLE
|
||||
pointer, so callers must type-cast it in
|
||||
order to read 12-bit or 16-bit samples from
|
||||
the array. */
|
||||
If data_precision is 9 to 12, then this is
|
||||
actually a J12SAMPLE pointer, and if
|
||||
data_precision is 13 to 16, then this is
|
||||
actually a J16SAMPLE pointer, so callers
|
||||
must type-cast it in order to read samples
|
||||
from the array. */
|
||||
|
||||
/*
|
||||
* These fields are valid during any one scan.
|
||||
|
3
src/3rdparty/libjpeg/src/jsamplecomp.h
vendored
3
src/3rdparty/libjpeg/src/jsamplecomp.h
vendored
@ -93,7 +93,6 @@
|
||||
|
||||
/* Image I/O functions (cdjpeg.h) */
|
||||
#ifdef C_LOSSLESS_SUPPORTED
|
||||
#define _jinit_read_gif j16init_read_gif
|
||||
#define _jinit_read_ppm j16init_read_ppm
|
||||
#endif
|
||||
|
||||
@ -209,7 +208,6 @@
|
||||
#define _buffer buffer12
|
||||
|
||||
/* Image I/O functions (cdjpeg.h) */
|
||||
#define _jinit_read_gif j12init_read_gif
|
||||
#define _jinit_write_gif j12init_write_gif
|
||||
#define _jinit_read_ppm j12init_read_ppm
|
||||
#define _jinit_write_ppm j12init_write_ppm
|
||||
@ -324,7 +322,6 @@
|
||||
#define _buffer buffer
|
||||
|
||||
/* Image I/O functions (cdjpeg.h) */
|
||||
#define _jinit_read_gif jinit_read_gif
|
||||
#define _jinit_write_gif jinit_write_gif
|
||||
#define _jinit_read_ppm jinit_read_ppm
|
||||
#define _jinit_write_ppm jinit_write_ppm
|
||||
|
4
src/3rdparty/libjpeg/src/jstdhuff.c
vendored
4
src/3rdparty/libjpeg/src/jstdhuff.c
vendored
@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2013, 2022, D. R. Commander.
|
||||
* Copyright (C) 2013, 2022, 2024, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@ -25,7 +25,7 @@ add_huff_table(j_common_ptr cinfo, JHUFF_TBL **htblptr, const UINT8 *bits,
|
||||
|
||||
if (*htblptr == NULL)
|
||||
*htblptr = jpeg_alloc_huff_table(cinfo);
|
||||
else
|
||||
else if (cinfo->is_decompressor)
|
||||
return;
|
||||
|
||||
/* Copy the number-of-symbols-of-each-code-length counts */
|
||||
|
Loading…
x
Reference in New Issue
Block a user