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

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

Encode refinement pass

The SPECK encoding 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_OVERFLOW

Definition at line 645 of file speck.c.

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

Referenced by speck_encode().

{
    list_node *node;
    int result;

    node = LSP->first;
    threshold <<= 1;

    /* Travels through all nodes in LSP */
    while (node) {
        pixel_set *set = PIXEL_SET(node);
        int coeff = ABS(channel[set->x][set->y]);

        /* Output next bit */
        if (coeff >= threshold) {
            result = coeff & (threshold >> 1) ? write_1(bb) : write_0(bb);
            RETURN_IF_OVERFLOW(result);
        }

        /* 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