[poppler] 2 commits - splash/Splash.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed May 23 20:05:49 UTC 2018


 splash/Splash.cc |   57 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 39 insertions(+), 18 deletions(-)

New commits:
commit ffb0daefda688564c1456f4b8b3f5a715d228cdc
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed May 23 19:06:51 2018 +0200

    Apply previous optimization also to Splash::pipeRunAARGB8

diff --git a/splash/Splash.cc b/splash/Splash.cc
index 643e8190..7a772144 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -1078,25 +1078,35 @@ void Splash::pipeRunAARGB8(SplashPipe *pipe) {
   SplashColor cDest;
   Guchar cResult0, cResult1, cResult2;
 
-  //----- read destination pixel
-  cDest[0] = pipe->destColorPtr[0];
-  cDest[1] = pipe->destColorPtr[1];
-  cDest[2] = pipe->destColorPtr[2];
+  //----- read destination alpha
   aDest = *pipe->destAlphaPtr;
 
   //----- source alpha
   aSrc = div255(pipe->aInput * pipe->shape);
 
-  //----- result alpha and non-isolated group element correction
-  aResult = aSrc + aDest - div255(aSrc * aDest);
-  alpha2 = aResult;
-
   //----- result color
-  if (alpha2 == 0) {
+  if (aSrc == 255) {
+    cResult0 = state->rgbTransferR[pipe->cSrc[0]];
+    cResult1 = state->rgbTransferG[pipe->cSrc[1]];
+    cResult2 = state->rgbTransferB[pipe->cSrc[2]];
+    aResult = 255;
+
+  } else if (aSrc == 0 && aDest == 0) {
     cResult0 = 0;
     cResult1 = 0;
     cResult2 = 0;
+    aResult = 0;
+
   } else {
+    //----- read destination pixel
+    cDest[0] = pipe->destColorPtr[0];
+    cDest[1] = pipe->destColorPtr[1];
+    cDest[2] = pipe->destColorPtr[2];
+
+    //----- result alpha and non-isolated group element correction
+    aResult = aSrc + aDest - div255(aSrc * aDest);
+    alpha2 = aResult;
+
     cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] +
 					     aSrc * pipe->cSrc[0]) / alpha2)];
     cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] +
commit f47936af75088c55a19fe6b1a67128fcc3f57b08
Author: Stefan Brüns <stefan.bruens at rwth-aachen.de>
Date:   Wed May 23 19:05:50 2018 +0200

    Small optimization for AAXRGB8 pipes
    
    Skip some computations if both src and dest alpha are zero, or if
    src is fully opaque. For common cases (majority of pixels fully
    opaque) like in fdo#81211, this reduces execution time of
    pipeRunAAXBGR8 by 50% (-20% total execution time).

diff --git a/splash/Splash.cc b/splash/Splash.cc
index 0ee71077..643e8190 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -19,6 +19,7 @@
 // Copyright (C) 2012 Markus Trippelsdorf <markus at trippelsdorf.de>
 // Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Matthias Kramm <kramm at quiss.org>
+// Copyright (C) 2018 Stefan Brüns <stefan.bruens at rwth-aachen.de>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -1123,25 +1124,35 @@ void Splash::pipeRunAAXBGR8(SplashPipe *pipe) {
   SplashColor cDest;
   Guchar cResult0, cResult1, cResult2;
 
-  //----- read destination pixel
-  cDest[0] = pipe->destColorPtr[2];
-  cDest[1] = pipe->destColorPtr[1];
-  cDest[2] = pipe->destColorPtr[0];
+  //----- read destination alpha
   aDest = *pipe->destAlphaPtr;
 
   //----- source alpha
   aSrc = div255(pipe->aInput * pipe->shape);
 
-  //----- result alpha and non-isolated group element correction
-  aResult = aSrc + aDest - div255(aSrc * aDest);
-  alpha2 = aResult;
-
   //----- result color
-  if (alpha2 == 0) {
+  if (aSrc == 255) {
+    cResult0 = state->rgbTransferR[pipe->cSrc[0]];
+    cResult1 = state->rgbTransferG[pipe->cSrc[1]];
+    cResult2 = state->rgbTransferB[pipe->cSrc[2]];
+    aResult = 255;
+
+  } else if (aSrc == 0 && aDest == 0) {
     cResult0 = 0;
     cResult1 = 0;
     cResult2 = 0;
+    aResult = 0;
+
   } else {
+    //----- read destination color
+    cDest[0] = pipe->destColorPtr[2];
+    cDest[1] = pipe->destColorPtr[1];
+    cDest[2] = pipe->destColorPtr[0];
+
+    //----- result alpha and non-isolated group element correction
+    aResult = aSrc + aDest - div255(aSrc * aDest);
+    alpha2 = aResult;
+
     cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] +
 					     aSrc * pipe->cSrc[0]) / alpha2)];
     cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] +


More information about the poppler mailing list