IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 12, 2008, 12:36:29 PM (18 years ago)
Author:
Paul Price
Message:

Optimising psPixelsConcatenate: use of qsort took ages. Split into two functions: psPixelsConcatenate (joing two pixel lists) and psPixelsDuplicates (remove duplicates in a list; works nicely in-place), and using PSSORT instead of qsort. Much faster!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/types/tap_psPixels_all.c

    r17515 r19539  
    5151    }
    5252    //Make sure psMemCheckPixels works correctly - return false
    53     // XXX EAM : disabled -- failing test causes segfault 
     53    // XXX EAM : disabled -- failing test causes segfault
    5454    if (0) {
    5555        int j = 2;
     
    349349    {
    350350        psMemId id = psMemGetId();
    351         psPixels *outPixels = psPixelsAlloc(5);
     351        psPixels *outPixels = psPixelsAlloc(6);
    352352        in.x = 1.0;
    353353        in.y = 1.0;
     
    360360        in.x = 2.0;
    361361        psPixelsSet(outPixels, 4, in);  //2, 1
    362         psPixels *testPixels = psPixelsAlloc(6);
     362        in.y = 2.0;
     363        psPixelsSet(outPixels, 5, in);  //2, 2
     364        psPixels *testPixels = psPixelsAlloc(7);
    363365        in.x = 1.0;
    364366        in.y = 1.0;
     
    370372        in.x = 2.0;
    371373        psPixelsSet(testPixels, 3, in);  //2, 1
     374        in.y = 2.0;
     375        psPixelsSet(testPixels, 4, in);  //2, 2
    372376        in.x = 1.0;
    373         psPixelsSet(testPixels, 4, in);  //1, 1
     377        psPixelsSet(testPixels, 5, in);  //1, 2
    374378        in.x = 5.0;
    375379        in.y = 3.0;
    376         psPixelsSet(testPixels, 5, in);  //5, 3
     380        psPixelsSet(testPixels, 6, in);  //5, 3
    377381        outPixels = psPixelsConcatenate(outPixels, testPixels);
    378         ok(outPixels->n == 6, "psPixelsConcatenate:  return properly concatenate pixel list for valid inputs.");
     382        outPixels = psPixelsDuplicates(outPixels, outPixels);
     383        // Should be 5 entries: (1,1) (2,1) (1,2) (2,2) (5,3)
     384        ok(outPixels->n == 5, "psPixelsConcatenate:  return properly concatenate pixel list for valid inputs.");
    379385        psFree(testPixels);
    380386        psFree(outPixels);
Note: See TracChangeset for help on using the changeset viewer.