Commit 032988c3683abd22167a0c05ded6f61ab61ebb14
1 parent
1d399655
extended jit api
Showing
3 changed files
with
21 additions
and
2 deletions
sdk/jitcv/jitcv.h
| ... | ... | @@ -89,11 +89,14 @@ struct jit_matrix |
| 89 | 89 | typedef void* jit_unary_kernel; |
| 90 | 90 | typedef void* jit_binary_kernel; |
| 91 | 91 | |
| 92 | -jit_unary_kernel jit_square(); | |
| 92 | +jit_unary_kernel jit_unary_make(const char *description); | |
| 93 | +jit_binary_kernel jit_binary_make(const char *description); | |
| 93 | 94 | |
| 94 | 95 | void jit_unary_apply(const jit_unary_kernel &kernel, const jit_matrix &src, jit_matrix &dst); |
| 95 | 96 | void jit_binary_apply(const jit_binary_kernel &kernel, const jit_matrix &src, jit_matrix &dst); |
| 96 | 97 | |
| 98 | +jit_unary_kernel jit_square(); | |
| 99 | + | |
| 97 | 100 | #ifdef __cplusplus |
| 98 | 101 | } |
| 99 | 102 | #endif | ... | ... |
sdk/plugins/llvm.cpp
| ... | ... | @@ -940,6 +940,22 @@ void jit_binary_apply(const jit_binary_kernel &kernel, const jit_matrix &srcA, c |
| 940 | 940 | ((BinaryKernel*)kernel)->apply(srcA, srcB, dst); |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | +jit_unary_kernel jit_unary_make(const char *description) | |
| 944 | +{ | |
| 945 | + static QHash<QString, UnaryKernel*> kernels; | |
| 946 | + if (!kernels.contains(description)) | |
| 947 | + kernels.insert(description, dynamic_cast<UnaryKernel*>(Transform::make(description, NULL))); | |
| 948 | + return jit_unary_kernel(kernels[description]); | |
| 949 | +} | |
| 950 | + | |
| 951 | +jit_binary_kernel jit_binary_make(const char *description) | |
| 952 | +{ | |
| 953 | + static QHash<QString, BinaryKernel*> kernels; | |
| 954 | + if (!kernels.contains(description)) | |
| 955 | + kernels.insert(description, dynamic_cast<BinaryKernel*>(Factory<BinaryKernel>::make(description))); | |
| 956 | + return jit_binary_kernel(kernels[description]); | |
| 957 | +} | |
| 958 | + | |
| 943 | 959 | jit_unary_kernel jit_square() |
| 944 | 960 | { |
| 945 | 961 | static squareTransform transform; | ... | ... |