Spatial Audio: Improve Head-Tracking prediction
1) Add LEAST_SQUARES pose prediction.
Define 3 types of prediction: LAST, TWIST, and LEAST_SQUARES.
Furthermore, add a 4th AUTO prediction type to automatically
choose between the 3 (currently always selects LEAST_SQUARES).
2) Add Verification of pose prediction,
Enabled on userdebug and eng builds.
Prediction checked for 50ms, 100ms, 200ms look-ahead.
3) Add 2 properties for predictor control
audio.spatializer.pose_predictor_type
// Example: 0 == AUTO, 1 == LAST,
// 2 == TWIST, 3 == LEAST_SQUARES
audio.spatializer.prediction_duration_ms
// Example: 50 or 150
4) By default
Use the new LEAST_SQUARES predictor. (Old was TWIST)
Increase prediction_duration_ms from 50ms to 120ms.
Test: adb shell dumpsys media.audio_policy
Test: atest libheadtracking-test
Test: adb shell setprop on properties.
Test: force user / eng compilation modes
Bug: 270763710
Change-Id: I13662df10bc06480f336bb894fddd83e09c03c7e
diff --git a/media/libheadtracking/Twist.cpp b/media/libheadtracking/Twist.cpp
index 63b9e69..fdec694 100644
--- a/media/libheadtracking/Twist.cpp
+++ b/media/libheadtracking/Twist.cpp
@@ -15,7 +15,7 @@
*/
#include "media/Twist.h"
-
+#include <android-base/stringprintf.h>
#include "media/QuaternionUtil.h"
namespace android {
@@ -39,5 +39,11 @@
return os;
}
+std::string Twist3f::toString() const {
+ return base::StringPrintf("[%0.2f, %0.2f, %0.2f, %0.2f, %0.2f, %0.2f]",
+ mTranslationalVelocity[0], mTranslationalVelocity[1], mTranslationalVelocity[2],
+ mRotationalVelocity[0], mRotationalVelocity[1], mRotationalVelocity[2]);
+}
+
} // namespace media
} // namespace android