Logo Search packages:      
Sourcecode: librasterlite version File versions  Download package

local void filter_symmetric ( coeff_t input_signal,
coeff_t output_signal,
int  signal_length,
filter_t filter 
) [inline]

Symmetric signal filtering

This function filters input_signal of length signal_length into the output_signal using specified filter. Boundary samples are evaluated using symmetric extension.

Parameters:
input_signalInput signal
output_signalOutput signal
signal_lengthSignal length
filterFilter
Returns:
VOID
Note:
filter must be biorthogonal.
signal_length can be either even or odd.
Todo:
Add support for even-length biorthogonal filters.

Definition at line 145 of file filter.c.

References filter_t_tag::causality, filter_t_tag::coeffs, HIGHPASS_ANALYSIS, filter_t_tag::length, LOWPASS_ANALYSIS, symmetric_W_extension(), SYMMETRIC_WHOLE, and filter_t_tag::type.

Referenced by analysis_1D(), and synthesis_1D().

{
    int i, j, k1, k2;

    switch (filter->causality) {
        case SYMMETRIC_WHOLE:
        {
            if (filter->type == LOWPASS_ANALYSIS) {
                for (i = 0; i < signal_length; i += 2) {
                    output_signal[i] = input_signal[i] * filter->coeffs[0];
                    for (j = 1; j < filter->length; j++) {
                        k1 = symmetric_W_extension(i + j, signal_length);
                        k2 = symmetric_W_extension(i - j, signal_length);
                        output_signal[i] +=
                            (input_signal[k1] + input_signal[k2]) * filter->coeffs[j];
                    }
                }
            } else if (filter->type == HIGHPASS_ANALYSIS) {
                for (i = 1; i < signal_length; i += 2) {
                    output_signal[i] = input_signal[i] * filter->coeffs[0];
                    for (j = 1; j < filter->length; j++) {
                        k1 = symmetric_W_extension(i + j, signal_length);
                        k2 = symmetric_W_extension(i - j, signal_length);
                        output_signal[i] +=
                            (input_signal[k1] + input_signal[k2]) * filter->coeffs[j];
                    }
                }
            } else {
                for (i = 0; i < signal_length; i++) {
                    output_signal[i] = input_signal[i] * filter->coeffs[0];
                    for (j = 1; j < filter->length; j++) {
                        k1 = symmetric_W_extension(i + j, signal_length);
                        k2 = symmetric_W_extension(i - j, signal_length);
                        output_signal[i] +=
                            (input_signal[k1] + input_signal[k2]) * filter->coeffs[j];
                    }
                }
            }

            break;
        }
        /* Some day I hope to add 'case SYMMETRIC_HALF' here */
        default:
        {
            assert(0);
            break;
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index