[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1587-g825f77e

[email protected] (Robin Watts)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
  discards  390867f19f49a52d4585c0e5e980b2c245e15e76 (commit)
       via  825f77eabdbfaa9d566d38c4b2be918143cd5778 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (390867f19f49a52d4585c0e5e980b2c245e15e76)
            \
             N -- N -- N (825f77eabdbfaa9d566d38c4b2be918143cd5778)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

----------------------------------------------------------------------
commit 825f77eabdbfaa9d566d38c4b2be918143cd5778
Author: Robin Watts <[email protected]>
Date:   Tue Aug 20 12:24:03 2019 +0100

    Fix overflow in deep color blending.
    
    Multiplying a 16bit unsigned value with a 16 bit signed value
    in a 32bit int means we lose the sign bit. Sacrifice a bit of
    accuracy to avoid that.

diff --git a/base/gxblend.c b/base/gxblend.c
index 0e29fc9..aaadca8 100644
--- a/base/gxblend.c
+++ b/base/gxblend.c
@@ -1934,6 +1934,8 @@ art_pdf_composite_pixel_alpha_16_inline(uint16_t *gs_restrict dst, uint16_t *gs_
                 dst[i] += (src_scale * (blend[i] - dst[i]) + 0x8000) >> 16;
             }
         } else {
+            int a_b2 = a_b>>1;
+            int ss2 = src_scale>>1;
             for (i = 0; i < first_spot; i++) {
                 int c_bl;		/* Result of blend function */
 
@@ -1941,8 +1943,8 @@ art_pdf_composite_pixel_alpha_16_inline(uint16_t *gs_restrict dst, uint16_t *gs_
                 c_b = dst[i];
                 c_bl = blend[i];
 
-                c_s += (a_b * (c_bl - c_s) + 0x8000) >> 16;
-                c_b += (src_scale * (c_s - c_b) + 0x8000) >> 16;
+                c_s += (a_b2 * (c_bl - c_s) + 0x4000) >> 15;
+                c_b += (ss2 * (c_s - c_b) + 0x4000) >> 15;
                 dst[i] = c_b;
             }
         }


Summary of changes:
 windows/GhostPDL.sln | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.