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

local int significance_test ( pixel_set set,
int  threshold,
int **  channel,
int  channel_size 
)

Significance test

The purpose of this function is to compare set against threshold. If the set have a coefficient greater than or equal to threshold, then it is said that the set is significant. If all coefficients of the set are below threshold, then it is said that the set is insignificant.

Parameters:
setSet to test
thresholdThreshold to compare against
channelChannel
channel_sizeChannel size
Returns:
1 for significant sets and 0 for insignificant ones

Definition at line 205 of file speck.c.

References ABS, TYPE_I, TYPE_POINT, TYPE_S, and validate_set().

Referenced by speck_encode_S(), speck_process_I(), and speck_process_S().

{
#ifdef ENABLE_SET_VALIDATION
    /* Ensure that the set is valid */
    assert(validate_set(set, channel_size));
#endif

    assert(threshold > 0);

    switch (set->type) {
        case TYPE_POINT:
        {
            /* Single point */
            return (ABS(channel[set->x][set->y]) >= threshold);
            break;
        }
        case TYPE_S:
        {
            /* Set of type 'S' */
            int x, y;

            for (x = set->x; x < set->x + set->height; x++) {
                for (y = set->y; y < set->y + set->width; y++) {
                    if (ABS(channel[x][y]) >= threshold) {
                        return 1;
                    }
                }
            }

            return 0;
            break;
        }
        case TYPE_I:
        {
            /* Set of type 'I' */
            int x, y;

            for (x = 0; x < channel_size; x++) {
                for (y = 0; y < channel_size; y++) {
                    if ((x >= set->x) || (y >= set->y)) {
                        if (ABS(channel[x][y]) >= threshold) {
                            return 1;
                        }
                    }
                }
            }

            return 0;
            break;
        }
        default:
        {
            assert(0);
            break;
        }
    }
}

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