This file is indexed.

/usr/include/ETL/_boxblur.h is in etl-dev 0.04.19-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
/*! ========================================================================
** Extended Template Library
** Box 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__BOXBLUR_H
#define __ETL__BOXBLUR_H

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

/* === 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 T1,typename T2> void
hbox_blur(T1 pen,int w, int h, int length, T2 outpen)
{
	int x,y;
   	typename T1::iterator_x iter, end;

	length=std::min(w,length);
	const float divisor(1.0f/(length*2+1));

	for(y=0;y<h;y++,pen.inc_y(),outpen.inc_y())
	{
		iter=pen.x();
		end=pen.end_x();

		typename T1::accumulator_type tot((typename T1::accumulator_type)(*iter)*(length+1));

		for (x=0;x<length && iter!=end;x++,++iter) tot+=*iter;
		iter=pen.x();

		for (x=0;x<w && iter!=end;x++,++iter,outpen.inc_x())
		{
			tot -= (x>length) ?
				(typename T1::accumulator_type)(iter[-length-1]) :
				(typename T1::accumulator_type)(*pen.x());
			tot += ((x+length)<w) ?
				(typename T1::accumulator_type)(iter[length]) :
				(typename T1::accumulator_type)(end[-1]);
									  
			outpen.put_value((typename T2::value_type)(tot*divisor));
		}
		outpen.dec_x(x);
	}
}

#if 1
template<typename T1,typename T2> void
vbox_blur(T1 pen,const int w, const int h, int length, T2 outpen)
{
	int x,y;
   	typename T1::iterator_y iter, end;

	length=std::min(h,length);
	const float divisor(1.0f/(length*2+1));

	for(x=0;x<w;x++,pen.inc_x(),outpen.inc_x())
	{
		iter=pen.y();
		end=pen.end_y();

		typename T1::accumulator_type tot((typename T1::accumulator_type)(*iter)*(length+1));

		for (y=0;y<length && iter!=end;y++,++iter) tot+=*iter;
		iter=pen.y();

		for (y=0;y<h && iter!=end;y++,++iter,outpen.inc_y())
		{
			tot -= (y>length) ?
			(typename T1::accumulator_type)(iter[-length-1]) :
			(typename T1::accumulator_type)(*pen.y());
			tot += ((y+length)<h) ?
			(typename T1::accumulator_type)(iter[length]) :
			(typename T1::accumulator_type)(end[-1]);

			outpen.put_value((typename T2::value_type)(tot*divisor));
		}
		outpen.dec_y(y);
	}
}

#else

template<typename T1,typename T2> void
vbox_blur(T1 pen,int w, int h, int length,T2 outpen)
{
	int x,y;
   	typename T1::iterator_y iter, end, biter,eiter;

	//print out the info I need to figure out if this is somehow a buffer overrun...
	/*char *beginptr=0,*endptr=0;
	{
		T1 ypen = pen;
		T1 endpen = pen;
		endpen.move(w,h);
		ypen.inc_y();

		T2 	open = outpen,
			oepen = outpen;
		oepen.move(w,h);
		printf("V Blur (%d,%d,s-%d) in(%p,%p,st %d) out(%p,%p)\n",
				w,h,length,(char*)pen.x(),(char*)endpen.x(),(char*)ypen.x()-(char*)pen.x(),
				(char*)open.x(),(char*)oepen.x());
	}*/
	length=min(h-1,length);

	const float divisor(1.0f/(length*2+1));
	//const int div = (length*2+1);

	//since the filter range is 2*length+1 we need h-1
	for(x=0;x<w;x++,pen.inc_x(),outpen.inc_x())
	{
		iter=pen.y();
		end=pen.end_y();

		const typename T1::value_type bval = *iter;
		const typename T1::value_type eval = end[-1];

		typename T1::accumulator_type tot(bval*(length+1));
		//beginptr = (char*)&*iter; endptr = (char*)&*end;

		//printf("\nx line %d (%p,%p)\n",x,beginptr,endptr);

		//printf("Init %.3f - ",tot);
		for (y=0;y<length && iter!=end;y++)
		{
			tot+=iter[y];
			//printf("(%d,%p,+%.3f->%.3f),",y,&iter[y],iter[y],tot);
		}
		iter=pen.y();

		//printf(" tot=%.3f\n",tot);

		biter = iter+(-length-1); //get the first one...
		eiter = iter+length;

		//y will always be > length
		//T2 open = outpen;
		for (y=0;y<h && iter!=end;y++,++iter,++biter,++eiter,outpen.inc_y())
		{
			//printf("y line %d - (%f) ",y,tot);

			if (y>length)
			{
				typename T1::value_type &v = *biter;
				/*if( (char*)&v < beginptr ||
					(char*)&v >= endptr)
					printf("crap! %d (%p off %p)\n",y,(char*)&v,(char*)&*iter);*/
				tot -= v;
				//printf("[%.3f,",v);
			}
			else
			{
				tot -= bval;
				//printf("[%.3f,",bval);
			}

			if (y+length<h)
			{
				typename T1::value_type &v = *eiter;
				/*if( (char*)&v < beginptr ||
					(char*)&v >= endptr)
					printf("crap! %d (%p off %p)\n",y,(char*)&v,(char*)&*iter);*/
				tot += v;
				//printf("%.3f]",v);
			}
			else
			{
				tot += eval;
				//printf("%.3f]",eval);
			}

			//test handled in the previous case...
			//tot -= (y>length) ? *biter : bval;
			//tot += (y+length<h) ? *eiter : eval;

			//printf(" - %.3f\n",tot);
			outpen.put_value(tot*divisor);
		}
		outpen.dec_y(y);
	}
}
#endif

template<typename T1,typename T2> void
box_blur(T1 pen,int w, int h, int blur_w, int blur_h, T2 outpen)
	{ hbox_blur(pen,w,h,blur_w,outpen); vbox_blur(pen,w,h,blur_h,outpen); }

template<typename T1,typename T2> void
box_blur(T1 pen,int w, int h, int size, T2 outpen)
	{ hbox_blur(pen,w,h,size,outpen); vbox_blur(pen,w,h,size,outpen); }

template<typename T1,typename T2> void
hbox_blur(T1 begin,T1 end, int len,T2 outpen)
{
	typename T1::difference_type size(end-begin);
	hbox_blur(begin,size.x,size.y,len,outpen);
}

template<typename T1,typename T2> void
vbox_blur(T1 begin,T1 end, int len,T2 outpen)
{
	typename T1::difference_type size(end-begin);
	vbox_blur(begin,size.x,size.y,len,outpen);
}

template<typename T1,typename T2> void
box_blur(T1 begin,T1 end, int blur_w, int blur_h,T2 outpen)
{
	typename T1::difference_type size(end-begin);
	hbox_blur(begin,size.x,size.y,blur_w,outpen); vbox_blur(begin,size.x,size.y,blur_h,outpen);
}

template<typename T1,typename T2> void
box_blur(T1 begin,T1 end, int blursize,T2 outpen)
{
	typename T1::difference_type size(end-begin);
	hbox_blur(begin,size.x,size.y,blursize,outpen); vbox_blur(begin,size.x,size.y,blursize,outpen);
}

_ETL_END_NAMESPACE

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

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

#endif