mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng14] Imported from libpng-1.4.17beta01.tar
This commit is contained in:
parent
41de766f12
commit
cbd9e435ad
2
INSTALL
2
INSTALL
@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.4.17beta01 - May 9, 2015
|
||||
Installing libpng version 1.4.17beta01 - August 19, 2015
|
||||
|
||||
On Unix/Linux and similar systems, you can simply type
|
||||
|
||||
|
4
LICENSE
4
LICENSE
@ -10,7 +10,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.4.17beta01, July 13, 2015, are
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.4.17beta01, August 19, 2015, are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
@ -102,4 +102,4 @@ the additional disclaimers inserted at version 1.0.7.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
July 13, 2015
|
||||
August 19, 2015
|
||||
|
4
README
4
README
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.4.17beta01 - May 9, 2015 (shared library 14.0)
|
||||
README for libpng version 1.4.17beta01 - August 19, 2015 (shared library 14.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
@ -123,7 +123,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
|
||||
to others, if necessary.
|
||||
|
||||
Please do not send suggestions on how to change PNG. We have
|
||||
been discussing PNG for nineteen years now, and it is official and
|
||||
been discussing PNG for twenty years now, and it is official and
|
||||
finished. If you have suggestions for libpng, however, I'll
|
||||
gladly listen. Even if your suggestion is not used immediately,
|
||||
it may be used later.
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH LIBPNGPF 3 "May 9, 2015"
|
||||
.TH LIBPNGPF 3 "August 19, 2015"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.17beta01
|
||||
(private functions)
|
||||
|
2
png.5
2
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "August 11, 2015"
|
||||
.TH PNG 5 "August 19, 2015"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.4.17beta01, May 9, 2015
|
||||
* libpng version 1.4.17beta01, August 19, 2015
|
||||
*
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* libpng version 1.4.17beta01 - May 9, 2015
|
||||
* libpng version 1.4.17beta01 - August 19, 2015
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
2
pngset.c
2
pngset.c
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.4.17 [May 9, 2015]
|
||||
* Last changed in libpng 1.4.17 [August 19, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.4.17 [May 15, 2015]
|
||||
* Last changed in libpng 1.4.17 [August 19, 2015]
|
||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
131
pngwrite.c
131
pngwrite.c
@ -593,11 +593,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
|
||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
||||
1, NULL, NULL);
|
||||
#endif
|
||||
|
||||
return (png_ptr);
|
||||
}
|
||||
|
||||
@ -1012,14 +1007,6 @@ png_write_destroy(png_structp png_ptr)
|
||||
png_free(png_ptr, png_ptr->time_buffer);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
png_free(png_ptr, png_ptr->prev_filters);
|
||||
png_free(png_ptr, png_ptr->filter_weights);
|
||||
png_free(png_ptr, png_ptr->inv_filter_weights);
|
||||
png_free(png_ptr, png_ptr->filter_costs);
|
||||
png_free(png_ptr, png_ptr->inv_filter_costs);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* Reset structure */
|
||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||
@ -1167,123 +1154,19 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
* better compression.
|
||||
*/
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
||||
int num_weights, png_doublep filter_weights,
|
||||
png_doublep filter_costs)
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_set_filter_heuristics");
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
|
||||
{
|
||||
png_warning(png_ptr, "Unknown filter heuristic method");
|
||||
return;
|
||||
}
|
||||
|
||||
if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT)
|
||||
{
|
||||
heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED;
|
||||
}
|
||||
|
||||
if (num_weights < 0 || filter_weights == NULL ||
|
||||
heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED)
|
||||
{
|
||||
num_weights = 0;
|
||||
}
|
||||
|
||||
png_ptr->num_prev_filters = (png_byte)num_weights;
|
||||
png_ptr->heuristic_method = (png_byte)heuristic_method;
|
||||
|
||||
if (num_weights > 0)
|
||||
{
|
||||
if (png_ptr->prev_filters == NULL)
|
||||
{
|
||||
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)(png_sizeof(png_byte) * num_weights));
|
||||
|
||||
/* To make sure that the weighting starts out fairly */
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
png_ptr->prev_filters[i] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
if (png_ptr->filter_weights == NULL)
|
||||
{
|
||||
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
|
||||
|
||||
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_weights; i++)
|
||||
{
|
||||
if (filter_weights[i] < 0.0)
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
png_ptr->inv_filter_weights[i] =
|
||||
(png_uint_16)((double)PNG_WEIGHT_FACTOR*filter_weights[i]+0.5);
|
||||
png_ptr->filter_weights[i] =
|
||||
(png_uint_16)((double)PNG_WEIGHT_FACTOR/filter_weights[i]+0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If, in the future, there are other filter methods, this would
|
||||
* need to be based on png_ptr->filter.
|
||||
*/
|
||||
if (png_ptr->filter_costs == NULL)
|
||||
{
|
||||
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
||||
|
||||
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
||||
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
||||
|
||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
||||
{
|
||||
png_ptr->inv_filter_costs[i] =
|
||||
png_ptr->filter_costs[i] = PNG_COST_FACTOR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Here is where we set the relative costs of the different filters. We
|
||||
* should take the desired compression level into account when setting
|
||||
* the costs, so that Paeth, for instance, has a high relative cost at low
|
||||
* compression levels, while it has a lower relative cost at higher
|
||||
* compression settings. The filter types are in order of increasing
|
||||
* relative cost, so it would be possible to do this with an algorithm.
|
||||
*/
|
||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
||||
{
|
||||
if (filter_costs == NULL || filter_costs[i] < 0.0)
|
||||
{
|
||||
png_ptr->inv_filter_costs[i] =
|
||||
png_ptr->filter_costs[i] = PNG_COST_FACTOR;
|
||||
}
|
||||
else if (filter_costs[i] >= 1.0)
|
||||
{
|
||||
png_ptr->inv_filter_costs[i] =
|
||||
(png_uint_16)((double)PNG_COST_FACTOR / filter_costs[i] + 0.5);
|
||||
png_ptr->filter_costs[i] =
|
||||
(png_uint_16)((double)PNG_COST_FACTOR * filter_costs[i] + 0.5);
|
||||
}
|
||||
}
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(heuristic_method)
|
||||
PNG_UNUSED(num_weights)
|
||||
PNG_UNUSED(filter_weights)
|
||||
PNG_UNUSED(filter_costs)
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
||||
|
||||
void PNGAPI
|
||||
|
314
pngwutil.c
314
pngwutil.c
@ -2124,20 +2124,9 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 mins, bpp;
|
||||
png_byte filter_to_do = png_ptr->do_filter;
|
||||
png_uint_32 row_bytes = row_info->rowbytes;
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
int num_p_filters = (int)png_ptr->num_prev_filters;
|
||||
#endif
|
||||
|
||||
png_debug(1, "in png_write_find_filter");
|
||||
|
||||
#ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS)
|
||||
{
|
||||
/* These will never be selected so we need not test them. */
|
||||
filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Find out how many bytes offset each pixel is */
|
||||
bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
|
||||
@ -2187,41 +2176,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
sum += (v < 128) ? v : 256 - v;
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
png_uint_32 sumhi, sumlo;
|
||||
int j;
|
||||
sumlo = sum & PNG_LOMASK;
|
||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
|
||||
|
||||
/* Reduce the sum if we match any of the previous rows */
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
|
||||
{
|
||||
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Factor in the cost of this filter (this is here for completeness,
|
||||
* but it makes no sense to have a "cost" for the NONE filter, as
|
||||
* it has the minimum possible computational cost - none).
|
||||
*/
|
||||
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
|
||||
PNG_COST_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (sumhi > PNG_HIMASK)
|
||||
sum = PNG_MAXSUM;
|
||||
else
|
||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
||||
}
|
||||
#endif
|
||||
mins = sum;
|
||||
}
|
||||
|
||||
@ -2251,41 +2205,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 i;
|
||||
int v;
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
/* We temporarily increase the "minimum sum" by the factor we
|
||||
* would reduce the sum of this filter, so that we can do the
|
||||
* early exit comparison without scaling the sum each time.
|
||||
*/
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int j;
|
||||
png_uint_32 lmhi, lmlo;
|
||||
lmlo = lmins & PNG_LOMASK;
|
||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
||||
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
|
||||
{
|
||||
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
|
||||
PNG_COST_SHIFT;
|
||||
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (lmhi > PNG_HIMASK)
|
||||
lmins = PNG_MAXSUM;
|
||||
else
|
||||
lmins = (lmhi << PNG_HISHIFT) + lmlo;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
|
||||
i++, rp++, dp++)
|
||||
{
|
||||
@ -2304,37 +2223,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int j;
|
||||
png_uint_32 sumhi, sumlo;
|
||||
sumlo = sum & PNG_LOMASK;
|
||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
||||
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
|
||||
{
|
||||
sumlo = (sumlo * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
sumlo = (sumlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
|
||||
PNG_COST_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (sumhi > PNG_HIMASK)
|
||||
sum = PNG_MAXSUM;
|
||||
else
|
||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sum < mins)
|
||||
{
|
||||
mins = sum;
|
||||
@ -2364,38 +2252,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 i;
|
||||
int v;
|
||||
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int j;
|
||||
png_uint_32 lmhi, lmlo;
|
||||
lmlo = lmins & PNG_LOMASK;
|
||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
||||
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
|
||||
{
|
||||
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
|
||||
PNG_COST_SHIFT;
|
||||
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (lmhi > PNG_HIMASK)
|
||||
lmins = PNG_MAXSUM;
|
||||
else
|
||||
lmins = (lmhi << PNG_HISHIFT) + lmlo;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
||||
pp = prev_row + 1; i < row_bytes; i++)
|
||||
{
|
||||
@ -2407,37 +2263,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int j;
|
||||
png_uint_32 sumhi, sumlo;
|
||||
sumlo = sum & PNG_LOMASK;
|
||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
||||
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
|
||||
{
|
||||
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
|
||||
PNG_COST_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (sumhi > PNG_HIMASK)
|
||||
sum = PNG_MAXSUM;
|
||||
else
|
||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sum < mins)
|
||||
{
|
||||
mins = sum;
|
||||
@ -2470,37 +2295,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 i;
|
||||
int v;
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int j;
|
||||
png_uint_32 lmhi, lmlo;
|
||||
lmlo = lmins & PNG_LOMASK;
|
||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
||||
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG)
|
||||
{
|
||||
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
|
||||
PNG_COST_SHIFT;
|
||||
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (lmhi > PNG_HIMASK)
|
||||
lmins = PNG_MAXSUM;
|
||||
else
|
||||
lmins = (lmhi << PNG_HISHIFT) + lmlo;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
||||
pp = prev_row + 1; i < bpp; i++)
|
||||
{
|
||||
@ -2519,37 +2313,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int j;
|
||||
png_uint_32 sumhi, sumlo;
|
||||
sumlo = sum & PNG_LOMASK;
|
||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
||||
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
|
||||
{
|
||||
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
|
||||
PNG_COST_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (sumhi > PNG_HIMASK)
|
||||
sum = PNG_MAXSUM;
|
||||
else
|
||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sum < mins)
|
||||
{
|
||||
mins = sum;
|
||||
@ -2603,37 +2366,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 i;
|
||||
int v;
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int j;
|
||||
png_uint_32 lmhi, lmlo;
|
||||
lmlo = lmins & PNG_LOMASK;
|
||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
||||
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
|
||||
{
|
||||
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
|
||||
PNG_COST_SHIFT;
|
||||
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (lmhi > PNG_HIMASK)
|
||||
lmins = PNG_MAXSUM;
|
||||
else
|
||||
lmins = (lmhi << PNG_HISHIFT) + lmlo;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
||||
pp = prev_row + 1; i < bpp; i++)
|
||||
{
|
||||
@ -2684,37 +2416,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
||||
{
|
||||
int j;
|
||||
png_uint_32 sumhi, sumlo;
|
||||
sumlo = sum & PNG_LOMASK;
|
||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
||||
|
||||
for (j = 0; j < num_p_filters; j++)
|
||||
{
|
||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
|
||||
{
|
||||
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
|
||||
PNG_WEIGHT_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
|
||||
PNG_COST_SHIFT;
|
||||
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
|
||||
PNG_COST_SHIFT;
|
||||
|
||||
if (sumhi > PNG_HIMASK)
|
||||
sum = PNG_MAXSUM;
|
||||
else
|
||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sum < mins)
|
||||
{
|
||||
best_row = png_ptr->paeth_row;
|
||||
@ -2724,21 +2425,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
/* Do the actual writing of the filtered row data from the chosen filter. */
|
||||
|
||||
png_write_filtered_row(png_ptr, best_row);
|
||||
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
/* Save the type of filter we picked this time for future calculations */
|
||||
if (png_ptr->num_prev_filters > 0)
|
||||
{
|
||||
int j;
|
||||
for (j = 1; j < num_p_filters; j++)
|
||||
{
|
||||
png_ptr->prev_filters[j] = png_ptr->prev_filters[j - 1];
|
||||
}
|
||||
png_ptr->prev_filters[j] = best_row[0];
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
VisualStudio instructions
|
||||
|
||||
libpng version 1.4.17beta01 - May 9, 2015
|
||||
libpng version 1.4.17beta01 - August 19, 2015
|
||||
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* zlib.props - location of zlib source and build
|
||||
*
|
||||
* libpng version 1.4.17beta01 - May 9, 2015
|
||||
* libpng version 1.4.17beta01 - August 19, 2015
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
Makefiles for libpng version 1.4.17beta01 - May 9, 2015
|
||||
Makefiles for libpng version 1.4.17beta01 - August 19, 2015
|
||||
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng14.so.14.1.4.17beta01)
|
||||
|
Loading…
x
Reference in New Issue
Block a user