[libpng16] Improved performance of new do_check_palette_indexes() function

(only update the value when it actually increases, move test for whether
the check is wanted out of the function.
This commit is contained in:
Glenn Randers-Pehrson
2012-06-06 13:30:30 -05:00
parent b1e7771d5e
commit 14ca47b453
5 changed files with 15 additions and 8 deletions

View File

@@ -625,8 +625,7 @@ 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)
{
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
png_ptr->num_palette_max >= 0)
if (png_ptr->num_palette < (1 << row_info->bit_depth))
{
/* Calculations moved outside switch in an attempt to stop different
* compiler warnings. 'padding' is in *bits* within the last byte, it is
@@ -708,7 +707,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
{
for (; rp > png_ptr->row_buf; rp--)
{
if (*rp >= png_ptr->num_palette_max)
if (*rp > png_ptr->num_palette_max)
png_ptr->num_palette_max = (int) *rp;
}