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
|
/* { dg-do compile } */
/* { dg-additional-options "-O3" } */
static void addPrior(float center_x, float center_y, float width, float height,
bool normalized, float *dst)
{
if (normalized)
{
dst[0] = (center_x - width * 0.5f);
dst[1] = (center_y - height * 0.5f);
dst[2] = (center_x + width * 0.5f);
dst[3] = (center_y + height * 0.5f);
}
else
{
dst[0] = center_x - width * 0.5f;
dst[1] = center_y - height * 0.5f;
dst[2] = center_x + width * 0.5f - 1.0f;
dst[3] = center_y + height * 0.5f - 1.0f;
}
}
void forward(float *outputPtr, int _offsetsXs, float *_offsetsX,
float *_offsetsY, float _stepX, float _stepY,
bool _bboxesNormalized, float _boxWidth, float _boxHeight)
{
for (int j = 0; j < _offsetsXs; ++j)
{
float center_x = (_offsetsX[j]) * _stepX;
float center_y = (_offsetsY[j]) * _stepY;
addPrior(center_x, center_y, _boxWidth, _boxHeight, _bboxesNormalized,
outputPtr);
outputPtr += 4;
}
}
|