Example #1
0
void software_3x3_filter(const char *input)
{
    filter_params filter;
    Image iImage = IMAGE_INITIALIZER;
    Image oImage = IMAGE_INITIALIZER;
    Benchmark b;
    int val = 0;

    initBenchmark(&b, "Software 3x3 Filter", "");

    filter_Init(&filter, 4, 2, 1, 4);
    ImageRead(input, &iImage);

    startBenchmark(&b);
    val = filter_Execute(&filter, &iImage, &oImage);
    stopBenchmark(&b);

    if(val != 0) {
        fprintf(stderr, "software_3x3_filter: ERROR: Filter failed.\n");
    }

    printBenchmark(&b);
    ImageWrite("software_3x3.tif",&oImage);
    ImageCleanup(&oImage);
    ImageCleanup(&iImage);
}
Example #2
0
int main(int argc, const char * argv[])
{
    static const uint32_t MAX_COUNT = 100000;
    static const uint32_t NUM_TRIALS = 20;
    static const unsigned int NUM_SORTS = 5;
    
    SortBenchmark benchmarks[NUM_SORTS] = { NewSortBenchmark(SortAlgorithmC, NUM_TRIALS),
                                            NewSortBenchmark(SortAlgorithmQuick, NUM_TRIALS),
                                            NewSortBenchmark(SortAlgorithmHeap, NUM_TRIALS),
                                            NewSortBenchmark(SortAlgorithmInsertion, NUM_TRIALS),
                                            NewSortBenchmark(SortAlgorithmSelection, NUM_TRIALS) };
    
    uint32_t randomArray[MAX_COUNT];
    
    for (unsigned int t = 0; t < NUM_TRIALS; t++) {
        printf("\n::: TRIAL %d :::\n", t + 1);
        
        fillArrayWithRandomIntegers(randomArray, MAX_COUNT);
        
        for (unsigned int s = 0; s < NUM_SORTS; s++) {
            SortBenchmark b = benchmarks[s];
            
            double time = sortArrayWithBenchmark(randomArray, MAX_COUNT, b);
            b.sortTimes[t] = time;
        }
        
        memset(&randomArray[0], 0, sizeof(randomArray));
    }
    
    printf("\nFinal Results:\n--------------\n");
    for (unsigned int i = 0; i < NUM_SORTS; i++) {
        printBenchmark(benchmarks[i]);
    }
    
    printf("\n");
    
    for (unsigned int i = 0; i < NUM_SORTS; i++) {
        free(benchmarks[i].sortTimes);
    }
    
    return 0;
}
Example #3
0
void hardware_3x3_filter(const char *input)
{
#ifdef ZYNQ
    Image iImage = IMAGE_INITIALIZER;
    Image oImage = IMAGE_INITIALIZER;
    hardware_config hard_config;
    Benchmark b;
    int val = 0;

    initBenchmark(&b, "Hardware 3x3 Filter", "");
    ImageRead(input, &iImage);
    if(hardware_filter_init(&iImage, &hard_config) != 0) {
        fprintf(stderr, "hardware_3x3_filter: ERROR: Failed to initialize hardware driver\n");
        return;
    }

    startBenchmark(&b);
    val = hardware_filter_execute(&hard_config);
    stopBenchmark(&b);
    if(val != 0) {
        fprintf(stderr, "hardware_3x3_filter: ERROR: Filter failed.\n");
    }

    val = hardware_filter_cleanup(&iImage, &oImage, &hard_config);
    if(val != 0) {
        fprintf(stderr, "hardware_3x3_filter: ERROR: Hardware filter failed to clean up.\n");
    }

    printBenchmark(&b);
    ImageWrite("hardware_3x3.tif",&oImage);
    ImageCleanup(&oImage);
    ImageCleanup(&iImage);
#else
    fprintf(stderr, "Hardware 3x3 filter not supported on x86 platform\n");
#endif

}