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

void analysis_2D ( coeff_t **  input_signal,
coeff_t **  output_signal,
int  signal_length,
int  mode,
filterbank_t fb 
)

Two dimensional wavelet decomposition

This function performes N stages of 2D wavelet decomposition of input_signal using filter bank fb. Image is assumed to be square: if mode = MODE_NORMAL, then width = height = signal_length = 2 ^ N; if mode = MODE_OTLPF, then width = height = signal_length = (2 ^ N) + 1.

Parameters:
input_signalInput signal
output_signalOutput signal
signal_lengthSignal length (width = height)
modeEither MODE_NORMAL or MODE_OTLPF
fbFilter bank
Returns:
VOID

Definition at line 287 of file filter.c.

References analysis_1D(), daub97lift_analysis_1D_even(), daub97lift_analysis_1D_odd(), filterbank_t_tag::id, MODE_NORMAL, MODE_OTLPF, number_of_bits(), and xmalloc().

Referenced by eps_encode_grayscale_block(), and eps_encode_truecolor_block().

{
    coeff_t *input;
    coeff_t *output;
    coeff_t *temp;

    int scale, length;
    int scales;
    int i, j;

    assert(signal_length > 1);

    /* Transform as many times as possible */
    scales = number_of_bits(signal_length) - 1;

    /* Sanity checks */
    assert(((mode == MODE_NORMAL) && (signal_length == 1 << scales)) ||
           ((mode == MODE_OTLPF) && (signal_length == (1 << scales) + 1)));

    input = xmalloc(signal_length * sizeof(coeff_t));
    output = xmalloc(signal_length * sizeof(coeff_t));
    temp = xmalloc(signal_length * sizeof(coeff_t));

    for (i = 0; i < signal_length; i++) {
        for (j = 0; j < signal_length; j++) {
            output_signal[i][j] = input_signal[i][j];
        }
    }

    /* Transform image */
    for (scale = 0; scale < scales; scale++) {
        length = mode + (1 << (scales - scale));

        /* Transform rows */
        for (i = 0; i < length; i++) {
            for (j = 0; j < length; j++) {
                input[j] = output_signal[i][j];
            }

            if (!strcmp(fb->id, "daub97lift")) {
                if (length % 2) {
                    daub97lift_analysis_1D_odd(input, output, length);
                } else {
                    daub97lift_analysis_1D_even(input, output, length);
                }
            } else {
                analysis_1D(input, output, temp, length, fb);
            }

            for (j = 0; j < length; j++) {
                output_signal[i][j] = output[j];
            }
        }

        /* Transform columns */
        for (i = 0; i < length; i++) {
            for (j = 0; j < length; j++) {
                input[j] = output_signal[j][i];
            }

            if (!strcmp(fb->id, "daub97lift")) {
                if (length % 2) {
                    daub97lift_analysis_1D_odd(input, output, length);
                } else {
                    daub97lift_analysis_1D_even(input, output, length);
                }
            } else {
                analysis_1D(input, output, temp, length, fb);
            }

            for (j = 0; j < length; j++) {
                output_signal[j][i] = output[j];
            }
        }
    }

    free(input);
    free(output);
    free(temp);
}

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