/usr/lib/python3/dist-packages/ginga/opencl/trcalc.cl is in python3-ginga 2.6.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | __kernel void image_rotate_uint32(
// input, output buffers in global memory
__global unsigned int * src_data, __global unsigned int * dst_data,
int rotctr_x, int rotctr_y, // rotation about pt
int wd, int ht, // src image dimensions
int dst_wd, int dst_ht, // dst image dimensions
int dst_dx, int dst_dy, // dst offsets in image
double sin_theta, double cos_theta, // rotation parameters
unsigned int clip_val ) // clip subst value
{
// Thread gets its index within index space
const int iy = get_global_id(0); // height, y-axis
const int ix = get_global_id(1); // width, x-axis
int xi = ix - dst_dx - rotctr_x;
int yi = iy - dst_dy - rotctr_y;
// Calculate location of data to move into ix and iy
double xpos = (((double)xi) * cos_theta - ((double)yi) * sin_theta) + rotctr_x;
double ypos = (((double)xi) * sin_theta + ((double)yi) * cos_theta) + rotctr_y;
int xp = (int) round(xpos);
int yp = (int) round(ypos);
// Bound Checking
if (((xp >= 0) && (xp < wd)) && ((yp >= 0) && (yp < ht)))
{
// Read (xp, yp) src_data and store at (ix, iy) in dst_data
dst_data[iy * dst_wd + ix] = src_data[yp * wd + xp];
}
else {
dst_data[iy * dst_wd + ix] = clip_val;
}
}
__kernel void image_rotate_float64(
// input, output buffers in global memory
__global double * src_data, __global double * dst_data,
int rotctr_x, int rotctr_y, // rotation about pt
int wd, int ht, // src image dimensions
int dst_wd, int dst_ht, // dst image dimensions
int dst_dx, int dst_dy, // dst offsets in image
double sin_theta, double cos_theta, // rotation parameters
double clip_val ) // clip subst value
{
// Thread gets its index within index space
const int iy = get_global_id(0); // height, y-axis
const int ix = get_global_id(1); // width, x-axis
int xi = ix - dst_dx - rotctr_x;
int yi = iy - dst_dy - rotctr_y;
// Calculate location of data to move into ix and iy
double xpos = (((double)xi) * cos_theta - ((double)yi) * sin_theta) + rotctr_x;
double ypos = (((double)xi) * sin_theta + ((double)yi) * cos_theta) + rotctr_y;
int xp = (int) round(xpos);
int yp = (int) round(ypos);
// Bound Checking
if (((xp >= 0) && (xp < wd)) && ((yp >= 0) && (yp < ht)))
{
// Read (xp, yp) src_data and store at (ix, iy) in dst_data
dst_data[iy * dst_wd + ix] = src_data[yp * wd + xp];
}
else {
dst_data[iy * dst_wd + ix] = clip_val;
}
}
__kernel void image_transform_uint32(
// input, output buffers in global memory
__global unsigned int * src_data, __global unsigned int * dst_data,
int wd, int ht, // image dimensions
int flipx, int flipy, int swapxy ) // transform flags
{
// Thread gets its index within index space
const int ix = get_global_id(1);
const int iy = get_global_id(0);
// default is to simply pass through
int dst_x = ix;
int dst_y = iy;
if (flipy != 0) {
dst_y = ht - 1 - iy;
}
if (flipx != 0) {
dst_x = wd - 1 - ix;
}
if (swapxy != 0) {
dst_data[dst_x * ht + dst_y] = src_data[iy * wd + ix];
}
else {
dst_data[dst_y * wd + dst_x] = src_data[iy * wd + ix];
}
}
__kernel void image_resize_uint32(
__global const uint *src_data,
__global uint *dst_data,
const int old_wd,
const int new_wd,
const double scale_x,
const double scale_y)
{
// Thread gets its index within index space
const int ix = get_global_id(1);
const int iy = get_global_id(0);
int new_idx = iy * new_wd + ix;
int old_idx = convert_int_rtz(iy * (1.0/scale_y)) * old_wd + convert_int_rtz(ix * (1.0/scale_x));
dst_data[new_idx] = src_data[old_idx];
}
__kernel void image_resize_float64(
__global const double * src_data,
__global double * dst_data,
const int old_wd,
const int new_wd,
const double scale_x,
const double scale_y)
{
// Thread gets its index within index space
const int ix = get_global_id(1);
const int iy = get_global_id(0);
int new_idx = iy * new_wd + ix;
int old_idx = convert_int_rtz(iy * (1.0/scale_y)) * old_wd + convert_int_rtz(ix * (1.0/scale_x));
dst_data[new_idx] = src_data[old_idx];
}
|