summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/point_tracker.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-03-06 09:12:46 +0100
committerStanislaw Halik <sthalik@misaki.pl>2016-03-07 00:35:38 +0100
commit611a6df71f8ec2a0f742ad09a89668f684806d39 (patch)
treeee5290900bfc080fefdd8aa18a37356209398a7b /tracker-pt/point_tracker.cpp
parent99fb0282ba5cdfdb2b889df8916b36207d21ded0 (diff)
tracker/pt: remove branching that's frequently mispredicted
Diffstat (limited to 'tracker-pt/point_tracker.cpp')
-rw-r--r--tracker-pt/point_tracker.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tracker-pt/point_tracker.cpp b/tracker-pt/point_tracker.cpp
index aa6feb5b..599ce2d3 100644
--- a/tracker-pt/point_tracker.cpp
+++ b/tracker-pt/point_tracker.cpp
@@ -202,7 +202,8 @@ int PointTracker::POSIT(const PointModel& model, const PointOrder& order_, float
else {
rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 ));
theta = atan( -2*IJ0 / (JJ0-II0) );
- if (JJ0 - II0 < 0) theta += PI;
+ // avoid branch misprediction
+ theta += (JJ0 - II0 < 0) * PI;
theta /= 2;
}