IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 24, 2008, 12:22:51 PM (18 years ago)
Author:
Paul Price
Message:

Adding test for psImageConvolveMask.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/imageops/tap_psImageConvolve2.c

    r17331 r17806  
    9898int main(int argc, char *argv[])
    9999{
    100     plan_tests(20);
     100    plan_tests(30);
    101101
    102102    diag("psImageConvolve tests");
    103103
    104104    {
     105        diag("Mask convolution");
     106        // Better (separable) mask convolution: 5 tests
     107        psMemId id = psMemGetId();
     108
     109        psImage *mask = generateMask();
     110
     111        psImage *convolved = psImageConvolveMask(NULL, mask, MASK_INITIAL, MASK_FINAL,
     112                                                 -KERNEL_SIZE, KERNEL_SIZE, -KERNEL_SIZE, KERNEL_SIZE);
     113        ok(convolved, "convolution result");
     114        skip_start(!convolved, 3, "convolution failed");
     115        ok(convolved->type.type == PS_TYPE_MASK, "output type");
     116        ok(convolved->numCols == IMAGE_SIZE && convolved->numRows == IMAGE_SIZE, "output size %dx%d",
     117           convolved->numCols, convolved->numRows);
     118        ok(checkConvolvedMask(convolved), "convolved mask correct");
     119        psFree(convolved);
     120        skip_end();
     121
     122        psFree(mask);
     123
     124        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     125    }
     126
     127    {
     128        diag("Mask convolution in-place");
     129        // Better (separable) in-place FFT mask convolution: 5 tests
     130        psMemId id = psMemGetId();
     131
     132        psImage *mask = generateMask();
     133
     134        bool result = psImageConvolveMask(mask, mask, MASK_INITIAL, MASK_FINAL, -KERNEL_SIZE, KERNEL_SIZE,
     135                                          -KERNEL_SIZE, KERNEL_SIZE);
     136        ok(result, "convolution result");
     137        skip_start(!result, 3, "convolution failed");
     138        ok(mask->type.type == PS_TYPE_MASK, "output type");
     139        ok(mask->numCols == IMAGE_SIZE && mask->numRows == IMAGE_SIZE, "output size %dx%d",
     140           mask->numCols, mask->numRows);
     141        ok(checkConvolvedMask(mask), "convolved mask correct");
     142        skip_end();
     143
     144        psFree(mask);
     145
     146        ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks");
     147    }
     148
     149    {
     150        diag("Direct convolution");
    105151        // Direct convolution: 5 tests
    106152        psMemId id = psMemGetId();
     
    126172
    127173    {
     174        diag("FFT convolution");
    128175        // FFT convolution: 5 tests
    129176        psMemId id = psMemGetId();
     
    149196
    150197    {
     198        diag("FFT mask convolution");
    151199        // FFT mask convolution: 5 tests
    152200        psMemId id = psMemGetId();
     
    172220
    173221    {
     222        diag("FFT mask convolution in-place");
    174223        // In-place FFT mask convolution: 5 tests
    175224        psMemId id = psMemGetId();
     
    192241    }
    193242
    194 
    195243    return exit_status();
    196244}
Note: See TracChangeset for help on using the changeset viewer.