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

local int get_block_size ( int  w,
int  h,
int  mode,
int  min 
)

Compute required block size

This function computes block size (width=height) required for encoding and decoding process. Depending on mode parameter, function returns nearest power of two or power of two plus one.

Parameters:
wSource width
hSource height
modeEither EPS_MODE_NORMAL or EPS_MODE_OTLPF
minMinimal block size
Returns:
Block size (width = height)

Definition at line 108 of file libmain.c.

References EPS_MODE_NORMAL, MAX, and number_of_bits().

Referenced by eps_decode_grayscale_block(), eps_decode_truecolor_block(), eps_encode_grayscale_block(), and eps_encode_truecolor_block().

{
    int max = MAX(MAX(w, h), min);
    int bits = number_of_bits(max);

    if (mode == EPS_MODE_NORMAL) {
        /* W = H = 2 ^ N */
        if (max == (1 << (bits - 1))) {
            return max;
        } else {
            return (1 << bits);
        }
    } else {
        /* W = H = 2 ^ N + 1 */
        if (max == (1 << (bits - 1)) + 1) {
            return max;
        } else if (max == (1 << (bits - 1))) {
            return max + 1;
        } else {
            return (1 << bits) + 1;
        }
    }
}

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