8 : m_exComponent(ex), m_eyComponent(ey), m_algoType(
algo), m_bitShift(0), m_htMissLut(new
L1GctHtMissLut()) {}
11 : m_exComponent(ex), m_eyComponent(ey), m_algoType(
algo), m_bitShift(0), m_htMissLut(new
L1GctHtMissLut()) {}
93 static const int of_val = 0x1FFF;
95 static const int n_iterations = 6;
98 const int cordic_angles[n_iterations] = {0x120, 0x0AA, 0x05A, 0x02E, 0x017, 0x00B};
99 const int cordic_starting_angle_090 = 0x240;
100 const int cordic_starting_angle_270 = 0x6C0;
101 const int cordic_angle_360 = 0x900;
103 const int cordic_scale_factor = 0x26E;
112 z = cordic_starting_angle_090;
117 z = cordic_starting_angle_090;
121 z = cordic_starting_angle_270;
125 for (
int i = 0;
i < n_iterations;
i++) {
131 z =
z + cordic_angles[
i];
135 z =
z - cordic_angles[
i];
139 int scaled_magnitude =
x * cordic_scale_factor;
140 int adjusted_angle = ((
z < 0) ? (
z + cordic_angle_360) :
z) % cordic_angle_360;
141 result.mag = scaled_magnitude >> 10;
142 result.phi = adjusted_angle >> 5;
143 if (
result.mag > (
unsigned)of_val)
144 result.mag = (
unsigned)of_val;
153 r = (((
e >> (nBits - 1)) + 1) >> 1);
162 static const int componentMask = maxComponent - 1;
163 static const int maxPosComponent = componentMask >> 1;
181 if (of || (
abs(ex) >= maxInput) || (
abs(ey) >= maxInput)) {
182 hxCompBits = maxPosComponent;
183 hyCompBits = maxPosComponent;
192 result.phi = static_cast<unsigned>(lutData) & resultPhiMask;
216 unsigned eneCorect, phiCorect;
218 const unsigned root2fact = 181;
219 const unsigned corrFact[11] = {24, 39, 51, 60, 69, 77, 83, 89, 95, 101, 106};
220 const unsigned corrDphi[11] = {0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4};
222 std::vector<bool>
s(3);
233 My = static_cast<unsigned>(
abs(ey));
234 Mx = static_cast<unsigned>(
abs(ex));
235 Mw = (((Mx + My) * root2fact) + 0x80) >> 8;
243 for (
int i = 0;
i < 3;
i++) {
247 phibin = 2 * phibin +
b;
257 for (eFact = 0; eFact < 10; eFact++) {
258 Dx = (Mx * corrFact[eFact]) >> 8;
259 Dy = (My * corrFact[eFact]) >> 8;
260 if ((
Dx >= My) || (
Dy >= Mx)) {
264 if ((Mx +
Dx) >= (My -
Dy) && (My +
Dy) >= (Mx -
Dx)) {
269 eneCorect = (eneCoarse * (128 + eFact)) >> 7;
270 if (midphi ^ (
b == 1)) {
271 phiCorect =
phiCoarse + 8 - corrDphi[eFact];
287 double fx = static_cast<double>(ex);
288 double fy = static_cast<double>(ey);
290 double fphi = 36. * atan2(
fy,
fx) /
M_PI;
292 result.mag = static_cast<unsigned>(fmag);
294 result.phi = static_cast<unsigned>(fphi);
296 result.phi = static_cast<unsigned>(fphi + 72.);
318 static const int maxComponentInput =