Skip to content

Instantly share code, notes, and snippets.

/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
@RuiJCS
RuiJCS / convolution.cl
Created May 9, 2020 13:56
OpenCL convolution kernel
__kernel void convolute_mem(__read_only image2d_t src, __write_only image2d_t result, __constant float4 * filter) {
int2 global_coord = (int2) (get_global_id(0),get_global_id(1));
int2 local_coord = (int2) (get_local_id(0),get_local_id(1));
int2 local_size = (int2) (get_local_size(0),get_local_size(1));
int2 local_array = (int2) (local_coord.x + KERNEL_SIZE_HALF, local_coord.y + KERNEL_SIZE_HALF);
// Need to think of the size of the array
__local float4 pixels[BLOCK_SIZE][BLOCK_SIZE];
pixels[local_array.y][local_array.x] = read_imagef(src,sampler_const,global_coord);

Keybase proof

I hereby claim:

  • I am ruijcs on github.
  • I am rui_soares (https://keybase.io/rui_soares) on keybase.
  • I have a public key ASAlfJcKaVTWo0rdjlAwV1jlN-fX5XPaps3HMoEH6ouOrgo

To claim this, I am signing this object: