26 #if defined(DATA_TYPE) && defined(DATA_TYPE_DELTAS) && defined(WEIGHT_X) && defined(WEIGHT_Y) && defined(WEIGHT_W) && defined(WEIGHT_H) && defined(IMG_WIDTH) && defined(IMG_HEIGHT) && defined(BOX_FIELDS) && defined(SCALE_BEFORE) && defined(OFFSET_BOXES) && defined(SCALE_BOXES) && defined(OFFSET_DELTAS) && defined(SCALE_DELTAS) && defined(OFFSET_PRED_BOXES) && defined(SCALE_PRED_BOXES) // Check for compile time constants 62 __kernel
void bounding_box_transform_quantized(
73 const float one = 1.f;
74 const float halfone = 0.5f;
76 const int py = get_global_id(1);
77 float4 scale_before = (float4)SCALE_BEFORE;
78 float4 delta =
DEQUANTIZE(vload4(0, (__global DATA_TYPE_DELTAS *)deltas.
ptr), OFFSET_DELTAS, SCALE_DELTAS, DATA_TYPE_DELTAS, 4);
82 float2 dims = box.s23 - box.s01 + one;
83 float2 ctr = box.s01 + halfone * dims;
84 float4 weights = (float4)(WEIGHT_X, WEIGHT_Y, WEIGHT_W, WEIGHT_H);
86 delta.s23 = min(delta.s23, (
float)BBOX_XFORM_CLIP);
89 float2 pred_ctr = delta.s01 * dims + ctr;
90 float2 pred_dims = exp(delta.s23) * dims;
93 float4 max_values = (float4)(IMG_WIDTH - 1, IMG_HEIGHT - 1, IMG_WIDTH - 1, IMG_HEIGHT - 1);
94 float4 sign = (float4)(-1, -1, 1, 1);
95 float4 min_values = 0;
98 float4 pred_box = pred_ctr.s0101 + sign * halfone * pred_dims.s0101;
99 #ifdef OFFSET // Possibly adjust the predicted boxes 101 #endif // Possibly adjust the predicted boxes 102 pred_box =
CLAMP(pred_box, min_values, max_values);
103 #ifdef SCALE_AFTER // Possibly scale the predicted boxes 104 pred_box *= (float4)SCALE_AFTER;
105 #endif // Possibly scale the predicted boxes 110 #endif // Check for compile time constants Structure to hold Vector information.
#define CONVERT_TO_IMAGE_STRUCT(name)
#define IMAGE_DECLARATION(name)
#define DEQUANTIZE(input, offset, scale, type, size)
#define VECTOR_DECLARATION(name)
#define CLAMP(x, min_val, max_val)
Clamp the given value between an upper and lower bound.
Structure to hold Image information.
__global uchar * ptr
Pointer to the starting postion of the buffer.
__global const uchar * vector_offset(const Vector *vec, int x)
Get the pointer position of a Vector.
#define QUANTIZE(input, offset, scale, type, size)
#define CONVERT_TO_VECTOR_STRUCT_NO_STEP(name)