Commit 113cfabedc93d29e39ef957e0e01f71e25aff980

Authored by Josh Klontz
1 parent 7c4fec60

light renaming

sdk/jitcv/jitcv.h
@@ -4,10 +4,6 @@ @@ -4,10 +4,6 @@
4 #include <stddef.h> 4 #include <stddef.h>
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 -#ifdef __cplusplus  
8 -extern "C" {  
9 -#endif  
10 -  
11 /*! 7 /*!
12 * \brief jitcv matrix 8 * \brief jitcv matrix
13 * \author Josh Klontz \cite jklontz 9 * \author Josh Klontz \cite jklontz
@@ -29,7 +25,6 @@ struct jit_matrix @@ -29,7 +25,6 @@ struct jit_matrix
29 Single-row : 1 25 Single-row : 1
30 Single-frame : 1 */ 26 Single-frame : 1 */
31 27
32 -#ifdef __cplusplus  
33 enum Hash { Bits = 0x00FF, 28 enum Hash { Bits = 0x00FF,
34 Floating = 0x0100, 29 Floating = 0x0100,
35 Signed = 0x0200, 30 Signed = 0x0200,
@@ -83,25 +78,14 @@ struct jit_matrix @@ -83,25 +78,14 @@ struct jit_matrix
83 inline void setSingleFrame(bool singleFrame) { singleFrame ? hash |= SingleFrame : hash &= ~SingleFrame; } 78 inline void setSingleFrame(bool singleFrame) { singleFrame ? hash |= SingleFrame : hash &= ~SingleFrame; }
84 inline uint32_t elements() const { return channels * columns * rows * frames; } 79 inline uint32_t elements() const { return channels * columns * rows * frames; }
85 inline uint32_t bytes() const { return bits() / 8 * elements(); } 80 inline uint32_t bytes() const { return bits() / 8 * elements(); }
86 -#endif // __cplusplus  
87 }; 81 };
88 82
89 -typedef void* jit_unary_kernel;  
90 -typedef void* jit_binary_kernel;  
91 -  
92 -jit_unary_kernel jit_unary_make(const char *description);  
93 -jit_binary_kernel jit_binary_make(const char *description);  
94 -  
95 -void jit_unary_apply(const jit_unary_kernel &kernel, const jit_matrix &src, jit_matrix &dst);  
96 -void jit_binary_apply(const jit_binary_kernel &kernel, const jit_matrix &src, jit_matrix &dst);  
97 -  
98 -jit_unary_kernel jit_square();  
99 -  
100 -typedef void (*jit_unary_core_t)(const jit_matrix *src, jit_matrix *dst, uint32_t size);  
101 -typedef void (*jit_binary_core_t)(const jit_matrix *srcA, const jit_matrix *srcB, jit_matrix *dst, uint32_t size); 83 +typedef void (*jit_unary_function_t)(const jit_matrix *src, jit_matrix *dst);
  84 +typedef void (*jit_binary_function_t)(const jit_matrix *srcA, const jit_matrix *srcB, jit_matrix *dst);
  85 +typedef void (*jit_unary_kernel_t)(const jit_matrix *src, jit_matrix *dst, uint32_t size);
  86 +typedef void (*jit_binary_kernel_t)(const jit_matrix *srcA, const jit_matrix *srcB, jit_matrix *dst, uint32_t size);
102 87
103 -#ifdef __cplusplus  
104 -}  
105 -#endif 88 +jit_unary_function_t jit_unary_make(const char *description);
  89 +jit_binary_function_t jit_binary_make(const char *description);
106 90
107 #endif // __JITCV_H 91 #endif // __JITCV_H
sdk/plugins/llvm.cpp
@@ -304,7 +304,7 @@ class UnaryKernel : public UntrainableMetaTransform @@ -304,7 +304,7 @@ class UnaryKernel : public UntrainableMetaTransform
304 { 304 {
305 Q_OBJECT 305 Q_OBJECT
306 306
307 - jit_unary_core_t kernel; 307 + jit_unary_kernel_t kernel;
308 quint16 hash; 308 quint16 hash;
309 309
310 public: 310 public:
@@ -320,7 +320,7 @@ public: @@ -320,7 +320,7 @@ public:
320 invoke(src, dst, size); 320 invoke(src, dst, size);
321 } 321 }
322 322
323 - jit_unary_core_t getKernel(const jit_matrix *src) const 323 + jit_unary_kernel_t getKernel(const jit_matrix *src) const
324 { 324 {
325 const QString functionName = mangledName(*src); 325 const QString functionName = mangledName(*src);
326 Function *function = TheModule->getFunction(qPrintable(functionName)); 326 Function *function = TheModule->getFunction(qPrintable(functionName));
@@ -330,7 +330,7 @@ public: @@ -330,7 +330,7 @@ public:
330 TheExtraFunctionPassManager->run(*function); 330 TheExtraFunctionPassManager->run(*function);
331 function = TheModule->getFunction(qPrintable(functionName)); 331 function = TheModule->getFunction(qPrintable(functionName));
332 } 332 }
333 - return (jit_unary_core_t)TheExecutionEngine->getPointerToFunction(function); 333 + return (jit_unary_kernel_t)TheExecutionEngine->getPointerToFunction(function);
334 } 334 }
335 335
336 private: 336 private:
@@ -475,7 +475,7 @@ class BinaryKernel: public UntrainableMetaTransform @@ -475,7 +475,7 @@ class BinaryKernel: public UntrainableMetaTransform
475 { 475 {
476 Q_OBJECT 476 Q_OBJECT
477 477
478 - jit_binary_core_t kernel; 478 + jit_binary_kernel_t kernel;
479 quint16 hashA, hashB; 479 quint16 hashA, hashB;
480 480
481 public: 481 public:
@@ -552,7 +552,7 @@ private: @@ -552,7 +552,7 @@ private:
552 function = TheModule->getFunction(qPrintable(functionName)); 552 function = TheModule->getFunction(qPrintable(functionName));
553 } 553 }
554 554
555 - const_cast<BinaryKernel*>(this)->kernel = (jit_binary_core_t)TheExecutionEngine->getPointerToFunction(function); 555 + const_cast<BinaryKernel*>(this)->kernel = (jit_binary_kernel_t)TheExecutionEngine->getPointerToFunction(function);
556 const_cast<BinaryKernel*>(this)->hashA = srcA.hash; 556 const_cast<BinaryKernel*>(this)->hashA = srcA.hash;
557 const_cast<BinaryKernel*>(this)->hashB = srcB.hash; 557 const_cast<BinaryKernel*>(this)->hashB = srcB.hash;
558 } 558 }
@@ -1062,41 +1062,16 @@ class LLVMInitializer : public Initializer @@ -1062,41 +1062,16 @@ class LLVMInitializer : public Initializer
1062 1062
1063 BR_REGISTER(Initializer, LLVMInitializer) 1063 BR_REGISTER(Initializer, LLVMInitializer)
1064 1064
1065 -void jit_unary_apply(const jit_unary_kernel &kernel, const jit_matrix &src, jit_matrix &dst) 1065 +jit_unary_function_t jit_unary_make(const char *description)
1066 { 1066 {
1067 - ((UnaryKernel*)kernel)->apply(src, dst); 1067 + (void) description;
  1068 + return NULL;
1068 } 1069 }
1069 1070
1070 -void jit_binary_apply(const jit_binary_kernel &kernel, const jit_matrix &srcA, const jit_matrix &srcB, jit_matrix &dst) 1071 +jit_binary_function_t jit_binary_make(const char *description)
1071 { 1072 {
1072 - ((BinaryKernel*)kernel)->apply(srcA, srcB, dst);  
1073 -}  
1074 -  
1075 -jit_unary_kernel jit_unary_make(const char *description)  
1076 -{  
1077 - static QHash<QString, UnaryKernel*> kernels;  
1078 - if (!kernels.contains(description))  
1079 - kernels.insert(description, dynamic_cast<UnaryKernel*>(Transform::make(description, NULL)));  
1080 - return jit_unary_kernel(kernels[description]);  
1081 -}  
1082 -  
1083 -jit_binary_kernel jit_binary_make(const char *description)  
1084 -{  
1085 - static QHash<QString, BinaryKernel*> kernels;  
1086 - if (!kernels.contains(description))  
1087 - kernels.insert(description, dynamic_cast<BinaryKernel*>(Factory<BinaryKernel>::make(description)));  
1088 - return jit_binary_kernel(kernels[description]);  
1089 -}  
1090 -  
1091 -jit_unary_kernel jit_square()  
1092 -{  
1093 - static squareTransform transform;  
1094 - return &transform;  
1095 -}  
1096 -  
1097 -jit_unary_core_t jit_compile_unary_core(const void *kernel, const jit_matrix &m)  
1098 -{  
1099 - return ((const UnaryKernel*)kernel)->getKernel(&m); 1073 + (void) description;
  1074 + return NULL;
1100 } 1075 }
1101 1076
1102 #include "llvm.moc" 1077 #include "llvm.moc"