9 #define _USE_MATH_DEFINES    15 #include <sys/types.h>    25 template <
int filter_len>
    33             float t = (float)index + 0.5f - 0.5f*(
float)filter_len;
    35             float s = sinf(2*M_PI*fc*t + 1e-6f) / (2*M_PI*fc*t + 1e-6f);
    37             float w = 0.53836 - 0.46164*cosf((2*M_PI*(
float)index)/((
float)(filter_len-1)));
    39             return (s * w)*(1<<14);
    46         template <std::
size_t N>
    49             return coeff_fill(std::make_index_sequence<N>{});
    53         static const ::std::array<short int,filter_len> 
coeffs;
    70             insamp[filter_len - 1] = 
input;
    75             acc = (1 << 14)+((int32_t)(coeffs[0]) * (int32_t)(
input));
    77             for ( k = 0; k < filter_len-1; k++ ) {
    78                 acc += (int32_t)(coeffs[filter_len - 1 -k]) * (int32_t)(insamp[k]);
    80                 insamp[
k] = insamp[1+
k];
    83             if ( acc > 0x3fffffff ) {
    85             } 
else if ( acc < -0x40000000 ) {
    89             output = (int16_t)(acc >> 15);
    96 template <
int filter_len>
   101 #define FILTER_LEN     63   110 firFixed( 
short int input)
   129     in_fid = open( 
"input.pcm", O_RDONLY );
   132         printf(
"couldn't open input.pcm");
   138     out_fid = open( 
"outputFixed.pcm", O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH );
   141         printf(
"couldn't open outputFixed.pcm");
   149         size = 
read(in_fid, &input, 
sizeof(int16_t))/
sizeof(int16_t);
   154             output = firFixed( input );
   156             write(out_fid, &output, 
sizeof(int16_t));
   158     } 
while ( size != 0 );
 
short int operator()(short int input)
static const ::std::array< short int, filter_len > coeffs
filter coefficients 
volatile int output[DIM_Y][DIM_X]
short int __attribute__((noinline)) firFixed(short int input)
static const uint32_t k[]
static constexpr std::array< short int, N > coeff_fill()
static constexpr std::array< short int, sizeof...(I)> coeff_fill(std::index_sequence< I... >)
static constexpr short int compute_coeff(size_t index)
int16_t insamp[filter_len]
short int read(short int *data)