Update bundled libjpeg to version 9f

This commit is contained in:
ManoloFLTK 2024-02-17 11:46:11 +01:00
parent bf938da079
commit 3ecadc0a8e
19 changed files with 602 additions and 531 deletions

View File

@ -23,14 +23,14 @@ The nanosvg library is not affected.
\section bundled-status Current status \section bundled-status Current status
\code \code
Current versions of bundled libraries (as of December 5, 2023): Current versions of bundled libraries (as of February 17, 2024):
Library Version/git commit Release date FLTK Version Library Version/git commit Release date FLTK Version
-------------------------------------------------------------------------- --------------------------------------------------------------------------
jpeg jpeg-9e 2022-01-16 1.4.0 jpeg jpeg-9f 2024-01-14 1.4.0
nanosvg 7aeda550a8 [1] 2023-12-02 1.4.0 nanosvg 7aeda550a8 [1] 2023-12-02 1.4.0
png libpng-1.6.42 2024-01-29 1.4.0 png libpng-1.6.42 2024-01-29 1.4.0
zlib zlib-1.3.1 2024-01-22 1.4.0 zlib zlib-1.3.1 2024-01-22 1.4.0
libdecor 060fe761 [2] 2023-12-01 1.4.0 libdecor 7807ae34 [2] 2024-01-15 1.4.0
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Previous versions of bundled libraries (FLTK 1.3.x): Previous versions of bundled libraries (FLTK 1.3.x):

View File

@ -1,7 +1,7 @@
The Independent JPEG Group's JPEG software The Independent JPEG Group's JPEG software
========================================== ==========================================
README for release 9e of 16-Jan-2022 README for release 9f of 14-Jan-2024
==================================== ====================================
This distribution contains the ninth public release of the Independent JPEG 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, 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. its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-2022, Thomas G. Lane, Guido Vollbeding. This software is copyright (C) 1991-2024, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below. All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this 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 The most recent released version can always be found there in
directory "files". This particular version will be archived directory "files". This particular version will be archived
in Windows-compatible "zip" archive format as in Windows-compatible "zip" archive format as
https://www.ijg.org/files/jpegsr9e.zip, and https://www.ijg.org/files/jpegsr9f.zip, and
in Unix-compatible "tar.gz" archive format as in Unix-compatible "tar.gz" archive format as
https://www.ijg.org/files/jpegsrc.v9e.tar.gz. https://www.ijg.org/files/jpegsrc.v9f.tar.gz.
The JPEG FAQ (Frequently Asked Questions) article is a source of some The JPEG FAQ (Frequently Asked Questions) article is a source of some
general information about JPEG. general information about JPEG.
@ -371,4 +371,4 @@ to overcome the limitations of the original JPEG specification,
and is the first true source reference JPEG codec. and is the first true source reference JPEG codec.
More features are being prepared for coming releases... More features are being prepared for coming releases...
Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org. Please send bug reports, offers of help, etc. to jpeg-info@ijg.org.

View File

@ -1,6 +1,17 @@
CHANGE LOG for Independent JPEG Group's JPEG software CHANGE LOG for Independent JPEG Group's JPEG software
Version 9f 14-Jan-2024
-----------------------
Add build system for C++Builder/RAD Studio.
Add build system for Xcode (beside configure).
Add ARM64EC (Emulation Compatible) platform support in the
Visual Studio build.
Version 9e 16-Jan-2022 Version 9e 16-Jan-2022
----------------------- -----------------------

View File

@ -1,173 +1,169 @@
/* #define _jcopy_block_row fltk__jcopy_block_row
* FLTK symbol prefixes for libjpeg #define _jcopy_sample_rows fltk__jcopy_sample_rows
* This is a generated file: see README.bundled-libs.txt #define _jdiv_round_up fltk__jdiv_round_up
*/ #define _jinit_1pass_quantizer fltk__jinit_1pass_quantizer
#define jcopy_block_row fltk_jcopy_block_row #define _jinit_2pass_quantizer fltk__jinit_2pass_quantizer
#define jcopy_sample_rows fltk_jcopy_sample_rows #define _jinit_arith_decoder fltk__jinit_arith_decoder
#define jdiv_round_up fltk_jdiv_round_up #define _jinit_arith_encoder fltk__jinit_arith_encoder
#define jinit_1pass_quantizer fltk_jinit_1pass_quantizer #define _jinit_c_coef_controller fltk__jinit_c_coef_controller
#define jinit_2pass_quantizer fltk_jinit_2pass_quantizer #define _jinit_c_main_controller fltk__jinit_c_main_controller
#define jinit_arith_decoder fltk_jinit_arith_decoder #define _jinit_c_master_control fltk__jinit_c_master_control
#define jinit_arith_encoder fltk_jinit_arith_encoder #define _jinit_c_prep_controller fltk__jinit_c_prep_controller
#define jinit_c_coef_controller fltk_jinit_c_coef_controller #define _jinit_color_converter fltk__jinit_color_converter
#define jinit_c_main_controller fltk_jinit_c_main_controller #define _jinit_color_deconverter fltk__jinit_color_deconverter
#define jinit_c_master_control fltk_jinit_c_master_control #define _jinit_compress_master fltk__jinit_compress_master
#define jinit_color_converter fltk_jinit_color_converter #define _jinit_d_coef_controller fltk__jinit_d_coef_controller
#define jinit_color_deconverter fltk_jinit_color_deconverter #define _jinit_d_main_controller fltk__jinit_d_main_controller
#define jinit_compress_master fltk_jinit_compress_master #define _jinit_d_post_controller fltk__jinit_d_post_controller
#define jinit_c_prep_controller fltk_jinit_c_prep_controller #define _jinit_downsampler fltk__jinit_downsampler
#define jinit_d_coef_controller fltk_jinit_d_coef_controller #define _jinit_forward_dct fltk__jinit_forward_dct
#define jinit_d_main_controller fltk_jinit_d_main_controller #define _jinit_huff_decoder fltk__jinit_huff_decoder
#define jinit_downsampler fltk_jinit_downsampler #define _jinit_huff_encoder fltk__jinit_huff_encoder
#define jinit_d_post_controller fltk_jinit_d_post_controller #define _jinit_input_controller fltk__jinit_input_controller
#define jinit_forward_dct fltk_jinit_forward_dct #define _jinit_inverse_dct fltk__jinit_inverse_dct
#define jinit_huff_decoder fltk_jinit_huff_decoder #define _jinit_marker_reader fltk__jinit_marker_reader
#define jinit_huff_encoder fltk_jinit_huff_encoder #define _jinit_marker_writer fltk__jinit_marker_writer
#define jinit_input_controller fltk_jinit_input_controller #define _jinit_master_decompress fltk__jinit_master_decompress
#define jinit_inverse_dct fltk_jinit_inverse_dct #define _jinit_memory_mgr fltk__jinit_memory_mgr
#define jinit_marker_reader fltk_jinit_marker_reader #define _jinit_merged_upsampler fltk__jinit_merged_upsampler
#define jinit_marker_writer fltk_jinit_marker_writer #define _jinit_upsampler fltk__jinit_upsampler
#define jinit_master_decompress fltk_jinit_master_decompress #define _jpeg_CreateCompress fltk__jpeg_CreateCompress
#define jinit_memory_mgr fltk_jinit_memory_mgr #define _jpeg_CreateDecompress fltk__jpeg_CreateDecompress
#define jinit_merged_upsampler fltk_jinit_merged_upsampler #define _jpeg_abort fltk__jpeg_abort
#define jinit_upsampler fltk_jinit_upsampler #define _jpeg_abort_compress fltk__jpeg_abort_compress
#define jpeg_abort fltk_jpeg_abort #define _jpeg_abort_decompress fltk__jpeg_abort_decompress
#define jpeg_abort_compress fltk_jpeg_abort_compress #define _jpeg_add_quant_table fltk__jpeg_add_quant_table
#define jpeg_abort_decompress fltk_jpeg_abort_decompress #define _jpeg_alloc_huff_table fltk__jpeg_alloc_huff_table
#define jpeg_add_quant_table fltk_jpeg_add_quant_table #define _jpeg_alloc_quant_table fltk__jpeg_alloc_quant_table
#define jpeg_alloc_huff_table fltk_jpeg_alloc_huff_table #define _jpeg_aritab fltk__jpeg_aritab
#define jpeg_alloc_quant_table fltk_jpeg_alloc_quant_table #define _jpeg_calc_jpeg_dimensions fltk__jpeg_calc_jpeg_dimensions
#define jpeg_aritab fltk_jpeg_aritab #define _jpeg_calc_output_dimensions fltk__jpeg_calc_output_dimensions
#define jpeg_calc_jpeg_dimensions fltk_jpeg_calc_jpeg_dimensions #define _jpeg_consume_input fltk__jpeg_consume_input
#define jpeg_calc_output_dimensions fltk_jpeg_calc_output_dimensions #define _jpeg_copy_critical_parameters fltk__jpeg_copy_critical_parameters
#define jpeg_consume_input fltk_jpeg_consume_input #define _jpeg_core_output_dimensions fltk__jpeg_core_output_dimensions
#define jpeg_copy_critical_parameters fltk_jpeg_copy_critical_parameters #define _jpeg_default_colorspace fltk__jpeg_default_colorspace
#define jpeg_core_output_dimensions fltk_jpeg_core_output_dimensions #define _jpeg_default_qtables fltk__jpeg_default_qtables
#define jpeg_CreateCompress fltk_jpeg_CreateCompress #define _jpeg_destroy fltk__jpeg_destroy
#define jpeg_CreateDecompress fltk_jpeg_CreateDecompress #define _jpeg_destroy_compress fltk__jpeg_destroy_compress
#define jpeg_default_colorspace fltk_jpeg_default_colorspace #define _jpeg_destroy_decompress fltk__jpeg_destroy_decompress
#define jpeg_default_qtables fltk_jpeg_default_qtables #define _jpeg_fdct_10x10 fltk__jpeg_fdct_10x10
#define jpeg_destroy fltk_jpeg_destroy #define _jpeg_fdct_10x5 fltk__jpeg_fdct_10x5
#define jpeg_destroy_compress fltk_jpeg_destroy_compress #define _jpeg_fdct_11x11 fltk__jpeg_fdct_11x11
#define jpeg_destroy_decompress fltk_jpeg_destroy_decompress #define _jpeg_fdct_12x12 fltk__jpeg_fdct_12x12
#define jpeg_fdct_10x10 fltk_jpeg_fdct_10x10 #define _jpeg_fdct_12x6 fltk__jpeg_fdct_12x6
#define jpeg_fdct_10x5 fltk_jpeg_fdct_10x5 #define _jpeg_fdct_13x13 fltk__jpeg_fdct_13x13
#define jpeg_fdct_11x11 fltk_jpeg_fdct_11x11 #define _jpeg_fdct_14x14 fltk__jpeg_fdct_14x14
#define jpeg_fdct_12x12 fltk_jpeg_fdct_12x12 #define _jpeg_fdct_14x7 fltk__jpeg_fdct_14x7
#define jpeg_fdct_12x6 fltk_jpeg_fdct_12x6 #define _jpeg_fdct_15x15 fltk__jpeg_fdct_15x15
#define jpeg_fdct_13x13 fltk_jpeg_fdct_13x13 #define _jpeg_fdct_16x16 fltk__jpeg_fdct_16x16
#define jpeg_fdct_14x14 fltk_jpeg_fdct_14x14 #define _jpeg_fdct_16x8 fltk__jpeg_fdct_16x8
#define jpeg_fdct_14x7 fltk_jpeg_fdct_14x7 #define _jpeg_fdct_1x1 fltk__jpeg_fdct_1x1
#define jpeg_fdct_15x15 fltk_jpeg_fdct_15x15 #define _jpeg_fdct_1x2 fltk__jpeg_fdct_1x2
#define jpeg_fdct_16x16 fltk_jpeg_fdct_16x16 #define _jpeg_fdct_2x1 fltk__jpeg_fdct_2x1
#define jpeg_fdct_16x8 fltk_jpeg_fdct_16x8 #define _jpeg_fdct_2x2 fltk__jpeg_fdct_2x2
#define jpeg_fdct_1x1 fltk_jpeg_fdct_1x1 #define _jpeg_fdct_2x4 fltk__jpeg_fdct_2x4
#define jpeg_fdct_1x2 fltk_jpeg_fdct_1x2 #define _jpeg_fdct_3x3 fltk__jpeg_fdct_3x3
#define jpeg_fdct_2x1 fltk_jpeg_fdct_2x1 #define _jpeg_fdct_3x6 fltk__jpeg_fdct_3x6
#define jpeg_fdct_2x2 fltk_jpeg_fdct_2x2 #define _jpeg_fdct_4x2 fltk__jpeg_fdct_4x2
#define jpeg_fdct_2x4 fltk_jpeg_fdct_2x4 #define _jpeg_fdct_4x4 fltk__jpeg_fdct_4x4
#define jpeg_fdct_3x3 fltk_jpeg_fdct_3x3 #define _jpeg_fdct_4x8 fltk__jpeg_fdct_4x8
#define jpeg_fdct_3x6 fltk_jpeg_fdct_3x6 #define _jpeg_fdct_5x10 fltk__jpeg_fdct_5x10
#define jpeg_fdct_4x2 fltk_jpeg_fdct_4x2 #define _jpeg_fdct_5x5 fltk__jpeg_fdct_5x5
#define jpeg_fdct_4x4 fltk_jpeg_fdct_4x4 #define _jpeg_fdct_6x12 fltk__jpeg_fdct_6x12
#define jpeg_fdct_4x8 fltk_jpeg_fdct_4x8 #define _jpeg_fdct_6x3 fltk__jpeg_fdct_6x3
#define jpeg_fdct_5x10 fltk_jpeg_fdct_5x10 #define _jpeg_fdct_6x6 fltk__jpeg_fdct_6x6
#define jpeg_fdct_5x5 fltk_jpeg_fdct_5x5 #define _jpeg_fdct_7x14 fltk__jpeg_fdct_7x14
#define jpeg_fdct_6x12 fltk_jpeg_fdct_6x12 #define _jpeg_fdct_7x7 fltk__jpeg_fdct_7x7
#define jpeg_fdct_6x3 fltk_jpeg_fdct_6x3 #define _jpeg_fdct_8x16 fltk__jpeg_fdct_8x16
#define jpeg_fdct_6x6 fltk_jpeg_fdct_6x6 #define _jpeg_fdct_8x4 fltk__jpeg_fdct_8x4
#define jpeg_fdct_7x14 fltk_jpeg_fdct_7x14 #define _jpeg_fdct_9x9 fltk__jpeg_fdct_9x9
#define jpeg_fdct_7x7 fltk_jpeg_fdct_7x7 #define _jpeg_fdct_float fltk__jpeg_fdct_float
#define jpeg_fdct_8x16 fltk_jpeg_fdct_8x16 #define _jpeg_fdct_ifast fltk__jpeg_fdct_ifast
#define jpeg_fdct_8x4 fltk_jpeg_fdct_8x4 #define _jpeg_fdct_islow fltk__jpeg_fdct_islow
#define jpeg_fdct_9x9 fltk_jpeg_fdct_9x9 #define _jpeg_finish_compress fltk__jpeg_finish_compress
#define jpeg_fdct_float fltk_jpeg_fdct_float #define _jpeg_finish_decompress fltk__jpeg_finish_decompress
#define jpeg_fdct_ifast fltk_jpeg_fdct_ifast #define _jpeg_finish_output fltk__jpeg_finish_output
#define jpeg_fdct_islow fltk_jpeg_fdct_islow #define _jpeg_free_large fltk__jpeg_free_large
#define jpeg_finish_compress fltk_jpeg_finish_compress #define _jpeg_free_small fltk__jpeg_free_small
#define jpeg_finish_decompress fltk_jpeg_finish_decompress #define _jpeg_get_large fltk__jpeg_get_large
#define jpeg_finish_output fltk_jpeg_finish_output #define _jpeg_get_small fltk__jpeg_get_small
#define jpeg_free_large fltk_jpeg_free_large #define _jpeg_has_multiple_scans fltk__jpeg_has_multiple_scans
#define jpeg_free_small fltk_jpeg_free_small #define _jpeg_idct_10x10 fltk__jpeg_idct_10x10
#define jpeg_get_large fltk_jpeg_get_large #define _jpeg_idct_10x5 fltk__jpeg_idct_10x5
#define jpeg_get_small fltk_jpeg_get_small #define _jpeg_idct_11x11 fltk__jpeg_idct_11x11
#define jpeg_has_multiple_scans fltk_jpeg_has_multiple_scans #define _jpeg_idct_12x12 fltk__jpeg_idct_12x12
#define jpeg_idct_10x10 fltk_jpeg_idct_10x10 #define _jpeg_idct_12x6 fltk__jpeg_idct_12x6
#define jpeg_idct_10x5 fltk_jpeg_idct_10x5 #define _jpeg_idct_13x13 fltk__jpeg_idct_13x13
#define jpeg_idct_11x11 fltk_jpeg_idct_11x11 #define _jpeg_idct_14x14 fltk__jpeg_idct_14x14
#define jpeg_idct_12x12 fltk_jpeg_idct_12x12 #define _jpeg_idct_14x7 fltk__jpeg_idct_14x7
#define jpeg_idct_12x6 fltk_jpeg_idct_12x6 #define _jpeg_idct_15x15 fltk__jpeg_idct_15x15
#define jpeg_idct_13x13 fltk_jpeg_idct_13x13 #define _jpeg_idct_16x16 fltk__jpeg_idct_16x16
#define jpeg_idct_14x14 fltk_jpeg_idct_14x14 #define _jpeg_idct_16x8 fltk__jpeg_idct_16x8
#define jpeg_idct_14x7 fltk_jpeg_idct_14x7 #define _jpeg_idct_1x1 fltk__jpeg_idct_1x1
#define jpeg_idct_15x15 fltk_jpeg_idct_15x15 #define _jpeg_idct_1x2 fltk__jpeg_idct_1x2
#define jpeg_idct_16x16 fltk_jpeg_idct_16x16 #define _jpeg_idct_2x1 fltk__jpeg_idct_2x1
#define jpeg_idct_16x8 fltk_jpeg_idct_16x8 #define _jpeg_idct_2x2 fltk__jpeg_idct_2x2
#define jpeg_idct_1x1 fltk_jpeg_idct_1x1 #define _jpeg_idct_2x4 fltk__jpeg_idct_2x4
#define jpeg_idct_1x2 fltk_jpeg_idct_1x2 #define _jpeg_idct_3x3 fltk__jpeg_idct_3x3
#define jpeg_idct_2x1 fltk_jpeg_idct_2x1 #define _jpeg_idct_3x6 fltk__jpeg_idct_3x6
#define jpeg_idct_2x2 fltk_jpeg_idct_2x2 #define _jpeg_idct_4x2 fltk__jpeg_idct_4x2
#define jpeg_idct_2x4 fltk_jpeg_idct_2x4 #define _jpeg_idct_4x4 fltk__jpeg_idct_4x4
#define jpeg_idct_3x3 fltk_jpeg_idct_3x3 #define _jpeg_idct_4x8 fltk__jpeg_idct_4x8
#define jpeg_idct_3x6 fltk_jpeg_idct_3x6 #define _jpeg_idct_5x10 fltk__jpeg_idct_5x10
#define jpeg_idct_4x2 fltk_jpeg_idct_4x2 #define _jpeg_idct_5x5 fltk__jpeg_idct_5x5
#define jpeg_idct_4x4 fltk_jpeg_idct_4x4 #define _jpeg_idct_6x12 fltk__jpeg_idct_6x12
#define jpeg_idct_4x8 fltk_jpeg_idct_4x8 #define _jpeg_idct_6x3 fltk__jpeg_idct_6x3
#define jpeg_idct_5x10 fltk_jpeg_idct_5x10 #define _jpeg_idct_6x6 fltk__jpeg_idct_6x6
#define jpeg_idct_5x5 fltk_jpeg_idct_5x5 #define _jpeg_idct_7x14 fltk__jpeg_idct_7x14
#define jpeg_idct_6x12 fltk_jpeg_idct_6x12 #define _jpeg_idct_7x7 fltk__jpeg_idct_7x7
#define jpeg_idct_6x3 fltk_jpeg_idct_6x3 #define _jpeg_idct_8x16 fltk__jpeg_idct_8x16
#define jpeg_idct_6x6 fltk_jpeg_idct_6x6 #define _jpeg_idct_8x4 fltk__jpeg_idct_8x4
#define jpeg_idct_7x14 fltk_jpeg_idct_7x14 #define _jpeg_idct_9x9 fltk__jpeg_idct_9x9
#define jpeg_idct_7x7 fltk_jpeg_idct_7x7 #define _jpeg_idct_float fltk__jpeg_idct_float
#define jpeg_idct_8x16 fltk_jpeg_idct_8x16 #define _jpeg_idct_ifast fltk__jpeg_idct_ifast
#define jpeg_idct_8x4 fltk_jpeg_idct_8x4 #define _jpeg_idct_islow fltk__jpeg_idct_islow
#define jpeg_idct_9x9 fltk_jpeg_idct_9x9 #define _jpeg_input_complete fltk__jpeg_input_complete
#define jpeg_idct_float fltk_jpeg_idct_float #define _jpeg_mem_available fltk__jpeg_mem_available
#define jpeg_idct_ifast fltk_jpeg_idct_ifast #define _jpeg_mem_dest fltk__jpeg_mem_dest
#define jpeg_idct_islow fltk_jpeg_idct_islow #define _jpeg_mem_init fltk__jpeg_mem_init
#define jpeg_input_complete fltk_jpeg_input_complete #define _jpeg_mem_src fltk__jpeg_mem_src
#define jpeg_mem_available fltk_jpeg_mem_available #define _jpeg_mem_term fltk__jpeg_mem_term
#define jpeg_mem_dest fltk_jpeg_mem_dest #define _jpeg_natural_order fltk__jpeg_natural_order
#define jpeg_mem_init fltk_jpeg_mem_init #define _jpeg_natural_order2 fltk__jpeg_natural_order2
#define jpeg_mem_src fltk_jpeg_mem_src #define _jpeg_natural_order3 fltk__jpeg_natural_order3
#define jpeg_mem_term fltk_jpeg_mem_term #define _jpeg_natural_order4 fltk__jpeg_natural_order4
#define jpeg_natural_order fltk_jpeg_natural_order #define _jpeg_natural_order5 fltk__jpeg_natural_order5
#define jpeg_natural_order2 fltk_jpeg_natural_order2 #define _jpeg_natural_order6 fltk__jpeg_natural_order6
#define jpeg_natural_order3 fltk_jpeg_natural_order3 #define _jpeg_natural_order7 fltk__jpeg_natural_order7
#define jpeg_natural_order4 fltk_jpeg_natural_order4 #define _jpeg_new_colormap fltk__jpeg_new_colormap
#define jpeg_natural_order5 fltk_jpeg_natural_order5 #define _jpeg_open_backing_store fltk__jpeg_open_backing_store
#define jpeg_natural_order6 fltk_jpeg_natural_order6 #define _jpeg_quality_scaling fltk__jpeg_quality_scaling
#define jpeg_natural_order7 fltk_jpeg_natural_order7 #define _jpeg_read_coefficients fltk__jpeg_read_coefficients
#define jpeg_new_colormap fltk_jpeg_new_colormap #define _jpeg_read_header fltk__jpeg_read_header
#define jpeg_open_backing_store fltk_jpeg_open_backing_store #define _jpeg_read_raw_data fltk__jpeg_read_raw_data
#define jpeg_quality_scaling fltk_jpeg_quality_scaling #define _jpeg_read_scanlines fltk__jpeg_read_scanlines
#define jpeg_read_coefficients fltk_jpeg_read_coefficients #define _jpeg_resync_to_restart fltk__jpeg_resync_to_restart
#define jpeg_read_header fltk_jpeg_read_header #define _jpeg_save_markers fltk__jpeg_save_markers
#define jpeg_read_raw_data fltk_jpeg_read_raw_data #define _jpeg_set_colorspace fltk__jpeg_set_colorspace
#define jpeg_read_scanlines fltk_jpeg_read_scanlines #define _jpeg_set_defaults fltk__jpeg_set_defaults
#define jpeg_resync_to_restart fltk_jpeg_resync_to_restart #define _jpeg_set_linear_quality fltk__jpeg_set_linear_quality
#define jpeg_save_markers fltk_jpeg_save_markers #define _jpeg_set_marker_processor fltk__jpeg_set_marker_processor
#define jpeg_set_colorspace fltk_jpeg_set_colorspace #define _jpeg_set_quality fltk__jpeg_set_quality
#define jpeg_set_defaults fltk_jpeg_set_defaults #define _jpeg_simple_progression fltk__jpeg_simple_progression
#define jpeg_set_linear_quality fltk_jpeg_set_linear_quality #define _jpeg_start_compress fltk__jpeg_start_compress
#define jpeg_set_marker_processor fltk_jpeg_set_marker_processor #define _jpeg_start_decompress fltk__jpeg_start_decompress
#define jpeg_set_quality fltk_jpeg_set_quality #define _jpeg_start_output fltk__jpeg_start_output
#define jpeg_simple_progression fltk_jpeg_simple_progression #define _jpeg_std_error fltk__jpeg_std_error
#define jpeg_start_compress fltk_jpeg_start_compress #define _jpeg_std_huff_table fltk__jpeg_std_huff_table
#define jpeg_start_decompress fltk_jpeg_start_decompress #define _jpeg_std_message_table fltk__jpeg_std_message_table
#define jpeg_start_output fltk_jpeg_start_output #define _jpeg_stdio_dest fltk__jpeg_stdio_dest
#define jpeg_std_error fltk_jpeg_std_error #define _jpeg_stdio_src fltk__jpeg_stdio_src
#define jpeg_std_huff_table fltk_jpeg_std_huff_table #define _jpeg_suppress_tables fltk__jpeg_suppress_tables
#define jpeg_stdio_dest fltk_jpeg_stdio_dest #define _jpeg_write_coefficients fltk__jpeg_write_coefficients
#define jpeg_stdio_src fltk_jpeg_stdio_src #define _jpeg_write_m_byte fltk__jpeg_write_m_byte
#define jpeg_std_message_table fltk_jpeg_std_message_table #define _jpeg_write_m_header fltk__jpeg_write_m_header
#define jpeg_suppress_tables fltk_jpeg_suppress_tables #define _jpeg_write_marker fltk__jpeg_write_marker
#define jpeg_write_coefficients fltk_jpeg_write_coefficients #define _jpeg_write_raw_data fltk__jpeg_write_raw_data
#define jpeg_write_marker fltk_jpeg_write_marker #define _jpeg_write_scanlines fltk__jpeg_write_scanlines
#define jpeg_write_m_byte fltk_jpeg_write_m_byte #define _jpeg_write_tables fltk__jpeg_write_tables
#define jpeg_write_m_header fltk_jpeg_write_m_header #define _jround_up fltk__jround_up
#define jpeg_write_raw_data fltk_jpeg_write_raw_data
#define jpeg_write_scanlines fltk_jpeg_write_scanlines
#define jpeg_write_tables fltk_jpeg_write_tables
#define jround_up fltk_jround_up

View File

@ -1,6 +1,6 @@
INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software
Copyright (C) 1991-2021, Thomas G. Lane, Guido Vollbeding. Copyright (C) 1991-2023, Thomas G. Lane, Guido Vollbeding.
This file is part of the Independent JPEG Group's software. This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file. For conditions of distribution and use, see the accompanying README file.
@ -142,7 +142,8 @@ Makefile jconfig file System and/or compiler
makefile.manx jconfig.manx Amiga, Manx Aztec C makefile.manx jconfig.manx Amiga, Manx Aztec C
makefile.sas jconfig.sas Amiga, SAS C makefile.sas jconfig.sas Amiga, SAS C
makeproj.mac jconfig.mac Apple Macintosh, Metrowerks CodeWarrior makeproj.mac jconfig.mac Apple Macintosh, Metrowerks CodeWarrior
mak*jpeg.st jconfig.st Atari ST/STE/TT, Pure C or Turbo C makefile.xc jconfig.xc Apple Mac, Xcode 15
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.bcc jconfig.bcc MS-DOS or OS/2, Borland C
makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C) makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C)
makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only) makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C (16-bit only)
@ -150,12 +151,15 @@ makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C
makefile.vc jconfig.vc Windows, MS Visual C++ makefile.vc jconfig.vc Windows, MS Visual C++
makefile.vs jconfig.vc Windows, MS Visual C++ 6 Developer Studio makefile.vs jconfig.vc Windows, MS Visual C++ 6 Developer Studio
make*.vc6 make*.vc6
makefile.vs jconfig.vc Windows, Visual Studio 2019 Version 16 makefile.vs jconfig.vc Windows, Visual Studio 2019-2022 version 16-17
make*.v16 make*.v16
makefile.vs jconfig.vc Windows, Visual Studio 2022 Version 17 makefile.b32 jconfig.vc Windows, C++Builder/RAD Studio 10.4-11
make*.v16 mak*jpeg.bcb
make*.v17 makefile.b32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32)
makefile.b32 jconfig.vc Windows, Borland C++ 32-bit (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.mms jconfig.vms Digital VMS, with MMS software makefile.mms jconfig.vms Digital VMS, with MMS software
makefile.vms jconfig.vms Digital VMS, without MMS software makefile.vms jconfig.vms Digital VMS, without MMS software
@ -545,8 +549,8 @@ In general, it's worth trying the maximum optimization level of your compiler,
and experimenting with any optional optimizations such as loop unrolling. and experimenting with any optional optimizations such as loop unrolling.
(Unfortunately, far too many compilers have optimizer bugs ... be prepared to (Unfortunately, far too many compilers have optimizer bugs ... be prepared to
back off if the code fails self-test.) If you do any experimentation along back off if the code fails self-test.) If you do any experimentation along
these lines, please report the optimal settings to jpeg-info@jpegclub.org so these lines, please report the optimal settings to jpeg-info@ijg.org so we
we can mention them in future releases. Be sure to specify your machine and can mention them in future releases. Be sure to specify your machine and
compiler version. compiler version.
@ -554,8 +558,8 @@ HINTS FOR SPECIFIC SYSTEMS
========================== ==========================
We welcome reports on changes needed for systems not mentioned here. Submit We welcome reports on changes needed for systems not mentioned here. Submit
'em to jpeg-info@jpegclub.org. Also, if configure or ckconfig.c is wrong 'em to jpeg-info@ijg.org. Also, if configure or ckconfig.c is wrong about
about how to configure the JPEG software for your system, please let us know. how to configure the JPEG software for your system, please let us know.
Acorn RISC OS: Acorn RISC OS:
@ -593,7 +597,7 @@ manager, with temporary files being created on the device named by
"JPEGTMP:". "JPEGTMP:".
Atari ST/STE/TT: Atari ST/Mega/STE/TT/Falcon:
Copy the project files makcjpeg.st, makdjpeg.st, maktjpeg.st, and makljpeg.st Copy the project files makcjpeg.st, makdjpeg.st, maktjpeg.st, and makljpeg.st
to cjpeg.prj, djpeg.prj, jpegtran.prj, and libjpeg.prj respectively. The to cjpeg.prj, djpeg.prj, jpegtran.prj, and libjpeg.prj respectively. The
@ -1045,8 +1049,8 @@ To use:
(Note that the renaming is critical!) (Note that the renaming is critical!)
Alternatively you can use Alternatively you can use
nmake /f makefile.vs setupcopy-vc6 nmake /f makefile.vs setupcopy-vc6
This will create renamed copies of the files, which allows to repeat This will create renamed copies of the files,
the setup later. which allows to repeat the setup later.
2. Open the workspace file jpeg.dsw, build the library project. 2. Open the workspace file jpeg.dsw, build the library project.
(If you are using Developer Studio more recent than 6.0, you'll (If you are using Developer Studio more recent than 6.0, you'll
probably get a message saying that the project files are being updated.) probably get a message saying that the project files are being updated.)
@ -1057,108 +1061,100 @@ To use:
appropriate location on your path. appropriate location on your path.
Microsoft Windows, Visual Studio 2019 Version 16: Microsoft Windows, Microsoft Visual Studio 2019-2022 version 16-17:
We include makefiles that should work as project files in Visual Studio We include makefiles that should work as project files in Visual Studio
2019 Version 16 or later. There is a library makefile that builds the 2019-2022 version 16-17 or later. There is a library makefile that
IJG library as a static Win32/x64/ARM/ARM64 library, and application builds the IJG library as a static Win32/x64/ARM/ARM64/ARM64EC library,
makefiles that build the sample applications as Win32/x64/ARM/ARM64 and application makefiles that build the sample applications as
console applications. (Even if you only want the library, we recommend Win32/x64/ARM/ARM64/ARM64EC console applications. (Even if you
building the applications so that you can run the self-test.) only want the library, we recommend building the applications
so that you can run the self-test.)
To use: To use:
1. Ensure youve checked the item "Desktop development with C++" in the 1. Ensure youve checked the item "Desktop development with C++" in the
Workloads tab of Visual Studio Installer. Workloads tab of Visual Studio Installer.
Open the Developer Command Prompt for VS 2019, change to the source Open the Developer Command Prompt for VS 2019-2022, change to the
directory and execute the command line source directory and execute the command line
nmake /f makefile.vs setup-v16 nmake /f makefile.vs setup-v16
This will move jconfig.vc to jconfig.h and makefiles to project files. This will move jconfig.vc to jconfig.h and makefiles to project files.
(Note that the renaming is critical!) (Note that the renaming is critical!)
Alternatively you can use Alternatively you can use
nmake /f makefile.vs setupcopy-v16 nmake /f makefile.vs setupcopy-v16
This will create renamed copies of the files, which allows to repeat This will create renamed copies of the files,
the setup later. which allows to repeat the setup later.
2. Open the solution file jpeg.sln, build the library project. 2. Open the solution file jpeg.sln, build the library project.
a) If you are using Visual Studio more recent than a) If you are using Visual Studio more recent than
2019 Version 16, you'll probably get a message 2022 version 17, you'll possibly get a message
saying that the project files are being updated. saying that the project files are being updated.
b) If necessary, open the project properties and b) If necessary, open the project properties and adapt the
adapt the Windows Target Platform Version in Windows Target Platform Version (or Windows SDK Version)
the Configuration Properties, General section; in the Configuration Properties, General section.
we support the latest version at the time of release.
c) If you get a warning saying that a platform cannot be found, c) If you get a warning saying that a platform cannot be found,
you can either you can either
* forgo the platform and ignore the warning, or * forgo the platform and ignore the warning, or
* remove the platform in the Configuration Manager, or * remove the platform in the Configuration Manager, or
* install the corresponding platform Buildtools in * install the corresponding platform build tools in
Visual Studio Installer (Workloads tab Optional components Visual Studio Installer (Workloads tab Optional components
or Individual components tab). or Individual components tab).
d) If you want to build x64 code, change the platform setting from 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. Win32 to x64. You can build Win32 and x64 versions side by side.
e) If you want to build ARM/ARM64 code, change the platform setting e) If you want to build ARM/ARM64/ARM64EC code, change the platform
to ARM/ARM64. Ensure you've installed the ARM/ARM64-Buildtools setting to ARM/ARM64/ARM64EC. Ensure youve installed the
in Visual Studio Installer (Workloads tab Optional components ARM/ARM64/ARM64EC build tools in Visual Studio Installer
or Individual components tab). (Workloads tab Optional components or Individual components tab).
You can build Win32/x64/ARM/ARM64 versions side by side. You can build Win32/x64/ARM/ARM64/ARM64EC versions side by side.
3. Open the solution file apps.sln, build the application projects. 3. Open the solution file apps.sln, build the application projects.
4. To perform the self-test, execute the command line 4. To perform the self-test, execute the command line
nmake /f makefile.vs test-32 nmake /f makefile.vs test-32
for the Win32 build, or on a 64-bit system for the Win32 build, or on a 64-bit system
nmake /f makefile.vs test-64 nmake /f makefile.vs test-64
for the x64 build. 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.
5. Move the application .exe files from the Release folder to an 5. Move the application .exe files from the Release folder to an
appropriate location on your path. appropriate location on your path.
Microsoft Windows, Visual Studio 2022 Version 17: Microsoft Windows, Embarcadero C++Builder/RAD Studio 10.4-11:
We include makefiles that should work as project files in Visual Studio We include makefiles that should work as project files in C++Builder/RAD
2022 Version 17 or later. There is a library makefile that builds the Studio 10.4-11 or later. There is a library makefile that builds the
IJG library as a static Win32/x64/ARM/ARM64 library, and application IJG library as a static Win32/Win64 library, and application makefiles
makefiles that build the sample applications as Win32/x64/ARM/ARM64 that build the sample applications as Win32/Win64 console applications.
console applications. (Even if you only want the library, we recommend (Even if you only want the library, we recommend building the
building the applications so that you can run the self-test.) applications so that you can run the self-test.)
To use: To use:
1. Ensure youve checked the item "Desktop development with C++" in the 1. Open the RAD Studio Command Prompt (or the standard Windows Command
Workloads tab of Visual Studio Installer. Prompt, since the environment is set system-wide during RAD Studio
Open the Developer Command Prompt for VS 2022, change to the source installation), change to the source directory and execute the command
directory and execute the command line line
nmake /f makefile.vs setup-v17 make -fmakefile.b32 setup-cb
This will move jconfig.vc to jconfig.h and makefiles to project files. This will move jconfig.vc to jconfig.h and makefiles to project files.
(Note that the renaming is critical!) (Note that the renaming is critical!)
Alternatively you can use Alternatively you can use
nmake /f makefile.vs setupcopy-v17 make -fmakefile.b32 setupcopy-cb
This will create renamed copies of the files, which allows to repeat This will create renamed copies of the files,
the setup later. which allows to repeat the setup later.
2. Open the solution file jpeg.sln, build the library project. (You can use one of the other makefiles .c32,
a) If you are using Visual Studio more recent than .d32, .x32, or .b64 instead of .b32.)
2022 Version 17, you'll probably get a message 2. Open the project file jpeg.cbproj, build the library project.
saying that the project files are being updated. a) By default, the classic Borland compiler (bcc32) is used for
b) If necessary, open the project properties and the Win32 build. To enable the Clang-based compiler for a
adapt the Windows Target Platform Version in specific project, select Project > Options > C++ Compiler
the Configuration Properties, General section; and deselect the Use classic Borland compiler option.
we support the latest version at the time of release. b) If you want to build Win64 code, change the platform setting
c) If you get a warning saying that a platform cannot be found, from Windows 32 Bit to Windows 64 Bit.
you can either You can build Win32 and Win64 versions side by side.
* forgo the platform and ignore the warning, or 3. Open the project group file apps.groupproj,
* remove the platform in the Configuration Manager, or build the application projects.
* install the corresponding platform Buildtools in
Visual Studio Installer (Workloads tab Optional components
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 code, change the platform setting
to ARM/ARM64. Ensure you've installed the ARM/ARM64-Buildtools
in Visual Studio Installer (Workloads tab Optional components
or Individual components tab).
You can build Win32/x64/ARM/ARM64 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 4. To perform the self-test, execute the command line
nmake /f makefile.vs test-32 make -fmakefile.b32 test-32
for the Win32 build, or on a 64-bit system for the Win32 build, or on a 64-bit system
nmake /f makefile.vs test-64 make -fmakefile.b32 test-64
for the x64 build. for the Win64 build.
5. Move the application .exe files from the Release folder to an 5. Move the application .exe files from the Release folder to an
appropriate location on your path. appropriate location on your path.

View File

@ -2,7 +2,7 @@
* jccoefct.c * jccoefct.c
* *
* Copyright (C) 1994-1997, Thomas G. Lane. * Copyright (C) 1994-1997, Thomas G. Lane.
* Modified 2003-2020 by Guido Vollbeding. * Modified 2003-2022 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -41,9 +41,9 @@ typedef struct {
int MCU_rows_per_iMCU_row; /* number of such rows needed */ int MCU_rows_per_iMCU_row; /* number of such rows needed */
/* For single-pass compression, it's sufficient to buffer just one MCU /* For single-pass compression, it's sufficient to buffer just one MCU
* (although this may prove a bit slow in practice). We append a * (although this may prove a bit slow in practice).
* workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it * We append a workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks,
* for each MCU constructed and sent. * and reuse it for each MCU constructed and sent.
* In multi-pass modes, this array points to the current MCU's blocks * In multi-pass modes, this array points to the current MCU's blocks
* within the virtual arrays. * within the virtual arrays.
*/ */

View File

@ -2,7 +2,7 @@
* jccolor.c * jccolor.c
* *
* Copyright (C) 1991-1996, Thomas G. Lane. * Copyright (C) 1991-1996, Thomas G. Lane.
* Modified 2011-2019 by Guido Vollbeding. * Modified 2011-2023 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -40,10 +40,10 @@ typedef my_color_converter * my_cconvert_ptr;
* Note that the derived conversion coefficients given in some of these * Note that the derived conversion coefficients given in some of these
* documents are imprecise. The general conversion equations are * documents are imprecise. The general conversion equations are
* Y = Kr * R + (1 - Kr - Kb) * G + Kb * B * Y = Kr * R + (1 - Kr - Kb) * G + Kb * B
* Cb = 0.5 * (B - Y) / (1 - Kb) * Cb = (B - Y) / (1 - Kb) / K
* Cr = 0.5 * (R - Y) / (1 - Kr) * Cr = (R - Y) / (1 - Kr) / K
* With Kr = 0.299 and Kb = 0.114 (derived according to SMPTE RP 177-1993 * With Kr = 0.299 and Kb = 0.114 (derived according to SMPTE RP 177-1993
* from the 1953 FCC NTSC primaries and CIE Illuminant C), * from the 1953 FCC NTSC primaries and CIE Illuminant C), K = 2 for sYCC,
* the conversion equations to be implemented are therefore * the conversion equations to be implemented are therefore
* Y = 0.299 * R + 0.587 * G + 0.114 * B * Y = 0.299 * R + 0.587 * G + 0.114 * B
* Cb = -0.168735892 * R - 0.331264108 * G + 0.5 * B + CENTERJSAMPLE * Cb = -0.168735892 * R - 0.331264108 * G + 0.5 * B + CENTERJSAMPLE
@ -62,8 +62,8 @@ typedef my_color_converter * my_cconvert_ptr;
* by precalculating the constants times R,G,B for all possible values. * by precalculating the constants times R,G,B for all possible values.
* For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
* for 9-bit to 12-bit samples it is still acceptable. It's not very * for 9-bit to 12-bit samples it is still acceptable. It's not very
* reasonable for 16-bit samples, but if you want lossless storage you * reasonable for 16-bit samples, but if you want lossless storage
* shouldn't be changing colorspace anyway. * you shouldn't be changing colorspace anyway.
* The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included
* in the tables to save adding them separately in the inner loop. * in the tables to save adding them separately in the inner loop.
*/ */
@ -110,16 +110,16 @@ rgb_ycc_start (j_compress_ptr cinfo)
for (i = 0; i <= MAXJSAMPLE; i++) { for (i = 0; i <= MAXJSAMPLE; i++) {
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.299) * i; rgb_ycc_tab[i+R_Y_OFF] = FIX(0.299) * i;
rgb_ycc_tab[i+G_Y_OFF] = FIX(0.587) * i; rgb_ycc_tab[i+G_Y_OFF] = FIX(0.587) * i;
rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF; rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
rgb_ycc_tab[i+R_CB_OFF] = (- FIX(0.168735892)) * i; rgb_ycc_tab[i+R_CB_OFF] = (- FIX(0.168735892)) * i;
rgb_ycc_tab[i+G_CB_OFF] = (- FIX(0.331264108)) * i; rgb_ycc_tab[i+G_CB_OFF] = (- FIX(0.331264108)) * i;
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr. /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
* This ensures that the maximum output will round to MAXJSAMPLE * This ensures that the maximum output will round to MAXJSAMPLE
* not MAXJSAMPLE+1, and thus that we don't have to range-limit. * not MAXJSAMPLE+1, and thus that we don't have to range-limit.
*/ */
rgb_ycc_tab[i+B_CB_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1; rgb_ycc_tab[i+B_CB_OFF] = (i << (SCALEBITS-1)) + CBCR_OFFSET + ONE_HALF-1;
/* B=>Cb and R=>Cr tables are the same /* B=>Cb and R=>Cr tables are the same
rgb_ycc_tab[i+R_CR_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1; rgb_ycc_tab[i+R_CR_OFF] = (i << (SCALEBITS-1)) + CBCR_OFFSET + ONE_HALF-1;
*/ */
rgb_ycc_tab[i+G_CR_OFF] = (- FIX(0.418687589)) * i; rgb_ycc_tab[i+G_CR_OFF] = (- FIX(0.418687589)) * i;
rgb_ycc_tab[i+B_CR_OFF] = (- FIX(0.081312411)) * i; rgb_ycc_tab[i+B_CR_OFF] = (- FIX(0.081312411)) * i;
@ -190,8 +190,8 @@ rgb_ycc_convert (j_compress_ptr cinfo,
/* /*
* Convert some rows of samples to the JPEG colorspace. * Convert some rows of samples to the JPEG colorspace.
* This version handles RGB->grayscale conversion, which is the same * This version handles RGB->grayscale conversion,
* as the RGB->Y portion of RGB->YCbCr. * which is the same as the RGB->Y portion of RGB->YCbCr.
* We assume rgb_ycc_start has been called (we only use the Y tables). * We assume rgb_ycc_start has been called (we only use the Y tables).
*/ */
@ -201,7 +201,7 @@ rgb_gray_convert (j_compress_ptr cinfo,
JDIMENSION output_row, int num_rows) JDIMENSION output_row, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register int r, g, b; register INT32 y;
register INT32 * ctab = cconvert->rgb_ycc_tab; register INT32 * ctab = cconvert->rgb_ycc_tab;
register JSAMPROW inptr; register JSAMPROW inptr;
register JSAMPROW outptr; register JSAMPROW outptr;
@ -212,14 +212,11 @@ rgb_gray_convert (j_compress_ptr cinfo,
inptr = *input_buf++; inptr = *input_buf++;
outptr = output_buf[0][output_row++]; outptr = output_buf[0][output_row++];
for (col = 0; col < num_cols; col++) { for (col = 0; col < num_cols; col++) {
r = GETJSAMPLE(inptr[RGB_RED]); y = ctab[R_Y_OFF + GETJSAMPLE(inptr[RGB_RED])];
g = GETJSAMPLE(inptr[RGB_GREEN]); y += ctab[G_Y_OFF + GETJSAMPLE(inptr[RGB_GREEN])];
b = GETJSAMPLE(inptr[RGB_BLUE]); y += ctab[B_Y_OFF + GETJSAMPLE(inptr[RGB_BLUE])];
inptr += RGB_PIXELSIZE; inptr += RGB_PIXELSIZE;
/* Y */ outptr[col] = (JSAMPLE) (y >> SCALEBITS);
outptr[col] = (JSAMPLE)
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
} }
} }
} }

View File

@ -2,7 +2,7 @@
* jchuff.c * jchuff.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2006-2020 by Guido Vollbeding. * Modified 2006-2023 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -26,17 +26,11 @@
/* The legal range of a DCT coefficient is /* The legal range of a DCT coefficient is
* -1024 .. +1023 for 8-bit data; * -1024 .. +1023 for 8-bit sample data precision;
* -16384 .. +16383 for 12-bit data. * -16384 .. +16383 for 12-bit sample data precision.
* Hence the magnitude should always fit in 10 or 14 bits respectively. * Hence the magnitude should always fit in sample data precision + 2 bits.
*/ */
#if BITS_IN_JSAMPLE == 8
#define MAX_COEF_BITS 10
#else
#define MAX_COEF_BITS 14
#endif
/* Derived data constructed for each Huffman table */ /* Derived data constructed for each Huffman table */
typedef struct { typedef struct {
@ -547,6 +541,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
register int temp, temp2; register int temp, temp2;
register int nbits; register int nbits;
int max_coef_bits;
int blkn, ci, tbl; int blkn, ci, tbl;
ISHIFT_TEMPS ISHIFT_TEMPS
@ -558,6 +553,9 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
if (entropy->restarts_to_go == 0) if (entropy->restarts_to_go == 0)
emit_restart_e(entropy, entropy->next_restart_num); emit_restart_e(entropy, entropy->next_restart_num);
/* Since we're encoding a difference, the range limit is twice as much. */
max_coef_bits = cinfo->data_precision + 3;
/* Encode the MCU data blocks */ /* Encode the MCU data blocks */
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
ci = cinfo->MCU_membership[blkn]; ci = cinfo->MCU_membership[blkn];
@ -569,12 +567,17 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
temp = IRIGHT_SHIFT((int) (MCU_data[blkn][0][0]), cinfo->Al); temp = IRIGHT_SHIFT((int) (MCU_data[blkn][0][0]), cinfo->Al);
/* DC differences are figured on the point-transformed values. */ /* DC differences are figured on the point-transformed values. */
temp2 = temp - entropy->saved.last_dc_val[ci]; if ((temp2 = temp - entropy->saved.last_dc_val[ci]) == 0) {
/* Count/emit the Huffman-coded symbol for the number of bits */
emit_dc_symbol(entropy, tbl, 0);
continue;
}
entropy->saved.last_dc_val[ci] = temp; entropy->saved.last_dc_val[ci] = temp;
/* Encode the DC coefficient difference per section G.1.2.1 */ /* Encode the DC coefficient difference per section G.1.2.1 */
temp = temp2; if ((temp = temp2) < 0) {
if (temp < 0) {
temp = -temp; /* temp is abs value of input */ temp = -temp; /* temp is abs value of input */
/* For a negative input, want temp2 = bitwise complement of abs(input) */ /* For a negative input, want temp2 = bitwise complement of abs(input) */
/* This code assumes we are on a two's complement machine */ /* This code assumes we are on a two's complement machine */
@ -583,14 +586,10 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0; nbits = 0;
while (temp) { do nbits++; /* there must be at least one 1 bit */
nbits++; while ((temp >>= 1));
temp >>= 1; /* Check for out-of-range coefficient values */
} if (nbits > max_coef_bits)
/* Check for out-of-range coefficient values.
* Since we're encoding a difference, the range limit is twice as much.
*/
if (nbits > MAX_COEF_BITS+1)
ERREXIT(cinfo, JERR_BAD_DCT_COEF); ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit the Huffman-coded symbol for the number of bits */ /* Count/emit the Huffman-coded symbol for the number of bits */
@ -598,8 +597,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
/* Emit that number of bits of the value, if positive, */ /* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */ /* or the complement of its magnitude, if negative. */
if (nbits) /* emit_bits rejects calls with size 0 */ emit_bits_e(entropy, (unsigned int) temp2, nbits);
emit_bits_e(entropy, (unsigned int) temp2, nbits);
} }
cinfo->dest->next_output_byte = entropy->next_output_byte; cinfo->dest->next_output_byte = entropy->next_output_byte;
@ -633,7 +631,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
register int temp, temp2; register int temp, temp2;
register int nbits; register int nbits;
register int r, k; register int r, k;
int Se, Al; int Se, Al, max_coef_bits;
entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer; entropy->free_in_buffer = cinfo->dest->free_in_buffer;
@ -646,6 +644,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
Se = cinfo->Se; Se = cinfo->Se;
Al = cinfo->Al; Al = cinfo->Al;
natural_order = cinfo->natural_order; natural_order = cinfo->natural_order;
max_coef_bits = cinfo->data_precision + 2;
/* Encode the MCU data block */ /* Encode the MCU data block */
block = MCU_data[0]; block = MCU_data[0];
@ -666,18 +665,23 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
*/ */
if (temp < 0) { if (temp < 0) {
temp = -temp; /* temp is abs value of input */ temp = -temp; /* temp is abs value of input */
temp >>= Al; /* apply the point transform */ /* Apply the point transform, and watch out for case */
/* that nonzero coef is zero after point transform. */
if ((temp >>= Al) == 0) {
r++;
continue;
}
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */ /* For a negative coef, want temp2 = bitwise complement of abs(coef) */
temp2 = ~temp; temp2 = ~temp;
} else { } else {
temp >>= Al; /* apply the point transform */ /* Apply the point transform, and watch out for case */
/* that nonzero coef is zero after point transform. */
if ((temp >>= Al) == 0) {
r++;
continue;
}
temp2 = temp; temp2 = temp;
} }
/* Watch out for case that nonzero coef is zero after point transform */
if (temp == 0) {
r++;
continue;
}
/* Emit any pending EOBRUN */ /* Emit any pending EOBRUN */
if (entropy->EOBRUN > 0) if (entropy->EOBRUN > 0)
@ -689,11 +693,11 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
} }
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */ nbits = 0;
while ((temp >>= 1)) do nbits++; /* there must be at least one 1 bit */
nbits++; while ((temp >>= 1));
/* Check for out-of-range coefficient values */ /* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS) if (nbits > max_coef_bits)
ERREXIT(cinfo, JERR_BAD_DCT_COEF); ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit Huffman symbol for run length / number of bits */ /* Count/emit Huffman symbol for run length / number of bits */
@ -916,83 +920,89 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
register int nbits; register int nbits;
register int r, k; register int r, k;
int Se = state->cinfo->lim_Se; int Se = state->cinfo->lim_Se;
int max_coef_bits = state->cinfo->data_precision + 3;
const int * natural_order = state->cinfo->natural_order; const int * natural_order = state->cinfo->natural_order;
/* Encode the DC coefficient difference per section F.1.2.1 */ /* Encode the DC coefficient difference per section F.1.2.1 */
temp = temp2 = block[0] - last_dc_val; if ((temp = block[0] - last_dc_val) == 0) {
/* Emit the Huffman-coded symbol for the number of bits */
if (! emit_bits_s(state, dctbl->ehufco[0], dctbl->ehufsi[0]))
return FALSE;
} else {
if ((temp2 = temp) < 0) {
temp = -temp; /* temp is abs value of input */
/* For a negative input, want temp2 = bitwise complement of abs(input) */
/* This code assumes we are on a two's complement machine */
temp2--;
}
if (temp < 0) { /* Find the number of bits needed for the magnitude of the coefficient */
temp = -temp; /* temp is abs value of input */ nbits = 0;
/* For a negative input, want temp2 = bitwise complement of abs(input) */ do nbits++; /* there must be at least one 1 bit */
/* This code assumes we are on a two's complement machine */ while ((temp >>= 1));
temp2--; /* Check for out-of-range coefficient values.
} * Since we're encoding a difference, the range limit is twice as much.
*/
if (nbits > max_coef_bits)
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Find the number of bits needed for the magnitude of the coefficient */ /* Emit the Huffman-coded symbol for the number of bits */
nbits = 0; if (! emit_bits_s(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
while (temp) { return FALSE;
nbits++;
temp >>= 1;
}
/* Check for out-of-range coefficient values.
* Since we're encoding a difference, the range limit is twice as much.
*/
if (nbits > MAX_COEF_BITS+1)
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Emit the Huffman-coded symbol for the number of bits */ /* Emit that number of bits of the value, if positive, */
if (! emit_bits_s(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) /* or the complement of its magnitude, if negative. */
return FALSE;
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
if (nbits) /* emit_bits rejects calls with size 0 */
if (! emit_bits_s(state, (unsigned int) temp2, nbits)) if (! emit_bits_s(state, (unsigned int) temp2, nbits))
return FALSE; return FALSE;
}
/* Encode the AC coefficients per section F.1.2.2 */ /* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */ r = 0; /* r = run length of zeros */
for (k = 1; k <= Se; k++) { for (k = 1; k <= Se; k++) {
if ((temp2 = block[natural_order[k]]) == 0) { if ((temp = block[natural_order[k]]) == 0) {
r++; r++;
} else { continue;
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
while (r > 15) {
if (! emit_bits_s(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0]))
return FALSE;
r -= 16;
}
temp = temp2;
if (temp < 0) {
temp = -temp; /* temp is abs value of input */
/* This code assumes we are on a two's complement machine */
temp2--;
}
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */
while ((temp >>= 1))
nbits++;
/* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS)
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Emit Huffman symbol for run length / number of bits */
temp = (r << 4) + nbits;
if (! emit_bits_s(state, actbl->ehufco[temp], actbl->ehufsi[temp]))
return FALSE;
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
if (! emit_bits_s(state, (unsigned int) temp2, nbits))
return FALSE;
r = 0;
} }
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
while (r > 15) {
if (! emit_bits_s(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0]))
return FALSE;
r -= 16;
}
if ((temp2 = temp) < 0) {
temp = -temp; /* temp is abs value of input */
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */
/* This code assumes we are on a two's complement machine */
temp2--;
}
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0;
do nbits++; /* there must be at least one 1 bit */
while ((temp >>= 1));
/* Check for out-of-range coefficient values.
* Use ">=" instead of ">" so can use the
* same one larger limit from DC check here.
*/
if (nbits >= max_coef_bits)
ERREXIT(state->cinfo, JERR_BAD_DCT_COEF);
/* Emit Huffman symbol for run length / number of bits */
temp = (r << 4) + nbits;
if (! emit_bits_s(state, actbl->ehufco[temp], actbl->ehufsi[temp]))
return FALSE;
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
if (! emit_bits_s(state, (unsigned int) temp2, nbits))
return FALSE;
r = 0; /* reset zero run length */
} }
/* If the last coef(s) were zero, emit an end-of-block code */ /* If the last coef(s) were zero, emit an end-of-block code */
@ -1122,28 +1132,31 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
register int nbits; register int nbits;
register int r, k; register int r, k;
int Se = cinfo->lim_Se; int Se = cinfo->lim_Se;
int max_coef_bits = cinfo->data_precision + 3;
const int * natural_order = cinfo->natural_order; const int * natural_order = cinfo->natural_order;
/* Encode the DC coefficient difference per section F.1.2.1 */ /* Encode the DC coefficient difference per section F.1.2.1 */
temp = block[0] - last_dc_val; if ((temp = block[0] - last_dc_val) == 0) {
if (temp < 0) /* Count the Huffman symbol for the number of bits */
temp = -temp; dc_counts[0]++;
} else {
if (temp < 0)
temp = -temp; /* temp is abs value of input */
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0; nbits = 0;
while (temp) { do nbits++; /* there must be at least one 1 bit */
nbits++; while ((temp >>= 1));
temp >>= 1; /* Check for out-of-range coefficient values.
* Since we're encoding a difference, the range limit is twice as much.
*/
if (nbits > max_coef_bits)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count the Huffman symbol for the number of bits */
dc_counts[nbits]++;
} }
/* Check for out-of-range coefficient values.
* Since we're encoding a difference, the range limit is twice as much.
*/
if (nbits > MAX_COEF_BITS+1)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count the Huffman symbol for the number of bits */
dc_counts[nbits]++;
/* Encode the AC coefficients per section F.1.2.2 */ /* Encode the AC coefficients per section F.1.2.2 */
@ -1152,30 +1165,33 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
for (k = 1; k <= Se; k++) { for (k = 1; k <= Se; k++) {
if ((temp = block[natural_order[k]]) == 0) { if ((temp = block[natural_order[k]]) == 0) {
r++; r++;
} else { continue;
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
while (r > 15) {
ac_counts[0xF0]++;
r -= 16;
}
/* Find the number of bits needed for the magnitude of the coefficient */
if (temp < 0)
temp = -temp;
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */
while ((temp >>= 1))
nbits++;
/* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count Huffman symbol for run length / number of bits */
ac_counts[(r << 4) + nbits]++;
r = 0;
} }
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
while (r > 15) {
ac_counts[0xF0]++;
r -= 16;
}
if (temp < 0)
temp = -temp; /* temp is abs value of input */
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0;
do nbits++; /* there must be at least one 1 bit */
while ((temp >>= 1));
/* Check for out-of-range coefficient values.
* Use ">=" instead of ">" so can use the
* same one larger limit from DC check here.
*/
if (nbits >= max_coef_bits)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count Huffman symbol for run length / number of bits */
ac_counts[(r << 4) + nbits]++;
r = 0; /* reset zero run length */
} }
/* If the last coef(s) were zero, emit an end-of-block code */ /* If the last coef(s) were zero, emit an end-of-block code */

View File

@ -2,7 +2,7 @@
* jdatadst.c * jdatadst.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2009-2019 by Guido Vollbeding. * Modified 2009-2022 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -28,17 +28,17 @@ extern void free JPP((void *ptr));
/* Expanded data destination object for stdio output */ /* Expanded data destination object for stdio output */
#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
typedef struct { typedef struct {
struct jpeg_destination_mgr pub; /* public fields */ struct jpeg_destination_mgr pub; /* public fields */
FILE * outfile; /* target stream */ FILE * outfile; /* target stream */
JOCTET * buffer; /* start of buffer */ JOCTET buffer[OUTPUT_BUF_SIZE]; /* output buffer */
} my_destination_mgr; } my_destination_mgr;
typedef my_destination_mgr * my_dest_ptr; typedef my_destination_mgr * my_dest_ptr;
#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
/* Expanded data destination object for memory output */ /* Expanded data destination object for memory output */
@ -65,10 +65,6 @@ init_destination (j_compress_ptr cinfo)
{ {
my_dest_ptr dest = (my_dest_ptr) cinfo->dest; my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
/* Allocate the output buffer --- it will be released when done with image */
dest->buffer = (JOCTET *) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_IMAGE, OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
dest->pub.next_output_byte = dest->buffer; dest->pub.next_output_byte = dest->buffer;
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
} }
@ -187,8 +183,8 @@ term_mem_destination (j_compress_ptr cinfo)
/* /*
* Prepare for output to a stdio stream. * Prepare for output to a stdio stream.
* The caller must have already opened the stream, and is responsible * The caller must have already opened the stream,
* for closing it after finishing compression. * and is responsible for closing it after finishing compression.
*/ */
GLOBAL(void) GLOBAL(void)

View File

@ -2,7 +2,7 @@
* jdatasrc.c * jdatasrc.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2009-2019 by Guido Vollbeding. * Modified 2009-2022 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -23,18 +23,18 @@
/* Expanded data source object for stdio input */ /* Expanded data source object for stdio input */
#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */
typedef struct { typedef struct {
struct jpeg_source_mgr pub; /* public fields */ struct jpeg_source_mgr pub; /* public fields */
FILE * infile; /* source stream */ FILE * infile; /* source stream */
JOCTET * buffer; /* start of buffer */ JOCTET buffer[INPUT_BUF_SIZE]; /* input buffer */
boolean start_of_file; /* have we gotten any data yet? */ boolean start_of_file; /* have we gotten any data yet? */
} my_source_mgr; } my_source_mgr;
typedef my_source_mgr * my_src_ptr; typedef my_source_mgr * my_src_ptr;
#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */
/* /*
* Initialize source --- called by jpeg_read_header * Initialize source --- called by jpeg_read_header
@ -204,8 +204,8 @@ term_source (j_decompress_ptr cinfo)
/* /*
* Prepare for input from a stdio stream. * Prepare for input from a stdio stream.
* The caller must have already opened the stream, and is responsible * The caller must have already opened the stream,
* for closing it after finishing decompression. * and is responsible for closing it after finishing decompression.
*/ */
GLOBAL(void) GLOBAL(void)
@ -213,19 +213,16 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
{ {
my_src_ptr src; my_src_ptr src;
/* The source object and input buffer are made permanent so that a series /* The source object including the input buffer is made permanent so that
* of JPEG images can be read from the same file by calling jpeg_stdio_src * a series of JPEG images can be read from the same file by calling
* only before the first one. (If we discarded the buffer at the end of * jpeg_stdio_src only before the first one. (If we discarded the buffer
* one image, we'd likely lose the start of the next one.) * at the end of one image, we'd likely lose the start of the next one.)
* This makes it unsafe to use this manager and a different source * This makes it unsafe to use this manager and a different source
* manager serially with the same JPEG object. Caveat programmer. * manager serially with the same JPEG object. Caveat programmer.
*/ */
if (cinfo->src == NULL) { /* first time for this JPEG object? */ if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_source_mgr)); ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_source_mgr));
src = (my_src_ptr) cinfo->src;
src->buffer = (JOCTET *) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET));
} }
src = (my_src_ptr) cinfo->src; src = (my_src_ptr) cinfo->src;

View File

@ -2,7 +2,7 @@
* jdcolor.c * jdcolor.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2011-2020 by Guido Vollbeding. * Modified 2011-2023 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -32,7 +32,9 @@ typedef struct {
INT32 * Cb_g_tab; /* => table for Cb to G conversion */ INT32 * Cb_g_tab; /* => table for Cb to G conversion */
/* Private state for RGB->Y conversion */ /* Private state for RGB->Y conversion */
INT32 * rgb_y_tab; /* => table for RGB to Y conversion */ INT32 * R_y_tab; /* => table for R to Y conversion */
INT32 * G_y_tab; /* => table for G to Y conversion */
INT32 * B_y_tab; /* => table for B to Y conversion */
} my_color_deconverter; } my_color_deconverter;
typedef my_color_deconverter * my_cconvert_ptr; typedef my_color_deconverter * my_cconvert_ptr;
@ -87,29 +89,17 @@ typedef my_color_deconverter * my_cconvert_ptr;
* by precalculating the constants times Cb and Cr for all possible values. * by precalculating the constants times Cb and Cr for all possible values.
* For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
* for 9-bit to 12-bit samples it is still acceptable. It's not very * for 9-bit to 12-bit samples it is still acceptable. It's not very
* reasonable for 16-bit samples, but if you want lossless storage you * reasonable for 16-bit samples, but if you want lossless storage
* shouldn't be changing colorspace anyway. * you shouldn't be changing colorspace anyway.
* The Cr=>R and Cb=>B values can be rounded to integers in advance; the * The Cr=>R and Cb=>B values can be rounded to integers in advance;
* values for the G calculation are left scaled up, since we must add them * the values for the G calculation are left scaled up,
* together before rounding. * since we must add them together before rounding.
*/ */
#define SCALEBITS 16 /* speediest right-shift on some machines */ #define SCALEBITS 16 /* speediest right-shift on some machines */
#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) #define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
/* We allocate one big table for RGB->Y conversion and divide it up into
* three parts, instead of doing three alloc_small requests. This lets us
* use a single table base address, which can be held in a register in the
* inner loops on many machines (more than can hold all three addresses,
* anyway).
*/
#define R_Y_OFF 0 /* offset to R => Y section */
#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */
#define TABLE_SIZE (3*(MAXJSAMPLE+1))
/* /*
* Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion. * Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion.
@ -249,17 +239,19 @@ LOCAL(void)
build_rgb_y_table (j_decompress_ptr cinfo) build_rgb_y_table (j_decompress_ptr cinfo)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
INT32 * rgb_y_tab;
INT32 i; INT32 i;
/* Allocate and fill in the conversion tables. */ cconvert->R_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
cconvert->rgb_y_tab = rgb_y_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
((j_common_ptr) cinfo, JPOOL_IMAGE, TABLE_SIZE * SIZEOF(INT32)); cconvert->G_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
cconvert->B_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
for (i = 0; i <= MAXJSAMPLE; i++) { for (i = 0; i <= MAXJSAMPLE; i++) {
rgb_y_tab[i+R_Y_OFF] = FIX(0.299) * i; cconvert->R_y_tab[i] = FIX(0.299) * i;
rgb_y_tab[i+G_Y_OFF] = FIX(0.587) * i; cconvert->G_y_tab[i] = FIX(0.587) * i;
rgb_y_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF; cconvert->B_y_tab[i] = FIX(0.114) * i + ONE_HALF;
} }
} }
@ -274,8 +266,10 @@ rgb_gray_convert (j_decompress_ptr cinfo,
JSAMPARRAY output_buf, int num_rows) JSAMPARRAY output_buf, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register int r, g, b; register INT32 y;
register INT32 * ctab = cconvert->rgb_y_tab; register INT32 * Rytab = cconvert->R_y_tab;
register INT32 * Gytab = cconvert->G_y_tab;
register INT32 * Bytab = cconvert->B_y_tab;
register JSAMPROW outptr; register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW inptr0, inptr1, inptr2;
register JDIMENSION col; register JDIMENSION col;
@ -288,13 +282,10 @@ rgb_gray_convert (j_decompress_ptr cinfo,
input_row++; input_row++;
outptr = *output_buf++; outptr = *output_buf++;
for (col = 0; col < num_cols; col++) { for (col = 0; col < num_cols; col++) {
r = GETJSAMPLE(inptr0[col]); y = Rytab[GETJSAMPLE(inptr0[col])];
g = GETJSAMPLE(inptr1[col]); y += Gytab[GETJSAMPLE(inptr1[col])];
b = GETJSAMPLE(inptr2[col]); y += Bytab[GETJSAMPLE(inptr2[col])];
/* Y */ outptr[col] = (JSAMPLE) (y >> SCALEBITS);
outptr[col] = (JSAMPLE)
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
} }
} }
} }
@ -354,7 +345,10 @@ rgb1_gray_convert (j_decompress_ptr cinfo,
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register int r, g, b; register int r, g, b;
register INT32 * ctab = cconvert->rgb_y_tab; register INT32 y;
register INT32 * Rytab = cconvert->R_y_tab;
register INT32 * Gytab = cconvert->G_y_tab;
register INT32 * Bytab = cconvert->B_y_tab;
register JSAMPROW outptr; register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW inptr0, inptr1, inptr2;
register JDIMENSION col; register JDIMENSION col;
@ -373,12 +367,10 @@ rgb1_gray_convert (j_decompress_ptr cinfo,
/* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
* (modulo) operator is equivalent to the bitmask operator AND. * (modulo) operator is equivalent to the bitmask operator AND.
*/ */
r = (r + g - CENTERJSAMPLE) & MAXJSAMPLE; y = Rytab[(r + g - CENTERJSAMPLE) & MAXJSAMPLE];
b = (b + g - CENTERJSAMPLE) & MAXJSAMPLE; y += Gytab[g];
/* Y */ y += Bytab[(b + g - CENTERJSAMPLE) & MAXJSAMPLE];
outptr[col] = (JSAMPLE) outptr[col] = (JSAMPLE) (y >> SCALEBITS);
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
} }
} }
} }
@ -565,8 +557,10 @@ cmyk_yk_convert (j_decompress_ptr cinfo,
JSAMPARRAY output_buf, int num_rows) JSAMPARRAY output_buf, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register int r, g, b; register INT32 y;
register INT32 * ctab = cconvert->rgb_y_tab; register INT32 * Rytab = cconvert->R_y_tab;
register INT32 * Gytab = cconvert->G_y_tab;
register INT32 * Bytab = cconvert->B_y_tab;
register JSAMPROW outptr; register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2, inptr3; register JSAMPROW inptr0, inptr1, inptr2, inptr3;
register JDIMENSION col; register JDIMENSION col;
@ -580,13 +574,10 @@ cmyk_yk_convert (j_decompress_ptr cinfo,
input_row++; input_row++;
outptr = *output_buf++; outptr = *output_buf++;
for (col = 0; col < num_cols; col++) { for (col = 0; col < num_cols; col++) {
r = MAXJSAMPLE - GETJSAMPLE(inptr0[col]); y = Rytab[MAXJSAMPLE - GETJSAMPLE(inptr0[col])];
g = MAXJSAMPLE - GETJSAMPLE(inptr1[col]); y += Gytab[MAXJSAMPLE - GETJSAMPLE(inptr1[col])];
b = MAXJSAMPLE - GETJSAMPLE(inptr2[col]); y += Bytab[MAXJSAMPLE - GETJSAMPLE(inptr2[col])];
/* Y */ outptr[0] = (JSAMPLE) (y >> SCALEBITS);
outptr[0] = (JSAMPLE)
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
/* K passes through unchanged */ /* K passes through unchanged */
outptr[1] = inptr3[col]; /* don't need GETJSAMPLE here */ outptr[1] = inptr3[col]; /* don't need GETJSAMPLE here */
outptr += 2; outptr += 2;

View File

@ -2,7 +2,7 @@
* jdct.h * jdct.h
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2002-2019 by Guido Vollbeding. * Modified 2002-2023 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -158,7 +158,7 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
#define jpeg_idct_6x12 jRD6x12 #define jpeg_idct_6x12 jRD6x12
#define jpeg_idct_5x10 jRD5x10 #define jpeg_idct_5x10 jRD5x10
#define jpeg_idct_4x8 jRD4x8 #define jpeg_idct_4x8 jRD4x8
#define jpeg_idct_3x6 jRD3x8 #define jpeg_idct_3x6 jRD3x6
#define jpeg_idct_2x4 jRD2x4 #define jpeg_idct_2x4 jRD2x4
#define jpeg_idct_1x2 jRD1x2 #define jpeg_idct_1x2 jRD1x2
#endif /* NEED_SHORT_EXTERNAL_NAMES */ #endif /* NEED_SHORT_EXTERNAL_NAMES */

View File

@ -2,7 +2,7 @@
* jdmerge.c * jdmerge.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2013-2020 by Guido Vollbeding. * Modified 2013-2022 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -20,17 +20,17 @@
* B = Y + K4 * Cb * B = Y + K4 * Cb
* only the Y term varies among the group of pixels corresponding to a pair * only the Y term varies among the group of pixels corresponding to a pair
* of chroma samples, so the rest of the terms can be calculated just once. * of chroma samples, so the rest of the terms can be calculated just once.
* At typical sampling ratios, this eliminates half or three-quarters of the * At typical sampling ratios, this eliminates half or three-quarters
* multiplications needed for color conversion. * of the multiplications needed for color conversion.
* *
* This file currently provides implementations for the following cases: * This file currently provides implementations for the following cases:
* YCC => RGB color conversion only (YCbCr or BG_YCC). * YCC => RGB color conversion only (YCbCr or BG_YCC).
* Sampling ratios of 2h1v or 2h2v. * Sampling ratios of 2h1v or 2h2v.
* No scaling needed at upsample time. * No scaling needed at upsample time.
* Corner-aligned (non-CCIR601) sampling alignment. * Corner-aligned (non-CCIR601) sampling alignment.
* Other special cases could be added, but in most applications these are * Other special cases could be added, but in most applications these
* the only common cases. (For uncommon cases we fall back on the more * are the only common cases. (For uncommon cases we fall back on
* general code in jdsample.c and jdcolor.c.) * the more general code in jdsample.c and jdcolor.c.)
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@ -286,9 +286,9 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
/* Do the chroma part of the calculation */ /* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++); cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++); cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb]; cblue = Cbbtab[cb];
cred = Crrtab[cr];
/* Fetch 2 Y values and emit 2 pixels */ /* Fetch 2 Y values and emit 2 pixels */
y = GETJSAMPLE(*inptr0++); y = GETJSAMPLE(*inptr0++);
outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_RED] = range_limit[y + cred];
@ -303,15 +303,14 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
} }
/* If image width is odd, do the last output column separately */ /* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) { if (cinfo->output_width & 1) {
y = GETJSAMPLE(*inptr0);
cb = GETJSAMPLE(*inptr1); cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2); cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr]; outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); outptr[RGB_GREEN] = range_limit[y +
cblue = Cbbtab[cb]; ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
y = GETJSAMPLE(*inptr0); SCALEBITS))];
outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue];
} }
} }
@ -350,9 +349,9 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
/* Do the chroma part of the calculation */ /* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++); cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++); cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb]; cblue = Cbbtab[cb];
cred = Crrtab[cr];
/* Fetch 4 Y values and emit 4 pixels */ /* Fetch 4 Y values and emit 4 pixels */
y = GETJSAMPLE(*inptr00++); y = GETJSAMPLE(*inptr00++);
outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_RED] = range_limit[y + cred];
@ -379,9 +378,9 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
if (cinfo->output_width & 1) { if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1); cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2); cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb]; cblue = Cbbtab[cb];
cred = Crrtab[cr];
y = GETJSAMPLE(*inptr00); y = GETJSAMPLE(*inptr00);
outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_RED] = range_limit[y + cred];
outptr0[RGB_GREEN] = range_limit[y + cgreen]; outptr0[RGB_GREEN] = range_limit[y + cgreen];

View File

@ -2,7 +2,7 @@
* jinclude.h * jinclude.h
* *
* Copyright (C) 1991-1994, Thomas G. Lane. * Copyright (C) 1991-1994, Thomas G. Lane.
* Modified 2017 by Guido Vollbeding. * Modified 2017-2022 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -11,8 +11,8 @@
* care of by the standard jconfig symbols, but on really weird systems * care of by the standard jconfig symbols, but on really weird systems
* you may have to edit this file.) * you may have to edit this file.)
* *
* NOTE: this file is NOT intended to be included by applications using the * NOTE: this file is NOT intended to be included by applications using
* JPEG library. Most applications need only include jpeglib.h. * the JPEG library. Most applications need only include jpeglib.h.
*/ */
@ -87,11 +87,71 @@
* *
* Furthermore, macros are provided for fflush() and ferror() in order * Furthermore, macros are provided for fflush() and ferror() in order
* to facilitate adaption by applications using an own FILE class. * to facilitate adaption by applications using an own FILE class.
*
* You can define your own custom file I/O functions in jconfig.h and
* #define JPEG_HAVE_FILE_IO_CUSTOM there to prevent redefinition here.
*
* You can #define JPEG_USE_FILE_IO_CUSTOM in jconfig.h to use custom file
* I/O functions implemented in Delphi VCL (Visual Component Library)
* in Vcl.Imaging.jpeg.pas for the TJPEGImage component utilizing
* the Delphi RTL (Run-Time Library) TMemoryStream component:
*
* procedure jpeg_stdio_src(var cinfo: jpeg_decompress_struct;
* input_file: TStream); external;
*
* procedure jpeg_stdio_dest(var cinfo: jpeg_compress_struct;
* output_file: TStream); external;
*
* function jfread(var buf; recsize, reccount: Integer; S: TStream): Integer;
* begin
* Result := S.Read(buf, recsize * reccount);
* end;
*
* function jfwrite(const buf; recsize, reccount: Integer; S: TStream): Integer;
* begin
* Result := S.Write(buf, recsize * reccount);
* end;
*
* function jfflush(S: TStream): Integer;
* begin
* Result := 0;
* end;
*
* function jferror(S: TStream): Integer;
* begin
* Result := 0;
* end;
*
* TMemoryStream of Delphi RTL has the distinctive feature to provide dynamic
* memory buffer management with a file/stream-based interface, particularly for
* the write (output) operation, which is easier to apply compared with direct
* implementations as given in jdatadst.c for memory destination. Those direct
* implementations of dynamic memory write tend to be more difficult to use,
* so providing an option like TMemoryStream may be a useful alternative.
*
* The CFile/CMemFile classes of the Microsoft Foundation Class (MFC) Library
* may be used in a similar fashion.
*/ */
#ifndef JPEG_HAVE_FILE_IO_CUSTOM
#ifdef JPEG_USE_FILE_IO_CUSTOM
extern size_t jfread(void * __ptr, size_t __size, size_t __n, FILE * __stream);
extern size_t jfwrite(const void * __ptr, size_t __size, size_t __n, FILE * __stream);
extern int jfflush(FILE * __stream);
extern int jferror(FILE * __fp);
#define JFREAD(file,buf,sizeofbuf) \
((size_t) jfread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define JFWRITE(file,buf,sizeofbuf) \
((size_t) jfwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define JFFLUSH(file) jfflush(file)
#define JFERROR(file) jferror(file)
#else
#define JFREAD(file,buf,sizeofbuf) \ #define JFREAD(file,buf,sizeofbuf) \
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define JFWRITE(file,buf,sizeofbuf) \ #define JFWRITE(file,buf,sizeofbuf) \
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define JFFLUSH(file) fflush(file) #define JFFLUSH(file) fflush(file)
#define JFERROR(file) ferror(file) #define JFERROR(file) ferror(file)
#endif
#endif

View File

@ -2,7 +2,7 @@
* jmorecfg.h * jmorecfg.h
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2013 by Guido Vollbeding. * Modified 1997-2022 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -351,8 +351,8 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean;
#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ #define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN) */
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/ #define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW) */
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
/* Note: if you selected more than 8-bit data precision, it is dangerous to /* Note: if you selected more than 8-bit data precision, it is dangerous to
* turn off ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only * turn off ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only
@ -369,8 +369,8 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean;
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ #define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN) */
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? (Requires DCT_ISLOW)*/ #define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? (Requires DCT_ISLOW) */
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
@ -384,20 +384,31 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean;
/* /*
* Ordering of RGB data in scanlines passed to or from the application. * Ordering of RGB data in scanlines passed to or from the application.
* If your application wants to deal with data in the order B,G,R, just * If your application wants to deal with data in the order B,G,R, just
* change these macros. You can also deal with formats such as R,G,B,X * #define JPEG_USE_RGB_CUSTOM in jconfig.h, or define your own custom
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing * order in jconfig.h and #define JPEG_HAVE_RGB_CUSTOM.
* the offsets will also change the order in which colormap data is organized. * You can also deal with formats such as R,G,B,X (one extra byte per pixel)
* by changing RGB_PIXELSIZE.
* Note that changing the offsets will also change
* the order in which colormap data is organized.
* RESTRICTIONS: * RESTRICTIONS:
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
* 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE * 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
* is not 3 (they don't understand about dummy color components!). So you * is not 3 (they don't understand about dummy color components!).
* can't use color quantization if you change that value. * So you can't use color quantization if you change that value.
*/ */
#ifndef JPEG_HAVE_RGB_CUSTOM
#ifdef JPEG_USE_RGB_CUSTOM
#define RGB_RED 2 /* Offset of Red in an RGB scanline element */
#define RGB_GREEN 1 /* Offset of Green */
#define RGB_BLUE 0 /* Offset of Blue */
#else
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ #define RGB_RED 0 /* Offset of Red in an RGB scanline element */
#define RGB_GREEN 1 /* Offset of Green */ #define RGB_GREEN 1 /* Offset of Green */
#define RGB_BLUE 2 /* Offset of Blue */ #define RGB_BLUE 2 /* Offset of Blue */
#endif
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
#endif
/* Definitions for speed-related optimizations. */ /* Definitions for speed-related optimizations. */

View File

@ -2,7 +2,7 @@
* jpeglib.h * jpeglib.h
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2020 by Guido Vollbeding. * Modified 2002-2022 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -39,7 +39,7 @@ extern "C" {
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */ #define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
#define JPEG_LIB_VERSION_MAJOR 9 #define JPEG_LIB_VERSION_MAJOR 9
#define JPEG_LIB_VERSION_MINOR 5 #define JPEG_LIB_VERSION_MINOR 6
/* Various constants determining the sizes of things. /* Various constants determining the sizes of things.

View File

@ -1,7 +1,7 @@
/* /*
* jversion.h * jversion.h
* *
* Copyright (C) 1991-2022, Thomas G. Lane, Guido Vollbeding. * Copyright (C) 1991-2024, Thomas G. Lane, Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@ -9,6 +9,6 @@
*/ */
#define JVERSION "9e 16-Jan-2022" #define JVERSION "9f 14-Jan-2024"
#define JCOPYRIGHT "Copyright (C) 2022, Thomas G. Lane, Guido Vollbeding" #define JCOPYRIGHT "Copyright (C) 2024, Thomas G. Lane, Guido Vollbeding"

View File

@ -1,6 +1,6 @@
USING THE IJG JPEG LIBRARY USING THE IJG JPEG LIBRARY
Copyright (C) 1994-2019, Thomas G. Lane, Guido Vollbeding. Copyright (C) 1994-2023, Thomas G. Lane, Guido Vollbeding.
This file is part of the Independent JPEG Group's software. This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file. For conditions of distribution and use, see the accompanying README file.
@ -285,8 +285,9 @@ that's why the error handler must be initialized first.
As previously mentioned, the JPEG library delivers compressed data to a As previously mentioned, the JPEG library delivers compressed data to a
"data destination" module. The library includes one data destination "data destination" module. The library includes one data destination
module which knows how to write to a stdio stream. You can use your own module which knows how to write to memory or to a file (or any stdio stream).
destination module if you want to do something else, as discussed later. You can use your own destination module if you want to do something else,
as discussed later.
If you use the standard destination module, you must open the target stdio If you use the standard destination module, you must open the target stdio
stream beforehand. Typical code for this step looks like: stream beforehand. Typical code for this step looks like:
@ -532,8 +533,8 @@ both compression and decompression objects.)
As previously mentioned, the JPEG library reads compressed data from a "data As previously mentioned, the JPEG library reads compressed data from a "data
source" module. The library includes one data source module which knows how source" module. The library includes one data source module which knows how
to read from a stdio stream. You can use your own source module if you want to read from memory or from a file (or any stdio stream). You can use your
to do something else, as discussed later. own source module if you want to do something else, as discussed later.
If you use the standard source module, you must open the source stdio stream If you use the standard source module, you must open the source stdio stream
beforehand. Typical code for this step looks like: beforehand. Typical code for this step looks like:
@ -886,7 +887,7 @@ int block_size
Larger values produce higher compression, Larger values produce higher compression,
smaller values produce higher quality. smaller values produce higher quality.
An exact DCT stage is possible with 1 or 2. An exact DCT stage is possible with 1 or 2.
With the default quality of 75 and default Luminance qtable With the default quality of 75 and default quantization tables
the DCT+Quantization stage is lossless for value 1. the DCT+Quantization stage is lossless for value 1.
Note that values other than 8 require a SmartScale capable decoder, Note that values other than 8 require a SmartScale capable decoder,
introduced with IJG JPEG 8. Setting the block_size parameter for introduced with IJG JPEG 8. Setting the block_size parameter for

View File

@ -169,7 +169,7 @@ Switches for advanced users:
Larger values produce higher compression, Larger values produce higher compression,
smaller values produce higher quality smaller values produce higher quality
(exact DCT stage possible with 1 or 2; with the (exact DCT stage possible with 1 or 2; with the
default quality of 75 and default Luminance qtable default quality of 75 and default quantization tables
the DCT+Quantization stage is lossless for N=1). the DCT+Quantization stage is lossless for N=1).
CAUTION: An implementation of the JPEG SmartScale CAUTION: An implementation of the JPEG SmartScale
extension is required for this feature. SmartScale extension is required for this feature. SmartScale