// ***************** prog.c ****************************************** // Dsp program sample 1d-median filter // // (c) multicore.ru // // ******************************************************************* float x[200]; float y[200]; float z0[200]; float z1[200]; // // @description: 1d median filter // @parameters : signal - input signal // result - output signal // N - length of the signal void MedianFilter(const float* signal, float* result, int N) { // Move window through all elements of the signal for (int i = 2; i < N - 2; ++i) { // Pick up window elements float window[5]; for (int j = 0; j < 5; ++j) window[j] = signal[i - 2 + j]; // Order elements (only half of them) for (int j = 0; j < 3; ++j) { // Find position of minimum element int min = j; for (int k = j + 1; k < 5; ++k) if (window[k] < window[min]) min = k; // Put found minimum element in its place const float temp = window[j]; window[j] = window[min]; window[min] = temp; } // Get result - the middle element result[i - 2] = window[2]; } } int main() { return 0; }