Revision: 56489
          http://sourceforge.net/p/brlcad/code/56489
Author:   mohitdaga
Date:     2013-08-02 18:29:39 +0000 (Fri, 02 Aug 2013)
Log Message:
-----------
Improve BOX Average in shrink function.

Modified Paths:
--------------
    brlcad/trunk/src/util/bwshrink.c

Modified: brlcad/trunk/src/util/bwshrink.c
===================================================================
--- brlcad/trunk/src/util/bwshrink.c    2013-08-02 18:13:58 UTC (rev 56488)
+++ brlcad/trunk/src/util/bwshrink.c    2013-08-02 18:29:39 UTC (rev 56489)
@@ -46,7 +46,7 @@
 void
 shrink_image(int w, int h, unsigned char *buffer, int Factor)
 {
-    unsigned char *finalpixel; /* output pixel pointer */
+    unsigned char *finalpixel, *pixelp;        /* output pixel pointer */
     unsigned int p;            /* pixel sum/average */
     int facsq, x, y, px, py;
 
@@ -57,13 +57,13 @@
        for (x=0; x < w; x += Factor) {
 
            /* average factor by factor grid of pixels */
-
            p = 0;
            for (py = 0; py < Factor; py++) {
 
+               pixelp = &buffer[(y+py)*w+x];
                /* add pixels from scanline to average */
                for (px = 0; px < Factor; px++) {
-                   p += buffer[y*w + x+px];
+                   p += *pixelp++;
                }
            }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to