aboutsummaryrefslogtreecommitdiff
path: root/src/modules/audio_processing/main/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/audio_processing/main/test')
-rw-r--r--src/modules/audio_processing/main/test/android/apmtest/AndroidManifest.xml30
-rw-r--r--src/modules/audio_processing/main/test/android/apmtest/default.properties11
-rw-r--r--src/modules/audio_processing/main/test/android/apmtest/jni/Android.mk26
-rw-r--r--src/modules/audio_processing/main/test/android/apmtest/jni/Application.mk1
-rw-r--r--src/modules/audio_processing/main/test/android/apmtest/jni/main.c307
-rw-r--r--src/modules/audio_processing/main/test/android/apmtest/res/values/strings.xml4
-rw-r--r--src/modules/audio_processing/main/test/process_test/Android.mk48
-rw-r--r--src/modules/audio_processing/main/test/process_test/apmtest.m360
-rw-r--r--src/modules/audio_processing/main/test/process_test/process_test.cc628
-rw-r--r--src/modules/audio_processing/main/test/unit_test/Android.mk49
-rw-r--r--src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.cc1111
-rw-r--r--src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.h862
-rw-r--r--src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.proto33
-rw-r--r--src/modules/audio_processing/main/test/unit_test/unit_test.cc881
14 files changed, 0 insertions, 4351 deletions
diff --git a/src/modules/audio_processing/main/test/android/apmtest/AndroidManifest.xml b/src/modules/audio_processing/main/test/android/apmtest/AndroidManifest.xml
deleted file mode 100644
index c6063b3d76..0000000000
--- a/src/modules/audio_processing/main/test/android/apmtest/AndroidManifest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- BEGIN_INCLUDE(manifest) -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.native_activity"
- android:versionCode="1"
- android:versionName="1.0">
-
- <!-- This is the platform API where NativeActivity was introduced. -->
- <uses-sdk android:minSdkVersion="8" />
-
- <!-- This .apk has no Java code itself, so set hasCode to false. -->
- <application android:label="@string/app_name" android:hasCode="false" android:debuggable="true">
-
- <!-- Our activity is the built-in NativeActivity framework class.
- This will take care of integrating with our NDK code. -->
- <activity android:name="android.app.NativeActivity"
- android:label="@string/app_name"
- android:configChanges="orientation|keyboardHidden">
- <!-- Tell NativeActivity the name of or .so -->
- <meta-data android:name="android.app.lib_name"
- android:value="apmtest-activity" />
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
-<!-- END_INCLUDE(manifest) -->
diff --git a/src/modules/audio_processing/main/test/android/apmtest/default.properties b/src/modules/audio_processing/main/test/android/apmtest/default.properties
deleted file mode 100644
index 9a2c9f6c88..0000000000
--- a/src/modules/audio_processing/main/test/android/apmtest/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-9
diff --git a/src/modules/audio_processing/main/test/android/apmtest/jni/Android.mk b/src/modules/audio_processing/main/test/android/apmtest/jni/Android.mk
deleted file mode 100644
index eaf3c9d86f..0000000000
--- a/src/modules/audio_processing/main/test/android/apmtest/jni/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := apmtest-activity
-LOCAL_SRC_FILES := main.c
-LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM
-LOCAL_STATIC_LIBRARIES := android_native_app_glue
-
-include $(BUILD_SHARED_LIBRARY)
-
-$(call import-module,android/native_app_glue)
diff --git a/src/modules/audio_processing/main/test/android/apmtest/jni/Application.mk b/src/modules/audio_processing/main/test/android/apmtest/jni/Application.mk
deleted file mode 100644
index 22d188e595..0000000000
--- a/src/modules/audio_processing/main/test/android/apmtest/jni/Application.mk
+++ /dev/null
@@ -1 +0,0 @@
-APP_PLATFORM := android-9
diff --git a/src/modules/audio_processing/main/test/android/apmtest/jni/main.c b/src/modules/audio_processing/main/test/android/apmtest/jni/main.c
deleted file mode 100644
index 2e19635683..0000000000
--- a/src/modules/audio_processing/main/test/android/apmtest/jni/main.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-//BEGIN_INCLUDE(all)
-#include <jni.h>
-#include <errno.h>
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-
-#include <android/sensor.h>
-#include <android/log.h>
-#include <android_native_app_glue.h>
-
-#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
-#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__))
-
-/**
- * Our saved state data.
- */
-struct saved_state {
- float angle;
- int32_t x;
- int32_t y;
-};
-
-/**
- * Shared state for our app.
- */
-struct engine {
- struct android_app* app;
-
- ASensorManager* sensorManager;
- const ASensor* accelerometerSensor;
- ASensorEventQueue* sensorEventQueue;
-
- int animating;
- EGLDisplay display;
- EGLSurface surface;
- EGLContext context;
- int32_t width;
- int32_t height;
- struct saved_state state;
-};
-
-/**
- * Initialize an EGL context for the current display.
- */
-static int engine_init_display(struct engine* engine) {
- // initialize OpenGL ES and EGL
-
- /*
- * Here specify the attributes of the desired configuration.
- * Below, we select an EGLConfig with at least 8 bits per color
- * component compatible with on-screen windows
- */
- const EGLint attribs[] = {
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_BLUE_SIZE, 8,
- EGL_GREEN_SIZE, 8,
- EGL_RED_SIZE, 8,
- EGL_NONE
- };
- EGLint w, h, dummy, format;
- EGLint numConfigs;
- EGLConfig config;
- EGLSurface surface;
- EGLContext context;
-
- EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-
- eglInitialize(display, 0, 0);
-
- /* Here, the application chooses the configuration it desires. In this
- * sample, we have a very simplified selection process, where we pick
- * the first EGLConfig that matches our criteria */
- eglChooseConfig(display, attribs, &config, 1, &numConfigs);
-
- /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
- * guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
- * As soon as we picked a EGLConfig, we can safely reconfigure the
- * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
- eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
-
- ANativeWindow_setBuffersGeometry(engine->app->window, 0, 0, format);
-
- surface = eglCreateWindowSurface(display, config, engine->app->window, NULL);
- context = eglCreateContext(display, config, NULL, NULL);
-
- if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
- LOGW("Unable to eglMakeCurrent");
- return -1;
- }
-
- eglQuerySurface(display, surface, EGL_WIDTH, &w);
- eglQuerySurface(display, surface, EGL_HEIGHT, &h);
-
- engine->display = display;
- engine->context = context;
- engine->surface = surface;
- engine->width = w;
- engine->height = h;
- engine->state.angle = 0;
-
- // Initialize GL state.
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
- glEnable(GL_CULL_FACE);
- glShadeModel(GL_SMOOTH);
- glDisable(GL_DEPTH_TEST);
-
- return 0;
-}
-
-/**
- * Just the current frame in the display.
- */
-static void engine_draw_frame(struct engine* engine) {
- if (engine->display == NULL) {
- // No display.
- return;
- }
-
- // Just fill the screen with a color.
- glClearColor(((float)engine->state.x)/engine->width, engine->state.angle,
- ((float)engine->state.y)/engine->height, 1);
- glClear(GL_COLOR_BUFFER_BIT);
-
- eglSwapBuffers(engine->display, engine->surface);
-}
-
-/**
- * Tear down the EGL context currently associated with the display.
- */
-static void engine_term_display(struct engine* engine) {
- if (engine->display != EGL_NO_DISPLAY) {
- eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- if (engine->context != EGL_NO_CONTEXT) {
- eglDestroyContext(engine->display, engine->context);
- }
- if (engine->surface != EGL_NO_SURFACE) {
- eglDestroySurface(engine->display, engine->surface);
- }
- eglTerminate(engine->display);
- }
- engine->animating = 0;
- engine->display = EGL_NO_DISPLAY;
- engine->context = EGL_NO_CONTEXT;
- engine->surface = EGL_NO_SURFACE;
-}
-
-/**
- * Process the next input event.
- */
-static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) {
- struct engine* engine = (struct engine*)app->userData;
- if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
- engine->animating = 1;
- engine->state.x = AMotionEvent_getX(event, 0);
- engine->state.y = AMotionEvent_getY(event, 0);
- return 1;
- }
- return 0;
-}
-
-/**
- * Process the next main command.
- */
-static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
- struct engine* engine = (struct engine*)app->userData;
- switch (cmd) {
- case APP_CMD_SAVE_STATE:
- // The system has asked us to save our current state. Do so.
- engine->app->savedState = malloc(sizeof(struct saved_state));
- *((struct saved_state*)engine->app->savedState) = engine->state;
- engine->app->savedStateSize = sizeof(struct saved_state);
- break;
- case APP_CMD_INIT_WINDOW:
- // The window is being shown, get it ready.
- if (engine->app->window != NULL) {
- engine_init_display(engine);
- engine_draw_frame(engine);
- }
- break;
- case APP_CMD_TERM_WINDOW:
- // The window is being hidden or closed, clean it up.
- engine_term_display(engine);
- break;
- case APP_CMD_GAINED_FOCUS:
- // When our app gains focus, we start monitoring the accelerometer.
- if (engine->accelerometerSensor != NULL) {
- ASensorEventQueue_enableSensor(engine->sensorEventQueue,
- engine->accelerometerSensor);
- // We'd like to get 60 events per second (in us).
- ASensorEventQueue_setEventRate(engine->sensorEventQueue,
- engine->accelerometerSensor, (1000L/60)*1000);
- }
- break;
- case APP_CMD_LOST_FOCUS:
- // When our app loses focus, we stop monitoring the accelerometer.
- // This is to avoid consuming battery while not being used.
- if (engine->accelerometerSensor != NULL) {
- ASensorEventQueue_disableSensor(engine->sensorEventQueue,
- engine->accelerometerSensor);
- }
- // Also stop animating.
- engine->animating = 0;
- engine_draw_frame(engine);
- break;
- }
-}
-
-/**
- * This is the main entry point of a native application that is using
- * android_native_app_glue. It runs in its own thread, with its own
- * event loop for receiving input events and doing other things.
- */
-void android_main(struct android_app* state) {
- struct engine engine;
-
- // Make sure glue isn't stripped.
- app_dummy();
-
- memset(&engine, 0, sizeof(engine));
- state->userData = &engine;
- state->onAppCmd = engine_handle_cmd;
- state->onInputEvent = engine_handle_input;
- engine.app = state;
-
- // Prepare to monitor accelerometer
- engine.sensorManager = ASensorManager_getInstance();
- engine.accelerometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager,
- ASENSOR_TYPE_ACCELEROMETER);
- engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager,
- state->looper, LOOPER_ID_USER, NULL, NULL);
-
- if (state->savedState != NULL) {
- // We are starting with a previous saved state; restore from it.
- engine.state = *(struct saved_state*)state->savedState;
- }
-
- // loop waiting for stuff to do.
-
- while (1) {
- // Read all pending events.
- int ident;
- int events;
- struct android_poll_source* source;
-
- // If not animating, we will block forever waiting for events.
- // If animating, we loop until all events are read, then continue
- // to draw the next frame of animation.
- while ((ident=ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events,
- (void**)&source)) >= 0) {
-
- // Process this event.
- if (source != NULL) {
- source->process(state, source);
- }
-
- // If a sensor has data, process it now.
- if (ident == LOOPER_ID_USER) {
- if (engine.accelerometerSensor != NULL) {
- ASensorEvent event;
- while (ASensorEventQueue_getEvents(engine.sensorEventQueue,
- &event, 1) > 0) {
- LOGI("accelerometer: x=%f y=%f z=%f",
- event.acceleration.x, event.acceleration.y,
- event.acceleration.z);
- }
- }
- }
-
- // Check if we are exiting.
- if (state->destroyRequested != 0) {
- engine_term_display(&engine);
- return;
- }
- }
-
- if (engine.animating) {
- // Done with events; draw next animation frame.
- engine.state.angle += .01f;
- if (engine.state.angle > 1) {
- engine.state.angle = 0;
- }
-
- // Drawing is throttled to the screen update rate, so there
- // is no need to do timing here.
- engine_draw_frame(&engine);
- }
- }
-}
-//END_INCLUDE(all)
diff --git a/src/modules/audio_processing/main/test/android/apmtest/res/values/strings.xml b/src/modules/audio_processing/main/test/android/apmtest/res/values/strings.xml
deleted file mode 100644
index d0bd0f3051..0000000000
--- a/src/modules/audio_processing/main/test/android/apmtest/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">apmtest</string>
-</resources>
diff --git a/src/modules/audio_processing/main/test/process_test/Android.mk b/src/modules/audio_processing/main/test/process_test/Android.mk
deleted file mode 100644
index 23080aab23..0000000000
--- a/src/modules/audio_processing/main/test/process_test/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS. All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-LOCAL_PATH:= $(call my-dir)
-
-# apm test app
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_SRC_FILES:= \
- process_test.cc
-
-# Flags passed to both C and C++ files.
-LOCAL_CFLAGS := \
- '-DWEBRTC_TARGET_PC' \
- '-DWEBRTC_LINUX' \
- '-DWEBRTC_THREAD_RR' \
- '-DWEBRTC_ANDROID' \
- '-DANDROID'
-
-LOCAL_CPPFLAGS :=
-LOCAL_LDFLAGS :=
-LOCAL_C_INCLUDES := \
- external/gtest/include \
- $(LOCAL_PATH)/../../../../../system_wrappers/interface \
- $(LOCAL_PATH)/../../interface \
- $(LOCAL_PATH)/../../../../interface \
- $(LOCAL_PATH)/../../../../..
-
-LOCAL_STATIC_LIBRARIES := \
- libgtest
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libstlport \
- libwebrtc_audio_preprocessing
-
-LOCAL_MODULE:= webrtc_apm_process_test
-
-include external/stlport/libstlport.mk
-include $(BUILD_EXECUTABLE)
diff --git a/src/modules/audio_processing/main/test/process_test/apmtest.m b/src/modules/audio_processing/main/test/process_test/apmtest.m
deleted file mode 100644
index 6152bb5a9a..0000000000
--- a/src/modules/audio_processing/main/test/process_test/apmtest.m
+++ /dev/null
@@ -1,360 +0,0 @@
-function apmtest(task, testname, casenumber, legacy)
-%APMTEST is a tool to process APM file sets and easily display the output.
-% APMTEST(TASK, TESTNAME, CASENUMBER) performs one of several TASKs:
-% 'test' Processes the files to produce test output.
-% 'list' Prints a list of cases in the test set, preceded by their
-% CASENUMBERs.
-% 'show' Uses spclab to show the test case specified by the
-% CASENUMBER parameter.
-%
-% using a set of test files determined by TESTNAME:
-% 'all' All tests.
-% 'apm' The standard APM test set (default).
-% 'apmm' The mobile APM test set.
-% 'aec' The AEC test set.
-% 'aecm' The AECM test set.
-% 'agc' The AGC test set.
-% 'ns' The NS test set.
-% 'vad' The VAD test set.
-%
-% CASENUMBER can be used to select a single test case. Omit CASENUMBER,
-% or set to zero, to use all test cases.
-%
-
-if nargin < 4
- % Set to true to run old VQE recordings.
- legacy = false;
-end
-
-if nargin < 3
- casenumber = 0;
-end
-
-if nargin < 2
- task = 'test';
-end
-
-if nargin < 1
- testname = 'all';
-end
-
-if ~strcmp(task, 'test') && ~strcmp(task, 'list') && ~strcmp(task, 'show')
- error(['TASK ' task ' is not recognized']);
-end
-
-if casenumber == 0 && strcmp(task, 'show')
- error(['CASENUMBER must be specified for TASK ' task]);
-end
-
-filepath = 'data/';
-inpath = [filepath 'input/'];
-outpath = [filepath 'output/'];
-refpath = [filepath 'reference/'];
-
-% Temporary
-if legacy
- refpath = [filepath 'output/'];
- outpath = [filepath 'reference/'];
-end
-
-if strcmp(testname, 'all')
- tests = {'apm','apmm','aec','aecm','agc','ns','vad'};
-else
- tests = {testname};
-end
-
-if legacy
- progname = '/usr/local/google/p4/dev/depot/test';
-else
- progname = './process_test';
-end
-
-global farFile;
-global nearFile;
-global eventFile;
-global delayFile;
-global driftFile;
-
-if legacy
- farFile = 'vqeFar.pcm';
- nearFile = 'vqeNear.pcm';
- eventFile = 'vqeEvent.dat';
- delayFile = 'vqeBuf.dat';
- driftFile = 'vqeDrift.dat';
-else
- farFile = 'apm_far.pcm';
- nearFile = 'apm_near.pcm';
- eventFile = 'apm_event.dat';
- delayFile = 'apm_delay.dat';
- driftFile = 'apm_drift.dat';
-end
-
-simulateMode = false;
-nErr = 0;
-nCases = 0;
-for i=1:length(tests)
- simulateMode = false;
-
- if strcmp(tests{i}, 'apm')
- testdir = ['apm/'];
- outfile = ['out'];
- if legacy
- opt = ['-ec 1 -agc 2 -nc 2 -vad 3'];
- else
- opt = ['--no_progress -hpf' ...
- ' -aec --drift_compensation -agc --fixed_digital' ...
- ' -ns --ns_moderate -vad'];
- end
-
- elseif strcmp(tests{i}, 'apm-swb')
- simulateMode = true;
- testdir = ['apm-swb/'];
- outfile = ['out'];
- if legacy
- opt = ['-fs 32000 -ec 1 -agc 2 -nc 2'];
- else
- opt = ['--no_progress -fs 32000 -hpf' ...
- ' -aec --drift_compensation -agc --adaptive_digital' ...
- ' -ns --ns_moderate -vad'];
- end
- elseif strcmp(tests{i}, 'apmm')
- testdir = ['apmm/'];
- outfile = ['out'];
- opt = ['-aec --drift_compensation -agc --fixed_digital -hpf -ns ' ...
- '--ns_moderate'];
-
- else
- error(['TESTNAME ' tests{i} ' is not recognized']);
- end
-
- inpath = [inpath testdir];
- outpath = [outpath testdir];
- refpath = [refpath testdir];
-
- if ~exist(inpath,'dir')
- error(['Input directory ' inpath ' does not exist']);
- end
-
- if ~exist(refpath,'dir')
- warning(['Reference directory ' refpath ' does not exist']);
- end
-
- [status, errMsg] = mkdir(outpath);
- if (status == 0)
- error(errMsg);
- end
-
- [nErr, nCases] = recurseDir(inpath, outpath, refpath, outfile, ...
- progname, opt, simulateMode, nErr, nCases, task, casenumber, legacy);
-
- if strcmp(task, 'test') || strcmp(task, 'show')
- system(['rm ' farFile]);
- system(['rm ' nearFile]);
- if simulateMode == false
- system(['rm ' eventFile]);
- system(['rm ' delayFile]);
- system(['rm ' driftFile]);
- end
- end
-end
-
-if ~strcmp(task, 'list')
- if nErr == 0
- fprintf(1, '\nAll files are bit-exact to reference\n', nErr);
- else
- fprintf(1, '\n%d files are NOT bit-exact to reference\n', nErr);
- end
-end
-
-
-function [nErrOut, nCases] = recurseDir(inpath, outpath, refpath, ...
- outfile, progname, opt, simulateMode, nErr, nCases, task, casenumber, ...
- legacy)
-
-global farFile;
-global nearFile;
-global eventFile;
-global delayFile;
-global driftFile;
-
-dirs = dir(inpath);
-nDirs = 0;
-nErrOut = nErr;
-for i=3:length(dirs) % skip . and ..
- nDirs = nDirs + dirs(i).isdir;
-end
-
-
-if nDirs == 0
- nCases = nCases + 1;
-
- if casenumber == nCases || casenumber == 0
-
- if strcmp(task, 'list')
- fprintf([num2str(nCases) '. ' outfile '\n'])
- else
- vadoutfile = ['vad_' outfile '.dat'];
- outfile = [outfile '.pcm'];
-
- % Check for VAD test
- vadTest = 0;
- if ~isempty(findstr(opt, '-vad'))
- vadTest = 1;
- if legacy
- opt = [opt ' ' outpath vadoutfile];
- else
- opt = [opt ' --vad_out_file ' outpath vadoutfile];
- end
- end
-
- if exist([inpath 'vqeFar.pcm'])
- system(['ln -s -f ' inpath 'vqeFar.pcm ' farFile]);
- elseif exist([inpath 'apm_far.pcm'])
- system(['ln -s -f ' inpath 'apm_far.pcm ' farFile]);
- end
-
- if exist([inpath 'vqeNear.pcm'])
- system(['ln -s -f ' inpath 'vqeNear.pcm ' nearFile]);
- elseif exist([inpath 'apm_near.pcm'])
- system(['ln -s -f ' inpath 'apm_near.pcm ' nearFile]);
- end
-
- if exist([inpath 'vqeEvent.dat'])
- system(['ln -s -f ' inpath 'vqeEvent.dat ' eventFile]);
- elseif exist([inpath 'apm_event.day'])
- system(['ln -s -f ' inpath 'apm_event.dat ' eventFile]);
- end
-
- if exist([inpath 'vqeBuf.dat'])
- system(['ln -s -f ' inpath 'vqeBuf.dat ' delayFile]);
- elseif exist([inpath 'apm_delay.day'])
- system(['ln -s -f ' inpath 'apm_delay.dat ' delayFile]);
- end
-
- if exist([inpath 'vqeSkew.dat'])
- system(['ln -s -f ' inpath 'vqeSkew.dat ' driftFile]);
- elseif exist([inpath 'vqeDrift.dat'])
- system(['ln -s -f ' inpath 'vqeDrift.dat ' driftFile]);
- elseif exist([inpath 'apm_drift.dat'])
- system(['ln -s -f ' inpath 'apm_drift.dat ' driftFile]);
- end
-
- if simulateMode == false
- command = [progname ' -o ' outpath outfile ' ' opt];
- else
- if legacy
- inputCmd = [' -in ' nearFile];
- else
- inputCmd = [' -i ' nearFile];
- end
-
- if exist([farFile])
- if legacy
- inputCmd = [' -if ' farFile inputCmd];
- else
- inputCmd = [' -ir ' farFile inputCmd];
- end
- end
- command = [progname inputCmd ' -o ' outpath outfile ' ' opt];
- end
- % This prevents MATLAB from using its own C libraries.
- shellcmd = ['bash -c "unset LD_LIBRARY_PATH;'];
- fprintf([command '\n']);
- [status, result] = system([shellcmd command '"']);
- fprintf(result);
-
- fprintf(['Reference file: ' refpath outfile '\n']);
-
- if vadTest == 1
- equal_to_ref = are_files_equal([outpath vadoutfile], ...
- [refpath vadoutfile], ...
- 'int8');
- if ~equal_to_ref
- nErr = nErr + 1;
- end
- end
-
- [equal_to_ref, diffvector] = are_files_equal([outpath outfile], ...
- [refpath outfile], ...
- 'int16');
- if ~equal_to_ref
- nErr = nErr + 1;
- end
-
- if strcmp(task, 'show')
- % Assume the last init gives the sample rate of interest.
- str_idx = strfind(result, 'Sample rate:');
- fs = str2num(result(str_idx(end) + 13:str_idx(end) + 17));
- fprintf('Using %d Hz\n', fs);
-
- if exist([farFile])
- spclab(fs, farFile, nearFile, [refpath outfile], ...
- [outpath outfile], diffvector);
- %spclab(fs, diffvector);
- else
- spclab(fs, nearFile, [refpath outfile], [outpath outfile], ...
- diffvector);
- %spclab(fs, diffvector);
- end
-
- if vadTest == 1
- spclab([refpath vadoutfile], [outpath vadoutfile]);
- end
- end
- end
- end
-else
-
- for i=3:length(dirs)
- if dirs(i).isdir
- [nErr, nCases] = recurseDir([inpath dirs(i).name '/'], outpath, ...
- refpath,[outfile '_' dirs(i).name], progname, opt, ...
- simulateMode, nErr, nCases, task, casenumber, legacy);
- end
- end
-end
-nErrOut = nErr;
-
-function [are_equal, diffvector] = ...
- are_files_equal(newfile, reffile, precision, diffvector)
-
-are_equal = false;
-diffvector = 0;
-if ~exist(newfile,'file')
- warning(['Output file ' newfile ' does not exist']);
- return
-end
-
-if ~exist(reffile,'file')
- warning(['Reference file ' reffile ' does not exist']);
- return
-end
-
-fid = fopen(newfile,'rb');
-new = fread(fid,inf,precision);
-fclose(fid);
-
-fid = fopen(reffile,'rb');
-ref = fread(fid,inf,precision);
-fclose(fid);
-
-if length(new) ~= length(ref)
- warning('Reference is not the same length as output');
- minlength = min(length(new), length(ref));
- new = new(1:minlength);
- ref = ref(1:minlength);
-end
-diffvector = new - ref;
-
-if isequal(new, ref)
- fprintf([newfile ' is bit-exact to reference\n']);
- are_equal = true;
-else
- if isempty(new)
- warning([newfile ' is empty']);
- return
- end
- snr = snrseg(new,ref,80);
- fprintf('\n');
- are_equal = false;
-end
diff --git a/src/modules/audio_processing/main/test/process_test/process_test.cc b/src/modules/audio_processing/main/test/process_test/process_test.cc
deleted file mode 100644
index c62345fcf0..0000000000
--- a/src/modules/audio_processing/main/test/process_test/process_test.cc
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <stdio.h>
-#include <string.h>
-#ifdef WEBRTC_ANDROID
-#include <sys/stat.h>
-#endif
-
-#include "tick_util.h"
-#include "gtest/gtest.h"
-#include "module_common_types.h"
-
-#include "audio_processing.h"
-
-#include "cpu_features_wrapper.h"
-
-using webrtc::AudioFrame;
-using webrtc::TickInterval;
-using webrtc::TickTime;
-
-using webrtc::AudioProcessing;
-using webrtc::GainControl;
-using webrtc::NoiseSuppression;
-
-void usage() {
- printf(
- "Usage: process_test [options] [-ir REVERSE_FILE] [-i PRIMARY_FILE]\n");
- printf(
- " [-o OUT_FILE]\n");
- printf(
- "process_test is a test application for AudioProcessing.\n\n"
- "When -ir or -i is specified the files will be processed directly in a\n"
- "simulation mode. Otherwise the full set of test files is expected to be\n"
- "present in the working directory.\n");
- printf("\n");
- printf("Options\n");
- printf("General configuration:\n");
- printf(" -fs SAMPLE_RATE_HZ\n");
- printf(" -ch CHANNELS_IN CHANNELS_OUT\n");
- printf(" -rch REVERSE_CHANNELS\n");
- printf("\n");
- printf("Component configuration:\n");
- printf(
- "All components are disabled by default. Each block below begins with a\n"
- "flag to enable the component with default settings. The subsequent flags\n"
- "in the block are used to provide configuration settings.\n");
- printf("\n -aec Echo cancellation\n");
- printf(" --drift_compensation\n");
- printf(" --no_drift_compensation\n");
- printf("\n -aecm Echo control mobile\n");
- printf("\n -agc Gain control\n");
- printf(" --analog\n");
- printf(" --adaptive_digital\n");
- printf(" --fixed_digital\n");
- printf(" --target_level LEVEL\n");
- printf(" --compression_gain GAIN\n");
- printf(" --limiter\n");
- printf(" --no_limiter\n");
- printf("\n -hpf High pass filter\n");
- printf("\n -ns Noise suppression\n");
- printf(" --ns_low\n");
- printf(" --ns_moderate\n");
- printf(" --ns_high\n");
- printf(" --ns_very_high\n");
- printf("\n -vad Voice activity detection\n");
- printf(" --vad_out_file FILE");
- printf("\n");
- printf("Modifiers:\n");
- printf(" --perf Measure performance.\n");
- printf(" --quiet Suppress text output.\n");
- printf(" --no_progress Suppress progress.\n");
- printf(" --version Print version information and exit.\n");
-}
-
-// void function for gtest.
-void void_main(int argc, char* argv[]) {
- if (argc > 1 && strcmp(argv[1], "--help") == 0) {
- usage();
- return;
- }
-
- if (argc < 2) {
- printf("Did you mean to run without arguments?\n");
- printf("Try `process_test --help' for more information.\n\n");
- }
-
- AudioProcessing* apm = AudioProcessing::Create(0);
- ASSERT_TRUE(apm != NULL);
-
- WebRtc_Word8 version[1024];
- WebRtc_UWord32 version_bytes_remaining = sizeof(version);
- WebRtc_UWord32 version_position = 0;
-
- const char* far_filename = NULL;
- const char* near_filename = NULL;
- const char* out_filename = NULL;
- const char* vad_out_filename = NULL;
-
- int32_t sample_rate_hz = 16000;
- int32_t device_sample_rate_hz = 16000;
-
- int num_capture_input_channels = 1;
- int num_capture_output_channels = 1;
- int num_render_channels = 1;
-
- int samples_per_channel = sample_rate_hz / 100;
-
- bool simulating = false;
- bool perf_testing = false;
- bool verbose = true;
- bool progress = true;
- //bool interleaved = true;
-
- for (int i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-ir") == 0) {
- i++;
- ASSERT_LT(i, argc) << "Specify filename after -ir";
- far_filename = argv[i];
- simulating = true;
-
- } else if (strcmp(argv[i], "-i") == 0) {
- i++;
- ASSERT_LT(i, argc) << "Specify filename after -i";
- near_filename = argv[i];
- simulating = true;
-
- } else if (strcmp(argv[i], "-o") == 0) {
- i++;
- ASSERT_LT(i, argc) << "Specify filename after -o";
- out_filename = argv[i];
-
- } else if (strcmp(argv[i], "-fs") == 0) {
- i++;
- ASSERT_LT(i, argc) << "Specify sample rate after -fs";
- ASSERT_EQ(1, sscanf(argv[i], "%d", &sample_rate_hz));
- samples_per_channel = sample_rate_hz / 100;
-
- ASSERT_EQ(apm->kNoError,
- apm->set_sample_rate_hz(sample_rate_hz));
-
- } else if (strcmp(argv[i], "-ch") == 0) {
- i++;
- ASSERT_LT(i + 1, argc) << "Specify number of channels after -ch";
- ASSERT_EQ(1, sscanf(argv[i], "%d", &num_capture_input_channels));
- i++;
- ASSERT_EQ(1, sscanf(argv[i], "%d", &num_capture_output_channels));
-
- ASSERT_EQ(apm->kNoError,
- apm->set_num_channels(num_capture_input_channels,
- num_capture_output_channels));
-
- } else if (strcmp(argv[i], "-rch") == 0) {
- i++;
- ASSERT_LT(i, argc) << "Specify number of channels after -rch";
- ASSERT_EQ(1, sscanf(argv[i], "%d", &num_render_channels));
-
- ASSERT_EQ(apm->kNoError,
- apm->set_num_reverse_channels(num_render_channels));
-
- } else if (strcmp(argv[i], "-aec") == 0) {
- ASSERT_EQ(apm->kNoError, apm->echo_cancellation()->Enable(true));
-
- } else if (strcmp(argv[i], "-noasm") == 0) {
- WebRtc_GetCPUInfo = WebRtc_GetCPUInfoNoASM;
-
- } else if (strcmp(argv[i], "--drift_compensation") == 0) {
- ASSERT_EQ(apm->kNoError, apm->echo_cancellation()->Enable(true));
- // TODO(ajm): this is enabled in the VQE test app by default. Investigate
- // why it can give better performance despite passing zeros.
- ASSERT_EQ(apm->kNoError,
- apm->echo_cancellation()->enable_drift_compensation(true));
- } else if (strcmp(argv[i], "--no_drift_compensation") == 0) {
- ASSERT_EQ(apm->kNoError, apm->echo_cancellation()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->echo_cancellation()->enable_drift_compensation(false));
-
- } else if (strcmp(argv[i], "-aecm") == 0) {
- ASSERT_EQ(apm->kNoError, apm->echo_control_mobile()->Enable(true));
-
- } else if (strcmp(argv[i], "-agc") == 0) {
- ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
-
- } else if (strcmp(argv[i], "--analog") == 0) {
- ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->gain_control()->set_mode(GainControl::kAdaptiveAnalog));
-
- } else if (strcmp(argv[i], "--adaptive_digital") == 0) {
- ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->gain_control()->set_mode(GainControl::kAdaptiveDigital));
-
- } else if (strcmp(argv[i], "--fixed_digital") == 0) {
- ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->gain_control()->set_mode(GainControl::kFixedDigital));
-
- } else if (strcmp(argv[i], "--target_level") == 0) {
- i++;
- int level;
- ASSERT_EQ(1, sscanf(argv[i], "%d", &level));
-
- ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->gain_control()->set_target_level_dbfs(level));
-
- } else if (strcmp(argv[i], "--compression_gain") == 0) {
- i++;
- int gain;
- ASSERT_EQ(1, sscanf(argv[i], "%d", &gain));
-
- ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->gain_control()->set_compression_gain_db(gain));
-
- } else if (strcmp(argv[i], "--limiter") == 0) {
- ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->gain_control()->enable_limiter(true));
-
- } else if (strcmp(argv[i], "--no_limiter") == 0) {
- ASSERT_EQ(apm->kNoError, apm->gain_control()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->gain_control()->enable_limiter(false));
-
- } else if (strcmp(argv[i], "-hpf") == 0) {
- ASSERT_EQ(apm->kNoError, apm->high_pass_filter()->Enable(true));
-
- } else if (strcmp(argv[i], "-ns") == 0) {
- ASSERT_EQ(apm->kNoError, apm->noise_suppression()->Enable(true));
-
- } else if (strcmp(argv[i], "--ns_low") == 0) {
- ASSERT_EQ(apm->kNoError, apm->noise_suppression()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->noise_suppression()->set_level(NoiseSuppression::kLow));
-
- } else if (strcmp(argv[i], "--ns_moderate") == 0) {
- ASSERT_EQ(apm->kNoError, apm->noise_suppression()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->noise_suppression()->set_level(NoiseSuppression::kModerate));
-
- } else if (strcmp(argv[i], "--ns_high") == 0) {
- ASSERT_EQ(apm->kNoError, apm->noise_suppression()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->noise_suppression()->set_level(NoiseSuppression::kHigh));
-
- } else if (strcmp(argv[i], "--ns_very_high") == 0) {
- ASSERT_EQ(apm->kNoError, apm->noise_suppression()->Enable(true));
- ASSERT_EQ(apm->kNoError,
- apm->noise_suppression()->set_level(NoiseSuppression::kVeryHigh));
-
- } else if (strcmp(argv[i], "-vad") == 0) {
- ASSERT_EQ(apm->kNoError, apm->voice_detection()->Enable(true));
-
- } else if (strcmp(argv[i], "--vad_out_file") == 0) {
- i++;
- ASSERT_LT(i, argc) << "Specify filename after --vad_out_file";
- vad_out_filename = argv[i];
-
- } else if (strcmp(argv[i], "--perf") == 0) {
- perf_testing = true;
-
- } else if (strcmp(argv[i], "--quiet") == 0) {
- verbose = false;
- progress = false;
-
- } else if (strcmp(argv[i], "--no_progress") == 0) {
- progress = false;
-
- } else if (strcmp(argv[i], "--version") == 0) {
- ASSERT_EQ(apm->kNoError, apm->Version(version,
- version_bytes_remaining,
- version_position));
- printf("%s\n", version);
- return;
-
- } else {
- FAIL() << "Unrecognized argument " << argv[i];
- }
- }
-
- if (verbose) {
- printf("Sample rate: %d Hz\n", sample_rate_hz);
- printf("Primary channels: %d (in), %d (out)\n",
- num_capture_input_channels,
- num_capture_output_channels);
- printf("Reverse channels: %d \n", num_render_channels);
- }
-
- const char far_file_default[] = "apm_far.pcm";
- const char near_file_default[] = "apm_near.pcm";
- const char out_file_default[] = "out.pcm";
- const char event_filename[] = "apm_event.dat";
- const char delay_filename[] = "apm_delay.dat";
- const char drift_filename[] = "apm_drift.dat";
- const char vad_file_default[] = "vad_out.dat";
-
- if (!simulating) {
- far_filename = far_file_default;
- near_filename = near_file_default;
- }
-
- if (out_filename == NULL) {
- out_filename = out_file_default;
- }
-
- if (vad_out_filename == NULL) {
- vad_out_filename = vad_file_default;
- }
-
- FILE* far_file = NULL;
- FILE* near_file = NULL;
- FILE* out_file = NULL;
- FILE* event_file = NULL;
- FILE* delay_file = NULL;
- FILE* drift_file = NULL;
- FILE* vad_out_file = NULL;
-
- if (far_filename != NULL) {
- far_file = fopen(far_filename, "rb");
- ASSERT_TRUE(NULL != far_file) << "Unable to open far-end audio file "
- << far_filename;
- }
-
- near_file = fopen(near_filename, "rb");
- ASSERT_TRUE(NULL != near_file) << "Unable to open near-end audio file "
- << near_filename;
- struct stat st;
- stat(near_filename, &st);
- int near_size_samples = st.st_size / sizeof(int16_t);
-
- out_file = fopen(out_filename, "wb");
- ASSERT_TRUE(NULL != out_file) << "Unable to open output audio file "
- << out_filename;
-
- if (!simulating) {
- event_file = fopen(event_filename, "rb");
- ASSERT_TRUE(NULL != event_file) << "Unable to open event file "
- << event_filename;
-
- delay_file = fopen(delay_filename, "rb");
- ASSERT_TRUE(NULL != delay_file) << "Unable to open buffer file "
- << delay_filename;
-
- drift_file = fopen(drift_filename, "rb");
- ASSERT_TRUE(NULL != drift_file) << "Unable to open drift file "
- << drift_filename;
- }
-
- if (apm->voice_detection()->is_enabled()) {
- vad_out_file = fopen(vad_out_filename, "wb");
- ASSERT_TRUE(NULL != vad_out_file) << "Unable to open VAD output file "
- << vad_out_file;
- }
-
- enum Events {
- kInitializeEvent,
- kRenderEvent,
- kCaptureEvent,
- kResetEventDeprecated
- };
- int16_t event = 0;
- size_t read_count = 0;
- int reverse_count = 0;
- int primary_count = 0;
- int near_read_samples = 0;
- TickInterval acc_ticks;
-
- AudioFrame far_frame;
- far_frame._frequencyInHz = sample_rate_hz;
-
- AudioFrame near_frame;
- near_frame._frequencyInHz = sample_rate_hz;
-
- int delay_ms = 0;
- int drift_samples = 0;
- int capture_level = 127;
- int8_t stream_has_voice = 0;
-
- TickTime t0 = TickTime::Now();
- TickTime t1 = t0;
- WebRtc_Word64 max_time_us = 0;
- WebRtc_Word64 max_time_reverse_us = 0;
- WebRtc_Word64 min_time_us = 1e6;
- WebRtc_Word64 min_time_reverse_us = 1e6;
-
- while (simulating || feof(event_file) == 0) {
- std::ostringstream trace_stream;
- trace_stream << "Processed frames: " << reverse_count << " (reverse), "
- << primary_count << " (primary)";
- SCOPED_TRACE(trace_stream.str());
-
-
- if (simulating) {
- if (far_file == NULL) {
- event = kCaptureEvent;
- } else {
- if (event == kRenderEvent) {
- event = kCaptureEvent;
- } else {
- event = kRenderEvent;
- }
- }
- } else {
- read_count = fread(&event, sizeof(event), 1, event_file);
- if (read_count != 1) {
- break;
- }
- //if (fread(&event, sizeof(event), 1, event_file) != 1) {
- // break; // This is expected.
- //}
- }
-
- if (event == kInitializeEvent || event == kResetEventDeprecated) {
- ASSERT_EQ(1u,
- fread(&sample_rate_hz, sizeof(sample_rate_hz), 1, event_file));
- samples_per_channel = sample_rate_hz / 100;
-
- ASSERT_EQ(1u,
- fread(&device_sample_rate_hz,
- sizeof(device_sample_rate_hz),
- 1,
- event_file));
-
- ASSERT_EQ(apm->kNoError,
- apm->set_sample_rate_hz(sample_rate_hz));
-
- ASSERT_EQ(apm->kNoError,
- apm->echo_cancellation()->set_device_sample_rate_hz(
- device_sample_rate_hz));
-
- far_frame._frequencyInHz = sample_rate_hz;
- near_frame._frequencyInHz = sample_rate_hz;
-
- if (verbose) {
- printf("Init at frame: %d (primary), %d (reverse)\n",
- primary_count, reverse_count);
- printf(" Sample rate: %d Hz\n", sample_rate_hz);
- }
-
- } else if (event == kRenderEvent) {
- reverse_count++;
- far_frame._audioChannel = num_render_channels;
- far_frame._payloadDataLengthInSamples =
- num_render_channels * samples_per_channel;
-
- read_count = fread(far_frame._payloadData,
- sizeof(WebRtc_Word16),
- far_frame._payloadDataLengthInSamples,
- far_file);
-
- if (simulating) {
- if (read_count != far_frame._payloadDataLengthInSamples) {
- break; // This is expected.
- }
- } else {
- ASSERT_EQ(read_count,
- far_frame._payloadDataLengthInSamples);
- }
-
- if (perf_testing) {
- t0 = TickTime::Now();
- }
-
- ASSERT_EQ(apm->kNoError,
- apm->AnalyzeReverseStream(&far_frame));
-
- if (perf_testing) {
- t1 = TickTime::Now();
- TickInterval tick_diff = t1 - t0;
- acc_ticks += tick_diff;
- if (tick_diff.Microseconds() > max_time_reverse_us) {
- max_time_reverse_us = tick_diff.Microseconds();
- }
- if (tick_diff.Microseconds() < min_time_reverse_us) {
- min_time_reverse_us = tick_diff.Microseconds();
- }
- }
-
- } else if (event == kCaptureEvent) {
- primary_count++;
- near_frame._audioChannel = num_capture_input_channels;
- near_frame._payloadDataLengthInSamples =
- num_capture_input_channels * samples_per_channel;
-
- read_count = fread(near_frame._payloadData,
- sizeof(WebRtc_Word16),
- near_frame._payloadDataLengthInSamples,
- near_file);
-
- near_read_samples += read_count;
- if (progress && primary_count % 100 == 0) {
- printf("%.0f%% complete\r",
- (near_read_samples * 100.0) / near_size_samples);
- fflush(stdout);
- }
- if (simulating) {
- if (read_count != near_frame._payloadDataLengthInSamples) {
- break; // This is expected.
- }
-
- delay_ms = 0;
- drift_samples = 0;
- } else {
- ASSERT_EQ(read_count,
- near_frame._payloadDataLengthInSamples);
-
- // TODO(ajm): sizeof(delay_ms) for current files?
- ASSERT_EQ(1u,
- fread(&delay_ms, 2, 1, delay_file));
- ASSERT_EQ(1u,
- fread(&drift_samples, sizeof(drift_samples), 1, drift_file));
- }
-
- if (perf_testing) {
- t0 = TickTime::Now();
- }
-
- // TODO(ajm): fake an analog gain while simulating.
-
- int capture_level_in = capture_level;
- ASSERT_EQ(apm->kNoError,
- apm->gain_control()->set_stream_analog_level(capture_level));
- ASSERT_EQ(apm->kNoError,
- apm->set_stream_delay_ms(delay_ms));
- ASSERT_EQ(apm->kNoError,
- apm->echo_cancellation()->set_stream_drift_samples(drift_samples));
-
- int err = apm->ProcessStream(&near_frame);
- if (err == apm->kBadStreamParameterWarning) {
- printf("Bad parameter warning. %s\n", trace_stream.str().c_str());
- }
- ASSERT_TRUE(err == apm->kNoError ||
- err == apm->kBadStreamParameterWarning);
-
- capture_level = apm->gain_control()->stream_analog_level();
-
- stream_has_voice =
- static_cast<int8_t>(apm->voice_detection()->stream_has_voice());
- if (vad_out_file != NULL) {
- ASSERT_EQ(1u, fwrite(&stream_has_voice,
- sizeof(stream_has_voice),
- 1,
- vad_out_file));
- }
-
- if (apm->gain_control()->mode() != GainControl::kAdaptiveAnalog) {
- ASSERT_EQ(capture_level_in, capture_level);
- }
-
- if (perf_testing) {
- t1 = TickTime::Now();
- TickInterval tick_diff = t1 - t0;
- acc_ticks += tick_diff;
- if (tick_diff.Microseconds() > max_time_us) {
- max_time_us = tick_diff.Microseconds();
- }
- if (tick_diff.Microseconds() < min_time_us) {
- min_time_us = tick_diff.Microseconds();
- }
- }
-
- ASSERT_EQ(near_frame._payloadDataLengthInSamples,
- fwrite(near_frame._payloadData,
- sizeof(WebRtc_Word16),
- near_frame._payloadDataLengthInSamples,
- out_file));
- }
- else {
- FAIL() << "Event " << event << " is unrecognized";
- }
- }
-
- if (verbose) {
- printf("\nProcessed frames: %d (primary), %d (reverse)\n",
- primary_count, reverse_count);
- }
-
- int8_t temp_int8;
- if (far_file != NULL) {
- read_count = fread(&temp_int8, sizeof(temp_int8), 1, far_file);
- EXPECT_NE(0, feof(far_file)) << "Far-end file not fully processed";
- }
- read_count = fread(&temp_int8, sizeof(temp_int8), 1, near_file);
- EXPECT_NE(0, feof(near_file)) << "Near-end file not fully processed";
-
- if (!simulating) {
- read_count = fread(&temp_int8, sizeof(temp_int8), 1, event_file);
- EXPECT_NE(0, feof(event_file)) << "Event file not fully processed";
- read_count = fread(&temp_int8, sizeof(temp_int8), 1, delay_file);
- EXPECT_NE(0, feof(delay_file)) << "Delay file not fully processed";
- read_count = fread(&temp_int8, sizeof(temp_int8), 1, drift_file);
- EXPECT_NE(0, feof(drift_file)) << "Drift file not fully processed";
- }
-
- if (perf_testing) {
- if (primary_count > 0) {
- WebRtc_Word64 exec_time = acc_ticks.Milliseconds();
- printf("\nTotal time: %.3f s, file time: %.2f s\n",
- exec_time * 0.001, primary_count * 0.01);
- printf("Time per frame: %.3f ms (average), %.3f ms (max),"
- " %.3f ms (min)\n",
- (exec_time * 1.0) / primary_count,
- (max_time_us + max_time_reverse_us) / 1000.0,
- (min_time_us + min_time_reverse_us) / 1000.0);
- } else {
- printf("Warning: no capture frames\n");
- }
- }
-
- AudioProcessing::Destroy(apm);
- apm = NULL;
-}
-
-int main(int argc, char* argv[])
-{
- void_main(argc, argv);
-
- return 0;
-}
diff --git a/src/modules/audio_processing/main/test/unit_test/Android.mk b/src/modules/audio_processing/main/test/unit_test/Android.mk
deleted file mode 100644
index b2029cfb4d..0000000000
--- a/src/modules/audio_processing/main/test/unit_test/Android.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS. All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-LOCAL_PATH:= $(call my-dir)
-
-# apm test app
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_SRC_FILES:= \
- unit_test.cc
-
-# Flags passed to both C and C++ files.
-LOCAL_CFLAGS := \
- '-DWEBRTC_TARGET_PC' \
- '-DWEBRTC_LINUX' \
- '-DWEBRTC_THREAD_RR' \
- '-DWEBRTC_ANDROID' \
- '-DANDROID'
-
-LOCAL_CPPFLAGS :=
-LOCAL_LDFLAGS :=
-LOCAL_C_INCLUDES := \
- external/gtest/include \
- $(LOCAL_PATH)/../../../../../system_wrappers/interface \
- $(LOCAL_PATH)/../../../../../common_audio/signal_processing_library/main/interface \
- $(LOCAL_PATH)/../../interface \
- $(LOCAL_PATH)/../../../../interface \
- $(LOCAL_PATH)/../../../../..
-
-LOCAL_STATIC_LIBRARIES := \
- libgtest
-
-LOCAL_SHARED_LIBRARIES := \
- libutils \
- libstlport \
- libwebrtc_audio_preprocessing
-
-LOCAL_MODULE:= webrtc_apm_unit_test
-
-include external/stlport/libstlport.mk
-include $(BUILD_EXECUTABLE)
diff --git a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.cc b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.cc
deleted file mode 100644
index c82ffdb43e..0000000000
--- a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.cc
+++ /dev/null
@@ -1,1111 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-
-#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
-#include "audio_processing_unittest.pb.h"
-
-#include <algorithm>
-
-#include <google/protobuf/stubs/once.h>
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/wire_format_lite_inl.h>
-// @@protoc_insertion_point(includes)
-
-namespace audio_processing_unittest {
-
-void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto() {
- delete Test::default_instance_;
- delete Test_Statistic::default_instance_;
- delete Test_EchoMetrics::default_instance_;
- delete OutputData::default_instance_;
-}
-
-void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto() {
- static bool already_here = false;
- if (already_here) return;
- already_here = true;
- GOOGLE_PROTOBUF_VERIFY_VERSION;
-
- Test::default_instance_ = new Test();
- Test_Statistic::default_instance_ = new Test_Statistic();
- Test_EchoMetrics::default_instance_ = new Test_EchoMetrics();
- OutputData::default_instance_ = new OutputData();
- Test::default_instance_->InitAsDefaultInstance();
- Test_Statistic::default_instance_->InitAsDefaultInstance();
- Test_EchoMetrics::default_instance_->InitAsDefaultInstance();
- OutputData::default_instance_->InitAsDefaultInstance();
- ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto);
-}
-
-// Force AddDescriptors() to be called at static initialization time.
-struct StaticDescriptorInitializer_audio_5fprocessing_5funittest_2eproto {
- StaticDescriptorInitializer_audio_5fprocessing_5funittest_2eproto() {
- protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto();
- }
-} static_descriptor_initializer_audio_5fprocessing_5funittest_2eproto_;
-
-
-// ===================================================================
-
-#ifndef _MSC_VER
-const int Test_Statistic::kInstantFieldNumber;
-const int Test_Statistic::kAverageFieldNumber;
-const int Test_Statistic::kMaximumFieldNumber;
-const int Test_Statistic::kMinimumFieldNumber;
-#endif // !_MSC_VER
-
-Test_Statistic::Test_Statistic()
- : ::google::protobuf::MessageLite() {
- SharedCtor();
-}
-
-void Test_Statistic::InitAsDefaultInstance() {
-}
-
-Test_Statistic::Test_Statistic(const Test_Statistic& from)
- : ::google::protobuf::MessageLite() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void Test_Statistic::SharedCtor() {
- _cached_size_ = 0;
- instant_ = 0;
- average_ = 0;
- maximum_ = 0;
- minimum_ = 0;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-Test_Statistic::~Test_Statistic() {
- SharedDtor();
-}
-
-void Test_Statistic::SharedDtor() {
- if (this != default_instance_) {
- }
-}
-
-void Test_Statistic::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const Test_Statistic& Test_Statistic::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto(); return *default_instance_;
-}
-
-Test_Statistic* Test_Statistic::default_instance_ = NULL;
-
-Test_Statistic* Test_Statistic::New() const {
- return new Test_Statistic;
-}
-
-void Test_Statistic::Clear() {
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- instant_ = 0;
- average_ = 0;
- maximum_ = 0;
- minimum_ = 0;
- }
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-bool Test_Statistic::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // optional int32 instant = 1;
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &instant_)));
- set_has_instant();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(16)) goto parse_average;
- break;
- }
-
- // optional int32 average = 2;
- case 2: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_average:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &average_)));
- set_has_average();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(24)) goto parse_maximum;
- break;
- }
-
- // optional int32 maximum = 3;
- case 3: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_maximum:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &maximum_)));
- set_has_maximum();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(32)) goto parse_minimum;
- break;
- }
-
- // optional int32 minimum = 4;
- case 4: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_minimum:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &minimum_)));
- set_has_minimum();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, NULL));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void Test_Statistic::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // optional int32 instant = 1;
- if (has_instant()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->instant(), output);
- }
-
- // optional int32 average = 2;
- if (has_average()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->average(), output);
- }
-
- // optional int32 maximum = 3;
- if (has_maximum()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->maximum(), output);
- }
-
- // optional int32 minimum = 4;
- if (has_minimum()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->minimum(), output);
- }
-
-}
-
-int Test_Statistic::ByteSize() const {
- int total_size = 0;
-
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- // optional int32 instant = 1;
- if (has_instant()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->instant());
- }
-
- // optional int32 average = 2;
- if (has_average()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->average());
- }
-
- // optional int32 maximum = 3;
- if (has_maximum()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->maximum());
- }
-
- // optional int32 minimum = 4;
- if (has_minimum()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->minimum());
- }
-
- }
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void Test_Statistic::CheckTypeAndMergeFrom(
- const ::google::protobuf::MessageLite& from) {
- MergeFrom(*::google::protobuf::down_cast<const Test_Statistic*>(&from));
-}
-
-void Test_Statistic::MergeFrom(const Test_Statistic& from) {
- GOOGLE_CHECK_NE(&from, this);
- if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- if (from.has_instant()) {
- set_instant(from.instant());
- }
- if (from.has_average()) {
- set_average(from.average());
- }
- if (from.has_maximum()) {
- set_maximum(from.maximum());
- }
- if (from.has_minimum()) {
- set_minimum(from.minimum());
- }
- }
-}
-
-void Test_Statistic::CopyFrom(const Test_Statistic& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool Test_Statistic::IsInitialized() const {
-
- return true;
-}
-
-void Test_Statistic::Swap(Test_Statistic* other) {
- if (other != this) {
- std::swap(instant_, other->instant_);
- std::swap(average_, other->average_);
- std::swap(maximum_, other->maximum_);
- std::swap(minimum_, other->minimum_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::std::string Test_Statistic::GetTypeName() const {
- return "audio_processing_unittest.Test.Statistic";
-}
-
-
-// -------------------------------------------------------------------
-
-#ifndef _MSC_VER
-const int Test_EchoMetrics::kResidualEchoReturnLossFieldNumber;
-const int Test_EchoMetrics::kEchoReturnLossFieldNumber;
-const int Test_EchoMetrics::kEchoReturnLossEnhancementFieldNumber;
-const int Test_EchoMetrics::kANlpFieldNumber;
-#endif // !_MSC_VER
-
-Test_EchoMetrics::Test_EchoMetrics()
- : ::google::protobuf::MessageLite() {
- SharedCtor();
-}
-
-void Test_EchoMetrics::InitAsDefaultInstance() {
- residualechoreturnloss_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance());
- echoreturnloss_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance());
- echoreturnlossenhancement_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance());
- anlp_ = const_cast< ::audio_processing_unittest::Test_Statistic*>(&::audio_processing_unittest::Test_Statistic::default_instance());
-}
-
-Test_EchoMetrics::Test_EchoMetrics(const Test_EchoMetrics& from)
- : ::google::protobuf::MessageLite() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void Test_EchoMetrics::SharedCtor() {
- _cached_size_ = 0;
- residualechoreturnloss_ = NULL;
- echoreturnloss_ = NULL;
- echoreturnlossenhancement_ = NULL;
- anlp_ = NULL;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-Test_EchoMetrics::~Test_EchoMetrics() {
- SharedDtor();
-}
-
-void Test_EchoMetrics::SharedDtor() {
- if (this != default_instance_) {
- delete residualechoreturnloss_;
- delete echoreturnloss_;
- delete echoreturnlossenhancement_;
- delete anlp_;
- }
-}
-
-void Test_EchoMetrics::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const Test_EchoMetrics& Test_EchoMetrics::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto(); return *default_instance_;
-}
-
-Test_EchoMetrics* Test_EchoMetrics::default_instance_ = NULL;
-
-Test_EchoMetrics* Test_EchoMetrics::New() const {
- return new Test_EchoMetrics;
-}
-
-void Test_EchoMetrics::Clear() {
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- if (has_residualechoreturnloss()) {
- if (residualechoreturnloss_ != NULL) residualechoreturnloss_->::audio_processing_unittest::Test_Statistic::Clear();
- }
- if (has_echoreturnloss()) {
- if (echoreturnloss_ != NULL) echoreturnloss_->::audio_processing_unittest::Test_Statistic::Clear();
- }
- if (has_echoreturnlossenhancement()) {
- if (echoreturnlossenhancement_ != NULL) echoreturnlossenhancement_->::audio_processing_unittest::Test_Statistic::Clear();
- }
- if (has_anlp()) {
- if (anlp_ != NULL) anlp_->::audio_processing_unittest::Test_Statistic::Clear();
- }
- }
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-bool Test_EchoMetrics::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1;
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, mutable_residualechoreturnloss()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(18)) goto parse_echoReturnLoss;
- break;
- }
-
- // optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2;
- case 2: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_echoReturnLoss:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, mutable_echoreturnloss()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(26)) goto parse_echoReturnLossEnhancement;
- break;
- }
-
- // optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3;
- case 3: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_echoReturnLossEnhancement:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, mutable_echoreturnlossenhancement()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(34)) goto parse_aNlp;
- break;
- }
-
- // optional .audio_processing_unittest.Test.Statistic aNlp = 4;
- case 4: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_aNlp:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, mutable_anlp()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, NULL));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void Test_EchoMetrics::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1;
- if (has_residualechoreturnloss()) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 1, this->residualechoreturnloss(), output);
- }
-
- // optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2;
- if (has_echoreturnloss()) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 2, this->echoreturnloss(), output);
- }
-
- // optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3;
- if (has_echoreturnlossenhancement()) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 3, this->echoreturnlossenhancement(), output);
- }
-
- // optional .audio_processing_unittest.Test.Statistic aNlp = 4;
- if (has_anlp()) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 4, this->anlp(), output);
- }
-
-}
-
-int Test_EchoMetrics::ByteSize() const {
- int total_size = 0;
-
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- // optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1;
- if (has_residualechoreturnloss()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->residualechoreturnloss());
- }
-
- // optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2;
- if (has_echoreturnloss()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->echoreturnloss());
- }
-
- // optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3;
- if (has_echoreturnlossenhancement()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->echoreturnlossenhancement());
- }
-
- // optional .audio_processing_unittest.Test.Statistic aNlp = 4;
- if (has_anlp()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->anlp());
- }
-
- }
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void Test_EchoMetrics::CheckTypeAndMergeFrom(
- const ::google::protobuf::MessageLite& from) {
- MergeFrom(*::google::protobuf::down_cast<const Test_EchoMetrics*>(&from));
-}
-
-void Test_EchoMetrics::MergeFrom(const Test_EchoMetrics& from) {
- GOOGLE_CHECK_NE(&from, this);
- if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- if (from.has_residualechoreturnloss()) {
- mutable_residualechoreturnloss()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.residualechoreturnloss());
- }
- if (from.has_echoreturnloss()) {
- mutable_echoreturnloss()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.echoreturnloss());
- }
- if (from.has_echoreturnlossenhancement()) {
- mutable_echoreturnlossenhancement()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.echoreturnlossenhancement());
- }
- if (from.has_anlp()) {
- mutable_anlp()->::audio_processing_unittest::Test_Statistic::MergeFrom(from.anlp());
- }
- }
-}
-
-void Test_EchoMetrics::CopyFrom(const Test_EchoMetrics& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool Test_EchoMetrics::IsInitialized() const {
-
- return true;
-}
-
-void Test_EchoMetrics::Swap(Test_EchoMetrics* other) {
- if (other != this) {
- std::swap(residualechoreturnloss_, other->residualechoreturnloss_);
- std::swap(echoreturnloss_, other->echoreturnloss_);
- std::swap(echoreturnlossenhancement_, other->echoreturnlossenhancement_);
- std::swap(anlp_, other->anlp_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::std::string Test_EchoMetrics::GetTypeName() const {
- return "audio_processing_unittest.Test.EchoMetrics";
-}
-
-
-// -------------------------------------------------------------------
-
-#ifndef _MSC_VER
-const int Test::kNumReverseChannelsFieldNumber;
-const int Test::kNumChannelsFieldNumber;
-const int Test::kSampleRateFieldNumber;
-const int Test::kHasEchoCountFieldNumber;
-const int Test::kHasVoiceCountFieldNumber;
-const int Test::kIsSaturatedCountFieldNumber;
-const int Test::kEchoMetricsFieldNumber;
-#endif // !_MSC_VER
-
-Test::Test()
- : ::google::protobuf::MessageLite() {
- SharedCtor();
-}
-
-void Test::InitAsDefaultInstance() {
- echometrics_ = const_cast< ::audio_processing_unittest::Test_EchoMetrics*>(&::audio_processing_unittest::Test_EchoMetrics::default_instance());
-}
-
-Test::Test(const Test& from)
- : ::google::protobuf::MessageLite() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void Test::SharedCtor() {
- _cached_size_ = 0;
- numreversechannels_ = 0;
- numchannels_ = 0;
- samplerate_ = 0;
- hasechocount_ = 0;
- hasvoicecount_ = 0;
- issaturatedcount_ = 0;
- echometrics_ = NULL;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-Test::~Test() {
- SharedDtor();
-}
-
-void Test::SharedDtor() {
- if (this != default_instance_) {
- delete echometrics_;
- }
-}
-
-void Test::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const Test& Test::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto(); return *default_instance_;
-}
-
-Test* Test::default_instance_ = NULL;
-
-Test* Test::New() const {
- return new Test;
-}
-
-void Test::Clear() {
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- numreversechannels_ = 0;
- numchannels_ = 0;
- samplerate_ = 0;
- hasechocount_ = 0;
- hasvoicecount_ = 0;
- issaturatedcount_ = 0;
- if (has_echometrics()) {
- if (echometrics_ != NULL) echometrics_->::audio_processing_unittest::Test_EchoMetrics::Clear();
- }
- }
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-bool Test::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // optional int32 numReverseChannels = 1;
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &numreversechannels_)));
- set_has_numreversechannels();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(16)) goto parse_numChannels;
- break;
- }
-
- // optional int32 numChannels = 2;
- case 2: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_numChannels:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &numchannels_)));
- set_has_numchannels();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(24)) goto parse_sampleRate;
- break;
- }
-
- // optional int32 sampleRate = 3;
- case 3: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_sampleRate:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &samplerate_)));
- set_has_samplerate();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(32)) goto parse_hasEchoCount;
- break;
- }
-
- // optional int32 hasEchoCount = 4;
- case 4: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_hasEchoCount:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &hasechocount_)));
- set_has_hasechocount();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(40)) goto parse_hasVoiceCount;
- break;
- }
-
- // optional int32 hasVoiceCount = 5;
- case 5: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_hasVoiceCount:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &hasvoicecount_)));
- set_has_hasvoicecount();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(48)) goto parse_isSaturatedCount;
- break;
- }
-
- // optional int32 isSaturatedCount = 6;
- case 6: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
- parse_isSaturatedCount:
- DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
- ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
- input, &issaturatedcount_)));
- set_has_issaturatedcount();
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(58)) goto parse_echoMetrics;
- break;
- }
-
- // optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7;
- case 7: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_echoMetrics:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, mutable_echometrics()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, NULL));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void Test::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // optional int32 numReverseChannels = 1;
- if (has_numreversechannels()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->numreversechannels(), output);
- }
-
- // optional int32 numChannels = 2;
- if (has_numchannels()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->numchannels(), output);
- }
-
- // optional int32 sampleRate = 3;
- if (has_samplerate()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->samplerate(), output);
- }
-
- // optional int32 hasEchoCount = 4;
- if (has_hasechocount()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->hasechocount(), output);
- }
-
- // optional int32 hasVoiceCount = 5;
- if (has_hasvoicecount()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->hasvoicecount(), output);
- }
-
- // optional int32 isSaturatedCount = 6;
- if (has_issaturatedcount()) {
- ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->issaturatedcount(), output);
- }
-
- // optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7;
- if (has_echometrics()) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 7, this->echometrics(), output);
- }
-
-}
-
-int Test::ByteSize() const {
- int total_size = 0;
-
- if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- // optional int32 numReverseChannels = 1;
- if (has_numreversechannels()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->numreversechannels());
- }
-
- // optional int32 numChannels = 2;
- if (has_numchannels()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->numchannels());
- }
-
- // optional int32 sampleRate = 3;
- if (has_samplerate()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->samplerate());
- }
-
- // optional int32 hasEchoCount = 4;
- if (has_hasechocount()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->hasechocount());
- }
-
- // optional int32 hasVoiceCount = 5;
- if (has_hasvoicecount()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->hasvoicecount());
- }
-
- // optional int32 isSaturatedCount = 6;
- if (has_issaturatedcount()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::Int32Size(
- this->issaturatedcount());
- }
-
- // optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7;
- if (has_echometrics()) {
- total_size += 1 +
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->echometrics());
- }
-
- }
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void Test::CheckTypeAndMergeFrom(
- const ::google::protobuf::MessageLite& from) {
- MergeFrom(*::google::protobuf::down_cast<const Test*>(&from));
-}
-
-void Test::MergeFrom(const Test& from) {
- GOOGLE_CHECK_NE(&from, this);
- if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
- if (from.has_numreversechannels()) {
- set_numreversechannels(from.numreversechannels());
- }
- if (from.has_numchannels()) {
- set_numchannels(from.numchannels());
- }
- if (from.has_samplerate()) {
- set_samplerate(from.samplerate());
- }
- if (from.has_hasechocount()) {
- set_hasechocount(from.hasechocount());
- }
- if (from.has_hasvoicecount()) {
- set_hasvoicecount(from.hasvoicecount());
- }
- if (from.has_issaturatedcount()) {
- set_issaturatedcount(from.issaturatedcount());
- }
- if (from.has_echometrics()) {
- mutable_echometrics()->::audio_processing_unittest::Test_EchoMetrics::MergeFrom(from.echometrics());
- }
- }
-}
-
-void Test::CopyFrom(const Test& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool Test::IsInitialized() const {
-
- return true;
-}
-
-void Test::Swap(Test* other) {
- if (other != this) {
- std::swap(numreversechannels_, other->numreversechannels_);
- std::swap(numchannels_, other->numchannels_);
- std::swap(samplerate_, other->samplerate_);
- std::swap(hasechocount_, other->hasechocount_);
- std::swap(hasvoicecount_, other->hasvoicecount_);
- std::swap(issaturatedcount_, other->issaturatedcount_);
- std::swap(echometrics_, other->echometrics_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::std::string Test::GetTypeName() const {
- return "audio_processing_unittest.Test";
-}
-
-
-// ===================================================================
-
-#ifndef _MSC_VER
-const int OutputData::kTestFieldNumber;
-#endif // !_MSC_VER
-
-OutputData::OutputData()
- : ::google::protobuf::MessageLite() {
- SharedCtor();
-}
-
-void OutputData::InitAsDefaultInstance() {
-}
-
-OutputData::OutputData(const OutputData& from)
- : ::google::protobuf::MessageLite() {
- SharedCtor();
- MergeFrom(from);
-}
-
-void OutputData::SharedCtor() {
- _cached_size_ = 0;
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-OutputData::~OutputData() {
- SharedDtor();
-}
-
-void OutputData::SharedDtor() {
- if (this != default_instance_) {
- }
-}
-
-void OutputData::SetCachedSize(int size) const {
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
-}
-const OutputData& OutputData::default_instance() {
- if (default_instance_ == NULL) protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto(); return *default_instance_;
-}
-
-OutputData* OutputData::default_instance_ = NULL;
-
-OutputData* OutputData::New() const {
- return new OutputData;
-}
-
-void OutputData::Clear() {
- test_.Clear();
- ::memset(_has_bits_, 0, sizeof(_has_bits_));
-}
-
-bool OutputData::MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input) {
-#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
- ::google::protobuf::uint32 tag;
- while ((tag = input->ReadTag()) != 0) {
- switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
- // repeated .audio_processing_unittest.Test test = 1;
- case 1: {
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
- parse_test:
- DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
- input, add_test()));
- } else {
- goto handle_uninterpreted;
- }
- if (input->ExpectTag(10)) goto parse_test;
- if (input->ExpectAtEnd()) return true;
- break;
- }
-
- default: {
- handle_uninterpreted:
- if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
- ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
- return true;
- }
- DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag, NULL));
- break;
- }
- }
- }
- return true;
-#undef DO_
-}
-
-void OutputData::SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const {
- // repeated .audio_processing_unittest.Test test = 1;
- for (int i = 0; i < this->test_size(); i++) {
- ::google::protobuf::internal::WireFormatLite::WriteMessage(
- 1, this->test(i), output);
- }
-
-}
-
-int OutputData::ByteSize() const {
- int total_size = 0;
-
- // repeated .audio_processing_unittest.Test test = 1;
- total_size += 1 * this->test_size();
- for (int i = 0; i < this->test_size(); i++) {
- total_size +=
- ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
- this->test(i));
- }
-
- GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
- _cached_size_ = total_size;
- GOOGLE_SAFE_CONCURRENT_WRITES_END();
- return total_size;
-}
-
-void OutputData::CheckTypeAndMergeFrom(
- const ::google::protobuf::MessageLite& from) {
- MergeFrom(*::google::protobuf::down_cast<const OutputData*>(&from));
-}
-
-void OutputData::MergeFrom(const OutputData& from) {
- GOOGLE_CHECK_NE(&from, this);
- test_.MergeFrom(from.test_);
-}
-
-void OutputData::CopyFrom(const OutputData& from) {
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool OutputData::IsInitialized() const {
-
- return true;
-}
-
-void OutputData::Swap(OutputData* other) {
- if (other != this) {
- test_.Swap(&other->test_);
- std::swap(_has_bits_[0], other->_has_bits_[0]);
- std::swap(_cached_size_, other->_cached_size_);
- }
-}
-
-::std::string OutputData::GetTypeName() const {
- return "audio_processing_unittest.OutputData";
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-} // namespace audio_processing_unittest
-
-// @@protoc_insertion_point(global_scope)
diff --git a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.h b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.h
deleted file mode 100644
index 34c21b2f40..0000000000
--- a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.pb.h
+++ /dev/null
@@ -1,862 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: audio_processing_unittest.proto
-
-#ifndef PROTOBUF_audio_5fprocessing_5funittest_2eproto__INCLUDED
-#define PROTOBUF_audio_5fprocessing_5funittest_2eproto__INCLUDED
-
-#include <string>
-
-#include <google/protobuf/stubs/common.h>
-
-#if GOOGLE_PROTOBUF_VERSION < 2004000
-#error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers. Please update
-#error your headers.
-#endif
-#if 2004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
-#error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers. Please
-#error regenerate this file with a newer version of protoc.
-#endif
-
-#include <google/protobuf/generated_message_util.h>
-#include <google/protobuf/repeated_field.h>
-#include <google/protobuf/extension_set.h>
-// @@protoc_insertion_point(includes)
-
-namespace audio_processing_unittest {
-
-// Internal implementation detail -- do not call these.
-void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto();
-void protobuf_AssignDesc_audio_5fprocessing_5funittest_2eproto();
-void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto();
-
-class Test;
-class Test_Statistic;
-class Test_EchoMetrics;
-class OutputData;
-
-// ===================================================================
-
-class Test_Statistic : public ::google::protobuf::MessageLite {
- public:
- Test_Statistic();
- virtual ~Test_Statistic();
-
- Test_Statistic(const Test_Statistic& from);
-
- inline Test_Statistic& operator=(const Test_Statistic& from) {
- CopyFrom(from);
- return *this;
- }
-
- static const Test_Statistic& default_instance();
-
- void Swap(Test_Statistic* other);
-
- // implements Message ----------------------------------------------
-
- Test_Statistic* New() const;
- void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
- void CopyFrom(const Test_Statistic& from);
- void MergeFrom(const Test_Statistic& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- int GetCachedSize() const { return _cached_size_; }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
- public:
-
- ::std::string GetTypeName() const;
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- // optional int32 instant = 1;
- inline bool has_instant() const;
- inline void clear_instant();
- static const int kInstantFieldNumber = 1;
- inline ::google::protobuf::int32 instant() const;
- inline void set_instant(::google::protobuf::int32 value);
-
- // optional int32 average = 2;
- inline bool has_average() const;
- inline void clear_average();
- static const int kAverageFieldNumber = 2;
- inline ::google::protobuf::int32 average() const;
- inline void set_average(::google::protobuf::int32 value);
-
- // optional int32 maximum = 3;
- inline bool has_maximum() const;
- inline void clear_maximum();
- static const int kMaximumFieldNumber = 3;
- inline ::google::protobuf::int32 maximum() const;
- inline void set_maximum(::google::protobuf::int32 value);
-
- // optional int32 minimum = 4;
- inline bool has_minimum() const;
- inline void clear_minimum();
- static const int kMinimumFieldNumber = 4;
- inline ::google::protobuf::int32 minimum() const;
- inline void set_minimum(::google::protobuf::int32 value);
-
- // @@protoc_insertion_point(class_scope:audio_processing_unittest.Test.Statistic)
- private:
- inline void set_has_instant();
- inline void clear_has_instant();
- inline void set_has_average();
- inline void clear_has_average();
- inline void set_has_maximum();
- inline void clear_has_maximum();
- inline void set_has_minimum();
- inline void clear_has_minimum();
-
- ::google::protobuf::int32 instant_;
- ::google::protobuf::int32 average_;
- ::google::protobuf::int32 maximum_;
- ::google::protobuf::int32 minimum_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
-
- friend void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto();
- friend void protobuf_AssignDesc_audio_5fprocessing_5funittest_2eproto();
- friend void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto();
-
- void InitAsDefaultInstance();
- static Test_Statistic* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class Test_EchoMetrics : public ::google::protobuf::MessageLite {
- public:
- Test_EchoMetrics();
- virtual ~Test_EchoMetrics();
-
- Test_EchoMetrics(const Test_EchoMetrics& from);
-
- inline Test_EchoMetrics& operator=(const Test_EchoMetrics& from) {
- CopyFrom(from);
- return *this;
- }
-
- static const Test_EchoMetrics& default_instance();
-
- void Swap(Test_EchoMetrics* other);
-
- // implements Message ----------------------------------------------
-
- Test_EchoMetrics* New() const;
- void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
- void CopyFrom(const Test_EchoMetrics& from);
- void MergeFrom(const Test_EchoMetrics& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- int GetCachedSize() const { return _cached_size_; }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
- public:
-
- ::std::string GetTypeName() const;
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- // optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1;
- inline bool has_residualechoreturnloss() const;
- inline void clear_residualechoreturnloss();
- static const int kResidualEchoReturnLossFieldNumber = 1;
- inline const ::audio_processing_unittest::Test_Statistic& residualechoreturnloss() const;
- inline ::audio_processing_unittest::Test_Statistic* mutable_residualechoreturnloss();
- inline ::audio_processing_unittest::Test_Statistic* release_residualechoreturnloss();
-
- // optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2;
- inline bool has_echoreturnloss() const;
- inline void clear_echoreturnloss();
- static const int kEchoReturnLossFieldNumber = 2;
- inline const ::audio_processing_unittest::Test_Statistic& echoreturnloss() const;
- inline ::audio_processing_unittest::Test_Statistic* mutable_echoreturnloss();
- inline ::audio_processing_unittest::Test_Statistic* release_echoreturnloss();
-
- // optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3;
- inline bool has_echoreturnlossenhancement() const;
- inline void clear_echoreturnlossenhancement();
- static const int kEchoReturnLossEnhancementFieldNumber = 3;
- inline const ::audio_processing_unittest::Test_Statistic& echoreturnlossenhancement() const;
- inline ::audio_processing_unittest::Test_Statistic* mutable_echoreturnlossenhancement();
- inline ::audio_processing_unittest::Test_Statistic* release_echoreturnlossenhancement();
-
- // optional .audio_processing_unittest.Test.Statistic aNlp = 4;
- inline bool has_anlp() const;
- inline void clear_anlp();
- static const int kANlpFieldNumber = 4;
- inline const ::audio_processing_unittest::Test_Statistic& anlp() const;
- inline ::audio_processing_unittest::Test_Statistic* mutable_anlp();
- inline ::audio_processing_unittest::Test_Statistic* release_anlp();
-
- // @@protoc_insertion_point(class_scope:audio_processing_unittest.Test.EchoMetrics)
- private:
- inline void set_has_residualechoreturnloss();
- inline void clear_has_residualechoreturnloss();
- inline void set_has_echoreturnloss();
- inline void clear_has_echoreturnloss();
- inline void set_has_echoreturnlossenhancement();
- inline void clear_has_echoreturnlossenhancement();
- inline void set_has_anlp();
- inline void clear_has_anlp();
-
- ::audio_processing_unittest::Test_Statistic* residualechoreturnloss_;
- ::audio_processing_unittest::Test_Statistic* echoreturnloss_;
- ::audio_processing_unittest::Test_Statistic* echoreturnlossenhancement_;
- ::audio_processing_unittest::Test_Statistic* anlp_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
-
- friend void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto();
- friend void protobuf_AssignDesc_audio_5fprocessing_5funittest_2eproto();
- friend void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto();
-
- void InitAsDefaultInstance();
- static Test_EchoMetrics* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class Test : public ::google::protobuf::MessageLite {
- public:
- Test();
- virtual ~Test();
-
- Test(const Test& from);
-
- inline Test& operator=(const Test& from) {
- CopyFrom(from);
- return *this;
- }
-
- static const Test& default_instance();
-
- void Swap(Test* other);
-
- // implements Message ----------------------------------------------
-
- Test* New() const;
- void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
- void CopyFrom(const Test& from);
- void MergeFrom(const Test& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- int GetCachedSize() const { return _cached_size_; }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
- public:
-
- ::std::string GetTypeName() const;
-
- // nested types ----------------------------------------------------
-
- typedef Test_Statistic Statistic;
- typedef Test_EchoMetrics EchoMetrics;
-
- // accessors -------------------------------------------------------
-
- // optional int32 numReverseChannels = 1;
- inline bool has_numreversechannels() const;
- inline void clear_numreversechannels();
- static const int kNumReverseChannelsFieldNumber = 1;
- inline ::google::protobuf::int32 numreversechannels() const;
- inline void set_numreversechannels(::google::protobuf::int32 value);
-
- // optional int32 numChannels = 2;
- inline bool has_numchannels() const;
- inline void clear_numchannels();
- static const int kNumChannelsFieldNumber = 2;
- inline ::google::protobuf::int32 numchannels() const;
- inline void set_numchannels(::google::protobuf::int32 value);
-
- // optional int32 sampleRate = 3;
- inline bool has_samplerate() const;
- inline void clear_samplerate();
- static const int kSampleRateFieldNumber = 3;
- inline ::google::protobuf::int32 samplerate() const;
- inline void set_samplerate(::google::protobuf::int32 value);
-
- // optional int32 hasEchoCount = 4;
- inline bool has_hasechocount() const;
- inline void clear_hasechocount();
- static const int kHasEchoCountFieldNumber = 4;
- inline ::google::protobuf::int32 hasechocount() const;
- inline void set_hasechocount(::google::protobuf::int32 value);
-
- // optional int32 hasVoiceCount = 5;
- inline bool has_hasvoicecount() const;
- inline void clear_hasvoicecount();
- static const int kHasVoiceCountFieldNumber = 5;
- inline ::google::protobuf::int32 hasvoicecount() const;
- inline void set_hasvoicecount(::google::protobuf::int32 value);
-
- // optional int32 isSaturatedCount = 6;
- inline bool has_issaturatedcount() const;
- inline void clear_issaturatedcount();
- static const int kIsSaturatedCountFieldNumber = 6;
- inline ::google::protobuf::int32 issaturatedcount() const;
- inline void set_issaturatedcount(::google::protobuf::int32 value);
-
- // optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7;
- inline bool has_echometrics() const;
- inline void clear_echometrics();
- static const int kEchoMetricsFieldNumber = 7;
- inline const ::audio_processing_unittest::Test_EchoMetrics& echometrics() const;
- inline ::audio_processing_unittest::Test_EchoMetrics* mutable_echometrics();
- inline ::audio_processing_unittest::Test_EchoMetrics* release_echometrics();
-
- // @@protoc_insertion_point(class_scope:audio_processing_unittest.Test)
- private:
- inline void set_has_numreversechannels();
- inline void clear_has_numreversechannels();
- inline void set_has_numchannels();
- inline void clear_has_numchannels();
- inline void set_has_samplerate();
- inline void clear_has_samplerate();
- inline void set_has_hasechocount();
- inline void clear_has_hasechocount();
- inline void set_has_hasvoicecount();
- inline void clear_has_hasvoicecount();
- inline void set_has_issaturatedcount();
- inline void clear_has_issaturatedcount();
- inline void set_has_echometrics();
- inline void clear_has_echometrics();
-
- ::google::protobuf::int32 numreversechannels_;
- ::google::protobuf::int32 numchannels_;
- ::google::protobuf::int32 samplerate_;
- ::google::protobuf::int32 hasechocount_;
- ::google::protobuf::int32 hasvoicecount_;
- ::google::protobuf::int32 issaturatedcount_;
- ::audio_processing_unittest::Test_EchoMetrics* echometrics_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32];
-
- friend void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto();
- friend void protobuf_AssignDesc_audio_5fprocessing_5funittest_2eproto();
- friend void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto();
-
- void InitAsDefaultInstance();
- static Test* default_instance_;
-};
-// -------------------------------------------------------------------
-
-class OutputData : public ::google::protobuf::MessageLite {
- public:
- OutputData();
- virtual ~OutputData();
-
- OutputData(const OutputData& from);
-
- inline OutputData& operator=(const OutputData& from) {
- CopyFrom(from);
- return *this;
- }
-
- static const OutputData& default_instance();
-
- void Swap(OutputData* other);
-
- // implements Message ----------------------------------------------
-
- OutputData* New() const;
- void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from);
- void CopyFrom(const OutputData& from);
- void MergeFrom(const OutputData& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- int GetCachedSize() const { return _cached_size_; }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
- public:
-
- ::std::string GetTypeName() const;
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- // repeated .audio_processing_unittest.Test test = 1;
- inline int test_size() const;
- inline void clear_test();
- static const int kTestFieldNumber = 1;
- inline const ::audio_processing_unittest::Test& test(int index) const;
- inline ::audio_processing_unittest::Test* mutable_test(int index);
- inline ::audio_processing_unittest::Test* add_test();
- inline const ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test >&
- test() const;
- inline ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test >*
- mutable_test();
-
- // @@protoc_insertion_point(class_scope:audio_processing_unittest.OutputData)
- private:
-
- ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test > test_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
-
- friend void protobuf_AddDesc_audio_5fprocessing_5funittest_2eproto();
- friend void protobuf_AssignDesc_audio_5fprocessing_5funittest_2eproto();
- friend void protobuf_ShutdownFile_audio_5fprocessing_5funittest_2eproto();
-
- void InitAsDefaultInstance();
- static OutputData* default_instance_;
-};
-// ===================================================================
-
-
-// ===================================================================
-
-// Test_Statistic
-
-// optional int32 instant = 1;
-inline bool Test_Statistic::has_instant() const {
- return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void Test_Statistic::set_has_instant() {
- _has_bits_[0] |= 0x00000001u;
-}
-inline void Test_Statistic::clear_has_instant() {
- _has_bits_[0] &= ~0x00000001u;
-}
-inline void Test_Statistic::clear_instant() {
- instant_ = 0;
- clear_has_instant();
-}
-inline ::google::protobuf::int32 Test_Statistic::instant() const {
- return instant_;
-}
-inline void Test_Statistic::set_instant(::google::protobuf::int32 value) {
- set_has_instant();
- instant_ = value;
-}
-
-// optional int32 average = 2;
-inline bool Test_Statistic::has_average() const {
- return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void Test_Statistic::set_has_average() {
- _has_bits_[0] |= 0x00000002u;
-}
-inline void Test_Statistic::clear_has_average() {
- _has_bits_[0] &= ~0x00000002u;
-}
-inline void Test_Statistic::clear_average() {
- average_ = 0;
- clear_has_average();
-}
-inline ::google::protobuf::int32 Test_Statistic::average() const {
- return average_;
-}
-inline void Test_Statistic::set_average(::google::protobuf::int32 value) {
- set_has_average();
- average_ = value;
-}
-
-// optional int32 maximum = 3;
-inline bool Test_Statistic::has_maximum() const {
- return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void Test_Statistic::set_has_maximum() {
- _has_bits_[0] |= 0x00000004u;
-}
-inline void Test_Statistic::clear_has_maximum() {
- _has_bits_[0] &= ~0x00000004u;
-}
-inline void Test_Statistic::clear_maximum() {
- maximum_ = 0;
- clear_has_maximum();
-}
-inline ::google::protobuf::int32 Test_Statistic::maximum() const {
- return maximum_;
-}
-inline void Test_Statistic::set_maximum(::google::protobuf::int32 value) {
- set_has_maximum();
- maximum_ = value;
-}
-
-// optional int32 minimum = 4;
-inline bool Test_Statistic::has_minimum() const {
- return (_has_bits_[0] & 0x00000008u) != 0;
-}
-inline void Test_Statistic::set_has_minimum() {
- _has_bits_[0] |= 0x00000008u;
-}
-inline void Test_Statistic::clear_has_minimum() {
- _has_bits_[0] &= ~0x00000008u;
-}
-inline void Test_Statistic::clear_minimum() {
- minimum_ = 0;
- clear_has_minimum();
-}
-inline ::google::protobuf::int32 Test_Statistic::minimum() const {
- return minimum_;
-}
-inline void Test_Statistic::set_minimum(::google::protobuf::int32 value) {
- set_has_minimum();
- minimum_ = value;
-}
-
-// -------------------------------------------------------------------
-
-// Test_EchoMetrics
-
-// optional .audio_processing_unittest.Test.Statistic residualEchoReturnLoss = 1;
-inline bool Test_EchoMetrics::has_residualechoreturnloss() const {
- return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void Test_EchoMetrics::set_has_residualechoreturnloss() {
- _has_bits_[0] |= 0x00000001u;
-}
-inline void Test_EchoMetrics::clear_has_residualechoreturnloss() {
- _has_bits_[0] &= ~0x00000001u;
-}
-inline void Test_EchoMetrics::clear_residualechoreturnloss() {
- if (residualechoreturnloss_ != NULL) residualechoreturnloss_->::audio_processing_unittest::Test_Statistic::Clear();
- clear_has_residualechoreturnloss();
-}
-inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::residualechoreturnloss() const {
- return residualechoreturnloss_ != NULL ? *residualechoreturnloss_ : *default_instance_->residualechoreturnloss_;
-}
-inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_residualechoreturnloss() {
- set_has_residualechoreturnloss();
- if (residualechoreturnloss_ == NULL) residualechoreturnloss_ = new ::audio_processing_unittest::Test_Statistic;
- return residualechoreturnloss_;
-}
-inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_residualechoreturnloss() {
- clear_has_residualechoreturnloss();
- ::audio_processing_unittest::Test_Statistic* temp = residualechoreturnloss_;
- residualechoreturnloss_ = NULL;
- return temp;
-}
-
-// optional .audio_processing_unittest.Test.Statistic echoReturnLoss = 2;
-inline bool Test_EchoMetrics::has_echoreturnloss() const {
- return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void Test_EchoMetrics::set_has_echoreturnloss() {
- _has_bits_[0] |= 0x00000002u;
-}
-inline void Test_EchoMetrics::clear_has_echoreturnloss() {
- _has_bits_[0] &= ~0x00000002u;
-}
-inline void Test_EchoMetrics::clear_echoreturnloss() {
- if (echoreturnloss_ != NULL) echoreturnloss_->::audio_processing_unittest::Test_Statistic::Clear();
- clear_has_echoreturnloss();
-}
-inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::echoreturnloss() const {
- return echoreturnloss_ != NULL ? *echoreturnloss_ : *default_instance_->echoreturnloss_;
-}
-inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_echoreturnloss() {
- set_has_echoreturnloss();
- if (echoreturnloss_ == NULL) echoreturnloss_ = new ::audio_processing_unittest::Test_Statistic;
- return echoreturnloss_;
-}
-inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_echoreturnloss() {
- clear_has_echoreturnloss();
- ::audio_processing_unittest::Test_Statistic* temp = echoreturnloss_;
- echoreturnloss_ = NULL;
- return temp;
-}
-
-// optional .audio_processing_unittest.Test.Statistic echoReturnLossEnhancement = 3;
-inline bool Test_EchoMetrics::has_echoreturnlossenhancement() const {
- return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void Test_EchoMetrics::set_has_echoreturnlossenhancement() {
- _has_bits_[0] |= 0x00000004u;
-}
-inline void Test_EchoMetrics::clear_has_echoreturnlossenhancement() {
- _has_bits_[0] &= ~0x00000004u;
-}
-inline void Test_EchoMetrics::clear_echoreturnlossenhancement() {
- if (echoreturnlossenhancement_ != NULL) echoreturnlossenhancement_->::audio_processing_unittest::Test_Statistic::Clear();
- clear_has_echoreturnlossenhancement();
-}
-inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::echoreturnlossenhancement() const {
- return echoreturnlossenhancement_ != NULL ? *echoreturnlossenhancement_ : *default_instance_->echoreturnlossenhancement_;
-}
-inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_echoreturnlossenhancement() {
- set_has_echoreturnlossenhancement();
- if (echoreturnlossenhancement_ == NULL) echoreturnlossenhancement_ = new ::audio_processing_unittest::Test_Statistic;
- return echoreturnlossenhancement_;
-}
-inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_echoreturnlossenhancement() {
- clear_has_echoreturnlossenhancement();
- ::audio_processing_unittest::Test_Statistic* temp = echoreturnlossenhancement_;
- echoreturnlossenhancement_ = NULL;
- return temp;
-}
-
-// optional .audio_processing_unittest.Test.Statistic aNlp = 4;
-inline bool Test_EchoMetrics::has_anlp() const {
- return (_has_bits_[0] & 0x00000008u) != 0;
-}
-inline void Test_EchoMetrics::set_has_anlp() {
- _has_bits_[0] |= 0x00000008u;
-}
-inline void Test_EchoMetrics::clear_has_anlp() {
- _has_bits_[0] &= ~0x00000008u;
-}
-inline void Test_EchoMetrics::clear_anlp() {
- if (anlp_ != NULL) anlp_->::audio_processing_unittest::Test_Statistic::Clear();
- clear_has_anlp();
-}
-inline const ::audio_processing_unittest::Test_Statistic& Test_EchoMetrics::anlp() const {
- return anlp_ != NULL ? *anlp_ : *default_instance_->anlp_;
-}
-inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::mutable_anlp() {
- set_has_anlp();
- if (anlp_ == NULL) anlp_ = new ::audio_processing_unittest::Test_Statistic;
- return anlp_;
-}
-inline ::audio_processing_unittest::Test_Statistic* Test_EchoMetrics::release_anlp() {
- clear_has_anlp();
- ::audio_processing_unittest::Test_Statistic* temp = anlp_;
- anlp_ = NULL;
- return temp;
-}
-
-// -------------------------------------------------------------------
-
-// Test
-
-// optional int32 numReverseChannels = 1;
-inline bool Test::has_numreversechannels() const {
- return (_has_bits_[0] & 0x00000001u) != 0;
-}
-inline void Test::set_has_numreversechannels() {
- _has_bits_[0] |= 0x00000001u;
-}
-inline void Test::clear_has_numreversechannels() {
- _has_bits_[0] &= ~0x00000001u;
-}
-inline void Test::clear_numreversechannels() {
- numreversechannels_ = 0;
- clear_has_numreversechannels();
-}
-inline ::google::protobuf::int32 Test::numreversechannels() const {
- return numreversechannels_;
-}
-inline void Test::set_numreversechannels(::google::protobuf::int32 value) {
- set_has_numreversechannels();
- numreversechannels_ = value;
-}
-
-// optional int32 numChannels = 2;
-inline bool Test::has_numchannels() const {
- return (_has_bits_[0] & 0x00000002u) != 0;
-}
-inline void Test::set_has_numchannels() {
- _has_bits_[0] |= 0x00000002u;
-}
-inline void Test::clear_has_numchannels() {
- _has_bits_[0] &= ~0x00000002u;
-}
-inline void Test::clear_numchannels() {
- numchannels_ = 0;
- clear_has_numchannels();
-}
-inline ::google::protobuf::int32 Test::numchannels() const {
- return numchannels_;
-}
-inline void Test::set_numchannels(::google::protobuf::int32 value) {
- set_has_numchannels();
- numchannels_ = value;
-}
-
-// optional int32 sampleRate = 3;
-inline bool Test::has_samplerate() const {
- return (_has_bits_[0] & 0x00000004u) != 0;
-}
-inline void Test::set_has_samplerate() {
- _has_bits_[0] |= 0x00000004u;
-}
-inline void Test::clear_has_samplerate() {
- _has_bits_[0] &= ~0x00000004u;
-}
-inline void Test::clear_samplerate() {
- samplerate_ = 0;
- clear_has_samplerate();
-}
-inline ::google::protobuf::int32 Test::samplerate() const {
- return samplerate_;
-}
-inline void Test::set_samplerate(::google::protobuf::int32 value) {
- set_has_samplerate();
- samplerate_ = value;
-}
-
-// optional int32 hasEchoCount = 4;
-inline bool Test::has_hasechocount() const {
- return (_has_bits_[0] & 0x00000008u) != 0;
-}
-inline void Test::set_has_hasechocount() {
- _has_bits_[0] |= 0x00000008u;
-}
-inline void Test::clear_has_hasechocount() {
- _has_bits_[0] &= ~0x00000008u;
-}
-inline void Test::clear_hasechocount() {
- hasechocount_ = 0;
- clear_has_hasechocount();
-}
-inline ::google::protobuf::int32 Test::hasechocount() const {
- return hasechocount_;
-}
-inline void Test::set_hasechocount(::google::protobuf::int32 value) {
- set_has_hasechocount();
- hasechocount_ = value;
-}
-
-// optional int32 hasVoiceCount = 5;
-inline bool Test::has_hasvoicecount() const {
- return (_has_bits_[0] & 0x00000010u) != 0;
-}
-inline void Test::set_has_hasvoicecount() {
- _has_bits_[0] |= 0x00000010u;
-}
-inline void Test::clear_has_hasvoicecount() {
- _has_bits_[0] &= ~0x00000010u;
-}
-inline void Test::clear_hasvoicecount() {
- hasvoicecount_ = 0;
- clear_has_hasvoicecount();
-}
-inline ::google::protobuf::int32 Test::hasvoicecount() const {
- return hasvoicecount_;
-}
-inline void Test::set_hasvoicecount(::google::protobuf::int32 value) {
- set_has_hasvoicecount();
- hasvoicecount_ = value;
-}
-
-// optional int32 isSaturatedCount = 6;
-inline bool Test::has_issaturatedcount() const {
- return (_has_bits_[0] & 0x00000020u) != 0;
-}
-inline void Test::set_has_issaturatedcount() {
- _has_bits_[0] |= 0x00000020u;
-}
-inline void Test::clear_has_issaturatedcount() {
- _has_bits_[0] &= ~0x00000020u;
-}
-inline void Test::clear_issaturatedcount() {
- issaturatedcount_ = 0;
- clear_has_issaturatedcount();
-}
-inline ::google::protobuf::int32 Test::issaturatedcount() const {
- return issaturatedcount_;
-}
-inline void Test::set_issaturatedcount(::google::protobuf::int32 value) {
- set_has_issaturatedcount();
- issaturatedcount_ = value;
-}
-
-// optional .audio_processing_unittest.Test.EchoMetrics echoMetrics = 7;
-inline bool Test::has_echometrics() const {
- return (_has_bits_[0] & 0x00000040u) != 0;
-}
-inline void Test::set_has_echometrics() {
- _has_bits_[0] |= 0x00000040u;
-}
-inline void Test::clear_has_echometrics() {
- _has_bits_[0] &= ~0x00000040u;
-}
-inline void Test::clear_echometrics() {
- if (echometrics_ != NULL) echometrics_->::audio_processing_unittest::Test_EchoMetrics::Clear();
- clear_has_echometrics();
-}
-inline const ::audio_processing_unittest::Test_EchoMetrics& Test::echometrics() const {
- return echometrics_ != NULL ? *echometrics_ : *default_instance_->echometrics_;
-}
-inline ::audio_processing_unittest::Test_EchoMetrics* Test::mutable_echometrics() {
- set_has_echometrics();
- if (echometrics_ == NULL) echometrics_ = new ::audio_processing_unittest::Test_EchoMetrics;
- return echometrics_;
-}
-inline ::audio_processing_unittest::Test_EchoMetrics* Test::release_echometrics() {
- clear_has_echometrics();
- ::audio_processing_unittest::Test_EchoMetrics* temp = echometrics_;
- echometrics_ = NULL;
- return temp;
-}
-
-// -------------------------------------------------------------------
-
-// OutputData
-
-// repeated .audio_processing_unittest.Test test = 1;
-inline int OutputData::test_size() const {
- return test_.size();
-}
-inline void OutputData::clear_test() {
- test_.Clear();
-}
-inline const ::audio_processing_unittest::Test& OutputData::test(int index) const {
- return test_.Get(index);
-}
-inline ::audio_processing_unittest::Test* OutputData::mutable_test(int index) {
- return test_.Mutable(index);
-}
-inline ::audio_processing_unittest::Test* OutputData::add_test() {
- return test_.Add();
-}
-inline const ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test >&
-OutputData::test() const {
- return test_;
-}
-inline ::google::protobuf::RepeatedPtrField< ::audio_processing_unittest::Test >*
-OutputData::mutable_test() {
- return &test_;
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-} // namespace audio_processing_unittest
-
-// @@protoc_insertion_point(global_scope)
-
-#endif // PROTOBUF_audio_5fprocessing_5funittest_2eproto__INCLUDED
diff --git a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.proto b/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.proto
deleted file mode 100644
index 8520e64f22..0000000000
--- a/src/modules/audio_processing/main/test/unit_test/audio_processing_unittest.proto
+++ /dev/null
@@ -1,33 +0,0 @@
-package audio_processing_unittest;
-option optimize_for = LITE_RUNTIME;
-
-message Test {
- optional int32 numReverseChannels = 1;
- optional int32 numChannels = 2;
- optional int32 sampleRate = 3;
-
- optional int32 hasEchoCount = 4;
- optional int32 hasVoiceCount = 5;
- optional int32 isSaturatedCount = 6;
-
- message Statistic {
- optional int32 instant = 1;
- optional int32 average = 2;
- optional int32 maximum = 3;
- optional int32 minimum = 4;
- }
-
- message EchoMetrics {
- optional Statistic residualEchoReturnLoss = 1;
- optional Statistic echoReturnLoss = 2;
- optional Statistic echoReturnLossEnhancement = 3;
- optional Statistic aNlp = 4;
- }
-
- optional EchoMetrics echoMetrics = 7;
-}
-
-message OutputData {
- repeated Test test = 1;
-}
-
diff --git a/src/modules/audio_processing/main/test/unit_test/unit_test.cc b/src/modules/audio_processing/main/test/unit_test/unit_test.cc
deleted file mode 100644
index 3a6fce5a3f..0000000000
--- a/src/modules/audio_processing/main/test/unit_test/unit_test.cc
+++ /dev/null
@@ -1,881 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include <cstdio>
-
-#include <gtest/gtest.h>
-
-#include "audio_processing.h"
-#include "audio_processing_unittest.pb.h"
-#include "event_wrapper.h"
-#include "module_common_types.h"
-#include "thread_wrapper.h"
-#include "trace.h"
-#include "signal_processing_library.h"
-
-using webrtc::AudioProcessing;
-using webrtc::AudioFrame;
-using webrtc::GainControl;
-using webrtc::NoiseSuppression;
-using webrtc::EchoCancellation;
-using webrtc::EventWrapper;
-using webrtc::Trace;
-using webrtc::LevelEstimator;
-using webrtc::EchoCancellation;
-using webrtc::EchoControlMobile;
-using webrtc::VoiceDetection;
-
-namespace {
-// When true, this will compare the output data with the results stored to
-// file. This is the typical case. When the file should be updated, it can
-// be set to false with the command-line switch --write_output_data.
-bool global_read_output_data = true;
-
-class ApmEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {
- Trace::CreateTrace();
- ASSERT_EQ(0, Trace::SetTraceFile("apm_trace.txt"));
- }
-
- virtual void TearDown() {
- Trace::ReturnTrace();
- }
-};
-
-class ApmTest : public ::testing::Test {
- protected:
- ApmTest();
- virtual void SetUp();
- virtual void TearDown();
-
- webrtc::AudioProcessing* apm_;
- webrtc::AudioFrame* frame_;
- webrtc::AudioFrame* revframe_;
- FILE* far_file_;
- FILE* near_file_;
- bool update_output_data_;
-};
-
-ApmTest::ApmTest()
- : apm_(NULL),
- far_file_(NULL),
- near_file_(NULL),
- frame_(NULL),
- revframe_(NULL) {}
-
-void ApmTest::SetUp() {
- apm_ = AudioProcessing::Create(0);
- ASSERT_TRUE(apm_ != NULL);
-
- frame_ = new AudioFrame();
- revframe_ = new AudioFrame();
-
- ASSERT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(32000));
- ASSERT_EQ(apm_->kNoError, apm_->set_num_channels(2, 2));
- ASSERT_EQ(apm_->kNoError, apm_->set_num_reverse_channels(2));
-
- frame_->_payloadDataLengthInSamples = 320;
- frame_->_audioChannel = 2;
- frame_->_frequencyInHz = 32000;
- revframe_->_payloadDataLengthInSamples = 320;
- revframe_->_audioChannel = 2;
- revframe_->_frequencyInHz = 32000;
-
- far_file_ = fopen("aec_far.pcm", "rb");
- ASSERT_TRUE(far_file_ != NULL) << "Could not open input file aec_far.pcm\n";
- near_file_ = fopen("aec_near.pcm", "rb");
- ASSERT_TRUE(near_file_ != NULL) << "Could not open input file aec_near.pcm\n";
-}
-
-void ApmTest::TearDown() {
- if (frame_) {
- delete frame_;
- }
- frame_ = NULL;
-
- if (revframe_) {
- delete revframe_;
- }
- revframe_ = NULL;
-
- if (far_file_) {
- ASSERT_EQ(0, fclose(far_file_));
- }
- far_file_ = NULL;
-
- if (near_file_) {
- ASSERT_EQ(0, fclose(near_file_));
- }
- near_file_ = NULL;
-
- if (apm_ != NULL) {
- AudioProcessing::Destroy(apm_);
- }
- apm_ = NULL;
-}
-
-void MixStereoToMono(WebRtc_Word16* stereo,
- WebRtc_Word16* mono,
- int numSamples) {
- for (int i = 0; i < numSamples; i++) {
- int int32 = (static_cast<int>(stereo[i * 2]) +
- static_cast<int>(stereo[i * 2 + 1])) >> 1;
- mono[i] = static_cast<WebRtc_Word16>(int32);
- }
-}
-
-void WriteMessageLiteToFile(const char* filename,
- const ::google::protobuf::MessageLite& message) {
- assert(filename != NULL);
-
- FILE* file = fopen(filename, "wb");
- ASSERT_TRUE(file != NULL) << "Could not open " << filename;
- int size = message.ByteSize();
- ASSERT_GT(size, 0);
- unsigned char* array = new unsigned char[size];
- ASSERT_TRUE(message.SerializeToArray(array, size));
-
- ASSERT_EQ(1, fwrite(&size, sizeof(int), 1, file));
- ASSERT_EQ(size, fwrite(array, sizeof(unsigned char), size, file));
-
- delete [] array;
- fclose(file);
-}
-
-void ReadMessageLiteFromFile(const char* filename,
- ::google::protobuf::MessageLite* message) {
- assert(filename != NULL);
- assert(message != NULL);
-
- FILE* file = fopen(filename, "rb");
- ASSERT_TRUE(file != NULL) << "Could not open " << filename;
- int size = 0;
- ASSERT_EQ(1, fread(&size, sizeof(int), 1, file));
- ASSERT_GT(size, 0);
- unsigned char* array = new unsigned char[size];
- ASSERT_EQ(size, fread(array, sizeof(unsigned char), size, file));
-
- ASSERT_TRUE(message->ParseFromArray(array, size));
-
- delete [] array;
- fclose(file);
-}
-
-struct ThreadData {
- ThreadData(int thread_num_, AudioProcessing* ap_)
- : thread_num(thread_num_),
- error(false),
- ap(ap_) {}
- int thread_num;
- bool error;
- AudioProcessing* ap;
-};
-
-// Don't use GTest here; non-thread-safe on Windows (as of 1.5.0).
-bool DeadlockProc(void* thread_object) {
- ThreadData* thread_data = static_cast<ThreadData*>(thread_object);
- AudioProcessing* ap = thread_data->ap;
- int err = ap->kNoError;
-
- AudioFrame primary_frame;
- AudioFrame reverse_frame;
- primary_frame._payloadDataLengthInSamples = 320;
- primary_frame._audioChannel = 2;
- primary_frame._frequencyInHz = 32000;
- reverse_frame._payloadDataLengthInSamples = 320;
- reverse_frame._audioChannel = 2;
- reverse_frame._frequencyInHz = 32000;
-
- ap->echo_cancellation()->Enable(true);
- ap->gain_control()->Enable(true);
- ap->high_pass_filter()->Enable(true);
- ap->level_estimator()->Enable(true);
- ap->noise_suppression()->Enable(true);
- ap->voice_detection()->Enable(true);
-
- if (thread_data->thread_num % 2 == 0) {
- err = ap->AnalyzeReverseStream(&reverse_frame);
- if (err != ap->kNoError) {
- printf("Error in AnalyzeReverseStream(): %d\n", err);
- thread_data->error = true;
- return false;
- }
- }
-
- if (thread_data->thread_num % 2 == 1) {
- ap->set_stream_delay_ms(0);
- ap->echo_cancellation()->set_stream_drift_samples(0);
- ap->gain_control()->set_stream_analog_level(0);
- err = ap->ProcessStream(&primary_frame);
- if (err == ap->kStreamParameterNotSetError) {
- printf("Expected kStreamParameterNotSetError in ProcessStream(): %d\n",
- err);
- } else if (err != ap->kNoError) {
- printf("Error in ProcessStream(): %d\n", err);
- thread_data->error = true;
- return false;
- }
- ap->gain_control()->stream_analog_level();
- }
-
- EventWrapper* event = EventWrapper::Create();
- event->Wait(1);
- delete event;
- event = NULL;
-
- return true;
-}
-
-/*TEST_F(ApmTest, Deadlock) {
- const int num_threads = 16;
- std::vector<ThreadWrapper*> threads(num_threads);
- std::vector<ThreadData*> thread_data(num_threads);
-
- ASSERT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(32000));
- ASSERT_EQ(apm_->kNoError, apm_->set_num_channels(2, 2));
- ASSERT_EQ(apm_->kNoError, apm_->set_num_reverse_channels(2));
-
- for (int i = 0; i < num_threads; i++) {
- thread_data[i] = new ThreadData(i, apm_);
- threads[i] = ThreadWrapper::CreateThread(DeadlockProc,
- thread_data[i],
- kNormalPriority,
- 0);
- ASSERT_TRUE(threads[i] != NULL);
- unsigned int thread_id = 0;
- threads[i]->Start(thread_id);
- }
-
- EventWrapper* event = EventWrapper::Create();
- ASSERT_EQ(kEventTimeout, event->Wait(5000));
- delete event;
- event = NULL;
-
- for (int i = 0; i < num_threads; i++) {
- // This will return false if the thread has deadlocked.
- ASSERT_TRUE(threads[i]->Stop());
- ASSERT_FALSE(thread_data[i]->error);
- delete threads[i];
- threads[i] = NULL;
- delete thread_data[i];
- thread_data[i] = NULL;
- }
-}*/
-
-TEST_F(ApmTest, StreamParameters) {
- // No errors when the components are disabled.
- EXPECT_EQ(apm_->kNoError,
- apm_->ProcessStream(frame_));
-
- // Missing agc level
- EXPECT_EQ(apm_->kNoError, apm_->Initialize());
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true));
- EXPECT_EQ(apm_->kStreamParameterNotSetError,
- apm_->ProcessStream(frame_));
- EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(100));
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->set_stream_drift_samples(0));
- EXPECT_EQ(apm_->kStreamParameterNotSetError,
- apm_->ProcessStream(frame_));
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->Enable(false));
-
- // Missing delay
- EXPECT_EQ(apm_->kNoError, apm_->Initialize());
- EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(true));
- EXPECT_EQ(apm_->kStreamParameterNotSetError,
- apm_->ProcessStream(frame_));
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true));
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->set_stream_drift_samples(0));
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_stream_analog_level(127));
- EXPECT_EQ(apm_->kStreamParameterNotSetError,
- apm_->ProcessStream(frame_));
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->Enable(false));
-
- // Missing drift
- EXPECT_EQ(apm_->kNoError, apm_->Initialize());
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->enable_drift_compensation(true));
- EXPECT_EQ(apm_->kStreamParameterNotSetError,
- apm_->ProcessStream(frame_));
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true));
- EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(100));
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_stream_analog_level(127));
- EXPECT_EQ(apm_->kStreamParameterNotSetError,
- apm_->ProcessStream(frame_));
-
- // No stream parameters
- EXPECT_EQ(apm_->kNoError, apm_->Initialize());
- EXPECT_EQ(apm_->kNoError,
- apm_->AnalyzeReverseStream(revframe_));
- EXPECT_EQ(apm_->kStreamParameterNotSetError,
- apm_->ProcessStream(frame_));
-
- // All there
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true));
- EXPECT_EQ(apm_->kNoError, apm_->Initialize());
- EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(100));
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->set_stream_drift_samples(0));
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_stream_analog_level(127));
- EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
-}
-
-TEST_F(ApmTest, Channels) {
- // Testing number of invalid channels
- EXPECT_EQ(apm_->kBadParameterError, apm_->set_num_channels(0, 1));
- EXPECT_EQ(apm_->kBadParameterError, apm_->set_num_channels(1, 0));
- EXPECT_EQ(apm_->kBadParameterError, apm_->set_num_channels(3, 1));
- EXPECT_EQ(apm_->kBadParameterError, apm_->set_num_channels(1, 3));
- EXPECT_EQ(apm_->kBadParameterError, apm_->set_num_reverse_channels(0));
- EXPECT_EQ(apm_->kBadParameterError, apm_->set_num_reverse_channels(3));
- // Testing number of valid channels
- for (int i = 1; i < 3; i++) {
- for (int j = 1; j < 3; j++) {
- if (j > i) {
- EXPECT_EQ(apm_->kBadParameterError, apm_->set_num_channels(i, j));
- } else {
- EXPECT_EQ(apm_->kNoError, apm_->set_num_channels(i, j));
- EXPECT_EQ(j, apm_->num_output_channels());
- }
- }
- EXPECT_EQ(i, apm_->num_input_channels());
- EXPECT_EQ(apm_->kNoError, apm_->set_num_reverse_channels(i));
- EXPECT_EQ(i, apm_->num_reverse_channels());
- }
-}
-
-TEST_F(ApmTest, SampleRates) {
- // Testing invalid sample rates
- EXPECT_EQ(apm_->kBadParameterError, apm_->set_sample_rate_hz(10000));
- // Testing valid sample rates
- int fs[] = {8000, 16000, 32000};
- for (size_t i = 0; i < sizeof(fs) / sizeof(*fs); i++) {
- EXPECT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(fs[i]));
- EXPECT_EQ(fs[i], apm_->sample_rate_hz());
- }
-}
-
-TEST_F(ApmTest, Process) {
- GOOGLE_PROTOBUF_VERIFY_VERSION;
- audio_processing_unittest::OutputData output_data;
-
- if (global_read_output_data) {
- ReadMessageLiteFromFile("output_data.pb", &output_data);
-
- } else {
- // We don't have a file; add the required tests to the protobuf.
- int rev_ch[] = {1, 2};
- int ch[] = {1, 2};
- int fs[] = {8000, 16000, 32000};
- for (size_t i = 0; i < sizeof(rev_ch) / sizeof(*rev_ch); i++) {
- for (size_t j = 0; j < sizeof(ch) / sizeof(*ch); j++) {
- for (size_t k = 0; k < sizeof(fs) / sizeof(*fs); k++) {
- audio_processing_unittest::Test* test = output_data.add_test();
- test->set_numreversechannels(rev_ch[i]);
- test->set_numchannels(ch[j]);
- test->set_samplerate(fs[k]);
- }
- }
- }
- }
-
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->enable_drift_compensation(true));
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->enable_metrics(true));
- EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(true));
-
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_mode(GainControl::kAdaptiveAnalog));
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_analog_level_limits(0, 255));
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->Enable(true));
-
- EXPECT_EQ(apm_->kNoError,
- apm_->high_pass_filter()->Enable(true));
-
- //EXPECT_EQ(apm_->kNoError,
- // apm_->level_estimator()->Enable(true));
-
- EXPECT_EQ(apm_->kNoError,
- apm_->noise_suppression()->Enable(true));
-
- EXPECT_EQ(apm_->kNoError,
- apm_->voice_detection()->Enable(true));
-
- for (int i = 0; i < output_data.test_size(); i++) {
- printf("Running test %d of %d...\n", i + 1, output_data.test_size());
-
- audio_processing_unittest::Test* test = output_data.mutable_test(i);
- const int num_samples = test->samplerate() / 100;
- revframe_->_payloadDataLengthInSamples = num_samples;
- revframe_->_audioChannel = test->numreversechannels();
- revframe_->_frequencyInHz = test->samplerate();
- frame_->_payloadDataLengthInSamples = num_samples;
- frame_->_audioChannel = test->numchannels();
- frame_->_frequencyInHz = test->samplerate();
-
- EXPECT_EQ(apm_->kNoError, apm_->Initialize());
- ASSERT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(test->samplerate()));
- ASSERT_EQ(apm_->kNoError, apm_->set_num_channels(frame_->_audioChannel,
- frame_->_audioChannel));
- ASSERT_EQ(apm_->kNoError,
- apm_->set_num_reverse_channels(revframe_->_audioChannel));
-
-
- int has_echo_count = 0;
- int has_voice_count = 0;
- int is_saturated_count = 0;
-
- while (1) {
- WebRtc_Word16 temp_data[640];
- int analog_level = 127;
-
- // Read far-end frame
- size_t read_count = fread(temp_data,
- sizeof(WebRtc_Word16),
- num_samples * 2,
- far_file_);
- if (read_count != static_cast<size_t>(num_samples * 2)) {
- // Check that the file really ended.
- ASSERT_NE(0, feof(far_file_));
- break; // This is expected.
- }
-
- if (revframe_->_audioChannel == 1) {
- MixStereoToMono(temp_data, revframe_->_payloadData,
- revframe_->_payloadDataLengthInSamples);
- } else {
- memcpy(revframe_->_payloadData,
- &temp_data[0],
- sizeof(WebRtc_Word16) * read_count);
- }
-
- EXPECT_EQ(apm_->kNoError,
- apm_->AnalyzeReverseStream(revframe_));
-
- EXPECT_EQ(apm_->kNoError, apm_->set_stream_delay_ms(0));
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->set_stream_drift_samples(0));
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_stream_analog_level(analog_level));
-
- // Read near-end frame
- read_count = fread(temp_data,
- sizeof(WebRtc_Word16),
- num_samples * 2,
- near_file_);
- if (read_count != static_cast<size_t>(num_samples * 2)) {
- // Check that the file really ended.
- ASSERT_NE(0, feof(near_file_));
- break; // This is expected.
- }
-
- if (frame_->_audioChannel == 1) {
- MixStereoToMono(temp_data, frame_->_payloadData, num_samples);
- } else {
- memcpy(frame_->_payloadData,
- &temp_data[0],
- sizeof(WebRtc_Word16) * read_count);
- }
-
- EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_));
-
- if (apm_->echo_cancellation()->stream_has_echo()) {
- has_echo_count++;
- }
-
- analog_level = apm_->gain_control()->stream_analog_level();
- if (apm_->gain_control()->stream_is_saturated()) {
- is_saturated_count++;
- }
- if (apm_->voice_detection()->stream_has_voice()) {
- has_voice_count++;
- }
- }
-
- //<-- Statistics -->
- //LevelEstimator::Metrics far_metrics;
- //LevelEstimator::Metrics near_metrics;
- //EchoCancellation::Metrics echo_metrics;
- //LevelEstimator::Metrics far_metrics_ref_;
- //LevelEstimator::Metrics near_metrics_ref_;
- //EchoCancellation::Metrics echo_metrics_ref_;
- //EXPECT_EQ(apm_->kNoError,
- // apm_->echo_cancellation()->GetMetrics(&echo_metrics));
- //EXPECT_EQ(apm_->kNoError,
- // apm_->level_estimator()->GetMetrics(&near_metrics,
-
- // TODO(ajm): check echo metrics and output audio.
- if (global_read_output_data) {
- EXPECT_EQ(has_echo_count,
- test->hasechocount());
- EXPECT_EQ(has_voice_count,
- test->hasvoicecount());
- EXPECT_EQ(is_saturated_count,
- test->issaturatedcount());
- } else {
- test->set_hasechocount(has_echo_count);
- test->set_hasvoicecount(has_voice_count);
- test->set_issaturatedcount(is_saturated_count);
- }
-
- rewind(far_file_);
- rewind(near_file_);
- }
-
- if (!global_read_output_data) {
- WriteMessageLiteToFile("output_data.pb", output_data);
- }
-
- google::protobuf::ShutdownProtobufLibrary();
-}
-
-TEST_F(ApmTest, EchoCancellation) {
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->enable_drift_compensation(true));
- EXPECT_TRUE(apm_->echo_cancellation()->is_drift_compensation_enabled());
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->enable_drift_compensation(false));
- EXPECT_FALSE(apm_->echo_cancellation()->is_drift_compensation_enabled());
-
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->echo_cancellation()->set_device_sample_rate_hz(4000));
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->echo_cancellation()->set_device_sample_rate_hz(100000));
-
- int rate[] = {16000, 44100, 48000};
- for (size_t i = 0; i < sizeof(rate)/sizeof(*rate); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->set_device_sample_rate_hz(rate[i]));
- EXPECT_EQ(rate[i],
- apm_->echo_cancellation()->device_sample_rate_hz());
- }
-
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->echo_cancellation()->set_suppression_level(
- static_cast<EchoCancellation::SuppressionLevel>(-1)));
-
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->echo_cancellation()->set_suppression_level(
- static_cast<EchoCancellation::SuppressionLevel>(4)));
-
- EchoCancellation::SuppressionLevel level[] = {
- EchoCancellation::kLowSuppression,
- EchoCancellation::kModerateSuppression,
- EchoCancellation::kHighSuppression,
- };
- for (size_t i = 0; i < sizeof(level)/sizeof(*level); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->set_suppression_level(level[i]));
- EXPECT_EQ(level[i],
- apm_->echo_cancellation()->suppression_level());
- }
-
- EchoCancellation::Metrics metrics;
- EXPECT_EQ(apm_->kNotEnabledError,
- apm_->echo_cancellation()->GetMetrics(&metrics));
-
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->enable_metrics(true));
- EXPECT_TRUE(apm_->echo_cancellation()->are_metrics_enabled());
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_cancellation()->enable_metrics(false));
- EXPECT_FALSE(apm_->echo_cancellation()->are_metrics_enabled());
-
- EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(true));
- EXPECT_TRUE(apm_->echo_cancellation()->is_enabled());
- EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(false));
- EXPECT_FALSE(apm_->echo_cancellation()->is_enabled());
-}
-
-TEST_F(ApmTest, EchoControlMobile) {
- // AECM won't use super-wideband.
- EXPECT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(32000));
- EXPECT_EQ(apm_->kBadSampleRateError, apm_->echo_control_mobile()->Enable(true));
- EXPECT_EQ(apm_->kNoError, apm_->set_sample_rate_hz(16000));
- // Turn AECM on (and AEC off)
- EXPECT_EQ(apm_->kNoError, apm_->echo_control_mobile()->Enable(true));
- EXPECT_TRUE(apm_->echo_control_mobile()->is_enabled());
-
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->echo_control_mobile()->set_routing_mode(
- static_cast<EchoControlMobile::RoutingMode>(-1)));
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->echo_control_mobile()->set_routing_mode(
- static_cast<EchoControlMobile::RoutingMode>(5)));
-
- // Toggle routing modes
- EchoControlMobile::RoutingMode mode[] = {
- EchoControlMobile::kQuietEarpieceOrHeadset,
- EchoControlMobile::kEarpiece,
- EchoControlMobile::kLoudEarpiece,
- EchoControlMobile::kSpeakerphone,
- EchoControlMobile::kLoudSpeakerphone,
- };
- for (size_t i = 0; i < sizeof(mode)/sizeof(*mode); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_control_mobile()->set_routing_mode(mode[i]));
- EXPECT_EQ(mode[i],
- apm_->echo_control_mobile()->routing_mode());
- }
- // Turn comfort noise off/on
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_control_mobile()->enable_comfort_noise(false));
- EXPECT_FALSE(apm_->echo_control_mobile()->is_comfort_noise_enabled());
- EXPECT_EQ(apm_->kNoError,
- apm_->echo_control_mobile()->enable_comfort_noise(true));
- EXPECT_TRUE(apm_->echo_control_mobile()->is_comfort_noise_enabled());
- // Turn AECM off
- EXPECT_EQ(apm_->kNoError, apm_->echo_control_mobile()->Enable(false));
- EXPECT_FALSE(apm_->echo_control_mobile()->is_enabled());
-}
-
-TEST_F(ApmTest, GainControl) {
- // Testing gain modes
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_mode(static_cast<GainControl::Mode>(-1)));
-
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_mode(static_cast<GainControl::Mode>(3)));
-
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_mode(
- apm_->gain_control()->mode()));
-
- GainControl::Mode mode[] = {
- GainControl::kAdaptiveAnalog,
- GainControl::kAdaptiveDigital,
- GainControl::kFixedDigital
- };
- for (size_t i = 0; i < sizeof(mode)/sizeof(*mode); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_mode(mode[i]));
- EXPECT_EQ(mode[i], apm_->gain_control()->mode());
- }
- // Testing invalid target levels
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_target_level_dbfs(-3));
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_target_level_dbfs(-40));
- // Testing valid target levels
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_target_level_dbfs(
- apm_->gain_control()->target_level_dbfs()));
-
- int level_dbfs[] = {0, 6, 31};
- for (size_t i = 0; i < sizeof(level_dbfs)/sizeof(*level_dbfs); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_target_level_dbfs(level_dbfs[i]));
- EXPECT_EQ(level_dbfs[i], apm_->gain_control()->target_level_dbfs());
- }
-
- // Testing invalid compression gains
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_compression_gain_db(-1));
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_compression_gain_db(100));
-
- // Testing valid compression gains
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_compression_gain_db(
- apm_->gain_control()->compression_gain_db()));
-
- int gain_db[] = {0, 10, 90};
- for (size_t i = 0; i < sizeof(gain_db)/sizeof(*gain_db); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_compression_gain_db(gain_db[i]));
- EXPECT_EQ(gain_db[i], apm_->gain_control()->compression_gain_db());
- }
-
- // Testing limiter off/on
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->enable_limiter(false));
- EXPECT_FALSE(apm_->gain_control()->is_limiter_enabled());
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->enable_limiter(true));
- EXPECT_TRUE(apm_->gain_control()->is_limiter_enabled());
-
- // Testing invalid level limits
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_analog_level_limits(-1, 512));
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_analog_level_limits(100000, 512));
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_analog_level_limits(512, -1));
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_analog_level_limits(512, 100000));
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->gain_control()->set_analog_level_limits(512, 255));
-
- // Testing valid level limits
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_analog_level_limits(
- apm_->gain_control()->analog_level_minimum(),
- apm_->gain_control()->analog_level_maximum()));
-
- int min_level[] = {0, 255, 1024};
- for (size_t i = 0; i < sizeof(min_level)/sizeof(*min_level); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_analog_level_limits(min_level[i], 1024));
- EXPECT_EQ(min_level[i], apm_->gain_control()->analog_level_minimum());
- }
-
- int max_level[] = {0, 1024, 65535};
- for (size_t i = 0; i < sizeof(min_level)/sizeof(*min_level); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->gain_control()->set_analog_level_limits(0, max_level[i]));
- EXPECT_EQ(max_level[i], apm_->gain_control()->analog_level_maximum());
- }
-
- // TODO(ajm): stream_is_saturated() and stream_analog_level()
-
- // Turn AGC off
- EXPECT_EQ(apm_->kNoError, apm_->gain_control()->Enable(false));
- EXPECT_FALSE(apm_->gain_control()->is_enabled());
-}
-
-TEST_F(ApmTest, NoiseSuppression) {
- // Tesing invalid suppression levels
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->noise_suppression()->set_level(
- static_cast<NoiseSuppression::Level>(-1)));
-
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->noise_suppression()->set_level(
- static_cast<NoiseSuppression::Level>(5)));
-
- // Tesing valid suppression levels
- NoiseSuppression::Level level[] = {
- NoiseSuppression::kLow,
- NoiseSuppression::kModerate,
- NoiseSuppression::kHigh,
- NoiseSuppression::kVeryHigh
- };
- for (size_t i = 0; i < sizeof(level)/sizeof(*level); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->noise_suppression()->set_level(level[i]));
- EXPECT_EQ(level[i], apm_->noise_suppression()->level());
- }
-
- // Turing NS on/off
- EXPECT_EQ(apm_->kNoError, apm_->noise_suppression()->Enable(true));
- EXPECT_TRUE(apm_->noise_suppression()->is_enabled());
- EXPECT_EQ(apm_->kNoError, apm_->noise_suppression()->Enable(false));
- EXPECT_FALSE(apm_->noise_suppression()->is_enabled());
-}
-
-TEST_F(ApmTest, HighPassFilter) {
- // Turing HP filter on/off
- EXPECT_EQ(apm_->kNoError, apm_->high_pass_filter()->Enable(true));
- EXPECT_TRUE(apm_->high_pass_filter()->is_enabled());
- EXPECT_EQ(apm_->kNoError, apm_->high_pass_filter()->Enable(false));
- EXPECT_FALSE(apm_->high_pass_filter()->is_enabled());
-}
-
-TEST_F(ApmTest, LevelEstimator) {
- // Turing Level estimator on/off
- EXPECT_EQ(apm_->kUnsupportedComponentError,
- apm_->level_estimator()->Enable(true));
- EXPECT_FALSE(apm_->level_estimator()->is_enabled());
- EXPECT_EQ(apm_->kUnsupportedComponentError,
- apm_->level_estimator()->Enable(false));
- EXPECT_FALSE(apm_->level_estimator()->is_enabled());
-}
-
-TEST_F(ApmTest, VoiceDetection) {
- // Test external VAD
- EXPECT_EQ(apm_->kNoError,
- apm_->voice_detection()->set_stream_has_voice(true));
- EXPECT_TRUE(apm_->voice_detection()->stream_has_voice());
- EXPECT_EQ(apm_->kNoError,
- apm_->voice_detection()->set_stream_has_voice(false));
- EXPECT_FALSE(apm_->voice_detection()->stream_has_voice());
-
- // Tesing invalid likelihoods
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->voice_detection()->set_likelihood(
- static_cast<VoiceDetection::Likelihood>(-1)));
-
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->voice_detection()->set_likelihood(
- static_cast<VoiceDetection::Likelihood>(5)));
-
- // Tesing valid likelihoods
- VoiceDetection::Likelihood likelihood[] = {
- VoiceDetection::kVeryLowLikelihood,
- VoiceDetection::kLowLikelihood,
- VoiceDetection::kModerateLikelihood,
- VoiceDetection::kHighLikelihood
- };
- for (size_t i = 0; i < sizeof(likelihood)/sizeof(*likelihood); i++) {
- EXPECT_EQ(apm_->kNoError,
- apm_->voice_detection()->set_likelihood(likelihood[i]));
- EXPECT_EQ(likelihood[i], apm_->voice_detection()->likelihood());
- }
-
- /* TODO(bjornv): Enable once VAD supports other frame lengths than 10 ms
- // Tesing invalid frame sizes
- EXPECT_EQ(apm_->kBadParameterError,
- apm_->voice_detection()->set_frame_size_ms(12));
-
- // Tesing valid frame sizes
- for (int i = 10; i <= 30; i += 10) {
- EXPECT_EQ(apm_->kNoError,
- apm_->voice_detection()->set_frame_size_ms(i));
- EXPECT_EQ(i, apm_->voice_detection()->frame_size_ms());
- }
- */
-
- // Turing VAD on/off
- EXPECT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(true));
- EXPECT_TRUE(apm_->voice_detection()->is_enabled());
- EXPECT_EQ(apm_->kNoError, apm_->voice_detection()->Enable(false));
- EXPECT_FALSE(apm_->voice_detection()->is_enabled());
-
- // TODO(bjornv): Add tests for streamed voice; stream_has_voice()
-}
-
-// Below are some ideas for tests from VPM.
-
-/*TEST_F(VideoProcessingModuleTest, GetVersionTest)
-{
-}
-
-TEST_F(VideoProcessingModuleTest, HandleNullBuffer)
-{
-}
-
-TEST_F(VideoProcessingModuleTest, HandleBadSize)
-{
-}
-
-TEST_F(VideoProcessingModuleTest, IdenticalResultsAfterReset)
-{
-}
-*/
-} // namespace
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ApmEnvironment* env = new ApmEnvironment; // GTest takes ownership.
- ::testing::AddGlobalTestEnvironment(env);
-
- for (int i = 1; i < argc; i++) {
- if (strcmp(argv[i], "--write_output_data") == 0) {
- global_read_output_data = false;
- }
- }
-
- return RUN_ALL_TESTS();
-}