Update bundled libraries

- Update zlib from 1.3 to 1.3.1
- Update libjpeg from jpeg-9e to jpeg-9f
- Update libpng from 1.6.40 to 1.6.43
This commit is contained in:
Albrecht Schlosser
2024-05-14 15:57:39 +02:00
parent 908d900794
commit f964732c87
58 changed files with 1408 additions and 1175 deletions
+10 -12
View File
@@ -13,7 +13,16 @@ to avoid runtime errors.
User code compiled correctly with the header files provided by the
bundled image libraries need not be changed.
Current versions of bundled libraries (as of December 5, 2023):
Current versions of bundled libraries (as of May 13, 2024):
Library Version Release date FLTK Version
--------------------------------------------------------------------------
jpeg jpeg-9f 2024-01-14 1.3.10
png libpng-1.6.43 2024-02-23 1.3.10
zlib zlib-1.3.1 2024-01-22 1.3.10
--------------------------------------------------------------------------
Previous versions of bundled libraries:
Library Version Release date FLTK Version
--------------------------------------------------------------------------
@@ -22,15 +31,6 @@ Current versions of bundled libraries (as of December 5, 2023):
zlib zlib-1.3 2023-08-18 1.3.9
--------------------------------------------------------------------------
Previous versions of bundled libraries:
Library Version Release date FLTK Version
------------------------------------------------------------------
jpeg jpeg-9d 2020-01-12 1.3.6 - 1.3.8
png libpng-1.6.37 2019-04-14 1.3.6 - 1.3.8
zlib zlib-1.2.11 2017-01-15 1.3.6 - 1.3.8
--------------------------------------------------------------------------
General information:
@@ -177,8 +177,6 @@ png:
- pnglibconf.h: Generate on a Linux system and merge (see above).
- pngprefix.h: Generate on a Linux system and merge (see above).
- makedepend: Keep this file.
- png.c: Keep a change labelled with "FLTK"
- pngerror.c: Keep two changes labelled with "FLTK"
Run `make depend' in the png folder on a Linux system after
the upgrade to update this file.
+5 -5
View File
@@ -1,7 +1,7 @@
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
@@ -116,7 +116,7 @@ with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-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.
Permission is hereby granted to use, copy, modify, and distribute this
@@ -240,9 +240,9 @@ The "official" archive site for this software is www.ijg.org.
The most recent released version can always be found there in
directory "files". This particular version will be archived
in Windows-compatible "zip" archive format as
https://www.ijg.org/files/jpegsr9e.zip, and
https://www.ijg.org/files/jpegsr9f.zip, and
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
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.
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.
+11
View File
@@ -1,6 +1,17 @@
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
-----------------------
+169 -173
View File
@@ -1,173 +1,169 @@
/*
* FLTK symbol prefixes for libjpeg
* This is a generated file: see README.bundled-libs.txt
*/
#define jcopy_block_row fltk_jcopy_block_row
#define jcopy_sample_rows fltk_jcopy_sample_rows
#define jdiv_round_up fltk_jdiv_round_up
#define jinit_1pass_quantizer fltk_jinit_1pass_quantizer
#define jinit_2pass_quantizer fltk_jinit_2pass_quantizer
#define jinit_arith_decoder fltk_jinit_arith_decoder
#define jinit_arith_encoder fltk_jinit_arith_encoder
#define jinit_c_coef_controller fltk_jinit_c_coef_controller
#define jinit_c_main_controller fltk_jinit_c_main_controller
#define jinit_c_master_control fltk_jinit_c_master_control
#define jinit_color_converter fltk_jinit_color_converter
#define jinit_color_deconverter fltk_jinit_color_deconverter
#define jinit_compress_master fltk_jinit_compress_master
#define jinit_c_prep_controller fltk_jinit_c_prep_controller
#define jinit_d_coef_controller fltk_jinit_d_coef_controller
#define jinit_d_main_controller fltk_jinit_d_main_controller
#define jinit_downsampler fltk_jinit_downsampler
#define jinit_d_post_controller fltk_jinit_d_post_controller
#define jinit_forward_dct fltk_jinit_forward_dct
#define jinit_huff_decoder fltk_jinit_huff_decoder
#define jinit_huff_encoder fltk_jinit_huff_encoder
#define jinit_input_controller fltk_jinit_input_controller
#define jinit_inverse_dct fltk_jinit_inverse_dct
#define jinit_marker_reader fltk_jinit_marker_reader
#define jinit_marker_writer fltk_jinit_marker_writer
#define jinit_master_decompress fltk_jinit_master_decompress
#define jinit_memory_mgr fltk_jinit_memory_mgr
#define jinit_merged_upsampler fltk_jinit_merged_upsampler
#define jinit_upsampler fltk_jinit_upsampler
#define jpeg_abort fltk_jpeg_abort
#define jpeg_abort_compress fltk_jpeg_abort_compress
#define jpeg_abort_decompress fltk_jpeg_abort_decompress
#define jpeg_add_quant_table fltk_jpeg_add_quant_table
#define jpeg_alloc_huff_table fltk_jpeg_alloc_huff_table
#define jpeg_alloc_quant_table fltk_jpeg_alloc_quant_table
#define jpeg_aritab fltk_jpeg_aritab
#define jpeg_calc_jpeg_dimensions fltk_jpeg_calc_jpeg_dimensions
#define jpeg_calc_output_dimensions fltk_jpeg_calc_output_dimensions
#define jpeg_consume_input fltk_jpeg_consume_input
#define jpeg_copy_critical_parameters fltk_jpeg_copy_critical_parameters
#define jpeg_core_output_dimensions fltk_jpeg_core_output_dimensions
#define jpeg_CreateCompress fltk_jpeg_CreateCompress
#define jpeg_CreateDecompress fltk_jpeg_CreateDecompress
#define jpeg_default_colorspace fltk_jpeg_default_colorspace
#define jpeg_default_qtables fltk_jpeg_default_qtables
#define jpeg_destroy fltk_jpeg_destroy
#define jpeg_destroy_compress fltk_jpeg_destroy_compress
#define jpeg_destroy_decompress fltk_jpeg_destroy_decompress
#define jpeg_fdct_10x10 fltk_jpeg_fdct_10x10
#define jpeg_fdct_10x5 fltk_jpeg_fdct_10x5
#define jpeg_fdct_11x11 fltk_jpeg_fdct_11x11
#define jpeg_fdct_12x12 fltk_jpeg_fdct_12x12
#define jpeg_fdct_12x6 fltk_jpeg_fdct_12x6
#define jpeg_fdct_13x13 fltk_jpeg_fdct_13x13
#define jpeg_fdct_14x14 fltk_jpeg_fdct_14x14
#define jpeg_fdct_14x7 fltk_jpeg_fdct_14x7
#define jpeg_fdct_15x15 fltk_jpeg_fdct_15x15
#define jpeg_fdct_16x16 fltk_jpeg_fdct_16x16
#define jpeg_fdct_16x8 fltk_jpeg_fdct_16x8
#define jpeg_fdct_1x1 fltk_jpeg_fdct_1x1
#define jpeg_fdct_1x2 fltk_jpeg_fdct_1x2
#define jpeg_fdct_2x1 fltk_jpeg_fdct_2x1
#define jpeg_fdct_2x2 fltk_jpeg_fdct_2x2
#define jpeg_fdct_2x4 fltk_jpeg_fdct_2x4
#define jpeg_fdct_3x3 fltk_jpeg_fdct_3x3
#define jpeg_fdct_3x6 fltk_jpeg_fdct_3x6
#define jpeg_fdct_4x2 fltk_jpeg_fdct_4x2
#define jpeg_fdct_4x4 fltk_jpeg_fdct_4x4
#define jpeg_fdct_4x8 fltk_jpeg_fdct_4x8
#define jpeg_fdct_5x10 fltk_jpeg_fdct_5x10
#define jpeg_fdct_5x5 fltk_jpeg_fdct_5x5
#define jpeg_fdct_6x12 fltk_jpeg_fdct_6x12
#define jpeg_fdct_6x3 fltk_jpeg_fdct_6x3
#define jpeg_fdct_6x6 fltk_jpeg_fdct_6x6
#define jpeg_fdct_7x14 fltk_jpeg_fdct_7x14
#define jpeg_fdct_7x7 fltk_jpeg_fdct_7x7
#define jpeg_fdct_8x16 fltk_jpeg_fdct_8x16
#define jpeg_fdct_8x4 fltk_jpeg_fdct_8x4
#define jpeg_fdct_9x9 fltk_jpeg_fdct_9x9
#define jpeg_fdct_float fltk_jpeg_fdct_float
#define jpeg_fdct_ifast fltk_jpeg_fdct_ifast
#define jpeg_fdct_islow fltk_jpeg_fdct_islow
#define jpeg_finish_compress fltk_jpeg_finish_compress
#define jpeg_finish_decompress fltk_jpeg_finish_decompress
#define jpeg_finish_output fltk_jpeg_finish_output
#define jpeg_free_large fltk_jpeg_free_large
#define jpeg_free_small fltk_jpeg_free_small
#define jpeg_get_large fltk_jpeg_get_large
#define jpeg_get_small fltk_jpeg_get_small
#define jpeg_has_multiple_scans fltk_jpeg_has_multiple_scans
#define jpeg_idct_10x10 fltk_jpeg_idct_10x10
#define jpeg_idct_10x5 fltk_jpeg_idct_10x5
#define jpeg_idct_11x11 fltk_jpeg_idct_11x11
#define jpeg_idct_12x12 fltk_jpeg_idct_12x12
#define jpeg_idct_12x6 fltk_jpeg_idct_12x6
#define jpeg_idct_13x13 fltk_jpeg_idct_13x13
#define jpeg_idct_14x14 fltk_jpeg_idct_14x14
#define jpeg_idct_14x7 fltk_jpeg_idct_14x7
#define jpeg_idct_15x15 fltk_jpeg_idct_15x15
#define jpeg_idct_16x16 fltk_jpeg_idct_16x16
#define jpeg_idct_16x8 fltk_jpeg_idct_16x8
#define jpeg_idct_1x1 fltk_jpeg_idct_1x1
#define jpeg_idct_1x2 fltk_jpeg_idct_1x2
#define jpeg_idct_2x1 fltk_jpeg_idct_2x1
#define jpeg_idct_2x2 fltk_jpeg_idct_2x2
#define jpeg_idct_2x4 fltk_jpeg_idct_2x4
#define jpeg_idct_3x3 fltk_jpeg_idct_3x3
#define jpeg_idct_3x6 fltk_jpeg_idct_3x6
#define jpeg_idct_4x2 fltk_jpeg_idct_4x2
#define jpeg_idct_4x4 fltk_jpeg_idct_4x4
#define jpeg_idct_4x8 fltk_jpeg_idct_4x8
#define jpeg_idct_5x10 fltk_jpeg_idct_5x10
#define jpeg_idct_5x5 fltk_jpeg_idct_5x5
#define jpeg_idct_6x12 fltk_jpeg_idct_6x12
#define jpeg_idct_6x3 fltk_jpeg_idct_6x3
#define jpeg_idct_6x6 fltk_jpeg_idct_6x6
#define jpeg_idct_7x14 fltk_jpeg_idct_7x14
#define jpeg_idct_7x7 fltk_jpeg_idct_7x7
#define jpeg_idct_8x16 fltk_jpeg_idct_8x16
#define jpeg_idct_8x4 fltk_jpeg_idct_8x4
#define jpeg_idct_9x9 fltk_jpeg_idct_9x9
#define jpeg_idct_float fltk_jpeg_idct_float
#define jpeg_idct_ifast fltk_jpeg_idct_ifast
#define jpeg_idct_islow fltk_jpeg_idct_islow
#define jpeg_input_complete fltk_jpeg_input_complete
#define jpeg_mem_available fltk_jpeg_mem_available
#define jpeg_mem_dest fltk_jpeg_mem_dest
#define jpeg_mem_init fltk_jpeg_mem_init
#define jpeg_mem_src fltk_jpeg_mem_src
#define jpeg_mem_term fltk_jpeg_mem_term
#define jpeg_natural_order fltk_jpeg_natural_order
#define jpeg_natural_order2 fltk_jpeg_natural_order2
#define jpeg_natural_order3 fltk_jpeg_natural_order3
#define jpeg_natural_order4 fltk_jpeg_natural_order4
#define jpeg_natural_order5 fltk_jpeg_natural_order5
#define jpeg_natural_order6 fltk_jpeg_natural_order6
#define jpeg_natural_order7 fltk_jpeg_natural_order7
#define jpeg_new_colormap fltk_jpeg_new_colormap
#define jpeg_open_backing_store fltk_jpeg_open_backing_store
#define jpeg_quality_scaling fltk_jpeg_quality_scaling
#define jpeg_read_coefficients fltk_jpeg_read_coefficients
#define jpeg_read_header fltk_jpeg_read_header
#define jpeg_read_raw_data fltk_jpeg_read_raw_data
#define jpeg_read_scanlines fltk_jpeg_read_scanlines
#define jpeg_resync_to_restart fltk_jpeg_resync_to_restart
#define jpeg_save_markers fltk_jpeg_save_markers
#define jpeg_set_colorspace fltk_jpeg_set_colorspace
#define jpeg_set_defaults fltk_jpeg_set_defaults
#define jpeg_set_linear_quality fltk_jpeg_set_linear_quality
#define jpeg_set_marker_processor fltk_jpeg_set_marker_processor
#define jpeg_set_quality fltk_jpeg_set_quality
#define jpeg_simple_progression fltk_jpeg_simple_progression
#define jpeg_start_compress fltk_jpeg_start_compress
#define jpeg_start_decompress fltk_jpeg_start_decompress
#define jpeg_start_output fltk_jpeg_start_output
#define jpeg_std_error fltk_jpeg_std_error
#define jpeg_std_huff_table fltk_jpeg_std_huff_table
#define jpeg_stdio_dest fltk_jpeg_stdio_dest
#define jpeg_stdio_src fltk_jpeg_stdio_src
#define jpeg_std_message_table fltk_jpeg_std_message_table
#define jpeg_suppress_tables fltk_jpeg_suppress_tables
#define jpeg_write_coefficients fltk_jpeg_write_coefficients
#define jpeg_write_marker fltk_jpeg_write_marker
#define jpeg_write_m_byte fltk_jpeg_write_m_byte
#define jpeg_write_m_header fltk_jpeg_write_m_header
#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
#define _jcopy_block_row fltk__jcopy_block_row
#define _jcopy_sample_rows fltk__jcopy_sample_rows
#define _jdiv_round_up fltk__jdiv_round_up
#define _jinit_1pass_quantizer fltk__jinit_1pass_quantizer
#define _jinit_2pass_quantizer fltk__jinit_2pass_quantizer
#define _jinit_arith_decoder fltk__jinit_arith_decoder
#define _jinit_arith_encoder fltk__jinit_arith_encoder
#define _jinit_c_coef_controller fltk__jinit_c_coef_controller
#define _jinit_c_main_controller fltk__jinit_c_main_controller
#define _jinit_c_master_control fltk__jinit_c_master_control
#define _jinit_c_prep_controller fltk__jinit_c_prep_controller
#define _jinit_color_converter fltk__jinit_color_converter
#define _jinit_color_deconverter fltk__jinit_color_deconverter
#define _jinit_compress_master fltk__jinit_compress_master
#define _jinit_d_coef_controller fltk__jinit_d_coef_controller
#define _jinit_d_main_controller fltk__jinit_d_main_controller
#define _jinit_d_post_controller fltk__jinit_d_post_controller
#define _jinit_downsampler fltk__jinit_downsampler
#define _jinit_forward_dct fltk__jinit_forward_dct
#define _jinit_huff_decoder fltk__jinit_huff_decoder
#define _jinit_huff_encoder fltk__jinit_huff_encoder
#define _jinit_input_controller fltk__jinit_input_controller
#define _jinit_inverse_dct fltk__jinit_inverse_dct
#define _jinit_marker_reader fltk__jinit_marker_reader
#define _jinit_marker_writer fltk__jinit_marker_writer
#define _jinit_master_decompress fltk__jinit_master_decompress
#define _jinit_memory_mgr fltk__jinit_memory_mgr
#define _jinit_merged_upsampler fltk__jinit_merged_upsampler
#define _jinit_upsampler fltk__jinit_upsampler
#define _jpeg_CreateCompress fltk__jpeg_CreateCompress
#define _jpeg_CreateDecompress fltk__jpeg_CreateDecompress
#define _jpeg_abort fltk__jpeg_abort
#define _jpeg_abort_compress fltk__jpeg_abort_compress
#define _jpeg_abort_decompress fltk__jpeg_abort_decompress
#define _jpeg_add_quant_table fltk__jpeg_add_quant_table
#define _jpeg_alloc_huff_table fltk__jpeg_alloc_huff_table
#define _jpeg_alloc_quant_table fltk__jpeg_alloc_quant_table
#define _jpeg_aritab fltk__jpeg_aritab
#define _jpeg_calc_jpeg_dimensions fltk__jpeg_calc_jpeg_dimensions
#define _jpeg_calc_output_dimensions fltk__jpeg_calc_output_dimensions
#define _jpeg_consume_input fltk__jpeg_consume_input
#define _jpeg_copy_critical_parameters fltk__jpeg_copy_critical_parameters
#define _jpeg_core_output_dimensions fltk__jpeg_core_output_dimensions
#define _jpeg_default_colorspace fltk__jpeg_default_colorspace
#define _jpeg_default_qtables fltk__jpeg_default_qtables
#define _jpeg_destroy fltk__jpeg_destroy
#define _jpeg_destroy_compress fltk__jpeg_destroy_compress
#define _jpeg_destroy_decompress fltk__jpeg_destroy_decompress
#define _jpeg_fdct_10x10 fltk__jpeg_fdct_10x10
#define _jpeg_fdct_10x5 fltk__jpeg_fdct_10x5
#define _jpeg_fdct_11x11 fltk__jpeg_fdct_11x11
#define _jpeg_fdct_12x12 fltk__jpeg_fdct_12x12
#define _jpeg_fdct_12x6 fltk__jpeg_fdct_12x6
#define _jpeg_fdct_13x13 fltk__jpeg_fdct_13x13
#define _jpeg_fdct_14x14 fltk__jpeg_fdct_14x14
#define _jpeg_fdct_14x7 fltk__jpeg_fdct_14x7
#define _jpeg_fdct_15x15 fltk__jpeg_fdct_15x15
#define _jpeg_fdct_16x16 fltk__jpeg_fdct_16x16
#define _jpeg_fdct_16x8 fltk__jpeg_fdct_16x8
#define _jpeg_fdct_1x1 fltk__jpeg_fdct_1x1
#define _jpeg_fdct_1x2 fltk__jpeg_fdct_1x2
#define _jpeg_fdct_2x1 fltk__jpeg_fdct_2x1
#define _jpeg_fdct_2x2 fltk__jpeg_fdct_2x2
#define _jpeg_fdct_2x4 fltk__jpeg_fdct_2x4
#define _jpeg_fdct_3x3 fltk__jpeg_fdct_3x3
#define _jpeg_fdct_3x6 fltk__jpeg_fdct_3x6
#define _jpeg_fdct_4x2 fltk__jpeg_fdct_4x2
#define _jpeg_fdct_4x4 fltk__jpeg_fdct_4x4
#define _jpeg_fdct_4x8 fltk__jpeg_fdct_4x8
#define _jpeg_fdct_5x10 fltk__jpeg_fdct_5x10
#define _jpeg_fdct_5x5 fltk__jpeg_fdct_5x5
#define _jpeg_fdct_6x12 fltk__jpeg_fdct_6x12
#define _jpeg_fdct_6x3 fltk__jpeg_fdct_6x3
#define _jpeg_fdct_6x6 fltk__jpeg_fdct_6x6
#define _jpeg_fdct_7x14 fltk__jpeg_fdct_7x14
#define _jpeg_fdct_7x7 fltk__jpeg_fdct_7x7
#define _jpeg_fdct_8x16 fltk__jpeg_fdct_8x16
#define _jpeg_fdct_8x4 fltk__jpeg_fdct_8x4
#define _jpeg_fdct_9x9 fltk__jpeg_fdct_9x9
#define _jpeg_fdct_float fltk__jpeg_fdct_float
#define _jpeg_fdct_ifast fltk__jpeg_fdct_ifast
#define _jpeg_fdct_islow fltk__jpeg_fdct_islow
#define _jpeg_finish_compress fltk__jpeg_finish_compress
#define _jpeg_finish_decompress fltk__jpeg_finish_decompress
#define _jpeg_finish_output fltk__jpeg_finish_output
#define _jpeg_free_large fltk__jpeg_free_large
#define _jpeg_free_small fltk__jpeg_free_small
#define _jpeg_get_large fltk__jpeg_get_large
#define _jpeg_get_small fltk__jpeg_get_small
#define _jpeg_has_multiple_scans fltk__jpeg_has_multiple_scans
#define _jpeg_idct_10x10 fltk__jpeg_idct_10x10
#define _jpeg_idct_10x5 fltk__jpeg_idct_10x5
#define _jpeg_idct_11x11 fltk__jpeg_idct_11x11
#define _jpeg_idct_12x12 fltk__jpeg_idct_12x12
#define _jpeg_idct_12x6 fltk__jpeg_idct_12x6
#define _jpeg_idct_13x13 fltk__jpeg_idct_13x13
#define _jpeg_idct_14x14 fltk__jpeg_idct_14x14
#define _jpeg_idct_14x7 fltk__jpeg_idct_14x7
#define _jpeg_idct_15x15 fltk__jpeg_idct_15x15
#define _jpeg_idct_16x16 fltk__jpeg_idct_16x16
#define _jpeg_idct_16x8 fltk__jpeg_idct_16x8
#define _jpeg_idct_1x1 fltk__jpeg_idct_1x1
#define _jpeg_idct_1x2 fltk__jpeg_idct_1x2
#define _jpeg_idct_2x1 fltk__jpeg_idct_2x1
#define _jpeg_idct_2x2 fltk__jpeg_idct_2x2
#define _jpeg_idct_2x4 fltk__jpeg_idct_2x4
#define _jpeg_idct_3x3 fltk__jpeg_idct_3x3
#define _jpeg_idct_3x6 fltk__jpeg_idct_3x6
#define _jpeg_idct_4x2 fltk__jpeg_idct_4x2
#define _jpeg_idct_4x4 fltk__jpeg_idct_4x4
#define _jpeg_idct_4x8 fltk__jpeg_idct_4x8
#define _jpeg_idct_5x10 fltk__jpeg_idct_5x10
#define _jpeg_idct_5x5 fltk__jpeg_idct_5x5
#define _jpeg_idct_6x12 fltk__jpeg_idct_6x12
#define _jpeg_idct_6x3 fltk__jpeg_idct_6x3
#define _jpeg_idct_6x6 fltk__jpeg_idct_6x6
#define _jpeg_idct_7x14 fltk__jpeg_idct_7x14
#define _jpeg_idct_7x7 fltk__jpeg_idct_7x7
#define _jpeg_idct_8x16 fltk__jpeg_idct_8x16
#define _jpeg_idct_8x4 fltk__jpeg_idct_8x4
#define _jpeg_idct_9x9 fltk__jpeg_idct_9x9
#define _jpeg_idct_float fltk__jpeg_idct_float
#define _jpeg_idct_ifast fltk__jpeg_idct_ifast
#define _jpeg_idct_islow fltk__jpeg_idct_islow
#define _jpeg_input_complete fltk__jpeg_input_complete
#define _jpeg_mem_available fltk__jpeg_mem_available
#define _jpeg_mem_dest fltk__jpeg_mem_dest
#define _jpeg_mem_init fltk__jpeg_mem_init
#define _jpeg_mem_src fltk__jpeg_mem_src
#define _jpeg_mem_term fltk__jpeg_mem_term
#define _jpeg_natural_order fltk__jpeg_natural_order
#define _jpeg_natural_order2 fltk__jpeg_natural_order2
#define _jpeg_natural_order3 fltk__jpeg_natural_order3
#define _jpeg_natural_order4 fltk__jpeg_natural_order4
#define _jpeg_natural_order5 fltk__jpeg_natural_order5
#define _jpeg_natural_order6 fltk__jpeg_natural_order6
#define _jpeg_natural_order7 fltk__jpeg_natural_order7
#define _jpeg_new_colormap fltk__jpeg_new_colormap
#define _jpeg_open_backing_store fltk__jpeg_open_backing_store
#define _jpeg_quality_scaling fltk__jpeg_quality_scaling
#define _jpeg_read_coefficients fltk__jpeg_read_coefficients
#define _jpeg_read_header fltk__jpeg_read_header
#define _jpeg_read_raw_data fltk__jpeg_read_raw_data
#define _jpeg_read_scanlines fltk__jpeg_read_scanlines
#define _jpeg_resync_to_restart fltk__jpeg_resync_to_restart
#define _jpeg_save_markers fltk__jpeg_save_markers
#define _jpeg_set_colorspace fltk__jpeg_set_colorspace
#define _jpeg_set_defaults fltk__jpeg_set_defaults
#define _jpeg_set_linear_quality fltk__jpeg_set_linear_quality
#define _jpeg_set_marker_processor fltk__jpeg_set_marker_processor
#define _jpeg_set_quality fltk__jpeg_set_quality
#define _jpeg_simple_progression fltk__jpeg_simple_progression
#define _jpeg_start_compress fltk__jpeg_start_compress
#define _jpeg_start_decompress fltk__jpeg_start_decompress
#define _jpeg_start_output fltk__jpeg_start_output
#define _jpeg_std_error fltk__jpeg_std_error
#define _jpeg_std_huff_table fltk__jpeg_std_huff_table
#define _jpeg_std_message_table fltk__jpeg_std_message_table
#define _jpeg_stdio_dest fltk__jpeg_stdio_dest
#define _jpeg_stdio_src fltk__jpeg_stdio_src
#define _jpeg_suppress_tables fltk__jpeg_suppress_tables
#define _jpeg_write_coefficients fltk__jpeg_write_coefficients
#define _jpeg_write_m_byte fltk__jpeg_write_m_byte
#define _jpeg_write_m_header fltk__jpeg_write_m_header
#define _jpeg_write_marker fltk__jpeg_write_marker
#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
+72 -76
View File
@@ -1,6 +1,6 @@
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.
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.sas jconfig.sas Amiga, SAS C
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.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C)
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.vs jconfig.vc Windows, MS Visual C++ 6 Developer Studio
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
makefile.vs jconfig.vc Windows, Visual Studio 2022 Version 17
make*.v16
make*.v17
makefile.b32 jconfig.vc Windows, Borland C++ 32-bit (bcc32)
makefile.b32 jconfig.vc Windows, C++Builder/RAD Studio 10.4-11
mak*jpeg.bcb
makefile.b32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32)
makefile.c32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32c)
makefile.d32
makefile.x32 jconfig.vc Windows, Embarcadero C++ for Win32 (bcc32x)
makefile.b64 jconfig.vc Windows, Embarcadero C++ for Win64 (bcc64)
makefile.mms jconfig.vms Digital VMS, with 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.
(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
these lines, please report the optimal settings to jpeg-info@jpegclub.org so
we can mention them in future releases. Be sure to specify your machine and
these lines, please report the optimal settings to jpeg-info@ijg.org so we
can mention them in future releases. Be sure to specify your machine and
compiler version.
@@ -554,8 +558,8 @@ HINTS FOR SPECIFIC SYSTEMS
==========================
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
about how to configure the JPEG software for your system, please let us know.
'em to jpeg-info@ijg.org. Also, if configure or ckconfig.c is wrong about
how to configure the JPEG software for your system, please let us know.
Acorn RISC OS:
@@ -593,7 +597,7 @@ manager, with temporary files being created on the device named by
"JPEGTMP:".
Atari ST/STE/TT:
Atari ST/Mega/STE/TT/Falcon:
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
@@ -1045,8 +1049,8 @@ To use:
(Note that the renaming is critical!)
Alternatively you can use
nmake /f makefile.vs setupcopy-vc6
This will create renamed copies of the files, which allows to repeat
the setup later.
This will create renamed copies of the files,
which allows to repeat the setup later.
2. Open the workspace file jpeg.dsw, build the library project.
(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.)
@@ -1057,108 +1061,100 @@ To use:
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
2019 Version 16 or later. There is a library makefile that builds the
IJG library as a static Win32/x64/ARM/ARM64 library, and application
makefiles that build the sample applications as Win32/x64/ARM/ARM64
console applications. (Even if you only want the library, we recommend
building the applications so that you can run the self-test.)
2019-2022 version 16-17 or later. There is a library makefile that
builds the IJG library as a static Win32/x64/ARM/ARM64/ARM64EC library,
and application makefiles that build the sample applications as
Win32/x64/ARM/ARM64/ARM64EC console applications. (Even if you
only want the library, we recommend building the applications
so that you can run the self-test.)
To use:
1. Ensure youve checked the item "Desktop development with C++" in the
Workloads tab of Visual Studio Installer.
Open the Developer Command Prompt for VS 2019, change to the source
directory and execute the command line
Open the Developer Command Prompt for VS 2019-2022, change to the
source directory and execute the command line
nmake /f makefile.vs setup-v16
This will move jconfig.vc to jconfig.h and makefiles to project files.
(Note that the renaming is critical!)
Alternatively you can use
nmake /f makefile.vs setupcopy-v16
This will create renamed copies of the files, which allows to repeat
the setup later.
This will create renamed copies of the files,
which allows to repeat the setup later.
2. Open the solution file jpeg.sln, build the library project.
a) If you are using Visual Studio more recent than
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.
b) If necessary, open the project properties and
adapt the Windows Target Platform Version in
the Configuration Properties, General section;
we support the latest version at the time of release.
b) If necessary, open the project properties and adapt the
Windows Target Platform Version (or Windows SDK Version)
in the Configuration Properties, General section.
c) If you get a warning saying that a platform cannot be found,
you can either
* forgo the platform and ignore the warning, 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
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.
e) If you want to build ARM/ARM64/ARM64EC code, change the platform
setting to ARM/ARM64/ARM64EC. Ensure youve installed the
ARM/ARM64/ARM64EC build tools in Visual Studio Installer
(Workloads tab Optional components or Individual components tab).
You can build Win32/x64/ARM/ARM64/ARM64EC versions side by side.
3. Open the solution file apps.sln, build the application projects.
4. To perform the self-test, execute the command line
nmake /f makefile.vs test-32
for the Win32 build, or on a 64-bit system
nmake /f makefile.vs test-64
for the x64 build.
Note: test options for ARM code will be added
as soon as Windows on ARM reference devices are available.
To date there are no Windows on ARM reference devices available.
5. Move the application .exe files from the Release folder to an
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
2022 Version 17 or later. There is a library makefile that builds the
IJG library as a static Win32/x64/ARM/ARM64 library, and application
makefiles that build the sample applications as Win32/x64/ARM/ARM64
console applications. (Even if you only want the library, we recommend
building the applications so that you can run the self-test.)
We include makefiles that should work as project files in C++Builder/RAD
Studio 10.4-11 or later. There is a library makefile that builds the
IJG library as a static Win32/Win64 library, and application makefiles
that build the sample applications as Win32/Win64 console applications.
(Even if you only want the library, we recommend building the
applications so that you can run the self-test.)
To use:
1. Ensure youve checked the item "Desktop development with C++" in the
Workloads tab of Visual Studio Installer.
Open the Developer Command Prompt for VS 2022, change to the source
directory and execute the command line
nmake /f makefile.vs setup-v17
1. Open the RAD Studio Command Prompt (or the standard Windows Command
Prompt, since the environment is set system-wide during RAD Studio
installation), change to the source directory and execute the command
line
make -fmakefile.b32 setup-cb
This will move jconfig.vc to jconfig.h and makefiles to project files.
(Note that the renaming is critical!)
Alternatively you can use
nmake /f makefile.vs setupcopy-v17
This will create renamed copies of the files, which allows to repeat
the setup later.
2. Open the solution file jpeg.sln, build the library project.
a) If you are using Visual Studio more recent than
2022 Version 17, you'll probably get a message
saying that the project files are being updated.
b) If necessary, open the project properties and
adapt the Windows Target Platform Version 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,
you can either
* forgo the platform and ignore the warning, or
* remove the platform in the Configuration Manager, or
* 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.
make -fmakefile.b32 setupcopy-cb
This will create renamed copies of the files,
which allows to repeat the setup later.
(You can use one of the other makefiles .c32,
.d32, .x32, or .b64 instead of .b32.)
2. Open the project file jpeg.cbproj, build the library project.
a) By default, the classic Borland compiler (bcc32) is used for
the Win32 build. To enable the Clang-based compiler for a
specific project, select Project > Options > C++ Compiler
and deselect the Use classic Borland compiler option.
b) If you want to build Win64 code, change the platform setting
from Windows 32 Bit to Windows 64 Bit.
You can build Win32 and Win64 versions side by side.
3. Open the project group file apps.groupproj,
build the application projects.
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
nmake /f makefile.vs test-64
for the x64 build.
make -fmakefile.b32 test-64
for the Win64 build.
5. Move the application .exe files from the Release folder to an
appropriate location on your path.
+4 -4
View File
@@ -2,7 +2,7 @@
* jccoefct.c
*
* 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.
* 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 */
/* For single-pass compression, it's sufficient to buffer just one MCU
* (although this may prove a bit slow in practice). We append a
* workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it
* for each MCU constructed and sent.
* (although this may prove a bit slow in practice).
* We append a workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks,
* and reuse it for each MCU constructed and sent.
* In multi-pass modes, this array points to the current MCU's blocks
* within the virtual arrays.
*/
+16 -19
View File
@@ -2,7 +2,7 @@
* jccolor.c
*
* 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.
* 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
* documents are imprecise. The general conversion equations are
* Y = Kr * R + (1 - Kr - Kb) * G + Kb * B
* Cb = 0.5 * (B - Y) / (1 - Kb)
* Cr = 0.5 * (R - Y) / (1 - Kr)
* Cb = (B - Y) / (1 - Kb) / K
* Cr = (R - Y) / (1 - Kr) / K
* 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
* Y = 0.299 * R + 0.587 * G + 0.114 * B
* 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.
* 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
* reasonable for 16-bit samples, but if you want lossless storage you
* shouldn't be changing colorspace anyway.
* reasonable for 16-bit samples, but if you want lossless storage
* you shouldn't be changing colorspace anyway.
* 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.
*/
@@ -110,16 +110,16 @@ rgb_ycc_start (j_compress_ptr cinfo)
for (i = 0; i <= MAXJSAMPLE; 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+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+G_CB_OFF] = (- FIX(0.331264108)) * i;
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
* This ensures that the maximum output will round to MAXJSAMPLE
* 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
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+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.
* This version handles RGB->grayscale conversion, which is the same
* as the RGB->Y portion of RGB->YCbCr.
* This version handles RGB->grayscale conversion,
* 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).
*/
@@ -201,7 +201,7 @@ rgb_gray_convert (j_compress_ptr cinfo,
JDIMENSION output_row, int num_rows)
{
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 JSAMPROW inptr;
register JSAMPROW outptr;
@@ -212,14 +212,11 @@ rgb_gray_convert (j_compress_ptr cinfo,
inptr = *input_buf++;
outptr = output_buf[0][output_row++];
for (col = 0; col < num_cols; col++) {
r = GETJSAMPLE(inptr[RGB_RED]);
g = GETJSAMPLE(inptr[RGB_GREEN]);
b = GETJSAMPLE(inptr[RGB_BLUE]);
y = ctab[R_Y_OFF + GETJSAMPLE(inptr[RGB_RED])];
y += ctab[G_Y_OFF + GETJSAMPLE(inptr[RGB_GREEN])];
y += ctab[B_Y_OFF + GETJSAMPLE(inptr[RGB_BLUE])];
inptr += RGB_PIXELSIZE;
/* Y */
outptr[col] = (JSAMPLE)
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
outptr[col] = (JSAMPLE) (y >> SCALEBITS);
}
}
}
+150 -134
View File
@@ -2,7 +2,7 @@
* jchuff.c
*
* 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.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -26,17 +26,11 @@
/* The legal range of a DCT coefficient is
* -1024 .. +1023 for 8-bit data;
* -16384 .. +16383 for 12-bit data.
* Hence the magnitude should always fit in 10 or 14 bits respectively.
* -1024 .. +1023 for 8-bit sample data precision;
* -16384 .. +16383 for 12-bit sample data precision.
* Hence the magnitude should always fit in sample data precision + 2 bits.
*/
#if BITS_IN_JSAMPLE == 8
#define MAX_COEF_BITS 10
#else
#define MAX_COEF_BITS 14
#endif
/* Derived data constructed for each Huffman table */
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;
register int temp, temp2;
register int nbits;
int max_coef_bits;
int blkn, ci, tbl;
ISHIFT_TEMPS
@@ -558,6 +553,9 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
if (entropy->restarts_to_go == 0)
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 */
for (blkn = 0; blkn < cinfo->blocks_in_MCU; 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);
/* 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;
/* Encode the DC coefficient difference per section G.1.2.1 */
temp = temp2;
if (temp < 0) {
if ((temp = temp2) < 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 */
@@ -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 */
nbits = 0;
while (temp) {
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)
do nbits++; /* there must be at least one 1 bit */
while ((temp >>= 1));
/* Check for out-of-range coefficient values */
if (nbits > max_coef_bits)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* 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, */
/* 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;
@@ -633,7 +631,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
register int temp, temp2;
register int nbits;
register int r, k;
int Se, Al;
int Se, Al, max_coef_bits;
entropy->next_output_byte = cinfo->dest->next_output_byte;
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;
Al = cinfo->Al;
natural_order = cinfo->natural_order;
max_coef_bits = cinfo->data_precision + 2;
/* Encode the MCU data block */
block = MCU_data[0];
@@ -666,18 +665,23 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data)
*/
if (temp < 0) {
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) */
temp2 = ~temp;
} 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;
}
/* Watch out for case that nonzero coef is zero after point transform */
if (temp == 0) {
r++;
continue;
}
/* Emit any pending EOBRUN */
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 */
nbits = 1; /* there must be at least one 1 bit */
while ((temp >>= 1))
nbits++;
nbits = 0;
do nbits++; /* there must be at least one 1 bit */
while ((temp >>= 1));
/* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS)
if (nbits > max_coef_bits)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* 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 r, k;
int Se = state->cinfo->lim_Se;
int max_coef_bits = state->cinfo->data_precision + 3;
const int * natural_order = state->cinfo->natural_order;
/* 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) {
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--;
}
/* 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.
* 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 */
nbits = 0;
while (temp) {
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 */
if (! emit_bits_s(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
return FALSE;
/* Emit the Huffman-coded symbol for the number of bits */
if (! emit_bits_s(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
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 */
/* 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;
}
/* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */
for (k = 1; k <= Se; k++) {
if ((temp2 = block[natural_order[k]]) == 0) {
if ((temp = block[natural_order[k]]) == 0) {
r++;
} else {
/* 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;
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;
}
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 */
@@ -1122,28 +1132,31 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
register int nbits;
register int r, k;
int Se = cinfo->lim_Se;
int max_coef_bits = cinfo->data_precision + 3;
const int * natural_order = cinfo->natural_order;
/* Encode the DC coefficient difference per section F.1.2.1 */
temp = block[0] - last_dc_val;
if (temp < 0)
temp = -temp;
if ((temp = block[0] - last_dc_val) == 0) {
/* Count the Huffman symbol for the number of bits */
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 */
nbits = 0;
while (temp) {
nbits++;
temp >>= 1;
/* 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.
* 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 */
@@ -1152,30 +1165,33 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val,
for (k = 1; k <= Se; k++) {
if ((temp = block[natural_order[k]]) == 0) {
r++;
} else {
/* 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;
continue;
}
/* 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 */
+6 -10
View File
@@ -2,7 +2,7 @@
* jdatadst.c
*
* 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.
* 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 */
#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
typedef struct {
struct jpeg_destination_mgr pub; /* public fields */
FILE * outfile; /* target stream */
JOCTET * buffer; /* start of buffer */
JOCTET buffer[OUTPUT_BUF_SIZE]; /* output buffer */
} my_destination_mgr;
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 */
@@ -65,10 +65,6 @@ init_destination (j_compress_ptr cinfo)
{
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.free_in_buffer = OUTPUT_BUF_SIZE;
}
@@ -187,8 +183,8 @@ term_mem_destination (j_compress_ptr cinfo)
/*
* Prepare for output to a stdio stream.
* The caller must have already opened the stream, and is responsible
* for closing it after finishing compression.
* The caller must have already opened the stream,
* and is responsible for closing it after finishing compression.
*/
GLOBAL(void)
+10 -13
View File
@@ -2,7 +2,7 @@
* jdatasrc.c
*
* 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.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -23,18 +23,18 @@
/* Expanded data source object for stdio input */
#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */
typedef struct {
struct jpeg_source_mgr pub; /* public fields */
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? */
} my_source_mgr;
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
@@ -204,8 +204,8 @@ term_source (j_decompress_ptr cinfo)
/*
* Prepare for input from a stdio stream.
* The caller must have already opened the stream, and is responsible
* for closing it after finishing decompression.
* The caller must have already opened the stream,
* and is responsible for closing it after finishing decompression.
*/
GLOBAL(void)
@@ -213,19 +213,16 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
{
my_src_ptr src;
/* The source object and input buffer are made permanent so that a series
* of JPEG images can be read from the same file by calling jpeg_stdio_src
* only before the first one. (If we discarded the buffer at the end of
* one image, we'd likely lose the start of the next one.)
/* The source object including the input buffer is made permanent so that
* a series of JPEG images can be read from the same file by calling
* jpeg_stdio_src only before the first one. (If we discarded the buffer
* 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
* manager serially with the same JPEG object. Caveat programmer.
*/
if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small)
((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;
+42 -51
View File
@@ -2,7 +2,7 @@
* jdcolor.c
*
* 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.
* 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 */
/* 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;
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.
* 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
* reasonable for 16-bit samples, but if you want lossless storage you
* shouldn't be changing colorspace anyway.
* The Cr=>R and Cb=>B values can be rounded to integers in advance; the
* values for the G calculation are left scaled up, since we must add them
* together before rounding.
* reasonable for 16-bit samples, but if you want lossless storage
* you shouldn't be changing colorspace anyway.
* The Cr=>R and Cb=>B values can be rounded to integers in advance;
* the values for the G calculation are left scaled up,
* since we must add them together before rounding.
*/
#define SCALEBITS 16 /* speediest right-shift on some machines */
#define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
#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.
@@ -249,17 +239,19 @@ LOCAL(void)
build_rgb_y_table (j_decompress_ptr cinfo)
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
INT32 * rgb_y_tab;
INT32 i;
/* Allocate and fill in the conversion tables. */
cconvert->rgb_y_tab = rgb_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_IMAGE, TABLE_SIZE * SIZEOF(INT32));
cconvert->R_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * 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++) {
rgb_y_tab[i+R_Y_OFF] = FIX(0.299) * i;
rgb_y_tab[i+G_Y_OFF] = FIX(0.587) * i;
rgb_y_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
cconvert->R_y_tab[i] = FIX(0.299) * i;
cconvert->G_y_tab[i] = FIX(0.587) * i;
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)
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
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 inptr0, inptr1, inptr2;
register JDIMENSION col;
@@ -288,13 +282,10 @@ rgb_gray_convert (j_decompress_ptr cinfo,
input_row++;
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
r = GETJSAMPLE(inptr0[col]);
g = GETJSAMPLE(inptr1[col]);
b = GETJSAMPLE(inptr2[col]);
/* Y */
outptr[col] = (JSAMPLE)
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
y = Rytab[GETJSAMPLE(inptr0[col])];
y += Gytab[GETJSAMPLE(inptr1[col])];
y += Bytab[GETJSAMPLE(inptr2[col])];
outptr[col] = (JSAMPLE) (y >> SCALEBITS);
}
}
}
@@ -354,7 +345,10 @@ rgb1_gray_convert (j_decompress_ptr cinfo,
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
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 inptr0, inptr1, inptr2;
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
* (modulo) operator is equivalent to the bitmask operator AND.
*/
r = (r + g - CENTERJSAMPLE) & MAXJSAMPLE;
b = (b + g - CENTERJSAMPLE) & MAXJSAMPLE;
/* Y */
outptr[col] = (JSAMPLE)
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
y = Rytab[(r + g - CENTERJSAMPLE) & MAXJSAMPLE];
y += Gytab[g];
y += Bytab[(b + g - CENTERJSAMPLE) & MAXJSAMPLE];
outptr[col] = (JSAMPLE) (y >> SCALEBITS);
}
}
}
@@ -565,8 +557,10 @@ cmyk_yk_convert (j_decompress_ptr cinfo,
JSAMPARRAY output_buf, int num_rows)
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
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 inptr0, inptr1, inptr2, inptr3;
register JDIMENSION col;
@@ -580,13 +574,10 @@ cmyk_yk_convert (j_decompress_ptr cinfo,
input_row++;
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
r = MAXJSAMPLE - GETJSAMPLE(inptr0[col]);
g = MAXJSAMPLE - GETJSAMPLE(inptr1[col]);
b = MAXJSAMPLE - GETJSAMPLE(inptr2[col]);
/* Y */
outptr[0] = (JSAMPLE)
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
>> SCALEBITS);
y = Rytab[MAXJSAMPLE - GETJSAMPLE(inptr0[col])];
y += Gytab[MAXJSAMPLE - GETJSAMPLE(inptr1[col])];
y += Bytab[MAXJSAMPLE - GETJSAMPLE(inptr2[col])];
outptr[0] = (JSAMPLE) (y >> SCALEBITS);
/* K passes through unchanged */
outptr[1] = inptr3[col]; /* don't need GETJSAMPLE here */
outptr += 2;
+2 -2
View File
@@ -2,7 +2,7 @@
* jdct.h
*
* 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.
* 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_5x10 jRD5x10
#define jpeg_idct_4x8 jRD4x8
#define jpeg_idct_3x6 jRD3x8
#define jpeg_idct_3x6 jRD3x6
#define jpeg_idct_2x4 jRD2x4
#define jpeg_idct_1x2 jRD1x2
#endif /* NEED_SHORT_EXTERNAL_NAMES */
+15 -16
View File
@@ -2,7 +2,7 @@
* jdmerge.c
*
* 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.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -20,17 +20,17 @@
* B = Y + K4 * Cb
* 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.
* At typical sampling ratios, this eliminates half or three-quarters of the
* multiplications needed for color conversion.
* At typical sampling ratios, this eliminates half or three-quarters
* of the multiplications needed for color conversion.
*
* This file currently provides implementations for the following cases:
* YCC => RGB color conversion only (YCbCr or BG_YCC).
* Sampling ratios of 2h1v or 2h2v.
* No scaling needed at upsample time.
* Corner-aligned (non-CCIR601) sampling alignment.
* Other special cases could be added, but in most applications these are
* the only common cases. (For uncommon cases we fall back on the more
* general code in jdsample.c and jdcolor.c.)
* Other special cases could be added, but in most applications these
* are the only common cases. (For uncommon cases we fall back on
* the more general code in jdsample.c and jdcolor.c.)
*/
#define JPEG_INTERNALS
@@ -286,9 +286,9 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
/* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
cred = Crrtab[cr];
/* Fetch 2 Y values and emit 2 pixels */
y = GETJSAMPLE(*inptr0++);
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 (cinfo->output_width & 1) {
y = GETJSAMPLE(*inptr0);
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr0);
outptr[RGB_RED] = range_limit[y + cred];
outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue];
outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
outptr[RGB_GREEN] = range_limit[y +
((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
SCALEBITS))];
outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
}
}
@@ -350,9 +349,9 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
/* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
cred = Crrtab[cr];
/* Fetch 4 Y values and emit 4 pixels */
y = GETJSAMPLE(*inptr00++);
outptr0[RGB_RED] = range_limit[y + cred];
@@ -379,9 +378,9 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cred = Crrtab[cr];
cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
cred = Crrtab[cr];
y = GETJSAMPLE(*inptr00);
outptr0[RGB_RED] = range_limit[y + cred];
outptr0[RGB_GREEN] = range_limit[y + cgreen];
+63 -3
View File
@@ -2,7 +2,7 @@
* jinclude.h
*
* 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.
* 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
* you may have to edit this file.)
*
* NOTE: this file is NOT intended to be included by applications using the
* JPEG library. Most applications need only include jpeglib.h.
* NOTE: this file is NOT intended to be included by applications using
* the JPEG library. Most applications need only include jpeglib.h.
*/
@@ -87,11 +87,71 @@
*
* Furthermore, macros are provided for fflush() and ferror() in order
* 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) \
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define JFWRITE(file,buf,sizeofbuf) \
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define JFFLUSH(file) fflush(file)
#define JFERROR(file) ferror(file)
#endif
#endif
+21 -10
View File
@@ -2,7 +2,7 @@
* jmorecfg.h
*
* 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.
* 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_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN) */
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW) */
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
/* 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
@@ -369,8 +369,8 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean;
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? (Requires DCT_ISLOW)*/
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN) */
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? (Requires DCT_ISLOW) */
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
#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.
* 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
* (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.
* #define JPEG_USE_RGB_CUSTOM in jconfig.h, or define your own custom
* order in jconfig.h and #define JPEG_HAVE_RGB_CUSTOM.
* 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:
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
* 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
* can't use color quantization if you change that value.
* is not 3 (they don't understand about dummy color components!).
* 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_GREEN 1 /* Offset of Green */
#define RGB_BLUE 2 /* Offset of Blue */
#endif
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
#endif
/* Definitions for speed-related optimizations. */
+2 -2
View File
@@ -2,7 +2,7 @@
* jpeglib.h
*
* 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.
* 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_MAJOR 9
#define JPEG_LIB_VERSION_MINOR 5
#define JPEG_LIB_VERSION_MINOR 6
/* Various constants determining the sizes of things.
+3 -3
View File
@@ -1,7 +1,7 @@
/*
* 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.
* 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"
+7 -6
View File
@@ -1,6 +1,6 @@
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.
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
"data destination" module. The library includes one data destination
module which knows how to write to a stdio stream. You can use your own
destination module if you want to do something else, as discussed later.
module which knows how to write to memory or to a file (or any stdio stream).
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
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
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 do something else, as discussed later.
to read from memory or from a file (or any stdio stream). You can use your
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
beforehand. Typical code for this step looks like:
@@ -886,7 +887,7 @@ int block_size
Larger values produce higher compression,
smaller values produce higher quality.
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.
Note that values other than 8 require a SmartScale capable decoder,
introduced with IJG JPEG 8. Setting the block_size parameter for
+1 -1
View File
@@ -169,7 +169,7 @@ Switches for advanced users:
Larger values produce higher compression,
smaller values produce higher quality
(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).
CAUTION: An implementation of the JPEG SmartScale
extension is required for this feature. SmartScale
+34 -13
View File
@@ -1,5 +1,5 @@
libpng 1.6.40 - June 21, 2023
=============================
libpng 1.6.43 - February 23, 2024
=================================
This is a public release of libpng, intended for use in production code.
@@ -9,13 +9,13 @@ Files available for download
Source files with LF line endings (for Unix/Linux):
* libpng-1.6.40.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.40.tar.gz
* libpng-1.6.43.tar.xz (LZMA-compressed, recommended)
* libpng-1.6.43.tar.gz (deflate-compressed)
Source files with CRLF line endings (for Windows):
* lpng1640.7z (LZMA-compressed, recommended)
* lpng1640.zip
* lpng1643.7z (LZMA-compressed, recommended)
* lpng1643.zip (deflate-compressed)
Other information:
@@ -25,15 +25,36 @@ Other information:
* TRADEMARK.md
Changes from version 1.6.39 to version 1.6.40
Changes from version 1.6.42 to version 1.6.43
---------------------------------------------
* Fixed the eXIf chunk multiplicity checks.
* Fixed a memory leak in pCAL processing.
* Corrected the validity report about tRNS inside png_get_valid().
* Fixed various build issues on *BSD, Mac and Windows.
* Updated the configurations and the scripts for continuous integration.
* Cleaned up the code, the build scripts, and the documentation.
* Fixed the row width check in png_check_IHDR().
This corrected a bug that was specific to the 16-bit platforms,
and removed a spurious compiler warning from the 64-bit builds.
(Reported by Jacek Caban; fixed by John Bowler)
* Added eXIf chunk support to the push-mode reader in pngpread.c.
(Contributed by Chris Blume)
* Added contrib/pngexif for the benefit of the users who would like
to inspect the content of eXIf chunks.
* Added contrib/conftest/basic.dfa, a basic build-time configuration.
(Contributed by John Bowler)
* Fixed a preprocessor condition in pngread.c that broke build-time
configurations like contrib/conftest/pngcp.dfa.
(Contributed by John Bowler)
* Added CMake build support for LoongArch LSX.
(Contributed by GuXiWei)
* Fixed a CMake build error that occurred under a peculiar state of the
dependency tree. This was a regression introduced in libpng-1.6.41.
(Contributed by Dan Rosser)
* Marked the installed libpng headers as system headers in CMake.
(Contributed by Benjamin Buch)
* Updated the build support for RISCOS.
(Contributed by Cameron Cawley)
* Updated the makefiles to allow cross-platform builds to initialize
conventional make variables like AR and ARFLAGS.
* Added various improvements to the CI scripts in areas like version
consistency verification and text linting.
* Added version consistency verification to pngtest.c also.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
+67
View File
@@ -6129,6 +6129,73 @@ Version 1.6.40 [June 21, 2023]
Updated the configurations and the scripts for continuous integration.
Cleaned up the code, the build scripts, and the documentation.
Version 1.6.41 [January 24, 2024]
Added SIMD-optimized code for the LoongArch LSX hardware.
(Contributed by GuXiWei, JinBo and ZhangLixia)
Fixed the run-time discovery of MIPS MSA hardware.
(Contributed by Sui Jingfeng)
Fixed an off-by-one error in the function png_do_check_palette_indexes(),
which failed to recognize errors that might have existed in the first
column of a broken palette-encoded image. This was a benign regression
accidentally introduced in libpng-1.6.33. No pixel was harmed.
(Contributed by Adam Richter; reviewed by John Bowler)
Fixed, improved and modernized the contrib/pngminus programs, i.e.,
png2pnm.c and pnm2png.c
Removed old and peculiar portability hacks that were meant to silence
warnings issued by gcc version 7.1 alone.
(Contributed by John Bowler)
Fixed and modernized the CMake file, and raised the minimum required
CMake version from 3.1 to 3.6.
(Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
Allowed the configure script to disable the building of auxiliary tools
and tests, thus catching up with the CMake file.
(Contributed by Carlo Bramini)
Fixed a build issue on Mac.
(Contributed by Zixu Wang)
Moved the Autoconf macro files to scripts/autoconf.
Moved the CMake files (except for the main CMakeLists.txt) to
scripts/cmake and moved the list of their contributing authors to
scripts/cmake/AUTHORS.md
Updated the CI configurations and scripts.
Relicensed the CI scripts to the MIT License.
Improved the test coverage.
(Contributed by John Bowler)
Version 1.6.42 [January 29, 2024]
Fixed the implementation of the macro function png_check_sig().
This was an API regression, introduced in libpng-1.6.41.
(Reported by Matthieu Darbois)
Fixed and updated the libpng manual.
Version 1.6.43 [February 23, 2024]
Fixed the row width check in png_check_IHDR().
This corrected a bug that was specific to the 16-bit platforms,
and removed a spurious compiler warning from the 64-bit builds.
(Reported by Jacek Caban; fixed by John Bowler)
Added eXIf chunk support to the push-mode reader in pngpread.c.
(Contributed by Chris Blume)
Added contrib/pngexif for the benefit of the users who would like
to inspect the content of eXIf chunks.
Added contrib/conftest/basic.dfa, a basic build-time configuration.
(Contributed by John Bowler)
Fixed a preprocessor condition in pngread.c that broke build-time
configurations like contrib/conftest/pngcp.dfa.
(Contributed by John Bowler)
Added CMake build support for LoongArch LSX.
(Contributed by GuXiWei)
Fixed a CMake build error that occurred under a peculiar state of the
dependency tree. This was a regression introduced in libpng-1.6.41.
(Contributed by Dan Rosser)
Marked the installed libpng headers as system headers in CMake.
(Contributed by Benjamin Buch)
Updated the build support for RISCOS.
(Contributed by Cameron Cawley)
Updated the makefiles to allow cross-platform builds to initialize
conventional make variables like AR and ARFLAGS.
Added various improvements to the CI scripts in areas like version
consistency verification and text linting.
Added version consistency verification to pngtest.c also.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
+22 -22
View File
@@ -1,7 +1,7 @@
#
# PNG library CMake configuration for the Fast Light Toolkit (FLTK).
#
# Copyright 1998-2023 by Bill Spitzak and others.
# Copyright 1998-2024 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
@@ -15,7 +15,7 @@
#
# source files for png
set (PNG_SRCS
set(PNG_SRCS
png.c
pngerror.c
pngget.c
@@ -36,8 +36,8 @@ set (PNG_SRCS
#######################################################################
# Note: This file is used only if we build the bundled PNG library,
# and if we do this we MUST also build and use the *bundled* ZLIB,
# hence we MUST also link against the bundled ZLIB (see below).
# There's no need to check which ZLIB version to use in this context.
# hence we also link against the bundled ZLIB. Therefore there's
# no need to check which ZLIB version to use in this context.
#######################################################################
#######################################################################
@@ -49,31 +49,31 @@ set (PNG_SRCS
# compile these files even if this results in some warnings.
# This includes all non-macOS platforms.
if (CMAKE_OSX_ARCHITECTURES)
string (REGEX MATCH "arm64" is_arm "${CMAKE_OSX_ARCHITECTURES}")
else ()
set (is_arm TRUE)
endif ()
if(CMAKE_OSX_ARCHITECTURES)
string(REGEX MATCH "arm64" is_arm "${CMAKE_OSX_ARCHITECTURES}")
else()
set(is_arm TRUE)
endif()
if (is_arm)
LIST (APPEND PNG_SRCS
arm/arm_init.c
arm/filter_neon_intrinsics.c
arm/palette_neon_intrinsics.c
if(is_arm)
list(APPEND PNG_SRCS
arm/arm_init.c
arm/filter_neon_intrinsics.c
arm/palette_neon_intrinsics.c
)
endif ()
endif()
unset (is_arm)
unset(is_arm)
#######################################################################
# Build some files on ppc64
# We compile these files whatever the architecture resulting in void code
# on non-ppc64 architectures.
# Build some files on ppc64.
# We compile these files whatever the architecture resulting in
# void code on non-ppc64 architectures.
#######################################################################
LIST (APPEND PNG_SRCS
powerpc/powerpc_init.c
powerpc/filter_vsx_intrinsics.c
list(APPEND PNG_SRCS
powerpc/powerpc_init.c
powerpc/filter_vsx_intrinsics.c
)
#######################################################################
+2 -2
View File
@@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
PNG Reference Library License version 2
---------------------------------------
* Copyright (c) 1995-2023 The PNG Reference Library Authors.
* Copyright (c) 2018-2023 Cosmin Truta.
* Copyright (c) 1995-2024 The PNG Reference Library Authors.
* Copyright (c) 2018-2024 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+7 -5
View File
@@ -1,4 +1,4 @@
README for libpng version 1.6.40
README for libpng version 1.6.43
================================
See the note about version numbers near the top of `png.h`.
@@ -142,10 +142,11 @@ Files included in this distribution
pngwrite.c => High-level write functions
pngwtran.c => Write data transformations
pngwutil.c => Write utility functions
arm/ => Optimized code for the ARM platform
intel/ => Optimized code for the INTEL-SSE2 platform
mips/ => Optimized code for the MIPS platform
powerpc/ => Optimized code for the PowerPC platform
arm/ => Optimized code for ARM Neon
intel/ => Optimized code for INTEL SSE2
loongarch/ => Optimized code for LoongArch LSX
mips/ => Optimized code for MIPS MSA and MIPS MMI
powerpc/ => Optimized code for PowerPC VSX
ci/ => Scripts for continuous integration
contrib/ => External contributions
arm-neon/ => Optimized code for the ARM-NEON platform
@@ -158,6 +159,7 @@ Files included in this distribution
libtests/ => Test programs
oss-fuzz/ => Files used by the OSS-Fuzz project for fuzz-testing
libpng
pngexif/ => Program to inspect the EXIF information in PNG files
pngminim/ => Minimal decoder, encoder, and progressive decoder
programs demonstrating the use of pngusr.dfa
pngminus/ => Simple pnm2png and png2pnm programs
+69 -78
View File
@@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
Copyright (c) 2018-2023 Cosmin Truta
Copyright (c) 2018-2024 Cosmin Truta
Copyright (c) 1998-2018 Glenn Randers-Pehrson
This document is released under the libpng license.
@@ -9,9 +9,9 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng version 1.6.36, December 2018, through 1.6.40 - June 2023
libpng version 1.6.36, December 2018, through 1.6.43 - February 2024
Updated and distributed by Cosmin Truta
Copyright (c) 2018-2023 Cosmin Truta
Copyright (c) 2018-2024 Cosmin Truta
libpng versions 0.97, January 1998, through 1.6.35 - July 2018
Updated and distributed by Glenn Randers-Pehrson
@@ -357,7 +357,7 @@ Customizing libpng.
return ERROR;
}
is_png = !png_sig_cmp(header, 0, number);
is_png = (png_sig_cmp(header, 0, number) == 0);
if (!is_png)
{
return NOT_PNG;
@@ -385,8 +385,7 @@ create the structure, so your application should check for that.
if (!info_ptr)
{
png_destroy_read_struct(&png_ptr,
(png_infopp)NULL, (png_infopp)NULL);
png_destroy_read_struct(&png_ptr, NULL, NULL);
return ERROR;
}
@@ -419,14 +418,13 @@ free any memory.
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr,
&end_info);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
fclose(fp);
return ERROR;
}
Pass (png_infopp)NULL instead of &end_info if you didn't create
an end_info structure.
Pass NULL instead of &end_info if you didn't create an end_info
structure.
If you would rather avoid the complexity of setjmp/longjmp issues,
you can compile libpng with PNG_NO_SETJMP, in which case
@@ -496,7 +494,7 @@ You can set up a callback function to handle any unknown chunks in the
input stream. You must supply the function
read_chunk_callback(png_structp png_ptr,
png_unknown_chunkp chunk);
png_unknown_chunkp chunk)
{
/* The unknown chunk structure contains your
chunk data, along with similar data for any other
@@ -547,9 +545,9 @@ a progress meter or the like. It's demonstrated in pngtest.c.
You must supply a function
void read_row_callback(png_structp png_ptr,
png_uint_32 row, int pass);
png_uint_32 row, int pass)
{
/* put your code here */
/* put your code here */
}
(You can give it another name that you like instead of "read_row_callback")
@@ -1180,22 +1178,22 @@ where row_pointers is an array of pointers to the pixel data for each row:
If you know your image size and pixel size ahead of time, you can allocate
row_pointers prior to calling png_read_png() with
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
png_error (png_ptr,
if (height > PNG_UINT_32_MAX / (sizeof (png_bytep)))
png_error(png_ptr,
"Image is too tall to process in memory");
if (width > PNG_UINT_32_MAX/pixel_size)
png_error (png_ptr,
if (width > PNG_UINT_32_MAX / pixel_size)
png_error(png_ptr,
"Image is too wide to process in memory");
row_pointers = png_malloc(png_ptr,
height*(sizeof (png_bytep)));
for (int i=0; i<height, i++)
row_pointers[i]=NULL; /* security precaution */
for (int i = 0; i < height, i++)
row_pointers[i] = NULL; /* security precaution */
for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr,
for (int i = 0; i < height, i++)
row_pointers[i] = png_malloc(png_ptr,
width*pixel_size);
png_set_rows(png_ptr, info_ptr, &row_pointers);
@@ -1205,14 +1203,14 @@ row_pointers[i] to point into the proper places in your block, but first
be sure that your platform is able to allocate such a large buffer:
/* Guard against integer overflow */
if (height > PNG_SIZE_MAX/(width*pixel_size)) {
png_error(png_ptr,"image_data buffer would be too large");
}
if (height > PNG_SIZE_MAX/(width*pixel_size))
png_error(png_ptr, "image_data buffer would be too large");
png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size);
png_bytep buffer = png_malloc(png_ptr,
height*width*pixel_size);
for (int i=0; i<height, i++)
row_pointers[i]=buffer+i*width*pixel_size;
for (int i = 0; i < height, i++)
row_pointers[i] = buffer + i*width*pixel_size;
png_set_rows(png_ptr, info_ptr, &row_pointers);
@@ -1465,25 +1463,24 @@ png_set_rgb_to_gray()).
non-paletted images (PNG_INFO_tRNS)
png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif);
(PNG_INFO_eXIf)
exif - Exif profile (array of png_byte)
(PNG_INFO_eXIf)
png_get_hIST(png_ptr, info_ptr, &hist);
(PNG_INFO_hIST)
hist - histogram of palette (array of
png_uint_16)
png_uint_16) (PNG_INFO_hIST)
png_get_tIME(png_ptr, info_ptr, &mod_time);
mod_time - time image was last modified
(PNG_VALID_tIME)
(PNG_INFO_tIME)
png_get_bKGD(png_ptr, info_ptr, &background);
background - background color (of type
png_color_16p) (PNG_VALID_bKGD)
png_color_16p) (PNG_INFO_bKGD)
valid 16-bit red, green and blue
values, regardless of color_type
@@ -1743,13 +1740,13 @@ grayscale images with bit depths of 2 or 4 or if there is a multiple-image
viewing application that wishes to treat all images in the same way.
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ptr);
png_set_palette_to_rgb(png_ptr);
if (png_get_valid(png_ptr, info_ptr,
PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY &&
bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_expand_gray_1_2_4_to_8(png_ptr);
The first two functions are actually aliases for png_set_expand(), added
in libpng version 1.0.4, with the function names expanded to improve code
@@ -1764,18 +1761,20 @@ png_set_expand(); however, the resultant channels have 16 bits rather than 8.
Use this when the output color or gray channels are made linear to avoid fairly
severe accuracy loss.
if (bit_depth < 16)
png_set_expand_16(png_ptr);
if (bit_depth < 16)
png_set_expand_16(png_ptr);
PNG can have files with 16 bits per channel. If you only can handle
8 bits per channel, this will strip the pixels down to 8-bit.
if (bit_depth == 16)
{
#if PNG_LIBPNG_VER >= 10504
png_set_scale_16(png_ptr);
#else
png_set_strip_16(png_ptr);
#endif
}
(The more accurate "png_set_scale_16()" API became available in libpng version
1.5.4).
@@ -1901,7 +1900,7 @@ Note that png_set_filler() does not change the color type. If you want
to do that, you can add a true alpha channel with
if (color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_GRAY)
color_type == PNG_COLOR_TYPE_GRAY)
png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER);
where "filler" contains the alpha value to assign to each pixel.
@@ -1926,7 +1925,7 @@ with alpha.
if (color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
png_set_rgb_to_gray(png_ptr, error_action,
double red_weight, double green_weight);
(double)red_weight, (double)green_weight);
error_action = 1: silently do the conversion
@@ -1949,8 +1948,8 @@ In the corresponding fixed point API the red_weight and green_weight values are
simply scaled by 100,000:
png_set_rgb_to_gray(png_ptr, error_action,
png_fixed_point red_weight,
png_fixed_point green_weight);
(png_fixed_point)red_weight,
(png_fixed_point)green_weight);
If you have set error_action = 1 or 2, you can
later check whether the image really was gray, after processing
@@ -2186,9 +2185,8 @@ do your own check for number_of_rows*width*pixel_size if you are using
a multiple-row buffer:
/* Guard against integer overflow */
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) {
png_error(png_ptr,"image_data buffer would be too large");
}
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size))
png_error(png_ptr, "image_data buffer would be too large");
Remember: Before you call png_read_update_info(), the png_get_*()
functions return the values corresponding to the original PNG image.
@@ -2408,12 +2406,11 @@ separate.
if (!end_info)
{
png_destroy_read_struct(&png_ptr, &info_ptr,
(png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return ERROR;
}
png_read_end(png_ptr, end_info);
png_read_end(png_ptr, end_info);
If you are not interested, you should still call png_read_end()
but you can pass NULL, avoiding the need to create an end_info structure.
@@ -2421,7 +2418,7 @@ If you do this, libpng will not process any chunks after IDAT other than
skipping over them and perhaps (depending on whether you have called
png_set_crc_action) checking their CRCs while looking for the IEND chunk.
png_read_end(png_ptr, (png_infop)NULL);
png_read_end(png_ptr, NULL);
If you don't call png_read_end(), then your file pointer will be
left pointing to the first chunk after the last IDAT, which is probably
@@ -2430,13 +2427,11 @@ the PNG datastream.
When you are done, you can free all memory allocated by libpng like this:
png_destroy_read_struct(&png_ptr, &info_ptr,
&end_info);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
or, if you didn't create an end_info structure,
png_destroy_read_struct(&png_ptr, &info_ptr,
(png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
It is also possible to individually free the info_ptr members that
point to libpng-allocated storage with the following function:
@@ -2556,15 +2551,13 @@ png_infop info_ptr;
if (!info_ptr)
{
png_destroy_read_struct(&png_ptr,
(png_infopp)NULL, (png_infopp)NULL);
png_destroy_read_struct(&png_ptr, NULL, NULL);
return ERROR;
}
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr,
(png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return ERROR;
}
@@ -2597,8 +2590,7 @@ png_infop info_ptr;
{
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr,
(png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return ERROR;
}
@@ -2763,8 +2755,7 @@ both "png_ptr"; you can call them anything you like, such as
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
png_destroy_write_struct(&png_ptr,
(png_infopp)NULL);
png_destroy_write_struct(&png_ptr, NULL);
return ERROR;
}
@@ -2790,7 +2781,7 @@ section below for more information on the libpng error handling.
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_write_struct(&png_ptr, &info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);
return ERROR;
}
@@ -2844,9 +2835,9 @@ a progress meter or the like. It's demonstrated in pngtest.c.
You must supply a function
void write_row_callback(png_structp png_ptr, png_uint_32 row,
int pass);
int pass)
{
/* put your code here */
/* put your code here */
}
(You can give it another name that you like instead of "write_row_callback")
@@ -3116,8 +3107,8 @@ width, height, bit_depth, and color_type must be the same in each call.
png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif);
exif - Exif profile (array of
png_byte) (PNG_INFO_eXIf)
exif - Exif profile (array of png_byte)
(PNG_INFO_eXIf)
png_set_hIST(png_ptr, info_ptr, hist);
@@ -3127,12 +3118,12 @@ width, height, bit_depth, and color_type must be the same in each call.
png_set_tIME(png_ptr, info_ptr, mod_time);
mod_time - time image was last modified
(PNG_VALID_tIME)
(PNG_INFO_tIME)
png_set_bKGD(png_ptr, info_ptr, background);
background - background color (of type
png_color_16p) (PNG_VALID_bKGD)
png_color_16p) (PNG_INFO_bKGD)
png_set_text(png_ptr, info_ptr, text_ptr, num_text);
@@ -4218,7 +4209,7 @@ png_create_read_struct_2() or png_create_write_struct_2() to register your
own functions as described above. These functions also provide a void
pointer that can be retrieved via
mem_ptr=png_get_mem_ptr(png_ptr);
mem_ptr = png_get_mem_ptr(png_ptr);
Your replacement memory functions must have prototypes as follows:
@@ -4515,7 +4506,7 @@ When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
can still use PNG_DEBUG to control your own debugging:
#ifdef PNG_DEBUG
fprintf(stderr, ...
fprintf(stderr, ...);
#endif
When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
@@ -4692,7 +4683,7 @@ deprecated since libpng-1.0.16 and libpng-1.2.6.
The function
png_check_sig(sig, num)
was replaced with
!png_sig_cmp(sig, 0, num)
png_sig_cmp(sig, 0, num) == 0
It has been deprecated since libpng-0.90.
The function
@@ -4756,8 +4747,8 @@ png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(),
png_set_asm_flags(), and png_mmx_supported()
We removed the obsolete png_check_sig(), png_memcpy_check(), and
png_memset_check() functions. Instead use !png_sig_cmp(), memcpy(),
and memset(), respectively.
png_memset_check() functions. Instead use png_sig_cmp() == 0,
memcpy(), and memset(), respectively.
The function png_set_gray_1_2_4_to_8() was removed. It has been
deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
@@ -5239,7 +5230,7 @@ changed, and is unaffected by conditional compilation macros. It is the
best choice for use in configure scripts for detecting the presence of any
libpng version since 0.88. In an autoconf "configure.in" you could use
AC_CHECK_LIB(png, png_get_io_ptr, ...
AC_CHECK_LIB(png, png_get_io_ptr, ...)
XV. Source code repository
@@ -5248,12 +5239,12 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
going back to version 0.70. You can access the git repository (read only)
at
https://github.com/glennrp/libpng or
https://github.com/pnggroup/libpng or
https://git.code.sf.net/p/libpng/code.git
or you can browse it with a web browser at
https://github.com/glennrp/libpng or
https://github.com/pnggroup/libpng or
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
Patches can be sent to png-mng-implement at lists.sourceforge.net or
@@ -5263,7 +5254,7 @@ uploaded to the libpng bug tracker at
or as a "pull request" to
https://github.com/glennrp/libpng/pulls
https://github.com/pnggroup/libpng/pulls
We also accept patches built from the tar or zip distributions, and
simple verbal descriptions of bug fixes, reported either to the
+71 -80
View File
@@ -1,6 +1,6 @@
.TH LIBPNG 3 "June 21, 2023"
.TH LIBPNG 3 "February 23, 2024"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.40
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.43
.SH SYNOPSIS
\fB#include <png.h>\fP
@@ -519,7 +519,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
Copyright (c) 2018-2023 Cosmin Truta
Copyright (c) 2018-2024 Cosmin Truta
Copyright (c) 1998-2018 Glenn Randers-Pehrson
This document is released under the libpng license.
@@ -528,9 +528,9 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng version 1.6.36, December 2018, through 1.6.40 - June 2023
libpng version 1.6.36, December 2018, through 1.6.43 - February 2024
Updated and distributed by Cosmin Truta
Copyright (c) 2018-2023 Cosmin Truta
Copyright (c) 2018-2024 Cosmin Truta
libpng versions 0.97, January 1998, through 1.6.35 - July 2018
Updated and distributed by Glenn Randers-Pehrson
@@ -876,7 +876,7 @@ Customizing libpng.
return ERROR;
}
is_png = !png_sig_cmp(header, 0, number);
is_png = (png_sig_cmp(header, 0, number) == 0);
if (!is_png)
{
return NOT_PNG;
@@ -904,8 +904,7 @@ create the structure, so your application should check for that.
if (!info_ptr)
{
png_destroy_read_struct(&png_ptr,
(png_infopp)NULL, (png_infopp)NULL);
png_destroy_read_struct(&png_ptr, NULL, NULL);
return ERROR;
}
@@ -938,14 +937,13 @@ free any memory.
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr,
&end_info);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
fclose(fp);
return ERROR;
}
Pass (png_infopp)NULL instead of &end_info if you didn't create
an end_info structure.
Pass NULL instead of &end_info if you didn't create an end_info
structure.
If you would rather avoid the complexity of setjmp/longjmp issues,
you can compile libpng with PNG_NO_SETJMP, in which case
@@ -1015,7 +1013,7 @@ You can set up a callback function to handle any unknown chunks in the
input stream. You must supply the function
read_chunk_callback(png_structp png_ptr,
png_unknown_chunkp chunk);
png_unknown_chunkp chunk)
{
/* The unknown chunk structure contains your
chunk data, along with similar data for any other
@@ -1066,9 +1064,9 @@ a progress meter or the like. It's demonstrated in pngtest.c.
You must supply a function
void read_row_callback(png_structp png_ptr,
png_uint_32 row, int pass);
png_uint_32 row, int pass)
{
/* put your code here */
/* put your code here */
}
(You can give it another name that you like instead of "read_row_callback")
@@ -1699,22 +1697,22 @@ where row_pointers is an array of pointers to the pixel data for each row:
If you know your image size and pixel size ahead of time, you can allocate
row_pointers prior to calling png_read_png() with
if (height > PNG_UINT_32_MAX/(sizeof (png_byte)))
png_error (png_ptr,
if (height > PNG_UINT_32_MAX / (sizeof (png_bytep)))
png_error(png_ptr,
"Image is too tall to process in memory");
if (width > PNG_UINT_32_MAX/pixel_size)
png_error (png_ptr,
if (width > PNG_UINT_32_MAX / pixel_size)
png_error(png_ptr,
"Image is too wide to process in memory");
row_pointers = png_malloc(png_ptr,
height*(sizeof (png_bytep)));
for (int i=0; i<height, i++)
row_pointers[i]=NULL; /* security precaution */
for (int i = 0; i < height, i++)
row_pointers[i] = NULL; /* security precaution */
for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr,
for (int i = 0; i < height, i++)
row_pointers[i] = png_malloc(png_ptr,
width*pixel_size);
png_set_rows(png_ptr, info_ptr, &row_pointers);
@@ -1724,14 +1722,14 @@ row_pointers[i] to point into the proper places in your block, but first
be sure that your platform is able to allocate such a large buffer:
/* Guard against integer overflow */
if (height > PNG_SIZE_MAX/(width*pixel_size)) {
png_error(png_ptr,"image_data buffer would be too large");
}
if (height > PNG_SIZE_MAX/(width*pixel_size))
png_error(png_ptr, "image_data buffer would be too large");
png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size);
png_bytep buffer = png_malloc(png_ptr,
height*width*pixel_size);
for (int i=0; i<height, i++)
row_pointers[i]=buffer+i*width*pixel_size;
for (int i = 0; i < height, i++)
row_pointers[i] = buffer + i*width*pixel_size;
png_set_rows(png_ptr, info_ptr, &row_pointers);
@@ -1984,25 +1982,24 @@ png_set_rgb_to_gray()).
non-paletted images (PNG_INFO_tRNS)
png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif);
(PNG_INFO_eXIf)
exif - Exif profile (array of png_byte)
(PNG_INFO_eXIf)
png_get_hIST(png_ptr, info_ptr, &hist);
(PNG_INFO_hIST)
hist - histogram of palette (array of
png_uint_16)
png_uint_16) (PNG_INFO_hIST)
png_get_tIME(png_ptr, info_ptr, &mod_time);
mod_time - time image was last modified
(PNG_VALID_tIME)
(PNG_INFO_tIME)
png_get_bKGD(png_ptr, info_ptr, &background);
background - background color (of type
png_color_16p) (PNG_VALID_bKGD)
png_color_16p) (PNG_INFO_bKGD)
valid 16-bit red, green and blue
values, regardless of color_type
@@ -2262,13 +2259,13 @@ grayscale images with bit depths of 2 or 4 or if there is a multiple-image
viewing application that wishes to treat all images in the same way.
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ptr);
png_set_palette_to_rgb(png_ptr);
if (png_get_valid(png_ptr, info_ptr,
PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY &&
bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_expand_gray_1_2_4_to_8(png_ptr);
The first two functions are actually aliases for png_set_expand(), added
in libpng version 1.0.4, with the function names expanded to improve code
@@ -2283,18 +2280,20 @@ png_set_expand(); however, the resultant channels have 16 bits rather than 8.
Use this when the output color or gray channels are made linear to avoid fairly
severe accuracy loss.
if (bit_depth < 16)
png_set_expand_16(png_ptr);
if (bit_depth < 16)
png_set_expand_16(png_ptr);
PNG can have files with 16 bits per channel. If you only can handle
8 bits per channel, this will strip the pixels down to 8-bit.
if (bit_depth == 16)
{
#if PNG_LIBPNG_VER >= 10504
png_set_scale_16(png_ptr);
#else
png_set_strip_16(png_ptr);
#endif
}
(The more accurate "png_set_scale_16()" API became available in libpng version
1.5.4).
@@ -2420,7 +2419,7 @@ Note that png_set_filler() does not change the color type. If you want
to do that, you can add a true alpha channel with
if (color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_GRAY)
color_type == PNG_COLOR_TYPE_GRAY)
png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER);
where "filler" contains the alpha value to assign to each pixel.
@@ -2445,7 +2444,7 @@ with alpha.
if (color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
png_set_rgb_to_gray(png_ptr, error_action,
double red_weight, double green_weight);
(double)red_weight, (double)green_weight);
error_action = 1: silently do the conversion
@@ -2468,8 +2467,8 @@ In the corresponding fixed point API the red_weight and green_weight values are
simply scaled by 100,000:
png_set_rgb_to_gray(png_ptr, error_action,
png_fixed_point red_weight,
png_fixed_point green_weight);
(png_fixed_point)red_weight,
(png_fixed_point)green_weight);
If you have set error_action = 1 or 2, you can
later check whether the image really was gray, after processing
@@ -2705,9 +2704,8 @@ do your own check for number_of_rows*width*pixel_size if you are using
a multiple-row buffer:
/* Guard against integer overflow */
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) {
png_error(png_ptr,"image_data buffer would be too large");
}
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size))
png_error(png_ptr, "image_data buffer would be too large");
Remember: Before you call png_read_update_info(), the png_get_*()
functions return the values corresponding to the original PNG image.
@@ -2927,12 +2925,11 @@ separate.
if (!end_info)
{
png_destroy_read_struct(&png_ptr, &info_ptr,
(png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return ERROR;
}
png_read_end(png_ptr, end_info);
png_read_end(png_ptr, end_info);
If you are not interested, you should still call png_read_end()
but you can pass NULL, avoiding the need to create an end_info structure.
@@ -2940,7 +2937,7 @@ If you do this, libpng will not process any chunks after IDAT other than
skipping over them and perhaps (depending on whether you have called
png_set_crc_action) checking their CRCs while looking for the IEND chunk.
png_read_end(png_ptr, (png_infop)NULL);
png_read_end(png_ptr, NULL);
If you don't call png_read_end(), then your file pointer will be
left pointing to the first chunk after the last IDAT, which is probably
@@ -2949,13 +2946,11 @@ the PNG datastream.
When you are done, you can free all memory allocated by libpng like this:
png_destroy_read_struct(&png_ptr, &info_ptr,
&end_info);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
or, if you didn't create an end_info structure,
png_destroy_read_struct(&png_ptr, &info_ptr,
(png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
It is also possible to individually free the info_ptr members that
point to libpng-allocated storage with the following function:
@@ -3075,15 +3070,13 @@ png_infop info_ptr;
if (!info_ptr)
{
png_destroy_read_struct(&png_ptr,
(png_infopp)NULL, (png_infopp)NULL);
png_destroy_read_struct(&png_ptr, NULL, NULL);
return ERROR;
}
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr,
(png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return ERROR;
}
@@ -3116,8 +3109,7 @@ png_infop info_ptr;
{
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr,
(png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return ERROR;
}
@@ -3282,8 +3274,7 @@ both "png_ptr"; you can call them anything you like, such as
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
{
png_destroy_write_struct(&png_ptr,
(png_infopp)NULL);
png_destroy_write_struct(&png_ptr, NULL);
return ERROR;
}
@@ -3309,7 +3300,7 @@ section below for more information on the libpng error handling.
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_write_struct(&png_ptr, &info_ptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);
return ERROR;
}
@@ -3363,9 +3354,9 @@ a progress meter or the like. It's demonstrated in pngtest.c.
You must supply a function
void write_row_callback(png_structp png_ptr, png_uint_32 row,
int pass);
int pass)
{
/* put your code here */
/* put your code here */
}
(You can give it another name that you like instead of "write_row_callback")
@@ -3635,8 +3626,8 @@ width, height, bit_depth, and color_type must be the same in each call.
png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif);
exif - Exif profile (array of
png_byte) (PNG_INFO_eXIf)
exif - Exif profile (array of png_byte)
(PNG_INFO_eXIf)
png_set_hIST(png_ptr, info_ptr, hist);
@@ -3646,12 +3637,12 @@ width, height, bit_depth, and color_type must be the same in each call.
png_set_tIME(png_ptr, info_ptr, mod_time);
mod_time - time image was last modified
(PNG_VALID_tIME)
(PNG_INFO_tIME)
png_set_bKGD(png_ptr, info_ptr, background);
background - background color (of type
png_color_16p) (PNG_VALID_bKGD)
png_color_16p) (PNG_INFO_bKGD)
png_set_text(png_ptr, info_ptr, text_ptr, num_text);
@@ -4737,7 +4728,7 @@ png_create_read_struct_2() or png_create_write_struct_2() to register your
own functions as described above. These functions also provide a void
pointer that can be retrieved via
mem_ptr=png_get_mem_ptr(png_ptr);
mem_ptr = png_get_mem_ptr(png_ptr);
Your replacement memory functions must have prototypes as follows:
@@ -5034,7 +5025,7 @@ When PNG_DEBUG is defined but is zero, the macros aren't defined, but you
can still use PNG_DEBUG to control your own debugging:
#ifdef PNG_DEBUG
fprintf(stderr, ...
fprintf(stderr, ...);
#endif
When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
@@ -5211,7 +5202,7 @@ deprecated since libpng-1.0.16 and libpng-1.2.6.
The function
png_check_sig(sig, num)
was replaced with
!png_sig_cmp(sig, 0, num)
png_sig_cmp(sig, 0, num) == 0
It has been deprecated since libpng-0.90.
The function
@@ -5275,8 +5266,8 @@ png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(),
png_set_asm_flags(), and png_mmx_supported()
We removed the obsolete png_check_sig(), png_memcpy_check(), and
png_memset_check() functions. Instead use !png_sig_cmp(), memcpy(),
and memset(), respectively.
png_memset_check() functions. Instead use png_sig_cmp() == 0,
memcpy(), and memset(), respectively.
The function png_set_gray_1_2_4_to_8() was removed. It has been
deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
@@ -5758,7 +5749,7 @@ changed, and is unaffected by conditional compilation macros. It is the
best choice for use in configure scripts for detecting the presence of any
libpng version since 0.88. In an autoconf "configure.in" you could use
AC_CHECK_LIB(png, png_get_io_ptr, ...
AC_CHECK_LIB(png, png_get_io_ptr, ...)
.SH XV. Source code repository
@@ -5767,12 +5758,12 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
going back to version 0.70. You can access the git repository (read only)
at
https://github.com/glennrp/libpng or
https://github.com/pnggroup/libpng or
https://git.code.sf.net/p/libpng/code.git
or you can browse it with a web browser at
https://github.com/glennrp/libpng or
https://github.com/pnggroup/libpng or
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
Patches can be sent to png-mng-implement at lists.sourceforge.net or
@@ -5782,7 +5773,7 @@ uploaded to the libpng bug tracker at
or as a "pull request" to
https://github.com/glennrp/libpng/pulls
https://github.com/pnggroup/libpng/pulls
We also accept patches built from the tar or zip distributions, and
simple verbal descriptions of bug fixes, reported either to the
+2 -2
View File
@@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "June 21, 2023"
.TH LIBPNGPF 3 "February 23, 2024"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.40
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.43
(private functions)
.SH SYNOPSIS
+1 -1
View File
@@ -1,4 +1,4 @@
.TH PNG 5 "June 21, 2023"
.TH PNG 5 "February 23, 2024"
.SH NAME
png \- Portable Network Graphics (PNG) format
+31 -79
View File
@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -14,27 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_40 Your_png_h_is_not_version_1_6_40;
#ifdef __GNUC__
/* The version tests may need to be added to, but the problem warning has
* consistently been fixed in GCC versions which obtain wide-spread release.
* The problem is that many versions of GCC rearrange comparison expressions in
* the optimizer in such a way that the results of the comparison will change
* if signed integer overflow occurs. Such comparisons are not permitted in
* ANSI C90, however GCC isn't clever enough to work out that that do not occur
* below in png_ascii_from_fp and png_muldiv, so it produces a warning with
* -Wextra. Unfortunately this is highly dependent on the optimizer and the
* machine architecture so the warning comes and goes unpredictably and is
* impossible to "fix", even were that a good idea.
*/
#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
#define GCC_STRICT_OVERFLOW 1
#endif /* GNU 7.1.x */
#endif /* GNU */
#ifndef GCC_STRICT_OVERFLOW
#define GCC_STRICT_OVERFLOW 0
#endif
typedef png_libpng_version_1_6_43 Your_png_h_is_not_version_1_6_43;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -73,21 +53,21 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
int PNGAPI
png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
{
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
static const png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
if (num_to_check > 8)
num_to_check = 8;
else if (num_to_check < 1)
return (-1);
return -1;
if (start > 7)
return (-1);
return -1;
if (start + num_to_check > 8)
num_to_check = 8 - start;
return ((int)(memcmp(&sig[start], &png_signature[start], num_to_check)));
return memcmp(&sig[start], &png_signature[start], num_to_check);
}
#endif /* READ */
@@ -447,7 +427,6 @@ png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size),
memset(info_ptr, 0, (sizeof *info_ptr));
}
/* The following API is not called internally */
void PNGAPI
png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
int freer, png_uint_32 mask)
@@ -686,9 +665,9 @@ png_voidp PNGAPI
png_get_io_ptr(png_const_structrp png_ptr)
{
if (png_ptr == NULL)
return (NULL);
return NULL;
return (png_ptr->io_ptr);
return png_ptr->io_ptr;
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@@ -752,7 +731,7 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
{
size_t pos = 0;
char number_buf[5] = ""; /* enough for a four-digit year */ /* FLTK Issue #296 */
char number_buf[5] = {0, 0, 0, 0, 0}; /* enough for a four-digit year */
# define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string))
# define APPEND_NUMBER(format, value)\
@@ -815,8 +794,8 @@ png_get_copyright(png_const_structrp png_ptr)
return PNG_STRING_COPYRIGHT
#else
return PNG_STRING_NEWLINE \
"libpng version 1.6.40" PNG_STRING_NEWLINE \
"Copyright (c) 2018-2023 Cosmin Truta" PNG_STRING_NEWLINE \
"libpng version 1.6.43" PNG_STRING_NEWLINE \
"Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
@@ -977,7 +956,7 @@ png_reset_zstream(png_structrp png_ptr)
return Z_STREAM_ERROR;
/* WARNING: this resets the window bits to the maximum! */
return (inflateReset(&png_ptr->zstream));
return inflateReset(&png_ptr->zstream);
}
#endif /* READ */
@@ -986,7 +965,7 @@ png_uint_32 PNGAPI
png_access_version_number(void)
{
/* Version of *.c files used when building libpng */
return((png_uint_32)PNG_LIBPNG_VER);
return (png_uint_32)PNG_LIBPNG_VER;
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@@ -1842,14 +1821,14 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
}
# ifdef PNG_WARNINGS_SUPPORTED
else
{
char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */
{
char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114 */
pos = png_safecat(message, (sizeof message), pos,
png_format_number(number, number+(sizeof number),
PNG_NUMBER_FORMAT_x, value));
pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */
}
pos = png_safecat(message, (sizeof message), pos,
png_format_number(number, number+(sizeof number),
PNG_NUMBER_FORMAT_x, value));
pos = png_safecat(message, (sizeof message), pos, "h: "); /* +2 = 116 */
}
# endif
/* The 'reason' is an arbitrary message, allow +79 maximum 195 */
pos = png_safecat(message, (sizeof message), pos, reason);
@@ -2532,17 +2511,6 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
#endif /* COLORSPACE */
#ifdef __GNUC__
/* This exists solely to work round a warning from GNU C. */
static int /* PRIVATE */
png_gt(size_t a, size_t b)
{
return a > b;
}
#else
# define png_gt(a,b) ((a) > (b))
#endif
void /* PRIVATE */
png_check_IHDR(png_const_structrp png_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth,
@@ -2564,8 +2532,16 @@ png_check_IHDR(png_const_structrp png_ptr,
error = 1;
}
if (png_gt(((width + 7) & (~7U)),
((PNG_SIZE_MAX
/* The bit mask on the first line below must be at least as big as a
* png_uint_32. "~7U" is not adequate on 16-bit systems because it will
* be an unsigned 16-bit value. Casting to (png_alloc_size_t) makes the
* type of the result at least as bit (in bits) as the RHS of the > operator
* which also avoids a common warning on 64-bit systems that the comparison
* of (png_uint_32) against the constant value on the RHS will always be
* false.
*/
if (((width + 7) & ~(png_alloc_size_t)7) >
(((PNG_SIZE_MAX
- 48 /* big_row_buf hack */
- 1) /* filter byte */
/ 8) /* 8-byte RGBA pixels */
@@ -2891,14 +2867,6 @@ png_pow10(int power)
/* Function to format a floating point value in ASCII with a given
* precision.
*/
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic push
/* The problem arises below with exp_b10, which can never overflow because it
* comes, originally, from frexp and is therefore limited to a range which is
* typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
*/
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
#endif /* GCC_STRICT_OVERFLOW */
void /* PRIVATE */
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
double fp, unsigned int precision)
@@ -3220,10 +3188,6 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
/* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion buffer too small");
}
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic pop
#endif /* GCC_STRICT_OVERFLOW */
# endif /* FLOATING_POINT */
# ifdef PNG_FIXED_POINT_SUPPORTED
@@ -3251,7 +3215,7 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
if (num <= 0x80000000) /* else overflowed */
{
unsigned int ndigits = 0, first = 16 /* flag value */;
char digits[10];
char digits[10] = {0};
while (num)
{
@@ -3336,15 +3300,6 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
* the nearest .00001). Overflow and divide by zero are signalled in
* the result, a boolean - true on success, false on overflow.
*/
#if GCC_STRICT_OVERFLOW /* from above */
/* It is not obvious which comparison below gets optimized in such a way that
* signed overflow would change the result; looking through the code does not
* reveal any tests which have the form GCC complains about, so presumably the
* optimizer is moving an add or subtract into the 'if' somewhere.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
#endif /* GCC_STRICT_OVERFLOW */
int
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
png_int_32 divisor)
@@ -3459,9 +3414,6 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
return 0;
}
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic pop
#endif /* GCC_STRICT_OVERFLOW */
#endif /* READ_GAMMA || INCH_CONVERSIONS */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
+33 -30
View File
@@ -1,9 +1,9 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.6.40
* libpng version 1.6.43
*
* Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -15,7 +15,7 @@
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
* Glenn Randers-Pehrson
* libpng versions 1.6.36, December 2018, through 1.6.40, June 2023:
* libpng versions 1.6.36, December 2018, through 1.6.43, February 2024:
* Cosmin Truta
* See also "Contributing Authors", below.
*/
@@ -27,8 +27,8 @@
* PNG Reference Library License version 2
* ---------------------------------------
*
* * Copyright (c) 1995-2023 The PNG Reference Library Authors.
* * Copyright (c) 2018-2023 Cosmin Truta.
* * Copyright (c) 1995-2024 The PNG Reference Library Authors.
* * Copyright (c) 2018-2024 Cosmin Truta.
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* * Copyright (c) 1996-1997 Andreas Dilger.
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -239,7 +239,7 @@
* ...
* 1.5.30 15 10530 15.so.15.30[.0]
* ...
* 1.6.40 16 10640 16.so.16.40[.0]
* 1.6.43 16 10643 16.so.16.43[.0]
*
* Henceforth the source version will match the shared-library major and
* minor numbers; the shared-library major version number will be used for
@@ -255,9 +255,6 @@
* to the info_ptr or png_ptr members through png.h, and the compiled
* application is loaded with a different version of the library.
*
* DLLNUM will change each time there are forward or backward changes
* in binary compatibility (e.g., when a new feature is added).
*
* See libpng.txt or libpng.3 for more information. The PNG specification
* is available as a W3C Recommendation and as an ISO/IEC Standard; see
* <https://www.w3.org/TR/2003/REC-PNG-20031110/>
@@ -278,19 +275,21 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.40"
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.40 - June 21, 2023\n"
#define PNG_LIBPNG_VER_STRING "1.6.43"
#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
/* The versions of shared library builds should stay in sync, going forward */
#define PNG_LIBPNG_VER_SHAREDLIB 16
#define PNG_LIBPNG_VER_SONUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
#define PNG_LIBPNG_VER_DLLNUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 40
#define PNG_LIBPNG_VER_RELEASE 43
/* This should be zero for a public release, or non-zero for a
* development version. [Deprecated]
* development version.
*/
#define PNG_LIBPNG_VER_BUILD 0
@@ -318,7 +317,7 @@
* From version 1.0.1 it is:
* XXYYZZ, where XX=major, YY=minor, ZZ=release
*/
#define PNG_LIBPNG_VER 10640 /* 1.6.40 */
#define PNG_LIBPNG_VER 10643 /* 1.6.43 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@@ -428,7 +427,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef char* png_libpng_version_1_6_40;
typedef char* png_libpng_version_1_6_43;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -849,7 +848,7 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
/* Added to libpng-1.5.4 */
#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
#if INT_MAX >= 0x8000 /* else this might break */
#if ~0U > 0xffffU /* or else this might break on a 16-bit machine */
#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
#endif
@@ -908,15 +907,15 @@ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
* PNG file. Returns zero if the supplied bytes match the 8-byte PNG
* signature, and non-zero otherwise. Having num_to_check == 0 or
* start > 7 will always fail (ie return non-zero).
* start > 7 will always fail (i.e. return non-zero).
*/
PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
size_t num_to_check));
/* Simple signature checking function. This is the same as calling
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
* png_check_sig(sig, n) := (png_sig_cmp(sig, 0, n) == 0).
*/
#define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n))
#define png_check_sig(sig, n) (png_sig_cmp((sig), 0, (n)) == 0) /* DEPRECATED */
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
PNG_EXPORTA(4, png_structp, png_create_read_struct,
@@ -1730,12 +1729,9 @@ PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr));
PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
png_inforp info_ptr, png_uint_32 free_me, int num));
/* Reassign responsibility for freeing existing data, whether allocated
/* Reassign the responsibility for freeing existing data, whether allocated
* by libpng or by the application; this works on the png_info structure passed
* in, it does not change the state for other png_info structures.
*
* It is unlikely that this function works correctly as of 1.6.0 and using it
* may result either in memory leaks or double free of allocated data.
* in, without changing the state for other png_info structures.
*/
PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
png_inforp info_ptr, int freer, png_uint_32 mask));
@@ -3207,11 +3203,18 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
#ifdef PNG_MIPS_MSA_API_SUPPORTED
# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
#endif
#define PNG_IGNORE_ADLER32 8
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions supported */
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
# define PNG_IGNORE_ADLER32 8 /* SOFTWARE: disable Adler32 check on IDAT */
#endif
#define PNG_OPTION_NEXT 12 /* Next option - numbers must be even */
#ifdef PNG_POWERPC_VSX_API_SUPPORTED
# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions
* supported */
#endif
#ifdef PNG_MIPS_MMI_API_SUPPORTED
# define PNG_MIPS_MMI 12 /* HARDWARE: MIPS MMI SIMD instructions supported */
#endif
#define PNG_OPTION_NEXT 14 /* Next option - numbers must be even */
/* Return values: NOTE: there are four values and 'off' is *not* zero */
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
+2 -2
View File
@@ -1,9 +1,9 @@
/* pngconf.h - machine-configurable file for libpng
*
* libpng version 1.6.40
* libpng version 1.6.43
*
* Copyright (c) 2018-2022 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+14 -20
View File
@@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -255,7 +255,7 @@ void
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
png_alloc_size_t value)
{
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0}; /* FLTK Issue #757 */
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
}
@@ -265,7 +265,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
{
png_alloc_size_t u;
png_charp str;
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0}; /* FLTK Issue #757 */
char buffer[PNG_NUMBER_BUFFER_SIZE] = {0};
/* Avoid overflow by doing the negate in a png_alloc_size_t: */
u = (png_alloc_size_t)value;
@@ -858,7 +858,7 @@ png_get_error_ptr(png_const_structrp png_ptr)
if (png_ptr == NULL)
return NULL;
return ((png_voidp)png_ptr->error_ptr);
return (png_voidp)png_ptr->error_ptr;
}
@@ -933,31 +933,25 @@ png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
#endif
int /* PRIVATE */
png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
png_safe_execute(png_imagep image, int (*function)(png_voidp), png_voidp arg)
{
volatile png_imagep image = image_in;
volatile int result;
volatile png_voidp saved_error_buf;
png_voidp saved_error_buf = image->opaque->error_buf;
jmp_buf safe_jmpbuf;
int result;
/* Safely execute function(arg) with png_error returning to this function. */
saved_error_buf = image->opaque->error_buf;
result = setjmp(safe_jmpbuf) == 0;
if (result != 0)
/* Safely execute function(arg), with png_error returning back here. */
if (setjmp(safe_jmpbuf) == 0)
{
image->opaque->error_buf = safe_jmpbuf;
result = function(arg);
image->opaque->error_buf = saved_error_buf;
return result;
}
/* On png_error, return via longjmp, pop the jmpbuf, and free the image. */
image->opaque->error_buf = saved_error_buf;
/* And do the cleanup prior to any failure return. */
if (result == 0)
png_image_free(image);
return result;
png_image_free(image);
return 0;
}
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
#endif /* READ || WRITE */
+126 -119
View File
File diff suppressed because it is too large Load Diff
+8 -3
View File
@@ -9,9 +9,9 @@
/* pnglibconf.h - library build configuration */
/* libpng version 1.6.40 */
/* libpng version 1.6.43 */
/* Copyright (c) 2018-2023 Cosmin Truta */
/* Copyright (c) 2018-2024 Cosmin Truta */
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */
@@ -36,6 +36,7 @@
#define PNG_COLORSPACE_SUPPORTED
#define PNG_CONSOLE_IO_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED
/*#undef PNG_DISABLE_ADLER32_CHECK_SUPPORTED*/
#define PNG_EASY_ACCESS_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
#define PNG_ERROR_TEXT_SUPPORTED
@@ -50,6 +51,10 @@
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
/*#undef PNG_MIPS_MMI_API_SUPPORTED*/
/*#undef PNG_MIPS_MMI_CHECK_SUPPORTED*/
/*#undef PNG_MIPS_MSA_API_SUPPORTED*/
/*#undef PNG_MIPS_MSA_CHECK_SUPPORTED*/
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_POINTER_INDEXING_SUPPORTED
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
@@ -219,7 +224,7 @@
#define PNG_USER_HEIGHT_MAX 1000000
#define PNG_USER_WIDTH_MAX 1000000
#define PNG_ZBUF_SIZE 8192
#define PNG_ZLIB_VERNUM 0x1300
#define PNG_ZLIB_VERNUM 0x1310
#define PNG_Z_DEFAULT_COMPRESSION (-1)
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
#define PNG_Z_DEFAULT_STRATEGY 1
+12 -4
View File
@@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -145,10 +145,10 @@ png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
num_to_check);
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
{
if (num_checked < 4 &&
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0)
png_error(png_ptr, "Not a PNG file");
else
@@ -294,6 +294,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
}
#endif
#ifdef PNG_READ_eXIf_SUPPORTED
else if (png_ptr->chunk_name == png_eXIf)
{
PNG_PUSH_SAVE_BUFFER_IF_FULL
png_handle_eXIf(png_ptr, info_ptr, png_ptr->push_length);
}
#endif
#ifdef PNG_READ_sRGB_SUPPORTED
else if (chunk_name == png_sRGB)
@@ -1089,7 +1097,7 @@ png_voidp PNGAPI
png_get_progressive_ptr(png_const_structrp png_ptr)
{
if (png_ptr == NULL)
return (NULL);
return NULL;
return png_ptr->io_ptr;
}
-15
View File
@@ -1,7 +1,3 @@
/*
* FLTK symbol prefixes for libpng
* This is a generated file: see README.bundled-libs.txt
*/
#define png_sRGB_table fltk_png_sRGB_table
#define png_sRGB_base fltk_png_sRGB_base
#define png_sRGB_delta fltk_png_sRGB_delta
@@ -60,13 +56,6 @@
#define png_do_read_interlace fltk_png_do_read_interlace
#define png_do_write_interlace fltk_png_do_write_interlace
#define png_read_filter_row fltk_png_read_filter_row
#define png_read_filter_row_up_neon fltk_png_read_filter_row_up_neon
#define png_read_filter_row_sub3_neon fltk_png_read_filter_row_sub3_neon
#define png_read_filter_row_sub4_neon fltk_png_read_filter_row_sub4_neon
#define png_read_filter_row_avg3_neon fltk_png_read_filter_row_avg3_neon
#define png_read_filter_row_avg4_neon fltk_png_read_filter_row_avg4_neon
#define png_read_filter_row_paeth3_neon fltk_png_read_filter_row_paeth3_neon
#define png_read_filter_row_paeth4_neon fltk_png_read_filter_row_paeth4_neon
#define png_write_find_filter fltk_png_write_find_filter
#define png_read_IDAT_data fltk_png_read_IDAT_data
#define png_read_finish_IDAT fltk_png_read_finish_IDAT
@@ -170,8 +159,4 @@
#define png_safe_warning fltk_png_safe_warning
#define png_safe_execute fltk_png_safe_execute
#define png_image_error fltk_png_image_error
#define png_init_filter_functions_neon fltk_png_init_filter_functions_neon
#define png_check_keyword fltk_png_check_keyword
#define png_riffle_palette_neon fltk_png_riffle_palette_neon
#define png_do_expand_palette_rgba8_neon fltk_png_do_expand_palette_rgba8_neon
#define png_do_expand_palette_rgb8_neon fltk_png_do_expand_palette_rgb8_neon
+98 -20
View File
@@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
* Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -36,7 +36,7 @@
* still required (as of 2011-05-02.)
*/
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
#endif
#ifndef PNG_VERSION_INFO_ONLY
@@ -190,13 +190,27 @@
#endif /* PNG_ARM_NEON_OPT > 0 */
#ifndef PNG_MIPS_MSA_OPT
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && \
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
# define PNG_MIPS_MSA_OPT 2
# else
# define PNG_MIPS_MSA_OPT 0
# endif
#endif
#ifndef PNG_MIPS_MMI_OPT
# ifdef PNG_MIPS_MMI
# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64) && \
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
# define PNG_MIPS_MMI_OPT 1
# else
# define PNG_MIPS_MMI_OPT 0
# endif
# else
# define PNG_MIPS_MMI_OPT 0
# endif
#endif
#ifndef PNG_POWERPC_VSX_OPT
# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
# define PNG_POWERPC_VSX_OPT 2
@@ -205,13 +219,21 @@
# endif
#endif
#ifndef PNG_LOONGARCH_LSX_OPT
# if defined(__loongarch_sx)
# define PNG_LOONGARCH_LSX_OPT 1
# else
# define PNG_LOONGARCH_LSX_OPT 0
# endif
#endif
#ifndef PNG_INTEL_SSE_OPT
# ifdef PNG_INTEL_SSE
/* Only check for SSE if the build configuration has been modified to
* enable SSE optimizations. This means that these optimizations will
* be off by default. See contrib/intel for more details.
*/
# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
# define PNG_INTEL_SSE_OPT 1
@@ -248,7 +270,6 @@
#endif
#if PNG_MIPS_MSA_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
# if defined(__mips_msa)
# if defined(__clang__)
@@ -264,11 +285,28 @@
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
# define PNG_MIPS_MSA_IMPLEMENTATION 1
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
# endif
#else
# define PNG_MIPS_MSA_IMPLEMENTATION 0
#endif /* PNG_MIPS_MSA_OPT > 0 */
#if PNG_MIPS_MMI_OPT > 0
# ifndef PNG_MIPS_MMI_IMPLEMENTATION
# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64)
# define PNG_MIPS_MMI_IMPLEMENTATION 2
# else /* !defined __mips_loongson_mmi || _MIPS_SIM != _ABI64 */
# define PNG_MIPS_MMI_IMPLEMENTATION 0
# endif /* __mips_loongson_mmi && _MIPS_SIM == _ABI64 */
# endif /* !PNG_MIPS_MMI_IMPLEMENTATION */
# if PNG_MIPS_MMI_IMPLEMENTATION > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
# endif
#else
# define PNG_MIPS_MMI_IMPLEMENTATION 0
#endif /* PNG_MIPS_MMI_OPT > 0 */
#if PNG_POWERPC_VSX_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
@@ -276,6 +314,12 @@
# define PNG_POWERPC_VSX_IMPLEMENTATION 0
#endif
#if PNG_LOONGARCH_LSX_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_lsx
# define PNG_LOONGARCH_LSX_IMPLEMENTATION 1
#else
# define PNG_LOONGARCH_LSX_IMPLEMENTATION 0
#endif
/* Is this a build of a DLL where compilation of the object modules requires
* different preprocessor settings to those required for a simple library? If
@@ -514,18 +558,8 @@
*/
# include <float.h>
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
*/
# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
# include <fp.h>
# endif
# else
# include <math.h>
# endif
# include <math.h>
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
@@ -1306,7 +1340,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
#endif
#if PNG_MIPS_MSA_OPT > 0
#if PNG_MIPS_MSA_IMPLEMENTATION == 1
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
@@ -1323,6 +1357,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
#endif
#if PNG_MIPS_MMI_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_mmi,(png_row_infop row_info,
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_mmi,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_mmi,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_mmi,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_mmi,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_mmi,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_mmi,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
#endif
#if PNG_POWERPC_VSX_OPT > 0
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
@@ -1355,6 +1406,23 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
#endif
#if PNG_LOONGARCH_LSX_IMPLEMENTATION == 1
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_lsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_lsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_lsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_lsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_lsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_lsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_lsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
#endif
/* Choose the best filter to use and filter the row data */
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
png_row_infop row_info),PNG_EMPTY);
@@ -2094,17 +2162,27 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
#endif
#if PNG_MIPS_MSA_OPT > 0
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
#if PNG_MIPS_MSA_IMPLEMENTATION == 1
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
#endif
# if PNG_MIPS_MMI_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
# endif
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
# endif
#endif
#if PNG_LOONGARCH_LSX_OPT > 0
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_lsx,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
#endif
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
png_const_charp key, png_bytep new_key), PNG_EMPTY);
+9 -3
View File
@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* Copyright (c) 2018-2019 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -568,7 +568,11 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
#endif
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
if (png_ptr->transformations)
if (png_ptr->transformations
# ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|| png_ptr->num_palette_max >= 0
# endif
)
png_do_read_transformations(png_ptr, &row_info);
#endif
@@ -785,7 +789,7 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
/* Report invalid palette index; added at libng-1.5.10 */
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
png_ptr->num_palette_max > png_ptr->num_palette)
png_ptr->num_palette_max >= png_ptr->num_palette)
png_benign_error(png_ptr, "Read palette index exceeding num_palette");
#endif
@@ -1049,6 +1053,8 @@ void PNGAPI
png_read_png(png_structrp png_ptr, png_inforp info_ptr,
int transforms, voidp params)
{
png_debug(1, "in png_read_png");
if (png_ptr == NULL || info_ptr == NULL)
return;
+15 -19
View File
@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Copyright (c) 2018-2019 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -290,21 +290,20 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
int compose = 0;
png_fixed_point file_gamma;
png_debug(1, "in png_set_alpha_mode");
png_debug(1, "in png_set_alpha_mode_fixed");
if (png_rtran_ok(png_ptr, 0) == 0)
return;
output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/);
/* Validate the value to ensure it is in a reasonable range. The value
/* Validate the value to ensure it is in a reasonable range. The value
* is expected to be 1 or greater, but this range test allows for some
* viewing correction values. The intent is to weed out users of this API
* who use the inverse of the gamma value accidentally! Since some of these
* values are reasonable this may have to be changed:
* viewing correction values. The intent is to weed out the API users
* who might use the inverse of the gamma value accidentally!
*
* 1.6.x: changed from 0.07..3 to 0.01..100 (to accommodate the optimal 16-bit
* gamma of 36, and its reciprocal.)
* In libpng 1.6.0, we changed from 0.07..3 to 0.01..100, to accommodate
* the optimal 16-bit gamma of 36 and its reciprocal.
*/
if (output_gamma < 1000 || output_gamma > 10000000)
png_error(png_ptr, "output gamma out of expected range");
@@ -441,7 +440,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
int i;
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
(png_alloc_size_t)num_palette);
for (i = 0; i < num_palette; i++)
png_ptr->quantize_index[i] = (png_byte)i;
}
@@ -458,7 +457,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
/* Initialize an array to sort colors */
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
(png_alloc_size_t)num_palette);
/* Initialize the quantize_sort array */
for (i = 0; i < num_palette; i++)
@@ -592,11 +591,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
/* Initialize palette index arrays */
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
(png_alloc_size_t)((png_uint_32)num_palette *
(sizeof (png_byte))));
(png_alloc_size_t)num_palette);
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
(png_alloc_size_t)((png_uint_32)num_palette *
(sizeof (png_byte))));
(png_alloc_size_t)num_palette);
/* Initialize the sort array */
for (i = 0; i < num_palette; i++)
@@ -761,12 +758,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
size_t num_entries = ((size_t)1 << total_bits);
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
(png_alloc_size_t)(num_entries * (sizeof (png_byte))));
(png_alloc_size_t)(num_entries));
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
(sizeof (png_byte))));
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)num_entries);
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
memset(distance, 0xff, num_entries);
for (i = 0; i < num_palette; i++)
{
@@ -970,7 +966,7 @@ void PNGFAPI
png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
png_fixed_point red, png_fixed_point green)
{
png_debug(1, "in png_set_rgb_to_gray");
png_debug(1, "in png_set_rgb_to_gray_fixed");
/* Need the IHDR here because of the check on color_type below. */
/* TODO: fix this */
+9 -10
View File
@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Copyright (c) 2018-2022 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -26,7 +26,7 @@ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
if (uval > PNG_UINT_31_MAX)
png_error(png_ptr, "PNG unsigned integer out of range");
return (uval);
return uval;
}
#if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_READ_cHRM_SUPPORTED)
@@ -140,7 +140,7 @@ png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
{
if (num_checked < 4 &&
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4) != 0)
png_error(png_ptr, "Not a PNG file");
else
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
@@ -171,7 +171,7 @@ png_read_chunk_header(png_structrp png_ptr)
/* Put the chunk name into png_ptr->chunk_name. */
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
png_debug2(0, "Reading %lx chunk, length = %lu",
png_debug2(0, "Reading chunk typeid = 0x%lx, length = %lu",
(unsigned long)png_ptr->chunk_name, (unsigned long)length);
/* Reset the crc and run it over the chunk name. */
@@ -238,10 +238,10 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
else
png_chunk_error(png_ptr, "CRC error");
return (1);
return 1;
}
return (0);
return 0;
}
/* Compare the CRC stored in the PNG file with that calculated by libpng from
@@ -277,11 +277,11 @@ png_crc_error(png_structrp png_ptr)
if (need_crc != 0)
{
crc = png_get_uint_32(crc_bytes);
return ((int)(crc != png_ptr->crc));
return crc != png_ptr->crc;
}
else
return (0);
return 0;
}
#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
@@ -421,8 +421,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
}
#if ZLIB_VERNUM >= 0x1290 && \
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
/* Turn off validation of the ADLER32 checksum in IDAT chunks */
ret = inflateValidate(&png_ptr->zstream, 0);
+16 -6
View File
@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -763,11 +763,11 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
{
int i;
png_debug1(1, "in %lx storage function", png_ptr == NULL ? 0xabadca11U :
(unsigned long)png_ptr->chunk_name);
png_debug1(1, "in text storage function, chunk typeid = 0x%lx",
png_ptr == NULL ? 0xabadca11UL : (unsigned long)png_ptr->chunk_name);
if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
return(0);
return 0;
/* Make sure we have enough space in the "text" array in info_struct
* to hold all of the incoming text_ptr objects. This compare can't overflow
@@ -947,7 +947,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
}
return(0);
return 0;
}
#endif
@@ -1063,6 +1063,8 @@ png_set_sPLT(png_const_structrp png_ptr,
{
png_sPLT_tp np;
png_debug1(1, "in %s storage function", "sPLT");
if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
return;
@@ -1537,7 +1539,7 @@ void PNGAPI
png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
png_bytepp row_pointers)
{
png_debug1(1, "in %s storage function", "rows");
png_debug(1, "in png_set_rows");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -1556,6 +1558,8 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
void PNGAPI
png_set_compression_buffer_size(png_structrp png_ptr, size_t size)
{
png_debug(1, "in png_set_compression_buffer_size");
if (png_ptr == NULL)
return;
@@ -1627,6 +1631,8 @@ void PNGAPI
png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
png_uint_32 user_height_max)
{
png_debug(1, "in png_set_user_limits");
/* Images with dimensions larger than these limits will be
* rejected by png_set_IHDR(). To accept any PNG datastream
* regardless of dimensions, set both limits to 0x7fffffff.
@@ -1642,6 +1648,8 @@ png_set_user_limits(png_structrp png_ptr, png_uint_32 user_width_max,
void PNGAPI
png_set_chunk_cache_max(png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
{
png_debug(1, "in png_set_chunk_cache_max");
if (png_ptr != NULL)
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
}
@@ -1651,6 +1659,8 @@ void PNGAPI
png_set_chunk_malloc_max(png_structrp png_ptr,
png_alloc_size_t user_chunk_malloc_max)
{
png_debug(1, "in png_set_chunk_malloc_max");
if (png_ptr != NULL)
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
}
+9 -5
View File
@@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Copyright (c) 2018 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -103,10 +103,10 @@ png_set_interlace_handling(png_structrp png_ptr)
if (png_ptr != 0 && png_ptr->interlaced != 0)
{
png_ptr->transformations |= PNG_INTERLACE;
return (7);
return 7;
}
return (1);
return 1;
}
#endif
@@ -498,6 +498,8 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
png_bytep dp = row; /* destination pointer */
png_bytep ep = row + row_info->rowbytes; /* One beyond end of row */
png_debug(1, "in png_do_strip_channel");
/* At the start sp will point to the first byte to copy and dp to where
* it is copied to. ep always points just beyond the end of the row, so
* the loop simply copies (channels-1) channels until sp reaches ep.
@@ -698,6 +700,8 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
void /* PRIVATE */
png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
{
png_debug(1, "in png_do_check_palette_indexes");
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
{
@@ -708,7 +712,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
* forms produced on either GCC or MSVC.
*/
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1;
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
switch (row_info->bit_depth)
{
@@ -833,7 +837,7 @@ png_voidp PNGAPI
png_get_user_transform_ptr(png_const_structrp png_ptr)
{
if (png_ptr == NULL)
return (NULL);
return NULL;
return png_ptr->user_transform_ptr;
}
+14 -5
View File
@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Copyright (c) 2018-2023 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -369,7 +369,8 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
png_error(png_ptr, "No IDATs written into file");
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
if (png_ptr->num_palette_max > png_ptr->num_palette)
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
png_ptr->num_palette_max >= png_ptr->num_palette)
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
#endif
@@ -714,12 +715,12 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
/* 1.5.6: moved from png_struct to be a local structure: */
png_row_info row_info;
if (png_ptr == NULL)
return;
png_debug2(1, "in png_write_row (row %u, pass %d)",
png_ptr->row_number, png_ptr->pass);
if (png_ptr == NULL)
return;
/* Initialize transformations and other stuff if first time */
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
{
@@ -1210,6 +1211,8 @@ png_set_compression_strategy(png_structrp png_ptr, int strategy)
void PNGAPI
png_set_compression_window_bits(png_structrp png_ptr, int window_bits)
{
png_debug(1, "in png_set_compression_window_bits");
if (png_ptr == NULL)
return;
@@ -1293,6 +1296,8 @@ png_set_text_compression_strategy(png_structrp png_ptr, int strategy)
void PNGAPI
png_set_text_compression_window_bits(png_structrp png_ptr, int window_bits)
{
png_debug(1, "in png_set_text_compression_window_bits");
if (png_ptr == NULL)
return;
@@ -1330,6 +1335,8 @@ png_set_text_compression_method(png_structrp png_ptr, int method)
void PNGAPI
png_set_write_status_fn(png_structrp png_ptr, png_write_status_ptr write_row_fn)
{
png_debug(1, "in png_set_write_status_fn");
if (png_ptr == NULL)
return;
@@ -1357,6 +1364,8 @@ void PNGAPI
png_write_png(png_structrp png_ptr, png_inforp info_ptr,
int transforms, voidp params)
{
png_debug(1, "in png_write_png");
if (png_ptr == NULL || info_ptr == NULL)
return;
+5 -5
View File
@@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
* Copyright (c) 2018-2022 Cosmin Truta
* Copyright (c) 2018-2024 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -2311,7 +2311,7 @@ png_setup_sub_row(png_structrp png_ptr, png_uint_32 bpp,
break;
}
return (sum);
return sum;
}
static void /* PRIVATE */
@@ -2361,7 +2361,7 @@ png_setup_up_row(png_structrp png_ptr, size_t row_bytes, size_t lmins)
break;
}
return (sum);
return sum;
}
static void /* PRIVATE */
png_setup_up_row_only(png_structrp png_ptr, size_t row_bytes)
@@ -2417,7 +2417,7 @@ png_setup_avg_row(png_structrp png_ptr, png_uint_32 bpp,
break;
}
return (sum);
return sum;
}
static void /* PRIVATE */
png_setup_avg_row_only(png_structrp png_ptr, png_uint_32 bpp,
@@ -2500,7 +2500,7 @@ png_setup_paeth_row(png_structrp png_ptr, png_uint_32 bpp,
break;
}
return (sum);
return sum;
}
static void /* PRIVATE */
png_setup_paeth_row_only(png_structrp png_ptr, png_uint_32 bpp,
+1 -2
View File
@@ -14,8 +14,7 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html
2. Where can I get a Windows DLL version?
The zlib sources can be compiled without change to produce a DLL. See the
file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
precompiled DLL are found in the zlib web site at http://zlib.net/ .
file win32/DLL_FAQ.txt in the zlib distribution.
3. Where can I get a Visual Basic interface to zlib?
+3 -3
View File
@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY
zlib 1.3 is a general purpose data compression library. All the code is
zlib 1.3.1 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
https://marknelson.us/posts/1997/01/01/zlib-engine.html .
The changes made in version 1.3 are documented in the file ChangeLog.
The changes made in version 1.3.1 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ .
@@ -83,7 +83,7 @@ Acknowledgments:
Copyright notice:
(C) 1995-2023 Jean-loup Gailly and Mark Adler
(C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
+36 -11
View File
@@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
* Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
" deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler ";
" deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -493,7 +493,7 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
* symbols from which it is being constructed.
*/
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
@@ -503,8 +503,14 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
deflateEnd (strm);
return Z_MEM_ERROR;
}
#ifdef LIT_MEM
s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1));
s->l_buf = s->pending_buf + (s->lit_bufsize << 2);
s->sym_end = s->lit_bufsize - 1;
#else
s->sym_buf = s->pending_buf + s->lit_bufsize;
s->sym_end = (s->lit_bufsize - 1) * 3;
#endif
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
* on 16 bit machines and because stored blocks are restricted to
* 64K-1 bytes.
@@ -720,9 +726,15 @@ int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
s = strm->state;
#ifdef LIT_MEM
if (bits < 0 || bits > 16 ||
(uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR;
#else
if (bits < 0 || bits > 16 ||
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR;
#endif
do {
put = Buf_size - s->bi_valid;
if (put > bits)
@@ -1294,7 +1306,7 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) {
@@ -1305,10 +1317,15 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS);
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
#ifdef LIT_MEM
ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1));
ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2);
#else
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
#endif
ds->l_desc.dyn_tree = ds->dyn_ltree;
ds->d_desc.dyn_tree = ds->dyn_dtree;
@@ -1539,13 +1556,21 @@ local uInt longest_match(deflate_state *s, IPos cur_match) {
*/
local void check_match(deflate_state *s, IPos start, IPos match, int length) {
/* check that the match is indeed a match */
if (zmemcmp(s->window + match,
s->window + start, length) != EQUAL) {
fprintf(stderr, " start %u, match %u, length %d\n",
start, match, length);
Bytef *back = s->window + (int)match, *here = s->window + start;
IPos len = length;
if (match == (IPos)-1) {
/* match starts one byte before the current window -- just compare the
subsequent length-1 bytes */
back++;
here++;
len--;
}
if (zmemcmp(back, here, len) != EQUAL) {
fprintf(stderr, " start %u, match %d, length %d\n",
start, (int)match, length);
do {
fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
} while (--length != 0);
fprintf(stderr, "(%02x %02x)", *back++, *here++);
} while (--len != 0);
z_error("invalid match");
}
if (z_verbose > 1) {
+33 -2
View File
@@ -1,5 +1,5 @@
/* deflate.h -- internal compression state
* Copyright (C) 1995-2018 Jean-loup Gailly
* Copyright (C) 1995-2024 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -23,6 +23,10 @@
# define GZIP
#endif
/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at
the cost of a larger memory footprint */
/* #define LIT_MEM */
/* ===========================================================================
* Internal compression state.
*/
@@ -217,7 +221,14 @@ typedef struct internal_state {
/* Depth of each subtree used as tie breaker for trees of equal frequency
*/
#ifdef LIT_MEM
# define LIT_BUFS 5
ushf *d_buf; /* buffer for distances */
uchf *l_buf; /* buffer for literals/lengths */
#else
# define LIT_BUFS 4
uchf *sym_buf; /* buffer for distances and literals/lengths */
#endif
uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
@@ -239,7 +250,7 @@ typedef struct internal_state {
* - I can't count above 4
*/
uInt sym_next; /* running index in sym_buf */
uInt sym_next; /* running index in symbol buffer */
uInt sym_end; /* symbol table full when sym_next reaches this */
ulg opt_len; /* bit length of current block with optimal trees */
@@ -318,6 +329,25 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
extern const uch ZLIB_INTERNAL _dist_code[];
#endif
#ifdef LIT_MEM
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
s->d_buf[s->sym_next] = 0; \
s->l_buf[s->sym_next++] = cc; \
s->dyn_ltree[cc].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
# define _tr_tally_dist(s, distance, length, flush) \
{ uch len = (uch)(length); \
ush dist = (ush)(distance); \
s->d_buf[s->sym_next] = dist; \
s->l_buf[s->sym_next++] = len; \
dist--; \
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
#else
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
s->sym_buf[s->sym_next++] = 0; \
@@ -337,6 +367,7 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
#endif
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
# define _tr_tally_dist(s, distance, length, flush) \
+2 -6
View File
@@ -1,5 +1,5 @@
/* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (C) 2004-2019 Mark Adler
* Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -210,9 +210,5 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
value -- needed when comparing unsigned to z_off64_t, which is signed
(possible z_off64_t types off_t, off64_t, and long are all signed) */
#ifdef INT_MAX
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
#else
unsigned ZLIB_INTERNAL gz_intmax(void);
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
#endif
#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
+6 -6
View File
@@ -1,5 +1,5 @@
/* gzlib.c -- zlib functions common to reading and writing gzip files
* Copyright (C) 2004-2019 Mark Adler
* Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -563,20 +563,20 @@ void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
#endif
}
#ifndef INT_MAX
/* portably return maximum value for an int (when limits.h presumed not
available) -- we need to do this to cover cases where 2's complement not
used, since C standard permits 1's complement and sign-bit representations,
otherwise we could just use ((unsigned)-1) >> 1 */
unsigned ZLIB_INTERNAL gz_intmax(void) {
unsigned p, q;
p = 1;
#ifdef INT_MAX
return INT_MAX;
#else
unsigned p = 1, q;
do {
q = p;
p <<= 1;
p++;
} while (p > q);
return q >> 1;
}
#endif
}

Some files were not shown because too many files have changed in this diff Show More