43
43
template<typename T> void
44
44
gaussian_blur_5x5_(T pen,int w, int h,
45
typename T::pointer SC0,
46
typename T::pointer SC1,
47
typename T::pointer SC2,
48
typename T::pointer SC3)
45
typename T::accumulator_pointer SC0,
46
typename T::accumulator_pointer SC1,
47
typename T::accumulator_pointer SC2,
48
typename T::accumulator_pointer SC3)
51
typename T::value_type Tmp1,Tmp2,SR0,SR1,SR2,SR3;
51
typename T::accumulator_type Tmp1,Tmp2,SR0,SR1,SR2,SR3;
53
53
//typename T::iterator_x iter;
55
55
// Setup the row buffers
56
for(x=0;x<w;x++)SC0[x+2]=pen.x()[x]*24;
57
memset(SC1,0,(w+2)*sizeof(typename T::value_type));
58
memset(SC2,0,(w+2)*sizeof(typename T::value_type));
59
memset(SC3,0,(w+2)*sizeof(typename T::value_type));
56
for(x=0;x<w;x++)SC0[x+2]=(typename T::accumulator_type)(pen.x()[x])*24;
57
memset(SC1,0,(w+2)*sizeof(typename T::accumulator_type));
58
memset(SC2,0,(w+2)*sizeof(typename T::accumulator_type));
59
memset(SC3,0,(w+2)*sizeof(typename T::accumulator_type));
61
61
for(y=0;y<h+2;y++,pen.inc_y())
65
{yadj=(h-y)-1; SR0=pen.y()[yadj]*1.35;}
65
{yadj=(h-y)-1; SR0=(typename T::accumulator_type)(pen.y()[yadj])*1.35;}
67
{yadj=0; SR0=pen.get_value()*1.35; }
67
{yadj=0; SR0=(typename T::accumulator_type)(pen.get_value())*1.35; }
69
SR1=SR2=SR3=typename T::value_type();
69
SR1=SR2=SR3=typename T::accumulator_type();
70
70
for(x=0;x<w+2;x++,pen.inc_x())
73
Tmp1=pen[yadj][(w-x)-1];
73
Tmp1=(typename T::accumulator_type)(pen[yadj][(w-x)-1]);
75
Tmp1=(typename T::accumulator_type)(*pen[yadj]);
102
102
template<typename T> void
103
103
gaussian_blur_5x5(T pen, int w, int h)
105
typename T::pointer SC0=new typename T::value_type[w+2];
106
typename T::pointer SC1=new typename T::value_type[w+2];
107
typename T::pointer SC2=new typename T::value_type[w+2];
108
typename T::pointer SC3=new typename T::value_type[w+2];
105
typename T::accumulator_pointer SC0=new typename T::accumulator_type[w+2];
106
typename T::accumulator_pointer SC1=new typename T::accumulator_type[w+2];
107
typename T::accumulator_pointer SC2=new typename T::accumulator_type[w+2];
108
typename T::accumulator_pointer SC3=new typename T::accumulator_type[w+2];
110
110
gaussian_blur_5x5_(pen,w,h,SC0,SC1,SC2,SC3);
121
121
typename T::difference_type size(end-begin);
123
typename T::pointer SC0=new typename T::value_type[size.x+2];
124
typename T::pointer SC1=new typename T::value_type[size.x+2];
125
typename T::pointer SC2=new typename T::value_type[size.x+2];
126
typename T::pointer SC3=new typename T::value_type[size.x+2];
123
typename T::accumulator_pointer SC0=new typename T::accumulator_type[size.x+2];
124
typename T::accumulator_pointer SC1=new typename T::accumulator_type[size.x+2];
125
typename T::accumulator_pointer SC2=new typename T::accumulator_type[size.x+2];
126
typename T::accumulator_pointer SC3=new typename T::accumulator_type[size.x+2];
128
128
gaussian_blur_5x5_(begin,size.x,size.y,SC0,SC1,SC2,SC3);
137
137
gaussian_blur_3x3(T pen,int w, int h)
140
typename T::value_type Tmp1,Tmp2,SR0,SR1;
140
typename T::accumulator_type Tmp1,Tmp2,SR0,SR1;
142
142
// typename T::iterator_x iter;
144
typename T::pointer SC0=new typename T::value_type[w+1];
145
typename T::pointer SC1=new typename T::value_type[w+1];
144
typename T::accumulator_pointer SC0=new typename T::accumulator_type[w+1];
145
typename T::accumulator_pointer SC1=new typename T::accumulator_type[w+1];
147
147
// Setup the row buffers
148
for(x=0;x<w;x++)SC0[x+1]=pen.x()[x]*4;
149
memset(SC1,0,(w+1)*sizeof(typename T::value_type));
148
for(x=0;x<w;x++)SC0[x+1]=(typename T::accumulator_type)(pen.x()[x])*4;
149
memset(SC1,0,(w+1)*sizeof(typename T::accumulator_type));
151
151
for(y=0;y<h+1;y++,pen.inc_y())
155
{yadj=-1; SR1=SR0=pen.y()[yadj];}
155
{yadj=-1; SR1=SR0=(typename T::accumulator_type)(pen.y()[yadj]);}
157
{yadj=0; SR1=SR0=pen.get_value(); }
157
{yadj=0; SR1=SR0=(typename T::accumulator_type)(pen.get_value()); }
159
159
for(x=0;x<w+1;x++,pen.inc_x())
162
Tmp1=pen[yadj][(w-x)-2];
162
Tmp1=(typename T::accumulator_type)(pen[yadj][(w-x)-2]);
164
Tmp1=(typename T::accumulator_type)(*pen[yadj]);
242
242
template<typename T> void
243
243
gaussian_blur(T pen, int w, int h, int blur_x, int blur_y)
245
typename T::pointer SC0=new typename T::value_type[w+2];
246
typename T::pointer SC1=new typename T::value_type[w+2];
247
typename T::pointer SC2=new typename T::value_type[w+2];
248
typename T::pointer SC3=new typename T::value_type[w+2];
245
typename T::accumulator_pointer SC0=new typename T::accumulator_type[w+2];
246
typename T::accumulator_pointer SC1=new typename T::accumulator_type[w+2];
247
typename T::accumulator_pointer SC2=new typename T::accumulator_type[w+2];
248
typename T::accumulator_pointer SC3=new typename T::accumulator_type[w+2];