Update bundled JPEG library to version 10 dated 25-Jan-2026.

This commit is contained in:
ManoloFLTK
2026-07-07 13:49:40 +02:00
parent 139e9f74d7
commit 34dd7839c1
26 changed files with 1597 additions and 985 deletions
+2 -2
View File
@@ -23,10 +23,10 @@ The nanosvg library is not affected.
\section bundled-status Current status
\code
Current versions of bundled libraries (as of Jan 20, 2026):
Current versions of bundled libraries (as of Jul 7, 2026):
Library Version/git commit Release date FLTK Version
--------------------------------------------------------------------------
jpeg jpeg-9f 2024-01-14 1.4.0
jpeg jpeg-10 2026-01-26 1.5.0
nanosvg 7aeda550a8 [1] 2023-12-02 1.4.0
png libpng-1.6.54 2026-01-12 1.5.0
zlib zlib-1.3.1 2024-01-22 1.4.0
+6 -6
View File
@@ -1,7 +1,7 @@
The Independent JPEG Group's JPEG software
==========================================
README for release 9f of 14-Jan-2024
README for release 10 of 25-Jan-2026
====================================
This distribution contains the ninth public release of the Independent JPEG
@@ -116,7 +116,7 @@ with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-2024, Thomas G. Lane, Guido Vollbeding.
This software is copyright (C) 1991-2026, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this
@@ -240,9 +240,9 @@ The "official" archive site for this software is www.ijg.org.
The most recent released version can always be found there in
directory "files". This particular version will be archived
in Windows-compatible "zip" archive format as
https://www.ijg.org/files/jpegsr9f.zip, and
https://www.ijg.org/files/jpegsr10.zip, and
in Unix-compatible "tar.gz" archive format as
https://www.ijg.org/files/jpegsrc.v9f.tar.gz.
https://www.ijg.org/files/jpegsrc.v10.tar.gz.
The JPEG FAQ (Frequently Asked Questions) article is a source of some
general information about JPEG.
@@ -366,9 +366,9 @@ is currently prepared and will be published later.
TO DO
=====
Version 9 is the second release of a new generation JPEG standard
Version 10 is the third release of a new generation JPEG standard
to overcome the limitations of the original JPEG specification,
and is the first true source reference JPEG codec.
and is a true source reference JPEG codec.
More features are being prepared for coming releases...
Please send bug reports, offers of help, etc. to jpeg-info@ijg.org.
+17
View File
@@ -1,6 +1,23 @@
CHANGE LOG for Independent JPEG Group's JPEG software
Version 10 25-Jan-2026
-----------------------
jmorecfg.h: add JPEG_DATA_PRECISION parameter alongside and independent
of BITS_IN_JSAMPLE, enabling higher bit depth support with backward
compatibility and preparing the next standard for file interchange.
Add lossless negate function in jpegtran.
Thank to Ulf-Dietrich Braumann for suggestion.
Enable processing of images using reversible color tranform
with various bit depths by jpegtran.
Add Windows 64 Bit (Modern) platform support in the C++Builder/RAD Studio
build, remove ARM (32-bit) platform support in the Visual Studio build.
Version 9f 14-Jan-2024
-----------------------
+2 -2
View File
@@ -27,8 +27,6 @@
#define _jinit_memory_mgr fltk__jinit_memory_mgr
#define _jinit_merged_upsampler fltk__jinit_merged_upsampler
#define _jinit_upsampler fltk__jinit_upsampler
#define _jpeg_CreateCompress fltk__jpeg_CreateCompress
#define _jpeg_CreateDecompress fltk__jpeg_CreateDecompress
#define _jpeg_abort fltk__jpeg_abort
#define _jpeg_abort_compress fltk__jpeg_abort_compress
#define _jpeg_abort_decompress fltk__jpeg_abort_decompress
@@ -41,6 +39,8 @@
#define _jpeg_consume_input fltk__jpeg_consume_input
#define _jpeg_copy_critical_parameters fltk__jpeg_copy_critical_parameters
#define _jpeg_core_output_dimensions fltk__jpeg_core_output_dimensions
#define _jpeg_CreateCompress fltk__jpeg_CreateCompress
#define _jpeg_CreateDecompress fltk__jpeg_CreateDecompress
#define _jpeg_default_colorspace fltk__jpeg_default_colorspace
#define _jpeg_default_qtables fltk__jpeg_default_qtables
#define _jpeg_destroy fltk__jpeg_destroy
+36 -31
View File
@@ -1,6 +1,6 @@
INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software
Copyright (C) 1991-2023, Thomas G. Lane, Guido Vollbeding.
Copyright (C) 1991-2025, Thomas G. Lane, Guido Vollbeding.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.
@@ -142,7 +142,7 @@ Makefile jconfig file System and/or compiler
makefile.manx jconfig.manx Amiga, Manx Aztec C
makefile.sas jconfig.sas Amiga, SAS C
makeproj.mac jconfig.mac Apple Macintosh, Metrowerks CodeWarrior
makefile.xc jconfig.xc Apple Mac, Xcode 15
makefile.xc jconfig.xc Apple Mac, Xcode 26
mak*jpeg.st jconfig.st Atari ST/Mega/STE/TT/Falcon, Pure C or Turbo C
makefile.bcc jconfig.bcc MS-DOS or OS/2, Borland C
makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C)
@@ -151,15 +151,16 @@ makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C
makefile.vc jconfig.vc Windows, MS Visual C++
makefile.vs jconfig.vc Windows, MS Visual C++ 6 Developer Studio
make*.vc6
makefile.vs jconfig.vc Windows, Visual Studio 2019-2022 version 16-17
makefile.vs jconfig.vc Windows, Visual Studio 2019-2026 version 16-18
make*.v16
makefile.b32 jconfig.vc Windows, C++Builder/RAD Studio 10.4-11
makefile.b32 jconfig.vc Windows, C++Builder/RAD Studio 12
mak*jpeg.bcb
makefile.b32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32)
makefile.c32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32c)
makefile.d32
makefile.x32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32x)
makefile.b64 jconfig.vc Windows, Embarcadero C++ for Win64 (bcc64)
makefile.x64 jconfig.vc Windows, Embarcadero C++ for Win64/COFF (bcc64x)
makefile.mms jconfig.vms Digital VMS, with MMS software
makefile.vms jconfig.vms Digital VMS, without MMS software
@@ -1061,20 +1062,20 @@ To use:
appropriate location on your path.
Microsoft Windows, Microsoft Visual Studio 2019-2022 version 16-17:
Microsoft Windows, Microsoft Visual Studio 2019-2026 version 16-18:
We include makefiles that should work as project files in Visual Studio
2019-2022 version 16-17 or later. There is a library makefile that
builds the IJG library as a static Win32/x64/ARM/ARM64/ARM64EC library,
2019-2026 version 16-18 or later. There is a library makefile that
builds the IJG library as a static Win32/x64/ARM64/ARM64EC library,
and application makefiles that build the sample applications as
Win32/x64/ARM/ARM64/ARM64EC console applications. (Even if you
only want the library, we recommend building the applications
so that you can run the self-test.)
Win32/x64/ARM64/ARM64EC console applications. (Even if you only
want the library, we recommend building the applications so that
you can run the self-test.)
To use:
1. Ensure youve checked the item "Desktop development with C++" in the
Workloads tab of Visual Studio Installer.
Open the Developer Command Prompt for VS 2019-2022, change to the
Open the Developer Command Prompt for VS 2019-2026, change to the
source directory and execute the command line
nmake /f makefile.vs setup-v16
This will move jconfig.vc to jconfig.h and makefiles to project files.
@@ -1085,7 +1086,7 @@ To use:
which allows to repeat the setup later.
2. Open the solution file jpeg.sln, build the library project.
a) If you are using Visual Studio more recent than
2022 version 17, you'll possibly get a message
2026 version 18, you'll possibly get a message
saying that the project files are being updated.
b) If necessary, open the project properties and adapt the
Windows Target Platform Version (or Windows SDK Version)
@@ -1099,32 +1100,33 @@ To use:
or Individual components tab).
d) If you want to build x64 code, change the platform setting from
Win32 to x64. You can build Win32 and x64 versions side by side.
e) If you want to build ARM/ARM64/ARM64EC code, change the platform
setting to ARM/ARM64/ARM64EC. Ensure youve installed the
ARM/ARM64/ARM64EC build tools in Visual Studio Installer
e) If you want to build ARM64/ARM64EC code, change the platform
setting to ARM64/ARM64EC. Ensure youve installed the
ARM64/ARM64EC build tools in Visual Studio Installer
(Workloads tab Optional components or Individual components tab).
You can build Win32/x64/ARM/ARM64/ARM64EC versions side by side.
You can build Win32/x64/ARM64/ARM64EC versions side by side.
3. Open the solution file apps.sln, build the application projects.
4. To perform the self-test, execute the command line
nmake /f makefile.vs test-32
for the Win32 build, or on a 64-bit system
nmake /f makefile.vs test-64
for the x64 build.
Note: test options for ARM code will be added
as soon as Windows on ARM reference devices are available.
To date there are no Windows on ARM reference devices available.
for the x64 build. On an ARM system use
nmake /f makefile.vs test-arm64
for the ARM64 build, and
nmake /f makefile.vs test-arm64ec
for the ARM64EC build.
5. Move the application .exe files from the Release folder to an
appropriate location on your path.
Microsoft Windows, Embarcadero C++Builder/RAD Studio 10.4-11:
Microsoft Windows, Embarcadero C++Builder/RAD Studio 12:
We include makefiles that should work as project files in C++Builder/RAD
Studio 10.4-11 or later. There is a library makefile that builds the
IJG library as a static Win32/Win64 library, and application makefiles
that build the sample applications as Win32/Win64 console applications.
(Even if you only want the library, we recommend building the
applications so that you can run the self-test.)
Studio 12 or later. There is a library makefile that builds the
IJG library as a static Win32/Win64/Win64x library, and application
makefiles that build the sample applications as Win32/Win64/Win64x
console applications. (Even if you only want the library, we recommend
building the applications so that you can run the self-test.)
To use:
1. Open the RAD Studio Command Prompt (or the standard Windows Command
@@ -1139,22 +1141,25 @@ To use:
This will create renamed copies of the files,
which allows to repeat the setup later.
(You can use one of the other makefiles .c32,
.d32, .x32, or .b64 instead of .b32.)
.d32, .x32, .b64, or .x64 instead of .b32.)
2. Open the project file jpeg.cbproj, build the library project.
a) By default, the classic Borland compiler (bcc32) is used for
the Win32 build. To enable the Clang-based compiler for a
specific project, select Project > Options > C++ Compiler
and deselect the Use classic Borland compiler option.
b) If you want to build Win64 code, change the platform setting
from Windows 32 Bit to Windows 64 Bit.
You can build Win32 and Win64 versions side by side.
b) If you want to build Win64/Win64x code, change the platform
setting from Windows 32 Bit to Windows 64 Bit/Windows 64 Bit
(Modern).
You can build Win32/Win64/Win64x versions side by side.
3. Open the project group file apps.groupproj,
build the application projects.
4. To perform the self-test, execute the command line
make -fmakefile.b32 test-32
for the Win32 build, or on a 64-bit system
make -fmakefile.b32 test-64
for the Win64 build.
for the Win64 build, and
make -fmakefile.b32 test-64x
for the Win64x build.
5. Move the application .exe files from the Release folder to an
appropriate location on your path.
+4 -3
View File
@@ -2,7 +2,7 @@
* jccolor.c
*
* Copyright (C) 1991-1996, Thomas G. Lane.
* Modified 2011-2023 by Guido Vollbeding.
* Modified 2011-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -476,8 +476,9 @@ jinit_color_converter (j_compress_ptr cinfo)
/* Support color transform only for RGB colorspaces */
if (cinfo->color_transform &&
cinfo->jpeg_color_space != JCS_RGB &&
cinfo->jpeg_color_space != JCS_BG_RGB)
(cinfo->LSE_maxtrans != MAXJSAMPLE ||
(cinfo->jpeg_color_space != JCS_RGB &&
cinfo->jpeg_color_space != JCS_BG_RGB)))
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
/* Check num_components, set conversion method based on requested space */
+71 -24
View File
@@ -2,7 +2,7 @@
* jcdctmgr.c
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2003-2020 by Guido Vollbeding.
* Modified 2003-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -50,18 +50,6 @@ typedef union {
} divisor_table;
/* The current scaled-DCT routines require ISLOW-style divisor tables,
* so be sure to compile that code if either ISLOW or SCALING is requested.
*/
#ifdef DCT_ISLOW_SUPPORTED
#define PROVIDE_ISLOW_TABLES
#else
#ifdef DCT_SCALING_SUPPORTED
#define PROVIDE_ISLOW_TABLES
#endif
#endif
/*
* Perform forward DCT on one or more blocks of a component.
*
@@ -102,9 +90,9 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
* In most files, at least half of the output values will be zero
* (at default quantization settings, more like three-quarters...)
* so we should ensure that this case is fast. On many machines,
* a comparison is enough cheaper than a divide to make a special test
* a win. Since both inputs will be nonnegative, we need only test
* for a < b to discover whether a/b is 0.
* a comparison is enough cheaper than a divide to make a special
* test a win. Since both inputs will be nonnegative, we need
* only test for a < b to discover whether a/b is 0.
* If your machine's division is fast enough, define FAST_DIVIDE.
*/
#ifdef FAST_DIVIDE
@@ -185,7 +173,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
int ci, qtblno, i;
jpeg_component_info *compptr;
int method = 0;
J_DCT_METHOD method = JDCT_DEFAULT;
JQUANT_TBL * qtbl;
DCTELEM * dtbl;
@@ -194,6 +182,13 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
/* Select the proper DCT routine for this component's scaling */
switch ((compptr->DCT_h_scaled_size << 8) + compptr->DCT_v_scaled_size) {
#ifdef DCT_SCALING_SUPPORTED
/*
* The current scaled-DCT routines require ISLOW-style divisor tables,
* so be sure to compile that code if either ISLOW or SCALING is requested.
*/
#ifndef PROVIDE_ISLOW_TABLES
#define PROVIDE_ISLOW_TABLES
#endif
case ((1 << 8) + 1):
fdct->do_dct[ci] = jpeg_fdct_1x1;
method = JDCT_ISLOW; /* jfdctint uses islow-style table */
@@ -323,14 +318,34 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
switch (cinfo->dct_method) {
#ifdef DCT_ISLOW_SUPPORTED
case JDCT_ISLOW:
#ifndef PROVIDE_ISLOW_TABLES
#define PROVIDE_ISLOW_TABLES
#endif
fdct->do_dct[ci] = jpeg_fdct_islow;
method = JDCT_ISLOW;
break;
#endif
#ifdef DCT_IFAST_SUPPORTED
case JDCT_IFAST:
#if BITS_IN_JSAMPLE < JPEG_DATA_PRECISION || \
BITS_IN_JSAMPLE > JPEG_DATA_PRECISION + 8
/*
* Adjustment of divisor tables in JDCT_IFAST
* below doesn't work well in this condition.
* Use JDCT_ISLOW instead.
*/
#ifndef PROVIDE_ISLOW_TABLES
#define PROVIDE_ISLOW_TABLES
#endif
fdct->do_dct[ci] = jpeg_fdct_islow;
method = JDCT_ISLOW;
#else
#ifndef PROVIDE_IFAST_TABLES
#define PROVIDE_IFAST_TABLES
#endif
fdct->do_dct[ci] = jpeg_fdct_ifast;
method = JDCT_IFAST;
#endif
break;
#endif
#ifdef DCT_FLOAT_SUPPORTED
@@ -357,7 +372,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
switch (method) {
#ifdef PROVIDE_ISLOW_TABLES
case JDCT_ISLOW:
/* For LL&M IDCT method, divisors are equal to raw quantization
/* For LL&M FDCT method, divisors are equal to raw quantization
* coefficients multiplied by 8 (to counteract scaling).
*/
dtbl = (DCTELEM *) compptr->dct_table;
@@ -368,14 +383,15 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
fdct->pub.forward_DCT[ci] = forward_DCT;
break;
#endif
#ifdef DCT_IFAST_SUPPORTED
#ifdef PROVIDE_IFAST_TABLES
case JDCT_IFAST:
{
/* For AA&N IDCT method, divisors are equal to quantization
/* For AA&N FDCT method, divisors are equal to quantization
* coefficients scaled by scalefactor[row]*scalefactor[col], where
* scalefactor[0] = 1
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
* We apply a further scale factor of 8.
* We apply a further scale factor of 8
* with adjustment if necessary.
*/
#define CONST_BITS 14
static const INT16 aanscales[DCTSIZE2] = {
@@ -392,11 +408,20 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
SHIFT_TEMPS
dtbl = (DCTELEM *) compptr->dct_table;
if (compptr->component_needed) {
for (i = 0; i < DCTSIZE2; i++) {
dtbl[i] = (DCTELEM)
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
(INT32) aanscales[i]),
compptr->component_needed ? CONST_BITS-4 : CONST_BITS-3);
CONST_BITS+JPEG_DATA_PRECISION-BITS_IN_JSAMPLE-4);
}
} else {
for (i = 0; i < DCTSIZE2; i++) {
dtbl[i] = (DCTELEM)
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i],
(INT32) aanscales[i]),
CONST_BITS+JPEG_DATA_PRECISION-BITS_IN_JSAMPLE-3);
}
}
}
fdct->pub.forward_DCT[ci] = forward_DCT;
@@ -405,11 +430,12 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
#ifdef DCT_FLOAT_SUPPORTED
case JDCT_FLOAT:
{
/* For float AA&N IDCT method, divisors are equal to quantization
/* For float AA&N FDCT method, divisors are equal to quantization
* coefficients scaled by scalefactor[row]*scalefactor[col], where
* scalefactor[0] = 1
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
* We apply a further scale factor of 8.
* We apply a further scale factor of 8
* with adjustment if necessary.
* What's actually stored is 1/divisor so that the inner loop can
* use a multiplication rather than a division.
*/
@@ -419,6 +445,7 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
1.0, 1.387039845, 1.306562965, 1.175875602,
1.0, 0.785694958, 0.541196100, 0.275899379
};
#if BITS_IN_JSAMPLE == JPEG_DATA_PRECISION
i = 0;
for (row = 0; row < DCTSIZE; row++) {
@@ -427,6 +454,26 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
(1.0 / ((double) qtbl->quantval[i] *
aanscalefactor[row] * aanscalefactor[col] *
(compptr->component_needed ? 16.0 : 8.0)));
#else
double extrafactor = compptr->component_needed ? 16.0 : 8.0;
/* Adjust extra factor */
#if BITS_IN_JSAMPLE < JPEG_DATA_PRECISION
i = JPEG_DATA_PRECISION - BITS_IN_JSAMPLE;
do { extrafactor *= 0.5; } while (--i);
#else
i = BITS_IN_JSAMPLE - JPEG_DATA_PRECISION;
do { extrafactor *= 2.0; } while (--i);
#endif
i = 0;
for (row = 0; row < DCTSIZE; row++) {
for (col = 0; col < DCTSIZE; col++) {
fdtbl[i] = (FAST_FLOAT)
(1.0 / ((double) qtbl->quantval[i] *
aanscalefactor[row] * aanscalefactor[col] *
extrafactor));
#endif
i++;
}
}
+4 -4
View File
@@ -2,7 +2,7 @@
* jchuff.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2006-2023 by Guido Vollbeding.
* Modified 2006-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -26,9 +26,9 @@
/* The legal range of a DCT coefficient is
* -1024 .. +1023 for 8-bit sample data precision;
* -16384 .. +16383 for 12-bit sample data precision.
* Hence the magnitude should always fit in sample data precision + 2 bits.
* -1024 .. +1023 for 8-bit JPEG data precision;
* -16384 .. +16383 for 12-bit JPEG data precision.
* Hence the magnitude should always fit in JPEG data precision + 2 bits.
*/
/* Derived data constructed for each Huffman table */
+2 -2
View File
@@ -2,7 +2,7 @@
* jcinit.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2017 by Guido Vollbeding.
* Modified 2003-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -196,7 +196,7 @@ jinit_compress_master (j_compress_ptr cinfo)
JDIMENSION jd_samplesperrow;
/* For now, precision must match compiled-in value... */
if (cinfo->data_precision != BITS_IN_JSAMPLE)
if (cinfo->data_precision != JPEG_DATA_PRECISION)
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
/* Sanity check on input image dimensions */
+2 -2
View File
@@ -2,7 +2,7 @@
* jcmarker.c
*
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2003-2019 by Guido Vollbeding.
* Modified 2003-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -296,7 +296,7 @@ emit_lse_ict (j_compress_ptr cinfo)
emit_2bytes(cinfo, 24); /* fixed length */
emit_byte(cinfo, 0x0D); /* ID inverse transform specification */
emit_2bytes(cinfo, MAXJSAMPLE); /* MAXTRANS */
emit_2bytes(cinfo, (int) cinfo->LSE_maxtrans); /* MAXTRANS */
emit_byte(cinfo, 3); /* Nt=3 */
emit_byte(cinfo, cinfo->comp_info[1].component_id);
emit_byte(cinfo, cinfo->comp_info[0].component_id);
+3 -2
View File
@@ -2,7 +2,7 @@
* jcparam.c
*
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2003-2022 by Guido Vollbeding.
* Modified 2003-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -215,7 +215,7 @@ jpeg_set_defaults (j_compress_ptr cinfo)
cinfo->scale_num = 1; /* 1:1 scaling */
cinfo->scale_denom = 1;
cinfo->data_precision = BITS_IN_JSAMPLE;
cinfo->data_precision = JPEG_DATA_PRECISION;
/* Set up two quantization tables using default quality of 75 */
jpeg_set_quality(cinfo, 75, TRUE);
/* Reset standard Huffman tables */
@@ -283,6 +283,7 @@ jpeg_set_defaults (j_compress_ptr cinfo)
/* No color transform */
cinfo->color_transform = JCT_NONE;
cinfo->LSE_maxtrans = MAXJSAMPLE; /* Default LSE MAXTRANS value */
/* Choose JPEG colorspace based on input space, set defaults accordingly */
+2 -1
View File
@@ -2,7 +2,7 @@
* jctrans.c
*
* Copyright (C) 1995-1998, Thomas G. Lane.
* Modified 2000-2020 by Guido Vollbeding.
* Modified 2000-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -91,6 +91,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
* entropy coding mode dependent on image data precision.
*/
dstinfo->color_transform = srcinfo->color_transform;
dstinfo->LSE_maxtrans = srcinfo->LSE_maxtrans;
jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
dstinfo->data_precision = srcinfo->data_precision;
dstinfo->arith_code = srcinfo->data_precision > 8 ? TRUE : FALSE;
+4 -3
View File
@@ -2,7 +2,7 @@
* jdcolor.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2011-2023 by Guido Vollbeding.
* Modified 2011-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -640,8 +640,9 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
/* Support color transform only for RGB colorspaces */
if (cinfo->color_transform &&
cinfo->jpeg_color_space != JCS_RGB &&
cinfo->jpeg_color_space != JCS_BG_RGB)
(cinfo->LSE_maxtrans != MAXJSAMPLE ||
(cinfo->jpeg_color_space != JCS_RGB &&
cinfo->jpeg_color_space != JCS_BG_RGB)))
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
/* Set out_color_components and conversion method based on requested space.
+22 -8
View File
@@ -2,7 +2,7 @@
* jdct.h
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2002-2023 by Guido Vollbeding.
* Modified 2002-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -17,9 +17,9 @@
/*
* A forward DCT routine is given a pointer to an input sample array and
* a pointer to a work area of type DCTELEM[]; the DCT is to be performed
* in-place in that buffer. Type DCTELEM is int for 8-bit samples, INT32
* for 12-bit samples. (NOTE: Floating-point DCT implementations use an
* array of type FAST_FLOAT, instead.)
* in-place in that buffer. Type DCTELEM is int or INT32, depending on
* bit depth parameters. (NOTE: Floating-point DCT implementations use
* an array of type FAST_FLOAT, instead.)
* The input data is to be fetched from the sample array starting at a
* specified column. (Any row offset needed will be applied to the array
* pointer before it is passed to the FDCT code.)
@@ -32,7 +32,20 @@
* Quantization of the output coefficients is done by jcdctmgr.c.
*/
#if BITS_IN_JSAMPLE == 8
/* Condition for FDCT:
* BITS_IN_JSAMPLE <= 10 && JPEG_DATA_PRECISION <= 10
* Condition for int IDCT where DCTELEM is used (2x2, 1x1, 2x1, 1x2):
* JPEG_DATA_PRECISION + RANGE_BITS <= 12
* [BITS_IN_JSAMPLE - 1 + RANGE_BITS +
* 3 - (BITS_IN_JSAMPLE - JPEG_DATA_PRECISION) <= 14]
* {3 - (BITS_IN_JSAMPLE - JPEG_DATA_PRECISION) = PASS2_BITS - PASS1_BITS}
* Condition for fast IDCT where DCTELEM is used:
* JPEG_DATA_PRECISION <= 10 && BITS_IN_JSAMPLE <= 13 && RANGE_BITS <= 2
* [BITS_IN_JSAMPLE - 1 + RANGE_BITS + PASS2BITS <= 14]
* Combined for all:
*/
#if BITS_IN_JSAMPLE <= 10 && JPEG_DATA_PRECISION <= 10 && RANGE_BITS <= 2
typedef int DCTELEM; /* 16 or 32 bits is fine */
#else
typedef INT32 DCTELEM; /* must have 32 bits */
@@ -64,9 +77,10 @@ typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data,
*/
typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
#if BITS_IN_JSAMPLE == 8
#if JPEG_DATA_PRECISION <= 10 && BITS_IN_JSAMPLE <= 13
typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */
#define IFAST_SCALE_BITS (10 - JPEG_DATA_PRECISION)
/* fractional bits in scale factors */
#else
typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */
#define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */
@@ -394,7 +408,7 @@ EXTERN(void) jpeg_idct_1x2
#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define ISHIFT_TEMPS DCTELEM ishift_temp;
#if BITS_IN_JSAMPLE == 8
#if BITS_IN_JSAMPLE <= 10 && JPEG_DATA_PRECISION <= 10 && RANGE_BITS <= 2
#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */
#else
#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */
+41 -29
View File
@@ -2,7 +2,7 @@
* jddctmgr.c
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2002-2013 by Guido Vollbeding.
* Modified 2002-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -46,8 +46,8 @@ typedef struct {
/* This array contains the IDCT method code that each multiplier table
* is currently set up for, or -1 if it's not yet set up.
* The actual multiplier tables are pointed to by dct_table in the
* per-component comp_info structures.
* The actual multiplier tables are pointed to by dct_table
* in the per-component comp_info structures.
*/
int cur_method[MAX_COMPONENTS];
} my_idct_controller;
@@ -68,18 +68,6 @@ typedef union {
} multiplier_table;
/* The current scaled-IDCT routines require ISLOW-style multiplier tables,
* so be sure to compile that code if either ISLOW or SCALING is requested.
*/
#ifdef DCT_ISLOW_SUPPORTED
#define PROVIDE_ISLOW_TABLES
#else
#ifdef IDCT_SCALING_SUPPORTED
#define PROVIDE_ISLOW_TABLES
#endif
#endif
/*
* Prepare for an output pass.
* Here we select the proper IDCT routine for each component and build
@@ -101,6 +89,13 @@ start_pass (j_decompress_ptr cinfo)
/* Select the proper IDCT routine for this component's scaling */
switch ((compptr->DCT_h_scaled_size << 8) + compptr->DCT_v_scaled_size) {
#ifdef IDCT_SCALING_SUPPORTED
/*
* The current scaled-IDCT routines require ISLOW-style multiplier tables,
* so be sure to compile that code if either ISLOW or SCALING is requested.
*/
#ifndef PROVIDE_ISLOW_TABLES
#define PROVIDE_ISLOW_TABLES
#endif
case ((1 << 8) + 1):
method_ptr = jpeg_idct_1x1;
method = JDCT_ISLOW; /* jidctint uses islow-style table */
@@ -230,6 +225,9 @@ start_pass (j_decompress_ptr cinfo)
switch (cinfo->dct_method) {
#ifdef DCT_ISLOW_SUPPORTED
case JDCT_ISLOW:
#ifndef PROVIDE_ISLOW_TABLES
#define PROVIDE_ISLOW_TABLES
#endif
method_ptr = jpeg_idct_islow;
method = JDCT_ISLOW;
break;
@@ -248,21 +246,19 @@ start_pass (j_decompress_ptr cinfo)
#endif
default:
ERREXIT(cinfo, JERR_NOT_COMPILED);
break;
}
break;
default:
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
compptr->DCT_h_scaled_size, compptr->DCT_v_scaled_size);
break;
}
idct->pub.inverse_DCT[ci] = method_ptr;
/* Create multiplier table from quant table.
* However, we can skip this if the component is uninteresting
* or if we already built the table. Also, if no quant table
* has yet been saved for the component, we leave the
* multiplier table all-zero; we'll be reading zeroes from the
* coefficient controller's buffer anyway.
* multiplier table all-zero; we'll be reading zeroes
* from the coefficient controller's buffer anyway.
*/
if (! compptr->component_needed || idct->cur_method[ci] == method)
continue;
@@ -325,7 +321,8 @@ start_pass (j_decompress_ptr cinfo)
* coefficients scaled by scalefactor[row]*scalefactor[col], where
* scalefactor[0] = 1
* scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
* We apply a further scale factor of 1/8.
* We apply a further scale factor of 1/8
* with adjustment if necessary.
*/
FLOAT_MULT_TYPE * fmtbl = (FLOAT_MULT_TYPE *) compptr->dct_table;
int row, col;
@@ -333,13 +330,31 @@ start_pass (j_decompress_ptr cinfo)
1.0, 1.387039845, 1.306562965, 1.175875602,
1.0, 0.785694958, 0.541196100, 0.275899379
};
#if JPEG_DATA_PRECISION == BITS_IN_JSAMPLE
i = 0;
for (row = 0; row < DCTSIZE; row++) {
for (col = 0; col < DCTSIZE; col++) {
fmtbl[i] = (FLOAT_MULT_TYPE)
((double) qtbl->quantval[i] *
fmtbl[i] = (FLOAT_MULT_TYPE) ((double) qtbl->quantval[i] *
aanscalefactor[row] * aanscalefactor[col] * 0.125);
#else
double extrafactor = 0.125;
/* Adjust extra factor */
#if JPEG_DATA_PRECISION < BITS_IN_JSAMPLE
i = BITS_IN_JSAMPLE - JPEG_DATA_PRECISION;
do { extrafactor *= 2.0; } while (--i);
#else
i = JPEG_DATA_PRECISION - BITS_IN_JSAMPLE;
do { extrafactor *= 0.5; } while (--i);
#endif
i = 0;
for (row = 0; row < DCTSIZE; row++) {
for (col = 0; col < DCTSIZE; col++) {
fmtbl[i] = (FLOAT_MULT_TYPE) ((double) qtbl->quantval[i] *
aanscalefactor[row] * aanscalefactor[col] * extrafactor);
#endif
i++;
}
}
@@ -348,7 +363,6 @@ start_pass (j_decompress_ptr cinfo)
#endif
default:
ERREXIT(cinfo, JERR_NOT_COMPILED);
break;
}
}
}
@@ -365,18 +379,16 @@ jinit_inverse_dct (j_decompress_ptr cinfo)
int ci;
jpeg_component_info *compptr;
idct = (my_idct_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_idct_controller));
idct = (my_idct_ptr) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_idct_controller));
cinfo->idct = &idct->pub;
idct->pub.start_pass = start_pass;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
/* Allocate and pre-zero a multiplier table for each component */
compptr->dct_table =
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(multiplier_table));
compptr->dct_table = (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(multiplier_table));
MEMZERO(compptr->dct_table, SIZEOF(multiplier_table));
/* Mark multiplier table not yet set up for any method */
idct->cur_method[ci] = -1;
+2 -2
View File
@@ -2,7 +2,7 @@
* jdmarker.c
*
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2009-2019 by Guido Vollbeding.
* Modified 2009-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -664,7 +664,7 @@ get_lse (j_decompress_ptr cinfo)
if (tmp != 0x0D) /* ID inverse transform specification */
ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
INPUT_2BYTES(cinfo, tmp, return FALSE);
if (tmp != MAXJSAMPLE) goto bad; /* MAXTRANS */
cinfo->LSE_maxtrans = (UINT16) tmp; /* MAXTRANS */
INPUT_BYTE(cinfo, tmp, return FALSE);
if (tmp != 3) goto bad; /* Nt=3 */
INPUT_BYTE(cinfo, cid, return FALSE);
+2 -2
View File
@@ -2,7 +2,7 @@
* jdmaster.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2002-2020 by Guido Vollbeding.
* Modified 2002-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -267,7 +267,7 @@ master_selection (j_decompress_ptr cinfo)
JDIMENSION jd_samplesperrow;
/* For now, precision must match compiled-in value... */
if (cinfo->data_precision != BITS_IN_JSAMPLE)
if (cinfo->data_precision != JPEG_DATA_PRECISION)
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
/* Initialize dimensions and other stuff */
+11 -2
View File
@@ -2,7 +2,7 @@
* jerror.c
*
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2012-2015 by Guido Vollbeding.
* Modified 2012-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -237,9 +237,18 @@ jpeg_std_error (struct jpeg_error_mgr * err)
err->format_message = format_message;
err->reset_error_mgr = reset_error_mgr;
err->msg_code = 0; /* may be useful as a flag for "no error" */
err->msg_parm.i[0] = 0; /* initialize 8 int message parameters */
err->msg_parm.i[1] = 0;
err->msg_parm.i[2] = 0;
err->msg_parm.i[3] = 0;
err->msg_parm.i[4] = 0;
err->msg_parm.i[5] = 0;
err->msg_parm.i[6] = 0;
err->msg_parm.i[7] = 0;
err->trace_level = 0; /* default = no tracing */
err->num_warnings = 0; /* no warnings emitted yet */
err->msg_code = 0; /* may be useful as a flag for "no error" */
/* Initialize message table pointers */
err->jpeg_message_table = jpeg_std_message_table;
+3 -3
View File
@@ -2,7 +2,7 @@
* jerror.h
*
* Copyright (C) 1994-1997, Thomas G. Lane.
* Modified 1997-2018 by Guido Vollbeding.
* Modified 1997-2026 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -130,7 +130,7 @@ JMESSAGE(JTRC_ADOBE,
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
JMESSAGE(JTRC_DAC, "Define Arithmetic Conditioning 0x%02x: 0x%02x")
JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
@@ -156,7 +156,7 @@ JMESSAGE(JTRC_SMOOTH_NOTIMPL,
"Smoothing not supported with nonstandard sampling ratios")
JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
JMESSAGE(JTRC_SOI, "Start of Image")
JMESSAGE(JTRC_SOI, "Start Of Image")
JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
+553 -359
View File
File diff suppressed because it is too large Load Diff
+62 -50
View File
@@ -2,7 +2,7 @@
* jidctfst.c
*
* Copyright (C) 1994-1998, Thomas G. Lane.
* Modified 2015-2017 by Guido Vollbeding.
* Modified 2015-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -15,11 +15,11 @@
* a time). Direct algorithms are also available, but they are much more
* complex and seem not to be any faster when reduced to code.
*
* This implementation is based on Arai, Agui, and Nakajima's algorithm for
* scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is in
* Japanese, but the algorithm is described in the Pennebaker & Mitchell
* JPEG textbook (see REFERENCES section in file README). The following code
* is based directly on figure 4-8 in P&M.
* This implementation is based on Arai, Agui, and Nakajima's algorithm
* for scaled DCT. Their original paper (Trans. IEICE E-71(11):1095) is
* in Japanese, but the algorithm is described in the Pennebaker & Mitchell
* JPEG textbook (see REFERENCES section in file README). The following
* code is based directly on figure 4-8 in P&M.
* While an 8-point DCT cannot be done in less than 11 multiplies, it is
* possible to arrange the computation so that many of the multiplies are
* simple scalings of the final outputs. These multiplies can then be
@@ -28,9 +28,9 @@
* to be done in the DCT itself.
* The primary disadvantage of this method is that with fixed-point math,
* accuracy is lost due to imprecise representation of the scaled
* quantization values. The smaller the quantization table entry, the less
* precise the scaled value, so this implementation does worse with high-
* quality-setting files than with low-quality ones.
* quantization values. The smaller the quantization table entry,
* the less precise the scaled value, so this implementation does
* worse with high-quality-setting files than with low-quality ones.
*/
#define JPEG_INTERNALS
@@ -55,17 +55,17 @@
* (right shift) multiplication products as soon as they are formed,
* rather than carrying additional fractional bits into subsequent additions.
* This compromises accuracy slightly, but it lets us save a few shifts.
* More importantly, 16-bit arithmetic is then adequate (for 8-bit samples)
* everywhere except in the multiplications proper; this saves a good deal
* of work on 16-bit-int machines.
* More importantly, 16-bit arithmetic is then adequate (for up to 10-bit
* data) everywhere except in the multiplications proper;
* this saves a good deal of work on 16-bit-int machines.
*
* The dequantized coefficients are not integers because the AA&N scaling
* factors have been incorporated. We represent them scaled up by PASS1_BITS,
* so that the first and second IDCT rounds have the same input scaling.
* For 8-bit JSAMPLEs, we choose IFAST_SCALE_BITS = PASS1_BITS so as to
* For up to 10-bit data, we choose IFAST_SCALE_BITS = PASS1_BITS so as to
* avoid a descaling shift; this compromises accuracy rather drastically
* for small quantization table entries, but it saves a lot of shifts.
* For 12-bit JSAMPLEs, there's no hope of using 16x16 multiplies anyway,
* For higher bit depths, there's no hope of using 16x16 multiplies anyway,
* so we use a much larger scaling factor to preserve accuracy.
*
* A final compromise is to represent the multiplicative constants to only
@@ -74,16 +74,20 @@
* are fewer one-bits in the constants).
*/
#if BITS_IN_JSAMPLE == 8
#if JPEG_DATA_PRECISION <= 10 && BITS_IN_JSAMPLE <= 13
#define CONST_BITS 8
#define PASS1_BITS 2
#define PASS1_BITS (10 - JPEG_DATA_PRECISION)
#define PASS2_BITS (13 - BITS_IN_JSAMPLE)
#else
#if JPEG_DATA_PRECISION <= 13 && BITS_IN_JSAMPLE <= 16
#define CONST_BITS 8
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#define PASS1_BITS (13 - JPEG_DATA_PRECISION)
#define PASS2_BITS (16 - BITS_IN_JSAMPLE)
#endif
#endif
/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
* causing a lot of useless floating-point operations at run time.
/* Some C compilers fail to reduce "FIX(constant)" at compile time,
* thus causing a lot of useless floating-point operations at run time.
* To get around this we use the following pre-calculated constants.
* If you change CONST_BITS you may want to add appropriate values.
* (With a reasonable C compiler, you can just rely on the FIX() macro...)
@@ -102,9 +106,9 @@
#endif
/* We can gain a little more speed, with a further compromise in accuracy,
* by omitting the addition in a descaling shift. This yields an incorrectly
* rounded result half the time...
/* We can gain a little more speed, with a further compromise
* in accuracy, by omitting the addition in a descaling shift.
* This yields an incorrectly rounded result half the time...
*/
#ifndef USE_ACCURATE_ROUNDING
@@ -113,20 +117,20 @@
#endif
/* Multiply a DCTELEM variable by an INT32 constant, and immediately
* descale to yield a DCTELEM result.
/* Multiply a DCTELEM variable by an INT32 constant,
* and immediately descale to yield a DCTELEM result.
*/
#define MULTIPLY(var,const) ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
/* Dequantize a coefficient by multiplying it by the multiplier-table
* entry; produce a DCTELEM result. For 8-bit data a 16x16->16
* multiplication will do. For 12-bit data, the multiplier table is
* declared INT32, so a 32-bit multiply will be used.
* entry; produce a DCTELEM result. For up to 10-bit data a 16x16->16
* multiplication will do. For higher bit depths, the multiplier table
* is declared INT32, so a 32-bit multiply will be used.
*/
#if BITS_IN_JSAMPLE == 8
#if JPEG_DATA_PRECISION <= 10 && BITS_IN_JSAMPLE <= 13
#define DEQUANTIZE(coef,quantval) (((IFAST_MULT_TYPE) (coef)) * (quantval))
#else
#define DEQUANTIZE(coef,quantval) \
@@ -134,6 +138,16 @@
#endif
/* Final output conversion: scale down and range-limit. */
#if PASS2_BITS > 0
#define FINAL_OUTPUT(x) \
range_limit[(int) IRIGHT_SHIFT(x, PASS2_BITS) & RANGE_MASK]
#else
#define FINAL_OUTPUT(x) range_limit[(int) (x) & RANGE_MASK]
#endif
/*
* Perform dequantization and inverse DCT on one block of coefficients.
*
@@ -252,7 +266,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* Pass 2: process rows from work array, store into output array.
* Note that we must descale the results by a factor of 8 == 2**3,
* and also undo the PASS1_BITS scaling.
* which is folded into the PASS2_BITS value.
*/
wsptr = workspace;
@@ -260,9 +274,16 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
outptr = output_buf[ctr] + output_col;
/* Add range center and fudge factor for final descale and range-limit. */
#if PASS2_BITS > 1
z5 = (DCTELEM) wsptr[0] +
((((DCTELEM) RANGE_CENTER) << (PASS1_BITS+3)) +
(1 << (PASS1_BITS+2)));
((((DCTELEM) RANGE_CENTER) << PASS2_BITS) + (1 << (PASS2_BITS-1)));
#else
#if PASS2_BITS > 0
z5 = (DCTELEM) wsptr[0] + ((((DCTELEM) RANGE_CENTER) << 1) + 1);
#else
z5 = (DCTELEM) wsptr[0] + (DCTELEM) RANGE_CENTER;
#endif
#endif
/* Rows of zeroes can be exploited in the same way as we did with columns.
* However, the column calculation has created many nonzero AC terms, so
@@ -276,8 +297,7 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */
JSAMPLE dcval = range_limit[(int) IRIGHT_SHIFT(z5, PASS1_BITS+3)
& RANGE_MASK];
JSAMPLE dcval = FINAL_OUTPUT(z5);
outptr[0] = dcval;
outptr[1] = dcval;
@@ -325,24 +345,16 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 - tmp5;
/* Final output stage: scale down by a factor of 8 and range-limit */
/* Final output stage: scale down and range-limit */
outptr[0] = range_limit[(int) IRIGHT_SHIFT(tmp0 + tmp7, PASS1_BITS+3)
& RANGE_MASK];
outptr[7] = range_limit[(int) IRIGHT_SHIFT(tmp0 - tmp7, PASS1_BITS+3)
& RANGE_MASK];
outptr[1] = range_limit[(int) IRIGHT_SHIFT(tmp1 + tmp6, PASS1_BITS+3)
& RANGE_MASK];
outptr[6] = range_limit[(int) IRIGHT_SHIFT(tmp1 - tmp6, PASS1_BITS+3)
& RANGE_MASK];
outptr[2] = range_limit[(int) IRIGHT_SHIFT(tmp2 + tmp5, PASS1_BITS+3)
& RANGE_MASK];
outptr[5] = range_limit[(int) IRIGHT_SHIFT(tmp2 - tmp5, PASS1_BITS+3)
& RANGE_MASK];
outptr[3] = range_limit[(int) IRIGHT_SHIFT(tmp3 + tmp4, PASS1_BITS+3)
& RANGE_MASK];
outptr[4] = range_limit[(int) IRIGHT_SHIFT(tmp3 - tmp4, PASS1_BITS+3)
& RANGE_MASK];
outptr[0] = FINAL_OUTPUT(tmp0 + tmp7);
outptr[7] = FINAL_OUTPUT(tmp0 - tmp7);
outptr[1] = FINAL_OUTPUT(tmp1 + tmp6);
outptr[6] = FINAL_OUTPUT(tmp1 - tmp6);
outptr[2] = FINAL_OUTPUT(tmp2 + tmp5);
outptr[5] = FINAL_OUTPUT(tmp2 - tmp5);
outptr[3] = FINAL_OUTPUT(tmp3 + tmp4);
outptr[4] = FINAL_OUTPUT(tmp3 - tmp4);
wsptr += DCTSIZE; /* advance pointer to next row */
}
+638 -382
View File
File diff suppressed because it is too large Load Diff
+50 -14
View File
@@ -2,7 +2,7 @@
* jmorecfg.h
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2022 by Guido Vollbeding.
* Modified 1997-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -12,26 +12,62 @@
*/
#define JPEG_DATA_PRECISION 8 /* see table below */
#define BITS_IN_JSAMPLE JPEG_DATA_PRECISION /* see table below */
/*
* Define BITS_IN_JSAMPLE as either
* 8 for 8-bit sample values (the usual setting)
* 9 for 9-bit sample values
* 10 for 10-bit sample values
* 11 for 11-bit sample values
* 12 for 12-bit sample values
* Only 8, 9, 10, 11, and 12 bits sample data precision are supported for
* full-feature DCT processing. Further depths up to 16-bit may be added
* later for the lossless modes of operation.
* Run-time selection and conversion of data precision will be added later
* and are currently not supported, sorry.
* Most useful alternative for "HDR" (High Dynamic Range) application
* with backward compatibility for file interchange (see table below;
* move comment marks for selection):
#define BITS_IN_JSAMPLE 10
*/
/* For still higher demands (see table below):
#define BITS_IN_JSAMPLE 11
*/
/* or
#define BITS_IN_JSAMPLE 12
*/
/* | BITS_IN_JSAMPLE
* JPEG_DATA_PRECISION | read / write with full DCT up to lossless operation
* | exceptions see below
* -------------------------------------------------------------------------------
* {[_8_]} | _8_ <9> <10> <11>* <12>~
* [_9_] | <8> _9_ <10> <11> <12>*
* [_10_] | <8> <9> _10_ <11> <12> 13 *
* _11_ | <8> <9> <10> _11_ <12> 13 14 *
* _12_ | <8> <9> <10> <11> _12_ 13 14 15 *
* 13 | 8 9 10 11 12 13 14 15 16 *
*
* _x_ currently and previously implemented - default configuration
* <x> newly implemented
* {x} current standard for file interchange - backward compatible
* [x] next standard for file interchange - common DCT implementation category
* * does not support GCC lossless (GCbCr lossless - requires 1 extra bit)
* ~ 1 bit precision loss - effective 11 bits precision (lossy)
*
* Since the DCT coefficients are 3 bits larger than sample values with normal DCT
* processing, it is possible to support sample values with up to 3 more bits than
* the nominal JPEG data precision parameter by adapted DCT processing with up to
* lossless operation. The generated JPEG files are fully interchangeable for the
* same JPEG data precision parameter. Another BITS_IN_JSAMPLE setting will just
* reconstruct an image with corresponding precision.
*
* A special case for JPEG data precision 8 with 12-bit sample size (4 more bits)
* is provided so that all previously available sample formats are now supported
* for file interchange with backward compatibility.
* If full-feature DCT up to lossless operation with up to 12-bit sample size is
* required, it is recommended to select JPEG data precision 10, because it falls
* in the same DCT implementation category with 8 and 9 which may be commonly
* supported at run-time as the next standard for file interchange.
*
* Remaining bit depths and variability at run-time may be added later and
* are currently not supported, sorry.
* Exception: The transcoding part (jpegtran) supports all settings in a
* single instance, since it operates on the level of DCT coefficients and
* not sample values. The DCT coefficients are of the same type (16 bits)
* in all cases (see below).
*/
#define BITS_IN_JSAMPLE 8 /* use 8, 9, 10, 11, or 12 */
/*
* Maximum number of components (color channels) allowed in JPEG image.
+9 -7
View File
@@ -2,7 +2,7 @@
* jpeglib.h
*
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2022 by Guido Vollbeding.
* Modified 2002-2025 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -34,12 +34,12 @@ extern "C" {
#endif
/* Version IDs for the JPEG library.
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 90".
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 100".
*/
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
#define JPEG_LIB_VERSION_MAJOR 9
#define JPEG_LIB_VERSION_MINOR 6
#define JPEG_LIB_VERSION 100 /* Compatibility version 10.0 */
#define JPEG_LIB_VERSION_MAJOR 10
#define JPEG_LIB_VERSION_MINOR 0
/* Various constants determining the sizes of things.
@@ -384,8 +384,9 @@ struct jpeg_compress_struct {
UINT16 Y_density; /* Vertical pixel density */
boolean write_Adobe_marker; /* should an Adobe marker be written? */
J_COLOR_TRANSFORM color_transform;
/* Color transform identifier, writes LSE marker if nonzero */
J_COLOR_TRANSFORM color_transform;
UINT16 LSE_maxtrans; /* LSE MAXTRANS value, usually = MAXJSAMPLE */
/* State variable: index of next scanline to be written to
* jpeg_write_scanlines(). Application may use this to control its
@@ -606,8 +607,9 @@ struct jpeg_decompress_struct {
boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
UINT8 Adobe_transform; /* Color transform code from Adobe marker */
J_COLOR_TRANSFORM color_transform;
/* Color transform identifier derived from LSE marker, otherwise zero */
J_COLOR_TRANSFORM color_transform;
UINT16 LSE_maxtrans; /* LSE MAXTRANS value, usually = MAXJSAMPLE */
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
+3 -3
View File
@@ -1,7 +1,7 @@
/*
* jversion.h
*
* Copyright (C) 1991-2024, Thomas G. Lane, Guido Vollbeding.
* Copyright (C) 1991-2026, Thomas G. Lane, Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -9,6 +9,6 @@
*/
#define JVERSION "9f 14-Jan-2024"
#define JVERSION "10 25-Jan-2026"
#define JCOPYRIGHT "Copyright (C) 2024, Thomas G. Lane, Guido Vollbeding"
#define JCOPYRIGHT "Copyright (C) 2026, Thomas G. Lane, Guido Vollbeding"
+5 -1
View File
@@ -555,6 +555,10 @@ For example you may want to do
jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg | pnmflip -r90 | cjpeg
to do a perfect rotation if available or an approximated one if not.
A lossless negation function can be used in case an image file contains
inverted component data:
-negate Negate image (invert component data).
We also offer a lossless-crop option, which discards data outside a given
image region but losslessly preserves what is inside. Like the rotate and
flip transforms, lossless crop is restricted by the current JPEG format: the
@@ -591,7 +595,7 @@ region with repeated reflections of the outside area, instead of gray out.
Another option is lossless-drop, which replaces data at a given image
position by another image:
-drop +X+Y filename Drop another image
-drop +X+Y filename Drop another image.
Both source images must have the same subsampling values. It is best if
they also have the same quantization, otherwise quantization adaption occurs.