Home | History | Annotate | Download | only in cl_kernel
      1 /**
      2 * \brief Image scaling kernel function.
      3 * \param[in] input Input image object.
      4 * \param[out] output scaled output image object.
      5 * \param[in] output_width: output width
      6 * \param[in] output_height: output height
      7 * \param[in] vertical_offset:  vertical offset from y to uv
      8 */
      9 __kernel void kernel_image_scaler (__read_only image2d_t input,
     10                                    __write_only image2d_t output,
     11                                    const uint output_width,
     12                                    const uint output_height)
     13 {
     14     int x = get_global_id(0);
     15     int y = get_global_id(1);
     16 
     17     const sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;
     18 
     19     float2 normCoor = convert_float2((int2)(x, y)) / (float2)(output_width, output_height);
     20     float4 scaled_pixel = read_imagef(input, sampler, normCoor);
     21     write_imagef(output, (int2)(x, y), scaled_pixel);
     22 }
     23 
     24