Revision: 56487
          http://sourceforge.net/p/brlcad/code/56487
Author:   mohitdaga
Date:     2013-08-02 18:12:06 +0000 (Fri, 02 Aug 2013)
Log Message:
-----------
Improve Box Average method in shrink function

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

Modified: brlcad/trunk/src/util/pixshrink.c
===================================================================
--- brlcad/trunk/src/util/pixshrink.c   2013-08-02 18:04:18 UTC (rev 56486)
+++ brlcad/trunk/src/util/pixshrink.c   2013-08-02 18:12:06 UTC (rev 56487)
@@ -99,13 +99,14 @@
 void
 shrink_image(int scanlen, int Width, int Height, unsigned char *buffer, int 
Factor)
 {
-    UCHAR *pixelp, *finalpixel;
+    UCHAR *pixelp, *out_buf;
     unsigned int p[3];
     int facsq, x, y, px, py;
 
     facsq = Factor * Factor;
-    finalpixel = buffer;
 
+    out_buf = buffer;  
+
     for (y=0; y < Height; y += Factor)
        for (x=0; x < Width; x += Factor) {
 
@@ -117,8 +118,8 @@
            for (py = 0; py < Factor; py++) {
 
                /* get first pixel in scanline */
-               pixelp = &buffer[y*scanlen+x*3];
-
+               pixelp = &buffer[(y+py)*scanlen+x*3];
+                       
                /* add pixels from scanline to average */
                for (px = 0; px < Factor; px++) {
                    p[0] += *pixelp++;
@@ -128,8 +129,9 @@
            }
 
            /* store resultant pixel back in buffer */
-           for (py = 0; py < 3; ++py)
-               *finalpixel++ = p[py] / facsq;
+           for (py = 0; py < 3; ++py) 
+               *out_buf++ = p[py] / facsq;
+                                           
        }
 }
 

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