Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7679 Discussions

C code in Intel's Fritz Gerneth's FIR implementation for Atom

Silva__Saulo
Beginner
316 Views

I have downloaded a 2010 paper by Fritz Gerneth, FIR Filter Algorithm Implementation Using Intel SSE Instructions, targeted for the Atom.

In page 4, there is a brief description of the sum to be implemented and vectorized. The code is as follows:

for ( j = 0; j < 640; j++ ) {
    int s = 0;     // s = accumulator
    for ( i =0; i <= 63; i++ )
        s += c * x[i + j];  // x[] = input values, c[] = filter coefficients
    y = s;     // y[] = output values
}

When j is at the last iteration (639) and i is in the second (1), the index in x[i + j] will overflow, as the text says it is 640 input elements that will be filtered. By the time i is in its last iteration (63), we will have x[63 + 639], which is clearly broken.

0 Kudos
0 Replies
Reply