Author: Carlos Lopez <[email protected]>
Date:   Tue Sep 18 18:30:04 2012 +0200

etl::gaussian: use type name T::accumulator_type instead of value_type.

---

 ETL/ETL/_gaussian.h |   70 +++++++++++++++++++++++++-------------------------
 1 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/ETL/ETL/_gaussian.h b/ETL/ETL/_gaussian.h
index 781b1ab..020eafe 100644
--- a/ETL/ETL/_gaussian.h
+++ b/ETL/ETL/_gaussian.h
@@ -42,37 +42,37 @@ _ETL_BEGIN_NAMESPACE
 
 template<typename T> void
 gaussian_blur_5x5_(T pen,int w, int h,
-typename T::pointer SC0,
-typename T::pointer SC1,
-typename T::pointer SC2,
-typename T::pointer SC3)
+typename T::accumulator_pointer SC0,
+typename T::accumulator_pointer SC1,
+typename T::accumulator_pointer SC2,
+typename T::accumulator_pointer SC3)
 {
        int x,y;
-       typename T::value_type Tmp1,Tmp2,SR0,SR1,SR2,SR3;
+       typename T::accumulator_type Tmp1,Tmp2,SR0,SR1,SR2,SR3;
 
        //typename T::iterator_x iter;
 
        // Setup the row buffers
-       for(x=0;x<w;x++)SC0[x+2]=pen.x()[x]*24;
-       memset(SC1,0,(w+2)*sizeof(typename T::value_type));
-       memset(SC2,0,(w+2)*sizeof(typename T::value_type));
-       memset(SC3,0,(w+2)*sizeof(typename T::value_type));
+       for(x=0;x<w;x++)SC0[x+2]=(typename T::accumulator_type)(pen.x()[x])*24;
+       memset(SC1,0,(w+2)*sizeof(typename T::accumulator_type));
+       memset(SC2,0,(w+2)*sizeof(typename T::accumulator_type));
+       memset(SC3,0,(w+2)*sizeof(typename T::accumulator_type));
 
        for(y=0;y<h+2;y++,pen.inc_y())
        {
                int yadj;
                if(y>=h)
-                       {yadj=(h-y)-1; SR0=pen.y()[yadj]*1.35;}
+                       {yadj=(h-y)-1; SR0=(typename 
T::accumulator_type)(pen.y()[yadj])*1.35;}
                else
-                       {yadj=0; SR0=pen.get_value()*1.35; }
+                       {yadj=0; SR0=(typename 
T::accumulator_type)(pen.get_value())*1.35; }
 
-               SR1=SR2=SR3=typename T::value_type();
+               SR1=SR2=SR3=typename T::accumulator_type();
                for(x=0;x<w+2;x++,pen.inc_x())
                {
                        if(x>=w)
-                               Tmp1=pen[yadj][(w-x)-1];
+                               Tmp1=(typename 
T::accumulator_type)(pen[yadj][(w-x)-1]);
                        else
-                               Tmp1=*pen[yadj];
+                               Tmp1=(typename T::accumulator_type)(*pen[yadj]);
 
                        Tmp2=SR0+Tmp1;
                        SR0=Tmp1;
@@ -102,10 +102,10 @@ typename T::pointer SC3)
 template<typename T> void
 gaussian_blur_5x5(T pen, int w, int h)
 {
-       typename T::pointer SC0=new typename T::value_type[w+2];
-       typename T::pointer SC1=new typename T::value_type[w+2];
-       typename T::pointer SC2=new typename T::value_type[w+2];
-       typename T::pointer SC3=new typename T::value_type[w+2];
+       typename T::accumulator_pointer SC0=new typename 
T::accumulator_type[w+2];
+       typename T::accumulator_pointer SC1=new typename 
T::accumulator_type[w+2];
+       typename T::accumulator_pointer SC2=new typename 
T::accumulator_type[w+2];
+       typename T::accumulator_pointer SC3=new typename 
T::accumulator_type[w+2];
 
        gaussian_blur_5x5_(pen,w,h,SC0,SC1,SC2,SC3);
 
@@ -120,10 +120,10 @@ gaussian_blur_5x5(T begin, T end)
 {
        typename T::difference_type size(end-begin);
 
-       typename T::pointer SC0=new typename T::value_type[size.x+2];
-       typename T::pointer SC1=new typename T::value_type[size.x+2];
-       typename T::pointer SC2=new typename T::value_type[size.x+2];
-       typename T::pointer SC3=new typename T::value_type[size.x+2];
+       typename T::accumulator_pointer SC0=new typename 
T::accumulator_type[size.x+2];
+       typename T::accumulator_pointer SC1=new typename 
T::accumulator_type[size.x+2];
+       typename T::accumulator_pointer SC2=new typename 
T::accumulator_type[size.x+2];
+       typename T::accumulator_pointer SC3=new typename 
T::accumulator_type[size.x+2];
 
        gaussian_blur_5x5_(begin,size.x,size.y,SC0,SC1,SC2,SC3);
 
@@ -137,31 +137,31 @@ template<typename T> void
 gaussian_blur_3x3(T pen,int w, int h)
 {
        int x,y;
-       typename T::value_type Tmp1,Tmp2,SR0,SR1;
+       typename T::accumulator_type Tmp1,Tmp2,SR0,SR1;
 
 //     typename T::iterator_x iter;
 
-       typename T::pointer SC0=new typename T::value_type[w+1];
-       typename T::pointer SC1=new typename T::value_type[w+1];
+       typename T::accumulator_pointer SC0=new typename 
T::accumulator_type[w+1];
+       typename T::accumulator_pointer SC1=new typename 
T::accumulator_type[w+1];
 
        // Setup the row buffers
-       for(x=0;x<w;x++)SC0[x+1]=pen.x()[x]*4;
-       memset(SC1,0,(w+1)*sizeof(typename T::value_type));
+       for(x=0;x<w;x++)SC0[x+1]=(typename T::accumulator_type)(pen.x()[x])*4;
+       memset(SC1,0,(w+1)*sizeof(typename T::accumulator_type));
 
        for(y=0;y<h+1;y++,pen.inc_y())
        {
                int yadj;
                if(y>=h)
-                       {yadj=-1; SR1=SR0=pen.y()[yadj];}
+                       {yadj=-1; SR1=SR0=(typename 
T::accumulator_type)(pen.y()[yadj]);}
                else
-                       {yadj=0; SR1=SR0=pen.get_value(); }
+                       {yadj=0; SR1=SR0=(typename 
T::accumulator_type)(pen.get_value()); }
 
                for(x=0;x<w+1;x++,pen.inc_x())
                {
                        if(x>=w)
-                               Tmp1=pen[yadj][(w-x)-2];
+                               Tmp1=(typename 
T::accumulator_type)(pen[yadj][(w-x)-2]);
                        else
-                               Tmp1=*pen[yadj];
+                               Tmp1=(typename T::accumulator_type)(*pen[yadj]);
 
                        Tmp2=SR0+Tmp1;
                        SR0=Tmp1;
@@ -242,10 +242,10 @@ gaussian_blur_1x3(_PEN begin, _PEN end)
 template<typename T> void
 gaussian_blur(T pen, int w, int h, int blur_x, int blur_y)
 {
-       typename T::pointer SC0=new typename T::value_type[w+2];
-       typename T::pointer SC1=new typename T::value_type[w+2];
-       typename T::pointer SC2=new typename T::value_type[w+2];
-       typename T::pointer SC3=new typename T::value_type[w+2];
+       typename T::accumulator_pointer SC0=new typename 
T::accumulator_type[w+2];
+       typename T::accumulator_pointer SC1=new typename 
T::accumulator_type[w+2];
+       typename T::accumulator_pointer SC2=new typename 
T::accumulator_type[w+2];
+       typename T::accumulator_pointer SC3=new typename 
T::accumulator_type[w+2];
 
        blur_x--;
        blur_y--;


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to