Avoid Temporary Memory Allocation in LSQ2 Velocity Calculation

When calculating LSQ2 velocity with no-weights, we used to create two
vectors: one for "age" of the movements since the latest movement, and
one for the movements' position. We then passed this to a static  helper
function to calculate velocity.

This CL avoids the creation of these intermediate vectors by calculating
velocity in one pass. Furthermore, we're now clearing out old data
points (i.e. the ones that are past the horizon) in the "add" operation
for LSQ2. This means that the "getVelocity" method always gets called
with the accumulated movements guaranteed to fall within the horizon.

A minor clean up that is a side-effect of this change is that we won't
be calculating "weights" for LSQ2 with no weights (we used to calculate
these weights and store them in vectors for no use before).

Trace measurements for only the "getVelocity" code block show ~2x
improvements in time taken to executre "getVelocity".

Bug: 271935895
Test: atest libinput_tests
Change-Id: Id27bcbb183556479b9499b003823d3b0adec0423
diff --git a/include/input/VelocityTracker.h b/include/input/VelocityTracker.h
index f218c51..b58feac 100644
--- a/include/input/VelocityTracker.h
+++ b/include/input/VelocityTracker.h
@@ -221,6 +221,13 @@
     static const nsecs_t HORIZON = 100 * 1000000; // 100 ms
 
     float chooseWeight(int32_t pointerId, uint32_t index) const;
+    /**
+     * An optimized least-squares solver for degree 2 and no weight (i.e. `Weighting.NONE`).
+     * The provided container of movements shall NOT be empty, and shall have the movements in
+     * chronological order.
+     */
+    std::optional<float> solveUnweightedLeastSquaresDeg2(
+            const RingBuffer<Movement>& movements) const;
 
     const uint32_t mDegree;
     const Weighting mWeighting;