36 const float4 in_x_coords = (float4)(coord.s0, 1 + coord.s0, 2 + coord.s0, 3 + coord.s0);
37 const float4 new_x = (in_x_coords + ((float4)(0.5f))) * (float4)(scale.s0);
38 const float4 new_y = (float4)((coord.s1 + 0.5f) * scale.s1);
39 return (float8)(new_x.s0, new_y.s0, new_x.s1, new_y.s1, new_x.s2, new_y.s2, new_x.s3, new_y.s3);
51 const float4 in_x_coords = (float4)(coord.s0, 1 + coord.s0, 2 + coord.s0, 3 + coord.s0);
52 #ifdef SAMPLING_POLICY_TOP_LEFT 53 const float4 new_x = in_x_coords * (float4)(scale.s0);
54 const float4 new_y = (float4)(coord.s1 * scale.s1);
55 return (float8)(new_x.s0, new_y.s0, new_x.s1, new_y.s1, new_x.s2, new_y.s2, new_x.s3, new_y.s3);
56 #elif SAMPLING_POLICY_CENTER 57 const float4 new_x = (in_x_coords + ((float4)(0.5f))) * (float4)(scale.s0) - (float4)(0.5f);
58 const float4 new_y = (float4)((coord.s1 + 0.5f) * scale.s1 - 0.5f);
59 return (float8)(new_x.s0, new_y.s0, new_x.s1, new_y.s1, new_x.s2, new_y.s2, new_x.s3, new_y.s3);
61 #error("Unsupported sampling policy"); 89 const float input_width,
90 const float input_height,
96 const float2 r = (float2)(scale_x, scale_y);
125 const float input_width,
126 const float input_height,
132 const float2 r = (float2)(scale_x, scale_y);
#define CONVERT_TO_IMAGE_STRUCT_NO_STEP(name)
const DATA_TYPE4 bilinear_interpolate_with_border(const Image *in, const float8 coords, const float width, const float height, const float border_size)
Computes the bilinear interpolation for each set of coordinates in the vector coords and returns the ...
#define IMAGE_DECLARATION(name)
__kernel void scale_bilinear(__global uchar *in_ptr, uint in_stride_x, uint in_step_x, uint in_stride_y, uint in_step_y, uint in_offset_first_element_in_bytes, __global uchar *out_ptr, uint out_stride_x, uint out_step_x, uint out_stride_y, uint out_step_y, uint out_offset_first_element_in_bytes, const float input_width, const float input_height, const float scale_x, const float scale_y)
Performs an affine transformation on an image interpolating with the BILINEAR method.
__kernel void scale_nearest_neighbour(__global uchar *in_ptr, uint in_stride_x, uint in_step_x, uint in_stride_y, uint in_step_y, uint in_offset_first_element_in_bytes, __global uchar *out_ptr, uint out_stride_x, uint out_step_x, uint out_stride_y, uint out_step_y, uint out_offset_first_element_in_bytes, const float input_width, const float input_height, const float scale_x, const float scale_y)
Performs an affine transformation on an image interpolating with the NEAREAST NEIGHBOUR method...
#define CONVERT_TO_IMAGE_STRUCT(name)
const float8 transform_bilinear(const float2 coord, const float2 scale)
Transforms four 2D coordinates.
const float8 transform_nearest(const float2 coord, const float2 scale)
Transforms four 2D coordinates.
Structure to hold Image information.
__global uchar * ptr
Pointer to the starting postion of the buffer.
const DATA_TYPE4 read_texels4(const Image *in, const int8 coords)
Reads four texels from the input image.
const float8 clamp_to_border_with_size(float8 coords, const float width, const float height, const float border_size)
Clamps the given coordinates to the borders according to the border size.
const float2 get_current_coords()
Returns the current thread coordinates.