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

local int decode_refinement_pass ( int **  channel,
linked_list LSP,
bit_buffer bb,
int  threshold 
)

Decode refinement pass

The SPECK decoding algorithm alternates two types of passes through the data: sorting pass and refinement pass. This function implements the second one.

Parameters:
channelChannel
LSPList of Significant Pixels
bbBit-buffer
thresholdThreshold
Returns:
Either BIT_BUFFER_OK or BIT_BUFFER_UNDERFLOW

Definition at line 918 of file speck.c.

References ABS, BIT_BUFFER_OK, linked_list_tag::first, list_node_tag::next, PIXEL_SET, read_bit, and RETURN_IF_OVERFLOW.

Referenced by speck_decode().

{
    list_node *node;
    int result;
    int mask;

    node = LSP->first;

    mask = threshold;
    threshold <<= 1;

    /* Travels through all nodes in LSP */
    while (node) {
        pixel_set *set = PIXEL_SET(node);

        int coeff = ABS(channel[set->x][set->y]);
        int sign = channel[set->x][set->y] < 0;

        if (coeff >= threshold) {
            int bit = 0;

            /* Read and shift-in next bit */
            result = read_bit(bb, &bit);
            RETURN_IF_OVERFLOW(result);

            if (bit) {
                coeff |= mask;
            } else {
                coeff &= ~mask;
            }

            coeff |= (mask >> 1);
            channel[set->x][set->y] = sign ? -coeff : coeff;
        }

        /* Next node */
        node = node->next;
    }

    return BIT_BUFFER_OK;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index