Skip to content
Snippets Groups Projects
Commit f2bbcd36 authored by Akash Kothari's avatar Akash Kothari :speech_balloon:
Browse files

Fixed OpenCV path and HPVM function names and arguments

parent c66ea309
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
*/ */
#include "opencv2/opencv.hpp" #include "opencv2/opencv.hpp"
#include "opencv2/core/ocl.hpp" #include "opencv2/ocl/ocl.hpp"
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -104,7 +104,7 @@ void laplacianEstimate(float *I, size_t bytesI, ...@@ -104,7 +104,7 @@ void laplacianEstimate(float *I, size_t bytesI,
float *L, size_t bytesL, float *L, size_t bytesL,
int m, int n) { int m, int n) {
__visc__hint(visc::DEVICE); __visc__hint(visc::CPU_TARGET);
//__visc__hint(visc::GPU_TARGET); //__visc__hint(visc::GPU_TARGET);
__visc__attributes(2, I, B, 1, L); __visc__attributes(2, I, B, 1, L);
// 3x3 image area // 3x3 image area
...@@ -179,7 +179,7 @@ void laplacianEstimate(float *I, size_t bytesI, ...@@ -179,7 +179,7 @@ void laplacianEstimate(float *I, size_t bytesI,
//OutStruct output = {bytesB, bytesL}; //OutStruct output = {bytesB, bytesL};
//if(gx == m-1 && gy == n-1) //if(gx == m-1 && gy == n-1)
//std::cout << "Exit laplacian\n"; //std::cout << "Exit laplacian\n";
__visc__return(m); __visc__return(1, m);
} }
void WrapperlaplacianEstimate(float *I, size_t bytesI, void WrapperlaplacianEstimate(float *I, size_t bytesI,
...@@ -188,7 +188,7 @@ void WrapperlaplacianEstimate(float *I, size_t bytesI, ...@@ -188,7 +188,7 @@ void WrapperlaplacianEstimate(float *I, size_t bytesI,
int m, int n) { int m, int n) {
__visc__hint(visc::CPU_TARGET); __visc__hint(visc::CPU_TARGET);
__visc__attributes(2, I, B, 1, L); __visc__attributes(2, I, B, 1, L);
void* LNode = __visc__createNode2D(laplacianEstimate, m, n); void* LNode = __visc__createNodeND(2, laplacianEstimate, (size_t)m, (size_t)n);
__visc__bindIn(LNode, 0, 0, 0); // Bind I __visc__bindIn(LNode, 0, 0, 0); // Bind I
__visc__bindIn(LNode, 1, 1, 0); // Bind bytesI __visc__bindIn(LNode, 1, 1, 0); // Bind bytesI
__visc__bindIn(LNode, 2, 2, 0); // Bind B __visc__bindIn(LNode, 2, 2, 0); // Bind B
...@@ -214,7 +214,7 @@ void computeZeroCrossings(float *L, size_t bytesL, ...@@ -214,7 +214,7 @@ void computeZeroCrossings(float *L, size_t bytesL,
float *B, size_t bytesB, float *B, size_t bytesB,
float *S, size_t bytesS, float *S, size_t bytesS,
int m, int n) { int m, int n) {
__visc__hint(visc::DEVICE); __visc__hint(visc::CPU_TARGET);
//__visc__hint(visc::SPIR_TARGET); //__visc__hint(visc::SPIR_TARGET);
__visc__attributes(2, L, B, 1, S); __visc__attributes(2, L, B, 1, S);
...@@ -291,7 +291,7 @@ void computeZeroCrossings(float *L, size_t bytesL, ...@@ -291,7 +291,7 @@ void computeZeroCrossings(float *L, size_t bytesL,
//std::cout << "Exit ZC\n"; //std::cout << "Exit ZC\n";
// FIXME: Return bytesG instead of L. RZC nodes expects bytesG // FIXME: Return bytesG instead of L. RZC nodes expects bytesG
// This is just temporary // This is just temporary
__visc__return(m); __visc__return(1, m);
} }
void WrapperComputeZeroCrossings(float *L, size_t bytesL, void WrapperComputeZeroCrossings(float *L, size_t bytesL,
...@@ -300,7 +300,7 @@ void WrapperComputeZeroCrossings(float *L, size_t bytesL, ...@@ -300,7 +300,7 @@ void WrapperComputeZeroCrossings(float *L, size_t bytesL,
int m, int n) { int m, int n) {
__visc__hint(visc::CPU_TARGET); __visc__hint(visc::CPU_TARGET);
__visc__attributes(2, L, B, 1, S); __visc__attributes(2, L, B, 1, S);
void* ZCNode = __visc__createNode2D(computeZeroCrossings, m, n); void* ZCNode = __visc__createNodeND(2, computeZeroCrossings, (size_t)m, (size_t)n);
__visc__bindIn(ZCNode, 0, 0, 0); // Bind L __visc__bindIn(ZCNode, 0, 0, 0); // Bind L
__visc__bindIn(ZCNode, 1, 1, 0); // Bind bytesL __visc__bindIn(ZCNode, 1, 1, 0); // Bind bytesL
__visc__bindIn(ZCNode, 2, 2, 0); // Bind B __visc__bindIn(ZCNode, 2, 2, 0); // Bind B
...@@ -326,7 +326,7 @@ void rejectZeroCrossings(float *S, size_t bytesS, ...@@ -326,7 +326,7 @@ void rejectZeroCrossings(float *S, size_t bytesS,
float *E, size_t bytesE, float *E, size_t bytesE,
//float theta, float maxG, //float theta, float maxG,
int m, int n) { int m, int n) {
__visc__hint(visc::DEVICE); __visc__hint(visc::CPU_TARGET);
__visc__attributes(2, S, G, 1, E); __visc__attributes(2, S, G, 1, E);
void* thisNode = __visc__getNode(); void* thisNode = __visc__getNode();
...@@ -338,7 +338,7 @@ void rejectZeroCrossings(float *S, size_t bytesS, ...@@ -338,7 +338,7 @@ void rejectZeroCrossings(float *S, size_t bytesS,
E[gy*n+gx] = ((S[gy*n+gx] > 0.0) && (G[gy*n+gx] > theta*maxG)) ? 1.0 : 0.0 ; E[gy*n+gx] = ((S[gy*n+gx] > 0.0) && (G[gy*n+gx] > theta*maxG)) ? 1.0 : 0.0 ;
} }
__visc__return(m); __visc__return(1, m);
} }
...@@ -349,7 +349,7 @@ void WrapperRejectZeroCrossings(float *S, size_t bytesS, ...@@ -349,7 +349,7 @@ void WrapperRejectZeroCrossings(float *S, size_t bytesS,
int m, int n) { int m, int n) {
__visc__hint(visc::CPU_TARGET); __visc__hint(visc::CPU_TARGET);
__visc__attributes(2, S, G, 1, E); __visc__attributes(2, S, G, 1, E);
void* RZCNode = __visc__createNode2D(rejectZeroCrossings, m, n); void* RZCNode = __visc__createNodeND(2, rejectZeroCrossings, (size_t)m, (size_t)n);
__visc__bindIn(RZCNode, 0, 0, 0); // Bind S __visc__bindIn(RZCNode, 0, 0, 0); // Bind S
__visc__bindIn(RZCNode, 1, 1, 0); // Bind bytesS __visc__bindIn(RZCNode, 1, 1, 0); // Bind bytesS
__visc__bindIn(RZCNode, 2, 2, 0); // Bind G __visc__bindIn(RZCNode, 2, 2, 0); // Bind G
...@@ -375,9 +375,9 @@ void edgeDetection(float *I, size_t bytesI, ...@@ -375,9 +375,9 @@ void edgeDetection(float *I, size_t bytesI,
float *E, size_t bytesE, float *E, size_t bytesE,
int m, int n) { int m, int n) {
__visc__attributes(2, I, B, 4, L, S, G, E); __visc__attributes(2, I, B, 4, L, S, G, E);
void* LNode = __visc__createNode(WrapperlaplacianEstimate); void* LNode = __visc__createNodeND(0, WrapperlaplacianEstimate);
void* CZCNode = __visc__createNode(WrapperComputeZeroCrossings); void* CZCNode = __visc__createNodeND(0, WrapperComputeZeroCrossings);
void* RZCNode = __visc__createNode(WrapperRejectZeroCrossings); void* RZCNode = __visc__createNodeND(0, WrapperRejectZeroCrossings);
// Laplacian Inputs // Laplacian Inputs
__visc__bindIn(LNode, 0, 0, 1); // Bind I __visc__bindIn(LNode, 0, 0, 1); // Bind I
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment