/normxcorr/trunk

To get this branch, use:
bzr branch http://suren.me/webbzr/normxcorr/trunk

« back to all changes in this revision

Viewing changes to dict_hw/src/dict_hw.cu

  • Committer: Suren A. Chilingaryan
  • Date: 2009-12-13 02:20:05 UTC
  • Revision ID: csa@dside.dyndns.org-20091213022005-m932to8hhihwuw5r
Support for TIFF images in C code and stand-alone console application

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
#include "dict_hw.h"
6
6
 
 
7
#include "dict_image.h"
 
8
 
7
9
#include "helpers.h"
8
10
 
9
11
#include "local_sum.cu.h"
47
49
}
48
50
 
49
51
int dictSetLogger(DICTLogger error_reporter, DICTLogger message_writer) {
50
 
    reportError = error_reporter;
51
 
    reportMessage = message_writer;
 
52
    return reportSet(error_reporter, message_writer);
52
53
}
53
54
 
54
 
 
55
 
int dictSetup(DICTContext ps, int ncp, int corr_size, int precision, DICTFlags flags) {
 
55
int dictSetup(DICTContext ps, int ncp, int corr_size, int precision, int flags) {
56
56
    int base_blocks, side_blocks;
57
57
 
58
58
    fftFree(ps);
69
69
    } else {
70
70
        ps->fft_real_size = next_power(ps->fft_size);
71
71
    }
 
72
    
 
73
    if (flags&DICT_FLAGS_MATLAB_MODE) {
 
74
        ps->matlab_mode = 1;
 
75
    } else {
 
76
        ps->matlab_mode = 0;
 
77
    }
72
78
 
73
79
    ps->ncp_alloc_size = calc_alloc(ps->ncp, CP_BLOCK);
74
80
    ps->side_alloc_size = calc_alloc(ps->fft_size, SIDE_BLOCK_SIZE);
192
198
    }
193
199
 
194
200
    if ((ps->base_mode)&&(!ps->mode)) {
195
 
//          printf("%ux%u\n", width, height);
196
 
 
197
201
        // Correcting difference of area size between base and data images
198
202
        ps->minx += ps->corr_size;
199
203
        ps->miny += ps->corr_size;
222
226
int dictLoadFragment(DICTContext ps, int icp, int ncp, const unsigned char *input) {
223
227
    int err;
224
228
    cudaStream_t stream = NULL;
225
 
 
226
229
    
227
230
        err = fftCopyFragment(ps, icp, ncp, input);
228
231
        if (err) return err;
312
315
    if (err) return err;
313
316
    return dictCompute(ps);
314
317
}
 
318
 
 
319
int dictLoadTemplateImageFile(DICTContext ps, const char *name) {
 
320
    int err = dictImageLoadTemplateImage(ps, name);
 
321
    if (err) return err;
 
322
    return dictLoadTemplateImage(ps, ps->image, ps->width, ps->height);
 
323
}
 
324
int dictLoadImageFile(DICTContext ps, const char *name) {
 
325
    int err = dictImageLoadImage(ps, name);
 
326
    if (err) return err;
 
327
    return dictLoadImage(ps, ps->image);
 
328
}
 
329
 
 
330
int dictProcessImageFile(DICTContext ps, const char *name) {
 
331
    int err = dictLoadImageFile(ps, name);
 
332
    if (err) return err;
 
333
    return dictCompute(ps);
 
334
}