Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Data Paths and Glitch tests #1963

Merged
merged 6 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/OboeTester/app/src/main/cpp/analyzer/BaseSineAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class BaseSineAnalyzer : public LoopbackProcessor {
}

double getPhaseOffset() {
ALOGD("%s(), mPhaseOffset = %f\n", __func__, mPhaseOffset);
return mPhaseOffset;
}

Expand Down Expand Up @@ -129,7 +130,6 @@ class BaseSineAnalyzer : public LoopbackProcessor {
double magnitude = 2.0 * sqrt((sinMean * sinMean) + (cosMean * cosMean));
if (phasePtr != nullptr) {
double phase = atan2(cosMean, sinMean);

*phasePtr = phase;
}
return magnitude;
Expand All @@ -153,6 +153,7 @@ class BaseSineAnalyzer : public LoopbackProcessor {
if (mFramesAccumulated == mSinePeriod) {
const double coefficient = 0.1;
double magnitude = calculateMagnitudePhase(&mPhaseOffset);
ALOGD("%s(), mPhaseOffset = %f\n", __func__, mPhaseOffset);
// One pole averaging filter.
setMagnitude((mMagnitude * (1.0 - coefficient)) + (magnitude * coefficient));
resetAccumulator();
Expand Down
8 changes: 2 additions & 6 deletions apps/OboeTester/app/src/main/cpp/analyzer/GlitchAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ class GlitchAnalyzer : public BaseSineAnalyzer {
return mSinePeriod;
}

float getPhaseOffset() const {
return mPhaseOffset;
}

int32_t getGlitchCount() const {
return mGlitchCount;
}
Expand Down Expand Up @@ -188,8 +184,8 @@ class GlitchAnalyzer : public BaseSineAnalyzer {
// Must be a multiple of the period or the calculation will not be accurate.
if (mFramesAccumulated == mSinePeriod * PERIODS_NEEDED_FOR_LOCK) {
setMagnitude(calculateMagnitudePhase(&mPhaseOffset));
// ALOGD("%s() mag = %f, offset = %f, prev = %f",
// __func__, mMagnitude, mPhaseOffset, mPreviousPhaseOffset);
ALOGD("%s() mag = %f, mPhaseOffset = %f",
__func__, mMagnitude, mPhaseOffset);
if (mMagnitude > mThreshold) {
if (fabs(mPhaseOffset) < kMaxPhaseError) {
mState = STATE_LOCKED;
Expand Down
6 changes: 6 additions & 0 deletions apps/OboeTester/app/src/main/cpp/jni-bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,12 @@ Java_com_mobileer_oboetester_TestDataPathsActivity_getMaxMagnitude(JNIEnv *env,
return engine.mActivityDataPath.getDataPathAnalyzer()->getMaxMagnitude();
}

JNIEXPORT double JNICALL
Java_com_mobileer_oboetester_TestDataPathsActivity_getPhaseDataPaths(JNIEnv *env,
jobject instance) {
return engine.mActivityDataPath.getDataPathAnalyzer()->getPhaseOffset();
}

JNIEXPORT void JNICALL
Java_com_mobileer_oboetester_GlitchActivity_setTolerance(JNIEnv *env,
jobject instance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void testConfiguration(int perfMode,
requestedInConfig.setChannelCount(inChannels);
requestedOutConfig.setChannelCount(outChannels);

testInOutConfigurations();
testCurrentConfigurations();
}

private void testConfiguration(int performanceMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public void run() {
mFailCount = 0;
try {
mActivity.runTest();
log("Tests finished without exception.");
log("Tests finished.");
} catch(Exception e) {
log("EXCEPTION: " + e.getMessage());
} finally {
Expand Down
Loading
Loading