From fa7d7934f608edcb9ca7c36f0a74256a4fd7aaa8 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Wed, 5 Oct 2011 21:09:22 -0500 Subject: [PATCH] [libpng15] Replaced a short but frequently-used memcpy() in png_combine_row() with a loop. --- ANNOUNCE | 5 +++-- CHANGES | 3 ++- pngrutil.c | 16 +++++++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index a07147bf1..569ded81e 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.5.6beta05 - October 5, 2011 +Libpng 1.5.6beta05 - October 6, 2011 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -55,7 +55,8 @@ Version 1.5.6beta03 [September 28, 2011] Version 1.5.6beta04 [October 5, 2011] Fixed typo in Makefile.in and Makefile.am ("-M Wl" should be "-M -Wl")." -Version 1.5.6beta05 [October 5, 2011] +Version 1.5.6beta05 [October 6, 2011] + Replaced a short but frequently-used memcpy() in png_combine_row() to a loop. Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index 367b3e568..7f44659df 100644 --- a/CHANGES +++ b/CHANGES @@ -3616,7 +3616,8 @@ Version 1.5.6beta03 [September 28, 2011] Version 1.5.6beta04 [October 5, 2011] Fixed typo in Makefile.in and Makefile.am ("-M Wl" should be "-M -Wl")." -Version 1.5.6beta05 [October 5, 2011] +Version 1.5.6beta05 [October 6, 2011] + Replaced a short but frequently-used memcpy() in png_combine_row() to a loop. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngrutil.c b/pngrutil.c index 0de1fa942..d8ab11776 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -2994,11 +2994,21 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask) { if (m & mask) { - png_memcpy(dp, sp, pixel_bytes); + /* Prior to libpng-1.5.6 we used memcpy(), but limited + * experiments show that this simple loop can be + * significantly faster. + */ + int j; + + for (j = pixel_bytes; j; --j) + *(dp++) = *(sp++); } - sp += pixel_bytes; - dp += pixel_bytes; + else + { + sp += pixel_bytes; + dp += pixel_bytes; + } if (m == 1) m = 0x80;