This file is indexed.

/usr/include/ETL/_gaussian.h is in etl-dev 0.04.17-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
/*! ========================================================================
** Extended Template Library
** Gaussian Blur Template Implementation
** $Id$
**
** Copyright (c) 2002 Robert B. Quattlebaum Jr.
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of
** the License, or (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
**
** === N O T E S ===========================================================
**
** This is an internal header file, included by other ETL headers.
** You should not attempt to use it directly.
**
** ========================================================================= */

/* === S T A R T =========================================================== */

#ifndef __ETL__GAUSSIAN_H
#define __ETL__GAUSSIAN_H

/* === H E A D E R S ======================================================= */

#include <cstring>		// for memset()
#include <iterator>

/* === M A C R O S ========================================================= */

/* === T Y P E D E F S ===================================================== */

/* === C L A S S E S & S T R U C T S ======================================= */

_ETL_BEGIN_NAMESPACE

template<typename T> void
gaussian_blur_5x5_(T pen,int w, int h,
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::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]=(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=(typename T::accumulator_type)(pen.y()[yadj])*1.35;}
		else
			{yadj=0; SR0=(typename T::accumulator_type)(pen.get_value())*1.35; }

		SR1=SR2=SR3=typename T::accumulator_type();
		for(x=0;x<w+2;x++,pen.inc_x())
		{
			if(x>=w)
				Tmp1=(typename T::accumulator_type)(pen[yadj][(w-x)-1]);
			else
				Tmp1=(typename T::accumulator_type)(*pen[yadj]);

			Tmp2=SR0+Tmp1;
			SR0=Tmp1;
			Tmp1=SR1+Tmp2;
			SR1=Tmp2;
			Tmp2=SR2+Tmp1;
			SR2=Tmp1;
			Tmp1=SR3+Tmp2;
			SR3=Tmp2;

			// Column Machine
			Tmp2=SC0[x]+Tmp1;
			SC0[x]=Tmp1;
			Tmp1=SC1[x]+Tmp2;
			SC1[x]=Tmp2;
			Tmp2=SC2[x]+Tmp1;
			SC2[x]=Tmp1;
			if(y>1&&x>1)
				pen[-2][-2]=(typename T::value_type)((SC3[x]+Tmp2)/256);
			SC3[x]=Tmp2;
		}
		pen.dec_x(x);
	}

}

template<typename T> void
gaussian_blur_5x5(T pen, int w, int h)
{
	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);

	delete [] SC0;
	delete [] SC1;
	delete [] SC2;
	delete [] SC3;
}

template<typename T> void
gaussian_blur_5x5(T begin, T end)
{
	typename T::difference_type size(end-begin);

	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);

	delete [] SC0;
	delete [] SC1;
	delete [] SC2;
	delete [] SC3;
}

template<typename T> void
gaussian_blur_3x3(T pen,int w, int h)
{
	int x,y;
	typename T::accumulator_type Tmp1,Tmp2,SR0,SR1;

//	typename T::iterator_x iter;

	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]=(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=(typename T::accumulator_type)(pen.y()[yadj]);}
		else
			{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=(typename T::accumulator_type)(pen[yadj][(w-x)-2]);
			else
				Tmp1=(typename T::accumulator_type)(*pen[yadj]);

			Tmp2=SR0+Tmp1;
			SR0=Tmp1;
			Tmp1=SR1+Tmp2;
			SR1=Tmp2;

			Tmp2=SC0[x]+Tmp1;
			SC0[x]=Tmp1;
			if(y&&x)
				pen[-1][-1]=(typename T::value_type)((SC1[x]+Tmp2)/16);
			SC1[x]=Tmp2;
		}
		pen.dec_x(x);
	}

	delete [] SC0;
	delete [] SC1;
}

//! 2D 3x3 pixel gaussian blur
template<typename _PEN> void
gaussian_blur_3x3(_PEN begin, _PEN end)
{
	typename _PEN::difference_type size(end-begin);
	gaussian_blur_3x3(begin,size.x,size.y);
}

//! 1D 3 pixel gaussian blur
template<typename I> void
gaussian_blur_3(I begin, I end, bool endpts = true)
{
//	typedef typename I _itertype;
//	int i;
	typename std::iterator_traits<I>::value_type Tmp1,Tmp2,SR0,SR1;

	SR0=SR1=*begin;
	I iter,prev=begin;
	for(iter=begin;iter!=end;prev=iter++)
	{
		Tmp1=*iter;
		Tmp2=SR0+Tmp1;
		SR0=Tmp1;
		Tmp1=SR1+Tmp2;
		SR1=Tmp2;
		if(iter!=begin && ( endpts || (prev != begin) ))
			*prev=(Tmp1)/4;
	}

	if(endpts)
	{
		Tmp1=*prev;
		Tmp2=SR0+Tmp1;
		SR0=Tmp1;
		Tmp1=SR1+Tmp2;
		SR1=Tmp2;
		*prev=(Tmp1)/4;
	}
}

//! 2D 3x1 pixel gaussian blur
template<typename _PEN> void
gaussian_blur_3x1(_PEN begin, _PEN end)
{
	typename _PEN::difference_type size=end-begin;
	for(;size.y>0;size.y--, begin.inc_y())
		gaussian_blur_3(begin.x(),begin.x()+size.x);
}

//! 2D 1x3 pixel gaussian blur
template<typename _PEN> void
gaussian_blur_1x3(_PEN begin, _PEN end)
{
	typename _PEN::difference_type size=end-begin;
	for(;size.x>0;size.x--,begin.inc_x())
		gaussian_blur_3(begin.y(),begin.y()+size.y);
}

template<typename T> void
gaussian_blur(T pen, int w, int h, int blur_x, int blur_y)
{
	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--;

	while(blur_x&&blur_y)
	{
		if(blur_x>=4 && blur_y>=4)
		{
			gaussian_blur_5x5_(pen,w,h,SC0,SC1,SC2,SC3);
			blur_x-=4,blur_y-=4;
		}
		else if(blur_x>=2 && blur_y>=2)
		{
			gaussian_blur_3x3(pen,w,h);
			blur_x-=2,blur_y-=2;
		}
		else
			blur_x--,blur_y--;
	}
	while(blur_x)
	{
		if(blur_x>=2)
		{
			gaussian_blur_3x1(pen,T(pen).move(w,h));
			blur_x-=2;
		}
		else
			blur_x--;
	}
	while(blur_y)
	{
		if(blur_y>=2)
		{
			gaussian_blur_1x3(pen,T(pen).move(w,h));
			blur_y-=2;
		}
		else
			blur_y--;
	}

	delete [] SC0;
	delete [] SC1;
	delete [] SC2;
	delete [] SC3;
}

template<typename T> void
gaussian_blur(T begin, T end,int w, int h)
{
	typename T::difference_type size(end-begin);
	gaussian_blur(begin,size.x,size.y,w,h);
}

template<typename T> void
gaussian_blur(T begin, T end,int w)
{
	typename T::difference_type size(end-begin);
	gaussian_blur(begin,size.x,size.y,w,w);
}

_ETL_END_NAMESPACE

/* === E X T E R N S ======================================================= */

/* === E N D =============================================================== */

#endif