fixed 3 bytes reading/writing in remap
authorVladislav Vinogradov <no@email>
Thu, 26 Aug 2010 12:30:41 +0000 (12:30 +0000)
committerVladislav Vinogradov <no@email>
Thu, 26 Aug 2010 12:30:41 +0000 (12:30 +0000)
modules/gpu/src/cuda/imgproc.cu

index 5638ccd69bc063c644476279be419cc553eeca31..8c53ae2d716f4194983fbf4a9d078959ee7f58b0 100644 (file)
@@ -86,31 +86,39 @@ namespace imgproc
                 const int x2 = x1 + 1;\r
                 const int y2 = y1 + 1;\r
                 \r
-                uchar3 src_reg = *(uchar3*)(src + y1 * src_step + 3 * x1);\r
-                out.x += src_reg.x * (x2 - xcoo) * (y2 - ycoo);\r
-                out.y += src_reg.y * (x2 - xcoo) * (y2 - ycoo);\r
-                out.z += src_reg.z * (x2 - xcoo) * (y2 - ycoo);\r
-\r
-                src_reg = *(uchar3*)(src + y1 * src_step + 3 * x2);\r
-                \r
-                out.x += src_reg.x * (xcoo - x1) * (y2 - ycoo);\r
-                out.y += src_reg.y * (xcoo - x1) * (y2 - ycoo);\r
-                out.z += src_reg.z * (xcoo - x1) * (y2 - ycoo);\r
-\r
-                src_reg = *(uchar3*)(src + y2 * src_step + 3 * x1);\r
-                \r
-                out.x += src_reg.x * (x2 - xcoo) * (ycoo - y1);\r
-                out.y += src_reg.y * (x2 - xcoo) * (ycoo - y1);\r
-                out.z += src_reg.z * (x2 - xcoo) * (ycoo - y1);\r
-\r
-                src_reg = *(uchar3*)(src + y2 * src_step + 3 * x2);\r
-                \r
-                out.x += src_reg.x * (xcoo - x1) * (ycoo - y1);\r
-                out.y += src_reg.y * (xcoo - x1) * (ycoo - y1);\r
-                out.z += src_reg.z * (xcoo - x1) * (ycoo - y1);\r
+                uchar src_reg = *(src + y1 * src_step + 3 * x1);\r
+                out.x += src_reg * (x2 - xcoo) * (y2 - ycoo);\r
+                src_reg = *(src + y1 * src_step + 3 * x1 + 1);\r
+                out.y += src_reg * (x2 - xcoo) * (y2 - ycoo);\r
+                src_reg = *(src + y1 * src_step + 3 * x1 + 2);\r
+                out.z += src_reg * (x2 - xcoo) * (y2 - ycoo);\r
+\r
+                src_reg = *(src + y1 * src_step + 3 * x2);                \r
+                out.x += src_reg * (xcoo - x1) * (y2 - ycoo);\r
+                src_reg = *(src + y1 * src_step + 3 * x2 + 1); \r
+                out.y += src_reg * (xcoo - x1) * (y2 - ycoo);\r
+                src_reg = *(src + y1 * src_step + 3 * x2 + 2); \r
+                out.z += src_reg * (xcoo - x1) * (y2 - ycoo);\r
+\r
+                src_reg = *(src + y2 * src_step + 3 * x1);                \r
+                out.x += src_reg * (x2 - xcoo) * (ycoo - y1);\r
+                src_reg = *(src + y2 * src_step + 3 * x1 + 1); \r
+                out.y += src_reg * (x2 - xcoo) * (ycoo - y1);\r
+                src_reg = *(src + y2 * src_step + 3 * x1 + 2); \r
+                out.z += src_reg * (x2 - xcoo) * (ycoo - y1);\r
+\r
+                src_reg = *(src + y2 * src_step + 3 * x2);                \r
+                out.x += src_reg * (xcoo - x1) * (ycoo - y1);\r
+                src_reg = *(src + y2 * src_step + 3 * x2 + 1);  \r
+                out.y += src_reg * (xcoo - x1) * (ycoo - y1);\r
+                src_reg = *(src + y2 * src_step + 3 * x2 + 2);  \r
+                out.z += src_reg * (xcoo - x1) * (ycoo - y1);\r
             }\r
 \r
-            *(uchar3*)(dst + y * dst_step + 3 * x) = out;\r
+            /**(uchar3*)(dst + y * dst_step + 3 * x) = out;*/\r
+            *(dst + y * dst_step + 3 * x) = out.x;\r
+            *(dst + y * dst_step + 3 * x + 1) = out.y;\r
+            *(dst + y * dst_step + 3 * x + 2) = out.z;\r
         }\r
     }\r
 }\r