---------- Forwarded message ----------
From: Eric Huss <ehuss@users.sf.net>
Date: Sat, Apr 5, 2014 at 7:04 PM
Subject: [libpng:bugs] #221 Interlace Oddity
To: Ticket 221 <221@bugs.libpng.p.re.sf.net>

** [bugs:#221] Interlace Oddity**

**Status:** open
**Group:** libpng_code
**Created:** Sat Apr 05, 2014 11:04 PM UTC by Eric Huss
**Last Updated:** Sat Apr 05, 2014 11:04 PM UTC
**Owner:** nobody

When reading an interlaced image with a bit depth less than 8, png_progressive_combine_row will use the "sparkle" technique for interlace passes 3 and 5.  I would expect it to use the block method for every pass.

This change was introduced in the git revision 4e68aa7 where significant changes were made to png_combine_row.

I'm fairly confident that the attached patch will fix this issue, but I am not deeply familiar with the libpng source.


diff --git a/pngrutil.c b/pngrutil.c
index 98e9524..c3d64ef 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -3153,7 +3153,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
 #        define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
             S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
-#        define B_MASKS(d,s) { B_MASK(1,d,s), S_MASK(3,d,s), S_MASK(5,d,s) }
+#        define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
 #        define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))