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

local int speck_decode_S ( int **  channel,
int  channel_size,
pixel_set set,
linked_list **  LIS_slots,
linked_list LSP,
bit_buffer bb,
int  threshold 
)

Decode set of type 'S'

This function is inverse to speck_encode_S.

Parameters:
channelChannel
channel_sizeChannel size
setSet to decode
LIS_slotsArray of LIS slots
LSPList of Significant Pixels
bbBit-buffer
thresholdThreshold
Returns:
Either BIT_BUFFER_OK or BIT_BUFFER_UNDERFLOW

Definition at line 672 of file speck.c.

References alloc_list_node(), append_list_node(), assign_set(), BIT_BUFFER_OK, prepend_list_node(), read_bit, RETURN_IF_UNDERFLOW, SLOT_INDEX, speck_decode_S(), split_set(), TYPE_EMPTY, TYPE_POINT, pixel_set_tag::x, and pixel_set_tag::y.

Referenced by speck_decode_S(), and speck_unprocess_S().

{
    pixel_set new_sets[4];
    int result;
    int st[4];
    int flag;
    int i;

    /* Split parent set */
    split_set(set, &new_sets[0], &new_sets[1], &new_sets[2], &new_sets[3], channel_size);

    /* Test each set for significance skipping over empty sets */
    for (flag = 0, i = 3; i >= 0; i--) {
        if (new_sets[i].type == TYPE_EMPTY) {
            continue;
        }

        if (i) {
            result = read_bit(bb, &st[i]);
            RETURN_IF_UNDERFLOW(result);

            flag |= st[i];
        } else {
            if (flag) {
                result = read_bit(bb, &st[i]);
                RETURN_IF_UNDERFLOW(result);
            } else {
                /* Implicitly significant set */
                st[i] = 1;
            }
        }
    }

    /* Process non-empty sets using their significance information */
    for (i = 0; i < 4; i++) {
        if (new_sets[i].type == TYPE_EMPTY) {
            continue;
        }

        if (st[i]) {
            /* Significant set */
            if (new_sets[i].type == TYPE_POINT) {
                /* Single point */
                list_node *new_node;
                int sign = 0;

                result = read_bit(bb, &sign);
                RETURN_IF_UNDERFLOW(result);

                /* Decode coefficient sign */
                if (sign) {
                    channel[new_sets[i].x][new_sets[i].y] =
                        -(threshold + (threshold >> 1));
                } else {
                    channel[new_sets[i].x][new_sets[i].y] =
                         (threshold + (threshold >> 1));
                }

                new_node = alloc_list_node(sizeof(pixel_set));
                assign_set(new_node, &new_sets[i]);
                append_list_node(LSP, new_node);
            } else {
                /* Decode set of type 'S' */
                result = speck_decode_S(channel, channel_size, &new_sets[i],
                                        LIS_slots, LSP, bb, threshold);
    
                RETURN_IF_UNDERFLOW(result);
            }
        } else {
            /* Insignificant set */
            list_node *new_node = alloc_list_node(sizeof(pixel_set));
            assign_set(new_node, &new_sets[i]);
            prepend_list_node(LIS_slots[SLOT_INDEX((&new_sets[i]))], new_node);            
        }
    }

    return BIT_BUFFER_OK;
}

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