This file is indexed.

/usr/share/doc/librtfilter1/examples/butterworth.c is in librtfilter-dev 1.1-4.

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
/*
    Copyright (C) 2010-2011 Nicolas Bourdaud <nicolas.bourdaud@epfl.ch>

    The program is free software: you can redistribute it and/or
    modify it under the terms of the version 3 of the GNU General
    Public License as published by the Free Software Foundation.
  
    This program 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.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
/* This program presents a very simple example of the use of the rtfilter
library. It simply creates a multichannel signal. Each channel contains a
ramp of the same length with an amplitude specific to each channel.

The input data in created and processd by chunk of CHUNKNS samples. The
input and output data are then recorded on 2 files: input.bin and
output.bin.
*/
#include <rtf_common.h>
#include <rtfilter.h>
#include <stdlib.h>
#include <stdio.h>

#define NCH		8	
#define FS		512	/* in Hz */
#define CUTOFF		8	/* in Hz */
#define CHUNKNS		16	
#define RAMPDUR		0.1	/* in seconds */
#define DURATION	10	/* in seconds */
#define NPOLES		2

/* Create a ramp signal in each channel */
static
void create_input(float* data, unsigned int ns, unsigned int cs)
{
	unsigned int j, i, ramplen;
	
	ramplen = (unsigned int)(RAMPDUR*FS);

	for (j=0; j<NCH; j++) 
		for (i=0; i<ns; i++) 
			data[i*NCH+j] = (j+1)*((cs+i) % ramplen);
}


int main(int argc, char* argv[])
{
	(void)argc;	/* Disable warning about unsed variable */
	(void)argv; 	/* Disable warning about unsed variable */

	float input[CHUNKNS*NCH], output[CHUNKNS*NCH];
	double normfc;
	unsigned int i;
	hfilter filt = NULL;
	FILE *fin = NULL, *fout = NULL;
	size_t ins, ons;
	int retcode = EXIT_FAILURE;

	/* Create the butterworth filter */
	normfc = (double)CUTOFF/(double)FS;
	filt = rtf_create_butterworth(NCH, RTF_FLOAT, normfc, NPOLES, 0);
	if (filt == NULL)
		goto exit;

	/* Open the streams for writing input and ouput signals */
	fin = fopen("input.bin", "wb");
	fout = fopen("output.bin", "wb");
	if (fin == NULL || fout == NULL) 
		goto exit;

	/* Loop over sample */
	for (i=0; i<DURATION*FS; i+=CHUNKNS) {
		/* prepare the input chunk */
		create_input(input, CHUNKNS, i);

		/* Filter the data */
		rtf_filter(filt, input, output, CHUNKNS);

		/* Write the input and output on files */
		ins = fwrite(input, sizeof(float)*NCH, CHUNKNS, fin);
		ons = fwrite(output, sizeof(float)*NCH, CHUNKNS, fout);
		if (ins < CHUNKNS || ons < CHUNKNS)
			goto exit;
	}

	retcode = EXIT_SUCCESS;

exit:
	fclose(fin);
	fclose(fout);
	rtf_destroy_filter(filt);
	return retcode;
}