Repository navigation
Expand file tree
/
Copy path0007-Update.patch
More file actions
executable file
·96 lines (81 loc) · 2.99 KB
/
Copy path0007-Update.patch
File metadata and controls
executable file
·96 lines (81 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From bfe0f4e2984b2a93be7486422f93b3b6bd494b67 Mon Sep 17 00:00:00 2001
From: BL <borek.latinovic@powerdynax.com>
Date: Thu, 23 Nov 2023 20:06:10 +0200
Subject: [PATCH 07/16] Update
Upon further inspection we discovered that values passed to the kernel
functions are correct.
The issue is when the kernel function writes values to the array itself.
Global_id seems to be alright but the values which are put into array
are incorrect.
---
canny.c | 37 +++++++++++++++++++++++++++++++++----
1 file changed, 33 insertions(+), 4 deletions(-)
diff --git a/canny.c b/canny.c
index f3abdec..e25534e 100644
--- a/canny.c
+++ b/canny.c
@@ -375,6 +375,11 @@ cannyEdgeDetection(
times[0] = gettimemono_ns();
+ // printf("%s", "Oriiginal values");
+ // for (int i = 0; i < 10; i++) {
+ // printf("%d ", input[i]);
+ // }
+
// *************************************************************
// Set up the OpenCL environment
// Read source file
@@ -418,7 +423,7 @@ cannyEdgeDetection(
char *log = (char *) malloc(log_size);
clGetProgramBuildInfo(program, devices[0], CL_PROGRAM_BUILD_LOG, log_size, log, NULL);
-
+
printf("%s\n", "Build program log: \n");
printf("%s\n", log);
@@ -437,7 +442,7 @@ cannyEdgeDetection(
status |= clSetKernelArg(kernel_sobel, 3, sizeof(cl_mem), &sobel_x_input);
status |= clSetKernelArg(kernel_sobel, 4, sizeof(cl_mem), &sobel_y_input);
chk(status, "clSetKernelArg");
-
+
size_t globalSize[2] = {width, height};
@@ -450,18 +455,42 @@ cannyEdgeDetection(
input, 0, NULL, NULL);
chk(status, "clEnqueueReadBuffer");
- status = clEnqueueReadBuffer(queue, sobel_x_input, CL_TRUE, 0, sizeof(uint8_t) * width * height,
+ status = clEnqueueReadBuffer(queue, sobel_x_input, CL_TRUE, 0, sizeof(uint16_t) * width * height,
sobel_x, 0, NULL, NULL);
chk(status, "clEnqueueReadBuffer");
- status = clEnqueueReadBuffer(queue, sobel_y_input, CL_TRUE, 0, sizeof(uint8_t) * width * height,
+ status = clEnqueueReadBuffer(queue, sobel_y_input, CL_TRUE, 0, sizeof(uint16_t) * width * height,
sobel_y, 0, NULL, NULL);
chk(status, "clEnqueueReadBuffer");
+
+ // printf("%s", "Values taken from buffer");
+ // for (int i = 0; i < 10; i++) {
+ // printf("%d ", input[i]);
+ // }
+
+
// CONTINUE HERE from rotator project
+ // printf("%s", "Values taken from buffer");
+ // printf("%d", sobel_x);
+ // for (int i = 0; i < 10000; i++) {
+ // printf("%d ", sobel_x[i]);
+ // }
+ // // printf("%d", sobel_y);
+ // printf("\n");
+ // printf("\n");
// sobel3x3(input, width, height, sobel_x, sobel_y);
+ // printf("%s", "Values from original function ");
+ // // printf("%d", sobel_x);
+ // for (int i = 0; i < 10000; i++) {
+ // printf("%d ", sobel_x[i]);
+ // }
+
+ // // printf("%d", sobel_y);
+ // printf("\n");
+
times[1] = gettimemono_ns();
phaseAndMagnitude(sobel_x, sobel_y, width, height, phase, magnitude);
--
2.34.1