<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - Add option to manually disable bilinear filtering"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=68360#c23">Comment # 23</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - Add option to manually disable bilinear filtering"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=68360">bug 68360</a>
              from <span class="vcard"><a class="email" href="mailto:dr.hyder@gmail.com" title="Charles Hyder <dr.hyder@gmail.com>"> <span class="fn">Charles Hyder</span></a>
</span></b>
        <pre>I'm going to start with rewriting a pair of functions (both defined in
Splash.cc) that implement bilinear interpolation:

static void expandRow(Guchar *srcBuf, Guchar *dstBuf, int srcWidth, int
scaledWidth, int nComps)

void Splash::scaleImageYuXuBilinear(SplashImageSource src, void *srcData,
                                    SplashColorMode srcMode, int nComps,
                                    GBool srcAlpha, int srcWidth, int
srcHeight,
                                    int scaledWidth, int scaledHeight,
                                    SplashBitmap *dest)


The first one interpolates along x, the second one interpolates along y using
results of calling the first one on adjacent rows.

There are two problems that I'm going to address:

1) both functions use floating point math, I'm going to replace that with
integer point math, fully preserving accuracy and hugely improving the speed;

2) when scaledWidth == srcWidth, scaledHeight == srcHeight, the nodes of the
source and destination grids are coinciding, and the interpolation should
(mathematically speaking) produce an identical image. So, I suspect, there is
indeed a bug after all. I'm going to find it.

Once I solve both problems the status of the bug will be as follows:

1) the original issue (bug) of fuzzy rendering at scale = 1 will be resolved;

2) For scale > 1 the rendering of images will be done as before, but at
improved speed. In particular, at 1 < scale < 4 (4 is an AD HOC number
introduced previously by someone else) the rendering will be done using
interpolation REGARDLESS of whether the "interpolate" flag is set.

I consider the last point a (minor) bug as well, but the one that doesn't
bother me personally. I'm not going to address it.

In summary: I'm going to 1) improve speed of image rendering at scale > 1,
while not altering what is produced - images produced will be interpolated for
1 < scale < 4, as before; 2) I'm going to fix interpolation at scale = 1: the
image should just be copied 1-to-1 in this case, obviously.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>