summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-06-03 14:18:26 -0700
committerJeff Brown <jeffbrown@google.com>2012-06-04 12:34:03 -0700
commit18f329e9480fca75210bb7496e5b4bc987b4ad8f (patch)
tree8be6eebdeb6dfd2cd64e0715048db571209a7096 /include
parent433927c52f2758e3e69f69d7e03d571ee4f18a26 (diff)
downloadframeworks_base-18f329e9480fca75210bb7496e5b4bc987b4ad8f.zip
frameworks_base-18f329e9480fca75210bb7496e5b4bc987b4ad8f.tar.gz
frameworks_base-18f329e9480fca75210bb7496e5b4bc987b4ad8f.tar.bz2
Implement a weighted least squares VelocityTracker strategy.
No change to the default strategy. Bug: 6413587 Change-Id: I08eb6f9a511e65ad637359b55b5993c26ba93b40
Diffstat (limited to 'include')
-rw-r--r--include/androidfw/VelocityTracker.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/include/androidfw/VelocityTracker.h b/include/androidfw/VelocityTracker.h
index e600c5a..262a51b 100644
--- a/include/androidfw/VelocityTracker.h
+++ b/include/androidfw/VelocityTracker.h
@@ -138,8 +138,23 @@ public:
*/
class LeastSquaresVelocityTrackerStrategy : public VelocityTrackerStrategy {
public:
+ enum Weighting {
+ // No weights applied. All data points are equally reliable.
+ WEIGHTING_NONE,
+
+ // Weight by time delta. Data points clustered together are weighted less.
+ WEIGHTING_DELTA,
+
+ // Weight such that points within a certain horizon are weighed more than those
+ // outside of that horizon.
+ WEIGHTING_CENTRAL,
+
+ // Weight such that points older than a certain amount are weighed less.
+ WEIGHTING_RECENT,
+ };
+
// Degree must be no greater than Estimator::MAX_DEGREE.
- LeastSquaresVelocityTrackerStrategy(uint32_t degree);
+ LeastSquaresVelocityTrackerStrategy(uint32_t degree, Weighting weighting = WEIGHTING_NONE);
virtual ~LeastSquaresVelocityTrackerStrategy();
virtual void clear();
@@ -167,7 +182,10 @@ private:
}
};
+ float chooseWeight(uint32_t index) const;
+
const uint32_t mDegree;
+ const Weighting mWeighting;
uint32_t mIndex;
Movement mMovements[HISTORY_SIZE];
};