Merge "Revert "Floss: Add new Suspend Topshim test""
diff --git a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
index 2c71f6d..a987758 100644
--- a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -88,6 +88,9 @@
// Protect setActiveDevice() so all invoked is handled squentially
private final Object mActiveSwitchingGuard = new Object();
+ // Timeout for state machine thread join, to prevent potential ANR.
+ private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;
+
// Upper limit of all A2DP devices: Bonded or Connected
private static final int MAX_A2DP_STATE_MACHINES = 50;
// Upper limit of all A2DP devices that are Connected or Connecting
@@ -218,7 +221,7 @@
if (mStateMachinesThread != null) {
try {
mStateMachinesThread.quitSafely();
- mStateMachinesThread.join();
+ mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
mStateMachinesThread = null;
} catch (InterruptedException e) {
// Do not rethrow as we are shutting down anyway
diff --git a/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java b/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java
index d66dbc0..b127534 100644
--- a/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java
+++ b/android/app/src/com/android/bluetooth/csip/CsipSetCoordinatorService.java
@@ -67,6 +67,9 @@
private static final boolean DBG = false;
private static final String TAG = "CsipSetCoordinatorService";
+ // Timeout for state machine thread join, to prevent potential ANR.
+ private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;
+
// Upper limit of all CSIP devices: Bonded or Connected
private static final int MAX_CSIS_STATE_MACHINES = 10;
private static CsipSetCoordinatorService sCsipSetCoordinatorService;
@@ -184,7 +187,7 @@
if (mStateMachinesThread != null) {
try {
mStateMachinesThread.quitSafely();
- mStateMachinesThread.join();
+ mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
mStateMachinesThread = null;
} catch (InterruptedException e) {
// Do not rethrow as we are shutting down anyway
diff --git a/android/app/src/com/android/bluetooth/gatt/GattService.java b/android/app/src/com/android/bluetooth/gatt/GattService.java
index d08de03..1c9c6d4 100644
--- a/android/app/src/com/android/bluetooth/gatt/GattService.java
+++ b/android/app/src/com/android/bluetooth/gatt/GattService.java
@@ -3444,7 +3444,7 @@
return new ArrayList<>(0);
}
List<ParcelUuid> serviceUuids = new ArrayList<ParcelUuid>();
- for (HandleMap.Entry entry : mHandleMap.mEntries) {
+ for (HandleMap.Entry entry : mHandleMap.getEntries()) {
serviceUuids.add(new ParcelUuid(entry.uuid));
}
return serviceUuids;
diff --git a/android/app/src/com/android/bluetooth/gatt/HandleMap.java b/android/app/src/com/android/bluetooth/gatt/HandleMap.java
index 2b662d6..2d8d936 100644
--- a/android/app/src/com/android/bluetooth/gatt/HandleMap.java
+++ b/android/app/src/com/android/bluetooth/gatt/HandleMap.java
@@ -17,12 +17,11 @@
import android.util.Log;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
class HandleMap {
private static final boolean DBG = GattServiceConfig.DBG;
@@ -88,8 +87,8 @@
int mLastCharacteristic = 0;
HandleMap() {
- mEntries = new ArrayList<Entry>();
- mRequestMap = new HashMap<Integer, Integer>();
+ mEntries = new CopyOnWriteArrayList<Entry>();
+ mRequestMap = new ConcurrentHashMap<Integer, Integer>();
}
void clear() {
@@ -144,16 +143,8 @@
}
void deleteService(int serverIf, int serviceHandle) {
- for (Iterator<Entry> it = mEntries.iterator(); it.hasNext(); ) {
- Entry entry = it.next();
- if (entry.serverIf != serverIf) {
- continue;
- }
-
- if (entry.handle == serviceHandle || entry.serviceHandle == serviceHandle) {
- it.remove();
- }
- }
+ mEntries.removeIf(entry -> ((entry.serverIf == serverIf)
+ && (entry.handle == serviceHandle || entry.serviceHandle == serviceHandle)));
}
List<Entry> getEntries() {
diff --git a/android/app/src/com/android/bluetooth/hearingaid/HearingAidService.java b/android/app/src/com/android/bluetooth/hearingaid/HearingAidService.java
index d234db1..8d4b6d3 100644
--- a/android/app/src/com/android/bluetooth/hearingaid/HearingAidService.java
+++ b/android/app/src/com/android/bluetooth/hearingaid/HearingAidService.java
@@ -61,6 +61,9 @@
private static final boolean DBG = true;
private static final String TAG = "HearingAidService";
+ // Timeout for state machine thread join, to prevent potential ANR.
+ private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;
+
// Upper limit of all HearingAid devices: Bonded or Connected
private static final int MAX_HEARING_AID_STATE_MACHINES = 10;
private static HearingAidService sHearingAidService;
@@ -191,7 +194,7 @@
if (mStateMachinesThread != null) {
try {
mStateMachinesThread.quitSafely();
- mStateMachinesThread.join();
+ mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
mStateMachinesThread = null;
} catch (InterruptedException e) {
// Do not rethrow as we are shutting down anyway
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetService.java b/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
index 361e247..fa96e7e 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetService.java
@@ -99,6 +99,9 @@
{BluetoothProfile.STATE_CONNECTING, BluetoothProfile.STATE_CONNECTED};
private static final int DIALING_OUT_TIMEOUT_MS = 10000;
+ // Timeout for state machine thread join, to prevent potential ANR.
+ private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;
+
private int mMaxHeadsetConnections = 1;
private BluetoothDevice mActiveDevice;
private AdapterService mAdapterService;
@@ -238,7 +241,7 @@
// Step 2: Stop handler thread
try {
mStateMachinesThread.quitSafely();
- mStateMachinesThread.join();
+ mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
mStateMachinesThread = null;
} catch (InterruptedException e) {
// Do not rethrow as we are shutting down anyway
diff --git a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
index e6d06e2..d39e317 100644
--- a/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
+++ b/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java
@@ -66,6 +66,9 @@
private static final boolean DBG = true;
private static final String TAG = "LeAudioService";
+ // Timeout for state machine thread join, to prevent potential ANR.
+ private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;
+
// Upper limit of all LeAudio devices: Bonded or Connected
private static final int MAX_LE_AUDIO_STATE_MACHINES = 10;
private static LeAudioService sLeAudioService;
@@ -262,7 +265,7 @@
if (mStateMachinesThread != null) {
try {
mStateMachinesThread.quitSafely();
- mStateMachinesThread.join();
+ mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
mStateMachinesThread = null;
} catch (InterruptedException e) {
// Do not rethrow as we are shutting down anyway
diff --git a/android/app/src/com/android/bluetooth/sap/SapServer.java b/android/app/src/com/android/bluetooth/sap/SapServer.java
index c838fa3..2514863 100644
--- a/android/app/src/com/android/bluetooth/sap/SapServer.java
+++ b/android/app/src/com/android/bluetooth/sap/SapServer.java
@@ -93,6 +93,9 @@
private PendingIntent mPendingDiscIntent = null;
// Holds a reference to disconnect timeout intents
+ /* Timeout for the message handler thread join, to prevent potential ANR. */
+ private static final int HANDLER_THREAD_JOIN_TIMEOUT_MS = 1000;
+
/* We store the mMaxMessageSize, as we need a copy of it when the init. sequence completes */
private int mMaxMsgSize = 0;
/* keep track of the current RIL test mode */
@@ -498,7 +501,7 @@
if (mHandlerThread != null) {
try {
mHandlerThread.quitSafely();
- mHandlerThread.join();
+ mHandlerThread.join(HANDLER_THREAD_JOIN_TIMEOUT_MS);
mHandlerThread = null;
} catch (InterruptedException e) {
}
diff --git a/android/app/src/com/android/bluetooth/vc/VolumeControlService.java b/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
index 732679a..7bce4c1 100644
--- a/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
+++ b/android/app/src/com/android/bluetooth/vc/VolumeControlService.java
@@ -56,6 +56,9 @@
private static final boolean DBG = false;
private static final String TAG = "VolumeControlService";
+ // Timeout for state machine thread join, to prevent potential ANR.
+ private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;
+
// Upper limit of all VolumeControl devices: Bonded or Connected
private static final int MAX_VC_STATE_MACHINES = 10;
private static final int LE_AUDIO_MAX_VOL = 255;
@@ -181,7 +184,7 @@
if (mStateMachinesThread != null) {
try {
mStateMachinesThread.quitSafely();
- mStateMachinesThread.join();
+ mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
mStateMachinesThread = null;
} catch (InterruptedException e) {
// Do not rethrow as we are shutting down anyway
diff --git a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java
index 2530fac..1a78d7c 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java
@@ -122,7 +122,7 @@
}
mA2dpStateMachine.doQuit();
mHandlerThread.quit();
- mHandlerThread.join();
+ mHandlerThread.join(TIMEOUT_MS);
TestUtils.clearAdapterService(mAdapterService);
}
diff --git a/android/blueberry/OWNERS b/android/blueberry/OWNERS
new file mode 100644
index 0000000..610b346
--- /dev/null
+++ b/android/blueberry/OWNERS
@@ -0,0 +1,5 @@
+# Project owners
+girardier@google.com
+licorne@google.com
+uael@google.com
+charliebout@google.com
diff --git a/android/blueberry/server/Android.bp b/android/blueberry/server/Android.bp
new file mode 100644
index 0000000..705ffa6
--- /dev/null
+++ b/android/blueberry/server/Android.bp
@@ -0,0 +1,25 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_test {
+ name: "BlueberryServer",
+ srcs: ["src/**/*.kt"],
+ certificate: "platform",
+
+ static_libs: [
+ "androidx.test.runner",
+ "androidx.test.core",
+ "grpc-java-netty-shaded-test",
+ "grpc-java-lite",
+ "guava",
+ "opencensus-java-api",
+ ],
+
+ dex_preopt: {
+ enabled: false,
+ },
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/android/blueberry/server/AndroidManifest.xml b/android/blueberry/server/AndroidManifest.xml
new file mode 100644
index 0000000..16a47bf
--- /dev/null
+++ b/android/blueberry/server/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.blueberry">
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <uses-permission android:name="android.permission.INTERNET" />
+
+ <instrumentation android:name="com.android.blueberry.Server"
+ android:targetPackage="com.android.blueberry"
+ android:label="Blueberry Android Server" />
+</manifest>
diff --git a/android/blueberry/server/README.md b/android/blueberry/server/README.md
new file mode 100644
index 0000000..ebeea94
--- /dev/null
+++ b/android/blueberry/server/README.md
@@ -0,0 +1,117 @@
+# Blueberry Android server
+
+The Blueberry Android server exposes the [Blueberry test interfaces](
+go/blueberry-doc) over gRPC implemented on top of the Android Bluetooth SDK.
+
+## Getting started
+
+Using Blueberry Android server requires to:
+
+* Build AOSP for your DUT, which can be either a physical device or an Android
+ Virtual Device (AVD).
+* [Only for virtual tests] Build Rootcanal, the Android
+ virtual Bluetooth Controller.
+* Setup your test environment.
+* Build, install, and run Blueberry server.
+* Run your tests.
+
+### 1. Build and run AOSP code
+
+Refer to the AOSP documentation to [initialize and sync](
+https://g3doc.corp.google.com/company/teams/android/developing/init-sync.md)
+AOSP code, and [build](
+https://g3doc.corp.google.com/company/teams/android/developing/build-flash.md)
+it for your DUT (`aosp_cf_x86_64_phone-userdebug` for the emulator).
+
+**If your DUT is a physical device**, flash the built image on it. You may
+need to use [Remote Device Proxy](
+https://g3doc.corp.google.com/company/teams/android/wfh/adb/remote_device_proxy.md)
+if you are using a remote instance to build. If you are also using `adb` on
+your local machine, you may need to force kill the local `adb` server (`adb
+kill-server` before using Remote Device Proxy.
+
+**If your DUT is a Cuttlefish virtual device**, then proceed with the following steps:
+
+* Connect to your [Chrome Remote Desktop](
+ https://remotedesktop.corp.google.com/access/).
+* Create a local Cuttlefish instance using your locally built image with the command
+ `acloud create --local-instance --local-image` (see [documentation](
+ go/acloud-manual#local-instance-using-a-locally-built-image))
+
+### 2. Build Rootcanal [only for virtual tests on a physical device]
+
+Rootcanal is a virtual Bluetooth Controller that allows emulating Bluetooth
+communications. It is used by default within Cuttlefish when running it using the [acloud](go/acloud) command (and thus this step is not
+needed) and is required for all virtual tests. However, it does not come
+preinstalled on a build for a physical device.
+
+Proceed with the [following instructions](
+https://docs.google.com/document/d/1-qoK1HtdOKK6sTIKAToFf7nu9ybxs8FQWU09idZijyc/edit#heading=h.x9snb54sjlu9)
+to build and install Rootcanal on your DUT.
+
+### 3. Setup your test environment
+
+Each time when starting a new ADB server to communicate with your DUT, proceed
+with the following steps to setup the test environment:
+
+* If running virtual tests (such as PTS-bot) on a physical device:
+ * Run Rootcanal:
+ `adb root` then
+ `adb shell ./vendor/bin/hw/android.hardware.bluetooth@1.1-service.sim &`
+ * Forward Rootcanal port through ADB:
+ `adb forward tcp:<rootcanal-port> tcp:<rootcanal-port>`.
+ Rootcanal port number may differ depending on its configuration. It is
+ 7200 for the AVD, and generally 6211 for physical devices.
+* Forward Blueberry Android server port through ADB:
+ `adb forward tcp:8999 tcp:8999`.
+
+The above steps can be done by executing the `setup.sh` helper script (the
+`-rootcanal` option must be used for virtual tests on a physical device).
+
+Finally, you must also make sure that the machine on which tests are executed
+can access the ports of the Blueberry Android server, Rootcanal (if required),
+and ADB (if required).
+
+You can also check the usage examples provided below.
+
+### 4. Build, install, and run Blueberry Android server
+
+* `m BlueberryServer`
+* `adb install -r -g out/target/product/<device>/testcases/Blueberry/arm64/Blueberry.apk`
+
+* Start the instrumented app:
+* `adb shell am instrument -w -e Debug false com.android.blueberry/.Server`
+
+### 5. Run your tests
+
+You should now be fully set up to run your tests!
+
+### Usage examples
+
+Here are some usage examples:
+
+* **DUT**: physical
+ **Test type**: virtual
+ **Test executer**: remote instance (for instance a Cloudtop) accessed via SSH
+ **Blueberry Android server repository location**: local machine (typically
+ using Android Studio)
+
+ * On your local machine: `./setup.sh --rootcanal`.
+ * On your local machine: build and install the app on your DUT.
+ * Log on your remote instance, and forward Rootcanal port (6211, may change
+ depending on your build) and Blueberry Android server (8999) port:
+ `ssh -R 6211:localhost:6211 -R 8999:localhost:8999 <remote-instance>`.
+ Optionnally, you can also share ADB port to your remote instance (if
+ needed) by adding `-R 5037:localhost:5037` to the command.
+ * On your remote instance: execute your tests.
+
+* **DUT**: virtual (running in remote instance)
+ **Test type**: virtual
+ **Test executer**: remote instance
+ **Blueberry Android server repository location**: remote instance
+
+ On your remote instance:
+ * `./setup.sh`.
+ * Build and install the app on the AVD.
+ * Execute your tests.
+
diff --git a/android/blueberry/server/scripts/setup.sh b/android/blueberry/server/scripts/setup.sh
new file mode 100755
index 0000000..1ade4f5
--- /dev/null
+++ b/android/blueberry/server/scripts/setup.sh
@@ -0,0 +1,12 @@
+#!/bin/env bash
+
+# Run Rootcanal and forward port
+if [ "$1" == "--rootcanal" ]
+then
+ adb root
+ adb shell ./vendor/bin/hw/android.hardware.bluetooth@1.1-service.sim &
+ adb forward tcp:6211 tcp:6211
+fi
+
+# Forward Blueberry server port
+adb forward tcp:8999 tcp:8999
diff --git a/android/blueberry/server/src/com/android/blueberry/Server.kt b/android/blueberry/server/src/com/android/blueberry/Server.kt
new file mode 100644
index 0000000..cbfff90
--- /dev/null
+++ b/android/blueberry/server/src/com/android/blueberry/Server.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.android.blueberry
+
+import android.os.Bundle
+import android.os.Debug
+import android.util.Log
+import androidx.test.runner.MonitoringInstrumentation
+import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder
+
+class Server : MonitoringInstrumentation() {
+
+ private val TAG = "BlueberryServer"
+ private val GRPC_PORT = 8999
+
+ override fun onCreate(arguments: Bundle) {
+ super.onCreate(arguments)
+
+ // Activate debugger
+ if (arguments.getString("debug").toBoolean()) {
+ Log.i(TAG, "Waiting for debugger to connect...")
+ Debug.waitForDebugger()
+ Log.i(TAG, "Debugger connected")
+ }
+
+ // Start instrumentation thread
+ start()
+ }
+
+ override fun onStart() {
+ super.onStart()
+
+ NettyServerBuilder.forPort(GRPC_PORT).build().start()
+ Log.d(TAG, "Blueberry Server started at $GRPC_PORT")
+ }
+}
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index 65a099d..6bff2b2 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -54,7 +54,6 @@
public final class BluetoothAdapter {
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean addOnMetadataChangedListener(@NonNull android.bluetooth.BluetoothDevice, @NonNull java.util.concurrent.Executor, @NonNull android.bluetooth.BluetoothAdapter.OnMetadataChangedListener);
- method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public int closeRfcommServer(@NonNull java.util.UUID);
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean disable(boolean);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean disableBLE();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean enableBLE();
@@ -78,6 +77,7 @@
method @NonNull @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public android.bluetooth.BluetoothSocket retrieveConnectedRfcommSocket(@NonNull java.util.UUID);
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean setActiveDevice(@NonNull android.bluetooth.BluetoothDevice, int);
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public int startRfcommServer(@NonNull String, @NonNull java.util.UUID, @NonNull android.app.PendingIntent);
+ method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public int stopRfcommServer(@NonNull java.util.UUID);
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean unregisterBluetoothConnectionCallback(@NonNull android.bluetooth.BluetoothAdapter.BluetoothConnectionCallback);
method public void unregisterServiceLifecycleCallback(@NonNull android.bluetooth.BluetoothAdapter.ServiceLifecycleCallback);
field public static final String ACTION_BLE_STATE_CHANGED = "android.bluetooth.adapter.action.BLE_STATE_CHANGED";
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index 06e0d89..8bfe6d8 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -3113,7 +3113,7 @@
android.Manifest.permission.BLUETOOTH_PRIVILEGED,
})
@RfcommListenerResult
- public int closeRfcommServer(@NonNull UUID uuid) {
+ public int stopRfcommServer(@NonNull UUID uuid) {
try {
final SynchronousResultReceiver<Integer> recv = new SynchronousResultReceiver();
mService.stopRfcommListener(new ParcelUuid(uuid), mAttributionSource, recv);
diff --git a/system/Android.bp b/system/Android.bp
index 6b06881..df03808 100644
--- a/system/Android.bp
+++ b/system/Android.bp
@@ -1,3 +1,15 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "system_bt_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ // SPDX-license-identifier-BSD
+ // SPDX-license-identifier-MIT
+ // legacy_unencumbered
+ default_applicable_licenses: ["system_bt_license"],
+}
+
filegroup {
name: "BlueberryFacadeProto",
srcs: [
@@ -170,4 +182,4 @@
"blueberry/facade/topshim/facade_pb2.py",
"blueberry/facade/topshim/facade_pb2_grpc.py"
],
-}
\ No newline at end of file
+}
diff --git a/system/audio_bluetooth_hw/Android.bp b/system/audio_bluetooth_hw/Android.bp
index 08496c2..25e1f8c 100644
--- a/system/audio_bluetooth_hw/Android.bp
+++ b/system/audio_bluetooth_hw/Android.bp
@@ -17,21 +17,25 @@
"audio_bluetooth_hw.cc",
"stream_apis.cc",
"device_port_proxy.cc",
+ "device_port_proxy_hidl.cc",
"utils.cc",
],
header_libs: ["libhardware_headers"],
shared_libs: [
- "android.hardware.bluetooth.audio@2.0",
- "android.hardware.bluetooth.audio@2.1",
- "android.hardware.bluetooth.audio@2.2",
+ "android.hardware.bluetooth.audio-V1-ndk",
+ "libbluetooth_audio_session_aidl",
"libaudioutils",
"libbase",
- "libbluetooth_audio_session",
+ "libbinder_ndk",
"libcutils",
"libfmq",
- "libhidlbase",
"liblog",
"libutils",
+ // HIDL dependencies
+ "android.hardware.bluetooth.audio@2.0",
+ "android.hardware.bluetooth.audio@2.1",
+ "libbluetooth_audio_session",
+ "libhidlbase",
],
cflags: [
"-Wall",
diff --git a/system/audio_bluetooth_hw/device_port_proxy.cc b/system/audio_bluetooth_hw/device_port_proxy.cc
index ed9f095..b9be63d 100644
--- a/system/audio_bluetooth_hw/device_port_proxy.cc
+++ b/system/audio_bluetooth_hw/device_port_proxy.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 The Android Open Source Project
+ * Copyright 2022 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.
@@ -14,7 +14,9 @@
* limitations under the License.
*/
-#define LOG_TAG "BTAudioHalDeviceProxy"
+#define LOG_TAG "BTAudioHalDeviceProxyAIDL"
+
+#include "device_port_proxy.h"
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
@@ -23,56 +25,29 @@
#include <log/log.h>
#include <stdlib.h>
-#include "BluetoothAudioSessionControl_2_2.h"
-#include "device_port_proxy.h"
+#include "BluetoothAudioSessionControl.h"
#include "stream_apis.h"
#include "utils.h"
namespace android {
namespace bluetooth {
namespace audio {
+namespace aidl {
+
+using ::aidl::android::hardware::bluetooth::audio::AudioConfiguration;
+using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioSessionControl;
+using ::aidl::android::hardware::bluetooth::audio::ChannelMode;
+using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration;
+using ::aidl::android::hardware::bluetooth::audio::PortStatusCallbacks;
+using ::aidl::android::hardware::bluetooth::audio::PresentationPosition;
using ::android::base::StringPrintf;
-using ::android::bluetooth::audio::BluetoothAudioSessionControl_2_2;
-using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample;
-using ::android::hardware::bluetooth::audio::V2_0::ChannelMode;
-using ::android::hardware::bluetooth::audio::V2_0::PcmParameters;
-using SampleRate = ::android::hardware::bluetooth::audio::V2_0::SampleRate;
-using SampleRate_2_1 = ::android::hardware::bluetooth::audio::V2_1::SampleRate;
-using BluetoothAudioStatus =
- ::android::hardware::bluetooth::audio::V2_0::Status;
using ControlResultCallback = std::function<void(
uint16_t cookie, bool start_resp, const BluetoothAudioStatus& status)>;
using SessionChangedCallback = std::function<void(uint16_t cookie)>;
namespace {
-unsigned int SampleRateToAudioFormat(SampleRate_2_1 sample_rate) {
- switch (sample_rate) {
- case SampleRate_2_1::RATE_8000:
- return 8000;
- case SampleRate_2_1::RATE_16000:
- return 16000;
- case SampleRate_2_1::RATE_24000:
- return 24000;
- case SampleRate_2_1::RATE_32000:
- return 32000;
- case SampleRate_2_1::RATE_44100:
- return 44100;
- case SampleRate_2_1::RATE_48000:
- return 48000;
- case SampleRate_2_1::RATE_88200:
- return 88200;
- case SampleRate_2_1::RATE_96000:
- return 96000;
- case SampleRate_2_1::RATE_176400:
- return 176400;
- case SampleRate_2_1::RATE_192000:
- return 192000;
- default:
- return kBluetoothDefaultSampleRate;
- }
-}
audio_channel_mask_t OutputChannelModeToAudioFormat(ChannelMode channel_mode) {
switch (channel_mode) {
case ChannelMode::MONO:
@@ -95,13 +70,13 @@
}
}
-audio_format_t BitsPerSampleToAudioFormat(BitsPerSample bits_per_sample) {
+audio_format_t BitsPerSampleToAudioFormat(uint8_t bits_per_sample) {
switch (bits_per_sample) {
- case BitsPerSample::BITS_16:
+ case 16:
return AUDIO_FORMAT_PCM_16_BIT;
- case BitsPerSample::BITS_24:
+ case 24:
return AUDIO_FORMAT_PCM_24_BIT_PACKED;
- case BitsPerSample::BITS_32:
+ case 32:
return AUDIO_FORMAT_PCM_32_BIT;
default:
return kBluetoothDefaultAudioFormatBitsPerSample;
@@ -113,12 +88,21 @@
} // namespace
-BluetoothAudioPort::BluetoothAudioPort()
- : cookie_(android::bluetooth::audio::kObserversCookieUndefined),
+BluetoothAudioPortAidl::BluetoothAudioPortAidl()
+ : cookie_(::aidl::android::hardware::bluetooth::audio::
+ kObserversCookieUndefined),
state_(BluetoothStreamState::DISABLED),
- session_type_(SessionType_2_1::UNKNOWN) {}
+ session_type_(SessionType::UNKNOWN) {}
-bool BluetoothAudioPort::SetUp(audio_devices_t devices) {
+BluetoothAudioPortAidlOut::~BluetoothAudioPortAidlOut() {
+ if (in_use()) TearDown();
+}
+
+BluetoothAudioPortAidlIn::~BluetoothAudioPortAidlIn() {
+ if (in_use()) TearDown();
+}
+
+bool BluetoothAudioPortAidl::SetUp(audio_devices_t devices) {
if (!init_session_type(devices)) return false;
state_ = BluetoothStreamState::STANDBY;
@@ -126,106 +110,120 @@
auto control_result_cb = [port = this](uint16_t cookie, bool start_resp,
const BluetoothAudioStatus& status) {
if (!port->in_use()) {
- LOG(ERROR) << "control_result_cb: BluetoothAudioPort is not in use";
+ LOG(ERROR) << "control_result_cb: BluetoothAudioPortAidl is not in use";
return;
}
if (port->cookie_ != cookie) {
- LOG(ERROR) << "control_result_cb: proxy of device port (cookie=" << StringPrintf("%#hx", cookie)
- << ") is corrupted";
+ LOG(ERROR) << "control_result_cb: proxy of device port (cookie="
+ << StringPrintf("%#hx", cookie) << ") is corrupted";
return;
}
port->ControlResultHandler(status);
};
auto session_changed_cb = [port = this](uint16_t cookie) {
if (!port->in_use()) {
- LOG(ERROR) << "session_changed_cb: BluetoothAudioPort is not in use";
+ LOG(ERROR) << "session_changed_cb: BluetoothAudioPortAidl is not in use";
return;
}
if (port->cookie_ != cookie) {
- LOG(ERROR) << "session_changed_cb: proxy of device port (cookie=" << StringPrintf("%#hx", cookie)
- << ") is corrupted";
+ LOG(ERROR) << "session_changed_cb: proxy of device port (cookie="
+ << StringPrintf("%#hx", cookie) << ") is corrupted";
return;
}
port->SessionChangedHandler();
};
- ::android::bluetooth::audio::PortStatusCallbacks cbacks = {
+ // TODO: Add audio_config_changed_cb
+ PortStatusCallbacks cbacks = {
.control_result_cb_ = control_result_cb,
- .session_changed_cb_ = session_changed_cb};
- cookie_ = BluetoothAudioSessionControl_2_2::RegisterControlResultCback(
+ .session_changed_cb_ = session_changed_cb,
+ };
+ cookie_ = BluetoothAudioSessionControl::RegisterControlResultCback(
session_type_, cbacks);
- LOG(INFO) << __func__ << ": session_type=" << toString(session_type_) << ", cookie=" << StringPrintf("%#hx", cookie_);
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_);
- return (cookie_ != android::bluetooth::audio::kObserversCookieUndefined);
+ return (
+ cookie_ !=
+ ::aidl::android::hardware::bluetooth::audio::kObserversCookieUndefined);
}
-bool BluetoothAudioPort::init_session_type(audio_devices_t device) {
+bool BluetoothAudioPortAidl::init_session_type(audio_devices_t device) {
switch (device) {
case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP:
case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES:
case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER:
- LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_OUT_BLUETOOTH_A2DP (HEADPHONES/SPEAKER) ("
- << StringPrintf("%#x", device) << ")";
- session_type_ = SessionType_2_1::A2DP_SOFTWARE_ENCODING_DATAPATH;
+ LOG(VERBOSE)
+ << __func__
+ << ": device=AUDIO_DEVICE_OUT_BLUETOOTH_A2DP (HEADPHONES/SPEAKER) ("
+ << StringPrintf("%#x", device) << ")";
+ session_type_ = SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH;
break;
case AUDIO_DEVICE_OUT_HEARING_AID:
- LOG(VERBOSE) << __func__ << ": device=AUDIO_DEVICE_OUT_HEARING_AID (MEDIA/VOICE) (" << StringPrintf("%#x", device)
- << ")";
- session_type_ = SessionType_2_1::HEARING_AID_SOFTWARE_ENCODING_DATAPATH;
+ LOG(VERBOSE) << __func__
+ << ": device=AUDIO_DEVICE_OUT_HEARING_AID (MEDIA/VOICE) ("
+ << StringPrintf("%#x", device) << ")";
+ session_type_ = SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH;
break;
case AUDIO_DEVICE_OUT_BLE_HEADSET:
LOG(VERBOSE) << __func__
<< ": device=AUDIO_DEVICE_OUT_BLE_HEADSET (MEDIA/VOICE) ("
<< StringPrintf("%#x", device) << ")";
- session_type_ = SessionType_2_1::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
+ session_type_ = SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
break;
case AUDIO_DEVICE_OUT_BLE_SPEAKER:
LOG(VERBOSE) << __func__
<< ": device=AUDIO_DEVICE_OUT_BLE_SPEAKER (MEDIA) ("
<< StringPrintf("%#x", device) << ")";
- session_type_ = SessionType_2_1::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
+ session_type_ = SessionType::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
break;
case AUDIO_DEVICE_IN_BLE_HEADSET:
LOG(VERBOSE) << __func__
<< ": device=AUDIO_DEVICE_IN_BLE_HEADSET (VOICE) ("
<< StringPrintf("%#x", device) << ")";
- session_type_ = SessionType_2_1::LE_AUDIO_SOFTWARE_DECODED_DATAPATH;
+ session_type_ = SessionType::LE_AUDIO_SOFTWARE_DECODING_DATAPATH;
break;
default:
- LOG(ERROR) << __func__ << ": unknown device=" << StringPrintf("%#x", device);
+ LOG(ERROR) << __func__
+ << ": unknown device=" << StringPrintf("%#x", device);
return false;
}
- if (!BluetoothAudioSessionControl_2_2::IsSessionReady(session_type_)) {
- LOG(ERROR) << __func__ << ": device=" << StringPrintf("%#x", device) << ", session_type=" << toString(session_type_)
+ if (!BluetoothAudioSessionControl::IsSessionReady(session_type_)) {
+ LOG(ERROR) << __func__ << ": device=" << StringPrintf("%#x", device)
+ << ", session_type=" << toString(session_type_)
<< " is not ready";
return false;
}
return true;
}
-void BluetoothAudioPort::TearDown() {
+void BluetoothAudioPortAidl::TearDown() {
if (!in_use()) {
LOG(ERROR) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << " unknown monitor";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " unknown monitor";
return;
}
- LOG(INFO) << __func__ << ": session_type=" << toString(session_type_) << ", cookie=" << StringPrintf("%#hx", cookie_);
- BluetoothAudioSessionControl_2_2::UnregisterControlResultCback(session_type_,
- cookie_);
- cookie_ = android::bluetooth::audio::kObserversCookieUndefined;
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_);
+ BluetoothAudioSessionControl::UnregisterControlResultCback(session_type_,
+ cookie_);
+ cookie_ =
+ ::aidl::android::hardware::bluetooth::audio::kObserversCookieUndefined;
}
-void BluetoothAudioPort::ControlResultHandler(
+void BluetoothAudioPortAidl::ControlResultHandler(
const BluetoothAudioStatus& status) {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPortis not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidlis not in use";
return;
}
std::unique_lock<std::mutex> port_lock(cv_mutex_);
BluetoothStreamState previous_state = state_;
LOG(INFO) << "control_result_cb: session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", previous_state=" << previous_state
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state
<< ", status=" << toString(status);
switch (previous_state) {
@@ -236,7 +234,8 @@
// Set to standby since the stack may be busy switching between outputs
LOG(WARNING) << "control_result_cb: status=" << toString(status)
<< " failure for session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", previous_state=" << previous_state;
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state;
state_ = BluetoothStreamState::STANDBY;
}
break;
@@ -248,13 +247,15 @@
// to wait for re-init again
LOG(WARNING) << "control_result_cb: status=" << toString(status)
<< " failure for session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", previous_state=" << previous_state;
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state;
state_ = BluetoothStreamState::DISABLED;
}
break;
default:
LOG(ERROR) << "control_result_cb: unexpected status=" << toString(status)
- << " for session_type=" << toString(session_type_) << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " for session_type=" << toString(session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
<< ", previous_state=" << previous_state;
return;
}
@@ -262,75 +263,73 @@
internal_cv_.notify_all();
}
-void BluetoothAudioPort::SessionChangedHandler() {
+void BluetoothAudioPortAidl::SessionChangedHandler() {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
return;
}
std::unique_lock<std::mutex> port_lock(cv_mutex_);
BluetoothStreamState previous_state = state_;
LOG(INFO) << "session_changed_cb: session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", previous_state=" << previous_state;
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state;
state_ = BluetoothStreamState::DISABLED;
port_lock.unlock();
internal_cv_.notify_all();
}
-bool BluetoothAudioPort::in_use() const {
- return (cookie_ != android::bluetooth::audio::kObserversCookieUndefined);
+bool BluetoothAudioPortAidl::in_use() const {
+ return (
+ cookie_ !=
+ ::aidl::android::hardware::bluetooth::audio::kObserversCookieUndefined);
}
-bool BluetoothAudioPort::GetPreferredDataIntervalUs(size_t* interval_us) const {
+bool BluetoothAudioPortAidl::GetPreferredDataIntervalUs(
+ size_t* interval_us) const {
if (!in_use()) {
return false;
}
- const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration&
- hal_audio_cfg =
- BluetoothAudioSessionControl_2_2::GetAudioConfig(session_type_);
- if (hal_audio_cfg.getDiscriminator() !=
- ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration::
- hidl_discriminator::pcmConfig) {
+ const AudioConfiguration& hal_audio_cfg =
+ BluetoothAudioSessionControl::GetAudioConfig(session_type_);
+ if (hal_audio_cfg.getTag() != AudioConfiguration::pcmConfig) {
return false;
}
- const ::android::hardware::bluetooth::audio::V2_1::PcmParameters& pcm_cfg =
- hal_audio_cfg.pcmConfig();
+ const PcmConfiguration& pcm_cfg =
+ hal_audio_cfg.get<AudioConfiguration::pcmConfig>();
*interval_us = pcm_cfg.dataIntervalUs;
return true;
}
-bool BluetoothAudioPortOut::LoadAudioConfig(audio_config_t* audio_cfg) const {
+bool BluetoothAudioPortAidlOut::LoadAudioConfig(
+ audio_config_t* audio_cfg) const {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPortOut is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidlOut is not in use";
audio_cfg->sample_rate = kBluetoothDefaultSampleRate;
audio_cfg->channel_mask = kBluetoothDefaultOutputChannelModeMask;
audio_cfg->format = kBluetoothDefaultAudioFormatBitsPerSample;
return false;
}
- const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration&
- hal_audio_cfg =
- BluetoothAudioSessionControl_2_2::GetAudioConfig(session_type_);
- if (hal_audio_cfg.getDiscriminator() !=
- ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration::
- hidl_discriminator::pcmConfig) {
+ const AudioConfiguration& hal_audio_cfg =
+ BluetoothAudioSessionControl::GetAudioConfig(session_type_);
+ if (hal_audio_cfg.getTag() != AudioConfiguration::pcmConfig) {
audio_cfg->sample_rate = kBluetoothDefaultSampleRate;
audio_cfg->channel_mask = kBluetoothDefaultOutputChannelModeMask;
audio_cfg->format = kBluetoothDefaultAudioFormatBitsPerSample;
return false;
}
- const ::android::hardware::bluetooth::audio::V2_1::PcmParameters& pcm_cfg =
- hal_audio_cfg.pcmConfig();
+ const PcmConfiguration& pcm_cfg =
+ hal_audio_cfg.get<AudioConfiguration::pcmConfig>();
LOG(VERBOSE) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << ", PcmConfig=["
- << toString(pcm_cfg) << "]";
- if (pcm_cfg.sampleRate == SampleRate_2_1::RATE_UNKNOWN ||
- pcm_cfg.channelMode == ChannelMode::UNKNOWN ||
- pcm_cfg.bitsPerSample == BitsPerSample::BITS_UNKNOWN) {
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << ", PcmConfig=[" << pcm_cfg.toString()
+ << "]";
+ if (pcm_cfg.channelMode == ChannelMode::UNKNOWN) {
return false;
}
- audio_cfg->sample_rate = SampleRateToAudioFormat(pcm_cfg.sampleRate);
+ audio_cfg->sample_rate = pcm_cfg.sampleRateHz;
audio_cfg->channel_mask =
(is_stereo_to_mono_
? AUDIO_CHANNEL_OUT_STEREO
@@ -339,51 +338,48 @@
return true;
}
-bool BluetoothAudioPortIn::LoadAudioConfig(audio_config_t* audio_cfg) const {
+bool BluetoothAudioPortAidlIn::LoadAudioConfig(
+ audio_config_t* audio_cfg) const {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPortIn is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidlIn is not in use";
audio_cfg->sample_rate = kBluetoothDefaultSampleRate;
audio_cfg->channel_mask = kBluetoothDefaultInputChannelModeMask;
audio_cfg->format = kBluetoothDefaultAudioFormatBitsPerSample;
return false;
}
- const ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration&
- hal_audio_cfg =
- BluetoothAudioSessionControl_2_2::GetAudioConfig(session_type_);
- if (hal_audio_cfg.getDiscriminator() !=
- ::android::hardware::bluetooth::audio::V2_2::AudioConfiguration::
- hidl_discriminator::pcmConfig) {
+ const AudioConfiguration& hal_audio_cfg =
+ BluetoothAudioSessionControl::GetAudioConfig(session_type_);
+ if (hal_audio_cfg.getTag() != AudioConfiguration::pcmConfig) {
audio_cfg->sample_rate = kBluetoothDefaultSampleRate;
audio_cfg->channel_mask = kBluetoothDefaultInputChannelModeMask;
audio_cfg->format = kBluetoothDefaultAudioFormatBitsPerSample;
return false;
}
- const ::android::hardware::bluetooth::audio::V2_1::PcmParameters& pcm_cfg =
- hal_audio_cfg.pcmConfig();
+ const PcmConfiguration& pcm_cfg =
+ hal_audio_cfg.get<AudioConfiguration::pcmConfig>();
LOG(VERBOSE) << __func__ << ": session_type=" << toString(session_type_)
<< ", cookie=" << StringPrintf("%#hx", cookie_)
- << ", state=" << state_ << ", PcmConfig=[" << toString(pcm_cfg)
+ << ", state=" << state_ << ", PcmConfig=[" << pcm_cfg.toString()
<< "]";
- if (pcm_cfg.sampleRate == SampleRate_2_1::RATE_UNKNOWN ||
- pcm_cfg.channelMode == ChannelMode::UNKNOWN ||
- pcm_cfg.bitsPerSample == BitsPerSample::BITS_UNKNOWN) {
+ if (pcm_cfg.channelMode == ChannelMode::UNKNOWN) {
return false;
}
- audio_cfg->sample_rate = SampleRateToAudioFormat(pcm_cfg.sampleRate);
+ audio_cfg->sample_rate = pcm_cfg.sampleRateHz;
audio_cfg->channel_mask = InputChannelModeToAudioFormat(pcm_cfg.channelMode);
audio_cfg->format = BitsPerSampleToAudioFormat(pcm_cfg.bitsPerSample);
return true;
}
-bool BluetoothAudioPort::CondwaitState(BluetoothStreamState state) {
+bool BluetoothAudioPortAidl::CondwaitState(BluetoothStreamState state) {
bool retval;
std::unique_lock<std::mutex> port_lock(cv_mutex_);
switch (state) {
case BluetoothStreamState::STARTING:
LOG(VERBOSE) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << " waiting for STARTED";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " waiting for STARTED";
retval = internal_cv_.wait_for(
port_lock, std::chrono::milliseconds(kMaxWaitingTimeMs),
[this] { return this->state_ != BluetoothStreamState::STARTING; });
@@ -391,7 +387,8 @@
break;
case BluetoothStreamState::SUSPENDING:
LOG(VERBOSE) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << " waiting for SUSPENDED";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " waiting for SUSPENDED";
retval = internal_cv_.wait_for(
port_lock, std::chrono::milliseconds(kMaxWaitingTimeMs),
[this] { return this->state_ != BluetoothStreamState::SUSPENDING; });
@@ -399,92 +396,107 @@
break;
default:
LOG(WARNING) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << " waiting for KNOWN";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " waiting for KNOWN";
return false;
}
return retval; // false if any failure like timeout
}
-bool BluetoothAudioPort::Start() {
+bool BluetoothAudioPortAidl::Start() {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
return false;
}
- LOG(INFO) << __func__ << ": session_type=" << toString(session_type_) << ", cookie=" << StringPrintf("%#hx", cookie_)
- << ", state=" << state_ << ", mono=" << (is_stereo_to_mono_ ? "true" : "false") << " request";
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_
+ << ", mono=" << (is_stereo_to_mono_ ? "true" : "false")
+ << " request";
bool retval = false;
if (state_ == BluetoothStreamState::STANDBY) {
state_ = BluetoothStreamState::STARTING;
- if (BluetoothAudioSessionControl_2_2::StartStream(session_type_)) {
+ if (BluetoothAudioSessionControl::StartStream(session_type_)) {
retval = CondwaitState(BluetoothStreamState::STARTING);
} else {
LOG(ERROR) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << " Hal fails";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " Hal fails";
}
}
if (retval) {
LOG(INFO) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_
- << ", mono=" << (is_stereo_to_mono_ ? "true" : "false") << " done";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_
+ << ", mono=" << (is_stereo_to_mono_ ? "true" : "false")
+ << " done";
} else {
LOG(ERROR) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << " failure";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " failure";
}
return retval; // false if any failure like timeout
}
-bool BluetoothAudioPort::Suspend() {
+bool BluetoothAudioPortAidl::Suspend() {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
return false;
}
- LOG(INFO) << __func__ << ": session_type=" << toString(session_type_) << ", cookie=" << StringPrintf("%#hx", cookie_)
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
<< ", state=" << state_ << " request";
bool retval = false;
if (state_ == BluetoothStreamState::STARTED) {
state_ = BluetoothStreamState::SUSPENDING;
- if (BluetoothAudioSessionControl_2_2::SuspendStream(session_type_)) {
+ if (BluetoothAudioSessionControl::SuspendStream(session_type_)) {
retval = CondwaitState(BluetoothStreamState::SUSPENDING);
} else {
LOG(ERROR) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << " Hal fails";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " Hal fails";
}
}
if (retval) {
LOG(INFO) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << " done";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " done";
} else {
LOG(ERROR) << __func__ << ": session_type=" << toString(session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << " failure";
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " failure";
}
return retval; // false if any failure like timeout
}
-void BluetoothAudioPort::Stop() {
+void BluetoothAudioPortAidl::Stop() {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
return;
}
- LOG(INFO) << __func__ << ": session_type=" << toString(session_type_) << ", cookie=" << StringPrintf("%#hx", cookie_)
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
<< ", state=" << state_ << " request";
state_ = BluetoothStreamState::DISABLED;
- BluetoothAudioSessionControl_2_2::StopStream(session_type_);
- LOG(INFO) << __func__ << ": session_type=" << toString(session_type_) << ", cookie=" << StringPrintf("%#hx", cookie_)
+ BluetoothAudioSessionControl::StopStream(session_type_);
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
<< ", state=" << state_ << " done";
}
-size_t BluetoothAudioPortOut::WriteData(const void* buffer, size_t bytes) const {
+size_t BluetoothAudioPortAidlOut::WriteData(const void* buffer,
+ size_t bytes) const {
if (!in_use()) return 0;
if (!is_stereo_to_mono_) {
- return BluetoothAudioSessionControl_2_2::OutWritePcmData(session_type_,
- buffer, bytes);
+ return BluetoothAudioSessionControl::OutWritePcmData(session_type_, buffer,
+ bytes);
}
// WAR to mix the stereo into Mono (16 bits per sample)
@@ -494,51 +506,62 @@
std::unique_ptr<int16_t[]> dst{new int16_t[write_frames]};
downmix_to_mono_i16_from_stereo_i16(dst.get(), src, write_frames);
// a frame is 16 bits, and the size of a mono frame is equal to half a stereo.
- return BluetoothAudioSessionControl_2_2::OutWritePcmData(
- session_type_, dst.get(), write_frames * 2) *
+ return BluetoothAudioSessionControl::OutWritePcmData(session_type_, dst.get(),
+ write_frames * 2) *
2;
}
-size_t BluetoothAudioPortIn::ReadData(void* buffer, size_t bytes) const {
+size_t BluetoothAudioPortAidlIn::ReadData(void* buffer, size_t bytes) const {
if (!in_use()) return 0;
- return BluetoothAudioSessionControl_2_2::InReadPcmData(session_type_, buffer,
- bytes);
+ return BluetoothAudioSessionControl::InReadPcmData(session_type_, buffer,
+ bytes);
}
-bool BluetoothAudioPort::GetPresentationPosition(uint64_t* delay_ns,
- uint64_t* bytes,
- timespec* timestamp) const {
+bool BluetoothAudioPortAidl::GetPresentationPosition(
+ uint64_t* delay_ns, uint64_t* bytes, timespec* timestamp) const {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
return false;
}
- bool retval = BluetoothAudioSessionControl_2_2::GetPresentationPosition(
- session_type_, delay_ns, bytes, timestamp);
- LOG(VERBOSE) << __func__ << ": session_type=" << StringPrintf("%#hhx", session_type_)
- << ", cookie=" << StringPrintf("%#hx", cookie_) << ", state=" << state_ << ", delay=" << *delay_ns
- << "ns, data=" << *bytes << " bytes, timestamp=" << timestamp->tv_sec << "."
+ PresentationPosition presentation_position;
+ bool retval = BluetoothAudioSessionControl::GetPresentationPosition(
+ session_type_, presentation_position);
+ *delay_ns = presentation_position.remoteDeviceAudioDelayNanos;
+ *bytes = presentation_position.transmittedOctets;
+ *timestamp = {.tv_sec = static_cast<__kernel_old_time_t>(
+ presentation_position.transmittedOctetsTimestamp.tvSec),
+ .tv_nsec = static_cast<long>(
+ presentation_position.transmittedOctetsTimestamp.tvNSec)};
+ LOG(VERBOSE) << __func__
+ << ": session_type=" << StringPrintf("%#hhx", session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << ", delay=" << *delay_ns
+ << "ns, data=" << *bytes
+ << " bytes, timestamp=" << timestamp->tv_sec << "."
<< StringPrintf("%09ld", timestamp->tv_nsec) << "s";
return retval;
}
-void BluetoothAudioPort::UpdateMetadata(
+void BluetoothAudioPortAidl::UpdateSourceMetadata(
const source_metadata* source_metadata) const {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
return;
}
- LOG(DEBUG) << __func__ << ": session_type=" << toString(session_type_) << ", cookie=" << StringPrintf("%#hx", cookie_)
- << ", state=" << state_ << ", " << source_metadata->track_count << " track(s)";
+ LOG(DEBUG) << __func__ << ": session_type=" << toString(session_type_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << ", " << source_metadata->track_count
+ << " track(s)";
if (source_metadata->track_count == 0) return;
- BluetoothAudioSessionControl_2_2::UpdateTracksMetadata(session_type_,
- source_metadata);
+ BluetoothAudioSessionControl::UpdateSourceMetadata(session_type_,
+ *source_metadata);
}
-void BluetoothAudioPort::UpdateSinkMetadata(
+void BluetoothAudioPortAidl::UpdateSinkMetadata(
const sink_metadata* sink_metadata) const {
if (!in_use()) {
- LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortAidl is not in use";
return;
}
LOG(DEBUG) << __func__ << ": session_type=" << toString(session_type_)
@@ -546,16 +569,17 @@
<< ", state=" << state_ << ", " << sink_metadata->track_count
<< " track(s)";
if (sink_metadata->track_count == 0) return;
- BluetoothAudioSessionControl_2_2::UpdateSinkMetadata(session_type_,
- sink_metadata);
+ BluetoothAudioSessionControl::UpdateSinkMetadata(session_type_,
+ *sink_metadata);
}
-BluetoothStreamState BluetoothAudioPort::GetState() const { return state_; }
+BluetoothStreamState BluetoothAudioPortAidl::GetState() const { return state_; }
-void BluetoothAudioPort::SetState(BluetoothStreamState state) {
+void BluetoothAudioPortAidl::SetState(BluetoothStreamState state) {
state_ = state;
}
+} // namespace aidl
} // namespace audio
} // namespace bluetooth
-} // namespace android
+} // namespace android
\ No newline at end of file
diff --git a/system/audio_bluetooth_hw/device_port_proxy.h b/system/audio_bluetooth_hw/device_port_proxy.h
index cc5342d..dab4970 100644
--- a/system/audio_bluetooth_hw/device_port_proxy.h
+++ b/system/audio_bluetooth_hw/device_port_proxy.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 The Android Open Source Project
+ * Copyright 2022 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.
@@ -16,8 +16,10 @@
#pragma once
-#include <android/hardware/bluetooth/audio/2.2/types.h>
+#include <aidl/android/hardware/bluetooth/audio/BluetoothAudioStatus.h>
+#include <aidl/android/hardware/bluetooth/audio/SessionType.h>
#include <hardware/audio.h>
+
#include <condition_variable>
#include <mutex>
#include <unordered_map>
@@ -28,112 +30,184 @@
namespace bluetooth {
namespace audio {
-using SessionType_2_1 =
- ::android::hardware::bluetooth::audio::V2_1::SessionType;
-
-// Proxy for Bluetooth Audio HW Module to communicate with Bluetooth Audio
-// Session Control. All methods are not thread safe, so users must acquire a
-// lock. Note: currently, in stream_apis.cc, if GetState() is only used for
-// verbose logging, it is not locked, so the state may not be synchronized.
+/***
+ * Proxy for Bluetooth Audio HW Module to communicate with Bluetooth Audio
+ * Session Control. All methods are not thread safe, so users must acquire a
+ * lock. Note: currently, in stream_apis.cc, if GetState() is only used for
+ * verbose logging, it is not locked, so the state may not be synchronized.
+ ***/
class BluetoothAudioPort {
public:
- BluetoothAudioPort();
+ BluetoothAudioPort(){};
virtual ~BluetoothAudioPort() = default;
- // Fetch output control / data path of BluetoothAudioPort and setup
- // callbacks into BluetoothAudioProvider. If SetUp() returns false, the audio
- // HAL must delete this BluetoothAudioPort and return EINVAL to caller
- bool SetUp(audio_devices_t devices);
+ /***
+ * Fetch output control / data path of BluetoothAudioPort and setup
+ * callbacks into BluetoothAudioProvider. If SetUp() returns false, the audio
+ * HAL must delete this BluetoothAudioPort and return EINVAL to caller
+ ***/
+ virtual bool SetUp(audio_devices_t) { return false; }
- // Unregister this BluetoothAudioPort from BluetoothAudioSessionControl.
- // Audio HAL must delete this BluetoothAudioPort after calling this.
- void TearDown();
+ /***
+ * Unregister this BluetoothAudioPort from BluetoothAudioSessionControl.
+ * Audio HAL must delete this BluetoothAudioPort after calling this.
+ ***/
+ virtual void TearDown() {}
- // When the Audio framework / HAL tries to query audio config about format,
- // channel mask and sample rate, it uses this function to fetch from the
- // Bluetooth stack
- virtual bool LoadAudioConfig(audio_config_t* audio_cfg) const = 0;
+ /***
+ * When the Audio framework / HAL tries to query audio config about format,
+ * channel mask and sample rate, it uses this function to fetch from the
+ * Bluetooth stack
+ ***/
+ virtual bool LoadAudioConfig(audio_config_t*) const { return false; };
- // WAR to support Mono mode / 16 bits per sample
- void ForcePcmStereoToMono(bool force) {
- is_stereo_to_mono_ = force;
+ /***
+ * WAR to support Mono mode / 16 bits per sample
+ ***/
+ virtual void ForcePcmStereoToMono(bool) {}
+
+ /***
+ * When the Audio framework / HAL wants to change the stream state, it invokes
+ * these 3 functions to control the Bluetooth stack (Audio Control Path).
+ * Note: Both Start() and Suspend() will return true when there are no errors.
+ * Called by Audio framework / HAL to start the stream
+ ***/
+ virtual bool Start() { return false; }
+
+ /***
+ * Called by Audio framework / HAL to suspend the stream
+ ***/
+ virtual bool Suspend() { return false; };
+
+ /***
+ virtual bool Suspend() { return false; }
+ * Called by Audio framework / HAL to stop the stream
+ ***/
+ virtual void Stop() {}
+
+ /***
+ * Called by the Audio framework / HAL to fetch information about audio frames
+ * presented to an external sink, or frames presented fror an internal sink
+ ***/
+ virtual bool GetPresentationPosition(uint64_t*, uint64_t*, timespec*) const {
+ return false;
}
- // When the Audio framework / HAL wants to change the stream state, it invokes
- // these 3 functions to control the Bluetooth stack (Audio Control Path).
- // Note: Both Start() and Suspend() will return ture when there are no errors.
- // Called by Audio framework / HAL to start the stream
- bool Start();
- // Called by Audio framework / HAL to suspend the stream
- bool Suspend();
- // Called by Audio framework / HAL to stop the stream
- void Stop();
+ /***
+ * Called by the Audio framework / HAL when the metadata of the stream's
+ * source has been changed.
+ ***/
+ virtual void UpdateSourceMetadata(const source_metadata*) const {};
- // Called by the Audio framework / HAL to fetch informaiton about audio frames
- // presented to an external sink, or frames presented fror an internal sink
- bool GetPresentationPosition(uint64_t* delay_ns, uint64_t* bytes,
- timespec* timestamp) const;
-
- // Called by the Audio framework / HAL when the metadata of the stream's
- // source has been changed.
- void UpdateMetadata(const source_metadata* source_metadata) const;
-
- void UpdateSinkMetadata(const sink_metadata* sink_metadata) const;
-
- // Return the current BluetoothStreamState
- BluetoothStreamState GetState() const;
-
- // Set the current BluetoothStreamState
- void SetState(BluetoothStreamState state);
-
- bool IsA2dp() const {
- return session_type_ == SessionType_2_1::A2DP_SOFTWARE_ENCODING_DATAPATH ||
- session_type_ == SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH;
+ /***
+ * Return the current BluetoothStreamState
+ ***/
+ virtual BluetoothStreamState GetState() const {
+ return static_cast<BluetoothStreamState>(0);
}
- bool GetPreferredDataIntervalUs(size_t* interval_us) const;
+ /***
+ * Set the current BluetoothStreamState
+ ***/
+ virtual void SetState(BluetoothStreamState state) {}
+
+ virtual bool IsA2dp() const { return false; }
+
+ virtual bool GetPreferredDataIntervalUs(size_t* interval_us) const {
+ return false;
+ };
+
+ virtual size_t WriteData(const void* buffer, size_t bytes) const {
+ return 0;
+ };
+ virtual size_t ReadData(void* buffer, size_t bytes) const { return 0; };
+};
+
+namespace aidl {
+
+using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioStatus;
+using ::aidl::android::hardware::bluetooth::audio::SessionType;
+
+class BluetoothAudioPortAidl : public BluetoothAudioPort {
+ public:
+ BluetoothAudioPortAidl();
+ virtual ~BluetoothAudioPortAidl() = default;
+
+ bool SetUp(audio_devices_t devices) override;
+
+ void TearDown() override;
+
+ void ForcePcmStereoToMono(bool force) override { is_stereo_to_mono_ = force; }
+
+ bool Start() override;
+ bool Suspend() override;
+ void Stop() override;
+
+ bool GetPresentationPosition(uint64_t* delay_ns, uint64_t* byte,
+ timespec* timestamp) const override;
+
+ void UpdateSourceMetadata(
+ const source_metadata* source_metadata) const override;
+
+ /***
+ * Called by the Audio framework / HAL when the metadata of the stream's
+ * sink has been changed.
+ ***/
+ virtual void UpdateSinkMetadata(const sink_metadata* sink_metadata) const;
+
+ BluetoothStreamState GetState() const override;
+
+ void SetState(BluetoothStreamState state) override;
+
+ bool IsA2dp() const override {
+ return session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ ==
+ SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
+ }
+
+ bool GetPreferredDataIntervalUs(size_t* interval_us) const override;
protected:
uint16_t cookie_;
BluetoothStreamState state_;
- SessionType_2_1 session_type_;
+ SessionType session_type_;
// WR to support Mono: True if fetching Stereo and mixing into Mono
bool is_stereo_to_mono_ = false;
- bool in_use() const;
+ virtual bool in_use() const;
private:
mutable std::mutex cv_mutex_;
std::condition_variable internal_cv_;
// Check and initialize session type for |devices| If failed, this
- // BluetoothAudioPort is not initialized and must be deleted.
+ // BluetoothAudioPortAidl is not initialized and must be deleted.
bool init_session_type(audio_devices_t device);
bool CondwaitState(BluetoothStreamState state);
- void ControlResultHandler(
- const ::android::hardware::bluetooth::audio::V2_0::Status& status);
+ void ControlResultHandler(const BluetoothAudioStatus& status);
void SessionChangedHandler();
};
-class BluetoothAudioPortOut : public BluetoothAudioPort {
+class BluetoothAudioPortAidlOut : public BluetoothAudioPortAidl {
public:
- ~BluetoothAudioPortOut() = default;
+ ~BluetoothAudioPortAidlOut();
// The audio data path to the Bluetooth stack (Software encoding)
- size_t WriteData(const void* buffer, size_t bytes) const;
- bool LoadAudioConfig(audio_config_t* audio_cfg) const;
+ size_t WriteData(const void* buffer, size_t bytes) const override;
+ bool LoadAudioConfig(audio_config_t* audio_cfg) const override;
};
-class BluetoothAudioPortIn : public BluetoothAudioPort {
+class BluetoothAudioPortAidlIn : public BluetoothAudioPortAidl {
public:
- ~BluetoothAudioPortIn() = default;
+ ~BluetoothAudioPortAidlIn();
// The audio data path from the Bluetooth stack (Software decoded)
- size_t ReadData(void* buffer, size_t bytes) const;
- bool LoadAudioConfig(audio_config_t* audio_cfg) const;
+ size_t ReadData(void* buffer, size_t bytes) const override;
+ bool LoadAudioConfig(audio_config_t* audio_cfg) const override;
};
+} // namespace aidl
} // namespace audio
} // namespace bluetooth
} // namespace android
diff --git a/system/audio_bluetooth_hw/device_port_proxy_hidl.cc b/system/audio_bluetooth_hw/device_port_proxy_hidl.cc
new file mode 100644
index 0000000..fbe7745
--- /dev/null
+++ b/system/audio_bluetooth_hw/device_port_proxy_hidl.cc
@@ -0,0 +1,608 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#define LOG_TAG "BTAudioHalDeviceProxyHIDL"
+
+#include "device_port_proxy_hidl.h"
+
+#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
+#include <audio_utils/primitives.h>
+#include <inttypes.h>
+#include <log/log.h>
+#include <stdlib.h>
+
+#include "BluetoothAudioSessionControl_2_1.h"
+#include "stream_apis.h"
+#include "utils.h"
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+namespace hidl {
+
+using ::android::base::StringPrintf;
+using ::android::bluetooth::audio::BluetoothAudioSessionControl_2_1;
+using ::android::hardware::bluetooth::audio::V2_0::BitsPerSample;
+using ::android::hardware::bluetooth::audio::V2_0::ChannelMode;
+using ::android::hardware::bluetooth::audio::V2_0::PcmParameters;
+using SampleRate = ::android::hardware::bluetooth::audio::V2_0::SampleRate;
+using SampleRate_2_1 = ::android::hardware::bluetooth::audio::V2_1::SampleRate;
+using BluetoothAudioStatusHidl =
+ ::android::hardware::bluetooth::audio::V2_0::Status;
+using ControlResultCallback = std::function<void(
+ uint16_t cookie, bool start_resp, const BluetoothAudioStatusHidl& status)>;
+using SessionChangedCallback = std::function<void(uint16_t cookie)>;
+
+namespace {
+
+unsigned int SampleRateToAudioFormat(SampleRate_2_1 sample_rate) {
+ switch (sample_rate) {
+ case SampleRate_2_1::RATE_8000:
+ return 8000;
+ case SampleRate_2_1::RATE_16000:
+ return 16000;
+ case SampleRate_2_1::RATE_24000:
+ return 24000;
+ case SampleRate_2_1::RATE_32000:
+ return 32000;
+ case SampleRate_2_1::RATE_44100:
+ return 44100;
+ case SampleRate_2_1::RATE_48000:
+ return 48000;
+ case SampleRate_2_1::RATE_88200:
+ return 88200;
+ case SampleRate_2_1::RATE_96000:
+ return 96000;
+ case SampleRate_2_1::RATE_176400:
+ return 176400;
+ case SampleRate_2_1::RATE_192000:
+ return 192000;
+ default:
+ return kBluetoothDefaultSampleRate;
+ }
+}
+audio_channel_mask_t OutputChannelModeToAudioFormat(ChannelMode channel_mode) {
+ switch (channel_mode) {
+ case ChannelMode::MONO:
+ return AUDIO_CHANNEL_OUT_MONO;
+ case ChannelMode::STEREO:
+ return AUDIO_CHANNEL_OUT_STEREO;
+ default:
+ return kBluetoothDefaultOutputChannelModeMask;
+ }
+}
+
+audio_channel_mask_t InputChannelModeToAudioFormat(ChannelMode channel_mode) {
+ switch (channel_mode) {
+ case ChannelMode::MONO:
+ return AUDIO_CHANNEL_IN_MONO;
+ case ChannelMode::STEREO:
+ return AUDIO_CHANNEL_IN_STEREO;
+ default:
+ return kBluetoothDefaultInputChannelModeMask;
+ }
+}
+
+audio_format_t BitsPerSampleToAudioFormat(BitsPerSample bits_per_sample) {
+ switch (bits_per_sample) {
+ case BitsPerSample::BITS_16:
+ return AUDIO_FORMAT_PCM_16_BIT;
+ case BitsPerSample::BITS_24:
+ return AUDIO_FORMAT_PCM_24_BIT_PACKED;
+ case BitsPerSample::BITS_32:
+ return AUDIO_FORMAT_PCM_32_BIT;
+ default:
+ return kBluetoothDefaultAudioFormatBitsPerSample;
+ }
+}
+
+// The maximum time to wait in std::condition_variable::wait_for()
+constexpr unsigned int kMaxWaitingTimeMs = 4500;
+
+} // namespace
+
+BluetoothAudioPortHidl::BluetoothAudioPortHidl()
+ : session_type_hidl_(SessionType_2_1::UNKNOWN),
+ cookie_(android::bluetooth::audio::kObserversCookieUndefined),
+ state_(BluetoothStreamState::DISABLED) {}
+
+BluetoothAudioPortHidlOut::~BluetoothAudioPortHidlOut() {
+ if (BluetoothAudioPortHidl::in_use()) BluetoothAudioPortHidl::TearDown();
+}
+
+BluetoothAudioPortHidlIn::~BluetoothAudioPortHidlIn() {
+ if (BluetoothAudioPortHidl::in_use()) BluetoothAudioPortHidl::TearDown();
+}
+
+bool BluetoothAudioPortHidl::SetUp(audio_devices_t devices) {
+ if (!init_session_type(devices)) return false;
+
+ state_ = BluetoothStreamState::STANDBY;
+
+ auto control_result_cb = [port = this](
+ uint16_t cookie, bool start_resp,
+ const BluetoothAudioStatusHidl& status) {
+ if (!port->in_use()) {
+ LOG(ERROR) << "control_result_cb: BluetoothAudioPort is not in use";
+ return;
+ }
+ if (port->cookie_ != cookie) {
+ LOG(ERROR) << "control_result_cb: proxy of device port (cookie="
+ << StringPrintf("%#hx", cookie) << ") is corrupted";
+ return;
+ }
+ port->ControlResultHandler(status);
+ };
+ auto session_changed_cb = [port = this](uint16_t cookie) {
+ if (!port->in_use()) {
+ LOG(ERROR) << "session_changed_cb: BluetoothAudioPort is not in use";
+ return;
+ }
+ if (port->cookie_ != cookie) {
+ LOG(ERROR) << "session_changed_cb: proxy of device port (cookie="
+ << StringPrintf("%#hx", cookie) << ") is corrupted";
+ return;
+ }
+ port->SessionChangedHandler();
+ };
+ ::android::bluetooth::audio::PortStatusCallbacks cbacks = {
+ .control_result_cb_ = control_result_cb,
+ .session_changed_cb_ = session_changed_cb};
+ cookie_ = BluetoothAudioSessionControl_2_1::RegisterControlResultCback(
+ session_type_hidl_, cbacks);
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_);
+
+ return (cookie_ != android::bluetooth::audio::kObserversCookieUndefined);
+}
+
+bool BluetoothAudioPortHidl::init_session_type(audio_devices_t device) {
+ switch (device) {
+ case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP:
+ case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES:
+ case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER:
+ LOG(VERBOSE)
+ << __func__
+ << ": device=AUDIO_DEVICE_OUT_BLUETOOTH_A2DP (HEADPHONES/SPEAKER) ("
+ << StringPrintf("%#x", device) << ")";
+ session_type_hidl_ = SessionType_2_1::A2DP_SOFTWARE_ENCODING_DATAPATH;
+ break;
+ case AUDIO_DEVICE_OUT_HEARING_AID:
+ LOG(VERBOSE) << __func__
+ << ": device=AUDIO_DEVICE_OUT_HEARING_AID (MEDIA/VOICE) ("
+ << StringPrintf("%#x", device) << ")";
+ session_type_hidl_ =
+ SessionType_2_1::HEARING_AID_SOFTWARE_ENCODING_DATAPATH;
+ break;
+ case AUDIO_DEVICE_OUT_BLE_HEADSET:
+ LOG(VERBOSE) << __func__
+ << ": device=AUDIO_DEVICE_OUT_BLE_HEADSET (MEDIA/VOICE) ("
+ << StringPrintf("%#x", device) << ")";
+ session_type_hidl_ = SessionType_2_1::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
+ break;
+ case AUDIO_DEVICE_OUT_BLE_SPEAKER:
+ LOG(VERBOSE) << __func__
+ << ": device=AUDIO_DEVICE_OUT_BLE_SPEAKER (MEDIA) ("
+ << StringPrintf("%#x", device) << ")";
+ session_type_hidl_ = SessionType_2_1::LE_AUDIO_SOFTWARE_ENCODING_DATAPATH;
+ break;
+ case AUDIO_DEVICE_IN_BLE_HEADSET:
+ LOG(VERBOSE) << __func__
+ << ": device=AUDIO_DEVICE_IN_BLE_HEADSET (VOICE) ("
+ << StringPrintf("%#x", device) << ")";
+ session_type_hidl_ = SessionType_2_1::LE_AUDIO_SOFTWARE_DECODED_DATAPATH;
+ break;
+ default:
+ LOG(ERROR) << __func__
+ << ": unknown device=" << StringPrintf("%#x", device);
+ return false;
+ }
+
+ if (!BluetoothAudioSessionControl_2_1::IsSessionReady(session_type_hidl_)) {
+ LOG(ERROR) << __func__ << ": device=" << StringPrintf("%#x", device)
+ << ", session_type=" << toString(session_type_hidl_)
+ << " is not ready";
+ return false;
+ }
+ return true;
+}
+
+void BluetoothAudioPortHidl::TearDown() {
+ if (!in_use()) {
+ LOG(ERROR) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " unknown monitor";
+ return;
+ }
+
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_);
+ BluetoothAudioSessionControl_2_1::UnregisterControlResultCback(
+ session_type_hidl_, cookie_);
+ cookie_ = android::bluetooth::audio::kObserversCookieUndefined;
+}
+
+void BluetoothAudioPortHidl::ControlResultHandler(
+ const BluetoothAudioStatusHidl& status) {
+ if (!in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortis not in use";
+ return;
+ }
+ std::unique_lock<std::mutex> port_lock(cv_mutex_);
+ BluetoothStreamState previous_state = state_;
+ LOG(INFO) << "control_result_cb: session_type="
+ << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state
+ << ", status=" << toString(status);
+
+ switch (previous_state) {
+ case BluetoothStreamState::STARTING:
+ if (status == BluetoothAudioStatusHidl::SUCCESS) {
+ state_ = BluetoothStreamState::STARTED;
+ } else {
+ // Set to standby since the stack may be busy switching between outputs
+ LOG(WARNING) << "control_result_cb: status=" << toString(status)
+ << " failure for session_type="
+ << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state;
+ state_ = BluetoothStreamState::STANDBY;
+ }
+ break;
+ case BluetoothStreamState::SUSPENDING:
+ if (status == BluetoothAudioStatusHidl::SUCCESS) {
+ state_ = BluetoothStreamState::STANDBY;
+ } else {
+ // It will be failed if the headset is disconnecting, and set to disable
+ // to wait for re-init again
+ LOG(WARNING) << "control_result_cb: status=" << toString(status)
+ << " failure for session_type="
+ << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state;
+ state_ = BluetoothStreamState::DISABLED;
+ }
+ break;
+ default:
+ LOG(ERROR) << "control_result_cb: unexpected status=" << toString(status)
+ << " for session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state;
+ return;
+ }
+ port_lock.unlock();
+ internal_cv_.notify_all();
+}
+
+void BluetoothAudioPortHidl::SessionChangedHandler() {
+ if (!in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ return;
+ }
+ std::unique_lock<std::mutex> port_lock(cv_mutex_);
+ BluetoothStreamState previous_state = state_;
+ LOG(INFO) << "session_changed_cb: session_type="
+ << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", previous_state=" << previous_state;
+ state_ = BluetoothStreamState::DISABLED;
+ port_lock.unlock();
+ internal_cv_.notify_all();
+}
+
+bool BluetoothAudioPortHidl::in_use() const {
+ return (cookie_ != android::bluetooth::audio::kObserversCookieUndefined);
+}
+
+bool BluetoothAudioPortHidl::GetPreferredDataIntervalUs(
+ size_t* interval_us) const {
+ if (!in_use()) {
+ return false;
+ }
+
+ const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration&
+ hal_audio_cfg =
+ BluetoothAudioSessionControl_2_1::GetAudioConfig(session_type_hidl_);
+ if (hal_audio_cfg.getDiscriminator() !=
+ ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration::
+ hidl_discriminator::pcmConfig) {
+ return false;
+ }
+
+ const ::android::hardware::bluetooth::audio::V2_1::PcmParameters& pcm_cfg =
+ hal_audio_cfg.pcmConfig();
+ *interval_us = pcm_cfg.dataIntervalUs;
+ return true;
+}
+
+bool BluetoothAudioPortHidl::CondwaitState(BluetoothStreamState state) {
+ bool retval;
+ std::unique_lock<std::mutex> port_lock(cv_mutex_);
+ switch (state) {
+ case BluetoothStreamState::STARTING:
+ LOG(VERBOSE) << __func__
+ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " waiting for STARTED";
+ retval = internal_cv_.wait_for(
+ port_lock, std::chrono::milliseconds(kMaxWaitingTimeMs),
+ [this] { return this->state_ != BluetoothStreamState::STARTING; });
+ retval = retval && state_ == BluetoothStreamState::STARTED;
+ break;
+ case BluetoothStreamState::SUSPENDING:
+ LOG(VERBOSE) << __func__
+ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " waiting for SUSPENDED";
+ retval = internal_cv_.wait_for(
+ port_lock, std::chrono::milliseconds(kMaxWaitingTimeMs),
+ [this] { return this->state_ != BluetoothStreamState::SUSPENDING; });
+ retval = retval && state_ == BluetoothStreamState::STANDBY;
+ break;
+ default:
+ LOG(WARNING) << __func__
+ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << " waiting for KNOWN";
+ return false;
+ }
+
+ return retval; // false if any failure like timeout
+}
+
+bool BluetoothAudioPortHidl::Start() {
+ if (!in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ return false;
+ }
+
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_
+ << ", mono=" << (is_stereo_to_mono_ ? "true" : "false")
+ << " request";
+ bool retval = false;
+ if (state_ == BluetoothStreamState::STANDBY) {
+ state_ = BluetoothStreamState::STARTING;
+ if (BluetoothAudioSessionControl_2_1::StartStream(session_type_hidl_)) {
+ retval = CondwaitState(BluetoothStreamState::STARTING);
+ } else {
+ LOG(ERROR) << __func__
+ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " Hal fails";
+ }
+ }
+
+ if (retval) {
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_
+ << ", mono=" << (is_stereo_to_mono_ ? "true" : "false")
+ << " done";
+ } else {
+ LOG(ERROR) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " failure";
+ }
+
+ return retval; // false if any failure like timeout
+}
+
+bool BluetoothAudioPortHidl::Suspend() {
+ if (!in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ return false;
+ }
+
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " request";
+ bool retval = false;
+ if (state_ == BluetoothStreamState::STARTED) {
+ state_ = BluetoothStreamState::SUSPENDING;
+ if (BluetoothAudioSessionControl_2_1::SuspendStream(session_type_hidl_)) {
+ retval = CondwaitState(BluetoothStreamState::SUSPENDING);
+ } else {
+ LOG(ERROR) << __func__
+ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " Hal fails";
+ }
+ }
+
+ if (retval) {
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " done";
+ } else {
+ LOG(ERROR) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " failure";
+ }
+
+ return retval; // false if any failure like timeout
+}
+
+void BluetoothAudioPortHidl::Stop() {
+ if (!in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ return;
+ }
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " request";
+ state_ = BluetoothStreamState::DISABLED;
+ BluetoothAudioSessionControl_2_1::StopStream(session_type_hidl_);
+ LOG(INFO) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << " done";
+}
+
+bool BluetoothAudioPortHidl::GetPresentationPosition(
+ uint64_t* delay_ns, uint64_t* bytes, timespec* timestamp) const {
+ if (!in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ return false;
+ }
+ bool retval = BluetoothAudioSessionControl_2_1::GetPresentationPosition(
+ session_type_hidl_, delay_ns, bytes, timestamp);
+ LOG(VERBOSE) << __func__
+ << ": session_type=" << StringPrintf("%#hhx", session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << ", delay=" << *delay_ns
+ << "ns, data=" << *bytes
+ << " bytes, timestamp=" << timestamp->tv_sec << "."
+ << StringPrintf("%09ld", timestamp->tv_nsec) << "s";
+
+ return retval;
+}
+
+void BluetoothAudioPortHidl::UpdateSourceMetadata(
+ const source_metadata* source_metadata) const {
+ if (!in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPort is not in use";
+ return;
+ }
+ LOG(DEBUG) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie=" << StringPrintf("%#hx", cookie_)
+ << ", state=" << state_ << ", " << source_metadata->track_count
+ << " track(s)";
+ if (source_metadata->track_count == 0) return;
+ BluetoothAudioSessionControl_2_1::UpdateTracksMetadata(session_type_hidl_,
+ source_metadata);
+}
+
+BluetoothStreamState BluetoothAudioPortHidl::GetState() const { return state_; }
+
+void BluetoothAudioPortHidl::SetState(BluetoothStreamState state) {
+ state_ = state;
+}
+
+size_t BluetoothAudioPortHidlOut::WriteData(const void* buffer,
+ size_t bytes) const {
+ if (!BluetoothAudioPortHidl::in_use()) return 0;
+ if (!BluetoothAudioPortHidl::is_stereo_to_mono_) {
+ return BluetoothAudioSessionControl_2_1::OutWritePcmData(session_type_hidl_,
+ buffer, bytes);
+ }
+
+ // WAR to mix the stereo into Mono (16 bits per sample)
+ const size_t write_frames = bytes >> 2;
+ if (write_frames == 0) return 0;
+ auto src = static_cast<const int16_t*>(buffer);
+ std::unique_ptr<int16_t[]> dst{new int16_t[write_frames]};
+ downmix_to_mono_i16_from_stereo_i16(dst.get(), src, write_frames);
+ // a frame is 16 bits, and the size of a mono frame is equal to half a stereo.
+ return BluetoothAudioSessionControl_2_1::OutWritePcmData(
+ session_type_hidl_, dst.get(), write_frames * 2) *
+ 2;
+}
+
+size_t BluetoothAudioPortHidlIn::ReadData(void* buffer, size_t bytes) const {
+ if (!BluetoothAudioPortHidl::in_use()) return 0;
+ return BluetoothAudioSessionControl_2_1::InReadPcmData(session_type_hidl_,
+ buffer, bytes);
+}
+
+bool BluetoothAudioPortHidlIn::LoadAudioConfig(
+ audio_config_t* audio_cfg) const {
+ if (!BluetoothAudioPortHidl::in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortIn is not in use";
+ audio_cfg->sample_rate = kBluetoothDefaultSampleRate;
+ audio_cfg->channel_mask = kBluetoothDefaultInputChannelModeMask;
+ audio_cfg->format = kBluetoothDefaultAudioFormatBitsPerSample;
+ return false;
+ }
+
+ const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration&
+ hal_audio_cfg =
+ BluetoothAudioSessionControl_2_1::GetAudioConfig(session_type_hidl_);
+ if (hal_audio_cfg.getDiscriminator() !=
+ ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration::
+ hidl_discriminator::pcmConfig) {
+ audio_cfg->sample_rate = kBluetoothDefaultSampleRate;
+ audio_cfg->channel_mask = kBluetoothDefaultInputChannelModeMask;
+ audio_cfg->format = kBluetoothDefaultAudioFormatBitsPerSample;
+ return false;
+ }
+ const ::android::hardware::bluetooth::audio::V2_1::PcmParameters& pcm_cfg =
+ hal_audio_cfg.pcmConfig();
+ LOG(VERBOSE) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie="
+ << StringPrintf("%#hx", BluetoothAudioPortHidl::cookie_)
+ << ", state=" << BluetoothAudioPortHidl::state_
+ << ", PcmConfig=[" << toString(pcm_cfg) << "]";
+ if (pcm_cfg.sampleRate == SampleRate_2_1::RATE_UNKNOWN ||
+ pcm_cfg.channelMode == ChannelMode::UNKNOWN ||
+ pcm_cfg.bitsPerSample == BitsPerSample::BITS_UNKNOWN) {
+ return false;
+ }
+
+ audio_cfg->sample_rate = SampleRateToAudioFormat(pcm_cfg.sampleRate);
+ audio_cfg->channel_mask = InputChannelModeToAudioFormat(pcm_cfg.channelMode);
+ audio_cfg->format = BitsPerSampleToAudioFormat(pcm_cfg.bitsPerSample);
+ return true;
+}
+
+bool BluetoothAudioPortHidlOut::LoadAudioConfig(
+ audio_config_t* audio_cfg) const {
+ if (!BluetoothAudioPortHidl::in_use()) {
+ LOG(ERROR) << __func__ << ": BluetoothAudioPortOut is not in use";
+ audio_cfg->sample_rate = kBluetoothDefaultSampleRate;
+ audio_cfg->channel_mask = kBluetoothDefaultOutputChannelModeMask;
+ audio_cfg->format = kBluetoothDefaultAudioFormatBitsPerSample;
+ return false;
+ }
+
+ const ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration&
+ hal_audio_cfg =
+ BluetoothAudioSessionControl_2_1::GetAudioConfig(session_type_hidl_);
+ if (hal_audio_cfg.getDiscriminator() !=
+ ::android::hardware::bluetooth::audio::V2_1::AudioConfiguration::
+ hidl_discriminator::pcmConfig) {
+ audio_cfg->sample_rate = kBluetoothDefaultSampleRate;
+ audio_cfg->channel_mask = kBluetoothDefaultOutputChannelModeMask;
+ audio_cfg->format = kBluetoothDefaultAudioFormatBitsPerSample;
+ return false;
+ }
+ const ::android::hardware::bluetooth::audio::V2_1::PcmParameters& pcm_cfg =
+ hal_audio_cfg.pcmConfig();
+ LOG(VERBOSE) << __func__ << ": session_type=" << toString(session_type_hidl_)
+ << ", cookie="
+ << StringPrintf("%#hx", BluetoothAudioPortHidl::cookie_)
+ << ", state=" << BluetoothAudioPortHidl::state_
+ << ", PcmConfig=[" << toString(pcm_cfg) << "]";
+ if (pcm_cfg.sampleRate == SampleRate_2_1::RATE_UNKNOWN ||
+ pcm_cfg.channelMode == ChannelMode::UNKNOWN ||
+ pcm_cfg.bitsPerSample == BitsPerSample::BITS_UNKNOWN) {
+ return false;
+ }
+ audio_cfg->sample_rate = SampleRateToAudioFormat(pcm_cfg.sampleRate);
+ audio_cfg->channel_mask =
+ (BluetoothAudioPortHidl::is_stereo_to_mono_
+ ? AUDIO_CHANNEL_OUT_STEREO
+ : OutputChannelModeToAudioFormat(pcm_cfg.channelMode));
+ audio_cfg->format = BitsPerSampleToAudioFormat(pcm_cfg.bitsPerSample);
+ return true;
+}
+
+} // namespace hidl
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
\ No newline at end of file
diff --git a/system/audio_bluetooth_hw/device_port_proxy_hidl.h b/system/audio_bluetooth_hw/device_port_proxy_hidl.h
new file mode 100644
index 0000000..f37370d
--- /dev/null
+++ b/system/audio_bluetooth_hw/device_port_proxy_hidl.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#pragma once
+
+#include <android/hardware/bluetooth/audio/2.1/types.h>
+#include <hardware/audio.h>
+
+#include <condition_variable>
+#include <mutex>
+#include <unordered_map>
+
+#include "device_port_proxy.h"
+
+enum class BluetoothStreamState : uint8_t;
+
+namespace android {
+namespace bluetooth {
+namespace audio {
+namespace hidl {
+
+using SessionType_2_1 =
+ ::android::hardware::bluetooth::audio::V2_1::SessionType;
+
+class BluetoothAudioPortHidl : public BluetoothAudioPort {
+ public:
+ BluetoothAudioPortHidl();
+ virtual ~BluetoothAudioPortHidl() = default;
+
+ bool SetUp(audio_devices_t devices) override;
+
+ void TearDown() override;
+
+ void ForcePcmStereoToMono(bool force) override { is_stereo_to_mono_ = force; }
+
+ bool Start() override;
+
+ bool Suspend() override;
+
+ void Stop() override;
+
+ bool GetPresentationPosition(uint64_t* delay_ns, uint64_t* bytes,
+ timespec* timestamp) const override;
+
+ void UpdateSourceMetadata(
+ const source_metadata* source_metadata) const override;
+
+ BluetoothStreamState GetState() const override;
+
+ void SetState(BluetoothStreamState state) override;
+
+ bool IsA2dp() const override {
+ return session_type_hidl_ ==
+ SessionType_2_1::A2DP_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_hidl_ ==
+ SessionType_2_1::A2DP_HARDWARE_OFFLOAD_DATAPATH;
+ }
+
+ bool GetPreferredDataIntervalUs(size_t* interval_us) const override;
+
+ protected:
+ SessionType_2_1 session_type_hidl_;
+ uint16_t cookie_;
+ BluetoothStreamState state_;
+ // WR to support Mono: True if fetching Stereo and mixing into Mono
+ bool is_stereo_to_mono_ = false;
+
+ bool in_use() const;
+
+ private:
+ mutable std::mutex cv_mutex_;
+ std::condition_variable internal_cv_;
+
+ bool init_session_type(audio_devices_t device);
+
+ bool CondwaitState(BluetoothStreamState state);
+
+ void ControlResultHandler(
+ const ::android::hardware::bluetooth::audio::V2_0::Status& status);
+
+ void SessionChangedHandler();
+};
+
+class BluetoothAudioPortHidlOut : public BluetoothAudioPortHidl {
+ public:
+ ~BluetoothAudioPortHidlOut();
+
+ size_t WriteData(const void* buffer, size_t bytes) const override;
+ bool LoadAudioConfig(audio_config_t* audio_cfg) const override;
+};
+
+class BluetoothAudioPortHidlIn : public BluetoothAudioPortHidl {
+ public:
+ ~BluetoothAudioPortHidlIn();
+
+ size_t ReadData(void* buffer, size_t bytes) const override;
+ bool LoadAudioConfig(audio_config_t* audio_cfg) const override;
+};
+
+} // namespace hidl
+} // namespace audio
+} // namespace bluetooth
+} // namespace android
\ No newline at end of file
diff --git a/system/audio_bluetooth_hw/stream_apis.cc b/system/audio_bluetooth_hw/stream_apis.cc
index 77e1bb0..5bc9923 100644
--- a/system/audio_bluetooth_hw/stream_apis.cc
+++ b/system/audio_bluetooth_hw/stream_apis.cc
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include "device_port_proxy.h"
#define LOG_TAG "BTAudioHalStream"
#include <android-base/logging.h>
@@ -26,11 +27,11 @@
#include <time.h>
#include <unistd.h>
+#include "BluetoothAudioSession.h"
#include "stream_apis.h"
#include "utils.h"
using ::android::base::StringPrintf;
-using ::android::bluetooth::audio::BluetoothAudioPortOut;
using ::android::bluetooth::audio::utils::GetAudioParamString;
using ::android::bluetooth::audio::utils::ParseAudioParams;
@@ -66,7 +67,7 @@
bool timestamp_fetched = false;
std::unique_lock<std::mutex> lock(out->mutex_);
- if (out->bluetooth_output_.GetPresentationPosition(
+ if (out->bluetooth_output_->GetPresentationPosition(
&delay_report_ns, &absorbed_bytes, &absorbed_timestamp)) {
delay_report_ms = delay_report_ns / 1000000;
// assume kMinimumDelayMs (50ms) < delay_report_ns < kMaximumDelayMs
@@ -76,7 +77,7 @@
delay_report_ms < kMaximumDelayMs) {
timestamp_fetched = true;
} else if (delay_report_ms >= kMaximumDelayMs) {
- LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", delay_report=" << delay_report_ns << "ns abnormal";
}
}
@@ -91,10 +92,10 @@
if (timestamp != nullptr) {
clock_gettime(CLOCK_MONOTONIC, &absorbed_timestamp);
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " uses the legacy delay " << delay_report_ms << " ms";
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", delay=" << delay_report_ms << "ms, data=" << absorbed_bytes
<< " bytes, timestamp=" << absorbed_timestamp.tv_sec << "."
<< StringPrintf("%09ld", absorbed_timestamp.tv_nsec) << "s";
@@ -139,14 +140,14 @@
struct timespec dispersed_timestamp = {};
std::unique_lock<std::mutex> lock(in->mutex_);
- in->bluetooth_input_.GetPresentationPosition(
+ in->bluetooth_input_->GetPresentationPosition(
&delay_report_ns, &dispersed_bytes, &dispersed_timestamp);
delay_report_ms = delay_report_ns / 1000000;
const uint64_t latency_frames = delay_report_ms * in->sample_rate_ / 1000;
*frames = dispersed_bytes / audio_stream_in_frame_size(&in->stream_in_);
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", delay=" << delay_report_ms
<< "ms, data=" << dispersed_bytes
<< " bytes, timestamp=" << dispersed_timestamp.tv_sec << "."
@@ -198,12 +199,12 @@
static uint32_t out_get_sample_rate(const struct audio_stream* stream) {
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
audio_config_t audio_cfg;
- if (out->bluetooth_output_.LoadAudioConfig(&audio_cfg)) {
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ if (out->bluetooth_output_->LoadAudioConfig(&audio_cfg)) {
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " audio_cfg=" << audio_cfg;
return audio_cfg.sample_rate;
} else {
- LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", sample_rate=" << out->sample_rate_ << " failed";
return out->sample_rate_;
}
@@ -211,7 +212,7 @@
static int out_set_sample_rate(struct audio_stream* stream, uint32_t rate) {
auto* out = reinterpret_cast<BluetoothStreamOut*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", sample_rate=" << out->sample_rate_;
return (rate == out->sample_rate_ ? 0 : -1);
}
@@ -220,7 +221,7 @@
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
size_t buffer_size =
out->frames_count_ * audio_stream_out_frame_size(&out->stream_out_);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", buffer_size=" << buffer_size;
return buffer_size;
}
@@ -229,13 +230,14 @@
const struct audio_stream* stream) {
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
audio_config_t audio_cfg;
- if (out->bluetooth_output_.LoadAudioConfig(&audio_cfg)) {
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ if (out->bluetooth_output_->LoadAudioConfig(&audio_cfg)) {
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " audio_cfg=" << audio_cfg;
return audio_cfg.channel_mask;
} else {
- LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_.GetState()
- << ", channels=" << StringPrintf("%#x", out->channel_mask_) << " failure";
+ LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_->GetState()
+ << ", channels=" << StringPrintf("%#x", out->channel_mask_)
+ << " failure";
return out->channel_mask_;
}
}
@@ -243,12 +245,12 @@
static audio_format_t out_get_format(const struct audio_stream* stream) {
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
audio_config_t audio_cfg;
- if (out->bluetooth_output_.LoadAudioConfig(&audio_cfg)) {
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ if (out->bluetooth_output_->LoadAudioConfig(&audio_cfg)) {
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " audio_cfg=" << audio_cfg;
return audio_cfg.format;
} else {
- LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", format=" << out->format_ << " failure";
return out->format_;
}
@@ -256,7 +258,7 @@
static int out_set_format(struct audio_stream* stream, audio_format_t format) {
auto* out = reinterpret_cast<BluetoothStreamOut*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", format=" << out->format_;
return (format == out->format_ ? 0 : -1);
}
@@ -268,23 +270,23 @@
// out->last_write_time_us_ = 0; unnecessary as a stale write time has same
// effect
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " being standby (suspend)";
- if (out->bluetooth_output_.GetState() == BluetoothStreamState::STARTED) {
+ if (out->bluetooth_output_->GetState() == BluetoothStreamState::STARTED) {
out->frames_rendered_ = 0;
- retval = (out->bluetooth_output_.Suspend() ? 0 : -EIO);
- } else if (out->bluetooth_output_.GetState() ==
+ retval = (out->bluetooth_output_->Suspend() ? 0 : -EIO);
+ } else if (out->bluetooth_output_->GetState() ==
BluetoothStreamState::STARTING ||
- out->bluetooth_output_.GetState() ==
+ out->bluetooth_output_->GetState() ==
BluetoothStreamState::SUSPENDING) {
- LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " NOT ready to be standby";
retval = -EBUSY;
} else {
- LOG(DEBUG) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(DEBUG) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " standby already";
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " standby (suspend) retval=" << retval;
return retval;
@@ -292,7 +294,7 @@
static int out_dump(const struct audio_stream* stream, int fd) {
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState();
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState();
return 0;
}
@@ -302,7 +304,7 @@
std::unique_lock<std::mutex> lock(out->mutex_);
int retval = 0;
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", kvpairs=[" << kvpairs << "]";
std::unordered_map<std::string, std::string> params =
@@ -316,73 +318,78 @@
if (params.find(AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES) != params.end() ||
params.find(AUDIO_PARAMETER_STREAM_SUP_CHANNELS) != params.end() ||
params.find(AUDIO_PARAMETER_STREAM_SUP_FORMATS) != params.end()) {
- if (out->bluetooth_output_.LoadAudioConfig(&audio_cfg)) {
+ if (out->bluetooth_output_->LoadAudioConfig(&audio_cfg)) {
out->sample_rate_ = audio_cfg.sample_rate;
out->channel_mask_ = audio_cfg.channel_mask;
out->format_ = audio_cfg.format;
- LOG(VERBOSE) << "state=" << out->bluetooth_output_.GetState() << ", sample_rate=" << out->sample_rate_
- << ", channels=" << StringPrintf("%#x", out->channel_mask_) << ", format=" << out->format_;
+ LOG(VERBOSE) << "state=" << out->bluetooth_output_->GetState()
+ << ", sample_rate=" << out->sample_rate_
+ << ", channels=" << StringPrintf("%#x", out->channel_mask_)
+ << ", format=" << out->format_;
} else {
LOG(WARNING) << __func__
- << ": state=" << out->bluetooth_output_.GetState()
+ << ": state=" << out->bluetooth_output_->GetState()
<< " failed to get audio config";
}
}
if (params.find("routing") != params.end()) {
auto routing_param = params.find("routing");
- LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", stream param '" << routing_param->first.c_str() << "="
<< routing_param->second.c_str() << "'";
}
if (params.find("A2dpSuspended") != params.end() &&
- out->bluetooth_output_.IsA2dp()) {
+ out->bluetooth_output_->IsA2dp()) {
if (params["A2dpSuspended"] == "true") {
- LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " stream param stopped";
out->frames_rendered_ = 0;
- if (out->bluetooth_output_.GetState() == BluetoothStreamState::STARTED) {
- out->bluetooth_output_.Suspend();
- out->bluetooth_output_.SetState(BluetoothStreamState::DISABLED);
- } else if (out->bluetooth_output_.GetState() !=
+ if (out->bluetooth_output_->GetState() == BluetoothStreamState::STARTED) {
+ out->bluetooth_output_->Suspend();
+ out->bluetooth_output_->SetState(BluetoothStreamState::DISABLED);
+ } else if (out->bluetooth_output_->GetState() !=
BluetoothStreamState::DISABLED) {
- out->bluetooth_output_.Stop();
+ out->bluetooth_output_->Stop();
}
} else {
- LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " stream param standby";
- if (out->bluetooth_output_.GetState() == BluetoothStreamState::DISABLED) {
- out->bluetooth_output_.SetState(BluetoothStreamState::STANDBY);
+ if (out->bluetooth_output_->GetState() ==
+ BluetoothStreamState::DISABLED) {
+ out->bluetooth_output_->SetState(BluetoothStreamState::STANDBY);
}
}
}
if (params.find("closing") != params.end()) {
if (params["closing"] == "true") {
- LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " stream param closing, disallow any writes?";
- if (out->bluetooth_output_.GetState() != BluetoothStreamState::DISABLED) {
+ if (out->bluetooth_output_->GetState() !=
+ BluetoothStreamState::DISABLED) {
out->frames_rendered_ = 0;
out->frames_presented_ = 0;
- out->bluetooth_output_.Stop();
+ out->bluetooth_output_->Stop();
}
}
}
if (params.find("exiting") != params.end()) {
if (params["exiting"] == "1") {
- LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " stream param exiting";
- if (out->bluetooth_output_.GetState() != BluetoothStreamState::DISABLED) {
+ if (out->bluetooth_output_->GetState() !=
+ BluetoothStreamState::DISABLED) {
out->frames_rendered_ = 0;
out->frames_presented_ = 0;
- out->bluetooth_output_.Stop();
+ out->bluetooth_output_->Stop();
}
}
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", kvpairs=[" << kvpairs << "], retval=" << retval;
return retval;
}
@@ -392,18 +399,18 @@
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
std::unique_lock<std::mutex> lock(out->mutex_);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", keys=[" << keys << "]";
std::unordered_map<std::string, std::string> params = ParseAudioParams(keys);
if (params.empty()) return strdup("");
audio_config_t audio_cfg;
- if (out->bluetooth_output_.LoadAudioConfig(&audio_cfg)) {
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ if (out->bluetooth_output_->LoadAudioConfig(&audio_cfg)) {
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " audio_cfg=" << audio_cfg;
} else {
- LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " failed to get audio config";
}
@@ -467,7 +474,7 @@
result += ptr.first + "=" + ptr.second + ";";
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", result=[" << result << "]";
return strdup(result.c_str());
}
@@ -476,7 +483,7 @@
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
uint32_t latency_ms = 0;
out_calculate_feeding_delay_ms(out, &latency_ms);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", latency=" << latency_ms << "ms";
return latency_ms;
}
@@ -484,7 +491,7 @@
static int out_set_volume(struct audio_stream_out* stream, float left,
float right) {
auto* out = reinterpret_cast<BluetoothStreamOut*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", Left=" << left << ", Right=" << right;
return -1;
}
@@ -495,14 +502,15 @@
std::unique_lock<std::mutex> lock(out->mutex_);
size_t totalWritten = 0;
- if (out->bluetooth_output_.GetState() != BluetoothStreamState::STARTED) {
- LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ if (out->bluetooth_output_->GetState() != BluetoothStreamState::STARTED) {
+ LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " first time bytes=" << bytes;
lock.unlock();
if (stream->resume(stream)) {
- LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " failed to resume";
- if (out->bluetooth_output_.GetState() == BluetoothStreamState::DISABLED) {
+ if (out->bluetooth_output_->GetState() ==
+ BluetoothStreamState::DISABLED) {
// drop data for cases of A2dpSuspended=true / closing=true
totalWritten = bytes;
}
@@ -512,7 +520,7 @@
lock.lock();
}
lock.unlock();
- totalWritten = out->bluetooth_output_.WriteData(buffer, bytes);
+ totalWritten = out->bluetooth_output_->WriteData(buffer, bytes);
lock.lock();
struct timespec ts = {.tv_sec = 0, .tv_nsec = 0};
@@ -563,7 +571,7 @@
*dsp_frames = 0;
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", dsp_frames=" << *dsp_frames;
return 0;
}
@@ -571,7 +579,7 @@
static int out_add_audio_effect(const struct audio_stream* stream,
effect_handle_t effect) {
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", effect=" << effect;
return 0;
}
@@ -579,7 +587,7 @@
static int out_remove_audio_effect(const struct audio_stream* stream,
effect_handle_t effect) {
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", effect=" << effect;
return 0;
}
@@ -588,7 +596,7 @@
int64_t* timestamp) {
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
*timestamp = 0;
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", timestamp=" << *timestamp;
return -EINVAL;
}
@@ -597,23 +605,23 @@
auto* out = reinterpret_cast<BluetoothStreamOut*>(stream);
std::unique_lock<std::mutex> lock(out->mutex_);
int retval = 0;
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", pausing (suspend)";
- if (out->bluetooth_output_.GetState() == BluetoothStreamState::STARTED) {
+ if (out->bluetooth_output_->GetState() == BluetoothStreamState::STARTED) {
out->frames_rendered_ = 0;
- retval = (out->bluetooth_output_.Suspend() ? 0 : -EIO);
- } else if (out->bluetooth_output_.GetState() ==
+ retval = (out->bluetooth_output_->Suspend() ? 0 : -EIO);
+ } else if (out->bluetooth_output_->GetState() ==
BluetoothStreamState::STARTING ||
- out->bluetooth_output_.GetState() ==
+ out->bluetooth_output_->GetState() ==
BluetoothStreamState::SUSPENDING) {
- LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " NOT ready to pause?!";
retval = -EBUSY;
} else {
- LOG(DEBUG) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(DEBUG) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " paused already";
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", pausing (suspend) retval=" << retval;
return retval;
@@ -624,27 +632,27 @@
std::unique_lock<std::mutex> lock(out->mutex_);
int retval = 0;
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", resuming (start)";
- if (out->bluetooth_output_.GetState() == BluetoothStreamState::STANDBY) {
- retval = (out->bluetooth_output_.Start() ? 0 : -EIO);
- } else if (out->bluetooth_output_.GetState() ==
+ if (out->bluetooth_output_->GetState() == BluetoothStreamState::STANDBY) {
+ retval = (out->bluetooth_output_->Start() ? 0 : -EIO);
+ } else if (out->bluetooth_output_->GetState() ==
BluetoothStreamState::STARTING ||
- out->bluetooth_output_.GetState() ==
+ out->bluetooth_output_->GetState() ==
BluetoothStreamState::SUSPENDING) {
- LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " NOT ready to resume?!";
retval = -EBUSY;
- } else if (out->bluetooth_output_.GetState() ==
+ } else if (out->bluetooth_output_->GetState() ==
BluetoothStreamState::DISABLED) {
- LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " NOT allow to resume?!";
retval = -EINVAL;
} else {
- LOG(DEBUG) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(DEBUG) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " resumed already";
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", resuming (start) retval=" << retval;
return retval;
@@ -659,7 +667,7 @@
const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream);
out_calculate_feeding_delay_ms(out, nullptr, frames, timestamp);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", frames=" << *frames << ", timestamp=" << timestamp->tv_sec
<< "." << StringPrintf("%09ld", timestamp->tv_nsec) << "s";
return 0;
@@ -673,9 +681,9 @@
if (source_metadata == nullptr || source_metadata->track_count == 0) {
return;
}
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", " << source_metadata->track_count << " track(s)";
- out->bluetooth_output_.UpdateMetadata(source_metadata);
+ out->bluetooth_output_->UpdateSourceMetadata(source_metadata);
}
static size_t frame_count(size_t microseconds, uint32_t sample_rate) {
@@ -690,7 +698,19 @@
const char* address __unused) {
*stream_out = nullptr;
auto* out = new BluetoothStreamOut{};
- if (!out->bluetooth_output_.SetUp(devices)) {
+ if (::aidl::android::hardware::bluetooth::audio::BluetoothAudioSession::
+ IsAidlAvailable()) {
+ out->bluetooth_output_ = std::make_unique<
+ ::android::bluetooth::audio::aidl::BluetoothAudioPortAidlOut>();
+ out->is_aidl = true;
+ } else {
+ out->bluetooth_output_ = std::make_unique<
+ ::android::bluetooth::audio::hidl::BluetoothAudioPortHidlOut>();
+ out->is_aidl = false;
+ }
+ if (!out->bluetooth_output_->SetUp(devices)) {
+ out->bluetooth_output_ = nullptr;
+ LOG(ERROR) << __func__ << ": cannot init HAL";
delete out;
return -EINVAL;
}
@@ -718,15 +738,17 @@
out->stream_out_.get_presentation_position = out_get_presentation_position;
out->stream_out_.update_source_metadata = out_update_source_metadata;
- if (!out->bluetooth_output_.LoadAudioConfig(config)) {
- LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ if (!out->bluetooth_output_->LoadAudioConfig(config)) {
+ LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< " failed to get audio config";
}
// WAR to support Mono / 16 bits per sample as the Bluetooth stack required
- if (config->channel_mask == AUDIO_CHANNEL_OUT_MONO && config->format == AUDIO_FORMAT_PCM_16_BIT) {
- LOG(INFO) << __func__ << ": force channels=" << StringPrintf("%#x", out->channel_mask_)
+ if (config->channel_mask == AUDIO_CHANNEL_OUT_MONO &&
+ config->format == AUDIO_FORMAT_PCM_16_BIT) {
+ LOG(INFO) << __func__
+ << ": force channels=" << StringPrintf("%#x", out->channel_mask_)
<< " to be AUDIO_CHANNEL_OUT_STEREO";
- out->bluetooth_output_.ForcePcmStereoToMono(true);
+ out->bluetooth_output_->ForcePcmStereoToMono(true);
config->channel_mask = AUDIO_CHANNEL_OUT_STEREO;
}
out->sample_rate_ = config->sample_rate;
@@ -735,7 +757,7 @@
// frame is number of samples per channel
size_t preferred_data_interval_us = kBluetoothDefaultOutputBufferMs * 1000;
- if (out->bluetooth_output_.GetPreferredDataIntervalUs(
+ if (out->bluetooth_output_->GetPreferredDataIntervalUs(
&preferred_data_interval_us) &&
preferred_data_interval_us != 0) {
out->preferred_data_interval_us = preferred_data_interval_us;
@@ -766,11 +788,11 @@
bluetooth_device->opened_stream_outs_.push_back(out);
}
*stream_out = &out->stream_out_;
- LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", sample_rate=" << out->sample_rate_
<< ", channels=" << StringPrintf("%#x", out->channel_mask_)
- << ", format=" << out->format_
- << ", preferred_data_interval_us=" << out->preferred_data_interval_us
+ << ", format=" << out->format_ << ", preferred_data_interval_us="
+ << out->preferred_data_interval_us
<< ", frames=" << out->frames_count_;
return 0;
}
@@ -778,20 +800,20 @@
void adev_close_output_stream(struct audio_hw_device* dev,
struct audio_stream_out* stream) {
auto* out = reinterpret_cast<BluetoothStreamOut*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", stopping";
{
auto* bluetooth_device = reinterpret_cast<BluetoothAudioDevice*>(dev);
std::lock_guard<std::mutex> guard(bluetooth_device->mutex_);
bluetooth_device->opened_stream_outs_.remove(out);
}
- if (out->bluetooth_output_.GetState() != BluetoothStreamState::DISABLED) {
+ if (out->bluetooth_output_->GetState() != BluetoothStreamState::DISABLED) {
out->frames_rendered_ = 0;
out->frames_presented_ = 0;
- out->bluetooth_output_.Stop();
+ out->bluetooth_output_->Stop();
}
- out->bluetooth_output_.TearDown();
- LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_.GetState()
+ out->bluetooth_output_->TearDown();
+ LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState()
<< ", stopped";
delete out;
}
@@ -812,7 +834,7 @@
static int in_set_sample_rate(struct audio_stream* stream, uint32_t rate) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", sample_rate=" << in->sample_rate_;
return (rate == in->sample_rate_ ? 0 : -ENOSYS);
}
@@ -821,7 +843,7 @@
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
size_t buffer_size =
in->frames_count_ * audio_stream_in_frame_size(&in->stream_in_);
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", buffer_size=" << buffer_size;
return buffer_size;
}
@@ -829,12 +851,12 @@
static audio_channel_mask_t in_get_channels(const struct audio_stream* stream) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
audio_config_t audio_cfg;
- if (in->bluetooth_input_.LoadAudioConfig(&audio_cfg)) {
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ if (in->bluetooth_input_->LoadAudioConfig(&audio_cfg)) {
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " audio_cfg=" << audio_cfg;
return audio_cfg.channel_mask;
} else {
- LOG(WARNING) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", channels=" << StringPrintf("%#x", in->channel_mask_)
<< " failure";
return in->channel_mask_;
@@ -844,12 +866,12 @@
static audio_format_t in_get_format(const struct audio_stream* stream) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
audio_config_t audio_cfg;
- if (in->bluetooth_input_.LoadAudioConfig(&audio_cfg)) {
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ if (in->bluetooth_input_->LoadAudioConfig(&audio_cfg)) {
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " audio_cfg=" << audio_cfg;
return audio_cfg.format;
} else {
- LOG(WARNING) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", format=" << in->format_ << " failure";
return in->format_;
}
@@ -857,7 +879,7 @@
static int in_set_format(struct audio_stream* stream, audio_format_t format) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", format=" << in->format_;
return (format == in->format_ ? 0 : -ENOSYS);
}
@@ -867,7 +889,7 @@
const BluetoothStreamState& state,
uint16_t timeout_ms) {
/* Don't loose suspend request, AF will not retry */
- while (in->bluetooth_input_.GetState() == state) {
+ while (in->bluetooth_input_->GetState() == state) {
lock.unlock();
usleep(1000);
lock.lock();
@@ -888,22 +910,22 @@
std::unique_lock<std::mutex> lock(in->mutex_);
int retval = 0;
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " being standby (suspend)";
/* Give some time to start up */
if (!in_state_transition_timeout(in, lock, BluetoothStreamState::STARTING,
kBluetoothDefaultInputStateTimeoutMs)) {
- LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " NOT ready to by standby";
return retval;
}
- if (in->bluetooth_input_.GetState() == BluetoothStreamState::STARTED) {
- retval = (in->bluetooth_input_.Suspend() ? 0 : -EIO);
- } else if (in->bluetooth_input_.GetState() !=
+ if (in->bluetooth_input_->GetState() == BluetoothStreamState::STARTED) {
+ retval = (in->bluetooth_input_->Suspend() ? 0 : -EIO);
+ } else if (in->bluetooth_input_->GetState() !=
BluetoothStreamState::SUSPENDING) {
- LOG(DEBUG) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(DEBUG) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " standby already";
return retval;
}
@@ -911,12 +933,12 @@
/* Give some time to suspend */
if (!in_state_transition_timeout(in, lock, BluetoothStreamState::SUSPENDING,
kBluetoothDefaultInputStateTimeoutMs)) {
- LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " NOT ready to by standby";
return 0;
}
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " standby (suspend) retval=" << retval;
return retval;
@@ -924,7 +946,7 @@
static int in_dump(const struct audio_stream* stream, int fd) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState();
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState();
return 0;
}
@@ -935,7 +957,7 @@
int retval = 0;
LOG(INFO) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState()
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState()
<< ", kvpairs=[" << kvpairs << "]";
std::unordered_map<std::string, std::string> params =
@@ -955,18 +977,18 @@
std::unique_lock<std::mutex> lock(in->mutex_);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState()
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState()
<< ", keys=[" << keys << "]";
std::unordered_map<std::string, std::string> params = ParseAudioParams(keys);
if (params.empty()) return strdup("");
audio_config_t audio_cfg;
- if (in->bluetooth_input_.LoadAudioConfig(&audio_cfg)) {
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ if (in->bluetooth_input_->LoadAudioConfig(&audio_cfg)) {
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " audio_cfg=" << audio_cfg;
} else {
- LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " failed to get audio config";
}
@@ -985,7 +1007,7 @@
static int in_add_audio_effect(const struct audio_stream* stream,
effect_handle_t effect) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", effect=" << effect;
return 0;
}
@@ -993,7 +1015,7 @@
static int in_remove_audio_effect(const struct audio_stream* stream,
effect_handle_t effect) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", effect=" << effect;
return 0;
}
@@ -1001,7 +1023,7 @@
static int in_set_gain(struct audio_stream_in* stream, float gain) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return 0;
}
@@ -1017,41 +1039,41 @@
kBluetoothDefaultInputStateTimeoutMs))
return -EBUSY;
- if (in->bluetooth_input_.GetState() != BluetoothStreamState::STARTED) {
- LOG(INFO) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ if (in->bluetooth_input_->GetState() != BluetoothStreamState::STARTED) {
+ LOG(INFO) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " first time bytes=" << bytes;
int retval = 0;
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", starting";
- if (in->bluetooth_input_.GetState() == BluetoothStreamState::STANDBY) {
- retval = (in->bluetooth_input_.Start() ? 0 : -EIO);
- } else if (in->bluetooth_input_.GetState() ==
+ if (in->bluetooth_input_->GetState() == BluetoothStreamState::STANDBY) {
+ retval = (in->bluetooth_input_->Start() ? 0 : -EIO);
+ } else if (in->bluetooth_input_->GetState() ==
BluetoothStreamState::SUSPENDING) {
- LOG(WARNING) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " NOT ready to start?!";
retval = -EBUSY;
- } else if (in->bluetooth_input_.GetState() ==
+ } else if (in->bluetooth_input_->GetState() ==
BluetoothStreamState::DISABLED) {
- LOG(WARNING) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(WARNING) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " NOT allow to start?!";
retval = -EINVAL;
} else {
- LOG(DEBUG) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(DEBUG) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " started already";
}
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", starting (start) retval=" << retval;
if (retval) {
- LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " failed to start";
return retval;
}
}
lock.unlock();
- totalRead = in->bluetooth_input_.ReadData(buffer, bytes);
+ totalRead = in->bluetooth_input_->ReadData(buffer, bytes);
lock.lock();
struct timespec ts = {.tv_sec = 0, .tv_nsec = 0};
@@ -1067,7 +1089,7 @@
static uint32_t in_get_input_frames_lost(struct audio_stream_in* stream) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return 0;
}
@@ -1079,8 +1101,8 @@
}
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
- if (in->bluetooth_input_.GetState() == BluetoothStreamState::STANDBY) {
- LOG(WARNING) << __func__ << ": state= " << in->bluetooth_input_.GetState();
+ if (in->bluetooth_input_->GetState() == BluetoothStreamState::STANDBY) {
+ LOG(WARNING) << __func__ << ": state= " << in->bluetooth_input_->GetState();
return -ENOSYS;
}
@@ -1092,7 +1114,7 @@
static int in_start(const struct audio_stream_in* stream) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return 0;
}
@@ -1100,7 +1122,7 @@
static int in_stop(const struct audio_stream_in* stream) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return 0;
}
@@ -1110,7 +1132,7 @@
struct audio_mmap_buffer_info* info) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return -ENOSYS;
}
@@ -1119,7 +1141,7 @@
struct audio_mmap_position* position) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return -ENOSYS;
}
@@ -1129,7 +1151,7 @@
struct audio_microphone_characteristic_t* mic_array, size_t* mic_count) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return -ENOSYS;
}
@@ -1138,7 +1160,7 @@
audio_microphone_direction_t direction) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return -ENOSYS;
}
@@ -1147,7 +1169,7 @@
const struct audio_stream_in* stream, float zoom) {
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
LOG(VERBOSE) << __func__
- << ": NOT HANDLED! state=" << in->bluetooth_input_.GetState();
+ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState();
return -ENOSYS;
}
@@ -1160,10 +1182,17 @@
}
const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream);
- LOG(INFO) << __func__ << ": state=" << in->bluetooth_input_.GetState() << ", "
- << sink_metadata->track_count << " track(s)";
+ LOG(INFO) << __func__ << ": state=" << in->bluetooth_input_->GetState()
+ << ", " << sink_metadata->track_count << " track(s)";
- in->bluetooth_input_.UpdateSinkMetadata(sink_metadata);
+ if (!in->is_aidl) {
+ LOG(WARNING) << __func__
+ << " is only supported in AIDL but using HIDL now!";
+ return;
+ }
+ static_cast<::android::bluetooth::audio::aidl::BluetoothAudioPortAidl*>(
+ in->bluetooth_input_.get())
+ ->UpdateSinkMetadata(sink_metadata);
}
int adev_open_input_stream(struct audio_hw_device* dev,
@@ -1175,7 +1204,19 @@
audio_source_t source __unused) {
*stream_in = nullptr;
auto* in = new BluetoothStreamIn{};
- if (!in->bluetooth_input_.SetUp(devices)) {
+ if (::aidl::android::hardware::bluetooth::audio::BluetoothAudioSession::
+ IsAidlAvailable()) {
+ in->bluetooth_input_ = std::make_unique<
+ ::android::bluetooth::audio::aidl::BluetoothAudioPortAidlIn>();
+ in->is_aidl = true;
+ } else {
+ in->bluetooth_input_ = std::make_unique<
+ ::android::bluetooth::audio::hidl::BluetoothAudioPortHidlIn>();
+ in->is_aidl = false;
+ }
+ if (!in->bluetooth_input_->SetUp(devices)) {
+ in->bluetooth_input_ = nullptr;
+ LOG(ERROR) << __func__ << ": cannot init HAL";
delete in;
return -EINVAL;
}
@@ -1208,8 +1249,8 @@
in_set_microphone_field_dimension;
in->stream_in_.update_sink_metadata = in_update_sink_metadata;
- if (!in->bluetooth_input_.LoadAudioConfig(config)) {
- LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ if (!in->bluetooth_input_->LoadAudioConfig(config)) {
+ LOG(ERROR) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< " failed to get audio config";
return -EINVAL;
}
@@ -1220,7 +1261,7 @@
// frame is number of samples per channel
size_t preferred_data_interval_us = kBluetoothDefaultInputBufferMs * 1000;
- if (in->bluetooth_input_.GetPreferredDataIntervalUs(
+ if (in->bluetooth_input_->GetPreferredDataIntervalUs(
&preferred_data_interval_us) &&
preferred_data_interval_us != 0) {
in->preferred_data_interval_us = preferred_data_interval_us;
@@ -1233,7 +1274,7 @@
in->frames_presented_ = 0;
*stream_in = &in->stream_in_;
- LOG(INFO) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ LOG(INFO) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", sample_rate=" << in->sample_rate_
<< ", channels=" << StringPrintf("%#x", in->channel_mask_)
<< ", format=" << in->format_
@@ -1247,12 +1288,12 @@
struct audio_stream_in* stream) {
auto* in = reinterpret_cast<BluetoothStreamIn*>(stream);
- if (in->bluetooth_input_.GetState() != BluetoothStreamState::DISABLED) {
- in->bluetooth_input_.Stop();
+ if (in->bluetooth_input_->GetState() != BluetoothStreamState::DISABLED) {
+ in->bluetooth_input_->Stop();
}
- in->bluetooth_input_.TearDown();
- LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_.GetState()
+ in->bluetooth_input_->TearDown();
+ LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState()
<< ", stopped";
delete in;
diff --git a/system/audio_bluetooth_hw/stream_apis.h b/system/audio_bluetooth_hw/stream_apis.h
index cf90281..76845d9 100644
--- a/system/audio_bluetooth_hw/stream_apis.h
+++ b/system/audio_bluetooth_hw/stream_apis.h
@@ -18,9 +18,11 @@
#include <hardware/audio.h>
#include <system/audio.h>
+
#include <list>
#include "device_port_proxy.h"
+#include "device_port_proxy_hidl.h"
constexpr unsigned int kBluetoothDefaultSampleRate = 44100;
constexpr audio_format_t kBluetoothDefaultAudioFormatBitsPerSample =
@@ -52,7 +54,9 @@
// Must be the first member so it can be cast from audio_stream
// or audio_stream_out pointer
audio_stream_out stream_out_{};
- ::android::bluetooth::audio::BluetoothAudioPortOut bluetooth_output_;
+ std::unique_ptr<::android::bluetooth::audio::BluetoothAudioPort>
+ bluetooth_output_;
+ bool is_aidl;
int64_t last_write_time_us_;
// Audio PCM Configs
uint32_t sample_rate_;
@@ -83,7 +87,9 @@
// Must be the first member so it can be cast from audio_stream
// or audio_stream_in pointer
audio_stream_in stream_in_;
- ::android::bluetooth::audio::BluetoothAudioPortIn bluetooth_input_;
+ std::unique_ptr<::android::bluetooth::audio::BluetoothAudioPort>
+ bluetooth_input_;
+ bool is_aidl;
int64_t last_read_time_us_;
// Audio PCM Configs
uint32_t sample_rate_;
diff --git a/system/audio_hal_interface/a2dp_encoding.cc b/system/audio_hal_interface/a2dp_encoding.cc
index f3d15f3..b2cead3 100644
--- a/system/audio_hal_interface/a2dp_encoding.cc
+++ b/system/audio_hal_interface/a2dp_encoding.cc
@@ -138,14 +138,13 @@
}
// Set low latency buffer mode allowed or disallowed
-bool set_audio_low_latency_mode_allowed(bool allowed){
+void set_audio_low_latency_mode_allowed(bool allowed) {
if (HalVersionManager::GetHalTransport() ==
BluetoothAudioHalTransport::HIDL) {
hidl::a2dp::set_low_latency_mode_allowed(allowed);
- return true;
+ return;
}
aidl::a2dp::set_low_latency_mode_allowed(allowed);
- return false;
}
} // namespace a2dp
diff --git a/system/audio_hal_interface/a2dp_encoding.h b/system/audio_hal_interface/a2dp_encoding.h
index 8e149ac..51d5c9f 100644
--- a/system/audio_hal_interface/a2dp_encoding.h
+++ b/system/audio_hal_interface/a2dp_encoding.h
@@ -44,7 +44,7 @@
bool setup_codec();
// Set low latency buffer mode allowed or disallowed
-bool set_audio_low_latency_mode_allowed(bool allowed);
+void set_audio_low_latency_mode_allowed(bool allowed);
// Send command to the BluetoothAudio HAL: StartSession, EndSession,
// StreamStarted, StreamSuspended
diff --git a/system/audio_hal_interface/a2dp_encoding_host.cc b/system/audio_hal_interface/a2dp_encoding_host.cc
index 9ffff8b..b0b6340 100644
--- a/system/audio_hal_interface/a2dp_encoding_host.cc
+++ b/system/audio_hal_interface/a2dp_encoding_host.cc
@@ -244,8 +244,7 @@
remote_delay_report_ = 0;
}
-bool set_audio_low_latency_mode_allowed(bool allowed){
- return true;
+void set_audio_low_latency_mode_allowed(bool allowed){
}
diff --git a/system/audio_hal_interface/aidl/a2dp_encoding.cc b/system/audio_hal_interface/aidl/a2dp_encoding.cc
index 6c280c1..da1cb43 100644
--- a/system/audio_hal_interface/aidl/a2dp_encoding.cc
+++ b/system/audio_hal_interface/aidl/a2dp_encoding.cc
@@ -208,6 +208,7 @@
bool btaudio_a2dp_disabled = false;
bool is_configured = false;
+bool is_low_latency_mode_allowed = false;
BluetoothAudioCtrlAck a2dp_ack_to_bt_audio_ctrl_ack(tA2DP_CTRL_ACK ack) {
switch (ack) {
@@ -470,6 +471,7 @@
LOG(ERROR) << __func__ << ": BluetoothAudio HAL is not enabled";
return;
}
+ active_hal_interface->SetLowLatencyModeAllowed(is_low_latency_mode_allowed);
active_hal_interface->StartSession();
}
@@ -554,6 +556,7 @@
// Set low latency buffer mode allowed or disallowed
void set_low_latency_mode_allowed(bool allowed) {
+ is_low_latency_mode_allowed = allowed;
if (!is_hal_enabled()) {
LOG(ERROR) << __func__ << ": BluetoothAudio HAL is not enabled";
return;
diff --git a/system/audio_hal_interface/aidl/client_interface.cc b/system/audio_hal_interface/aidl/client_interface.cc
index 83900cb..6bf3bd7 100644
--- a/system/audio_hal_interface/aidl/client_interface.cc
+++ b/system/audio_hal_interface/aidl/client_interface.cc
@@ -233,6 +233,7 @@
}
bool BluetoothAudioClientInterface::SetLowLatencyModeAllowed(bool allowed) {
+ is_low_latency_allowed_ = allowed;
if (provider_ == nullptr) {
LOG(INFO) << __func__
<< ": BluetoothAudioHal nullptr";
@@ -266,9 +267,12 @@
std::unique_ptr<DataMQ> data_mq;
DataMQDesc mq_desc;
-
+ std::vector<LatencyMode> latency_modes = {LatencyMode::FREE};
+ if (is_low_latency_allowed_) {
+ latency_modes.push_back(LatencyMode::LOW_LATENCY);
+ }
auto aidl_retval = provider_->startSession(
- stack_if, transport_->GetAudioConfiguration(), &mq_desc);
+ stack_if, transport_->GetAudioConfiguration(), latency_modes, &mq_desc);
if (!aidl_retval.isOk()) {
LOG(FATAL) << __func__ << ": BluetoothAudioHal failure: "
<< aidl_retval.getDescription();
diff --git a/system/audio_hal_interface/aidl/client_interface.h b/system/audio_hal_interface/aidl/client_interface.h
index 752160c..e423585 100644
--- a/system/audio_hal_interface/aidl/client_interface.h
+++ b/system/audio_hal_interface/aidl/client_interface.h
@@ -43,6 +43,7 @@
using ::aidl::android::hardware::bluetooth::audio::IBluetoothAudioProvider;
using ::aidl::android::hardware::bluetooth::audio::
IBluetoothAudioProviderFactory;
+using ::aidl::android::hardware::bluetooth::audio::LatencyMode;
using ::aidl::android::hardware::bluetooth::audio::PcmConfiguration;
using ::aidl::android::hardware::common::fmq::MQDescriptor;
@@ -119,6 +120,7 @@
static inline bool aidl_available = true;
IBluetoothTransportInstance* transport_;
std::vector<AudioCapabilities> capabilities_;
+ bool is_low_latency_allowed_{false};
};
/***
diff --git a/system/audio_hal_interface/fuzzer/Android.bp b/system/audio_hal_interface/fuzzer/Android.bp
index 257df71..5e8238f 100644
--- a/system/audio_hal_interface/fuzzer/Android.bp
+++ b/system/audio_hal_interface/fuzzer/Android.bp
@@ -70,7 +70,6 @@
"libg722codec",
"libudrv-uipc",
"libbt-common",
- "liblc3codec",
"liblc3",
"libstatslog_bt",
"libvndksupport",
diff --git a/system/binder/android/bluetooth/BluetoothDevice.aidl b/system/binder/android/bluetooth/BluetoothDevice.aidl
index b9b0589..49d1803 100644
--- a/system/binder/android/bluetooth/BluetoothDevice.aidl
+++ b/system/binder/android/bluetooth/BluetoothDevice.aidl
@@ -16,4 +16,4 @@
package android.bluetooth;
-parcelable BluetoothDevice cpp_header "android/bluetooth/bluetooth_device.h";
+parcelable BluetoothDevice;
diff --git a/system/binder/android/bluetooth/bluetooth_device.cc b/system/binder/android/bluetooth/bluetooth_device.cc
deleted file mode 100644
index 4247cf9..0000000
--- a/system/binder/android/bluetooth/bluetooth_device.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// Copyright 2017, 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.
-//
-
-#include "android/bluetooth/bluetooth_device.h"
-
-#include <utils/String16.h>
-
-#include "types/raw_address.h"
-
-using android::OK;
-using android::Parcel;
-using android::status_t;
-using android::String16;
-using android::String8;
-
-namespace android {
-namespace bluetooth {
-
-status_t BluetoothDevice::writeToParcel(Parcel* parcel) const {
- status_t status = parcel->writeString16(String16(address.ToString().c_str()));
- return status;
-}
-
-status_t BluetoothDevice::readFromParcel(const Parcel* parcel) {
- String16 tmp;
-
- status_t status = parcel->readString16(&tmp);
- if (status != OK) return status;
-
- RawAddress::FromString(String8(tmp).string(), address);
- return OK;
-}
-
-} // namespace bluetooth
-} // namespace android
diff --git a/system/binder/android/bluetooth/bluetooth_device.h b/system/binder/android/bluetooth/bluetooth_device.h
deleted file mode 100644
index 01bc00a..0000000
--- a/system/binder/android/bluetooth/bluetooth_device.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Copyright 2017, 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.
-//
-
-#pragma once
-
-#include <binder/Parcel.h>
-#include <binder/Parcelable.h>
-
-#include <raw_address.h>
-
-namespace android {
-namespace bluetooth {
-
-class BluetoothDevice : public android::Parcelable {
- public:
- BluetoothDevice() = default;
- ~BluetoothDevice() = default;
-
- // Write |this| parcelable to the given |parcel|. Keep in mind that
- // implementations of writeToParcel must be manually kept in sync
- // with readFromParcel and the Java equivalent versions of these methods.
- //
- // Returns android::OK on success and an appropriate error otherwise.
- android::status_t writeToParcel(android::Parcel* parcel) const override;
-
- // Read data from the given |parcel| into |this|. After readFromParcel
- // completes, |this| should have equivalent state to the object that
- // wrote itself to the parcel.
- //
- // Returns android::OK on success and an appropriate error otherwise.
- android::status_t readFromParcel(const android::Parcel* parcel) override;
-
- RawAddress address;
-};
-
-} // namespace bluetooth
-} // namespace android
diff --git a/system/blueberry/tests/gd/cert/gd_device.py b/system/blueberry/tests/gd/cert/gd_device.py
index 191e7f5..4674905 100644
--- a/system/blueberry/tests/gd/cert/gd_device.py
+++ b/system/blueberry/tests/gd/cert/gd_device.py
@@ -15,6 +15,7 @@
# limitations under the License.
from abc import ABC
+from abc import abstractmethod
from datetime import datetime
import inspect
import logging
@@ -22,7 +23,6 @@
import pathlib
import shutil
import signal
-import socket
import subprocess
import time
from typing import List
@@ -141,6 +141,8 @@
"""
WAIT_CHANNEL_READY_TIMEOUT_SECONDS = 10
+ WAIT_SIGINT_TIMEOUT_SECONDS = 5
+ WAIT_SIGKILL_TIMEOUT_SECONDS = 1
def __init__(self, grpc_port: str, grpc_root_server_port: str, signal_port: str, cmd: List[str], label: str,
type_identifier: str, name: str, verbose_mode: bool):
@@ -279,16 +281,17 @@
self.grpc_channel.close()
if self.grpc_root_server_port != -1:
self.grpc_root_server_channel.close()
- stop_signal = signal.SIGINT
- self.backing_process.send_signal(stop_signal)
+ stop_signal = self.gracefully_stop_backing_process()
try:
- return_code = self.backing_process.wait(timeout=self.WAIT_CHANNEL_READY_TIMEOUT_SECONDS)
- except subprocess.TimeoutExpired:
+ if stop_signal == 0:
+ raise RuntimeError("Failed to gracefully shutdown backing process")
+ return_code = self.backing_process.wait(timeout=self.WAIT_SIGINT_TIMEOUT_SECONDS)
+ except (subprocess.TimeoutExpired, RuntimeError):
logging.error("[%s] Failed to interrupt backing process via SIGINT, sending SIGKILL" % self.label)
stop_signal = signal.SIGKILL
self.backing_process.kill()
try:
- return_code = self.backing_process.wait(timeout=self.WAIT_CHANNEL_READY_TIMEOUT_SECONDS)
+ return_code = self.backing_process.wait(timeout=self.WAIT_SIGKILL_TIMEOUT_SECONDS)
except subprocess.TimeoutExpired:
logging.error("Failed to kill backing process")
return_code = -65536
@@ -303,6 +306,10 @@
except grpc.FutureTimeoutError:
asserts.fail("[%s] wait channel ready timeout" % self.label)
+ @abstractmethod
+ def gracefully_stop_backing_process(self):
+ return NotImplemented
+
class GdHostOnlyDevice(GdDeviceBase):
"""
@@ -443,12 +450,19 @@
logging.warning("[%s] Failed to generated coverage summary, cmd result: %r" % (label, result))
coverage_summary_path.unlink(missing_ok=True)
+ def gracefully_stop_backing_process(self):
+ stop_signal = signal.SIGINT
+ self.backing_process.send_signal(stop_signal)
+ return stop_signal
+
class GdAndroidDevice(GdDeviceBase):
"""Real Android device where the backing process is running on it
"""
WAIT_FOR_DEVICE_TIMEOUT_SECONDS = 180
+ WAIT_FOR_DEVICE_SIGINT_TIMEOUT_SECONDS = 1
+ ADB_ABORT_EXIT_CODE = 134
def __init__(self, grpc_port: str, grpc_root_server_port: str, signal_port: str, cmd: List[str], label: str,
type_identifier: str, name: str, serial_number: str, verbose_mode: bool):
@@ -542,14 +556,14 @@
stop_signal = signal.SIGINT
self.logcat_process.send_signal(stop_signal)
try:
- return_code = self.logcat_process.wait(timeout=self.WAIT_CHANNEL_READY_TIMEOUT_SECONDS)
+ return_code = self.logcat_process.wait(timeout=self.WAIT_FOR_DEVICE_SIGINT_TIMEOUT_SECONDS)
except subprocess.TimeoutExpired:
logging.error("[%s_%s] Failed to interrupt logcat process via SIGINT, sending SIGKILL" %
(self.label, self.serial_number))
stop_signal = signal.SIGKILL
self.logcat_process.kill()
try:
- return_code = self.logcat_process.wait(timeout=self.WAIT_CHANNEL_READY_TIMEOUT_SECONDS)
+ return_code = self.logcat_process.wait(timeout=self.WAIT_SIGKILL_TIMEOUT_SECONDS)
except subprocess.TimeoutExpired:
logging.error("Failed to kill logcat_process %s %s" % (self.label, self.serial_number))
return_code = -65536
@@ -788,3 +802,44 @@
pass
time.sleep(5)
asserts.fail(msg='Device %s booting process timed out.' % self.serial_number)
+
+ def gracefully_stop_backing_process(self):
+ """
+ Gracefully stops backing process
+ :return: expected backing process exit code on success, 0 on error
+ """
+ backing_process_pid = None
+ # Since we do not know which segment of self.cmd is the command running
+ # on the Android device. We have to iterate with trial and error.
+ cmd = self.cmd
+ if len(self.cmd) >= 5:
+ # skip adb -s serial shell to speed up the search
+ # we don't know if any environment variables are set up before the
+ # actual command and hence has to try from the 4th argument
+ cmd = self.cmd[4:] + self.cmd[:4]
+ for segment in cmd:
+ try:
+ # pgrep only takes 16 bytes including null terminator
+ # -f cannot be used because that include the full command args
+ current_cmd = pathlib.Path(segment).stem[:15]
+ # -x matches whole command, cannot avoid as short segment may partially match
+ # -n returnes the newest command matched
+ backing_process_pid = int(self.adb.shell("pgrep -n -x {}".format(current_cmd)))
+ logging.debug("Found backing process name on Android as {}, pid is {}".format(
+ segment, backing_process_pid))
+ except (AdbError, ValueError) as e:
+ logging.debug("Failed to run pgrep {}".format(e))
+ if backing_process_pid is not None:
+ break
+ if backing_process_pid is None:
+ logging.warning("Failed to get pid for cmd {}".format(self.cmd))
+ try:
+ logging.debug(self.adb.shell("ps -A | grep bluetooth"))
+ except AdbError:
+ pass
+ return 0
+ stop_signal = signal.SIGINT
+ self.adb.shell("kill -{} {}".format(stop_signal, backing_process_pid))
+ logging.debug("Sent SIGINT to backing process at pid {}".format(backing_process_pid))
+ stop_signal = -self.ADB_ABORT_EXIT_CODE
+ return stop_signal
diff --git a/system/bta/Android.bp b/system/bta/Android.bp
index 1a2dde5..2fa0b7d 100644
--- a/system/bta/Android.bp
+++ b/system/bta/Android.bp
@@ -644,7 +644,6 @@
"libbt-protos-lite",
"libflatbuffers-cpp",
"libosi",
- "liblc3codec",
"liblc3",
],
data: [
diff --git a/system/bta/csis/csis_client_test.cc b/system/bta/csis/csis_client_test.cc
index f3aaefe..1ad837f 100644
--- a/system/bta/csis/csis_client_test.cc
+++ b/system/bta/csis/csis_client_test.cc
@@ -75,12 +75,12 @@
class MockCsisLockCallback {
public:
MockCsisLockCallback() = default;
+ MockCsisLockCallback(const MockCsisLockCallback&) = delete;
+ MockCsisLockCallback& operator=(const MockCsisLockCallback&) = delete;
+
~MockCsisLockCallback() = default;
MOCK_METHOD((void), CsisGroupLockCb,
(int group_id, bool locked, CsisGroupLockStatus status));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockCsisLockCallback);
};
static MockCsisLockCallback* csis_lock_callback_mock;
@@ -93,6 +93,9 @@
class MockCsisCallbacks : public CsisClientCallbacks {
public:
MockCsisCallbacks() = default;
+ MockCsisCallbacks(const MockCsisCallbacks&) = delete;
+ MockCsisCallbacks& operator=(const MockCsisCallbacks&) = delete;
+
~MockCsisCallbacks() override = default;
MOCK_METHOD((void), OnConnectionState,
@@ -110,9 +113,6 @@
MOCK_METHOD((void), OnGattCsisWriteLockRsp,
(uint16_t conn_id, tGATT_STATUS status, uint16_t handle,
void* data));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockCsisCallbacks);
};
class CsisClientTest : public ::testing::Test {
diff --git a/system/bta/groups/groups_test.cc b/system/bta/groups/groups_test.cc
index 8966284..2299c57 100644
--- a/system/bta/groups/groups_test.cc
+++ b/system/bta/groups/groups_test.cc
@@ -52,6 +52,9 @@
class MockGroupsCallbacks : public DeviceGroupsCallbacks {
public:
MockGroupsCallbacks() = default;
+ MockGroupsCallbacks(const MockGroupsCallbacks&) = delete;
+ MockGroupsCallbacks& operator=(const MockGroupsCallbacks&) = delete;
+
~MockGroupsCallbacks() override = default;
MOCK_METHOD((void), OnGroupAdded,
@@ -69,9 +72,6 @@
(const RawAddress& address, const bluetooth::Uuid& uuid,
int group_id),
(override));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockGroupsCallbacks);
};
class GroupsTest : public ::testing::Test {
diff --git a/system/bta/has/has_client_test.cc b/system/bta/has/has_client_test.cc
index c46e034..5716869 100644
--- a/system/bta/has/has_client_test.cc
+++ b/system/bta/has/has_client_test.cc
@@ -104,6 +104,9 @@
class MockHasCallbacks : public HasClientCallbacks {
public:
MockHasCallbacks() = default;
+ MockHasCallbacks(const MockHasCallbacks&) = delete;
+ MockHasCallbacks& operator=(const MockHasCallbacks&) = delete;
+
~MockHasCallbacks() override = default;
MOCK_METHOD((void), OnConnectionState,
@@ -133,9 +136,6 @@
((std::variant<RawAddress, int> addr_or_group_id),
uint8_t preset_index, ErrorCode error_code),
(override));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockHasCallbacks);
};
class HasClientTestBase : public ::testing::Test {
diff --git a/system/bta/le_audio/broadcaster/broadcaster.cc b/system/bta/le_audio/broadcaster/broadcaster.cc
index 2122fb3..8cd2b3d 100644
--- a/system/bta/le_audio/broadcaster/broadcaster.cc
+++ b/system/bta/le_audio/broadcaster/broadcaster.cc
@@ -134,7 +134,7 @@
.vendor_codec_id = codec_id.vendor_codec_id,
.codec_specific_params = std::move(codec_spec_data),
},
- .metadata = metadata,
+ .metadata = std::move(metadata),
.bis_configs = {},
}};
diff --git a/system/bta/le_audio/broadcaster/mock_ble_advertising_manager.h b/system/bta/le_audio/broadcaster/mock_ble_advertising_manager.h
index ee1d874..eca09c8 100644
--- a/system/bta/le_audio/broadcaster/mock_ble_advertising_manager.h
+++ b/system/bta/le_audio/broadcaster/mock_ble_advertising_manager.h
@@ -27,6 +27,10 @@
class MockBleAdvertisingManager : public BleAdvertisingManager {
public:
MockBleAdvertisingManager() = default;
+ MockBleAdvertisingManager(const MockBleAdvertisingManager&) = delete;
+ MockBleAdvertisingManager& operator=(const MockBleAdvertisingManager&) =
+ delete;
+
~MockBleAdvertisingManager() override = default;
/* Allows getting and setting BleAdvertiserHciInterface dependency */
@@ -99,7 +103,6 @@
(override));
private:
- DISALLOW_COPY_AND_ASSIGN(MockBleAdvertisingManager);
base::WeakPtrFactory<MockBleAdvertisingManager> weak_factory_{this};
BleAdvertiserHciInterface* ble_adv_hci_interface_;
};
diff --git a/system/bta/le_audio/broadcaster/state_machine_test.cc b/system/bta/le_audio/broadcaster/state_machine_test.cc
index d0fc071..a203bca 100644
--- a/system/bta/le_audio/broadcaster/state_machine_test.cc
+++ b/system/bta/le_audio/broadcaster/state_machine_test.cc
@@ -53,6 +53,11 @@
: public IBroadcastStateMachineCallbacks {
public:
MockBroadcastStatMachineCallbacks() = default;
+ MockBroadcastStatMachineCallbacks(const MockBroadcastStatMachineCallbacks&) =
+ delete;
+ MockBroadcastStatMachineCallbacks& operator=(
+ const MockBroadcastStatMachineCallbacks&) = delete;
+
~MockBroadcastStatMachineCallbacks() override = default;
MOCK_METHOD((void), OnStateMachineCreateStatus,
@@ -70,9 +75,6 @@
MOCK_METHOD((uint32_t), GetSduItv, (uint8_t instance_id), (override));
MOCK_METHOD((uint16_t), GetMaxTransportLatency, (uint8_t instance_id),
(override));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockBroadcastStatMachineCallbacks);
};
class StateMachineTest : public Test {
diff --git a/system/bta/le_audio/client.cc b/system/bta/le_audio/client.cc
index 78b7f39..cb5282f 100644
--- a/system/bta/le_audio/client.cc
+++ b/system/bta/le_audio/client.cc
@@ -34,7 +34,6 @@
#include "common/time_util.h"
#include "device/include/controller.h"
#include "devices.h"
-#include "embdrv/lc3_dec/Api/Lc3Decoder.hpp"
#include "embdrv/lc3/include/lc3.h"
#include "gatt/bta_gattc_int.h"
#include "le_audio_types.h"
@@ -175,6 +174,7 @@
current_sink_codec_config({0, 0, 0, 0}),
lc3_encoder_left_mem(nullptr),
lc3_encoder_right_mem(nullptr),
+ lc3_decoder_mem(nullptr),
lc3_decoder(nullptr),
audio_source_instance_(nullptr),
audio_sink_instance_(nullptr),
@@ -2063,8 +2063,21 @@
void SendAudioData(uint8_t* data, uint16_t size) {
/* Get only one channel for MONO microphone */
/* Gather data for channel */
+
+ if ((active_group_id_ == bluetooth::groups::kGroupUnknown) ||
+ (audio_sender_state_ != AudioState::STARTED))
+ return;
+
+ LeAudioDeviceGroup* group = aseGroups_.FindById(active_group_id_);
+ if (!group) {
+ LOG(ERROR) << __func__ << "There is no streaming group available";
+ return;
+ }
+
+ auto stream_conf = group->stream_conf;
+
uint16_t required_for_channel_byte_count =
- lc3_decoder->lc3Config.getByteCountFromBitrate(32000);
+ stream_conf.source_octets_per_codec_frame;
size_t required_byte_count = current_sink_codec_config.num_channels *
required_for_channel_byte_count;
@@ -2074,14 +2087,36 @@
return;
}
- uint8_t BEC_detect = 0;
- std::vector<int16_t> pcm_data_decoded(lc3_decoder->lc3Config.NF, 0);
- auto err = lc3_decoder->run(data, required_for_channel_byte_count, 0,
- pcm_data_decoded.data(),
- pcm_data_decoded.size(), BEC_detect);
+ int dt_us = current_sink_codec_config.data_interval_us;
+ int sr_hz = current_sink_codec_config.sample_rate;
+ int af_hz = audio_framework_sink_config.sample_rate;
+ LOG_ASSERT(af_hz >= sr_hz) << __func__ << " sample freq issue";
+
+ int pitch = af_hz / sr_hz;
+
+ int pcm_size;
+ if (dt_us == 10000) {
+ if (sr_hz == 44100)
+ pcm_size = 480;
+ else
+ pcm_size = sr_hz / 100;
+ } else if (dt_us == 7500) {
+ if (sr_hz == 44100)
+ pcm_size = 360;
+ else
+ pcm_size = (sr_hz * 3) / 400;
+ } else {
+ LOG(ERROR) << "BAD dt_us: " << dt_us;
+ return;
+ }
+
+ std::vector<int16_t> pcm_data_decoded(pcm_size, 0);
+
+ auto err =
+ lc3_decode(lc3_decoder, data, size, pcm_data_decoded.data(), pitch);
/* TODO: How handle failing decoding ? */
- if (err != Lc3Decoder::ERROR_FREE) {
+ if (err < 0) {
LOG(ERROR) << " error while decoding error code: "
<< static_cast<int>(err);
return;
@@ -2093,17 +2128,6 @@
/* TODO: What to do if not all data sinked ? */
if (written != to_write) LOG(ERROR) << __func__ << ", not all data sinked";
-
- DLOG(INFO) << __func__
- << " num of frames: " << (int)lc3_decoder->lc3Config.NF;
- }
-
- static inline Lc3Config::FrameDuration Lc3ConfigFrameDuration(
- uint32_t frame_duration_us) {
- if (frame_duration_us == LeAudioCodecConfiguration::kInterval7500Us)
- return Lc3Config::FrameDuration::d7p5ms;
- else
- return Lc3Config::FrameDuration::d10ms;
}
bool StartSendingAudio(int group_id) {
@@ -2212,12 +2236,18 @@
if (CodecManager::GetInstance()->GetCodecLocation() ==
le_audio::types::CodecLocation::HOST) {
- Lc3Config lc3Config(
- current_sink_codec_config.sample_rate,
- Lc3ConfigFrameDuration(current_sink_codec_config.data_interval_us),
- 1);
+ if (lc3_decoder_mem) {
+ LOG(WARNING)
+ << " The decoder instance should have been already released.";
+ free(lc3_decoder_mem);
+ lc3_decoder_mem = nullptr;
+ }
- lc3_decoder = new Lc3Decoder(lc3Config);
+ int dt_us = current_sink_codec_config.data_interval_us;
+ int sr_hz = current_sink_codec_config.sample_rate;
+ unsigned dec_size = lc3_decoder_size(dt_us, sr_hz);
+ lc3_decoder_mem = malloc(dec_size);
+ lc3_decoder = lc3_setup_decoder(dt_us, sr_hz, lc3_decoder_mem);
} else if (CodecManager::GetInstance()->GetCodecLocation() ==
le_audio::types::CodecLocation::ADSP) {
CodecManager::GetInstance()->UpdateActiveSinkAudioConfig(*stream_conf,
@@ -2240,11 +2270,10 @@
lc3_encoder_right_mem = nullptr;
}
- if (lc3_decoder) {
+ if (lc3_decoder_mem) {
LOG(INFO) << __func__ << " stopping sink";
-
- delete lc3_decoder;
- lc3_decoder = nullptr;
+ free(lc3_decoder_mem);
+ lc3_decoder_mem = nullptr;
}
}
@@ -3097,7 +3126,9 @@
lc3_encoder_t lc3_encoder_left;
lc3_encoder_t lc3_encoder_right;
- Lc3Decoder* lc3_decoder;
+ void* lc3_decoder_mem;
+ lc3_decoder_t lc3_decoder;
+
std::vector<uint8_t> encoded_data;
const void* audio_source_instance_;
const void* audio_sink_instance_;
diff --git a/system/bta/le_audio/mock_codec_manager.h b/system/bta/le_audio/mock_codec_manager.h
index c31b08c..d191a5f 100644
--- a/system/bta/le_audio/mock_codec_manager.h
+++ b/system/bta/le_audio/mock_codec_manager.h
@@ -25,6 +25,9 @@
static MockCodecManager* GetInstance();
MockCodecManager() = default;
+ MockCodecManager(const MockCodecManager&) = delete;
+ MockCodecManager& operator=(const MockCodecManager&) = delete;
+
virtual ~MockCodecManager() = default;
MOCK_METHOD((le_audio::types::CodecLocation), GetCodecLocation, (), (const));
@@ -40,7 +43,4 @@
MOCK_METHOD((void), Start, ());
MOCK_METHOD((void), Stop, ());
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockCodecManager);
};
diff --git a/system/bta/le_audio/mock_iso_manager.h b/system/bta/le_audio/mock_iso_manager.h
index e4a10ab..8db3ade 100644
--- a/system/bta/le_audio/mock_iso_manager.h
+++ b/system/bta/le_audio/mock_iso_manager.h
@@ -26,6 +26,9 @@
static MockIsoManager* GetInstance();
MockIsoManager() = default;
+ MockIsoManager(const MockIsoManager&) = delete;
+ MockIsoManager& operator=(const MockIsoManager&) = delete;
+
virtual ~MockIsoManager() = default;
MOCK_METHOD((void), RegisterCigCallbacks,
@@ -68,7 +71,4 @@
MOCK_METHOD((void), Start, ());
MOCK_METHOD((void), Stop, ());
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockIsoManager);
};
diff --git a/system/bta/le_audio/state_machine_test.cc b/system/bta/le_audio/state_machine_test.cc
index 01ee3a3..aa70073 100644
--- a/system/bta/le_audio/state_machine_test.cc
+++ b/system/bta/le_audio/state_machine_test.cc
@@ -137,14 +137,16 @@
: public LeAudioGroupStateMachine::Callbacks {
public:
MockLeAudioGroupStateMachineCallbacks() = default;
+ MockLeAudioGroupStateMachineCallbacks(
+ const MockLeAudioGroupStateMachineCallbacks&) = delete;
+ MockLeAudioGroupStateMachineCallbacks& operator=(
+ const MockLeAudioGroupStateMachineCallbacks&) = delete;
+
~MockLeAudioGroupStateMachineCallbacks() override = default;
MOCK_METHOD((void), StatusReportCb,
(int group_id, bluetooth::le_audio::GroupStreamStatus status),
(override));
MOCK_METHOD((void), OnStateTransitionTimeout, (int group_id), (override));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockLeAudioGroupStateMachineCallbacks);
};
class StateMachineTest : public Test {
diff --git a/system/bta/vc/vc_test.cc b/system/bta/vc/vc_test.cc
index c4ccaa9..0e52d4a 100644
--- a/system/bta/vc/vc_test.cc
+++ b/system/bta/vc/vc_test.cc
@@ -66,6 +66,10 @@
class MockVolumeControlCallbacks : public VolumeControlCallbacks {
public:
MockVolumeControlCallbacks() = default;
+ MockVolumeControlCallbacks(const MockVolumeControlCallbacks&) = delete;
+ MockVolumeControlCallbacks& operator=(const MockVolumeControlCallbacks&) =
+ delete;
+
~MockVolumeControlCallbacks() override = default;
MOCK_METHOD((void), OnConnectionState,
@@ -75,9 +79,6 @@
(override));
MOCK_METHOD((void), OnGroupVolumeStateChanged,
(int group_id, uint8_t volume, bool mute, bool isAutonomous), (override));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockVolumeControlCallbacks);
};
class VolumeControlTest : public ::testing::Test {
diff --git a/system/btcore/fuzzer/btcore_property_fuzzer.cpp b/system/btcore/fuzzer/btcore_property_fuzzer.cpp
index 0bb0c01..c6bfd44 100644
--- a/system/btcore/fuzzer/btcore_property_fuzzer.cpp
+++ b/system/btcore/fuzzer/btcore_property_fuzzer.cpp
@@ -58,8 +58,8 @@
property_free(property);
uint32_t timeout = mFdp->ConsumeIntegral<uint32_t>();
- property = property_new_discovery_timeout(timeout);
- (void)property_as_discovery_timeout(property);
+ property = property_new_discoverable_timeout(timeout);
+ (void)property_as_discoverable_timeout(property);
property_free(property);
std::string name = mFdp->ConsumeRandomLengthString(kRandomStringLength);
diff --git a/system/btcore/include/property.h b/system/btcore/include/property.h
index 73d4d41..2ef94e7 100644
--- a/system/btcore/include/property.h
+++ b/system/btcore/include/property.h
@@ -46,7 +46,7 @@
bt_property_t* property_new_addr(const RawAddress* addr);
bt_property_t* property_new_device_class(const bt_device_class_t* dc);
bt_property_t* property_new_device_type(bt_device_type_t device_type);
-bt_property_t* property_new_discovery_timeout(const uint32_t timeout);
+bt_property_t* property_new_discoverable_timeout(const uint32_t timeout);
bt_property_t* property_new_name(const char* name);
bt_property_t* property_new_rssi(const int8_t rssi);
bt_property_t* property_new_scan_mode(bt_scan_mode_t scan_mode);
@@ -62,7 +62,7 @@
bool property_is_addr(const bt_property_t* property);
bool property_is_device_class(const bt_property_t* property);
bool property_is_device_type(const bt_property_t* property);
-bool property_is_discovery_timeout(const bt_property_t* property);
+bool property_is_discoverable_timeout(const bt_property_t* property);
bool property_is_name(const bt_property_t* property);
bool property_is_rssi(const bt_property_t* property);
bool property_is_scan_mode(const bt_property_t* property);
@@ -74,7 +74,7 @@
const bt_device_class_t* property_as_device_class(
const bt_property_t* property);
bt_device_type_t property_as_device_type(const bt_property_t* property);
-uint32_t property_as_discovery_timeout(const bt_property_t* property);
+uint32_t property_as_discoverable_timeout(const bt_property_t* property);
const bt_bdname_t* property_as_name(const bt_property_t* property);
int8_t property_as_rssi(const bt_property_t* property);
bt_scan_mode_t property_as_scan_mode(const bt_property_t* property);
diff --git a/system/btcore/src/property.cc b/system/btcore/src/property.cc
index 7b5a303..94679e9 100644
--- a/system/btcore/src/property.cc
+++ b/system/btcore/src/property.cc
@@ -98,9 +98,9 @@
BT_PROPERTY_TYPE_OF_DEVICE);
}
-bt_property_t* property_new_discovery_timeout(const uint32_t timeout) {
+bt_property_t* property_new_discoverable_timeout(const uint32_t timeout) {
return property_new_((void*)&timeout, sizeof(uint32_t),
- BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT);
+ BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT);
}
bt_property_t* property_new_name(const char* name) {
@@ -151,9 +151,9 @@
return property->type == BT_PROPERTY_TYPE_OF_DEVICE;
}
-bool property_is_discovery_timeout(const bt_property_t* property) {
+bool property_is_discoverable_timeout(const bt_property_t* property) {
CHECK(property != NULL);
- return property->type == BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT;
+ return property->type == BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT;
}
bool property_is_name(const bt_property_t* property) {
@@ -193,8 +193,8 @@
return *(const bt_device_type_t*)property->val;
}
-uint32_t property_as_discovery_timeout(const bt_property_t* property) {
- CHECK(property_is_discovery_timeout(property));
+uint32_t property_as_discoverable_timeout(const bt_property_t* property) {
+ CHECK(property_is_discoverable_timeout(property));
return *(const uint32_t*)property->val;
}
diff --git a/system/btcore/test/property_test.cc b/system/btcore/test/property_test.cc
index ee8ed22..4e24e0d 100644
--- a/system/btcore/test/property_test.cc
+++ b/system/btcore/test/property_test.cc
@@ -81,13 +81,13 @@
TEST_F(PropertyTest, discovery_timeout) {
uint32_t timeout0 = 12345;
- bt_property_t* property = property_new_discovery_timeout(timeout0);
+ bt_property_t* property = property_new_discoverable_timeout(timeout0);
EXPECT_EQ(timeout0, *(uint32_t*)property->val);
- EXPECT_EQ(BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, property->type);
+ EXPECT_EQ(BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT, property->type);
EXPECT_EQ((int)sizeof(uint32_t), property->len);
- uint32_t timeout1 = property_as_discovery_timeout(property);
+ uint32_t timeout1 = property_as_discoverable_timeout(property);
EXPECT_EQ(timeout0, timeout1);
property_free(property);
diff --git a/system/btif/Android.bp b/system/btif/Android.bp
index 92f14ea..d46119f 100644
--- a/system/btif/Android.bp
+++ b/system/btif/Android.bp
@@ -247,7 +247,6 @@
"libbt-utils",
"libFraunhoferAAC",
"libg722codec",
- "liblc3codec",
"liblc3",
"libbtdevice",
"libbt-hci",
diff --git a/system/btif/src/bluetooth.cc b/system/btif/src/bluetooth.cc
index 3f4791f..e76c617 100644
--- a/system/btif/src/bluetooth.cc
+++ b/system/btif/src/bluetooth.cc
@@ -262,7 +262,7 @@
switch (property->type) {
case BT_PROPERTY_BDNAME:
case BT_PROPERTY_ADAPTER_SCAN_MODE:
- case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
+ case BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT:
case BT_PROPERTY_CLASS_OF_DEVICE:
case BT_PROPERTY_LOCAL_IO_CAPS:
case BT_PROPERTY_LOCAL_IO_CAPS_BLE:
@@ -628,7 +628,8 @@
static bool allow_low_latency_audio(bool allowed, const RawAddress& address) {
LOG_INFO("%s %s", __func__, allowed ? "true" : "false");
- return bluetooth::audio::a2dp::set_audio_low_latency_mode_allowed(allowed);
+ bluetooth::audio::a2dp::set_audio_low_latency_mode_allowed(allowed);
+ return true;
}
EXPORT_SYMBOL bt_interface_t bluetoothInterface = {
diff --git a/system/btif/src/btif_core.cc b/system/btif/src/btif_core.cc
index 87dd06b..bdcf66e 100644
--- a/system/btif/src/btif_core.cc
+++ b/system/btif/src/btif_core.cc
@@ -439,7 +439,7 @@
/* DISC_TIMEOUT */
BTIF_STORAGE_FILL_PROPERTY(&properties[num_props],
- BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
+ BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT,
sizeof(disc_timeout), &disc_timeout);
btif_storage_get_adapter_property(&properties[num_props]);
num_props++;
@@ -721,7 +721,7 @@
btif_core_storage_adapter_write(property);
}
} break;
- case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT: {
+ case BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT: {
/* Nothing to do beside store the value in NV. Java
will change the SCAN_MODE property after setting timeout,
if required */
diff --git a/system/btif/src/btif_dm.cc b/system/btif/src/btif_dm.cc
index 245657e..c427f50 100644
--- a/system/btif/src/btif_dm.cc
+++ b/system/btif/src/btif_dm.cc
@@ -2180,7 +2180,7 @@
prop->len = sizeof(bt_scan_mode_t);
} break;
- case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT: {
+ case BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT: {
uint32_t* tmt = (uint32_t*)prop->val;
*tmt = 120; /* default to 120s, if not found in NV */
prop->len = sizeof(uint32_t);
diff --git a/system/btif/src/btif_storage.cc b/system/btif/src/btif_storage.cc
index 7838f9e..1f130d7 100644
--- a/system/btif/src/btif_storage.cc
+++ b/system/btif/src/btif_storage.cc
@@ -248,7 +248,7 @@
btif_config_set_int("Adapter", BTIF_STORAGE_KEY_LOCAL_IO_CAPS_BLE,
*(int*)prop->val);
break;
- case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
+ case BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT:
btif_config_set_int("Adapter", BTIF_STORAGE_KEY_ADAPTER_DISC_TIMEOUT,
*(int*)prop->val);
break;
@@ -358,7 +358,7 @@
(int*)prop->val);
break;
- case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
+ case BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT:
if (prop->len >= (int)sizeof(int))
ret = btif_config_get_int(
"Adapter", BTIF_STORAGE_KEY_ADAPTER_DISC_TIMEOUT, (int*)prop->val);
@@ -1040,9 +1040,9 @@
num_props++;
/* DISC_TIMEOUT */
- BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
- &disc_timeout, sizeof(disc_timeout),
- adapter_props[num_props]);
+ BTIF_STORAGE_GET_ADAPTER_PROP(
+ status, BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT, &disc_timeout,
+ sizeof(disc_timeout), adapter_props[num_props]);
num_props++;
/* BONDED_DEVICES */
diff --git a/system/btif/src/btif_util.cc b/system/btif/src/btif_util.cc
index 86307bc..bcd0ef9 100644
--- a/system/btif/src/btif_util.cc
+++ b/system/btif/src/btif_util.cc
@@ -129,7 +129,7 @@
CASE_RETURN_STR(BT_PROPERTY_CLASS_OF_DEVICE)
CASE_RETURN_STR(BT_PROPERTY_TYPE_OF_DEVICE)
CASE_RETURN_STR(BT_PROPERTY_REMOTE_RSSI)
- CASE_RETURN_STR(BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT)
+ CASE_RETURN_STR(BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT)
CASE_RETURN_STR(BT_PROPERTY_ADAPTER_BONDED_DEVICES)
CASE_RETURN_STR(BT_PROPERTY_ADAPTER_SCAN_MODE)
CASE_RETURN_STR(BT_PROPERTY_REMOTE_FRIENDLY_NAME)
diff --git a/system/common/message_loop_thread.h b/system/common/message_loop_thread.h
index 7420dbc..ece1d0f 100644
--- a/system/common/message_loop_thread.h
+++ b/system/common/message_loop_thread.h
@@ -48,6 +48,9 @@
explicit MessageLoopThread(const std::string& thread_name);
explicit MessageLoopThread(const std::string& thread_name, bool is_main);
+ MessageLoopThread(const MessageLoopThread&) = delete;
+ MessageLoopThread& operator=(const MessageLoopThread&) = delete;
+
/**
* Destroys the message loop thread automatically when it goes out of scope
*/
@@ -199,8 +202,6 @@
bool shutting_down_;
bool is_main_;
::rust::Box<shim::rust::MessageLoopThread>* rust_thread_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(MessageLoopThread);
};
inline std::ostream& operator<<(std::ostream& os,
diff --git a/system/common/once_timer.h b/system/common/once_timer.h
index ca7185d..d708ed9 100644
--- a/system/common/once_timer.h
+++ b/system/common/once_timer.h
@@ -39,6 +39,9 @@
class OnceTimer final {
public:
OnceTimer() {}
+ OnceTimer(const OnceTimer&) = delete;
+ OnceTimer& operator=(const OnceTimer&) = delete;
+
~OnceTimer();
/**
@@ -84,8 +87,6 @@
void CancelClosure(std::promise<void> promise);
void RunTask();
-
- DISALLOW_COPY_AND_ASSIGN(OnceTimer);
};
} // namespace common
diff --git a/system/common/repeating_timer.h b/system/common/repeating_timer.h
index 24eae67..5c2c9e3 100644
--- a/system/common/repeating_timer.h
+++ b/system/common/repeating_timer.h
@@ -39,6 +39,9 @@
class RepeatingTimer final {
public:
RepeatingTimer() : expected_time_next_task_us_(0) {}
+ RepeatingTimer(const RepeatingTimer&) = delete;
+ RepeatingTimer& operator=(const RepeatingTimer&) = delete;
+
~RepeatingTimer();
/**
@@ -85,8 +88,6 @@
void CancelClosure(std::promise<void> promise);
void RunTask();
-
- DISALLOW_COPY_AND_ASSIGN(RepeatingTimer);
};
} // namespace common
diff --git a/system/embdrv/lc3/src/bits.h b/system/embdrv/lc3/src/bits.h
index d1fc450..388bba1 100644
--- a/system/embdrv/lc3/src/bits.h
+++ b/system/embdrv/lc3/src/bits.h
@@ -292,7 +292,7 @@
if (ac->error)
ac->low = 0;
- unsigned s = 16;
+ int s = 16;
if (ac->low < range * symbols[s].low) {
s >>= 1;
diff --git a/system/embdrv/lc3/src/tns.c b/system/embdrv/lc3/src/tns.c
index 0ddd72c..8545d78 100644
--- a/system/embdrv/lc3/src/tns.c
+++ b/system/embdrv/lc3/src/tns.c
@@ -448,7 +448,7 @@
lc3_tns_order_models + data->lpc_weighting);
for (int i = 0; i < data->rc_order[f]; i++)
- data->rc[f][i] = lc3_get_symbol(bits,
+ data->rc[f][i] = (int)lc3_get_symbol(bits,
lc3_tns_coeffs_models + i) - 8;
}
}
diff --git a/system/embdrv/lc3_dec/Android.bp b/system/embdrv/lc3_dec/Android.bp
deleted file mode 100644
index 36c4099..0000000
--- a/system/embdrv/lc3_dec/Android.bp
+++ /dev/null
@@ -1,69 +0,0 @@
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "system_bt_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["system_bt_license"],
-}
-
-cc_library_static {
- name: "liblc3codec",
- host_supported: true,
- apex_available: [
-
- "//apex_available:platform",
- "com.android.bluetooth"
- ],
- defaults: ["fluoride_defaults"],
- srcs: [
- "Common/*.cpp",
- "Common/fft/*.c",
- "Common/Tables/*.cpp",
- "Decoder/*.cpp",
- "TestSupport/DatapointsAndroid.cpp",
- ],
- cflags: [
- "-Werror",
- "-Wmissing-braces",
- "-Wno-unused-parameter",
- "-Wno-#warnings",
- "-Wuninitialized",
- "-Wno-self-assign",
- "-Wno-implicit-fallthrough",
- ],
- target: {
- android: {
- sanitize: {
- misc_undefined:[
- "unsigned-integer-overflow",
- "signed-integer-overflow",
- "bounds",
- ],
- cfi: true,
- },
- },
- },
- shared_libs: [
- "liblog",
- ],
- export_include_dirs: [
- "Api",
- "Common",
- "Common/fft",
- "Common/Tables",
- "TestSupport",
- ],
-}
-
-cc_fuzz {
- name: "liblc3codec_decoder_fuzzer",
-
- srcs: [
- "fuzzer/liblc3codec_decoder_fuzzer.cpp",
- ],
-
- static_libs: [
- "liblc3codec",
- ],
-}
\ No newline at end of file
diff --git a/system/embdrv/lc3_dec/Api/Lc3Config.hpp b/system/embdrv/lc3_dec/Api/Lc3Config.hpp
deleted file mode 100644
index 9446905..0000000
--- a/system/embdrv/lc3_dec/Api/Lc3Config.hpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Lc3Config.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef __LC3_CONFIG_HPP_
-#define __LC3_CONFIG_HPP_
-
-#include <cstdint>
-
-/*
- * The LC3 encoder and decoder have a common set of essential session
- * configuration parameters - see LC3 specification Sections 2.2 "Encoder
- * interfaces" and Section 2.4 "Decoder interfaces" (dr09r07). The set of common
- * session configuration parameters is represented by an instance of class
- * Lc3Config.
- *
- * Lc3Config is designed such that all parameters need to be
- * providing when constructing an instance. Afterwards, success of creation,
- * the actual parameter values, and derived parameter values are provided
- * by corresponding const getter methods or public const fields.
- *
- * When parameters need to be changes, a new instance of Lc3Config has to be
- * created.
- *
- * Instances of Lc3Config are provided to instances of Lc3Encoder and Lc3Decoder
- * when constructing them.
- *
- * The main purpose of Lc3Config is to verify and handle common LC3 session
- * configuration parameters in a consistent way.
- *
- */
-class Lc3Config {
- public:
- /*
- * Enumeration of supported frame durations N_ms = 7.5ms and N_ms = 10ms.
- *
- * Note: although the LC3 specification describes frame duration N_ms as
- * a parameter with floating point values 7.5 and 10.0, we decided
- * to make this parameter a discrete enumeration of supported
- * frame durations. There are too many codec parts that need
- * specifically listed constants dependent on the configured
- * frame duration, so that it never will be possible to chose from a
- * larger set of floating point values for N_ms.
- * Making the data type of N_ms an enumeration supports
- * straight forwards verification that meaningful parameters are given.
- */
- enum class FrameDuration { d10ms, d7p5ms };
-
- // configuration error (see "getErrorStatus")
- static const uint8_t ERROR_FREE = 0x00;
- static const uint8_t INVALID_SAMPLING_RATE = 0x01;
- static const uint8_t INVALID_FRAME_DURATION = 0x02;
- static const uint8_t INVALID_NUMBER_OF_CHANNELS = 0x04;
-
- /*
- * Constructor of an instance of Lc3Config
- * Parameters:
- * (see also see LC3 specification Sections 2.2 "Encoder interfaces"
- * and Section 2.4 "Decoder interfaces" (dr09r07) )
- *
- * Fs_ : Sampling frequency in Hz -> defines public constant Fs
- * Supported values are
- * 8000 Hz
- * 16000 Hz
- * 24000 Hz
- * 32000 Hz
- * 44100 Hz
- * 48000 Hz
- *
- * N_ms_ : Frame duration given by value from enumeration FrameDuration (see
- * above)
- * -> defines public constant N_ms
- * Supported values see enumeration FrameDuration.
- *
- * Nc_ : Number of channels -> defines public constant Nc
- * Supported values are Nc > 0 and Nc < 256 such that device
- * resources are not exhausted. Notes:
- * - Exhausting device resources can mean that there is not enough
- * memory to instantiate the corresponding number of encoders and/or decoders,
- * but also that computing the encoders and/or decoders in real-time is not
- * possible.
- * - The parameter N_c_max described in the LC3 specifciation is
- * not given here, since there is too little knowledge on the target devices
- * where this code may be used.
- *
- */
- Lc3Config(uint16_t Fs_, FrameDuration N_ms_, uint8_t Nc_);
-
- // no default constructor supported
- Lc3Config() = delete;
-
- // Destructor
- virtual ~Lc3Config();
-
- /*
- * Getter "isValid" provides a convenience function that returns true when an
- * instance of Lc3Config could be created without error.
- */
- bool isValid() const;
-
- /*
- * Getter "getErrorStatus" provides details on the success of instantiating
- * Lc3Config. The possible return values are listed as constants in this class
- * (see configuration error constants above)
- */
- uint8_t getErrorStatus() const;
-
- /*
- * Getter "getByteCountFromBitrate" provides the number of bytes available in
- * one encoded frame of one channel (see "nbytes" as described in
- * Section 3.2.5 "Bit budget and bitrate" (dr09r07) )
- *
- * The number of bytes "nbytes" to use for encoding a single channel is a
- * required external input to each single channel LC3 encoder. The same number
- * of bytes (now to be used for decoding) is also a required external input to
- * each single channel LC3 decoder. The corresponding number of bits available
- * in one frame is thus "nbits 8*nbytes". The codec works on a byte boundary,
- * i.e. the variable "nbytes" shall be an integer number. A certain "bitrate"
- * can be converted to a number of bytes "nbytes" where the number of bytes is
- * rounded towards the nearest lower integer.
- *
- * The algorithm is verified from the bitrate corresponding to
- * nbytes = 20 up to the bitrate corresponding to
- * nbytes = 400 per channel for all sampling rates.
- * The LC3 specification does not specify or recommend what bitrate to use for
- * encoding a frame of audio samples. This is specified by the profiles making
- * use of the LC3.
- */
- uint16_t getByteCountFromBitrate(
- uint32_t bitrate) const; // meant for a single channel
-
- /*
- * Getter "getBitrateFromByteCount" provides the bitrate of the codec in bits
- * per second of one channel (see Section 3.2.5 "Bit budget and bitrate"
- * (dr1.0r03) )
- *
- * This is a convenience utility and not directly used by the LC3
- * implementation.
- *
- * The bitrate of the codec in bits per second is
- * "bitrate = ceil(nbits / frame_duration) = ceil(nbits*Fs/NF) =
- * ceil(8*nbytes*Fs/NF)".
- *
- * The LC3 specification does not specify or recommend what bitrate to use for
- * encoding a frame of audio samples. This is specified by the profiles making
- * use of the LC3.
- */
- uint32_t getBitrateFromByteCount(uint16_t nbytes) const;
-
- /*
- * Getter "getFscal" provides a utility used within the LC3 implementation
- * for easier parameter mapping when Fs == 44100
- * (see Section 3.2.2 "Sampling rates" (dr1.0r03) )
- */
- double getFscal() const;
-
- /*
- * Getter "getNmsValue" provides a utility used within the LC3 implementation
- * that converts FrameDuration N_ms enumeration values to duration values in
- * milliseconds.
- */
- double getNmsValue() const;
-
- private:
- // internal utilities used for verifying the given input parameters and
- // computing derived parameters
- uint8_t getFs_ind(uint16_t Fs);
- uint16_t getNF(uint16_t Fs, FrameDuration N_ms);
- uint16_t getNE(uint16_t NF, FrameDuration N_ms);
-
- // errors status set during construction and returned by getErrorStatus()
- uint8_t errorStatus;
-
- public:
- // configuration details -> see also Section 3.1.2 "Mathematical symbols"
- // (dr09r07)
- const uint16_t Fs; // Sampling rate (in Hz)
- const uint8_t Fs_ind; // Sampling rate index (see also Section 3.2.2
- // "Sampling rates" (dr09r07)
- const FrameDuration N_ms; // Frame duration -> see Lc3Config constructor
- // documentation Note: that the actual frame
- // duration is longer by a factor of 480/441
- // if the sampling rate is 44100 Hz
- const uint16_t NF; // Number of samples processed in one frame of one channel
- // (also known as frame size)
- const uint16_t
- NE; // Number of encoded spectral lines (per frame and channel)
- const uint16_t Z; // Number of leading zeros in MDCT window
- const uint8_t Nc; // Number of channels
- const uint8_t N_b; // Number of bands
-};
-
-#endif // __LC3_CONFIG_HPP_
diff --git a/system/embdrv/lc3_dec/Api/Lc3Decoder.hpp b/system/embdrv/lc3_dec/Api/Lc3Decoder.hpp
deleted file mode 100644
index aec64fe..0000000
--- a/system/embdrv/lc3_dec/Api/Lc3Decoder.hpp
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Lc3Decoder.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef API_LC3DECODER_HPP_
-#define API_LC3DECODER_HPP_
-
-#include <cstdint>
-#include <vector>
-
-#include "Lc3Config.hpp"
-
-/*
- * Forward declaration of the "internal" class DecoderTop, so
- * that the private vector of single channel decoders can be declared in
- * Lc3Decoder.
- */
-namespace Lc3Dec {
-class DecoderTop;
-}
-
-/*
- * The LC3 decoder interface is specified in
- * LC3 specification Sections 2.4 "Decoder interfaces" (dr09r07).
- *
- * Lc3Decoder is designed such that all specified features are provided.
- *
- * In contrast to the Lc3Encoder, even 24bit and 32bit decoded audio
- * data can be provided - however in one fix byte arrangement which will
- * not meet all meaningful options. Providing 24bit and 32bit decoded audio
- * data makes the API more complex but does not increase the needed
- * resources when basic 16bit/sample audio data is desired only.
- *
- * Instantiating Lc3Decoder implies providing a Lc3Config instance. A copy of
- * this instance is available as public const member so that all essential
- * session parameters can be obtained throughout the lifetime of the Lc3Decoder
- * instance.
- *
- * There is no possibility of changing Lc3Config within Lc3Decoder. When session
- * parameters have to be changed, the calling application has to create a new
- * instance of Lc3Decoder.
- *
- * Lc3 supports operation with variable encoded bitrate. It is possible to
- * change the bitrate from frame to frame, where for preciseness the parameter
- * is not given as bitrate directly but in terms of the byte_count per frame.
- * This parameter has to be in the range of 20 to 400 (see LC3 specification
- * Section 3.2.5 "Bit budget and bitrate"). LC3 specification Sections 2.4
- * "Decoder interfaces" specifies "byte_count_max" of the decoder to allow
- * pre-allocation of resources. This parameter is provided here for completeness
- * and used for verifying the byte_count value of individual frames only. The
- * needed memory has to be provided by the calling application anyway, so that
- * it is up to the application whether a pre-allocation of memory is useful.
- *
- */
-
-class Lc3Decoder {
- public:
- /*
- * Convenience constructor of Lc3Decoder with two simple parameter only.
- * Note that this constructor instantiated Lc3Config implicitly with
- * Lc3Decoder(Lc3Config(Fs,frameDuration, 1)) that means that this
- * constructor provides processing of one channel (mono) and 16bit/sample
- * PCM output only.
- *
- * Parameters:
- * Fs : Sampling frequency in Hz -> see Lc3Config.hpp for supported values
- *
- * frameDuration : frame duration of 10ms (default) or 7.5ms
- * -> see Lc3Config.hpp for more details
- */
- Lc3Decoder(uint16_t Fs, Lc3Config::FrameDuration frameDuration =
- Lc3Config::FrameDuration::d10ms);
-
- /*
- * General constructor of Lc3Decoder.
- *
- * Parameters:
- * lc3Config_ : instance of Lc3Config. See documentation of Lc3Config for
- * more details. Note: providing an invalid instance of Lc3Config will result
- * in skipping any processing later.
- * The provided instance of Lc3Config will be copied to the
- * public field "lc3Config" (see below).
- *
- * bits_per_audio_sample_dec_ : Bits per audio sample for the output PCM
- * signal. See LC3 specification Section 2.4 "Decoder interfaces" and
- * Section 3.2.3 "Bits per sample" for the general LC3 requirement to support
- * 16, 24 and 32 bit. Note: This parameter may differ from the encoder input
- * PCM setting "bits_per_audio_sample_enc".
- *
- * byte_count_max_dec_ : Maximum allowed payload byte_count for a single
- * channel. When using and allowing external rate control, the maximum byte
- * count for the session may be used to configure the
- * session buffers without a need to dynamically reallocate memory during the
- * session.
- *
- * datapoints : pointer to an instance of a class allowing to collect internal
- * data. Note: this feature is used and prepared for testing of the codec
- * implementation only. See general "Readme.txt"
- */
- Lc3Decoder(Lc3Config lc3Config_, uint8_t bits_per_audio_sample_dec_ = 16,
- uint16_t byte_count_max_dec_ = 400, void* datapoints = nullptr);
-
- // no default constructor supported
- Lc3Decoder() = delete;
-
- // Destructor
- virtual ~Lc3Decoder();
-
- /*
- * Configuration provided during instantiation accessible as public const
- * fields. Note: Lc3Config provides a getter to check whether the
- * configuration is valid.
- */
- const Lc3Config lc3Config;
- const uint8_t bits_per_audio_sample_dec;
- const uint16_t byte_count_max_dec;
-
- // encoding error (see return values of "run" methods)
- static const uint8_t ERROR_FREE = 0x00;
- static const uint8_t INVALID_CONFIGURATION = 0x01;
- static const uint8_t INVALID_BYTE_COUNT = 0x02;
- static const uint8_t INVALID_X_OUT_SIZE = 0x03;
- static const uint8_t INVALID_BITS_PER_AUDIO_SAMPLE = 0x04;
- static const uint8_t DECODER_ALLOCATION_ERROR = 0x05;
-
- /*
- * Decoding one 16 bit/sample output frame for one channel
- *
- * Note that this methods returns the error INVALID_BITS_PER_AUDIO_SAMPLE
- * when the session has been configured for any bits_per_audio_sample_dec
- * != 16.
- *
- * Further, note that this method can be used for multi-channel configurations
- * as well, particularly when the provided multi-channel "run" (see below) is
- * not supporting the kind of byte stream concatenation existing in the
- * calling application.
- *
- * Parameters:
- * bytes : pointer to byte array holding the input LC3 encoded byte stream
- * of the given channel.
- * The size of this memory is given by the byte_count parameter.
- *
- * byte_count : number of encoded bytes; byte count to be used for decoding
- * the received frame payload.
- * Supported values are 20 bytes to byte_count_max_dec bytes.
- *
- * BFI : Bad Frame Indication flags
- * "0" signifies that no bit errors where detected in given "bytes"
- * "1" signifies a corrupt payload packet was detected in given
- * "bytes"
- *
- * x_out : pointer to output PCM data (16 bit/sample), where the memory
- * has to be provided by the calling application.
- *
- * x_out_size : number of 16 bit values supported by x_out
- * Note: this parameter has been introduced for clarity and
- * verification purpose only. The method will return
- * the error INVALID_X_OUT_SIZE when x_out_size !=
- * lc3Config.NF.
- *
- * BEC_detect : flag indication bit errors detected during decoding of input
- * bytes Note: a basic packet loss concealment (PLC) will be applied when
- * BEC_detect!=0, so that the returned audio data stays
- * somewhat acceptable.
- *
- * channelNr : index of channel to be processed (default=0), where channelNr
- * < lc3Config.Nc
- *
- *
- * Return value: error code as listed above.
- */
- uint8_t run(const uint8_t* bytes, uint16_t byte_count, uint8_t BFI,
- int16_t* x_out, uint16_t x_out_size, uint8_t& BEC_detect,
- uint8_t channelNr = 0);
-
- /*
- * Decoding one 16, 24, or 32 bit/sample output frame for one channel
- *
- * Note that every output PCM sample will need one 32 bit memory place in the
- * output stream independently from the configured bits_per_audio_sample_dec.
- *
- * Further, note that this method can be used for multi-channel configurations
- * as well, particularly when the provided multi-channel "run" (see below) is
- * not supporting the kind of byte stream concatenation existing in the
- * calling application.
- *
- * Parameters:
- * bytes : pointer to byte array holding the input LC3 encoded byte stream
- * of the given channel.
- * The size of this memory is given by the byte_count parameter.
- *
- * byte_count : number of encoded bytes; byte count to be used for decoding
- * the received frame payload.
- * Supported values are 20 bytes to byte_count_max_dec bytes.
- *
- * BFI : Bad Frame Indication flags
- * "0" signifies that no bit errors where detected in given "bytes"
- * "1" signifies a corrupt payload packet was detected in given
- * "bytes"
- *
- * x_out : pointer to output PCM data (memory 32 bit/sample, precision 16
- * bit/sample, 24 bit/sample or 32 bit/sample), where the memory has to be
- * provided by the calling application.
- *
- * x_out_size : number of 32 bit values supported by x_out
- * Note: this parameter has been introduced for clarity and
- * verification purpose only. The method will return
- * the error INVALID_X_OUT_SIZE when x_out_size !=
- * lc3Config.NF.
- *
- * BEC_detect : flag indication bit errors detected during decoding of input
- * bytes Note: a basic packet loss concealment (PLC) will be applied when
- * BEC_detect!=0, so that the returned audio data stays
- * somewhat acceptable.
- *
- * channelNr : index of channel to be processed (default=0), where channelNr
- * < lc3Config.Nc
- *
- *
- * Return value: error code as listed above.
- */
- uint8_t run(const uint8_t* bytes, uint16_t byte_count, uint8_t BFI,
- int32_t* x_out, uint16_t x_out_size, uint8_t& BEC_detect,
- uint8_t channelNr = 0);
-
- /*
- * Decoding one 16 bit/sample output frame for multiple channels.
- *
- * Note that this methods returns the error INVALID_BITS_PER_AUDIO_SAMPLE
- * when the session has been configured for any bits_per_audio_sample_dec
- * != 16.
- *
- * Parameters:
- * bytes : pointer to byte array holding the input LC3 encoded byte stream
- * of all given channels.
- * The size of this memory is given by the sum of all
- * byte_count_per_channel values (see parameter byte_count_per_channel). Note
- * that the encoded values of all channels are expected to be concatenated
- * without any stuffing bytes of meta data in between.
- *
- * byte_count_per_channel : number of encoded bytes; byte count to be used
- * for decoding the received frame payload per channel. Thus,
- * byte_count_per_channel is an array of byte_count values with length
- * lc3Conig.Nc Supported values are 20 bytes to byte_count_max_dec bytes per
- * channel.
- *
- * BFI_per_channel : lc3Conig.Nc length array of Bad Frame Indication flags
- * "0" signifies that no bit errors where detected in
- * given "bytes" "1" signifies a corrupt payload packet was detected in given
- * "bytes"
- *
- * x_out : pointer to output 16 bit/sample PCM data, where the memory
- * has to be provided by the calling application.
- *
- * x_out_size : number of 16 bit values supported by x_out
- * Note: this parameter has been introduced for clarity and
- * verification purpose only. The method will return
- * the error INVALID_X_OUT_SIZE when x_out_size !=
- * lc3Config.NF * lc3Conig.Nc.
- *
- * BEC_detect_per_channel : lc3Conig.Nc length array of flags indicating bit
- * errors detected during decoding of input bytes of a certain channel. Note:
- * a basic packet loss concealment (PLC) will be applied when BEC_detect!=0,
- * so that the returned audio data stays somewhat acceptable.
- *
- *
- * Return value: error code via "or" concatenation of the error codes of
- * processing the individual channels. Note: this "or" concatenation make
- * specific error diagnosis impossible. Thus only checking != ERROR_FREE is
- * meaningful. When more specific information is needed, the single channel
- * call (see above) need to be called.
- */
- uint8_t run(const uint8_t* bytes, const uint16_t* byte_count_per_channel,
- const uint8_t* BFI_per_channel, int16_t* x_out,
- uint32_t x_out_size, uint8_t* BEC_detect_per_channel);
-
- /*
- * Decoding one 16, 24, or 32 bit/sample output frame for multiple channels
- *
- * Note that every output PCM sample will need one 32 bit memory place in the
- * output stream independently from the configured bits_per_audio_sample_dec.
- *
- * Parameters:
- * bytes : pointer to byte array holding the input LC3 encoded byte stream
- * of all given channels.
- * The size of this memory is given by the sum of all
- * byte_count_per_channel values (see parameter byte_count_per_channel). Note
- * that the encoded values of all channels are expected to be concatenated
- * without any stuffing bytes of meta data in between.
- *
- * byte_count_per_channel : number of encoded bytes; byte count to be used
- * for decoding the received frame payload per channel. Thus,
- * byte_count_per_channel is an array of byte_count values with length
- * lc3Conig.Nc Supported values are 20 bytes to byte_count_max_dec bytes per
- * channel.
- *
- * BFI_per_channel : lc3Conig.Nc length array of Bad Frame Indication flags
- * "0" signifies that no bit errors where detected in
- * given "bytes" "1" signifies a corrupt payload packet was detected in given
- * "bytes"
- *
- * x_out : pointer to output 16, 24, or 32 bit/sample PCM data, where the
- * memory has to be provided by the calling application.
- *
- * x_out_size : number of 32 bit values supported by x_out
- * Note: this parameter has been introduced for clarity and
- * verification purpose only. The method will return
- * the error INVALID_X_OUT_SIZE when x_out_size !=
- * lc3Config.NF * lc3Conig.Nc.
- *
- * BEC_detect_per_channel : lc3Conig.Nc length array of flags indicating bit
- * errors detected during decoding of input bytes of a certain channel. Note:
- * a basic packet loss concealment (PLC) will be applied when BEC_detect!=0,
- * so that the returned audio data stays somewhat acceptable.
- *
- *
- * Return value: error code via "or" concatenation of the error codes of
- * processing the individual channels. Note: this "or" concatenation make
- * specific error diagnosis impossible. Thus only checking != ERROR_FREE is
- * meaningful. When more specific information is needed, the single channel
- * call (see above) need to be called.
- */
- uint8_t run(const uint8_t* bytes, const uint16_t* byte_count_per_channel,
- const uint8_t* BFI_per_channel, int32_t* x_out,
- uint32_t x_out_size, uint8_t* BEC_detect_per_channel);
-
- private:
- std::vector<Lc3Dec::DecoderTop*> decoderList;
-};
-
-#endif /* API_LC3DECODER_HPP_ */
diff --git a/system/embdrv/lc3_dec/Common/DctIV.cpp b/system/embdrv/lc3_dec/Common/DctIV.cpp
deleted file mode 100644
index 798322e..0000000
--- a/system/embdrv/lc3_dec/Common/DctIV.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * DctIV.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "DctIV.hpp"
-
-#include <cmath>
-
-/*
- * Notes on the choice of the applied FFT library:
- * - Different fast transform implementations for the DCT-IV can be selected
- * via USE_FFTW USE_FFTW_FOR_FFT // assume NF being 4 times an integer
- * USE_KISSFFT // assume NF being 4 times an integer
- * where only one of them is meaningful to be defined
- *
- * - Defining none of the fast transforms will lead to a direct implementation
- * which is good for testing but usually to slow for practial applications
- *
- * - USE_FFTW: The free "fftw" library should be fastest, but may be more
- * complicated to be build for embedded target devices. It provides dedicated
- * optimization for the DCT-IV and thus is preferred from a technical
- * perspective. In terms of licences "fftw" is free in the sense of GPL, which
- * is not liked in some products. There might be the option to ask the authors
- * for other licences (which they propose). Nevertheless, the "license" issue
- * has driven us to not bundle "fftw" directly with the LC3 implementation,
- * although the API for using it is provided and tested.
- *
- * - USE_FFTW_FOR_FFT: this is a not fully optimized alternative approach using
- * the complex fft provided by "fftw" instead of the dedicated optimized DCT-IV
- * implementation. This option is mainly provided to demonstrate the transition
- * from USE_FFTW to USE_KISSFFT
- *
- * - USE_KISSFFT: the free "kissfft" library is sligthly slower than "fftw",
- * but gives a majority of the possible performance gain over a "stupid" direct
- * DCT-IV implementation. "kissfft" does not provide a dedicated optimization
- * for DCT-IV so that some additional code for implementing a DCT-IV by a
- * complex fft has to be added. This also implies additional memory needed. The
- * big advantage of the "kissfft" is that it is less restrictive in terms of its
- * license. Further, the template based C++ implementation reduces its impact on
- * the build system to a minimum (we just need to include the right header
- * without needing to compile and link a separate file).
- *
- * - USE_KISSFFT is defined below to be the default choice. The other
- * alternatives may be selecting by providing its define via the compiler switch
- * -D<define>
- *
- * - The impact of the defines is restricted to this *.cpp file for clarity
- * reasons. Ok, to make this work, we needed a few "ugly" pointer casts, but we
- * really wanted to make sure, that no other code or build impact is generated
- * by the options in this file.
- */
-#define USE_OWN_FFT
-
-#if defined USE_FFTW || defined USE_FFTW_FOR_FFT
-#include <fftw3.h>
-
-#elif defined USE_KISSFFT
-#include "kissfft.hh"
-
-class KissfftConfig {
- public:
- KissfftConfig(uint16_t N) : inbuf(nullptr), outbuf(nullptr), fft(nullptr) {
- inbuf = new std::complex<double>[N];
- outbuf = new std::complex<double>[N];
- twiddle = new std::complex<double>[N];
- fft = new kissfft<double>(N, false);
-
- const double pi = std::acos(-1);
- for (uint16_t n = 0; n < N; n++) {
- twiddle[n] =
- std::complex<double>(std::cos(-pi * (8 * n + 1) / (8.0 * N * 2)),
- std::sin(-pi * (8 * n + 1) / (8.0 * N * 2)));
- }
- }
-
- ~KissfftConfig() {
- if (nullptr != fft) {
- delete fft;
- }
- if (nullptr != inbuf) {
- delete[] inbuf;
- }
- if (nullptr != outbuf) {
- delete[] outbuf;
- }
- if (nullptr != twiddle) {
- delete[] twiddle;
- }
- }
-
- void transform() {
- if (nullptr != fft) {
- fft->transform(inbuf, outbuf);
- }
- }
-
- std::complex<double>* inbuf;
- std::complex<double>* outbuf;
- std::complex<double>* twiddle;
- kissfft<double>* fft;
-};
-
-#elif defined USE_OWN_FFT
-#include <complex>
-
-#include "fft.h"
-#endif
-
-DctIVDbl::DctIVDbl(uint16_t NF_)
- : NF(NF_), in(nullptr), out(nullptr), dctIVconfig(nullptr) {
- in = new double[NF];
- out = new double[NF];
-
-#if defined USE_FFTW
- dctIVconfig = fftw_plan_r2r_1d(NF, in, out, FFTW_REDFT11, FFTW_ESTIMATE);
-
-#elif defined USE_FFTW_FOR_FFT
- dctIVconfig = fftw_plan_dft_1d(NF / 2, reinterpret_cast<fftw_complex*>(in),
- reinterpret_cast<fftw_complex*>(out),
- FFTW_FORWARD, FFTW_ESTIMATE);
-
-#elif defined USE_KISSFFT
- dctIVconfig = new KissfftConfig(NF / 2);
-
-#elif defined USE_OWN_FFT
-
- int N = NF / 2;
- std::complex<double>* twiddle = new std::complex<double>[N];
- dctIVconfig = twiddle;
- const double pi = std::acos(-1);
- for (uint16_t n = 0; n < N; n++) {
- twiddle[n] =
- std::complex<double>(std::cos(-pi * (8 * n + 1) / (8.0 * N * 2)),
- std::sin(-pi * (8 * n + 1) / (8.0 * N * 2)));
- }
-
-#endif
-
- for (uint16_t n = 0; n < NF; n++) {
- in[n] = 0;
- out[n] = 0;
- }
-}
-
-DctIVDbl::~DctIVDbl() {
-#if defined USE_FFTW || defined USE_FFTW_FOR_FFT
- if (nullptr != dctIVconfig) {
- fftw_destroy_plan(reinterpret_cast<fftw_plan>(dctIVconfig));
- }
-
-#elif defined USE_KISSFFT
- if (nullptr != dctIVconfig) {
- KissfftConfig* kissfftConfig =
- reinterpret_cast<KissfftConfig*>(dctIVconfig);
- delete kissfftConfig;
- }
-
-#elif defined USE_OWN_FFT
- std::complex<double>* twiddle = (std::complex<double>*)dctIVconfig;
- delete[] twiddle;
-
-#endif
- if (nullptr != in) {
- delete[] in;
- }
- if (nullptr != out) {
- delete[] out;
- }
-}
-
-void DctIVDirectDbl(uint16_t N, const double* const tw, double* const X) {
- const double pi = std::acos(-1);
- for (uint16_t k = 0; k < N; k++) {
- X[k] = 0;
- for (uint16_t n = 0; n < N; n++) {
- X[k] += tw[n] * std::cos(pi / N * (n + 0.5) * (k + 0.5));
- }
- X[k] *= 2;
- }
-}
-
-void DctIVDbl::run() {
-#ifdef USE_FFTW
- fftw_execute(reinterpret_cast<fftw_plan>(dctIVconfig));
-
-#elif defined USE_FFTW_FOR_FFT
- const double pi = std::acos(-1);
- // assume NF being 4 times an integer
- for (uint16_t n = 1; n < NF / 2; n += 2) {
- double buffer;
- buffer = in[n];
- in[n] = in[NF - n];
- in[NF - n] = buffer;
- }
- for (uint16_t n = 0; n < NF; n += 2) {
- double real = in[n + 0];
- double imag = in[n + 1];
- in[n + 0] = real * std::cos(-pi * (4 * n + 1) / (8.0 * NF)) -
- imag * std::sin(-pi * (4 * n + 1) / (8.0 * NF));
- in[n + 1] = real * std::sin(-pi * (4 * n + 1) / (8.0 * NF)) +
- imag * std::cos(-pi * (4 * n + 1) / (8.0 * NF));
- }
-
- fftw_execute(reinterpret_cast<fftw_plan>(dctIVconfig));
-
- for (uint16_t n = 0; n < NF; n += 2) {
- double real = out[n + 0];
- double imag = out[n + 1];
- out[n + 0] = 2 * (real * std::cos(-pi * (4 * n + 1) / (8.0 * NF)) -
- imag * std::sin(-pi * (4 * n + 1) / (8.0 * NF)));
- out[n + 1] = 2 * (real * std::sin(-pi * (4 * n + 1) / (8.0 * NF)) +
- imag * std::cos(-pi * (4 * n + 1) / (8.0 * NF)));
- }
- for (uint16_t n = 1; n < NF / 2; n += 2) {
- double buffer;
- buffer = out[n];
- out[n] = -out[NF - n];
- out[NF - n] = -buffer;
- }
-
-#elif defined USE_KISSFFT
- // assume NF being 4 times an integer
- KissfftConfig* kissfftConfig = reinterpret_cast<KissfftConfig*>(dctIVconfig);
- for (uint16_t n = 0; n < NF / 2; n++) {
- kissfftConfig->inbuf[n] =
- kissfftConfig->twiddle[n] *
- std::complex<double>(in[2 * n], in[NF - 2 * n - 1]);
- }
-
- kissfftConfig->transform();
-
- for (uint16_t n = 0; n < NF / 2; n++) {
- std::complex<double> complexOut =
- kissfftConfig->twiddle[n] * kissfftConfig->outbuf[n];
- out[2 * n] = complexOut.real() * 2;
- out[NF - 2 * n - 1] = -complexOut.imag() * 2;
- }
-
-#elif defined USE_OWN_FFT
-
- fft_complex inbuf[NF / 2];
- fft_complex outbuf[NF / 2];
-
- // assume NF being 4 times an integer
- for (uint16_t n = 1; n < NF / 2; n += 2) {
- double buffer;
- buffer = in[n];
- in[n] = in[NF - n];
- in[NF - n] = buffer;
- }
-
- std::complex<double>* twiddle = (std::complex<double>*)dctIVconfig;
- for (uint16_t n = 0; n < NF / 2; n++) {
- double real = in[2 * n + 0];
- double imag = in[2 * n + 1];
- in[2 * n + 0] = real * twiddle[n].real() - imag * twiddle[n].imag();
- in[2 * n + 1] = real * twiddle[n].imag() + imag * twiddle[n].real();
- }
-
- for (uint16_t n = 0; n < NF / 2; n++) {
- inbuf[n].re = in[2 * n];
- inbuf[n].im = in[2 * n + 1];
- }
-
- fft_complex* actal_output = fft(false, inbuf, NF / 2, inbuf, outbuf);
-
- for (uint16_t n = 0; n < NF / 2; n++) {
- double real = actal_output[n].re;
- double imag = actal_output[n].im;
- out[2 * n + 0] = 2 * (real * twiddle[n].real() - imag * twiddle[n].imag());
- out[2 * n + 1] = 2 * (real * twiddle[n].imag() + imag * twiddle[n].real());
- }
-
- for (uint16_t n = 1; n < NF / 2; n += 2) {
- double buffer;
- buffer = out[n];
- out[n] = -out[NF - n];
- out[NF - n] = -buffer;
- }
-
-#else
- DctIVDirectDbl(NF, in, out);
-#endif
-}
diff --git a/system/embdrv/lc3_dec/Common/DctIV.hpp b/system/embdrv/lc3_dec/Common/DctIV.hpp
deleted file mode 100644
index 1e40d23..0000000
--- a/system/embdrv/lc3_dec/Common/DctIV.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * DctIV.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef DCT_IV_H_
-#define DCT_IV_H_
-
-#include <cstdint>
-
-class DctIVDbl {
- public:
- DctIVDbl(uint16_t NF_);
- virtual ~DctIVDbl();
-
- void run();
-
- const uint16_t NF;
- double* in;
- double* out;
- void* dctIVconfig;
-};
-
-#endif // DCT_IV_H_
diff --git a/system/embdrv/lc3_dec/Common/Lc3Config.cpp b/system/embdrv/lc3_dec/Common/Lc3Config.cpp
deleted file mode 100644
index 1d58b04..0000000
--- a/system/embdrv/lc3_dec/Common/Lc3Config.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Lc3Config.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "Lc3Config.hpp"
-
-#include <cmath>
-
-Lc3Config::Lc3Config(uint16_t Fs_, FrameDuration N_ms_, uint8_t Nc_)
- : errorStatus(ERROR_FREE),
- Fs(Fs_),
- Fs_ind(getFs_ind(Fs)),
- N_ms(N_ms_),
- NF(getNF(Fs, N_ms_)),
- NE(getNE(NF, N_ms_)),
- Z((N_ms == FrameDuration::d10ms) ? 3 * NF / 8 : 7 * NF / 30),
- Nc(Nc_),
- N_b(((N_ms == Lc3Config::FrameDuration::d7p5ms) && (Fs == 8000)) ? 60
- : 64) {
- if (0 == Nc) // we do not restrict the maximum yet (naturally limited to 255
- // because of the chosen datatype)
- {
- errorStatus |= INVALID_NUMBER_OF_CHANNELS;
- }
-}
-
-Lc3Config::~Lc3Config() {}
-
-bool Lc3Config::isValid() const { return ERROR_FREE == errorStatus; }
-
-uint8_t Lc3Config::getErrorStatus() const { return errorStatus; }
-
-uint8_t Lc3Config::getFs_ind(uint16_t Fs) {
- uint8_t fs_ind = 0;
- switch (Fs) {
- case 8000:
- fs_ind = 0;
- break;
- case 16000:
- fs_ind = 1;
- break;
- case 24000:
- fs_ind = 2;
- break;
- case 32000:
- fs_ind = 3;
- break;
- case 44100:;
- case 48000:
- fs_ind = 4;
- break;
- default:
- errorStatus |= INVALID_SAMPLING_RATE;
- }
- return fs_ind;
-}
-
-uint16_t Lc3Config::getNF(uint16_t Fs, FrameDuration N_ms) {
- uint16_t NF = 80;
- if (FrameDuration::d10ms == N_ms) {
- switch (Fs) {
- case 8000:
- NF = 80;
- break;
- case 16000:
- NF = 160;
- break;
- case 24000:
- NF = 240;
- break;
- case 32000:
- NF = 320;
- break;
- case 44100:;
- case 48000:
- NF = 480;
- break;
- default:
- errorStatus |= INVALID_SAMPLING_RATE;
- }
- } else if (FrameDuration::d7p5ms == N_ms) {
- switch (Fs) {
- case 8000:
- NF = 60;
- break;
- case 16000:
- NF = 120;
- break;
- case 24000:
- NF = 180;
- break;
- case 32000:
- NF = 240;
- break;
- case 44100:;
- case 48000:
- NF = 360;
- break;
- default:
- errorStatus |= INVALID_SAMPLING_RATE;
- }
- } else {
- // We never should reach this line unless
- // strange things happen. However, we want
- // to be on the safe side and thus handle
- // this case explicitly.
- errorStatus |= INVALID_FRAME_DURATION;
- }
- return NF;
-}
-
-uint16_t Lc3Config::getNE(uint16_t NF, FrameDuration N_ms) {
- // 3.3.4.3 Time-Frequency Transformation (d09r04_*implementorComments*)
- if (FrameDuration::d10ms == N_ms) {
- return (480 == NF) ? 400 : NF;
- } else {
- return (360 == NF) ? 300 : NF;
- }
-}
-
-uint16_t Lc3Config::getByteCountFromBitrate(uint32_t bitrate) const {
- // Section 3.2.5 Bit budget and bitrate (LC3_Specification_d09r06)
- double f_scal = getFscal();
- double N_ms_value = getNmsValue();
- return floor((bitrate * N_ms_value * f_scal) / 8000.0);
-}
-
-uint32_t Lc3Config::getBitrateFromByteCount(uint16_t nbytes) const {
- // Section 3.2.5 Bit budget and bitrate (LC3_Specification_d1.0r03)
- // Notes:
- // - this implementation includes Errata 15051
- // - this utility function is not used within the LC3 code so far, but
- // provided here for completeness
- double f_scal = getFscal();
- double N_ms_value = getNmsValue();
- return ceil((8000.0 * nbytes) / (N_ms_value * f_scal));
-}
-
-double Lc3Config::getFscal() const {
- // Section 3.2.2 Sampling rates (LC3_Specification_d1.0r03)
- return (44100 == Fs) ? 48000.0 / 44100.0 : 1.0;
-}
-
-double Lc3Config::getNmsValue() const {
- return (FrameDuration::d10ms == N_ms) ? 10.0 : 7.5;
-}
diff --git a/system/embdrv/lc3_dec/Common/Tables/BandIndexTables.cpp b/system/embdrv/lc3_dec/Common/Tables/BandIndexTables.cpp
deleted file mode 100644
index 26bc3ba..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/BandIndexTables.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * BandIndexTables.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.1 Band Tables Index I_fs
-#include "BandIndexTables.hpp"
-
-// LC3 Specification d09r01.pdf; Page 86 of 177
-// LC3 Specification Section 3.7.2 (d09r04_*implementorComments*)
-// Page 115 of 256
-// Band tables index I_fs for 10 ms frame duration
-int I_8000[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 53,
- 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 80};
-int I_16000[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 30, 32, 34, 36,
- 38, 40, 42, 44, 46, 48, 50, 52, 55, 58, 61,
- 64, 67, 70, 73, 76, 80, 84, 88, 92, 96, 101,
- 106, 111, 116, 121, 127, 133, 139, 146, 153, 160};
-int I_24000[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41,
- 43, 46, 49, 52, 55, 58, 61, 64, 68, 72, 76,
- 80, 85, 90, 95, 100, 106, 112, 118, 125, 132, 139,
- 147, 155, 164, 173, 183, 193, 204, 215, 227, 240};
-int I_32000[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22,
- 24, 26, 28, 30, 32, 34, 36, 38, 41, 44, 47,
- 50, 53, 56, 60, 64, 68, 72, 76, 81, 86, 91,
- 97, 103, 109, 116, 123, 131, 139, 148, 157, 166, 176,
- 187, 199, 211, 224, 238, 252, 268, 284, 302, 320};
-int I_48000[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24,
- 26, 28, 30, 32, 34, 36, 39, 42, 45, 48, 51,
- 55, 59, 63, 67, 71, 76, 81, 86, 92, 98, 105,
- 112, 119, 127, 135, 144, 154, 164, 175, 186, 198, 211,
- 225, 240, 256, 273, 291, 310, 330, 352, 375, 400};
-
-// LC3 Specification Section 3.7.2 (d09r04_*implementorComments*)
-// Page 115/116 of 256
-// Band tables index I_fs for 7.5 ms frame duration
-int I_8000_7p5ms[61] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 59, 60};
-int I_16000_7p5ms[65] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 65, 68,
- 71, 74, 77, 80, 83, 86, 90, 94, 98, 102, 106, 110, 115, 120};
-int I_24000_7p5ms[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 29, 31, 33, 35, 37,
- 39, 41, 43, 45, 47, 49, 52, 55, 58, 61, 64,
- 67, 70, 74, 78, 82, 86, 90, 95, 100, 105, 110,
- 115, 121, 127, 134, 141, 148, 155, 163, 171, 180};
-int I_32000_7p5ms[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 26, 28, 30, 32, 34, 36, 38, 40,
- 42, 45, 48, 51, 54, 57, 60, 63, 67, 71, 75,
- 79, 84, 89, 94, 99, 105, 111, 117, 124, 131, 138,
- 146, 154, 163, 172, 182, 192, 203, 215, 227, 240};
-int I_48000_7p5ms[65] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 43,
- 46, 49, 52, 55, 59, 63, 67, 71, 75, 80, 85,
- 90, 96, 102, 108, 115, 122, 129, 137, 146, 155, 165,
- 175, 186, 197, 209, 222, 236, 251, 266, 283, 300};
diff --git a/system/embdrv/lc3_dec/Common/Tables/BandIndexTables.hpp b/system/embdrv/lc3_dec/Common/Tables/BandIndexTables.hpp
deleted file mode 100644
index dfe7734..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/BandIndexTables.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * BandIndexTables.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef BAND_INDEX_TABLES_H_
-#define BAND_INDEX_TABLES_H_
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.1 Band Tables Index I_fs
-
-// LC3 Specification d09r04_*implementorComments*
-// Section 3.7.1 Band tables index I_fs for 10 ms frame duration
-
-extern int I_8000[65];
-extern int I_16000[65];
-extern int I_24000[65];
-extern int I_32000[65];
-extern int I_48000[65];
-
-// LC3 Specification d09r04_*implementorComments*
-// Section 3.7.2 Band tables index I_fs for 7.5 ms frame duration
-
-extern int I_8000_7p5ms[61];
-extern int I_16000_7p5ms[65];
-extern int I_24000_7p5ms[65];
-extern int I_32000_7p5ms[65];
-extern int I_48000_7p5ms[65];
-
-#endif // BAND_INDEX_TABLES_H_
diff --git a/system/embdrv/lc3_dec/Common/Tables/LongTermPostfilterCoefficients.cpp b/system/embdrv/lc3_dec/Common/Tables/LongTermPostfilterCoefficients.cpp
deleted file mode 100644
index 340ae20..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/LongTermPostfilterCoefficients.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * LongTermPostfilterCoefficients.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.5 Long Term Postfiltering
-#include "LongTermPostfilterCoefficients.hpp"
-
-// LC3 Specification d09r01.pdf; Page 110 of 177
-double tab_resamp_filter[239] = {
- -2.043055832879108e-05, -4.463458936757081e-05, -7.163663994481459e-05,
- -1.001011132655914e-04, -1.283728480660395e-04, -1.545438297704662e-04,
- -1.765445671257668e-04, -1.922569599584802e-04, -1.996438192500382e-04,
- -1.968886856400547e-04, -1.825383318834690e-04, -1.556394266046803e-04,
- -1.158603651792638e-04, -6.358930335348977e-05, +2.810064795067786e-19,
- +7.292180213001337e-05, +1.523970757644272e-04, +2.349207769898906e-04,
- +3.163786496265269e-04, +3.922117380894736e-04, +4.576238491064392e-04,
- +5.078242936704864e-04, +5.382955231045915e-04, +5.450729176175875e-04,
- +5.250221548270982e-04, +4.760984242947349e-04, +3.975713799264791e-04,
- +2.902002172907180e-04, +1.563446669975615e-04, -5.818801416923580e-19,
- -1.732527127898052e-04, -3.563859653300760e-04, -5.411552308801147e-04,
- -7.184140229675020e-04, -8.785052315963854e-04, -1.011714513697282e-03,
- -1.108767055632304e-03, -1.161345220483996e-03, -1.162601694464620e-03,
- -1.107640974148221e-03, -9.939415631563015e-04, -8.216921898513225e-04,
- // LC3 Specification d09r01.pdf; Page 111 of 177
- -5.940177657925908e-04, -3.170746535382728e-04, +9.746950818779534e-19,
- +3.452937604228947e-04, +7.044808705458705e-04, +1.061334465662964e-03,
- +1.398374734488549e-03, +1.697630799350524e-03, +1.941486748731660e-03,
- +2.113575906669355e-03, +2.199682452179964e-03, +2.188606246517629e-03,
- +2.072945458973295e-03, +1.849752491313908e-03, +1.521021876908738e-03,
- +1.093974255016849e-03, +5.811080624426164e-04, -1.422482656398999e-18,
- -6.271537303228204e-04, -1.274251404913447e-03, -1.912238389850182e-03,
- -2.510269249380764e-03, -3.037038298629825e-03, -3.462226871101535e-03,
- -3.758006719596473e-03, -3.900532466948409e-03, -3.871352309895838e-03,
- -3.658665583679722e-03, -3.258358512646846e-03, -2.674755551508349e-03,
- -1.921033054368456e-03, -1.019254326838640e-03, +1.869623690895593e-18,
- +1.098415446732263e-03, +2.231131973532823e-03, +3.348309272768835e-03,
- +4.397022774386510e-03, +5.323426722644900e-03, +6.075105310368700e-03,
- +6.603520247552113e-03, +6.866453987193027e-03, +6.830342695906946e-03,
- +6.472392343549424e-03, +5.782375213956374e-03, +4.764012726389739e-03,
- +3.435863514113467e-03, +1.831652835406657e-03, -2.251898372838663e-18,
- -1.996476188279370e-03, -4.082668858919100e-03, -6.173080374929424e-03,
- -8.174448945974208e-03, -9.988823864332691e-03, -1.151698705819990e-02,
- -1.266210056063963e-02, -1.333344579518481e-02, -1.345011199343934e-02,
- -1.294448809639154e-02, -1.176541543002924e-02, -9.880867320401294e-03,
- -7.280036402392082e-03, -3.974730209151807e-03, +2.509617777250391e-18,
- +4.586044219717467e-03, +9.703248998383679e-03, +1.525124770818010e-02,
- +2.111205854013017e-02, +2.715337236094137e-02, +3.323242450843114e-02,
- +3.920032029020130e-02, +4.490666443426786e-02, +5.020433088017846e-02,
- +5.495420172681558e-02, +5.902970324375908e-02, +6.232097270672976e-02,
- +6.473850225260731e-02, +6.621612450840858e-02, +6.671322871619612e-02,
- +6.621612450840858e-02, +6.473850225260731e-02, +6.232097270672976e-02,
- +5.902970324375908e-02, +5.495420172681558e-02, +5.020433088017846e-02,
- +4.490666443426786e-02, +3.920032029020130e-02, +3.323242450843114e-02,
- +2.715337236094137e-02, +2.111205854013017e-02, +1.525124770818010e-02,
- +9.703248998383679e-03, +4.586044219717467e-03, +2.509617777250391e-18,
- -3.974730209151807e-03, -7.280036402392082e-03, -9.880867320401294e-03,
- -1.176541543002924e-02, -1.294448809639154e-02, -1.345011199343934e-02,
- -1.333344579518481e-02, -1.266210056063963e-02, -1.151698705819990e-02,
- -9.988823864332691e-03, -8.174448945974208e-03, -6.173080374929424e-03,
- -4.082668858919100e-03, -1.996476188279370e-03, -2.251898372838663e-18,
- +1.831652835406657e-03, +3.435863514113467e-03, +4.764012726389739e-03,
- +5.782375213956374e-03, +6.472392343549424e-03, +6.830342695906946e-03,
- +6.866453987193027e-03, +6.603520247552113e-03, +6.075105310368700e-03,
- +5.323426722644900e-03, +4.397022774386510e-03, +3.348309272768835e-03,
- +2.231131973532823e-03, +1.098415446732263e-03, +1.869623690895593e-18,
- -1.019254326838640e-03, -1.921033054368456e-03, -2.674755551508349e-03,
- -3.258358512646846e-03, -3.658665583679722e-03, -3.871352309895838e-03,
- -3.900532466948409e-03, -3.758006719596473e-03, -3.462226871101535e-03,
- -3.037038298629825e-03, -2.510269249380764e-03, -1.912238389850182e-03,
- -1.274251404913447e-03, -6.271537303228204e-04, -1.422482656398999e-18,
- +5.811080624426164e-04, +1.093974255016849e-03, +1.521021876908738e-03,
- +1.849752491313908e-03, +2.072945458973295e-03, +2.188606246517629e-03,
- +2.199682452179964e-03, +2.113575906669355e-03, +1.941486748731660e-03,
- +1.697630799350524e-03, +1.398374734488549e-03, +1.061334465662964e-03,
- +7.044808705458705e-04, +3.452937604228947e-04, +9.746950818779534e-19,
- -3.170746535382728e-04, -5.940177657925908e-04, -8.216921898513225e-04,
- -9.939415631563015e-04, -1.107640974148221e-03, -1.162601694464620e-03,
- -1.161345220483996e-03, -1.108767055632304e-03, -1.011714513697282e-03,
- -8.785052315963854e-04, -7.184140229675020e-04, -5.411552308801147e-04,
- -3.563859653300760e-04, -1.732527127898052e-04, -5.818801416923580e-19,
- // LC3 Specification d09r01.pdf; Page 112 of 177
- +1.563446669975615e-04, +2.902002172907180e-04, +3.975713799264791e-04,
- +4.760984242947349e-04, +5.250221548270982e-04, +5.450729176175875e-04,
- +5.382955231045915e-04, +5.078242936704864e-04, +4.576238491064392e-04,
- +3.922117380894736e-04, +3.163786496265269e-04, +2.349207769898906e-04,
- +1.523970757644272e-04, +7.292180213001337e-05, +2.810064795067786e-19,
- -6.358930335348977e-05, -1.158603651792638e-04, -1.556394266046803e-04,
- -1.825383318834690e-04, -1.968886856400547e-04, -1.996438192500382e-04,
- -1.922569599584802e-04, -1.765445671257668e-04, -1.545438297704662e-04,
- -1.283728480660395e-04, -1.001011132655914e-04, -7.163663994481459e-05,
- -4.463458936757081e-05, -2.043055832879108e-05};
-double tab_ltpf_interp_R[31] = {
- -2.874561161519444e-03, -3.001251025861499e-03, +2.745471654059321e-03,
- +1.535727698935322e-02, +2.868234046665657e-02, +2.950385026557377e-02,
- +4.598334491135473e-03, -4.729632459043440e-02, -1.058359163062837e-01,
- -1.303050213607112e-01, -7.544046357555201e-02, +8.357885725250529e-02,
- +3.301825710764459e-01, +6.032970076366158e-01, +8.174886856243178e-01,
- +8.986382851273982e-01, +8.174886856243178e-01, +6.032970076366158e-01,
- +3.301825710764459e-01, +8.357885725250529e-02, -7.544046357555201e-02,
- -1.303050213607112e-01, -1.058359163062837e-01, -4.729632459043440e-02,
- +4.598334491135473e-03, +2.950385026557377e-02, +2.868234046665657e-02,
- +1.535727698935322e-02, +2.745471654059321e-03, -3.001251025861499e-03,
- -2.874561161519444e-03};
-double tab_ltpf_interp_x12k8[15] = {
- +6.698858366939680e-03, +3.967114782344967e-02, +1.069991860896389e-01,
- +2.098804630681809e-01, +3.356906254147840e-01, +4.592209296082350e-01,
- +5.500750019177116e-01, +5.835275754221211e-01, +5.500750019177116e-01,
- +4.592209296082350e-01, +3.356906254147840e-01, +2.098804630681809e-01,
- +1.069991860896389e-01, +3.967114782344967e-02, +6.698858366939680e-03};
-double tab_ltpf_num_8000[4][3] = {
- {6.023618207009578e-01, 4.197609261363617e-01, -1.883424527883687e-02},
- {5.994768582584314e-01, 4.197609261363620e-01, -1.594928283631041e-02},
- {5.967764663733787e-01, 4.197609261363617e-01, -1.324889095125780e-02},
- {5.942410120098895e-01, 4.197609261363618e-01, -1.071343658776831e-02}};
-double tab_ltpf_num_16000[4][3] = {
- {6.023618207009578e-01, 4.197609261363617e-01, -1.883424527883687e-02},
- {5.994768582584314e-01, 4.197609261363620e-01, -1.594928283631041e-02},
- {5.967764663733787e-01, 4.197609261363617e-01, -1.324889095125780e-02},
- {5.942410120098895e-01, 4.197609261363618e-01, -1.071343658776831e-02}};
-double tab_ltpf_num_24000[4][5] = {
- {3.989695588963494e-01, 5.142508607708275e-01, 1.004382966157454e-01,
- -1.278893956818042e-02, -1.572280075461383e-03},
- {3.948634911286333e-01, 5.123819208048688e-01, 1.043194926386267e-01,
- -1.091999960222166e-02, -1.347408330627317e-03},
- {3.909844475885914e-01, 5.106053522688359e-01, 1.079832524685944e-01,
- -9.143431066188848e-03, -1.132124620551895e-03},
- {3.873093888199928e-01, 5.089122083363975e-01, 1.114517380217371e-01,
- -7.450287133750717e-03, -9.255514050963111e-04}};
-double tab_ltpf_num_32000[4][7] = {
- // LC3 Specification d09r01.pdf; Page 113 of 177
- {2.982379446702096e-01, 4.652809203721290e-01, 2.105997428614279e-01,
- 3.766780380806063e-02, -1.015696155796564e-02, -2.535880996101096e-03,
- -3.182946168719958e-04},
- {2.943834154510240e-01, 4.619294002718798e-01, 2.129465770091844e-01,
- 4.066175002688857e-02, -8.693272297010050e-03, -2.178307114679820e-03,
- -2.742888063983188e-04},
- {2.907439213122688e-01, 4.587461910960279e-01, 2.151456974108970e-01,
- 4.350104772529774e-02, -7.295495347716925e-03, -1.834395637237086e-03,
- -2.316920186482416e-04},
- {2.872975852589158e-01, 4.557148886861379e-01, 2.172126950911401e-01,
- 4.620088878229615e-02, -5.957463802125952e-03, -1.502934284345198e-03,
- -1.903851911308866e-04}};
-double tab_ltpf_num_48000[4][11] = {
- {1.981363739883217e-01, 3.524494903964904e-01, 2.513695269649414e-01,
- 1.424146237314458e-01, 5.704731023952599e-02, 9.293366241586384e-03,
- -7.226025368953745e-03, -3.172679890356356e-03, -1.121835963567014e-03,
- -2.902957238400140e-04, -4.270815593769240e-05},
- {1.950709426598375e-01, 3.484660408341632e-01, 2.509988459466574e-01,
- 1.441167412482088e-01, 5.928947317677285e-02, 1.108923827452231e-02,
- -6.192908108653504e-03, -2.726705509251737e-03, -9.667125826217151e-04,
- -2.508100923165204e-04, -3.699938766131869e-05},
- {1.921810055196015e-01, 3.446945561091513e-01, 2.506220094626024e-01,
- 1.457102447664837e-01, 6.141132133664525e-02, 1.279941396562798e-02,
- -5.203721087886321e-03, -2.297324511109085e-03, -8.165608133217555e-04,
- -2.123855748277408e-04, -3.141271330981649e-05},
- {1.894485314175868e-01, 3.411139251108252e-01, 2.502406876894361e-01,
- 1.472065631098081e-01, 6.342477229539051e-02, 1.443203434150312e-02,
- -4.254449144657098e-03, -1.883081472613493e-03, -6.709619060722140e-04,
- -1.749363341966872e-04, -2.593864735284285e-05}};
-double tab_ltpf_den_8000[4][5] = {
- {0.000000000000000e+00, 2.098804630681809e-01, 5.835275754221211e-01,
- 2.098804630681809e-01, 0.000000000000000e+00},
- {0.000000000000000e+00, 1.069991860896389e-01, 5.500750019177116e-01,
- 3.356906254147840e-01, 6.698858366939680e-03},
- {0.000000000000000e+00, 3.967114782344967e-02, 4.592209296082350e-01,
- 4.592209296082350e-01, 3.967114782344967e-02},
- {0.000000000000000e+00, 6.698858366939680e-03, 3.356906254147840e-01,
- 5.500750019177116e-01, 1.069991860896389e-01}};
-double tab_ltpf_den_16000[4][5] = {
- {0.000000000000000e+00, 2.098804630681809e-01, 5.835275754221211e-01,
- 2.098804630681809e-01, 0.000000000000000e+00},
- {0.000000000000000e+00, 1.069991860896389e-01, 5.500750019177116e-01,
- 3.356906254147840e-01, 6.698858366939680e-03},
- {0.000000000000000e+00, 3.967114782344967e-02, 4.592209296082350e-01,
- 4.592209296082350e-01, 3.967114782344967e-02},
- {0.000000000000000e+00, 6.698858366939680e-03, 3.356906254147840e-01,
- 5.500750019177116e-01, 1.069991860896389e-01}};
-double tab_ltpf_den_24000[4][7] = {
- {0.000000000000000e+00, 6.322231627323796e-02, 2.507309606013235e-01,
- 3.713909428901578e-01, 2.507309606013235e-01, 6.322231627323796e-02,
- 0.000000000000000e+00},
- // LC3 Specification d09r01.pdf; Page 114 of 177
- {0.000000000000000e+00, 3.459272174099855e-02, 1.986515602645028e-01,
- 3.626411726581452e-01, 2.986750548992179e-01, 1.013092873505928e-01,
- 4.263543712369752e-03},
- {0.000000000000000e+00, 1.535746784963907e-02, 1.474344878058222e-01,
- 3.374259553990717e-01, 3.374259553990717e-01, 1.474344878058222e-01,
- 1.535746784963907e-02},
- {0.000000000000000e+00, 4.263543712369752e-03, 1.013092873505928e-01,
- 2.986750548992179e-01, 3.626411726581452e-01, 1.986515602645028e-01,
- 3.459272174099855e-02}};
-double tab_ltpf_den_32000[4][9] = {
- {0.000000000000000e+00, 2.900401878228730e-02, 1.129857420560927e-01,
- 2.212024028097570e-01, 2.723909472446145e-01, 2.212024028097570e-01,
- 1.129857420560927e-01, 2.900401878228730e-02, 0.000000000000000e+00},
- {0.000000000000000e+00, 1.703153418385261e-02, 8.722503785537784e-02,
- 1.961407762232199e-01, 2.689237982237257e-01, 2.424999102756389e-01,
- 1.405773364650031e-01, 4.474877169485788e-02, 3.127030243100724e-03},
- {0.000000000000000e+00, 8.563673748488349e-03, 6.426222944493845e-02,
- 1.687676705918012e-01, 2.587445937795505e-01, 2.587445937795505e-01,
- 1.687676705918012e-01, 6.426222944493845e-02, 8.563673748488349e-03},
- {0.000000000000000e+00, 3.127030243100724e-03, 4.474877169485788e-02,
- 1.405773364650031e-01, 2.424999102756389e-01, 2.689237982237257e-01,
- 1.961407762232199e-01, 8.722503785537784e-02, 1.703153418385261e-02}};
-double tab_ltpf_den_48000[4][13] = {
- {0.000000000000000e+00, 1.082359386659387e-02, 3.608969221303979e-02,
- 7.676401468099964e-02, 1.241530577501703e-01, 1.627596438300696e-01,
- 1.776771417779109e-01, 1.627596438300696e-01, 1.241530577501703e-01,
- 7.676401468099964e-02, 3.608969221303979e-02, 1.082359386659387e-02,
- 0.000000000000000e+00},
- {0.000000000000000e+00, 7.041404930459358e-03, 2.819702319820420e-02,
- 6.547044935127551e-02, 1.124647986743299e-01, 1.548418956489015e-01,
- 1.767122381341857e-01, 1.691507213057663e-01, 1.352901577989766e-01,
- 8.851425011427483e-02, 4.499353848562444e-02, 1.557613714732002e-02,
- 2.039721956502016e-03},
- {0.000000000000000e+00, 4.146998467444788e-03, 2.135757310741917e-02,
- 5.482735584552816e-02, 1.004971444643720e-01, 1.456060342830002e-01,
- 1.738439838565869e-01, 1.738439838565869e-01, 1.456060342830002e-01,
- 1.004971444643720e-01, 5.482735584552816e-02, 2.135757310741917e-02,
- 4.146998467444788e-03},
- {0.000000000000000e+00, 2.039721956502016e-03, 1.557613714732002e-02,
- 4.499353848562444e-02, 8.851425011427483e-02, 1.352901577989766e-01,
- 1.691507213057663e-01, 1.767122381341857e-01, 1.548418956489015e-01,
- 1.124647986743299e-01, 6.547044935127551e-02, 2.819702319820420e-02,
- 7.041404930459358e-03}};
diff --git a/system/embdrv/lc3_dec/Common/Tables/LongTermPostfilterCoefficients.hpp b/system/embdrv/lc3_dec/Common/Tables/LongTermPostfilterCoefficients.hpp
deleted file mode 100644
index 5ab9775..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/LongTermPostfilterCoefficients.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * LongTermPostfilterCoefficients.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.5 Long Term Postfiltering
-
-#ifndef LONG_TERM_POSTFILTER_COEFFICIENTS_H_
-#define LONG_TERM_POSTFILTER_COEFFICIENTS_H_
-
-extern double tab_resamp_filter[239];
-extern double tab_ltpf_interp_R[31];
-extern double tab_ltpf_interp_x12k8[15];
-extern double tab_ltpf_num_8000[4][3];
-extern double tab_ltpf_num_16000[4][3];
-extern double tab_ltpf_num_24000[4][5];
-extern double tab_ltpf_num_32000[4][7];
-extern double tab_ltpf_num_48000[4][11];
-extern double tab_ltpf_den_8000[4][5];
-extern double tab_ltpf_den_16000[4][5];
-extern double tab_ltpf_den_24000[4][7];
-extern double tab_ltpf_den_32000[4][9];
-extern double tab_ltpf_den_48000[4][13];
-
-#endif // LONG_TERM_POSTFILTER_COEFFICIENTS_H_
diff --git a/system/embdrv/lc3_dec/Common/Tables/MdctWindows.cpp b/system/embdrv/lc3_dec/Common/Tables/MdctWindows.cpp
deleted file mode 100644
index 595d573..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/MdctWindows.cpp
+++ /dev/null
@@ -1,1573 +0,0 @@
-/*
- * MdctWindows.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.2
-#include "MdctWindows.hpp"
-
-// LC3 Specification d09r01.pdf; Page 86 of 177
-
-// LC3 Specification d09r04_*implementorComments*
-// Section 3.7.3 Low delay MDCT windows
-// Section 3.7.3.1 10 ms Frame Duration
-
-// Section 5.7.2.1 w80 (d09r01.pdf)
-double w_N80[160] = {
- -7.078546706512391e-04, -2.098197727900724e-03, -4.525198076002370e-03,
- -8.233976327300612e-03, -1.337713096257934e-02, -1.999721557401502e-02,
- -2.800909464274782e-02, -3.721502082245055e-02, -4.731768261606175e-02,
- -5.794654834034055e-02, -6.867606753531441e-02, -7.904647440788692e-02,
- -8.859705468085925e-02, -9.688303623049199e-02, -1.034961241263523e-01,
- -1.080766457616878e-01, -1.103242262600913e-01, -1.099809851424550e-01,
- -1.068172142230882e-01, -1.006190418791648e-01, -9.116452506492527e-02,
- -7.820617483254730e-02, -6.146688124166948e-02, -4.063362855701623e-02,
- -1.536329520788766e-02, +1.470155068746303e-02, +4.989736509080558e-02,
- +9.050369257152079e-02, +1.366911019414417e-01, +1.884686389218322e-01,
- +2.456456803467095e-01, +3.077789078889820e-01, +3.741642373060188e-01,
- +4.438114799213576e-01, +5.154735456539700e-01, +5.876661722564289e-01,
- +6.587619767809000e-01, +7.270576699841359e-01, +7.908752989295335e-01,
- +8.486643364959733e-01, +8.991320235484349e-01, +9.413348145272842e-01,
- +9.747634827941575e-01, +9.994114730415857e-01, +1.015760373791603e+00,
- +1.024736164069697e+00, +1.027634294456205e+00, +1.025991493983836e+00,
- +1.021427210603284e+00, +1.015439859549357e+00, +1.009366925499550e+00,
- +1.003508162416449e+00, +9.988898206257559e-01, +9.953133902427869e-01,
- +9.925943919208190e-01, +9.905771957917731e-01, +9.891371616557014e-01,
- +9.881790747212391e-01, +9.876249269174586e-01, +9.874056275509585e-01,
- // LC3 Specification d09r01.pdf; Page 87 of 177
- +9.874524849192456e-01, +9.876951134084213e-01, +9.880640617030884e-01,
- +9.884926873551375e-01, +9.889230031022089e-01, +9.893074965384659e-01,
- +9.896146331889107e-01, +9.898319269347060e-01, +9.899693102025342e-01,
- +9.900603352632121e-01, +9.901575015155720e-01, +9.903255289051605e-01,
- +9.906303787150326e-01, +9.911298894709990e-01, +9.918665491182922e-01,
- +9.928619727154252e-01, +9.941156069136238e-01, +9.956033775539884e-01,
- +9.972793109558521e-01, +9.990784840729244e-01, +1.000922365901945e+00,
- +1.002728111386909e+00, +1.004416038098237e+00, +1.005919224127911e+00,
- +1.007189345025525e+00, +1.008200146369426e+00, +1.008949493525753e+00,
- +1.009458241425143e+00, +1.009768980817384e+00, +1.009940336228694e+00,
- +1.010039453539107e+00, +1.010132323996401e+00, +1.010272524848519e+00,
- +1.010494354532353e+00, +1.010808068774316e+00, +1.011201071127927e+00,
- +1.011641272406023e+00, +1.012080125934687e+00, +1.012458183122033e+00,
- +1.012706955800289e+00, +1.012755013843985e+00, +1.012530134411619e+00,
- +1.011962331100864e+00, +1.010982135506986e+00, +1.009512438049510e+00,
- +1.007460860286395e+00, +1.004708677491086e+00, +1.001111413242302e+00,
- +9.965041017623596e-01, +9.907199995730845e-01, +9.823765865983288e-01,
- +9.708821747608998e-01, +9.546732976073705e-01, +9.321553861564006e-01,
- +9.018003682081348e-01, +8.623984077953557e-01, +8.132817365236141e-01,
- +7.544551974836834e-01, +6.866580716267418e-01, +6.113488038789190e-01,
- +5.306181649316597e-01, +4.471309850999502e-01, +3.639114681156236e-01,
- +2.841647033392408e-01, +2.110209448747969e-01, +1.472287968327703e-01,
- +9.482665349502291e-02, +5.482436608328477e-02, +2.701461405056264e-02,
- +9.996743588367519e-03, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00};
-
-// Section 5.7.2.2 w160 (d09r01.pdf)
-double w_N160[320] = {
- -4.619898752628163e-04, -9.747166718929050e-04, -1.664473096973725e-03,
- -2.597106916737789e-03, -3.806285163352241e-03, -5.324608721716763e-03,
- -7.175885277771099e-03, -9.382480860899108e-03, -1.195270300743193e-02,
- -1.489528159506296e-02, -1.820666399965468e-02, -2.187570925786862e-02,
- -2.588471937157619e-02, -3.020862738245264e-02, -3.481597793538342e-02,
- -3.967067992672979e-02, -4.472698045914417e-02, -4.994225863256500e-02,
- -5.526334794593565e-02, -6.063717235243996e-02, -6.600961519440657e-02,
- -7.131966266443390e-02, -7.651178225890490e-02, -8.152964005319532e-02,
- -8.631137544905677e-02, -9.080411291245728e-02, -9.495377758870335e-02,
- -9.870736514214426e-02, -1.020202684361974e-01, -1.048438825017798e-01,
- -1.071382314127799e-01, -1.088690135027248e-01, -1.099969655786929e-01,
- -1.104898474883336e-01, -1.103225838568563e-01, -1.094621746650760e-01,
- -1.078834293141886e-01, -1.055612509762041e-01, -1.024650162703341e-01,
- -9.857014566194629e-02, -9.384684920715425e-02, -8.826309993000785e-02,
- -8.178792716809512e-02, -7.438785600211463e-02, -6.602189797715241e-02,
- -5.665655641133161e-02, -4.624456893420224e-02, -3.474585776145929e-02,
- -2.211581608120528e-02, -8.310425696208936e-03, +6.717697635290676e-03,
- // LC3 Specification d09r01.pdf; Page 88 of 177
- +2.300642061077823e-02, +4.060106462625085e-02, +5.953239090915557e-02,
- +7.983354189816511e-02, +1.015233140203748e-01, +1.246171387327525e-01,
- +1.491152519299797e-01, +1.750067399059861e-01, +2.022699854906251e-01,
- +2.308655379767671e-01, +2.607365124918583e-01, +2.918144694729168e-01,
- +3.240095704645023e-01, +3.572175180786021e-01, +3.913146885756875e-01,
- +4.261571642320424e-01, +4.615925445090212e-01, +4.974471592901086e-01,
- +5.335326819631583e-01, +5.696546730080154e-01, +6.056083823929643e-01,
- +6.411830842823245e-01, +6.761653499550255e-01, +7.103400549562944e-01,
- +7.434943718765665e-01, +7.754281892901473e-01, +8.059437233154637e-01,
- +8.348589373399948e-01, +8.620108336276733e-01, +8.872599706865123e-01,
- +9.104863121445679e-01, +9.315962496426278e-01, +9.505220861927248e-01,
- +9.672366712325431e-01, +9.817397501303696e-01, +9.940557180662704e-01,
- +1.004247514102417e+00, +1.012407428282884e+00, +1.018650990561848e+00,
- +1.023118841384460e+00, +1.025972450969440e+00, +1.027397523939210e+00,
- +1.027585830688143e+00, +1.026738673647482e+00, +1.025061777648234e+00,
- +1.022756514615106e+00, +1.020009139549275e+00, +1.016996499560845e+00,
- +1.013915946100629e+00, +1.011044869639164e+00, +1.007773858455400e+00,
- +1.004848753962734e+00, +1.002245009135684e+00, +9.999393169239009e-01,
- +9.979055415627330e-01, +9.961203379971326e-01, +9.945597525471822e-01,
- +9.932031606606762e-01, +9.920297273323891e-01, +9.910230654424902e-01,
- +9.901668953434221e-01, +9.894488374513719e-01, +9.888556356037892e-01,
- +9.883778520531268e-01, +9.880051626345804e-01, +9.877295459610343e-01,
- +9.875412739766566e-01, +9.874329809802893e-01, +9.873949921033299e-01,
- +9.874197049003676e-01, +9.874973205882319e-01, +9.876201238703241e-01,
- +9.877781920433015e-01, +9.879637979933339e-01, +9.881678007807095e-01,
- +9.883835200189653e-01, +9.886022219397892e-01, +9.888182771263505e-01,
- +9.890247977602895e-01, +9.892178658748239e-01, +9.893923680007577e-01,
- +9.895463342815009e-01, +9.896772011542693e-01, +9.897859195209235e-01,
- +9.898725363809847e-01, +9.899410789223559e-01, +9.899945557067980e-01,
- +9.900394023736973e-01, +9.900814722948890e-01, +9.901293790312005e-01,
- +9.901902265696609e-01, +9.902734448815004e-01, +9.903862280081246e-01,
- +9.905379830873822e-01, +9.907348826312993e-01, +9.909842592301273e-01,
- +9.912905118607647e-01, +9.916586940166509e-01, +9.920906151219310e-01,
- +9.925887208794144e-01, +9.931516528513824e-01, +9.937790866568735e-01,
- +9.944668184371617e-01, +9.952116634297566e-01, +9.960068616185641e-01,
- +9.968461329825753e-01, +9.977203369515556e-01, +9.986213520769593e-01,
- +9.995382582242990e-01, +1.000461955079660e+00, +1.001380551217109e+00,
- +1.002284871786226e+00, +1.003163845364970e+00, +1.004009147462043e+00,
- +1.004811375053364e+00, +1.005563968008037e+00, +1.006259855360867e+00,
- +1.006895570408563e+00, +1.007466616298057e+00, +1.007972441990187e+00,
- +1.008411468616852e+00, +1.008786009787269e+00, +1.009097763850333e+00,
- +1.009351762546296e+00, +1.009552401900961e+00, +1.009707093778162e+00,
- +1.009822090220407e+00, +1.009906958448099e+00, +1.009969021400474e+00,
- +1.010017890428877e+00, +1.010060809299530e+00, +1.010106564965965e+00,
- +1.010161131093372e+00, +1.010231078494249e+00, +1.010319484524512e+00,
- +1.010430470494512e+00, +1.010564099281000e+00, +1.010721360243234e+00,
- +1.010899655674578e+00, +1.011096993993037e+00, +1.011308167670753e+00,
- +1.011529185153809e+00, +1.011753008569803e+00, +1.011973876511603e+00,
- +1.012182837094955e+00, +1.012373028737774e+00, +1.012535058602453e+00,
- +1.012660975529858e+00, +1.012740575296603e+00, +1.012765922449960e+00,
- +1.012726958954961e+00, +1.012615904116265e+00, +1.012422888521601e+00,
- +1.012140460211194e+00, +1.011758810583150e+00, +1.011269960947744e+00,
- +1.010663676735228e+00, +1.009930754807923e+00, +1.009058249873833e+00,
- +1.008034308295421e+00, +1.006843352506855e+00, +1.005470005637052e+00,
- +1.003894772403371e+00, +1.002098854400575e+00, +1.000060686758758e+00,
- +9.977600196406868e-01, +9.951746430061121e-01, +9.922861082472264e-01,
- // LC3 Specification d09r01.pdf; Page 89 of 177
- +9.890757868707590e-01, +9.847362453480265e-01, +9.798613526271561e-01,
- +9.741378617337759e-01, +9.673331975559332e-01, +9.592539757044516e-01,
- +9.496984081652284e-01, +9.384634163826711e-01, +9.253567968750328e-01,
- +9.101986790930605e-01, +8.928338316495705e-01, +8.731437835983047e-01,
- +8.510420440685049e-01, +8.264839911291133e-01, +7.994681492797084e-01,
- +7.700431275216928e-01, +7.383028603058783e-01, +7.043814340356083e-01,
- +6.684616478236647e-01, +6.307755329382612e-01, +5.915799587176216e-01,
- +5.511703155400274e-01, +5.098915423728179e-01, +4.681017110047964e-01,
- +4.261772971493010e-01, +3.845172335531009e-01, +3.435228672445613e-01,
- +3.036004651973099e-01, +2.651434678028531e-01, +2.285283969438072e-01,
- +1.941021906320984e-01, +1.621735416384830e-01, +1.330015240938615e-01,
- +1.067840430193724e-01, +8.365057236623041e-02, +6.365188111381356e-02,
- +4.676538412257621e-02, +3.288072750732215e-02, +2.183057564646270e-02,
- +1.336381425803019e-02, +6.758124889697787e-03, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00};
-
-// Section 5.7.2.3 w240 (d09r01.pdf)
-double w_N240[480] = {
- -3.613496418928369e-04, -7.078546706512391e-04, -1.074443637110903e-03,
- -1.533478537964509e-03, -2.098197727900724e-03, -2.778420871815740e-03,
- -3.584129920673041e-03, -4.525198076002370e-03, -5.609327243712055e-03,
- -6.843234536105624e-03, -8.233976327300612e-03, -9.785314755557023e-03,
- -1.149880303071551e-02, -1.337713096257934e-02, -1.542181679511618e-02,
- -1.762979910961727e-02, -1.999721557401502e-02, -2.252080561390149e-02,
- -2.519406300389030e-02, -2.800909464274782e-02, -3.095765092956728e-02,
- -3.402996266948349e-02, -3.721502082245055e-02, -4.050053247568393e-02,
- -4.387219218706189e-02, -4.731768261606175e-02, -5.082325342672667e-02,
- -5.437166635159518e-02, -5.794654834034055e-02, -6.153426201732499e-02,
- -6.511708163113709e-02, -6.867606753531441e-02, -7.219447805250771e-02,
- -7.565695975592170e-02, -7.904647440788692e-02, -8.234442557322251e-02,
- -8.553324579905185e-02, -8.859705468085925e-02, -9.152091100798199e-02,
- -9.428847446755965e-02, -9.688303623049198e-02, -9.929123258537813e-02,
- -1.015008467688577e-01, -1.034961241263523e-01, -1.052637003544443e-01,
- -1.067939984687745e-01, -1.080766457616878e-01, -1.090997300590506e-01,
- // LC3 Specification d09r01.pdf; Page 90 of 177
- -1.098524491515805e-01, -1.103242262600913e-01, -1.105084619148789e-01,
- -1.103977408741932e-01, -1.099809851424550e-01, -1.092492774392824e-01,
- -1.081974227416502e-01, -1.068172142230882e-01, -1.050995803285455e-01,
- -1.030360111111103e-01, -1.006190418791648e-01, -9.784120023411771e-02,
- -9.469304216883027e-02, -9.116452506492527e-02, -8.724644532866996e-02,
- -8.293043914044632e-02, -7.820617483254730e-02, -7.306142427456862e-02,
- -6.748468182105991e-02, -6.146688124166948e-02, -5.499497258200362e-02,
- -4.805444424454820e-02, -4.063362855701623e-02, -3.272045590229335e-02,
- -2.430122582451853e-02, -1.536329520788766e-02, -5.891434269890659e-03,
- +4.126595858583295e-03, +1.470155068746303e-02, +2.584738191459814e-02,
- +3.757652772246801e-02, +4.989736509080558e-02, +6.282034030592902e-02,
- +7.635397728566121e-02, +9.050369257152079e-02, +1.052747118478660e-01,
- +1.206703467513333e-01, +1.366911019414417e-01, +1.533343890681390e-01,
- +1.705954709184399e-01, +1.884686389218322e-01, +2.069449962574092e-01,
- +2.260093000067393e-01, +2.456456803467095e-01, +2.658346019332584e-01,
- +2.865543814049772e-01, +3.077789078889820e-01, +3.294769437072290e-01,
- +3.516171481750350e-01, +3.741642373060188e-01, +3.970739591211551e-01,
- +4.203043046885219e-01, +4.438114799213576e-01, +4.675442291623012e-01,
- +4.914498631045615e-01, +5.154735456539700e-01, +5.395557644293222e-01,
- +5.636399817032525e-01, +5.876661722564289e-01, +6.115695310143157e-01,
- +6.352890592874099e-01, +6.587619767809000e-01, +6.819230974423550e-01,
- +7.047092819314779e-01, +7.270576699841359e-01, +7.489068963384272e-01,
- +7.701990187606995e-01, +7.908752989295335e-01, +8.108788692151807e-01,
- +8.301579139160681e-01, +8.486643364959733e-01, +8.663548164329093e-01,
- +8.831896853053627e-01, +8.991320235484349e-01, +9.141540563656075e-01,
- +9.282282546151819e-01, +9.413348145272842e-01, +9.534619388400459e-01,
- +9.646048250501910e-01, +9.747634827941575e-01, +9.839435385219192e-01,
- +9.921529097154242e-01, +9.994114730415857e-01, +1.005746084650236e+00,
- +1.011183971347815e+00, +1.015760373791603e+00, +1.019515072412387e+00,
- +1.022490937034641e+00, +1.024736164069697e+00, +1.026304095700693e+00,
- +1.027250978292214e+00, +1.027634294456205e+00, +1.027511063644843e+00,
- +1.026942795115598e+00, +1.025991493983836e+00, +1.024716149969084e+00,
- +1.023175976163407e+00, +1.021427210603284e+00, +1.019521566634239e+00,
- +1.017510118327508e+00, +1.015439859549357e+00, +1.013460916839174e+00,
- +1.011654901040475e+00, +1.009366925499550e+00, +1.007263182132894e+00,
- +1.005313192386866e+00, +1.003508162416449e+00, +1.001840787319378e+00,
- +1.000303927234380e+00, +9.988898206257559e-01, +9.975915283480670e-01,
- +9.964015284765968e-01, +9.953133902427869e-01, +9.943201078053212e-01,
- +9.934158959186011e-01, +9.925943919208190e-01, +9.918510277326026e-01,
- +9.911797988363887e-01, +9.905771957917731e-01, +9.900381047643838e-01,
- +9.895594394179152e-01, +9.891371616557014e-01, +9.887684373604154e-01,
- +9.884497924570929e-01, +9.881790747212391e-01, +9.879528358230726e-01,
- +9.877691368590689e-01, +9.876249269174586e-01, +9.875179947346887e-01,
- +9.874458127312921e-01, +9.874056275509585e-01, +9.873951115886979e-01,
- +9.874115368168944e-01, +9.874524849192456e-01, +9.875149888347144e-01,
- +9.875968894760857e-01, +9.876951134084213e-01, +9.878075819424549e-01,
- +9.879311998177238e-01, +9.880640617030884e-01, +9.882032571565917e-01,
- +9.883471084085503e-01, +9.884926873551375e-01, +9.886386592120545e-01,
- +9.887825578295630e-01, +9.889230031022089e-01, +9.890581715933395e-01,
- +9.891867674284610e-01, +9.893074965384659e-01, +9.894196399062921e-01,
- +9.895220757174378e-01, +9.896146331889107e-01, +9.896970346678272e-01,
- +9.897692596535289e-01, +9.898319269347060e-01, +9.898852572653667e-01,
- +9.899307640365727e-01, +9.899693102025343e-01, +9.900025692522435e-01,
- +9.900321562263099e-01, +9.900603352632121e-01, +9.900889812894406e-01,
- +9.901206586012907e-01, +9.901575015155720e-01, +9.902023946214220e-01,
- +9.902575406142213e-01, +9.903255289051605e-01, +9.904087914462694e-01,
- // LC3 Specification d09r01.pdf; Page 91 of 177
- +9.905096491583045e-01, +9.906303787150326e-01, +9.907727108894024e-01,
- +9.909387444078919e-01, +9.911298894709990e-01, +9.913476318763218e-01,
- +9.915928560402563e-01, +9.918665491182922e-01, +9.921691315380984e-01,
- +9.925010851461232e-01, +9.928619727154252e-01, +9.932519181564613e-01,
- +9.936700207375173e-01, +9.941156069136238e-01, +9.945873147903244e-01,
- +9.950837402063278e-01, +9.956033775539884e-01, +9.961439922621166e-01,
- +9.967034533921340e-01, +9.972793109558521e-01, +9.978690858367024e-01,
- +9.984697087896268e-01, +9.990784840729244e-01, +9.996919011206490e-01,
- +1.000308193833526e+00, +1.000922365901945e+00, +1.001532636590676e+00,
- +1.002135464655177e+00, +1.002728111386909e+00, +1.003307449770187e+00,
- +1.003870934089686e+00, +1.004416038098237e+00, +1.004940548815171e+00,
- +1.005442141810160e+00, +1.005919224127911e+00, +1.006370303149314e+00,
- +1.006793927824538e+00, +1.007189345025525e+00, +1.007555573455895e+00,
- +1.007892674961336e+00, +1.008200146369426e+00, +1.008478423284851e+00,
- +1.008727884997619e+00, +1.008949493525753e+00, +1.009144112734761e+00,
- +1.009313224929575e+00, +1.009458241425143e+00, +1.009581280555682e+00,
- +1.009684090687164e+00, +1.009768980817384e+00, +1.009838308708799e+00,
- +1.009894548257807e+00, +1.009940336228694e+00, +1.009977916643680e+00,
- +1.010010230290263e+00, +1.010039453539107e+00, +1.010068202038694e+00,
- +1.010098388689342e+00, +1.010132323996401e+00, +1.010171656775640e+00,
- +1.010218096148412e+00, +1.010272524848519e+00, +1.010336490294771e+00,
- +1.010410221483215e+00, +1.010494354532353e+00, +1.010588873699422e+00,
- +1.010693501186928e+00, +1.010808068774316e+00, +1.010931436739342e+00,
- +1.011062876503041e+00, +1.011201071127927e+00, +1.011344700694417e+00,
- +1.011491904228184e+00, +1.011641272406023e+00, +1.011790282474963e+00,
- +1.011937567254485e+00, +1.012080125934687e+00, +1.012216235487353e+00,
- +1.012342907951334e+00, +1.012458183122033e+00, +1.012558879696851e+00,
- +1.012642857380847e+00, +1.012706955800289e+00, +1.012748952907404e+00,
- +1.012765799894453e+00, +1.012755013843985e+00, +1.012713798678211e+00,
- +1.012639775003457e+00, +1.012530134411619e+00, +1.012382309473470e+00,
- +1.012194068117524e+00, +1.011962331100864e+00, +1.011685173724601e+00,
- +1.011359143572147e+00, +1.010982135506986e+00, +1.010550715971368e+00,
- +1.010062133151922e+00, +1.009512438049510e+00, +1.008898689394160e+00,
- +1.008215923600973e+00, +1.007460860286395e+00, +1.006627741823389e+00,
- +1.005712337656749e+00, +1.004708677491086e+00, +1.003611467285588e+00,
- +1.002414286392268e+00, +1.001111413242302e+00, +9.996961651093181e-01,
- +9.981625949525345e-01, +9.965041017623596e-01, +9.947148884277037e-01,
- +9.927891912841345e-01, +9.907199995730845e-01, +9.884793707533194e-01,
- +9.855347660016696e-01, +9.823765865983286e-01, +9.789747333404933e-01,
- +9.751623811486372e-01, +9.708821747608998e-01, +9.660805524695870e-01,
- +9.606976399184645e-01, +9.546732976073706e-01, +9.479479345282376e-01,
- +9.404609052933396e-01, +9.321553861564006e-01, +9.229775478442888e-01,
- +9.128745354570823e-01, +9.018003682081348e-01, +8.897163275605041e-01,
- +8.765908974996186e-01, +8.623984077953557e-01, +8.471200801854385e-01,
- +8.307479727020245e-01, +8.132817365236141e-01, +7.947291447585267e-01,
- +7.751108841891807e-01, +7.544551974836834e-01, +7.327963552921717e-01,
- +7.101790843209148e-01, +6.866580716267418e-01, +6.622962432368731e-01,
- +6.371684119604742e-01, +6.113488038789190e-01, +5.849206604934815e-01,
- +5.579747428663487e-01, +5.306181649316717e-01, +5.029523957059122e-01,
- +4.750868825511614e-01, +4.471309850999535e-01, +4.192049917945288e-01,
- +3.914252910998820e-01, +3.639114681156252e-01, +3.367837772954476e-01,
- +3.101627843160973e-01, +2.841647033392418e-01, +2.589033711808454e-01,
- +2.344880603710975e-01, +2.110209448747974e-01, +1.885997642296488e-01,
- +1.673100807904834e-01, +1.472287968327706e-01, +1.284223074167396e-01,
- +1.109422548710344e-01, +9.482665349502306e-02, +8.009914366829558e-02,
- +6.676765847398403e-02, +5.482436608328485e-02, +4.424588851571281e-02,
- // LC3 Specification d09r01.pdf; Page 92 of 177
- +3.499361000717621e-02, +2.701461405056267e-02, +2.024370180670145e-02,
- +1.460796755137538e-02, +9.996743588367531e-03, +5.305235098871444e-03,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00};
-
-// Section 5.7.2.4 w320 (d09r01.pdf)
-double w_N320[640] = {
- -3.021153494057143e-04, -5.867737487939294e-04, -8.366504004139796e-04,
- -1.126635355725494e-03, -1.470492941694331e-03, -1.873473391018495e-03,
- -2.339292362082021e-03, -2.872008069419264e-03, -3.476256385086407e-03,
- -4.155963816705528e-03, -4.914563787665504e-03, -5.755172503953251e-03,
- -6.680623380533122e-03, -7.693816924650567e-03, -8.796760749750191e-03,
- -9.990503073705982e-03, -1.127574117138621e-02, -1.265334152129685e-02,
- -1.412438986522702e-02, -1.568889620430290e-02, -1.734512089366117e-02,
- -1.909097368362797e-02, -2.092546711168754e-02, -2.284684792818856e-02,
- -2.485207716234951e-02, -2.693746704328349e-02, -2.909952486193999e-02,
- -3.133504629493832e-02, -3.363960728361352e-02, -3.600820974457969e-02,
- -3.843601741746971e-02, -4.091746034850161e-02, -4.344654894948344e-02,
- -4.601786724624048e-02, -4.862598509282497e-02, -5.126474204655663e-02,
- -5.392644753556616e-02, -5.660384311081047e-02, -5.929116747072080e-02,
- -6.198268202511926e-02, -6.467025548071184e-02, -6.734542216184526e-02,
- -7.000099017198280e-02, -7.263057011354321e-02, -7.522784961377151e-02,
- -7.778525942347714e-02, -8.029480247839878e-02, -8.274924535373614e-02,
- -8.514125464087215e-02, -8.746379123238275e-02, -8.971069341834263e-02,
- -9.187564084638347e-02, -9.395176975347193e-02, -9.593137735886889e-02,
- -9.780843257659243e-02, -9.957851303827886e-02, -1.012361165314596e-01,
- // LC3 Specification d09r01.pdf; Page 93 of 177
- -1.027741036495644e-01, -1.041861222641119e-01, -1.054680247057000e-01,
- -1.066160875985523e-01, -1.076255384835563e-01, -1.084912299471198e-01,
- -1.092087422379003e-01, -1.097736146613313e-01, -1.101808861640070e-01,
- -1.104271876052675e-01, -1.105108362290460e-01, -1.104281465492726e-01,
- -1.101739218186236e-01, -1.097437360338336e-01, -1.091353125572511e-01,
- -1.083467335729228e-01, -1.073739938306107e-01, -1.062130155324388e-01,
- -1.048606145834788e-01, -1.033132401525343e-01, -1.015673163469357e-01,
- -9.962005506126154e-02, -9.746803229469267e-02, -9.510723623306666e-02,
- -9.253303383231506e-02, -8.974125216128212e-02, -8.672877689119252e-02,
- -8.349213839083708e-02, -8.002639902061687e-02, -7.632679536516856e-02,
- -7.238806162166744e-02, -6.820576796149519e-02, -6.377611429172260e-02,
- -5.909386001558149e-02, -5.415316322402774e-02, -4.894812724598650e-02,
- -4.347347112195197e-02, -3.772461300253332e-02, -3.169587609244436e-02,
- -2.538179830690266e-02, -1.877689096555516e-02, -1.187461378850388e-02,
- -4.669099247423082e-03, +2.844096748870385e-03, +1.066976124794342e-02,
- +1.881355950582949e-02, +2.728156010437695e-02, +3.607810469851272e-02,
- +4.520702759803914e-02, +5.467238802204326e-02, +6.447866054615346e-02,
- +7.462862199422061e-02, +8.512490568723846e-02, +9.596983987496970e-02,
- +1.071650779014335e-01, +1.187115850305241e-01, +1.306101067250375e-01,
- +1.428596447589721e-01, +1.554584725339102e-01, +1.684041609371527e-01,
- +1.816947894623263e-01, +1.953273880886783e-01, +2.092963206850239e-01,
- +2.235945635254679e-01, +2.382160219461597e-01, +2.531529721334063e-01,
- +2.683961570569586e-01, +2.839361392493072e-01, +2.997624255177811e-01,
- +3.158619077906196e-01, +3.322210551086769e-01, +3.488264676990591e-01,
- +3.656640377499646e-01, +3.827152968157059e-01, +3.999611859760947e-01,
- +4.173843265025887e-01, +4.349669624916473e-01, +4.526876397402144e-01,
- +4.705242008503956e-01, +4.884539254831315e-01, +5.064545550235134e-01,
- +5.245006748662190e-01, +5.425674372882107e-01, +5.606312044701524e-01,
- +5.786672646386708e-01, +5.966477035050948e-01, +6.145458904162185e-01,
- +6.323361944662236e-01, +6.499926319211774e-01, +6.674874032292857e-01,
- +6.847932667399612e-01, +7.018835463513400e-01, +7.187322544823347e-01,
- +7.353128213893310e-01, +7.516001985652684e-01, +7.675699252273948e-01,
- +7.831974571624924e-01, +7.984583859818390e-01, +8.133295347030278e-01,
- +8.277892271515950e-01, +8.418178561101360e-01, +8.553961300139363e-01,
- +8.685068980898102e-01, +8.811334436653052e-01, +8.932596784799233e-01,
- +9.048748835980528e-01, +9.159657608120536e-01, +9.265215299450000e-01,
- +9.365339988633418e-01, +9.459977028429117e-01, +9.549088408436811e-01,
- +9.632658122557368e-01, +9.710688896122810e-01, +9.783204156360773e-01,
- +9.850226760127131e-01, +9.911792082081333e-01, +9.967989944502682e-01,
- +1.001894024615659e+00, +1.006474342231823e+00, +1.010552057109195e+00,
- +1.014142538208007e+00, +1.017262593268930e+00, +1.019928842669923e+00,
- +1.022159867011177e+00, +1.023976320927187e+00, +1.025400734608122e+00,
- +1.026455340400072e+00, +1.027164510654160e+00, +1.027552729180790e+00,
- +1.027644462380432e+00, +1.027463246660797e+00, +1.027035903410657e+00,
- +1.026389068000259e+00, +1.025548201799728e+00, +1.024537134749709e+00,
- +1.023380803775376e+00, +1.022103695693341e+00, +1.020728359657958e+00,
- +1.019275334687329e+00, +1.017765178792830e+00, +1.016217355867531e+00,
- +1.014665311686846e+00, +1.013249071090664e+00, +1.011948006992127e+00,
- +1.010189090179223e+00, +1.008557961167850e+00, +1.007011287608451e+00,
- +1.005548764575910e+00, +1.004168417268956e+00, +1.002867268893035e+00,
- +1.001641769115897e+00, +1.000489068954641e+00, +9.994060799749374e-01,
- +9.983898865406841e-01, +9.974370849972721e-01, +9.965444836911705e-01,
- +9.957098545943852e-01, +9.949302413030897e-01, +9.942024045863540e-01,
- +9.935241604969254e-01, +9.928930430130044e-01, +9.923068103443909e-01,
- +9.917633778190438e-01, +9.912597642374404e-01, +9.907954498484041e-01,
- +9.903677893656558e-01, +9.899751611066148e-01, +9.896160337369861e-01,
- // LC3 Specification d09r01.pdf; Page 94 of 177
- +9.892890160408989e-01, +9.889928511129679e-01, +9.887260333430423e-01,
- +9.884868721088945e-01, +9.882751039537586e-01, +9.880892168751595e-01,
- +9.879277114724612e-01, +9.877898261218510e-01, +9.876743442038471e-01,
- +9.875807496078497e-01, +9.875072021876561e-01, +9.874529447589979e-01,
- +9.874169741527905e-01, +9.873984685207834e-01, +9.873958301311858e-01,
- +9.874080027710336e-01, +9.874343401290739e-01, +9.874736235387018e-01,
- +9.875243137719285e-01, +9.875856201221135e-01, +9.876563785063032e-01,
- +9.877358921155149e-01, +9.878225576787804e-01, +9.879150968481590e-01,
- +9.880132731565830e-01, +9.881156946084619e-01, +9.882211314188272e-01,
- +9.883289032519310e-01, +9.884378310018685e-01, +9.885476787868710e-01,
- +9.886568414746639e-01, +9.887645868459630e-01, +9.888708540445242e-01,
- +9.889744320992592e-01, +9.890747269455915e-01, +9.891710038703801e-01,
- +9.892631024032380e-01, +9.893507219573624e-01, +9.894330645494204e-01,
- +9.895096919388534e-01, +9.895810813422480e-01, +9.896467469067676e-01,
- +9.897067365020641e-01, +9.897606930400666e-01, +9.898094478563998e-01,
- +9.898530133261707e-01, +9.898914705684924e-01, +9.899254194103574e-01,
- +9.899554202030650e-01, +9.899824494486951e-01, +9.900065116928948e-01,
- +9.900284805353695e-01, +9.900497484789281e-01, +9.900709561632662e-01,
- +9.900928358611601e-01, +9.901163920607219e-01, +9.901427479709606e-01,
- +9.901734275350572e-01, +9.902087332329851e-01, +9.902498637985275e-01,
- +9.902983686695558e-01, +9.903548501470234e-01, +9.904205084933333e-01,
- +9.904959297726740e-01, +9.905825150202904e-01, +9.906812569810133e-01,
- +9.907922087340426e-01, +9.909165464981378e-01, +9.910550740962871e-01,
- +9.912084614290896e-01, +9.913768610980639e-01, +9.915605826937839e-01,
- +9.917604214872976e-01, +9.919767175562684e-01, +9.922091101818779e-01,
- +9.924579135466506e-01, +9.927231225056266e-01, +9.930049538427406e-01,
- +9.933027281437943e-01, +9.936161084869942e-01, +9.939453714404443e-01,
- +9.942895145656371e-01, +9.946481676207727e-01, +9.950203031067961e-01,
- +9.954058173659507e-01, +9.958038713694317e-01, +9.962130271017117e-01,
- +9.966324689957675e-01, +9.970615306490058e-01, +9.974990583293081e-01,
- +9.979437430375855e-01, +9.983940572002874e-01, +9.988493116887893e-01,
- +9.993083430214909e-01, +9.997689221333534e-01, +1.000231131275969e+00,
- +1.000692135698996e+00, +1.001152013920163e+00, +1.001608526000461e+00,
- +1.002060493867275e+00, +1.002507212061815e+00, +1.002947129400411e+00,
- +1.003378909587027e+00, +1.003801368578070e+00, +1.004213810320699e+00,
- +1.004615386562846e+00, +1.005004618375781e+00, +1.005380628601598e+00,
- +1.005743282364652e+00, +1.006091510392348e+00, +1.006424907424988e+00,
- +1.006742427727669e+00, +1.007044321511378e+00, +1.007330218597112e+00,
- +1.007599401798709e+00, +1.007852064386603e+00, +1.008088176165563e+00,
- +1.008308033204578e+00, +1.008511247273756e+00, +1.008698144207627e+00,
- +1.008869515256392e+00, +1.009025659761512e+00, +1.009166718967367e+00,
- +1.009293362609020e+00, +1.009406398832440e+00, +1.009507017171120e+00,
- +1.009595264293017e+00, +1.009672145744679e+00, +1.009739084785160e+00,
- +1.009796675060142e+00, +1.009846137382005e+00, +1.009888083631667e+00,
- +1.009924092276850e+00, +1.009955384765721e+00, +1.009982268770147e+00,
- +1.010006298177305e+00, +1.010028618428735e+00, +1.010050254076988e+00,
- +1.010071952131355e+00, +1.010094366238073e+00, +1.010118917317053e+00,
- +1.010146497096682e+00, +1.010177110711677e+00, +1.010211755260102e+00,
- +1.010251003469427e+00, +1.010295468653759e+00, +1.010345234996637e+00,
- +1.010400316698172e+00, +1.010461564316351e+00, +1.010528615445659e+00,
- +1.010601521285347e+00, +1.010679788081867e+00, +1.010763905869062e+00,
- +1.010853429760676e+00, +1.010947547074519e+00, +1.011045953108263e+00,
- +1.011148486293359e+00, +1.011254397791134e+00, +1.011363082075863e+00,
- +1.011473302008831e+00, +1.011584996312149e+00, +1.011697416504599e+00,
- +1.011808919793469e+00, +1.011919264025716e+00, +1.012027240794153e+00,
- +1.012132151631041e+00, +1.012232734564333e+00, +1.012327560477901e+00,
- // LC3 Specification d09r01.pdf; Page 95 of 177
- +1.012416383754384e+00, +1.012497890726292e+00, +1.012570434021054e+00,
- +1.012633295255708e+00, +1.012685277016726e+00, +1.012725564992284e+00,
- +1.012752577651415e+00, +1.012765062889864e+00, +1.012762356719162e+00,
- +1.012743376077777e+00, +1.012706484200181e+00, +1.012650842226435e+00,
- +1.012575427778520e+00, +1.012479473490919e+00, +1.012361105121003e+00,
- +1.012219809594718e+00, +1.012054359992419e+00, +1.011864000215460e+00,
- +1.011647223869087e+00, +1.011402518267713e+00, +1.011129654652857e+00,
- +1.010826951260377e+00, +1.010492924436361e+00, +1.010126353960416e+00,
- +1.009725892479312e+00, +1.009290060983833e+00, +1.008817301052548e+00,
- +1.008305027555130e+00, +1.007752833675443e+00, +1.007157827358150e+00,
- +1.006518049344503e+00, +1.005831403532018e+00, +1.005095592119373e+00,
- +1.004308630055050e+00, +1.003467498305776e+00, +1.002569500413888e+00,
- +1.001612710105563e+00, +1.000594272975683e+00, +9.995111701168786e-01,
- +9.983609218719522e-01, +9.971409288327860e-01, +9.958488863050556e-01,
- +9.944818543153893e-01, +9.930375282832211e-01, +9.915146560759479e-01,
- +9.899136802423638e-01, +9.881930623810997e-01, +9.859422591203311e-01,
- +9.835667898378924e-01, +9.811423034808365e-01, +9.785214441250228e-01,
- +9.756636036109838e-01, +9.725453442532574e-01, +9.691456634185092e-01,
- +9.654406178310209e-01, +9.614043615076308e-01, +9.570113065179300e-01,
- +9.522367669696690e-01, +9.470548839544214e-01, +9.414403740008491e-01,
- +9.353691612846549e-01, +9.288190093977164e-01, +9.217662887169115e-01,
- +9.141896283466009e-01, +9.060694681113471e-01, +8.973891675497357e-01,
- +8.881332000806269e-01, +8.782893885841422e-01, +8.678469565343039e-01,
- +8.567970644671067e-01, +8.451334654019180e-01, +8.328542805780399e-01,
- +8.199594783897041e-01, +8.064511006873497e-01, +7.923346478686025e-01,
- +7.776204488292163e-01, +7.623206183595970e-01, +7.464486491227057e-01,
- +7.300205729992958e-01, +7.130567383226717e-01, +6.955805444755916e-01,
- +6.776173229836567e-01, +6.591955305148172e-01, +6.403486426892321e-01,
- +6.211072197441818e-01, +6.015049275244730e-01, +5.815787608870452e-01,
- +5.613674511156324e-01, +5.409188627354076e-01, +5.202736834971303e-01,
- +4.994780733459294e-01, +4.785774177949064e-01, +4.576172599874928e-01,
- +4.366490208265804e-01, +4.157221460415995e-01, +3.948856590950757e-01,
- +3.741903189229770e-01, +3.536868899553974e-01, +3.334260017756462e-01,
- +3.134586473252229e-01, +2.938337904395871e-01, +2.745992637590817e-01,
- +2.558030636168172e-01, +2.374902188466697e-01, +2.197036032185785e-01,
- +2.024855415115456e-01, +1.858749915117319e-01, +1.699067802117410e-01,
- +1.546132267478873e-01, +1.400238206749695e-01, +1.261637395672913e-01,
- +1.130534434072719e-01, +1.007084973747940e-01, +8.914024389873081e-02,
- +7.835612100141792e-02, +6.835821233920988e-02, +5.914211536028976e-02,
- +5.069893012340832e-02, +4.301717763585550e-02, +3.608020726673359e-02,
- +2.986316337017630e-02, +2.433722657129812e-02, +1.947675241971700e-02,
- +1.525710171255895e-02, +1.163787492636240e-02, +8.433087782643718e-03,
- +4.449668997344735e-03, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- // LC3 Specification d09r01.pdf; Page 96 of 177
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00};
-
-// Section 5.7.2.5 w480 (d09r01.pdf)
-double w_N480[960] = {
- -2.353032150516754e-04, -4.619898752628163e-04, -6.262931535610879e-04,
- -7.929180432976445e-04, -9.747166718929050e-04, -1.180256894474562e-03,
- -1.409209039594871e-03, -1.664473096973725e-03, -1.946591608170231e-03,
- -2.257081732588478e-03, -2.597106916737789e-03, -2.967607624839524e-03,
- -3.370454877988472e-03, -3.806285163352241e-03, -4.276873767639064e-03,
- -4.782469904501813e-03, -5.324608721716763e-03, -5.903403814095400e-03,
- -6.520419726599805e-03, -7.175885277771099e-03, -7.871422820642307e-03,
- -8.606586039759667e-03, -9.382480860899108e-03, -1.019827182163307e-02,
- -1.105520547739066e-02, -1.195270300743193e-02, -1.289205910303846e-02,
- -1.387263484323160e-02, -1.489528159506296e-02, -1.595856621933800e-02,
- -1.706288556735433e-02, -1.820666399965468e-02, -1.939065975232718e-02,
- -2.061355417582714e-02, -2.187570925786862e-02, -2.317526315266411e-02,
- -2.451227449041489e-02, -2.588471937157619e-02, -2.729263737090799e-02,
- -2.873390902713615e-02, -3.020862738245264e-02, -3.171440372994384e-02,
- -3.325098858986303e-02, -3.481597793538342e-02, -3.640892406933019e-02,
- -3.802742318209150e-02, -3.967067992672979e-02, -4.133575417353826e-02,
- -4.302203371734278e-02, -4.472698045914417e-02, -4.645022292934329e-02,
- -4.818891490266687e-02, -4.994225863256500e-02, -5.170690802826666e-02,
- -5.348162036097223e-02, -5.526334794593565e-02, -5.705123152423822e-02,
- -5.884271749745559e-02, -6.063717235243996e-02, -6.243104027829089e-02,
- -6.422303545004304e-02, -6.600961519440657e-02, -6.778962269634495e-02,
- -6.955996868581379e-02, -7.131966266443390e-02, -7.306581273272733e-02,
- -7.479758913001458e-02, -7.651178225890490e-02, -7.820711420768856e-02,
- -7.988010693411644e-02, -8.152964005319532e-02, -8.315237353264004e-02,
- // LC3 Specification d09r01.pdf; Page 97 of 177
- -8.474728946770714e-02, -8.631137544905677e-02, -8.784374452959058e-02,
- -8.934164364321417e-02, -9.080411291245728e-02, -9.222795761428432e-02,
- -9.361232867223340e-02, -9.495377758870335e-02, -9.625155313139856e-02,
- -9.750284620437569e-02, -9.870736514214426e-02, -9.986271288271026e-02,
- -1.009680221406219e-01, -1.020202684361974e-01, -1.030183804850491e-01,
- -1.039596356759290e-01, -1.048438825017798e-01, -1.056686838192766e-01,
- -1.064342821660323e-01, -1.071382314127799e-01, -1.077799961121537e-01,
- -1.083570625865931e-01, -1.088690135027248e-01, -1.093135588677235e-01,
- -1.096903559498340e-01, -1.099969655786929e-01, -1.102332261219973e-01,
- -1.103972812085189e-01, -1.104898474883336e-01, -1.105086416532167e-01,
- -1.104537426996073e-01, -1.103225838568563e-01, -1.101145827722143e-01,
- -1.098276928170364e-01, -1.094621746650760e-01, -1.090163960055733e-01,
- -1.084908852561722e-01, -1.078834293141886e-01, -1.071937180231978e-01,
- -1.064196358069465e-01, -1.055612509762041e-01, -1.046162812518618e-01,
- -1.035849043557610e-01, -1.024650162703341e-01, -1.012568997532046e-01,
- -9.995864571932928e-02, -9.857014566194627e-02, -9.708911135857967e-02,
- -9.551545820689084e-02, -9.384684920715425e-02, -9.208300062891550e-02,
- -9.022171021406450e-02, -8.826309993000785e-02, -8.620493821803937e-02,
- -8.404742152815330e-02, -8.178792716809512e-02, -7.942625026703617e-02,
- -7.695980775819990e-02, -7.438785600211463e-02, -7.170797002873608e-02,
- -6.891994783815969e-02, -6.602189797715241e-02, -6.301349420724424e-02,
- -5.989191912667712e-02, -5.665655641133161e-02, -5.330406164482222e-02,
- -4.983427241976235e-02, -4.624456893420224e-02, -4.253455686336916e-02,
- -3.870195772538443e-02, -3.474585776145929e-02, -3.066341518682682e-02,
- -2.645425077642105e-02, -2.211581608120528e-02, -1.764740541599136e-02,
- -1.304581363895818e-02, -8.310425696208936e-03, -3.438268661133170e-03,
- +1.570315476576933e-03, +6.717697635290676e-03, +1.200477020244778e-02,
- +1.743398319747869e-02, +2.300642061077823e-02, +2.872481423270595e-02,
- +3.458896350634671e-02, +4.060106462625085e-02, +4.676102915752826e-02,
- +5.307133911821893e-02, +5.953239090915557e-02, +6.614647812869151e-02,
- +7.291293184312803e-02, +7.983354189816511e-02, +8.690807412770696e-02,
- +9.413813765275064e-02, +1.015233140203748e-01, +1.090651518336202e-01,
- +1.167626546016197e-01, +1.246171387327525e-01, +1.326272948938113e-01,
- +1.407938190608664e-01, +1.491152519299797e-01, +1.575921408388593e-01,
- +1.662224799248571e-01, +1.750067399059861e-01, +1.839431938620024e-01,
- +1.930318183054904e-01, +2.022699854906251e-01, +2.116567430906184e-01,
- +2.211888523410642e-01, +2.308655379767671e-01, +2.406837992341654e-01,
- +2.506420640291662e-01, +2.607365124918583e-01, +2.709659073501196e-01,
- +2.813259021832532e-01, +2.918144694729168e-01, +3.024270279840051e-01,
- +3.131603499997996e-01, +3.240095704645023e-01, +3.349719592361666e-01,
- +3.460422935204829e-01, +3.572175180786021e-01, +3.684915649120530e-01,
- +3.798595119591716e-01, +3.913146885756875e-01, +4.028532873867052e-01,
- +4.144688328137527e-01, +4.261571642320424e-01, +4.379113897565727e-01,
- +4.497256320417501e-01, +4.615925445090212e-01, +4.735067030065239e-01,
- +4.854600184866710e-01, +4.974471592901086e-01, +5.094597228333853e-01,
- +5.214909841729947e-01, +5.335326819631583e-01, +5.455789811615239e-01,
- +5.576217157959890e-01, +5.696546730080154e-01, +5.816685576268035e-01,
- +5.936560624526468e-01, +6.056083823929643e-01, +6.175192060085208e-01,
- +6.293796611336280e-01, +6.411830842823245e-01, +6.529203544876097e-01,
- +6.645840786371451e-01, +6.761653499550255e-01, +6.876573952173626e-01,
- +6.990511539119996e-01, +7.103400549562944e-01, +7.215149331458728e-01,
- +7.325691772738999e-01, +7.434943718765665e-01, +7.542846327442048e-01,
- +7.649313654540612e-01, +7.754281892901473e-01, +7.857670170752049e-01,
- +7.959414651061612e-01, +8.059437233154637e-01, +8.157687070715176e-01,
- +8.254086223972127e-01, +8.348589373399948e-01, +8.441125827416620e-01,
- +8.531651194538425e-01, +8.620108336276733e-01, +8.706456337542150e-01,
- // LC3 Specification d09r01.pdf; Page 98 of 177
- +8.790631561061171e-01, +8.872599706865123e-01, +8.952313288619367e-01,
- +9.029751680353524e-01, +9.104863121445679e-01, +9.177625550620636e-01,
- +9.247997426966093e-01, +9.315962496426278e-01, +9.381494858921667e-01,
- +9.444588390359354e-01, +9.505220861927248e-01, +9.563402921286364e-01,
- +9.619114522936701e-01, +9.672366712325431e-01, +9.723156637834687e-01,
- +9.771501187120180e-01, +9.817397501303696e-01, +9.860865871353246e-01,
- +9.901906380163595e-01, +9.940557180662704e-01, +9.976842395284637e-01,
- +1.001080961257010e+00, +1.004247514102417e+00, +1.007188578458507e+00,
- +1.009906654565108e+00, +1.012407428282884e+00, +1.014694702432600e+00,
- +1.016774659209400e+00, +1.018650990561848e+00, +1.020330464463111e+00,
- +1.021817328911793e+00, +1.023118841384460e+00, +1.024240262467000e+00,
- +1.025189721888128e+00, +1.025972450969440e+00, +1.026596938589443e+00,
- +1.027069179375841e+00, +1.027397523939210e+00, +1.027587902203109e+00,
- +1.027648951922701e+00, +1.027585830688143e+00, +1.027408519661012e+00,
- +1.027122986826984e+00, +1.026738673647482e+00, +1.026261663878092e+00,
- +1.025701002415063e+00, +1.025061777648234e+00, +1.024353980976701e+00,
- +1.023582385618774e+00, +1.022756514615106e+00, +1.021880604350422e+00,
- +1.020963871317665e+00, +1.020009139549275e+00, +1.019027285501251e+00,
- +1.018019442784231e+00, +1.016996499560845e+00, +1.015957433206324e+00,
- +1.014923441259795e+00, +1.013915946100629e+00, +1.013047565149327e+00,
- +1.012216130365610e+00, +1.011044869639164e+00, +1.009914592130044e+00,
- +1.008824888092573e+00, +1.007773858455400e+00, +1.006761700412993e+00,
- +1.005786648810854e+00, +1.004848753962734e+00, +1.003946083413733e+00,
- +1.003078846506546e+00, +1.002245009135684e+00, +1.001444733905817e+00,
- +1.000676188436651e+00, +9.999393169239009e-01, +9.992320848298057e-01,
- +9.985548127155425e-01, +9.979055415627330e-01, +9.972842679758880e-01,
- +9.966890948441745e-01, +9.961203379971326e-01, +9.955761256313581e-01,
- +9.950565724564597e-01, +9.945597525471822e-01, +9.940860378486615e-01,
- +9.936337788972491e-01, +9.932031606606759e-01, +9.927921871265732e-01,
- +9.924015177880798e-01, +9.920297273323891e-01, +9.916767775088281e-01,
- +9.913408767719142e-01, +9.910230654424902e-01, +9.907216425865902e-01,
- +9.904366799536263e-01, +9.901668953434221e-01, +9.899131011580791e-01,
- +9.896735637374597e-01, +9.894488374513719e-01, +9.892374835404283e-01,
- +9.890401927796704e-01, +9.888556356037892e-01, +9.886843467692753e-01,
- +9.885247606051014e-01, +9.883778520531268e-01, +9.882423270582524e-01,
- +9.881185638915363e-01, +9.880051626345804e-01, +9.879032023766432e-01,
- +9.878111744348976e-01, +9.877295459610343e-01, +9.876571983429736e-01,
- +9.875949843246187e-01, +9.875412739766566e-01, +9.874969061399389e-01,
- +9.874606249127551e-01, +9.874329809802893e-01, +9.874126414437681e-01,
- +9.874004750404033e-01, +9.873949921033299e-01, +9.873969162747074e-01,
- +9.874049060317581e-01, +9.874197049003676e-01, +9.874399717110517e-01,
- +9.874663281231737e-01, +9.874973205882319e-01, +9.875338926695315e-01,
- +9.875746535410983e-01, +9.876201238703241e-01, +9.876689801932402e-01,
- +9.877221556193183e-01, +9.877781920433015e-01, +9.878376489591358e-01,
- +9.878991990245439e-01, +9.879637979933339e-01, +9.880300303653743e-01,
- +9.880984675859855e-01, +9.881678007807095e-01, +9.882390300097154e-01,
- +9.883107693992456e-01, +9.883835200189653e-01, +9.884560159878955e-01,
- +9.885294200392185e-01, +9.886022219397892e-01, +9.886749404176028e-01,
- +9.887466261142505e-01, +9.888182771263505e-01, +9.888882480852147e-01,
- +9.889574384705896e-01, +9.890247977602895e-01, +9.890911247701029e-01,
- +9.891551701556196e-01, +9.892178658748239e-01, +9.892779555818088e-01,
- +9.893365186903538e-01, +9.893923680007577e-01, +9.894462830852175e-01,
- +9.894972124952000e-01, +9.895463342815009e-01, +9.895923617530382e-01,
- +9.896362652966239e-01, +9.896772011542693e-01, +9.897162195263046e-01,
- +9.897520286480039e-01, +9.897859195209235e-01, +9.898170267411330e-01,
- +9.898462068764986e-01, +9.898725363809847e-01, +9.898975138787787e-01,
- // LC3 Specification d09r01.pdf; Page 99 of 177
- +9.899200050208486e-01, +9.899410789223559e-01, +9.899600605054418e-01,
- +9.899782261038060e-01, +9.899945557067980e-01, +9.900103500807507e-01,
- +9.900248320990181e-01, +9.900394023736973e-01, +9.900532105829365e-01,
- +9.900674746047259e-01, +9.900814722948890e-01, +9.900966926051257e-01,
- +9.901122448734595e-01, +9.901293790312005e-01, +9.901474648912307e-01,
- +9.901680598867444e-01, +9.901902265696609e-01, +9.902151896501201e-01,
- +9.902424418296485e-01, +9.902734448815004e-01, +9.903071270768942e-01,
- +9.903448913950654e-01, +9.903862280081246e-01, +9.904324484666853e-01,
- +9.904825650601110e-01, +9.905379830873822e-01, +9.905980602136440e-01,
- +9.906640366554630e-01, +9.907348826312993e-01, +9.908120376822228e-01,
- +9.908947858311721e-01, +9.909842592301273e-01, +9.910795247770178e-01,
- +9.911819240108124e-01, +9.912905118607647e-01, +9.914064705361564e-01,
- +9.915288011543961e-01, +9.916586940166509e-01, +9.917952720685562e-01,
- +9.919396217291009e-01, +9.920906151219310e-01, +9.922495028313456e-01,
- +9.924152398352751e-01, +9.925887208794144e-01, +9.927688708468421e-01,
- +9.929569112537944e-01, +9.931516528513824e-01, +9.933539244159140e-01,
- +9.935626893131695e-01, +9.937790866568735e-01, +9.940016434044485e-01,
- +9.942312024833810e-01, +9.944668184371617e-01, +9.947093441694513e-01,
- +9.949572854565533e-01, +9.952116634297566e-01, +9.954712635321227e-01,
- +9.957367951478069e-01, +9.960068616185641e-01, +9.962823025614079e-01,
- +9.965617986382630e-01, +9.968461329825753e-01, +9.971338271912752e-01,
- +9.974256691222113e-01, +9.977203369515556e-01, +9.980185087055744e-01,
- +9.983185871761977e-01, +9.986213520769593e-01, +9.989255426466267e-01,
- +9.992317314100975e-01, +9.995382582242990e-01, +9.998461160718275e-01,
- +1.000153907612080e+00, +1.000461955079660e+00, +1.000768859280338e+00,
- +1.001075613053728e+00, +1.001380551217109e+00, +1.001684244734497e+00,
- +1.001985425397567e+00, +1.002284871786226e+00, +1.002580975161843e+00,
- +1.002874411368430e+00, +1.003163845364970e+00, +1.003450063374329e+00,
- +1.003731570287893e+00, +1.004009147462043e+00, +1.004281457582935e+00,
- +1.004549339226336e+00, +1.004811375053364e+00, +1.005068272394360e+00,
- +1.005318795748286e+00, +1.005563968008037e+00, +1.005802269635282e+00,
- +1.006034554002353e+00, +1.006259855360867e+00, +1.006479018139540e+00,
- +1.006690541428116e+00, +1.006895570408563e+00, +1.007093045696527e+00,
- +1.007283799246233e+00, +1.007466616298057e+00, +1.007642728426847e+00,
- +1.007811036585595e+00, +1.007972441990187e+00, +1.008125875904472e+00,
- +1.008272602383284e+00, +1.008411468616852e+00, +1.008543573152632e+00,
- +1.008668018334797e+00, +1.008786009787269e+00, +1.008896526233555e+00,
- +1.009000766336071e+00, +1.009097763850333e+00, +1.009188880897370e+00,
- +1.009273163797313e+00, +1.009351762546296e+00, +1.009423944949143e+00,
- +1.009491175244507e+00, +1.009552401900961e+00, +1.009608886895764e+00,
- +1.009659973830751e+00, +1.009707093778162e+00, +1.009749238562067e+00,
- +1.009787744284661e+00, +1.009822090220407e+00, +1.009853706282597e+00,
- +1.009881498943010e+00, +1.009906958448099e+00, +1.009929567021562e+00,
- +1.009950573483366e+00, +1.009969021400474e+00, +1.009986499185054e+00,
- +1.010002363879044e+00, +1.010017890428877e+00, +1.010032170180360e+00,
- +1.010046722045583e+00, +1.010060809299530e+00, +1.010075674445289e+00,
- +1.010090449982098e+00, +1.010106564965965e+00, +1.010123226584120e+00,
- +1.010141762173145e+00, +1.010161131093372e+00, +1.010182635897876e+00,
- +1.010205587931660e+00, +1.010231078494249e+00, +1.010257950227988e+00,
- +1.010287732968580e+00, +1.010319484524512e+00, +1.010354079663767e+00,
- +1.010390635488037e+00, +1.010430470494512e+00, +1.010472266495074e+00,
- +1.010517096381509e+00, +1.010564099281000e+00, +1.010614266894512e+00,
- +1.010666285876455e+00, +1.010721360243234e+00, +1.010778416755264e+00,
- +1.010838252644461e+00, +1.010899655674578e+00, +1.010963729626641e+00,
- +1.011029191301694e+00, +1.011096993993037e+00, +1.011165861239173e+00,
- +1.011236610341260e+00, +1.011308167670753e+00, +1.011381453638912e+00,
- // LC3 Specification d09r01.pdf; Page 100 of 177
- +1.011454785713102e+00, +1.011529185153809e+00, +1.011603680910505e+00,
- +1.011678803938046e+00, +1.011753008569803e+00, +1.011827484797985e+00,
- +1.011900936547881e+00, +1.011973876511603e+00, +1.012044885003304e+00,
- +1.012114985644919e+00, +1.012182837094955e+00, +1.012249023976742e+00,
- +1.012312095063070e+00, +1.012373028737774e+00, +1.012430463679316e+00,
- +1.012484972246822e+00, +1.012535058602453e+00, +1.012581678169188e+00,
- +1.012623472898504e+00, +1.012660975529858e+00, +1.012692758750213e+00,
- +1.012719789201144e+00, +1.012740575296603e+00, +1.012755753887085e+00,
- +1.012763948841204e+00, +1.012765922449960e+00, +1.012760298661069e+00,
- +1.012747819936584e+00, +1.012726958954961e+00, +1.012698607692183e+00,
- +1.012661400539405e+00, +1.012615904116265e+00, +1.012560833005713e+00,
- +1.012497050269805e+00, +1.012422888521601e+00, +1.012339226241367e+00,
- +1.012244921966297e+00, +1.012140460211194e+00, +1.012024302085441e+00,
- +1.011897560567707e+00, +1.011758810583150e+00, +1.011608449127642e+00,
- +1.011445162723270e+00, +1.011269960947744e+00, +1.011081255645969e+00,
- +1.010879608424312e+00, +1.010663676735228e+00, +1.010434184200640e+00,
- +1.010189681124657e+00, +1.009930754807923e+00, +1.009655660215271e+00,
- +1.009365251564694e+00, +1.009058249873833e+00, +1.008734758578989e+00,
- +1.008393079963091e+00, +1.008034308295421e+00, +1.007656661215973e+00,
- +1.007260142622887e+00, +1.006843352506855e+00, +1.006407009542103e+00,
- +1.005949145170711e+00, +1.005470005637052e+00, +1.004967986424467e+00,
- +1.004443531995945e+00, +1.003894772403371e+00, +1.003321903663793e+00,
- +1.002723127308148e+00, +1.002098854400575e+00, +1.001447278873483e+00,
- +1.000768505317086e+00, +1.000060686758758e+00, +9.993242684851855e-01,
- +9.985573503390627e-01, +9.977600196406868e-01, +9.969306036935497e-01,
- +9.960694269553644e-01, +9.951746430061121e-01, +9.942466438407230e-01,
- +9.932837131068657e-01, +9.922861082472264e-01, +9.912523092989319e-01,
- +9.901827419790691e-01, +9.890757868707590e-01, +9.879313024174022e-01,
- +9.863553220272523e-01, +9.847362453480265e-01, +9.831750948772566e-01,
- +9.815583336011345e-01, +9.798613526271561e-01, +9.780617486993630e-01,
- +9.761574317374303e-01, +9.741378617337759e-01, +9.719990112065752e-01,
- +9.697327413658168e-01, +9.673331975559332e-01, +9.647915124057732e-01,
- +9.621011497566145e-01, +9.592539757044516e-01, +9.562427177295731e-01,
- +9.530600909726344e-01, +9.496984081652284e-01, +9.461498120176854e-01,
- +9.424071613625743e-01, +9.384634163826711e-01, +9.343112966094085e-01,
- +9.299449872197452e-01, +9.253567968750328e-01, +9.205404627076625e-01,
- +9.154896280575360e-01, +9.101986790930605e-01, +9.046620597741508e-01,
- +8.988755194372424e-01, +8.928338316495705e-01, +8.865337190368053e-01,
- +8.799712722567934e-01, +8.731437835983047e-01, +8.660476534563131e-01,
- +8.586812520174252e-01, +8.510420440685049e-01, +8.431297226886574e-01,
- +8.349435141989714e-01, +8.264839911291133e-01, +8.177505366573690e-01,
- +8.087449817124315e-01, +7.994681492797084e-01, +7.899235162194718e-01,
- +7.801137731566502e-01, +7.700431275216928e-01, +7.597145736971065e-01,
- +7.491330971820804e-01, +7.383028603058783e-01, +7.272298755824693e-01,
- +7.159201919962611e-01, +7.043814340356083e-01, +6.926196927377140e-01,
- +6.806438831866077e-01, +6.684616478236647e-01, +6.560830137986515e-01,
- +6.435179268559957e-01, +6.307755329382612e-01, +6.178641647786525e-01,
- +6.047954625702541e-01, +5.915799587176216e-01, +5.782289366005894e-01,
- +5.647535885752191e-01, +5.511703155400274e-01, +5.374905090437071e-01,
- +5.237263500445715e-01, +5.098915423728255e-01, +4.960008074926423e-01,
- +4.820662943337458e-01, +4.681017110048007e-01, +4.541216995958746e-01,
- +4.401421815729068e-01, +4.261772971493010e-01, +4.122417888542512e-01,
- +3.983499612526493e-01, +3.845172335531009e-01, +3.707583717376236e-01,
- +3.570886786795506e-01, +3.435228672445627e-01, +3.300763764703638e-01,
- +3.167640325043893e-01, +3.036004651973109e-01, +2.905996158436682e-01,
- +2.777758503744847e-01, +2.651434678028531e-01, +2.527161881181577e-01,
- // LC3 Specification d09r01.pdf; Page 101 of 177
- +2.405069849650012e-01, +2.285283969438072e-01, +2.167933432162879e-01,
- +2.053139897833021e-01, +1.941021906320988e-01, +1.831680872008943e-01,
- +1.725221947208913e-01, +1.621735416384834e-01, +1.521320683467849e-01,
- +1.424052801149985e-01, +1.330015240938615e-01, +1.239260664828526e-01,
- +1.151858295527293e-01, +1.067840430193724e-01, +9.872637505002878e-02,
- +9.101379000888035e-02, +8.365057236623055e-02, +7.663508305536153e-02,
- +6.997033405748826e-02, +6.365188111381365e-02, +5.768176015814392e-02,
- +5.205244216987966e-02, +4.676538412257621e-02, +4.180950541438362e-02,
- +3.718640251368464e-02, +3.288072750732215e-02, +2.889548499582958e-02,
- +2.520980565928884e-02, +2.183057564646272e-02, +1.872896194002638e-02,
- +1.592127815153420e-02, +1.336381425803020e-02, +1.108558877807282e-02,
- +8.943474189364638e-03, +6.758124889697787e-03, +3.504438130619497e-03,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- // LC3 Specification d09r01.pdf; Page 102 of 177
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00,
- +0.000000000000000e+00, +0.000000000000000e+00, +0.000000000000000e+00};
-
-// LC3 Specification d09r04_*implementorComments*
-// Section 3.7.3 Low delay MDCT windows
-// Section 3.7.3.2 7.5 ms Frame Duration
-
-// Section 3.7.3.2.1 w_7.5_60 (d09r04_*implementorComments*)
-double w_N60_7p5ms[120] = {
- 2.950608593187313e-03, 7.175411316438510e-03, 1.376953735371754e-02,
- 2.309535564877266e-02, 3.540362298325999e-02, 5.082893035710152e-02,
- 6.946962925951473e-02, 9.138842778133426e-02, 1.166045748296231e-01,
- 1.450735459839195e-01, 1.767111740534608e-01, 2.113429529554800e-01,
- 2.487686144599148e-01, 2.887011017469859e-01, 3.308238711499938e-01,
- 3.748145444067251e-01, 4.203080130472308e-01, 4.669049179648736e-01,
- 5.141853413578332e-01, 5.617100406669413e-01, 6.090263461524341e-01,
- 6.556710162134097e-01, 7.012183842298189e-01, 7.452406787622362e-01,
- 7.873692060484326e-01, 8.272238334368036e-01, 8.645136750188277e-01,
- 8.989774146126214e-01, 9.304075179845523e-01, 9.585999373974852e-01,
- 9.834477193784226e-01, 1.004882833289021e+00, 1.022853807278541e+00,
- 1.037404947967044e+00, 1.048597914202596e+00, 1.056561843427440e+00,
- 1.061493706243562e+00, 1.063625783716980e+00, 1.063259727973876e+00,
- 1.060745048351166e+00, 1.056435897894500e+00, 1.050695001011264e+00,
- 1.043924345068839e+00, 1.036477246028582e+00, 1.028728673666003e+00,
- 1.021064859918030e+00, 1.014006582262175e+00, 1.007274550102931e+00,
- 1.001722497437142e+00, 9.973095916665831e-01, 9.939851582601669e-01,
- 9.916833348089591e-01, 9.903253250249126e-01, 9.898226125376152e-01,
- 9.900747339893667e-01, 9.909753143689592e-01, 9.924128512256524e-01,
- 9.942731493578623e-01, 9.964391574315900e-01, 9.987916157534086e-01,
- 1.001209846205687e+00, 1.003573567479612e+00, 1.005759836364722e+00,
- 1.007645153692818e+00, 1.009106872290545e+00, 1.010024764464639e+00,
- 1.010282031682720e+00, 1.009769188700535e+00, 1.008386412173240e+00,
- 1.006051238984656e+00, 1.002697666156926e+00, 9.982804644584213e-01,
- 9.927779867939798e-01, 9.861868921689572e-01, 9.776341643922554e-01,
- 9.674472695701162e-01, 9.551297254161167e-01, 9.403898774115922e-01,
- 9.229592799642977e-01, 9.026073499372684e-01, 8.792026885629480e-01,
- 8.526417497265664e-01, 8.228812716163106e-01, 7.899717151715774e-01,
- 7.540303276706357e-01, 7.152557417328465e-01, 6.739369112409073e-01,
- 6.304147162292445e-01, 5.850788579084674e-01, 5.383985182966198e-01,
- 4.908337531732809e-01, 4.428858232573716e-01, 3.950910240537553e-01,
- 3.480043431985102e-01, 3.021967102409465e-01, 2.582274305805284e-01,
- 2.166414164389013e-01, 1.779221215201146e-01, 1.424805471287674e-01,
- 1.106521943353717e-01, 8.269959669528287e-02, 5.883345162013132e-02,
- 3.920308484545646e-02, 2.386291074479415e-02, 1.269762234246248e-02,
- 5.356653610215987e-03, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00};
-
-// Section 3.7.3.2.2 w_7.5_120 (d09r04_*implementorComments*)
-double w_N120_7p5ms[240] = {
- 2.208248743046650e-03, 3.810144195090351e-03, 5.915524734289813e-03,
- 8.583614568030036e-03, 1.187597226083452e-02, 1.583353014097089e-02,
- 2.049186515516006e-02, 2.588835928921542e-02, 3.204158944817544e-02,
- 3.896167212395468e-02, 4.667421691393490e-02, 5.518493372761350e-02,
- 6.450383844383757e-02, 7.464110714806732e-02, 8.560001618878993e-02,
- 9.738467025048170e-02, 1.099936025389733e-01, 1.234192774722812e-01,
- 1.376554565476283e-01, 1.526904374639564e-01, 1.685133626404965e-01,
- 1.850931046131430e-01, 2.024104194879864e-01, 2.204503651331880e-01,
- 2.391679406203077e-01, 2.585261682883327e-01, 2.784985387736362e-01,
- 2.990384315995911e-01, 3.201048623655521e-01, 3.416586222430363e-01,
- 3.636600340252121e-01, 3.860626951895035e-01, 4.088152724594432e-01,
- 4.318710458458660e-01, 4.551769877048139e-01, 4.786765926352632e-01,
- 5.023248131381035e-01, 5.260609162248473e-01, 5.498312828850233e-01,
- 5.735768827770059e-01, 5.972413384410342e-01, 6.207702424193973e-01,
- 6.440996624336124e-01, 6.671763816763950e-01, 6.899588537658654e-01,
- 7.123799800931302e-01, 7.343963718694788e-01, 7.559666880505324e-01,
- 7.770369811015168e-01, 7.975581136897942e-01, 8.174908555311138e-01,
- 8.367969496408532e-01, 8.554473095679163e-01, 8.734007983991156e-01,
- 8.906357189698083e-01, 9.071287701238782e-01, 9.228487835702877e-01,
- 9.377633225341820e-01, 9.518602062527468e-01, 9.651306001536289e-01,
- 9.775565405467248e-01, 9.891262086779957e-01, 9.998469191683163e-01,
- 1.009700729703874e+00, 1.018682286908352e+00, 1.026814550859190e+00,
- 1.034089812751720e+00, 1.040511956629397e+00, 1.046108368522362e+00,
- 1.050885649534276e+00, 1.054862887578656e+00, 1.058072205849552e+00,
- 1.060534138670111e+00, 1.062276617517642e+00, 1.063338150260194e+00,
- 1.063755566766962e+00, 1.063566320618061e+00, 1.062821557530121e+00,
- 1.061559958917576e+00, 1.059817091581481e+00, 1.057658760384513e+00,
- 1.055120057365395e+00, 1.052239850719546e+00, 1.049087785713381e+00,
- 1.045698595146235e+00, 1.042108306824389e+00, 1.038380985588667e+00,
- 1.034552762539362e+00, 1.030671997181282e+00, 1.026791666942681e+00,
- 1.022955584022344e+00, 1.019207332137853e+00, 1.015872887197225e+00,
- 1.012210174593533e+00, 1.008845591036958e+00, 1.005778512486221e+00,
- 1.003002618498964e+00, 1.000514601809148e+00, 9.983092287560527e-01,
- 9.963786013745719e-01, 9.947181322797367e-01, 9.933162157118496e-01,
- 9.921669569649387e-01, 9.912586027088507e-01, 9.905811038723256e-01,
- 9.901231181863754e-01, 9.898737119947000e-01, 9.898187066647253e-01,
- 9.899468001787191e-01, 9.902431753677082e-01, 9.906955635514434e-01,
- 9.912885401035934e-01, 9.920094690635668e-01, 9.928426927501408e-01,
- 9.937750666306635e-01, 9.947903979828719e-01, 9.958755336221258e-01,
- 9.970143670156726e-01, 9.981928706842119e-01, 9.993945064762333e-01,
- 1.000605860368296e+00, 1.001810400944408e+00, 1.002994573682287e+00,
- 1.004141548053574e+00, 1.005236884099094e+00, 1.006263925890636e+00,
- 1.007208903587772e+00, 1.008054893814649e+00, 1.008788016348394e+00,
- 1.009391822060050e+00, 1.009852958217732e+00, 1.010155293011166e+00,
- 1.010286018304889e+00, 1.010229878703309e+00, 1.009975407736885e+00,
- 1.009508455280294e+00, 1.008818483155921e+00, 1.007894884001199e+00,
- 1.006728757854175e+00, 1.005309913983530e+00, 1.003634560818982e+00,
- 1.001693634792953e+00, 9.994856628696702e-01, 9.970063702291652e-01,
- 9.942546868773952e-01, 9.912319673936767e-01, 9.879371153343368e-01,
- 9.843751246861034e-01, 9.798909633127684e-01, 9.752698788428587e-01,
- 9.701804980040253e-01, 9.645800268203278e-01, 9.584255335155275e-01,
- 9.516840138455831e-01, 9.443202322315050e-01, 9.362906241698766e-01,
- 9.275805069442316e-01, 9.181534137230351e-01, 9.079765240138057e-01,
- 8.970500584793123e-01, 8.853513603848177e-01, 8.728579265043998e-01,
- 8.595798186504622e-01, 8.455026150386550e-01, 8.306199433014801e-01,
- 8.149466481575340e-01, 7.984893775294407e-01, 7.812624496601451e-01,
- 7.632917692550881e-01, 7.445908434203883e-01, 7.251992870809165e-01,
- 7.051536683608545e-01, 6.844905446038185e-01, 6.632452099313783e-01,
- 6.414771616618185e-01, 6.192353336355413e-01, 5.965591325427860e-01,
- 5.735199893648143e-01, 5.501738510234542e-01, 5.265685382300127e-01,
- 5.027811586638018e-01, 4.788608890561979e-01, 4.548778943490807e-01,
- 4.308981228989757e-01, 4.069939642056274e-01, 3.832340305827807e-01,
- 3.596800983344559e-01, 3.364081000913040e-01, 3.134964181526467e-01,
- 2.910105654938709e-01, 2.690195851087463e-01, 2.475843475618672e-01,
- 2.267884333851992e-01, 2.066777706538489e-01, 1.873103432384193e-01,
- 1.687396441250691e-01, 1.510123820588979e-01, 1.341718422797088e-01,
- 1.182546623256353e-01, 1.032907339774596e-01, 8.931173602725516e-02,
- 7.634297866041775e-02, 6.440772914585903e-02, 5.352437147393933e-02,
- 4.370844528199230e-02, 3.496670991534089e-02, 2.729846292648297e-02,
- 2.068958080348781e-02, 1.511251252352759e-02, 1.052287538118900e-02,
- 6.855473143120779e-03, 4.023511190940974e-03, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00};
-
-// Section 3.7.3.2.3 w_7.5_180 (d09r04_*implementorComments*)
-double w_N180_7p5ms[360] = {
- 1.970849076512990e-03, 2.950608593187313e-03, 4.124477213467950e-03,
- 5.526886639437362e-03, 7.175411316438510e-03, 9.087577304291669e-03,
- 1.128191051703656e-02, 1.376953735371754e-02, 1.656002661605294e-02,
- 1.966508945492317e-02, 2.309535564877266e-02, 2.686128938982976e-02,
- 3.096325597431720e-02, 3.540362298325999e-02, 4.019156101100901e-02,
- 4.533314033337320e-02, 5.082893035710152e-02, 5.668154478534839e-02,
- 6.289353044640154e-02, 6.946962925951473e-02, 7.641063136809326e-02,
- 8.371600156519982e-02, 9.138842778133426e-02, 9.942940076792395e-02,
- 1.078347249723074e-01, 1.166045748296231e-01, 1.257365027864348e-01,
- 1.352268113395951e-01, 1.450735459839195e-01, 1.552738186648721e-01,
- 1.658221942341435e-01, 1.767111740534608e-01, 1.879287758848813e-01,
- 1.994731798188807e-01, 2.113429529554800e-01, 2.235245540318082e-01,
- 2.360030996517997e-01, 2.487686144599148e-01, 2.618138107489893e-01,
- 2.751291608544314e-01, 2.887011017469859e-01, 3.025140336309949e-01,
- 3.165588052366450e-01, 3.308238711499938e-01, 3.452955666730954e-01,
- 3.599639915662127e-01, 3.748145444067251e-01, 3.898318165532388e-01,
- 4.050010096015846e-01, 4.203080130472308e-01, 4.357395152859960e-01,
- 4.512778173547499e-01, 4.669049179648736e-01, 4.826090405673480e-01,
- 4.983754662664123e-01, 5.141853413578332e-01, 5.300214783136831e-01,
- 5.458693517886994e-01, 5.617100406669413e-01, 5.775281514417204e-01,
- 5.933046964262578e-01, 6.090263461524341e-01, 6.246741889386914e-01,
- 6.402275547146322e-01, 6.556710162134097e-01, 6.709959346439072e-01,
- 6.861845587972498e-01, 7.012183842298189e-01, 7.160784485622184e-01,
- 7.307560841550591e-01, 7.452406787622362e-01, 7.595151215738793e-01,
- 7.735619554086122e-01, 7.873692060484326e-01, 8.009231377307978e-01,
- 8.142113863131932e-01, 8.272238334368036e-01, 8.399523741938065e-01,
- 8.523861023610134e-01, 8.645136750188277e-01, 8.763240788355384e-01,
- 8.878142883924764e-01, 8.989774146126214e-01, 9.098033189281092e-01,
- 9.202843119253094e-01, 9.304075179845523e-01, 9.401696522166354e-01,
- 9.495677949302647e-01, 9.585999373974852e-01, 9.672602600117832e-01,
- 9.755451659417252e-01, 9.834477193784226e-01, 9.909719572606611e-01,
- 9.981192686440387e-01, 1.004882833289021e+00, 1.011257731140136e+00,
- 1.017244362189382e+00, 1.022853807278541e+00, 1.028087338709125e+00,
- 1.032937063258800e+00, 1.037404947967044e+00, 1.041501641198980e+00,
- 1.045232355730946e+00, 1.048597914202596e+00, 1.051603395002874e+00,
- 1.054255050268478e+00, 1.056561843427440e+00, 1.058534002822506e+00,
- 1.060174135407872e+00, 1.061493706243562e+00, 1.062499430330238e+00,
- 1.063205771472337e+00, 1.063625783716980e+00, 1.063764865344437e+00,
- 1.063637778334477e+00, 1.063259727973876e+00, 1.062646953245063e+00,
- 1.061804962699513e+00, 1.060745048351166e+00, 1.059484915739590e+00,
- 1.058045332777575e+00, 1.056435897894500e+00, 1.054662178717384e+00,
- 1.052740474459255e+00, 1.050695001011264e+00, 1.048538935354313e+00,
- 1.046278982648917e+00, 1.043924345068839e+00, 1.041495397384132e+00,
- 1.039010026880522e+00, 1.036477246028582e+00, 1.033907928361672e+00,
- 1.031319893754215e+00, 1.028728673666003e+00, 1.026148319362665e+00,
- 1.023589880840269e+00, 1.021064859918030e+00, 1.018562619376553e+00,
- 1.016557703375972e+00, 1.014006582262175e+00, 1.011629525863078e+00,
- 1.009385901800645e+00, 1.007274550102931e+00, 1.005296164582239e+00,
- 1.003445259887302e+00, 1.001722497437142e+00, 1.000127924463537e+00,
- 9.986575334669062e-01, 9.973095916665831e-01, 9.960835710929218e-01,
- 9.949765689814285e-01, 9.939851582601669e-01, 9.931075300522219e-01,
- 9.923413052310536e-01, 9.916833348089591e-01, 9.911300696314259e-01,
- 9.906783251641723e-01, 9.903253250249126e-01, 9.900675621816006e-01,
- 9.899012818722897e-01, 9.898226125376152e-01, 9.898278454016073e-01,
- 9.899132411259368e-01, 9.900747339893667e-01, 9.903082558387314e-01,
- 9.906098517881138e-01, 9.909753143689592e-01, 9.914003304461825e-01,
- 9.918809661701072e-01, 9.924128512256524e-01, 9.929917790758115e-01,
- 9.936133813858116e-01, 9.942731493578623e-01, 9.949669577858075e-01,
- 9.956903701113655e-01, 9.964391574315900e-01, 9.972085721948355e-01,
- 9.979942749676792e-01, 9.987916157534086e-01, 9.995960619759856e-01,
- 1.000404101255877e+00, 1.001209846205687e+00, 1.002009756050340e+00,
- 1.002799241686241e+00, 1.003573567479612e+00, 1.004328283187225e+00,
- 1.005058501867633e+00, 1.005759836364722e+00, 1.006427669689071e+00,
- 1.007057682723931e+00, 1.007645153692818e+00, 1.008185492117307e+00,
- 1.008674265369618e+00, 1.009106872290545e+00, 1.009479158919060e+00,
- 1.009786593319936e+00, 1.010024764464639e+00, 1.010189538289831e+00,
- 1.010276690684798e+00, 1.010282031682720e+00, 1.010201742651156e+00,
- 1.010032080837507e+00, 1.009769188700535e+00, 1.009409386073207e+00,
- 1.008949310126241e+00, 1.008386412173240e+00, 1.007717803066923e+00,
- 1.006940305796912e+00, 1.006051238984656e+00, 1.005048793283357e+00,
- 1.003931827630468e+00, 1.002697666156926e+00, 1.001344271172154e+00,
- 9.998720918990379e-01, 9.982804644584213e-01, 9.965665691741982e-01,
- 9.947317370056415e-01, 9.927779867939798e-01, 9.907013741881066e-01,
- 9.885041652445283e-01, 9.861868921689572e-01, 9.837119886839835e-01,
- 9.805846431095010e-01, 9.776341643922554e-01, 9.744550331507363e-01,
- 9.710629155613092e-01, 9.674472695701162e-01, 9.635939262874074e-01,
- 9.594913983473223e-01, 9.551297254161167e-01, 9.505013259120755e-01,
- 9.455928103144016e-01, 9.403898774115922e-01, 9.348867604141315e-01,
- 9.290805587106350e-01, 9.229592799642976e-01, 9.165095791928667e-01,
- 9.097244560733702e-01, 9.026073499372684e-01, 8.951550837577193e-01,
- 8.873561542082500e-01, 8.792026885629480e-01, 8.706996978416294e-01,
- 8.618474244579353e-01, 8.526417497265664e-01, 8.430778332415034e-01,
- 8.331549046805315e-01, 8.228812716163106e-01, 8.122575969197091e-01,
- 8.012854392434710e-01, 7.899717151715774e-01, 7.783181771724644e-01,
- 7.663377104116385e-01, 7.540303276706357e-01, 7.414079909457567e-01,
- 7.284775008035390e-01, 7.152557417328465e-01, 7.017517394571592e-01,
- 6.879756318118113e-01, 6.739369112409073e-01, 6.596525732013095e-01,
- 6.451394890668392e-01, 6.304147162292445e-01, 6.154836219271654e-01,
- 6.003658519413984e-01, 5.850788579084674e-01, 5.696495364564049e-01,
- 5.540848098312343e-01, 5.383985182966198e-01, 5.226147377537511e-01,
- 5.067568049662954e-01, 4.908337531732726e-01, 4.748660326525270e-01,
- 4.588765658108130e-01, 4.428858232573716e-01, 4.269065392300330e-01,
- 4.109709733914872e-01, 3.950910240537540e-01, 3.792913270170828e-01,
- 3.635874169858631e-01, 3.480043431985094e-01, 3.325632006175457e-01,
- 3.172874848823412e-01, 3.021967102409465e-01, 2.873094025754711e-01,
- 2.726439916003860e-01, 2.582274305805277e-01, 2.440728561740129e-01,
- 2.302089773823469e-01, 2.166414164389010e-01, 2.033984806897052e-01,
- 1.904861615463941e-01, 1.779221215201146e-01, 1.657266744835887e-01,
- 1.539063966799855e-01, 1.424805471287671e-01, 1.314539801011583e-01,
- 1.208417782380949e-01, 1.106521943353716e-01, 1.008917341936222e-01,
- 9.157188508647542e-02, 8.269959669528287e-02, 7.428155288862677e-02,
- 6.632423815331720e-02, 5.883345162013123e-02, 5.181406762377953e-02,
- 4.526983455651076e-02, 3.920308484545643e-02, 3.361441594214110e-02,
- 2.850233081562859e-02, 2.386291074479415e-02, 1.968942265531783e-02,
- 1.597205270240860e-02, 1.269762234246247e-02, 9.849377394464552e-03,
- 7.407244632998355e-03, 5.356653610215985e-03, 3.832265518746914e-03,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00};
-
-// Section 3.7.3.2.4 w_7.5_240 (d09r04_*implementorComments*)
-double w_N240_7p5ms[480] = {
- 1.848330370601890e-03, 2.564818394430541e-03, 3.367621175255762e-03,
- 4.287366172947020e-03, 5.338301429131479e-03, 6.526792229804446e-03,
- 7.861125872744963e-03, 9.346281793294168e-03, 1.099168677073023e-02,
- 1.280111724327587e-02, 1.478059105262588e-02, 1.693070430750747e-02,
- 1.925923070409017e-02, 2.176969372101092e-02, 2.446859826144651e-02,
- 2.735565427385896e-02, 3.043192302576378e-02, 3.369804639006632e-02,
- 3.715835772551574e-02, 4.081481795207546e-02, 4.467080684234739e-02,
- 4.872629952625619e-02, 5.298206325441551e-02, 5.743824696664848e-02,
- 6.209685798752235e-02, 6.696097666085293e-02, 7.202983636789818e-02,
- 7.730391464771366e-02, 8.278255740953620e-02, 8.846821015931731e-02,
- 9.436075664518449e-02, 1.004602720036002e-01, 1.067638237504515e-01,
- 1.132736794406103e-01, 1.199864202730101e-01, 1.269035206805856e-01,
- 1.340208531277774e-01, 1.413395568701277e-01, 1.488572112889720e-01,
- 1.565736853381255e-01, 1.644846220563571e-01, 1.725890765381433e-01,
- 1.808790898204713e-01, 1.893543196006846e-01, 1.980122435284018e-01,
- 2.068541409946420e-01, 2.158753187570538e-01, 2.250686723708130e-01,
- 2.344274072499690e-01, 2.439483137105153e-01, 2.536279928378056e-01,
- 2.634640609879333e-01, 2.734504944781370e-01, 2.835821889865098e-01,
- 2.938534694786572e-01, 3.042573734615632e-01, 3.147909140113310e-01,
- 3.254491234269504e-01, 3.362274096618026e-01, 3.471187602907065e-01,
- 3.581201769604495e-01, 3.692246633783371e-01, 3.804277928712796e-01,
- 3.917200227416179e-01, 4.030970221548365e-01, 4.145519552168687e-01,
- 4.260817186124239e-01, 4.376763184816823e-01, 4.493301956572350e-01,
- 4.610348550393067e-01, 4.727860432828289e-01, 4.845767771787368e-01,
- 4.964017067665196e-01, 5.082524575564947e-01, 5.201220784839651e-01,
- 5.320020770005417e-01, 5.438880897441558e-01, 5.557716011811357e-01,
- 5.676457387746829e-01, 5.795027863150121e-01, 5.913350345927856e-01,
- 6.031383674734400e-01, 6.149041716859808e-01, 6.266239411056014e-01,
- 6.382888344252021e-01, 6.498933747767719e-01, 6.614323601501731e-01,
- 6.729025139063478e-01, 6.842937498334491e-01, 6.956004595358826e-01,
- 7.068117836489756e-01, 7.179234245192330e-01, 7.289313857272890e-01,
- 7.398327727973596e-01, 7.506189823719328e-01, 7.612840534177552e-01,
- 7.718189187016244e-01, 7.822209919639922e-01, 7.924813304551203e-01,
- 8.025994477230463e-01, 8.125652295019083e-01, 8.223771289200885e-01,
- 8.320305183749199e-01, 8.415232076745133e-01, 8.508483129483138e-01,
- 8.600024117819522e-01, 8.689798808251054e-01, 8.777783467294870e-01,
- 8.863959039558345e-01, 8.948294207910807e-01, 9.030776256602892e-01,
- 9.111326521556180e-01, 9.189935853649371e-01, 9.266529369336567e-01,
- 9.341114204165168e-01, 9.413643442928993e-01, 9.484129673709889e-01,
- 9.552556295973936e-01, 9.618920131378678e-01, 9.683163629086772e-01,
- 9.745301563621191e-01, 9.805283381417256e-01, 9.863139277672938e-01,
- 9.918860486198928e-01, 9.972463447664014e-01, 1.002391896644578e+00,
- 1.007319464375827e+00, 1.012027073435850e+00, 1.016516541512393e+00,
- 1.020794302688699e+00, 1.024860815794490e+00, 1.028714705809749e+00,
- 1.032351702719174e+00, 1.035773750472822e+00, 1.038984315074006e+00,
- 1.041987855398911e+00, 1.044785643573356e+00, 1.047378184121997e+00,
- 1.049767431495211e+00, 1.051954045543143e+00, 1.053942898562160e+00,
- 1.055734631473796e+00, 1.057341767323983e+00, 1.058757264938716e+00,
- 1.059986744473714e+00, 1.061036716870687e+00, 1.061906510844496e+00,
- 1.062603694906377e+00, 1.063132893292572e+00, 1.063502373941053e+00,
- 1.063709808061891e+00, 1.063763223461893e+00, 1.063667646046172e+00,
- 1.063430118187021e+00, 1.063056564385666e+00, 1.062554210368898e+00,
- 1.061922346664364e+00, 1.061167017783231e+00, 1.060294689234573e+00,
- 1.059314689493745e+00, 1.058234647303768e+00, 1.057058907527535e+00,
- 1.055789482473656e+00, 1.054429786866560e+00, 1.052987925902714e+00,
- 1.051475051645344e+00, 1.049899300533228e+00, 1.048262129495776e+00,
- 1.046566906015578e+00, 1.044816992642391e+00, 1.043021249196200e+00,
- 1.041187680907488e+00, 1.039323391025476e+00, 1.037431684165083e+00,
- 1.035517573311265e+00, 1.033585105989712e+00, 1.031643708543028e+00,
- 1.029699545977279e+00, 1.027759438517856e+00, 1.025827187037112e+00,
- 1.023907910886626e+00, 1.022008050685529e+00, 1.020139101207016e+00,
- 1.018263100813380e+00, 1.016879010849981e+00, 1.014921948187593e+00,
- 1.013096623369458e+00, 1.011342052440818e+00, 1.009659122960534e+00,
- 1.008050363886717e+00, 1.006517540250988e+00, 1.005057992517306e+00,
- 1.003669560904293e+00, 1.002353273092562e+00, 1.001109808447114e+00,
- 9.999375230640204e-01, 9.988345237783536e-01, 9.978006059268592e-01,
- 9.968357558473706e-01, 9.959388811568640e-01, 9.951084589555501e-01,
- 9.943434110903315e-01, 9.936429211981983e-01, 9.930058324270904e-01,
- 9.924309837770386e-01, 9.919174926403282e-01, 9.914638980147298e-01,
- 9.910682139572967e-01, 9.907292184488009e-01, 9.904462245644213e-01,
- 9.902178185518503e-01, 9.900419630667118e-01, 9.899170852600004e-01,
- 9.898419746989491e-01, 9.898150482937847e-01, 9.898343291371600e-01,
- 9.898982107247224e-01, 9.900054030605746e-01, 9.901541892638673e-01,
- 9.903424269195302e-01, 9.905684589910844e-01, 9.908309527413479e-01,
- 9.911280379271901e-01, 9.914575656842904e-01, 9.918178809274675e-01,
- 9.922075589719793e-01, 9.926247572992801e-01, 9.930673584123647e-01,
- 9.935333982795475e-01, 9.940214100660039e-01, 9.945296851337717e-01,
- 9.950559636181178e-01, 9.955983505434736e-01, 9.961555801042186e-01,
- 9.967256267769223e-01, 9.973060922083319e-01, 9.978952138542876e-01,
- 9.984914406319209e-01, 9.990928899877792e-01, 9.996970625756828e-01,
- 1.000303029223210e+00, 1.000907933607887e+00, 1.001510838557739e+00,
- 1.002109225614564e+00, 1.002701184533730e+00, 1.003285129964668e+00,
- 1.003859256498246e+00, 1.004421109631332e+00, 1.004968601327613e+00,
- 1.005500403806944e+00, 1.006014548452834e+00, 1.006508690831783e+00,
- 1.006981038626341e+00, 1.007430041056790e+00, 1.007853640055005e+00,
- 1.008249618432853e+00, 1.008616036239346e+00, 1.008951378362138e+00,
- 1.009253896674588e+00, 1.009521341935844e+00, 1.009751751331617e+00,
- 1.009943714668776e+00, 1.010095497366507e+00, 1.010204876790192e+00,
- 1.010270073045154e+00, 1.010289752336835e+00, 1.010262269696272e+00,
- 1.010185615431975e+00, 1.010058196828792e+00, 1.009878817836722e+00,
- 1.009645930489341e+00, 1.009357533197330e+00, 1.009012281815637e+00,
- 1.008609594360786e+00, 1.008148366592626e+00, 1.007626743165711e+00,
- 1.007043430506158e+00, 1.006397749801444e+00, 1.005688767931258e+00,
- 1.004915585834316e+00, 1.004077678781271e+00, 1.003174288376062e+00,
- 1.002204242070086e+00, 1.001166836141424e+00, 1.000062480839591e+00,
- 9.988914218622672e-01, 9.976522518001048e-01, 9.963438555404762e-01,
- 9.949674620221296e-01, 9.935246630184282e-01, 9.920139269077016e-01,
- 9.904332831340030e-01, 9.887851470099116e-01, 9.870726808604894e-01,
- 9.852974426119764e-01, 9.834011611313795e-01, 9.809494177655508e-01,
- 9.787827290446353e-01, 9.764682383490441e-01, 9.740428502007106e-01,
- 9.714988482797869e-01, 9.688299679017578e-01, 9.660309739278938e-01,
- 9.630951038651144e-01, 9.600181976898812e-01, 9.567957384046786e-01,
- 9.534262666962353e-01, 9.499034823039632e-01, 9.462221151684139e-01,
- 9.423758195026390e-01, 9.383617015143452e-01, 9.341777978631194e-01,
- 9.298231239088762e-01, 9.252923195046721e-01, 9.205801200661107e-01,
- 9.156797929682001e-01, 9.105906042938267e-01, 9.053150301587091e-01,
- 8.998527561071954e-01, 8.941994971184931e-01, 8.883501524279332e-01,
- 8.823016313374981e-01, 8.760548741525249e-01, 8.696123849407055e-01,
- 8.629727993296973e-01, 8.561351975749198e-01, 8.490981786073120e-01,
- 8.418570243421116e-01, 8.344140550191105e-01, 8.267746168752393e-01,
- 8.189392440268611e-01, 8.109048914872936e-01, 8.026753184506191e-01,
- 7.942537505258295e-01, 7.856416615920516e-01, 7.768386086617421e-01,
- 7.678531932560713e-01, 7.586851806705738e-01, 7.493306577133620e-01,
- 7.398091711550503e-01, 7.301099443577747e-01, 7.202477806201014e-01,
- 7.102241609901638e-01, 7.000443258461506e-01, 6.897118895404929e-01,
- 6.792311541046628e-01, 6.686081789247391e-01, 6.578509967842496e-01,
- 6.469657182336516e-01, 6.359596166227444e-01, 6.248403358991607e-01,
- 6.136035026791002e-01, 6.022650906421884e-01, 5.908290833732823e-01,
- 5.793094079430561e-01, 5.677111240020907e-01, 5.560374156751429e-01,
- 5.442936643492620e-01, 5.324897680536480e-01, 5.206360841136255e-01,
- 5.087432727680400e-01, 4.968111660413653e-01, 4.848498807089364e-01,
- 4.728681073650310e-01, 4.608759183794885e-01, 4.488810806327018e-01,
- 4.368910387727512e-01, 4.249120223507826e-01, 4.129606031641687e-01,
- 4.010358962877044e-01, 3.891578667449375e-01, 3.773221988116735e-01,
- 3.655437668630012e-01, 3.538323564250667e-01, 3.421961154339837e-01,
- 3.306448201086834e-01, 3.191875589898712e-01, 3.078333093391901e-01,
- 2.965881816516454e-01, 2.854637165360221e-01, 2.744624088577634e-01,
- 2.636095844768899e-01, 2.528831011433226e-01, 2.423234889711821e-01,
- 2.319257462841697e-01, 2.216908373695833e-01, 2.116380576950307e-01,
- 2.017669202945304e-01, 1.920822358183417e-01, 1.825891600132626e-01,
- 1.733059967407588e-01, 1.642292000450303e-01, 1.553626542479246e-01,
- 1.467170785977411e-01, 1.382993914151456e-01, 1.301050780767305e-01,
- 1.221453099291547e-01, 1.144234581921691e-01, 1.069410759923033e-01,
- 9.970258934460623e-02, 9.271242833748693e-02, 8.597374270620267e-02,
- 7.948933111952143e-02, 7.326165794605345e-02, 6.729341023108891e-02,
- 6.158740810076327e-02, 5.614580025932222e-02, 5.097007470356519e-02,
- 4.606170471457775e-02, 4.142201169265410e-02, 3.705141887506228e-02,
- 3.294946662279392e-02, 2.911533269413120e-02, 2.554764013238235e-02,
- 2.224377112828603e-02, 1.920006589797908e-02, 1.641222045266977e-02,
- 1.387476111201306e-02, 1.158063529909875e-02, 9.522136642215920e-03,
- 7.691373795814687e-03, 6.072078331193099e-03, 4.625812168742676e-03,
- 3.606851641625968e-03, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00};
-
-// Section 3.7.3.2.5 w_7.5_360 (d09r04_*implementorComments*)
-double w_N360_7p5ms[720] = {
- 1.721526681611966e-03, 2.208248743046650e-03, 2.689017522595345e-03,
- 3.226133417706577e-03, 3.810144195090351e-03, 4.453719317184182e-03,
- 5.153692399681317e-03, 5.915524734289813e-03, 6.738691584410875e-03,
- 7.628618406907552e-03, 8.583614568030036e-03, 9.609384374613759e-03,
- 1.070607532160120e-02, 1.187597226083452e-02, 1.311901297315944e-02,
- 1.443901078588673e-02, 1.583353014097089e-02, 1.730630810758647e-02,
- 1.885847112173313e-02, 2.049186515516006e-02, 2.220614764140174e-02,
- 2.400571662419946e-02, 2.588835928921542e-02, 2.785523259150068e-02,
- 2.990591454016386e-02, 3.204158944817544e-02, 3.426100132985917e-02,
- 3.656809727321165e-02, 3.896167212395468e-02, 4.144358235567028e-02,
- 4.401407955156517e-02, 4.667421691393490e-02, 4.942146249896087e-02,
- 5.225884889914327e-02, 5.518493372761350e-02, 5.820051428449914e-02,
- 6.130598448769178e-02, 6.450383844383757e-02, 6.779139227807153e-02,
- 7.117078328947134e-02, 7.464110714806732e-02, 7.820280530933912e-02,
- 8.185495207937329e-02, 8.560001618878993e-02, 8.943576174662307e-02,
- 9.336425891679158e-02, 9.738467025048170e-02, 1.014967178422148e-01,
- 1.056987601379146e-01, 1.099936025389733e-01, 1.143782870006880e-01,
- 1.188535076446910e-01, 1.234192774722812e-01, 1.280759966861818e-01,
- 1.328205805921621e-01, 1.376554565476283e-01, 1.425786478649834e-01,
- 1.475905216894996e-01, 1.526904374639564e-01, 1.578788527293271e-01,
- 1.631525285166384e-01, 1.685133626404965e-01, 1.739579689655531e-01,
- 1.794847365410843e-01, 1.850931046131430e-01, 1.907848350801405e-01,
- 1.965564972779563e-01, 2.024104194879864e-01, 2.083454334275949e-01,
- 2.143598248322309e-01, 2.204503651331880e-01, 2.266172963796335e-01,
- 2.328562792793315e-01, 2.391679406203077e-01, 2.455506417347264e-01,
- 2.520039508016560e-01, 2.585261682883327e-01, 2.651184076263592e-01,
- 2.717759113203786e-01, 2.784985387736362e-01, 2.852846062288917e-01,
- 2.921324591263930e-01, 2.990384315995911e-01, 3.060042559686472e-01,
- 3.130265290443111e-01, 3.201048623655521e-01, 3.272373243719107e-01,
- 3.344232095441687e-01, 3.416586222430363e-01, 3.489449761645191e-01,
- 3.562792519116003e-01, 3.636600340252121e-01, 3.710851463600319e-01,
- 3.785543267164805e-01, 3.860626951895035e-01, 3.936105536140438e-01,
- 4.011952247532815e-01, 4.088152724594432e-01, 4.164684603494585e-01,
- 4.241554113955093e-01, 4.318710458458660e-01, 4.396147439144481e-01,
- 4.473840194903529e-01, 4.551769877048139e-01, 4.629901375019677e-01,
- 4.708246187885389e-01, 4.786765926352632e-01, 4.865454331135768e-01,
- 4.944287144003222e-01, 5.023248131381035e-01, 5.102294714645887e-01,
- 5.181429265558146e-01, 5.260609162248473e-01, 5.339828176544869e-01,
- 5.419068167854945e-01, 5.498312828850233e-01, 5.577512337479950e-01,
- 5.656676362338563e-01, 5.735768827770059e-01, 5.814766655477682e-01,
- 5.893646610908023e-01, 5.972413384410342e-01, 6.051020131945327e-01,
- 6.129461702965266e-01, 6.207702424193973e-01, 6.285720938000074e-01,
- 6.363485261821292e-01, 6.440996624336124e-01, 6.518209733012164e-01,
- 6.595138217057872e-01, 6.671763816763950e-01, 6.748067951703918e-01,
- 6.824007108459023e-01, 6.899588537658654e-01, 6.974757223488888e-01,
- 7.049501447553026e-01, 7.123799800931302e-01, 7.197654340542331e-01,
- 7.271038329243241e-01, 7.343963718694788e-01, 7.416385606661200e-01,
- 7.488296394277816e-01, 7.559666880505324e-01, 7.630492594418218e-01,
- 7.700722734566787e-01, 7.770369811015168e-01, 7.839411079555614e-01,
- 7.907812565704104e-01, 7.975581136897942e-01, 8.042713809653173e-01,
- 8.109149005929875e-01, 8.174908555311138e-01, 8.239970937711972e-01,
- 8.304327850184938e-01, 8.367969496408532e-01, 8.430892979726279e-01,
- 8.493058471422328e-01, 8.554473095679163e-01, 8.615110365133289e-01,
- 8.674962806836773e-01, 8.734007983991156e-01, 8.792275183442975e-01,
- 8.849724383046952e-01, 8.906357189698083e-01, 8.962171727097513e-01,
- 9.017164138681113e-01, 9.071287701238782e-01, 9.124565781610174e-01,
- 9.176972608396821e-01, 9.228487835702877e-01, 9.279099172570797e-01,
- 9.328825964768623e-01, 9.377633225341820e-01, 9.425533559491475e-01,
- 9.472524281763984e-01, 9.518602062527468e-01, 9.563760599307146e-01,
- 9.608006016536426e-01, 9.651306001536289e-01, 9.693666888567923e-01,
- 9.735088121912839e-01, 9.775565405467248e-01, 9.815072260762016e-01,
- 9.853645802900605e-01, 9.891262086779957e-01, 9.927942006806012e-01,
- 9.963675450849775e-01, 9.998469191683163e-01, 1.003228124845146e+00,
- 1.006513411821911e+00, 1.009700729703874e+00, 1.012790289606342e+00,
- 1.015782934360887e+00, 1.018682286908352e+00, 1.021486570410198e+00,
- 1.024197718428813e+00, 1.026814550859190e+00, 1.029335981099974e+00,
- 1.031760429936344e+00, 1.034089812751720e+00, 1.036323258515780e+00,
- 1.038463607653629e+00, 1.040511956629397e+00, 1.042468314695544e+00,
- 1.044333310154580e+00, 1.046108368522362e+00, 1.047790183156567e+00,
- 1.049383335559126e+00, 1.050885649534276e+00, 1.052299234616223e+00,
- 1.053625218490635e+00, 1.054862887578656e+00, 1.056015206502275e+00,
- 1.057087459299065e+00, 1.058072205849552e+00, 1.058975241719203e+00,
- 1.059794467230661e+00, 1.060534138670111e+00, 1.061194118632638e+00,
- 1.061773655564821e+00, 1.062276617517642e+00, 1.062703237255151e+00,
- 1.063055685508735e+00, 1.063338150260194e+00, 1.063547997184066e+00,
- 1.063686067900426e+00, 1.063755566766962e+00, 1.063757434953141e+00,
- 1.063693583520601e+00, 1.063566320618061e+00, 1.063377073891492e+00,
- 1.063127819699189e+00, 1.062821557530121e+00, 1.062457815392427e+00,
- 1.062036342819983e+00, 1.061559958917576e+00, 1.061029510184661e+00,
- 1.060447965083549e+00, 1.059817091581481e+00, 1.059141628118411e+00,
- 1.058421358875364e+00, 1.057658760384513e+00, 1.056853774077034e+00,
- 1.056007614360998e+00, 1.055120057365395e+00, 1.054195045438248e+00,
- 1.053233455551333e+00, 1.052239850719546e+00, 1.051216675517538e+00,
- 1.050166369287038e+00, 1.049087785713381e+00, 1.047983664181190e+00,
- 1.046853337647985e+00, 1.045698595146235e+00, 1.044520564730305e+00,
- 1.043323481681635e+00, 1.042108306824389e+00, 1.040879073476582e+00,
- 1.039636032987793e+00, 1.038380985588667e+00, 1.037114029603682e+00,
- 1.035838134533162e+00, 1.034552762539362e+00, 1.033262000621490e+00,
- 1.031967497567261e+00, 1.030671997181282e+00, 1.029375639312502e+00,
- 1.028082437365047e+00, 1.026791666942681e+00, 1.025506352493464e+00,
- 1.024226550306258e+00, 1.022955584022344e+00, 1.021692989563247e+00,
- 1.020444748460154e+00, 1.019207332137853e+00, 1.017999919156420e+00,
- 1.017160217193961e+00, 1.015872887197225e+00, 1.014617829299498e+00,
- 1.013397380801344e+00, 1.012210174593533e+00, 1.011056516187721e+00,
- 1.009934436494794e+00, 1.008845591036958e+00, 1.007789557609578e+00,
- 1.006767901472734e+00, 1.005778512486221e+00, 1.004821733696763e+00,
- 1.003895920161236e+00, 1.003002618498964e+00, 1.002140907258662e+00,
- 1.001312127031557e+00, 1.000514601809148e+00, 9.997489875663875e-01,
- 9.990134860651736e-01, 9.983092287560527e-01, 9.976349335738018e-01,
- 9.969918851181095e-01, 9.963786013745719e-01, 9.957959823242557e-01,
- 9.952422174315529e-01, 9.947181322797367e-01, 9.942221216035205e-01,
- 9.937553132700969e-01, 9.933162157118496e-01, 9.929058092648040e-01,
- 9.925224215680564e-01, 9.921669569649387e-01, 9.918377038474807e-01,
- 9.915355084098528e-01, 9.912586027088507e-01, 9.910078784250421e-01,
- 9.907817226664765e-01, 9.905811038723256e-01, 9.904043360106435e-01,
- 9.902522665150607e-01, 9.901231181863754e-01, 9.900177259420802e-01,
- 9.899343252516752e-01, 9.898737119947000e-01, 9.898341100636087e-01,
- 9.898163585163330e-01, 9.898187066647253e-01, 9.898419976335596e-01,
- 9.898844376083749e-01, 9.899468001787191e-01, 9.900272871794666e-01,
- 9.901266804330273e-01, 9.902431753677082e-01, 9.903775935673591e-01,
- 9.905281337320039e-01, 9.906955635514434e-01, 9.908780432538649e-01,
- 9.910763016962206e-01, 9.912885401035934e-01, 9.915156019790364e-01,
- 9.917556658638569e-01, 9.920094690635668e-01, 9.922751554325331e-01,
- 9.925534864640656e-01, 9.928426927501408e-01, 9.931435333387140e-01,
- 9.934540796611835e-01, 9.937750666306635e-01, 9.941046890713076e-01,
- 9.944437415635388e-01, 9.947903979828719e-01, 9.951453611435701e-01,
- 9.955067995758305e-01, 9.958755336221258e-01, 9.962496814968456e-01,
- 9.966299185765186e-01, 9.970143670156726e-01, 9.974037994063020e-01,
- 9.977964044701016e-01, 9.981928706842119e-01, 9.985912855613679e-01,
- 9.989924362978263e-01, 9.993945064762333e-01, 9.997982470741876e-01,
- 1.000201793638269e+00, 1.000605860368296e+00, 1.001008579910682e+00,
- 1.001410701714506e+00, 1.001810400944408e+00, 1.002208462087081e+00,
- 1.002602958395831e+00, 1.002994573682287e+00, 1.003381477277237e+00,
- 1.003764436338408e+00, 1.004141548053574e+00, 1.004513480396200e+00,
- 1.004878321344784e+00, 1.005236884099094e+00, 1.005587302935534e+00,
- 1.005930271724399e+00, 1.006263925890636e+00, 1.006589051746658e+00,
- 1.006903802351948e+00, 1.007208903587772e+00, 1.007502380110983e+00,
- 1.007784982346051e+00, 1.008054893814649e+00, 1.008312868199207e+00,
- 1.008556999006399e+00, 1.008788016348394e+00, 1.009004047709048e+00,
- 1.009205932867561e+00, 1.009391822060050e+00, 1.009562440424896e+00,
- 1.009715896739930e+00, 1.009852958217732e+00, 1.009971774079105e+00,
- 1.010073169648632e+00, 1.010155293011166e+00, 1.010218932642345e+00,
- 1.010262246288524e+00, 1.010286018304889e+00, 1.010288415013601e+00,
- 1.010270296641665e+00, 1.010229878703309e+00, 1.010168022758243e+00,
- 1.010082924574326e+00, 1.009975407736885e+00, 1.009843687123529e+00,
- 1.009688632854747e+00, 1.009508455280294e+00, 1.009304044596942e+00,
- 1.009073713509976e+00, 1.008818483155921e+00, 1.008536750845889e+00,
- 1.008229467503460e+00, 1.007894884001199e+00, 1.007533913863759e+00,
- 1.007144877861525e+00, 1.006728757854175e+00, 1.006283927891016e+00,
- 1.005811456284196e+00, 1.005309913983530e+00, 1.004780527277797e+00,
- 1.004221766054862e+00, 1.003634560818982e+00, 1.003017190938855e+00,
- 1.002370673225852e+00, 1.001693634792953e+00, 1.000987488105603e+00,
- 1.000251075456674e+00, 9.994856628696702e-01, 9.986895923896904e-01,
- 9.978636664333774e-01, 9.970063702291652e-01, 9.961191991291183e-01,
- 9.952014038559622e-01, 9.942546868773952e-01, 9.932775951012806e-01,
- 9.922706506028359e-01, 9.912319673936767e-01, 9.901632857185525e-01,
- 9.890643935223216e-01, 9.879371153343368e-01, 9.867797361083076e-01,
- 9.855927730842358e-01, 9.843751246861034e-01, 9.831292878900623e-01,
- 9.813484629113276e-01, 9.798909633127684e-01, 9.784004589849064e-01,
- 9.768604354115724e-01, 9.752698788428587e-01, 9.736273532416118e-01,
- 9.719313409832228e-01, 9.701804980040253e-01, 9.683726519652567e-01,
- 9.665069522597068e-01, 9.645800268203277e-01, 9.625923175883123e-01,
- 9.605409863432730e-01, 9.584255335155275e-01, 9.562443932750193e-01,
- 9.539984159028931e-01, 9.516840138455831e-01, 9.493011853637791e-01,
- 9.468468843298323e-01, 9.443202322315050e-01, 9.417184043233268e-01,
- 9.390425796467096e-01, 9.362906241698766e-01, 9.334640497363101e-01,
- 9.305608538768808e-01, 9.275805069442316e-01, 9.245195917195164e-01,
- 9.213784714413848e-01, 9.181534137230349e-01, 9.148446956130220e-01,
- 9.114516516017124e-01, 9.079765240138057e-01, 9.044175450831859e-01,
- 9.007763077278617e-01, 8.970500584793123e-01, 8.932383978549314e-01,
- 8.893386805647778e-01, 8.853513603848177e-01, 8.812740229566767e-01,
- 8.771096379139661e-01, 8.728579265043998e-01, 8.685195050926551e-01,
- 8.640927964490425e-01, 8.595798186504622e-01, 8.549760065595760e-01,
- 8.502852201263446e-01, 8.455026150386550e-01, 8.406304703204051e-01,
- 8.356679254927833e-01, 8.306199433014801e-01, 8.254820069905587e-01,
- 8.202589087059164e-01, 8.149466481575340e-01, 8.095466959213909e-01,
- 8.040599778581757e-01, 7.984893775294406e-01, 7.928314173180783e-01,
- 7.870906681120101e-01, 7.812624496601451e-01, 7.753539468965313e-01,
- 7.693636129738075e-01, 7.632917692550881e-01, 7.571390164385375e-01,
- 7.509017111797436e-01, 7.445908434203883e-01, 7.382051359832217e-01,
- 7.317380750199757e-01, 7.251992870809165e-01, 7.185882252895927e-01,
- 7.119056866892599e-01, 7.051536683608545e-01, 6.983326341551366e-01,
- 6.914441012238667e-01, 6.844905446038185e-01, 6.774701192768717e-01,
- 6.703883753752553e-01, 6.632452099313783e-01, 6.560457800753937e-01,
- 6.487886269109083e-01, 6.414771616618185e-01, 6.341143226974428e-01,
- 6.267020002885999e-01, 6.192353336355413e-01, 6.117205957668128e-01,
- 6.041616120083719e-01, 5.965591325427860e-01, 5.889144007425270e-01,
- 5.812347834141942e-01, 5.735199893648143e-01, 5.657706158383411e-01,
- 5.579880671567978e-01, 5.501738510234542e-01, 5.423301939386325e-01,
- 5.344607980557825e-01, 5.265685382300127e-01, 5.186563241060174e-01,
- 5.107288126105302e-01, 5.027811586638018e-01, 4.948194909906872e-01,
- 4.868451392486417e-01, 4.788608890561871e-01, 4.708699282370115e-01,
- 4.628751440565413e-01, 4.548778943490807e-01, 4.468825120278060e-01,
- 4.388893249911809e-01, 4.308981228989757e-01, 4.229183223777856e-01,
- 4.149508779761170e-01, 4.069939642056243e-01, 3.990526483957498e-01,
- 3.911346135115557e-01, 3.832340305827807e-01, 3.753546526584436e-01,
- 3.675020596488621e-01, 3.596800983344559e-01, 3.518873119772211e-01,
- 3.441301658282572e-01, 3.364081000913025e-01, 3.287289661673846e-01,
- 3.210905051632958e-01, 3.134964181526467e-01, 3.059515649397201e-01,
- 2.984543187240678e-01, 2.910105654938703e-01, 2.836211093775042e-01,
- 2.762854150573731e-01, 2.690195851087454e-01, 2.618124452057962e-01,
- 2.546592323719683e-01, 2.475843475618672e-01, 2.405786941912602e-01,
- 2.336470086662776e-01, 2.267884333851989e-01, 2.200019917678347e-01,
- 2.133013251703927e-01, 2.066777706538484e-01, 2.001404091043453e-01,
- 1.936836302775967e-01, 1.873103432384193e-01, 1.810273838836248e-01,
- 1.748394760623094e-01, 1.687396441250690e-01, 1.627372734819174e-01,
- 1.568252770506826e-01, 1.510123820588976e-01, 1.452982295367473e-01,
- 1.396874693829809e-01, 1.341718422797088e-01, 1.287625441360194e-01,
- 1.234555620731477e-01, 1.182546623256352e-01, 1.131596767663045e-01,
- 1.081714392735899e-01, 1.032907339774594e-01, 9.852029779063426e-02,
- 9.386000226048140e-02, 8.931173602725516e-02, 8.487521028829931e-02,
- 8.055237373221881e-02, 7.634297866041770e-02, 7.224892456088809e-02,
- 6.826991195487858e-02, 6.440772914585895e-02, 6.066200028414472e-02,
- 5.703437111472432e-02, 5.352437147393933e-02, 5.013346896851077e-02,
- 4.686107896077298e-02, 4.370844528199226e-02, 4.067483652594974e-02,
- 3.776122690656316e-02, 3.496670991534084e-02, 3.229192748331241e-02,
- 2.973576687031024e-02, 2.729846292648297e-02, 2.497871856111264e-02,
- 2.277625418320712e-02, 2.068958080348780e-02, 1.871781693470649e-02,
- 1.685934175287805e-02, 1.511251252352758e-02, 1.347570944951177e-02,
- 1.194627091218482e-02, 1.052287538118900e-02, 9.201309412840026e-03,
- 7.981243163732707e-03, 6.855473143120775e-03, 5.826573343851640e-03,
- 4.878385254226555e-03, 4.023511190940970e-03, 3.154186627586960e-03,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00,
- 0.000000000000000e+00, 0.000000000000000e+00, 0.000000000000000e+00};
diff --git a/system/embdrv/lc3_dec/Common/Tables/MdctWindows.hpp b/system/embdrv/lc3_dec/Common/Tables/MdctWindows.hpp
deleted file mode 100644
index 8b6bcc6..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/MdctWindows.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * MdctWindows.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef MDCT_WINDOWS_H_
-#define MDCT_WINDOWS_H_
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.2
-
-// LC3 Specification d09r04_*implementorComments*
-// Section 3.7.3 Low delay MDCT windows
-// Section 3.7.3.1 10 ms Frame Duration
-
-extern double w_N80[160];
-extern double w_N160[320];
-extern double w_N240[480];
-extern double w_N320[640];
-extern double w_N480[960];
-
-// Section 3.7.3.2 7.5 ms Frame Duration
-
-extern double w_N60_7p5ms[120];
-extern double w_N120_7p5ms[240];
-extern double w_N180_7p5ms[360];
-extern double w_N240_7p5ms[480];
-extern double w_N360_7p5ms[720];
-
-#endif // MDCT_WINDOWS_H_
diff --git a/system/embdrv/lc3_dec/Common/Tables/SnsQuantizationTables.cpp b/system/embdrv/lc3_dec/Common/Tables/SnsQuantizationTables.cpp
deleted file mode 100644
index 55b3462..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/SnsQuantizationTables.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * SnsQuantizationTables.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.3 SNS Quantization
-
-// LC3 Specification d09r04_*implementorComments*
-// Section 3.7.4 SNS Quantization
-
-#include "SnsQuantizationTables.hpp"
-
-// LC3 Specification d09r01.pdf; Page 102 of 177
-double LFCB[32][8] = {
- {+2.262833655926780e+00, +8.133112690613385e-01, -5.301934948714359e-01,
- -1.356648359034418e+00, -1.599521765631959e+00, -1.440987684300950e+00,
- -1.143816483058210e+00, -7.552037679090641e-01}, // 0
- {+2.945164791913764e+00, +2.411433179566788e+00, +9.604551064007274e-01,
- -4.432264880769172e-01, -1.229136124255896e+00, -1.555900391181699e+00,
- -1.496886559523759e+00, -1.116899865014692e+00}, // 1
- {-2.186107070099790e+00, -1.971521356752276e+00, -1.787186196810059e+00,
- -1.918658956855768e+00, -1.793991218365963e+00, -1.357384042572884e+00,
- -7.054442793538694e-01, -4.781729447777114e-02}, // 2
- {+6.936882365289195e-01, +9.556098571582197e-01, +5.752307870387333e-01,
- -1.146034194628886e-01, -6.460506374360290e-01, -9.523513704496247e-01,
- -1.074052472261504e+00, -7.580877070949045e-01}, // 3
- {-1.297521323152956e+00, -7.403690571778526e-01, -3.453724836421064e-01,
- -3.132856962479401e-01, -4.029772428244766e-01, -3.720208534652272e-01,
- -7.834141773237381e-02, +9.704413039922949e-02}, // 4
- {+9.146520378306716e-01, +1.742930434352573e+00, +1.909066268599861e+00,
- +1.544084838426651e+00, +1.093449607614550e+00, +6.474795495182776e-01,
- +3.617907524496421e-02, -2.970928071788889e-01}, // 5
- {-2.514288125789621e+00, -2.891752713843728e+00, -2.004506667594338e+00,
- -7.509122739031269e-01, +4.412021049046914e-01, +1.201909876010087e+00,
- +1.327428572572904e+00, +1.220490811409839e+00}, // 6
- {-9.221884048123851e-01, +6.324951414405520e-01, +1.087364312546411e+00,
- +6.086286245358197e-01, +1.311745675473482e-01, -2.961491577437521e-01,
- -2.070135165256287e-01, +1.349249166420795e-01}, // 7
- {+7.903222883692664e-01, +6.284012618761988e-01, +3.931179235404499e-01,
- +4.800077108669007e-01, +4.478151380501427e-01, +2.097342145522343e-01,
- +6.566919964280205e-03, -8.612423420618573e-02}, // 8
- // LC3 Specification d09r01.pdf; Page 103 of 177
- {+1.447755801787238e+00, +2.723999516749523e+00, +2.310832687375278e+00,
- +9.350512695665294e-01, -2.747439113836877e-01, -9.020776968286019e-01,
- -9.406815119454044e-01, -6.336970389743102e-01}, // 9
- {+7.933545264174744e-01, +1.439311855234535e-02, -5.678348447296789e-01,
- -6.547604679167449e-01, -4.794589984757430e-01, -1.738946619028885e-01,
- +6.801627055154381e-02, +2.951259483697938e-01}, // 10
- {+2.724253473850336e+00, +2.959475724048243e+00, +1.849535592684608e+00,
- +5.632849223223643e-01, +1.399170881250724e-01, +3.596410933662221e-01,
- +6.894613547745887e-01, +6.397901768331046e-01}, // 11
- {-5.308301983754000e-01, -2.126906828121638e-01, +5.766136283770966e-03,
- +4.248714843837454e-01, +4.731289521586675e-01, +8.588941993212806e-01,
- +1.191111608544352e+00, +9.961896696383581e-01}, // 12
- {+1.687284108450062e+00, +2.436145092376558e+00, +2.330194290782250e+00,
- +1.779837778350905e+00, +1.444112953900818e+00, +1.519951770097301e+00,
- +1.471993937504249e+00, +9.776824738917613e-01}, // 13
- {-2.951832728018580e+00, -1.593934967733454e+00, -1.099187728780224e-01,
- +3.886090729192574e-01, +5.129326495175837e-01, +6.281125970634966e-01,
- +8.226217964306339e-01, +8.758914246550805e-01}, // 14
- {+1.018783427856281e-01, +5.898573242289165e-01, +6.190476467934656e-01,
- +1.267313138517963e+00, +2.419610477698038e+00, +2.251742525721865e+00,
- +5.265370309912005e-01, -3.965915132279989e-01}, // 15
- {+2.682545754984259e+00, +1.327380108994199e+00, +1.301852738040482e-01,
- -3.385330885113471e-01, -3.682192358996665e-01, -1.916899467159607e-01,
- -1.547823771539079e-01, -2.342071777743923e-01}, // 16
- {+4.826979236804030e+00, +3.119478044924880e+00, +1.395136713851784e+00,
- +2.502953159187215e-01, -3.936138393797931e-01, -6.434581730547007e-01,
- -6.425707368569433e-01, -7.231932234440720e-01}, // 17
- {+8.784199364703349e-02, -5.695868402385010e-01, -1.145060156688110e+00,
- -1.669684881725975e+00, -1.845344176036817e+00, -1.564680273288019e+00,
- -1.117467590764198e+00, -5.339816633667862e-01}, // 18
- {+1.391023082043259e+00, +1.981464791994655e+00, +1.112657963887701e+00,
- -2.201075094207434e-01, -7.749656115523655e-01, -5.940638741491173e-01,
- +1.369376806289231e-01, +8.182428912643381e-01}, // 19
- {+3.845858938891820e-01, -1.605887855365100e-01, -5.393668095577095e-01,
- -5.293090787898571e-01, +1.904335474379324e-01, +2.560629181065215e+00,
- +2.818963982452484e+00, +6.566708756961611e-01}, // 20
- {+1.932273994417191e+00, +3.010301804120569e+00, +3.065438938262036e+00,
- +2.501101608700079e+00, +1.930895929789344e+00, +5.721538109618367e-01,
- -8.117417940810907e-01, -1.176418108619025e+00}, // 21
- {+1.750804628998837e-01, -7.505228322489846e-01, -1.039438933422309e+00,
- -1.135775089376484e+00, -1.041979038374938e+00, -1.520600989933816e-02,
- +2.070483917167066e+00, +3.429489180816891e+00}, // 22
- // LC3 Specification d09r01.pdf; Page 104 of 177
- {-1.188170202505555e+00, +3.667928736626364e-01, +1.309578304090959e+00,
- +1.683306872804914e+00, +1.251009242251268e+00, +9.423757516286146e-01,
- +8.262504833741330e-01, +4.399527411209563e-01}, // 23
- {+2.533222033270612e+00, +2.112746426959081e+00, +1.262884115020644e+00,
- +7.615135124304274e-01, +5.221179379761699e-01, +1.186800697571213e-01,
- -4.523468275073703e-01, -7.003524261611032e-01}, // 24
- {+3.998898374856063e+00, +4.079017514519560e+00, +2.822856611024964e+00,
- +1.726072128495800e+00, +6.471443773486192e-01, -3.311485212172380e-01,
- -8.840425708487493e-01, -1.126973406454781e+00}, // 25
- {+5.079025931863813e-01, +1.588384497895265e+00, +1.728990238692094e+00,
- +1.006922302417256e+00, +3.771212318163816e-01, +4.763707668994976e-01,
- +1.087547403721699e+00, +1.087562660992209e+00}, // 26
- {+3.168568251075689e+00, +3.258534581594065e+00, +2.422305913285988e+00,
- +1.794460776432612e+00, +1.521779106530886e+00, +1.171967065376021e+00,
- +4.893945969806952e-01, -6.227957157187685e-02}, // 27
- {+1.894147667317636e+00, +1.251086946092320e+00, +5.904512107206275e-01,
- +6.083585832937136e-01, +8.781710100110816e-01, +1.119125109509496e+00,
- +1.018576615503421e+00, +6.204538910117241e-01}, // 28
- {+9.488806045171881e-01, +2.132394392499823e+00, +2.723453503442780e+00,
- +2.769860768665877e+00, +2.542869732549456e+00, +2.020462638250194e+00,
- +8.300458594009102e-01, -2.755691738882634e-02}, // 29
- {-1.880267570456275e+00, -1.264310727587049e+00, +3.114249769686986e-01,
- +1.836702103064300e+00, +2.256341918398738e+00, +2.048189984634735e+00,
- +2.195268374585677e+00, +2.026596138366193e+00}, // 30
- {+2.463757462771289e-01, +9.556217733930993e-01, +1.520467767417663e+00,
- +1.976474004194571e+00, +1.940438671774617e+00, +2.233758472826862e+00,
- +1.988359777584072e+00, +1.272326725547010e+00}}; // 31
-double HFCB[32][8] = {
- {+2.320284191244650e-01, -1.008902706044547e+00, -2.142235027894714e+00,
- -2.375338135706641e+00, -2.230419330496551e+00, -2.175958812236960e+00,
- -2.290659135409999e+00, -2.532863979798455e+00}, // 0
- {-1.295039366736175e+00, -1.799299653843385e+00, -1.887031475315188e+00,
- -1.809916596873323e+00, -1.763400384792061e+00, -1.834184284679500e+00,
- -1.804809806874051e+00, -1.736795453174010e+00}, // 1
- {+1.392857160458027e-01, -2.581851261717519e-01, -6.508045726701103e-01,
- -1.068157317819692e+00, -1.619287415243023e+00, -2.187625664417564e+00,
- -2.637575869390537e+00, -2.978977495750963e+00}, // 2
- {-3.165131021857248e-01, -4.777476572098050e-01, -5.511620758797545e-01,
- -4.847882833811970e-01, -2.383883944558142e-01, -1.430245072855038e-01,
- +6.831866736490735e-02, +8.830617172880660e-02}, // 3
- {+8.795184052264962e-01, +2.983400960071886e-01, -9.153863964057101e-01,
- // LC3 Specification d09r01.pdf; Page 105 of 177
- -2.206459747397620e+00, -2.741421809599509e+00, -2.861390742768913e+00,
- -2.888415971052714e+00, -2.951826082625207e+00}, // 4
- {-2.967019224553751e-01, -9.750049191745525e-01, -1.358575002469926e+00,
- -9.837211058374442e-01, -6.529569391008090e-01, -9.899869929218105e-01,
- -1.614672245988999e+00, -2.407123023851163e+00}, // 5
- {+3.409811004696971e-01, +2.688997889460545e-01, +5.633356848280326e-02,
- +4.991140468266853e-02, -9.541307274143691e-02, -7.601661460838854e-01,
- -2.327581201770068e+00, -3.771554853856562e+00}, // 6
- {-1.412297590775968e+00, -1.485221193498518e+00, -1.186035798347001e+00,
- -6.250016344413516e-01, +1.539024974683036e-01, +5.763864978107553e-01,
- +7.950926037988714e-01, +5.965646321449126e-01}, // 7
- {-2.288395118273794e-01, -3.337190697846616e-01, -8.093213593246560e-01,
- -1.635878769237973e+00, -1.884863973309819e+00, -1.644966913163562e+00,
- -1.405157780466116e+00, -1.466664713261457e+00}, // 8
- {-1.071486285444486e+00, -1.417670154562606e+00, -1.548917622654407e+00,
- -1.452960624755303e+00, -1.031829700622701e+00, -6.906426402725842e-01,
- -4.288438045321706e-01, -4.949602154088736e-01}, // 9
- {-5.909885111880511e-01, -7.117377585376282e-02, +3.457195229473127e-01,
- +3.005494609962507e-01, -1.118652182958568e+00, -2.440891511480490e+00,
- -2.228547324507349e+00, -1.895092282108533e+00}, // 10
- {-8.484340988361639e-01, -5.832268107088888e-01, +9.004236881428734e-02,
- +8.450250075568864e-01, +1.065723845017161e+00, +7.375829993777555e-01,
- +2.565904524599121e-01, -4.919633597623784e-01}, // 11
- {+1.140691455623824e+00, +9.640168923982929e-01, +3.814612059847975e-01,
- -4.828493406089983e-01, -1.816327212605887e+00, -2.802795127285548e+00,
- -3.233857248338638e+00, -3.459087144914729e+00}, // 12
- {-3.762832379674643e-01, +4.256754620961052e-02, +5.165476965923055e-01,
- +2.517168818646298e-01, -2.161799675243032e-01, -5.340740911245042e-01,
- -6.407860962621957e-01, -8.697450323741350e-01}, // 13
- {+6.650041205984020e-01, +1.097907646907945e+00, +1.383426671120792e+00,
- +1.343273586282854e+00, +8.229788368559223e-01, +2.158767985156789e-01,
- -4.049257530802925e-01, -1.070256058705229e+00}, // 14
- {-8.262659539826793e-01, -6.711812327666034e-01, -2.284955927794715e-01,
- +5.189808525519373e-01, +1.367218963402784e+00, +2.180230382530922e+00,
- +2.535960927501071e+00, +2.201210988600361e+00}, // 15
- {+1.410083268321729e+00, +7.544419078354684e-01, -1.305505849586310e+00,
- -1.871337113509707e+00, -1.240086851563054e+00, -1.267129248662737e+00,
- -2.036708130039070e+00, -2.896851622423807e+00}, // 16
- {+3.613868175743476e-01, -2.199917054278258e-02, -5.793688336338242e-01,
- -8.794279609410701e-01, -8.506850234081188e-01, -7.793970501558157e-01,
- -7.321829272918255e-01, -8.883485148212548e-01}, // 17
- {+4.374692393303287e-01, +3.054404196059607e-01, -7.387865664783739e-03,
- // LC3 Specification d09r01.pdf; Page 106 of 177
- -4.956498547102520e-01, -8.066512711183929e-01, -1.224318919844005e+00,
- -1.701577700431810e+00, -2.244919137556108e+00}, // 18
- {+6.481003189965029e-01, +6.822991336406795e-01, +2.532474643329756e-01,
- +7.358421437884688e-02, +3.142167093890103e-01, +2.347298809236790e-01,
- +1.446001344798368e-01, -6.821201788801744e-02}, // 19
- {+1.119198330913041e+00, +1.234655325360046e+00, +5.891702380853181e-01,
- -1.371924596531664e+00, -2.370957072415767e+00, -2.007797826823599e+00,
- -1.666885402243946e+00, -1.926318462584058e+00}, // 20
- {+1.418474970871759e-01, -1.106600706331509e-01, -2.828245925436287e-01,
- -6.598134746141936e-03, +2.859292796272158e-01, +4.604455299529710e-02,
- -6.025964155778858e-01, -2.265687286325748e+00}, // 21
- {+5.040469553902519e-01, +8.269821629590972e-01, +1.119812362918282e+00,
- +1.179140443327336e+00, +1.079874291972597e+00, +6.975362390675000e-01,
- -9.125488173710808e-01, -3.576847470627726e+00}, // 22
- {-5.010760504793567e-01, -3.256780060814170e-01, +2.807981949470768e-02,
- +2.620545547631326e-01, +3.605908060857668e-01, +6.356237220536995e-01,
- +9.590124671781544e-01, +1.307451566886533e+00}, // 23
- {+3.749709827096420e+00, +1.523426118470452e+00, -4.577156618978547e-01,
- -7.987110082431923e-01, -3.868193293091003e-01, -3.759010622312032e-01,
- -6.578368999305377e-01, -1.281639642436027e+00}, // 24
- {-1.152589909805491e+00, -1.108008859062412e+00, -5.626151165124718e-01,
- -2.205621237656746e-01, -3.498428803366437e-01, -7.534327702504950e-01,
- -9.885965933963837e-01, -1.287904717914711e+00}, // 25
- {+1.028272464221398e+00, +1.097705193898282e+00, +7.686455457647760e-01,
- +2.060819777407656e-01, -3.428057350919982e-01, -7.549394046253397e-01,
- -1.041961776319998e+00, -1.503356529555287e+00}, // 26
- {+1.288319717078174e-01, +6.894393952648783e-01, +1.123469050095749e+00,
- +1.309345231065936e+00, +1.355119647139345e+00, +1.423113814707990e+00,
- +1.157064491909045e+00, +4.063194375168383e-01}, // 27
- {+1.340330303347565e+00, +1.389968250677893e+00, +1.044679217088833e+00,
- +6.358227462443666e-01, -2.747337555184823e-01, -1.549233724306950e+00,
- -2.442397102780069e+00, -3.024576069445502e+00}, // 28
- {+2.138431054193125e+00, +4.247112673031041e+00, +2.897341098304393e+00,
- +9.327306580268148e-01, -2.928222497298096e-01, -8.104042968531823e-01,
- -7.888680987564828e-01, -9.353531487613377e-01}, // 29
- {+5.648304873553961e-01, +1.591849779587432e+00, +2.397716990151462e+00,
- +3.036973436007040e+00, +2.664243503371508e+00, +1.393044850326060e+00,
- +4.038340235957454e-01, -6.562709713281135e-01}, // 30
- {-4.224605475860865e-01, +3.261496250498011e-01, +1.391713133422612e+00,
- +2.231466146364735e+00, +2.611794421696881e+00, +2.665403401965702e+00,
- +2.401035541057067e+00, +1.759203796708810e+00} // 31
-};
-// LC3 Specification d09r01.pdf; Page 107 of 177
-double sns_vq_reg_adj_gains[2] = {8915.0 / 4096.0, 12054.0 / 4096.0};
-double sns_vq_reg_lf_adj_gains[4] = {6245.0 / 4096.0, 15043.0 / 4096.0,
- 17861.0 / 4096.0, 21014.0 / 4096.0};
-double sns_vq_near_adj_gains[4] = {7099.0 / 4096.0, 9132.0 / 4096.0,
- 11253.0 / 4096.0, 14808.0 / 4096.0};
-double sns_vq_far_adj_gains[8] = {
- 4336.0 / 4096.0, 5067.0 / 4096.0, 5895.0 / 4096.0, 8149.0 / 4096.0,
- 10235.0 / 4096.0, 12825.0 / 4096.0, 16868.0 / 4096.0, 19882.0 / 4096.0};
-int sns_gainMSBbits[4] = {1, 1, 2, 2};
-int sns_gainLSBbits[4] = {0, 1, 0, 1};
-unsigned int MPVQ_offsets[16][1 + 10] = {
- /* k=0, k=1, k=2,... , k=10 */
- {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* n=0*/
- {0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19}, /* n=1*/
- {0, 1, 5, 13, 25, 41, 61, 85, 113, 145, 181},
- {0, 1, 7, 25, 63, 129, 231, 377, 575, 833, 1159},
- {0, 1, 9, 41, 129, 321, 681, 1289, 2241, 3649, 5641},
- {0, 1, 11, 61, 231, 681, 1683, 3653, 7183, 13073, 22363},
- {0, 1, 13, 85, 377, 1289, 3653, 8989, 19825, 40081, 75517},
- {0, 1, 15, 113, 575, 2241, 7183, 19825, 48639, 108545, 224143},
- {0, 1, 17, 145, 833, 3649, 13073, 40081, 108545, 265729, 598417},
- {0, 1, 19, 181, 1159, 5641, 22363, 75517, 224143, 598417, 1462563},
- {0, 1, 21, 221, 1561, 8361, 36365, 134245, 433905, 1256465, 3317445},
- {0, 1, 23, 265, 2047, 11969, 56695, 227305, 795455, 2485825, 7059735},
- {0, 1, 25, 313, 2625, 16641, 85305, 369305, 1392065, 4673345, 14218905},
- {0, 1, 27, 365, 3303, 22569, 124515, 579125, 2340495, 8405905, 27298155},
- {0, 1, 29, 421, 4089, 29961, 177045, 880685, 3800305, 14546705,
- 50250765}, /* n=14*/
- {0, 1, 31, 481, 4991, 39041, 246047, 1303777, 5984767, 24331777,
- 89129247}, /* n=15*/
-};
-double D[16][16] = {
- /* D consists of the base vectors of the DCT (orthogonalized DCT-II)*/
- /* (the DCT base vector are stored in column-wise in this table)*/
- /* first row results in the first coeff in fwd synthesis (dec+(enc))*/
- /* first column results in the first coeff in the analysis(encoder) */
- {+2.500000000000000e-01, +3.518509343815957e-01, +3.467599613305369e-01,
- +3.383295002935882e-01, +3.266407412190941e-01, +3.118062532466678e-01,
- +2.939689006048397e-01, +2.733004667504394e-01, +2.500000000000001e-01,
- +2.242918965856591e-01, +1.964237395967756e-01, +1.666639146194367e-01,
- +1.352990250365493e-01, +1.026311318805893e-01, +6.897484482073578e-02,
- +3.465429229977293e-02}, // 0 Note: needed a ',' as correction compared to
- // d09r01 (already fixed in d09r02_F2F)
- {+2.500000000000000e-01, +3.383295002935882e-01, +2.939689006048397e-01,
- +2.242918965856591e-01, +1.352990250365493e-01, +3.465429229977286e-02,
- -6.897484482073579e-02, -1.666639146194366e-01, -2.500000000000001e-01,
- -3.118062532466678e-01, -3.467599613305369e-01, -3.518509343815956e-01,
- -3.266407412190941e-01, -2.733004667504394e-01, -1.964237395967756e-01,
- -1.026311318805893e-01}, // 1
- // LC3 Specification d09r01.pdf; Page 108 of 177
- {+2.500000000000000e-01, +3.118062532466678e-01, +1.964237395967756e-01,
- +3.465429229977286e-02, -1.352990250365493e-01, -2.733004667504394e-01,
- -3.467599613305369e-01, -3.383295002935882e-01, -2.500000000000001e-01,
- -1.026311318805894e-01, +6.897484482073574e-02, +2.242918965856590e-01,
- +3.266407412190941e-01, +3.518509343815957e-01, +2.939689006048397e-01,
- +1.666639146194367e-01}, // 2
- {+2.500000000000000e-01, +2.733004667504394e-01, +6.897484482073575e-02,
- -1.666639146194366e-01, -3.266407412190941e-01, -3.383295002935882e-01,
- -1.964237395967755e-01, +3.465429229977288e-02, +2.500000000000001e-01,
- +3.518509343815957e-01, +2.939689006048397e-01, +1.026311318805893e-01,
- -1.352990250365493e-01, -3.118062532466679e-01, -3.467599613305369e-01,
- -2.242918965856590e-01}, // 3
- {+2.500000000000000e-01, +2.242918965856591e-01, -6.897484482073575e-02,
- -3.118062532466678e-01, -3.266407412190941e-01, -1.026311318805894e-01,
- +1.964237395967755e-01, +3.518509343815957e-01, +2.500000000000001e-01,
- -3.465429229977282e-02, -2.939689006048397e-01, -3.383295002935882e-01,
- -1.352990250365493e-01, +1.666639146194367e-01, +3.467599613305369e-01,
- +2.733004667504394e-01}, // 4
- {+2.500000000000000e-01, +1.666639146194366e-01, -1.964237395967756e-01,
- -3.518509343815956e-01, -1.352990250365493e-01, +2.242918965856591e-01,
- +3.467599613305369e-01, +1.026311318805894e-01, -2.500000000000001e-01,
- -3.383295002935882e-01, -6.897484482073574e-02, +2.733004667504394e-01,
- +3.266407412190941e-01, +3.465429229977289e-02, -2.939689006048397e-01,
- -3.118062532466677e-01}, // 5
- {+2.500000000000000e-01, +1.026311318805894e-01, -2.939689006048397e-01,
- -2.733004667504393e-01, +1.352990250365493e-01, +3.518509343815957e-01,
- +6.897484482073579e-02, -3.118062532466678e-01, -2.500000000000001e-01,
- +1.666639146194366e-01, +3.467599613305369e-01, +3.465429229977293e-02,
- -3.266407412190941e-01, -2.242918965856591e-01, +1.964237395967756e-01,
- +3.383295002935882e-01}, // 6
- {+2.500000000000000e-01, +3.465429229977287e-02, -3.467599613305369e-01,
- -1.026311318805893e-01, +3.266407412190941e-01, +1.666639146194366e-01,
- -2.939689006048397e-01, -2.242918965856591e-01, +2.500000000000001e-01,
- +2.733004667504393e-01, -1.964237395967756e-01, -3.118062532466678e-01,
- +1.352990250365493e-01, +3.383295002935882e-01, -6.897484482073578e-02,
- -3.518509343815956e-01}, // 7
- {+2.500000000000000e-01, -3.465429229977287e-02, -3.467599613305369e-01,
- +1.026311318805893e-01, +3.266407412190941e-01, -1.666639146194366e-01,
- -2.939689006048397e-01, +2.242918965856591e-01, +2.500000000000001e-01,
- -2.733004667504393e-01, -1.964237395967756e-01, +3.118062532466678e-01,
- +1.352990250365493e-01, -3.383295002935882e-01, -6.897484482073578e-02,
- +3.518509343815956e-01}, // 8
- {+2.500000000000000e-01, -1.026311318805894e-01, -2.939689006048397e-01,
- +2.733004667504393e-01, +1.352990250365493e-01, -3.518509343815957e-01,
- +6.897484482073579e-02, +3.118062532466678e-01, -2.500000000000001e-01,
- -1.666639146194366e-01, +3.467599613305369e-01, -3.465429229977293e-02,
- -3.266407412190941e-01, +2.242918965856591e-01, +1.964237395967756e-01,
- -3.383295002935882e-01}, // 9
- // LC3 Specification d09r01.pdf; Page 109 of 177
- {+2.500000000000000e-01, -1.666639146194366e-01, -1.964237395967756e-01,
- +3.518509343815956e-01, -1.352990250365493e-01, -2.242918965856591e-01,
- +3.467599613305369e-01, -1.026311318805894e-01, -2.500000000000001e-01,
- +3.383295002935882e-01, -6.897484482073574e-02, -2.733004667504394e-01,
- +3.266407412190941e-01, -3.465429229977289e-02, -2.939689006048397e-01,
- +3.118062532466677e-01}, // 10
- {+2.500000000000000e-01, -2.242918965856591e-01, -6.897484482073575e-02,
- +3.118062532466678e-01, -3.266407412190941e-01, +1.026311318805894e-01,
- +1.964237395967755e-01, -3.518509343815957e-01, +2.500000000000001e-01,
- +3.465429229977282e-02, -2.939689006048397e-01, +3.383295002935882e-01,
- -1.352990250365493e-01, -1.666639146194367e-01, +3.467599613305369e-01,
- -2.733004667504394e-01}, // 11
- {+2.500000000000000e-01, -2.733004667504394e-01, +6.897484482073575e-02,
- +1.666639146194366e-01, -3.266407412190941e-01, +3.383295002935882e-01,
- -1.964237395967755e-01, -3.465429229977288e-02, +2.500000000000001e-01,
- -3.518509343815957e-01, +2.939689006048397e-01, -1.026311318805893e-01,
- -1.352990250365493e-01, +3.118062532466679e-01, -3.467599613305369e-01,
- +2.242918965856590e-01}, // 12
- {+2.500000000000000e-01, -3.118062532466678e-01, +1.964237395967756e-01,
- -3.465429229977286e-02, -1.352990250365493e-01, +2.733004667504394e-01,
- -3.467599613305369e-01, +3.383295002935882e-01, -2.500000000000001e-01,
- +1.026311318805894e-01, +6.897484482073574e-02, -2.242918965856590e-01,
- +3.266407412190941e-01, -3.518509343815957e-01, +2.939689006048397e-01,
- -1.666639146194367e-01}, // 13
- {+2.500000000000000e-01, -3.383295002935882e-01, +2.939689006048397e-01,
- -2.242918965856591e-01, +1.352990250365493e-01, -3.465429229977286e-02,
- -6.897484482073579e-02, +1.666639146194366e-01, -2.500000000000001e-01,
- +3.118062532466678e-01, -3.467599613305369e-01, +3.518509343815956e-01,
- -3.266407412190941e-01, +2.733004667504394e-01, -1.964237395967756e-01,
- +1.026311318805893e-01}, // 14
- {+2.500000000000000e-01, -3.518509343815957e-01, +3.467599613305369e-01,
- -3.383295002935882e-01, +3.266407412190941e-01, -3.118062532466678e-01,
- +2.939689006048397e-01, -2.733004667504394e-01, +2.500000000000001e-01,
- -2.242918965856591e-01, +1.964237395967756e-01, -1.666639146194367e-01,
- +1.352990250365493e-01, -1.026311318805893e-01, +6.897484482073578e-02,
- -3.465429229977293e-02}}; // 15
diff --git a/system/embdrv/lc3_dec/Common/Tables/SnsQuantizationTables.hpp b/system/embdrv/lc3_dec/Common/Tables/SnsQuantizationTables.hpp
deleted file mode 100644
index 2d44739..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/SnsQuantizationTables.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SnsQuantizationTables.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef SNS_QUANTIZATION_TABLES_H_
-#define SNS_QUANTIZATION_TABLES_H_
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.3 SNS Quantization
-
-// LC3 Specification d09r04_*implementorComments*
-// Section 3.7.4 SNS Quantization
-
-extern double LFCB[32][8];
-extern double HFCB[32][8];
-extern double sns_vq_reg_adj_gains[2];
-extern double sns_vq_reg_lf_adj_gains[4];
-extern double sns_vq_near_adj_gains[4];
-extern double sns_vq_far_adj_gains[8];
-extern int sns_gainMSBbits[4];
-extern int sns_gainLSBbits[4];
-extern unsigned int MPVQ_offsets[16][1 + 10];
-extern double D[16][16];
-
-#endif // SNS_QUANTIZATION_TABLES_H_
diff --git a/system/embdrv/lc3_dec/Common/Tables/SpectralDataTables.cpp b/system/embdrv/lc3_dec/Common/Tables/SpectralDataTables.cpp
deleted file mode 100644
index 2ed6b15..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/SpectralDataTables.cpp
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- * SpectralDataTables.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.6 Spectral data
-#include "SpectralDataTables.hpp"
-
-// LC3 Specification d09r01.pdf; Page 114 of 177
-unsigned char ac_spec_lookup[4096] = {
- 0x01, 0x27, 0x07, 0x19, 0x16, 0x16, 0x1C, 0x16, 0x16, 0x16, 0x16, 0x1C,
- 0x1C, 0x1C, 0x22, 0x1F, 0x1F, 0x28, 0x2B, 0x2E, 0x31, 0x34, 0x0E, 0x11,
- 0x24, 0x24, 0x24, 0x26, 0x00, 0x39, 0x26, 0x16, 0x00, 0x08, 0x09, 0x0B,
- 0x2F, 0x0E, 0x0E, 0x11,
- // LC3 Specification d09r01.pdf; Page 115 of 177
- 0x24, 0x24, 0x24, 0x26, 0x3B, 0x3B, 0x26, 0x16, 0x16, 0x1A, 0x2E, 0x1D,
- 0x1E, 0x20, 0x21, 0x23, 0x24, 0x24, 0x24, 0x26, 0x00, 0x3B, 0x17, 0x16,
- 0x2E, 0x2E, 0x2D, 0x2F, 0x30, 0x32, 0x32, 0x12, 0x36, 0x36, 0x36, 0x26,
- 0x3B, 0x3B, 0x3B, 0x16, 0x00, 0x3E, 0x3F, 0x03, 0x21, 0x02, 0x02, 0x3D,
- 0x14, 0x14, 0x14, 0x15, 0x3B, 0x3B, 0x27, 0x1C, 0x1C, 0x3F, 0x3F, 0x03,
- 0x21, 0x02, 0x02, 0x3D, 0x26, 0x26, 0x26, 0x15, 0x3B, 0x3B, 0x27, 0x1C,
- 0x1C, 0x06, 0x06, 0x06, 0x02, 0x12, 0x3D, 0x14, 0x15, 0x15, 0x15, 0x3B,
- 0x27, 0x27, 0x07, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x33, 0x33, 0x33,
- 0x35, 0x36, 0x14, 0x26, 0x26, 0x39, 0x27, 0x27, 0x27, 0x07, 0x18, 0x22,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x38, 0x26, 0x39,
- 0x39, 0x3B, 0x07, 0x07, 0x07, 0x2A, 0x2A, 0x22, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x05, 0x04, 0x04, 0x05, 0x15, 0x15, 0x3B, 0x07, 0x07, 0x07, 0x07,
- 0x19, 0x19, 0x19, 0x22, 0x04, 0x04, 0x04, 0x04, 0x05, 0x17, 0x17, 0x27,
- 0x07, 0x07, 0x07, 0x2A, 0x19, 0x19, 0x16, 0x1F, 0x1F, 0x27, 0x27, 0x27,
- 0x27, 0x07, 0x07, 0x2A, 0x00, 0x19, 0x16, 0x16, 0x16, 0x1C, 0x22, 0x1F,
- 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37,
- 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x28, 0x08, 0x09, 0x31, 0x31, 0x34,
- 0x11, 0x11, 0x11, 0x04, 0x00, 0x14, 0x11, 0x3C, 0x28, 0x28, 0x08, 0x2B,
- 0x1B, 0x31, 0x31, 0x0E, 0x11, 0x11, 0x11, 0x24, 0x2A, 0x2A, 0x11, 0x39,
- 0x39, 0x28, 0x08, 0x1A, 0x1B, 0x31, 0x0C, 0x0E, 0x11, 0x11, 0x11, 0x24,
- 0x00, 0x26, 0x24, 0x01, 0x08, 0x08, 0x2B, 0x09, 0x0B, 0x31, 0x0C, 0x0E,
- 0x0E, 0x21, 0x32, 0x32, 0x32, 0x3D, 0x24, 0x27, 0x08, 0x08, 0x2B, 0x2E,
- 0x31, 0x34, 0x1E, 0x0E, 0x0E, 0x21, 0x32, 0x32, 0x32, 0x32, 0x12, 0x19,
- 0x08, 0x08, 0x2B, 0x2E, 0x31, 0x34, 0x1E, 0x0E, 0x0E, 0x12, 0x05, 0x05,
- 0x05, 0x3D, 0x12, 0x17, 0x2B, 0x2B, 0x2B, 0x09, 0x31, 0x34, 0x03, 0x0E,
- 0x0E, 0x32, 0x32, 0x32, 0x32, 0x3D, 0x11, 0x18, 0x2B, 0x2B, 0x2B, 0x2B,
- 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B,
- 0x2B, 0x2B, 0x2B, 0x09, 0x0B, 0x34, 0x34, 0x0E, 0x0E, 0x11, 0x3D, 0x3D,
- 0x3D, 0x36, 0x11, 0x27, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D,
- 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2C, 0x1B,
- 0x1D, 0x34, 0x30, 0x34, 0x34, 0x11, 0x11, 0x11, 0x11, 0x02, 0x11, 0x07,
- 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B,
- 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x09, 0x1B, 0x1B, 0x0C, 0x34, 0x0E,
- 0x0E, 0x3A, 0x29, 0x29, 0x29, 0x06, 0x11, 0x25, 0x09, 0x09, 0x09, 0x1B,
- 0x0B, 0x31, 0x0C, 0x34,
- // LC3 Specification d09r01.pdf; Page 116 of 177
- 0x0E, 0x0E, 0x0E, 0x32, 0x00, 0x35, 0x11, 0x1C, 0x34, 0x34, 0x31, 0x34,
- 0x0C, 0x34, 0x1E, 0x0E, 0x0E, 0x11, 0x02, 0x02, 0x02, 0x26, 0x26, 0x22,
- 0x1F, 0x22, 0x22, 0x1F, 0x1F, 0x1F, 0x1F, 0x13, 0x13, 0x13, 0x13, 0x13,
- 0x13, 0x13, 0x1F, 0x13, 0x2C, 0x2C, 0x3E, 0x1E, 0x20, 0x3A, 0x23, 0x24,
- 0x24, 0x26, 0x00, 0x3B, 0x07, 0x07, 0x27, 0x22, 0x22, 0x2D, 0x2F, 0x30,
- 0x21, 0x23, 0x23, 0x24, 0x26, 0x26, 0x26, 0x3B, 0x07, 0x07, 0x27, 0x22,
- 0x22, 0x3E, 0x1E, 0x0F, 0x32, 0x35, 0x35, 0x36, 0x15, 0x15, 0x15, 0x3B,
- 0x07, 0x07, 0x07, 0x22, 0x1E, 0x1E, 0x30, 0x21, 0x3A, 0x12, 0x12, 0x38,
- 0x17, 0x17, 0x17, 0x3B, 0x07, 0x07, 0x18, 0x22, 0x22, 0x06, 0x06, 0x3A,
- 0x35, 0x36, 0x36, 0x15, 0x3B, 0x3B, 0x3B, 0x27, 0x07, 0x07, 0x2A, 0x22,
- 0x06, 0x06, 0x21, 0x3A, 0x35, 0x36, 0x3D, 0x15, 0x3B, 0x3B, 0x3B, 0x27,
- 0x07, 0x07, 0x2A, 0x22, 0x22, 0x33, 0x33, 0x35, 0x36, 0x38, 0x38, 0x39,
- 0x27, 0x27, 0x27, 0x07, 0x2A, 0x2A, 0x19, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
- 0x1F, 0x04, 0x04, 0x04, 0x05, 0x17, 0x17, 0x27, 0x07, 0x07, 0x07, 0x2A,
- 0x19, 0x19, 0x16, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x05, 0x05, 0x05,
- 0x05, 0x39, 0x39, 0x27, 0x18, 0x18, 0x18, 0x2A, 0x16, 0x16, 0x1C, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x29, 0x29, 0x29, 0x29, 0x27, 0x27, 0x07,
- 0x2A, 0x2A, 0x2A, 0x19, 0x1C, 0x1C, 0x1C, 0x1F, 0x1F, 0x29, 0x29, 0x29,
- 0x29, 0x27, 0x27, 0x18, 0x19, 0x19, 0x19, 0x16, 0x1C, 0x1C, 0x22, 0x1F,
- 0x1F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x1C, 0x22, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x1F, 0x13, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x0B,
- 0x2F, 0x20, 0x32, 0x12, 0x12, 0x14, 0x15, 0x15, 0x15, 0x27, 0x3B, 0x22,
- 0x1A, 0x1A, 0x1B, 0x1D, 0x1E, 0x21, 0x32, 0x12, 0x12, 0x14, 0x39, 0x39,
- 0x39, 0x3B, 0x3B, 0x22, 0x1B, 0x1B, 0x0B, 0x0C, 0x30, 0x32, 0x3A, 0x3D,
- 0x3D, 0x38, 0x39, 0x39, 0x39, 0x3B, 0x27, 0x22, 0x2D, 0x2D, 0x0C, 0x1E,
- 0x20, 0x02, 0x02, 0x3D, 0x26, 0x26, 0x26, 0x39, 0x00, 0x3B, 0x27, 0x22,
- 0x3F, 0x3F, 0x03, 0x20, 0x3A, 0x12, 0x12, 0x14, 0x15, 0x15, 0x15, 0x3B,
- 0x27, 0x27, 0x07, 0x1F, 0x1F, 0x03, 0x03, 0x21, 0x3A, 0x12, 0x12, 0x14,
- 0x15, 0x15, 0x15, 0x3B, 0x07, 0x07, 0x07, 0x1F, 0x06, 0x06, 0x33, 0x33,
- 0x35, 0x36, 0x36, 0x26, 0x39, 0x39, 0x39, 0x27, 0x07, 0x07, 0x2A, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x33, 0x35, 0x35, 0x36, 0x38, 0x38, 0x39,
- 0x3B, 0x3B, 0x3B, 0x07, 0x18, 0x18, 0x19, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F,
- // LC3 Specification d09r01.pdf; Page 117 of 177
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x04, 0x04, 0x04,
- 0x36, 0x15, 0x15, 0x39, 0x27, 0x27, 0x27, 0x07, 0x2A, 0x2A, 0x16, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x05, 0x05, 0x05, 0x05, 0x17, 0x17, 0x3B,
- 0x07, 0x07, 0x07, 0x2A, 0x16, 0x16, 0x1C, 0x1F, 0x1F, 0x04, 0x04, 0x04,
- 0x05, 0x17, 0x17, 0x27, 0x18, 0x18, 0x18, 0x19, 0x1C, 0x1C, 0x22, 0x1F,
- 0x1F, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x1C, 0x22, 0x22, 0x22, 0x1F,
- 0x1F, 0x1F, 0x1F, 0x13, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x3C,
- 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x0D, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C,
- 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- // LC3 Specification d09r01.pdf; Page 118 of 177
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00,
- 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x25,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x3C, 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x3C, 0x3C, 0x3C, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x25,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- // LC3 Specification d09r01.pdf; Page 119 of 177
- 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x10,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x3C, 0x3C, 0x3C, 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x25,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- // LC3 Specification d09r01.pdf; Page 120 of 177
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x0D, 0x0D, 0x0D, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x10, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- // LC3 Specification d09r01.pdf; Page 121 of 177
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x3C, 0x3C, 0x3C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0D, 0x0D, 0x0D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x3C, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x3C, 0x3C, 0x3C,
- 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- // LC3 Specification d09r01.pdf; Page 122 of 177
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D,
- 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x0D, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- // LC3 Specification d09r01.pdf; Page 123 of 177
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- // LC3 Specification d09r01.pdf; Page 124 of 177
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-short ac_spec_cumfreq[64][17] = {
- {0, 1, 2, 177, 225, 226, 227, 336, 372, 543, 652, 699, 719, 768, 804, 824,
- 834},
- {0, 18, 44, 61, 71, 98, 135, 159, 175, 197, 229, 251, 265, 282, 308, 328,
- 341},
- {0, 71, 163, 212, 237, 318, 420, 481, 514, 556, 613, 652, 675, 697, 727,
- 749, 764},
- {0, 160, 290, 336, 354, 475, 598, 653, 677, 722, 777, 808, 823, 842, 866,
- 881, 890},
- {0, 71, 144, 177, 195, 266, 342, 385, 411, 445, 489, 519, 539, 559, 586,
- 607, 622},
- {0, 48, 108, 140, 159, 217, 285, 327, 354, 385, 427, 457, 478, 497, 524,
- 545, 561},
- {0, 138, 247, 290, 308, 419, 531, 584, 609, 655, 710, 742, 759, 780, 807,
- 825, 836},
- {0, 16, 40, 62, 79, 103, 139, 170, 195, 215, 245, 270, 290, 305, 327, 346,
- 362},
- {0, 579, 729, 741, 743, 897, 970, 980, 982, 996, 1007, 1010, 1011, 1014,
- 1017, 1018, 1019},
- {0, 398, 582, 607, 612, 788, 902, 925, 931, 956, 979, 987, 990, 996, 1002,
- 1005, 1007},
- {0, 13, 34, 52, 63, 83, 112, 134, 149, 163, 183, 199, 211, 221, 235, 247,
- 257},
- {0, 281, 464, 501, 510, 681, 820, 857, 867, 902, 938, 953, 959, 968, 978,
- 984, 987},
- {0, 198, 362, 408, 421, 575, 722, 773, 789, 832, 881, 905, 915, 928, 944,
- 954, 959},
- {0, 1, 2, 95, 139, 140, 141, 213, 251, 337, 407, 450, 475, 515, 551, 576,
- 592},
- {0, 133, 274, 338, 366, 483, 605, 664, 691, 730, 778, 807, 822, 837, 857,
- 870, 878},
- {0, 128, 253, 302, 320, 443, 577, 636, 659, 708, 767, 799, 814, 833, 857,
- 872, 881},
- {0, 1, 2, 25, 42, 43, 44, 67, 85, 105, 126, 144, 159, 174, 191, 205, 217},
- {0, 70, 166, 229, 267, 356, 468, 533, 569, 606, 653, 685, 705, 722, 745,
- 762, 774},
- {0, 55, 130, 175, 200, 268, 358, 416, 449, 488, 542, 581, 606, 628, 659,
- 683, 699},
- {0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31},
- {0, 34, 85, 123, 147, 196, 265, 317, 352, 386, 433, 470, 497, 518, 549, 574,
- 593},
- {0, 30, 73, 105, 127, 170, 229, 274, 305, 335, 377, 411, 436, 455, 483, 506,
- 524},
- {0, 9, 24, 38, 51, 65, 87, 108, 126, 139, 159, 177, 193, 204, 221, 236,
- 250},
- {0, 30, 74, 105, 125, 166, 224, 266, 294, 322, 361, 391, 413, 431, 457, 478,
- 494},
- {0, 15, 38, 58, 73, 95, 128, 156, 178, 196, 222, 245, 263, 276, 296, 314,
- 329},
- // LC3 Specification d09r01.pdf; Page 125 of 177
- {0, 11, 28, 44, 57, 74, 100, 123, 142, 157, 179, 199, 216, 228, 246, 262,
- 276},
- {0, 448, 619, 639, 643, 821, 926, 944, 948, 971, 991, 998, 1000, 1005, 1010,
- 1012, 1013},
- {0, 332, 520, 549, 555, 741, 874, 903, 910, 940, 970, 981, 985, 991, 998,
- 1002, 1004},
- {0, 8, 21, 34, 45, 58, 78, 96, 112, 124, 141, 157, 170, 180, 194, 207, 219},
- {0, 239, 415, 457, 468, 631, 776, 820, 833, 872, 914, 933, 940, 951, 964,
- 971, 975},
- {0, 165, 310, 359, 375, 513, 652, 707, 727, 774, 828, 856, 868, 884, 904,
- 916, 923},
- {0, 3, 8, 13, 18, 23, 30, 37, 44, 48, 55, 62, 68, 72, 78, 84, 90},
- {0, 115, 237, 289, 311, 422, 547, 608, 635, 680, 737, 771, 788, 807, 832,
- 849, 859},
- {0, 107, 221, 272, 293, 399, 521, 582, 610, 656, 714, 749, 767, 787, 813,
- 831, 842},
- {0, 6, 16, 26, 35, 45, 60, 75, 89, 98, 112, 125, 137, 145, 157, 168, 178},
- {0, 72, 160, 210, 236, 320, 422, 482, 514, 555, 608, 644, 665, 685, 712,
- 732, 745},
- {0, 45, 108, 153, 183, 244, 327, 385, 421, 455, 502, 536, 559, 578, 605,
- 626, 641},
- {0, 1, 2, 9, 16, 17, 18, 26, 34, 40, 48, 55, 62, 68, 75, 82, 88},
- {0, 29, 73, 108, 132, 174, 236, 284, 318, 348, 391, 426, 452, 471, 500, 524,
- 543},
- {0, 20, 51, 76, 93, 123, 166, 200, 225, 247, 279, 305, 326, 342, 365, 385,
- 401},
- {0, 742, 845, 850, 851, 959, 997, 1001, 1002, 1009, 1014, 1016, 1017, 1019,
- 1020, 1021, 1022},
- {0, 42, 94, 121, 137, 186, 244, 280, 303, 330, 366, 392, 410, 427, 451, 470,
- 484},
- {0, 13, 33, 51, 66, 85, 114, 140, 161, 178, 203, 225, 243, 256, 275, 292,
- 307},
- {0, 501, 670, 689, 693, 848, 936, 952, 956, 975, 991, 997, 999, 1004, 1008,
- 1010, 1011},
- {0, 445, 581, 603, 609, 767, 865, 888, 895, 926, 954, 964, 968, 977, 986,
- 991, 993},
- {0, 285, 442, 479, 489, 650, 779, 818, 830, 870, 912, 930, 937, 949, 963,
- 971, 975},
- {0, 349, 528, 561, 569, 731, 852, 883, 892, 923, 953, 965, 970, 978, 987,
- 992, 994},
- {0, 199, 355, 402, 417, 563, 700, 750, 767, 811, 860, 884, 894, 909, 926,
- 936, 942},
- {0, 141, 275, 325, 343, 471, 606, 664, 686, 734, 791, 822, 836, 854, 877,
- 891, 899},
- {0, 243, 437, 493, 510, 649, 775, 820, 836, 869, 905, 923, 931, 941, 953,
- 960, 964},
- {0, 91, 197, 248, 271, 370, 487, 550, 580, 625, 684, 721, 741, 761, 788,
- 807, 819},
- {0, 107, 201, 242, 262, 354, 451, 503, 531, 573, 626, 660, 680, 701, 730,
- 751, 765},
- {0, 168, 339, 407, 432, 553, 676, 731, 755, 789, 830, 854, 866, 879, 895,
- 906, 912},
- // LC3 Specification d09r01.pdf; Page 126 of 177
- {0, 67, 147, 191, 214, 290, 384, 441, 472, 513, 567, 604, 627, 648, 678,
- 700, 715},
- {0, 46, 109, 148, 171, 229, 307, 359, 391, 427, 476, 513, 537, 558, 588,
- 612, 629},
- {0, 848, 918, 920, 921, 996, 1012, 1013, 1014, 1016, 1017, 1018, 1019, 1020,
- 1021, 1022, 1023},
- {0, 36, 88, 123, 145, 193, 260, 308, 340, 372, 417, 452, 476, 496, 525, 548,
- 565},
- {0, 24, 61, 90, 110, 145, 196, 237, 266, 292, 330, 361, 385, 403, 430, 453,
- 471},
- {0, 85, 182, 230, 253, 344, 454, 515, 545, 590, 648, 685, 706, 727, 756,
- 776, 789},
- {0, 22, 55, 82, 102, 135, 183, 222, 252, 278, 315, 345, 368, 385, 410, 431,
- 448},
- {0, 1, 2, 56, 89, 90, 91, 140, 172, 221, 268, 303, 328, 358, 388, 412, 430},
- {0, 45, 109, 152, 177, 239, 320, 376, 411, 448, 499, 537, 563, 585, 616,
- 640, 658},
- {0, 247, 395, 433, 445, 599, 729, 771, 785, 829, 875, 896, 905, 920, 937,
- 946, 951},
- {0, 231, 367, 408, 423, 557, 676, 723, 742, 786, 835, 860, 872, 889, 909,
- 921, 928}};
-short ac_spec_freq[64][17] = {
- {1, 1, 175, 48, 1, 1, 109, 36, 171, 109, 47, 20, 49, 36, 20, 10, 190},
- {18, 26, 17, 10, 27, 37, 24, 16, 22, 32, 22, 14, 17, 26, 20, 13, 683},
- {71, 92, 49, 25, 81, 102, 61, 33, 42, 57, 39, 23, 22, 30, 22, 15, 260},
- {160, 130, 46, 18, 121, 123, 55, 24, 45, 55, 31, 15, 19, 24, 15, 9, 134},
- {71, 73, 33, 18, 71, 76, 43, 26, 34, 44, 30, 20, 20, 27, 21, 15, 402},
- {48, 60, 32, 19, 58, 68, 42, 27, 31, 42, 30, 21, 19, 27, 21, 16, 463},
- {138, 109, 43, 18, 111, 112, 53, 25, 46, 55, 32, 17, 21, 27, 18, 11, 188},
- {16, 24, 22, 17, 24, 36, 31, 25, 20, 30, 25, 20, 15, 22, 19, 16, 662},
- {579, 150, 12, 2, 154, 73, 10, 2, 14, 11, 3, 1, 3, 3, 1, 1, 5},
- {398, 184, 25, 5, 176, 114, 23, 6, 25, 23, 8, 3, 6, 6, 3, 2, 17},
- {13, 21, 18, 11, 20, 29, 22, 15, 14, 20, 16, 12, 10, 14, 12, 10, 767},
- {281, 183, 37, 9, 171, 139, 37, 10, 35, 36, 15, 6, 9, 10, 6, 3, 37},
- {198, 164, 46, 13, 154, 147, 51, 16, 43, 49, 24, 10, 13, 16, 10, 5, 65},
- {1, 1, 93, 44, 1, 1, 72, 38, 86, 70, 43, 25, 40, 36, 25, 16, 432},
- {133, 141, 64, 28, 117, 122, 59, 27, 39, 48, 29, 15, 15, 20, 13, 8, 146},
- // LC3 Specification d09r01.pdf; Page 127 of 177
- {128, 125, 49, 18, 123, 134, 59, 23, 49, 59, 32, 15, 19, 24, 15, 9, 143},
- {1, 1, 23, 17, 1, 1, 23, 18, 20, 21, 18, 15, 15, 17, 14, 12, 807},
- {70, 96, 63, 38, 89, 112, 65, 36, 37, 47, 32, 20, 17, 23, 17, 12, 250},
- {55, 75, 45, 25, 68, 90, 58, 33, 39, 54, 39, 25, 22, 31, 24, 16, 325},
- {1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 993},
- {34, 51, 38, 24, 49, 69, 52, 35, 34, 47, 37, 27, 21, 31, 25, 19, 431},
- {30, 43, 32, 22, 43, 59, 45, 31, 30, 42, 34, 25, 19, 28, 23, 18, 500},
- {9, 15, 14, 13, 14, 22, 21, 18, 13, 20, 18, 16, 11, 17, 15, 14, 774},
- {30, 44, 31, 20, 41, 58, 42, 28, 28, 39, 30, 22, 18, 26, 21, 16, 530},
- {15, 23, 20, 15, 22, 33, 28, 22, 18, 26, 23, 18, 13, 20, 18, 15, 695},
- {11, 17, 16, 13, 17, 26, 23, 19, 15, 22, 20, 17, 12, 18, 16, 14, 748},
- {448, 171, 20, 4, 178, 105, 18, 4, 23, 20, 7, 2, 5, 5, 2, 1, 11},
- {332, 188, 29, 6, 186, 133, 29, 7, 30, 30, 11, 4, 6, 7, 4, 2, 20},
- {8, 13, 13, 11, 13, 20, 18, 16, 12, 17, 16, 13, 10, 14, 13, 12, 805},
- {239, 176, 42, 11, 163, 145, 44, 13, 39, 42, 19, 7, 11, 13, 7, 4, 49},
- {165, 145, 49, 16, 138, 139, 55, 20, 47, 54, 28, 12, 16, 20, 12, 7, 101},
- {3, 5, 5, 5, 5, 7, 7, 7, 4, 7, 7, 6, 4, 6, 6, 6, 934},
- {115, 122, 52, 22, 111, 125, 61, 27, 45, 57, 34, 17, 19, 25, 17, 10, 165},
- {107, 114, 51, 21, 106, 122, 61, 28, 46, 58, 35, 18, 20, 26, 18, 11, 182},
- {6, 10, 10, 9, 10, 15, 15, 14, 9, 14, 13, 12, 8, 12, 11, 10, 846},
- {72, 88, 50, 26, 84, 102, 60, 32, 41, 53, 36, 21, 20, 27, 20, 13, 279},
- {45, 63, 45, 30, 61, 83, 58, 36, 34, 47, 34, 23, 19, 27, 21, 15, 383},
- {1, 1, 7, 7, 1, 1, 8, 8, 6, 8, 7, 7, 6, 7, 7, 6, 936},
- {29, 44, 35, 24, 42, 62, 48, 34, 30, 43, 35, 26, 19, 29, 24, 19, 481},
- {20, 31, 25, 17, 30, 43, 34, 25, 22, 32, 26, 21, 16, 23, 20, 16, 623},
- {742, 103, 5, 1, 108, 38, 4, 1, 7, 5, 2, 1, 2, 1, 1, 1, 2},
- {42, 52, 27, 16, 49, 58, 36, 23, 27, 36, 26, 18, 17, 24, 19, 14, 540},
- {13, 20, 18, 15, 19, 29, 26, 21, 17, 25, 22, 18, 13, 19, 17, 15, 717},
- // LC3 Specification d09r01.pdf; Page 128 of 177
- {501, 169, 19, 4, 155, 88, 16, 4, 19, 16, 6, 2, 5, 4, 2, 1, 13},
- {445, 136, 22, 6, 158, 98, 23, 7, 31, 28, 10, 4, 9, 9, 5, 2, 31},
- {285, 157, 37, 10, 161, 129, 39, 12, 40, 42, 18, 7, 12, 14, 8, 4, 49},
- {349, 179, 33, 8, 162, 121, 31, 9, 31, 30, 12, 5, 8, 9, 5, 2, 30},
- {199, 156, 47, 15, 146, 137, 50, 17, 44, 49, 24, 10, 15, 17, 10, 6, 82},
- {141, 134, 50, 18, 128, 135, 58, 22, 48, 57, 31, 14, 18, 23, 14, 8, 125},
- {243, 194, 56, 17, 139, 126, 45, 16, 33, 36, 18, 8, 10, 12, 7, 4, 60},
- {91, 106, 51, 23, 99, 117, 63, 30, 45, 59, 37, 20, 20, 27, 19, 12, 205},
- {107, 94, 41, 20, 92, 97, 52, 28, 42, 53, 34, 20, 21, 29, 21, 14, 259},
- {168, 171, 68, 25, 121, 123, 55, 24, 34, 41, 24, 12, 13, 16, 11, 6, 112},
- {67, 80, 44, 23, 76, 94, 57, 31, 41, 54, 37, 23, 21, 30, 22, 15, 309},
- {46, 63, 39, 23, 58, 78, 52, 32, 36, 49, 37, 24, 21, 30, 24, 17, 395},
- {848, 70, 2, 1, 75, 16, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1},
- {36, 52, 35, 22, 48, 67, 48, 32, 32, 45, 35, 24, 20, 29, 23, 17, 459},
- {24, 37, 29, 20, 35, 51, 41, 29, 26, 38, 31, 24, 18, 27, 23, 18, 553},
- {85, 97, 48, 23, 91, 110, 61, 30, 45, 58, 37, 21, 21, 29, 20, 13, 235},
- {22, 33, 27, 20, 33, 48, 39, 30, 26, 37, 30, 23, 17, 25, 21, 17, 576},
- {1, 1, 54, 33, 1, 1, 49, 32, 49, 47, 35, 25, 30, 30, 24, 18, 594},
- {45, 64, 43, 25, 62, 81, 56, 35, 37, 51, 38, 26, 22, 31, 24, 18, 366},
- {247, 148, 38, 12, 154, 130, 42, 14, 44, 46, 21, 9, 15, 17, 9, 5, 73},
- {231, 136, 41, 15, 134, 119, 47, 19, 44, 49, 25, 12, 17, 20, 12, 7, 96}};
-short ac_spec_bits[64][17] = {
- {20480, 20480, 5220, 9042, 20480, 20480, 6619, 9892, 5289, 6619, 9105,
- 11629, 8982, 9892, 11629, 13677, 4977},
- {11940, 10854, 12109, 13677, 10742, 9812, 11090, 12288, 11348, 10240, 11348,
- 12683, 12109, 10854, 11629, 12902, 1197},
- {7886, 7120, 8982, 10970, 7496, 6815, 8334, 10150, 9437, 8535, 9656, 11216,
- 11348, 10431, 11348, 12479, 4051},
- {5485, 6099, 9168, 11940, 6311, 6262, 8640, 11090, 9233, 8640, 10334, 12479,
- 11781, 11090, 12479, 13988, 6009},
- {7886, 7804, 10150, 11940, 7886, 7685, 9368, 10854, 10061, 9300, 10431,
- 11629, 11629, 10742, 11485, 12479, 2763},
- // LC3 Specification d09r01.pdf; Page 129 of 177
- {9042, 8383, 10240, 11781, 8483, 8013, 9437, 10742, 10334, 9437, 10431,
- 11485, 11781, 10742, 11485, 12288, 2346},
- {5922, 6619, 9368, 11940, 6566, 6539, 8750, 10970, 9168, 8640, 10240, 12109,
- 11485, 10742, 11940, 13396, 5009},
- {12288, 11090, 11348, 12109, 11090, 9892, 10334, 10970, 11629, 10431, 10970,
- 11629, 12479, 11348, 11781, 12288, 1289},
- {1685, 5676, 13138, 18432, 5598, 7804, 13677, 18432, 12683, 13396, 17234,
- 20480, 17234, 17234, 20480, 20480, 15725},
- {2793, 5072, 10970, 15725, 5204, 6487, 11216, 15186, 10970, 11216, 14336,
- 17234, 15186, 15186, 17234, 18432, 12109},
- {12902, 11485, 11940, 13396, 11629, 10531, 11348, 12479, 12683, 11629,
- 12288, 13138, 13677, 12683, 13138, 13677, 854},
- {3821, 5088, 9812, 13988, 5289, 5901, 9812, 13677, 9976, 9892, 12479, 15186,
- 13988, 13677, 15186, 17234, 9812},
- {4856, 5412, 9168, 12902, 5598, 5736, 8863, 12288, 9368, 8982, 11090, 13677,
- 12902, 12288, 13677, 15725, 8147},
- {20480, 20480, 7088, 9300, 20480, 20480, 7844, 9733, 7320, 7928, 9368,
- 10970, 9581, 9892, 10970, 12288, 2550},
- {6031, 5859, 8192, 10635, 6410, 6286, 8433, 10742, 9656, 9042, 10531, 12479,
- 12479, 11629, 12902, 14336, 5756},
- {6144, 6215, 8982, 11940, 6262, 6009, 8433, 11216, 8982, 8433, 10240, 12479,
- 11781, 11090, 12479, 13988, 5817},
- {20480, 20480, 11216, 12109, 20480, 20480, 11216, 11940, 11629, 11485,
- 11940, 12479, 12479, 12109, 12683, 13138, 704},
- {7928, 6994, 8239, 9733, 7218, 6539, 8147, 9892, 9812, 9105, 10240, 11629,
- 12109, 11216, 12109, 13138, 4167},
- {8640, 7724, 9233, 10970, 8013, 7185, 8483, 10150, 9656, 8694, 9656, 10970,
- 11348, 10334, 11090, 12288, 3391},
- {20480, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432, 18432,
- 18432, 18432, 18432, 18432, 18432, 18432, 91},
- {10061, 8863, 9733, 11090, 8982, 7970, 8806, 9976, 10061, 9105, 9812, 10742,
- 11485, 10334, 10970, 11781, 2557},
- {10431, 9368, 10240, 11348, 9368, 8433, 9233, 10334, 10431, 9437, 10061,
- 10970, 11781, 10635, 11216, 11940, 2119},
- {13988, 12479, 12683, 12902, 12683, 11348, 11485, 11940, 12902, 11629,
- 11940, 12288, 13396, 12109, 12479, 12683, 828},
- {10431, 9300, 10334, 11629, 9508, 8483, 9437, 10635, 10635, 9656, 10431,
- 11348, 11940, 10854, 11485, 12288, 1946},
- {12479, 11216, 11629, 12479, 11348, 10150, 10635, 11348, 11940, 10854,
- 11216, 11940, 12902, 11629, 11940, 12479, 1146},
- {13396, 12109, 12288, 12902, 12109, 10854, 11216, 11781, 12479, 11348,
- 11629, 12109, 13138, 11940, 12288, 12683, 928},
- {2443, 5289, 11629, 16384, 5170, 6730, 11940, 16384, 11216, 11629, 14731,
- 18432, 15725, 15725, 18432, 20480, 13396},
- {3328, 5009, 10531, 15186, 5040, 6031, 10531, 14731, 10431, 10431, 13396,
- 16384, 15186, 14731, 16384, 18432, 11629},
- {14336, 12902, 12902, 13396, 12902, 11629, 11940, 12288, 13138, 12109,
- 12288, 12902, 13677, 12683, 12902, 13138, 711},
- // LC3 Specification d09r01.pdf; Page 130 of 177
- {4300, 5204, 9437, 13396, 5430, 5776, 9300, 12902, 9656, 9437, 11781, 14731,
- 13396, 12902, 14731, 16384, 8982},
- {5394, 5776, 8982, 12288, 5922, 5901, 8640, 11629, 9105, 8694, 10635, 13138,
- 12288, 11629, 13138, 14731, 6844},
- {17234, 15725, 15725, 15725, 15725, 14731, 14731, 14731, 16384, 14731,
- 14731, 15186, 16384, 15186, 15186, 15186, 272},
- {6461, 6286, 8806, 11348, 6566, 6215, 8334, 10742, 9233, 8535, 10061, 12109,
- 11781, 10970, 12109, 13677, 5394},
- {6674, 6487, 8863, 11485, 6702, 6286, 8334, 10635, 9168, 8483, 9976, 11940,
- 11629, 10854, 11940, 13396, 5105},
- {15186, 13677, 13677, 13988, 13677, 12479, 12479, 12683, 13988, 12683,
- 12902, 13138, 14336, 13138, 13396, 13677, 565},
- {7844, 7252, 8922, 10854, 7389, 6815, 8383, 10240, 9508, 8750, 9892, 11485,
- 11629, 10742, 11629, 12902, 3842},
- {9233, 8239, 9233, 10431, 8334, 7424, 8483, 9892, 10061, 9105, 10061, 11216,
- 11781, 10742, 11485, 12479, 2906},
- {20480, 20480, 14731, 14731, 20480, 20480, 14336, 14336, 15186, 14336,
- 14731, 14731, 15186, 14731, 14731, 15186, 266},
- {10531, 9300, 9976, 11090, 9437, 8286, 9042, 10061, 10431, 9368, 9976,
- 10854, 11781, 10531, 11090, 11781, 2233},
- {11629, 10334, 10970, 12109, 10431, 9368, 10061, 10970, 11348, 10240, 10854,
- 11485, 12288, 11216, 11629, 12288, 1469},
- {952, 6787, 15725, 20480, 6646, 9733, 16384, 20480, 14731, 15725, 18432,
- 20480, 18432, 20480, 20480, 20480, 18432},
- {9437, 8806, 10742, 12288, 8982, 8483, 9892, 11216, 10742, 9892, 10854,
- 11940, 12109, 11090, 11781, 12683, 1891},
- {12902, 11629, 11940, 12479, 11781, 10531, 10854, 11485, 12109, 10970,
- 11348, 11940, 12902, 11781, 12109, 12479, 1054},
- {2113, 5323, 11781, 16384, 5579, 7252, 12288, 16384, 11781, 12288, 15186,
- 18432, 15725, 16384, 18432, 20480, 12902},
- {2463, 5965, 11348, 15186, 5522, 6934, 11216, 14731, 10334, 10635, 13677,
- 16384, 13988, 13988, 15725, 18432, 10334},
- {3779, 5541, 9812, 13677, 5467, 6122, 9656, 13138, 9581, 9437, 11940, 14731,
- 13138, 12683, 14336, 16384, 8982},
- {3181, 5154, 10150, 14336, 5448, 6311, 10334, 13988, 10334, 10431, 13138,
- 15725, 14336, 13988, 15725, 18432, 10431},
- {4841, 5560, 9105, 12479, 5756, 5944, 8922, 12109, 9300, 8982, 11090, 13677,
- 12479, 12109, 13677, 15186, 7460},
- {5859, 6009, 8922, 11940, 6144, 5987, 8483, 11348, 9042, 8535, 10334, 12683,
- 11940, 11216, 12683, 14336, 6215},
- {4250, 4916, 8587, 12109, 5901, 6191, 9233, 12288, 10150, 9892, 11940,
- 14336, 13677, 13138, 14731, 16384, 8383},
- {7153, 6702, 8863, 11216, 6904, 6410, 8239, 10431, 9233, 8433, 9812, 11629,
- 11629, 10742, 11781, 13138, 4753},
- {6674, 7057, 9508, 11629, 7120, 6964, 8806, 10635, 9437, 8750, 10061, 11629,
- 11485, 10531, 11485, 12683, 4062},
- {5341, 5289, 8013, 10970, 6311, 6262, 8640, 11090, 10061, 9508, 11090,
- 13138, 12902, 12288, 13396, 15186, 6539},
- {8057, 7533, 9300, 11216, 7685, 7057, 8535, 10334, 9508, 8694, 9812, 11216,
- 11485, 10431, 11348, 12479, 3541},
- {9168, 8239, 9656, 11216, 8483, 7608, 8806, 10240, 9892, 8982, 9812, 11090,
- 11485, 10431, 11090, 12109, 2815},
- // LC3 Specification d09r01.pdf; Page 131 of 177
- {558, 7928, 18432, 20480, 7724, 12288, 20480, 20480, 18432, 20480, 20480,
- 20480, 20480, 20480, 20480, 20480, 20480},
- {9892, 8806, 9976, 11348, 9042, 8057, 9042, 10240, 10240, 9233, 9976, 11090,
- 11629, 10531, 11216, 12109, 2371},
- {11090, 9812, 10531, 11629, 9976, 8863, 9508, 10531, 10854, 9733, 10334,
- 11090, 11940, 10742, 11216, 11940, 1821},
- {7354, 6964, 9042, 11216, 7153, 6592, 8334, 10431, 9233, 8483, 9812, 11485,
- 11485, 10531, 11629, 12902, 4349},
- {11348, 10150, 10742, 11629, 10150, 9042, 9656, 10431, 10854, 9812, 10431,
- 11216, 12109, 10970, 11485, 12109, 1700},
- {20480, 20480, 8694, 10150, 20480, 20480, 8982, 10240, 8982, 9105, 9976,
- 10970, 10431, 10431, 11090, 11940, 1610},
- {9233, 8192, 9368, 10970, 8286, 7496, 8587, 9976, 9812, 8863, 9733, 10854,
- 11348, 10334, 11090, 11940, 3040},
- {4202, 5716, 9733, 13138, 5598, 6099, 9437, 12683, 9300, 9168, 11485, 13988,
- 12479, 12109, 13988, 15725, 7804},
- {4400, 5965, 9508, 12479, 6009, 6360, 9105, 11781, 9300, 8982, 10970, 13138,
- 12109, 11629, 13138, 14731, 6994}};
diff --git a/system/embdrv/lc3_dec/Common/Tables/SpectralDataTables.hpp b/system/embdrv/lc3_dec/Common/Tables/SpectralDataTables.hpp
deleted file mode 100644
index 6c031b6..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/SpectralDataTables.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SpectralDataTables.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.6 Spectral data
-
-#ifndef SPECTRAL_DATA_TABLES_H_
-#define SPECTRAL_DATA_TABLES_H_
-
-extern unsigned char ac_spec_lookup[4096];
-extern short ac_spec_cumfreq[64][17];
-extern short ac_spec_freq[64][17];
-extern short ac_spec_bits[64][17];
-
-#endif // SPECTRAL_DATA_TABLES_H_
diff --git a/system/embdrv/lc3_dec/Common/Tables/TemporalNoiseShapingTables.cpp b/system/embdrv/lc3_dec/Common/Tables/TemporalNoiseShapingTables.cpp
deleted file mode 100644
index 4660663..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/TemporalNoiseShapingTables.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * TemporalNoiseShapingTables.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.4 Temporal Noise Shaping
-#include "TemporalNoiseShapingTables.hpp"
-
-// LC3 Specification d09r01.pdf; Page 109 of 177
-short ac_tns_order_bits[2][8] = {
- {17234, 13988, 11216, 8694, 6566, 4977, 3961, 3040},
- {12683, 9437, 6874, 5541, 5121, 5170, 5359, 5056}};
-short ac_tns_order_freq[2][8] = {{3, 9, 23, 54, 111, 190, 268, 366},
- {14, 42, 100, 157, 181, 178, 167, 185}};
-short ac_tns_order_cumfreq[2][8] = {{0, 3, 12, 35, 89, 200, 390, 658},
- {0, 14, 56, 156, 313, 494, 672, 839}};
-// LC3 Specification d09r01.pdf; Page 110 of 177
-short ac_tns_coef_bits[8][17] = {
- {20480, 15725, 12479, 10334, 8694, 7320, 6964, 6335, 5504, 5637, 6566, 6758,
- 8433, 11348, 15186, 20480, 20480},
- {20480, 20480, 20480, 20480, 12902, 9368, 7057, 5901, 5254, 5485, 5598,
- 6076, 7608, 10742, 15186, 20480, 20480},
- {20480, 20480, 20480, 20480, 13988, 9368, 6702, 4841, 4585, 4682, 5859,
- 7764, 12109, 20480, 20480, 20480, 20480},
- {20480, 20480, 20480, 20480, 18432, 13396, 8982, 4767, 3779, 3658, 6335,
- 9656, 13988, 20480, 20480, 20480, 20480},
- {20480, 20480, 20480, 20480, 20480, 14731, 9437, 4275, 3249, 3493, 8483,
- 13988, 17234, 20480, 20480, 20480, 20480},
- {20480, 20480, 20480, 20480, 20480, 20480, 12902, 4753, 3040, 2953, 9105,
- 15725, 20480, 20480, 20480, 20480, 20480},
- {20480, 20480, 20480, 20480, 20480, 20480, 12902, 3821, 3346, 3000, 12109,
- 20480, 20480, 20480, 20480, 20480, 20480},
- {20480, 20480, 20480, 20480, 20480, 20480, 15725, 3658, 20480, 1201, 10854,
- 18432, 20480, 20480, 20480, 20480, 20480}};
-short ac_tns_coef_freq[8][17] = {
- {1, 5, 15, 31, 54, 86, 97, 120, 159, 152, 111, 104, 59, 22, 6, 1, 1},
- {1, 1, 1, 1, 13, 43, 94, 139, 173, 160, 154, 131, 78, 27, 6, 1, 1},
- {1, 1, 1, 1, 9, 43, 106, 199, 217, 210, 141, 74, 17, 1, 1, 1, 1},
- {1, 1, 1, 1, 2, 11, 49, 204, 285, 297, 120, 39, 9, 1, 1, 1, 1},
- {1, 1, 1, 1, 1, 7, 42, 241, 341, 314, 58, 9, 3, 1, 1, 1, 1},
- {1, 1, 1, 1, 1, 1, 13, 205, 366, 377, 47, 5, 1, 1, 1, 1, 1},
- {1, 1, 1, 1, 1, 1, 13, 281, 330, 371, 17, 1, 1, 1, 1, 1, 1},
- {1, 1, 1, 1, 1, 1, 5, 297, 1, 682, 26, 2, 1, 1, 1, 1, 1}};
-short ac_tns_coef_cumfreq[8][17] = {{0, 1, 6, 21, 52, 106, 192, 289, 409, 568,
- 720, 831, 935, 994, 1016, 1022, 1023},
- {0, 1, 2, 3, 4, 17, 60, 154, 293, 466, 626,
- 780, 911, 989, 1016, 1022, 1023},
- {0, 1, 2, 3, 4, 13, 56, 162, 361, 578, 788,
- 929, 1003, 1020, 1021, 1022, 1023},
- {0, 1, 2, 3, 4, 6, 17, 66, 270, 555, 852,
- 972, 1011, 1020, 1021, 1022, 1023},
- {0, 1, 2, 3, 4, 5, 12, 54, 295, 636, 950,
- 1008, 1017, 1020, 1021, 1022, 1023},
- {0, 1, 2, 3, 4, 5, 6, 19, 224, 590, 967,
- 1014, 1019, 1020, 1021, 1022, 1023},
- {0, 1, 2, 3, 4, 5, 6, 19, 300, 630, 1001,
- 1018, 1019, 1020, 1021, 1022, 1023},
- {0, 1, 2, 3, 4, 5, 6, 11, 308, 309, 991,
- 1017, 1019, 1020, 1021, 1022, 1023}};
diff --git a/system/embdrv/lc3_dec/Common/Tables/TemporalNoiseShapingTables.hpp b/system/embdrv/lc3_dec/Common/Tables/TemporalNoiseShapingTables.hpp
deleted file mode 100644
index ca298b6..0000000
--- a/system/embdrv/lc3_dec/Common/Tables/TemporalNoiseShapingTables.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * TemporalNoiseShapingTables.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-// LC3 Specification d09r01.pdf
-// Section 5.7.4 Temporal Noise Shaping
-
-#ifndef TEMPORAL_NOISE_SHAPING_TABLES_H_
-#define TEMPORAL_NOISE_SHAPING_TABLES_H_
-
-// LC3 Specification d09r01.pdf; Page 109 of 177
-extern short ac_tns_order_bits[2][8];
-extern short ac_tns_order_freq[2][8];
-extern short ac_tns_order_cumfreq[2][8];
-
-extern short ac_tns_coef_bits[8][17];
-extern short ac_tns_coef_freq[8][17];
-extern short ac_tns_coef_cumfreq[8][17];
-
-#endif // TEMPORAL_NOISE_SHAPING_TABLES_H_
diff --git a/system/embdrv/lc3_dec/Common/fft/fft.c b/system/embdrv/lc3_dec/Common/fft/fft.c
deleted file mode 100644
index d684302..0000000
--- a/system/embdrv/lc3_dec/Common/fft/fft.c
+++ /dev/null
@@ -1,677 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2016 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.
- *
- ******************************************************************************/
-
-#include "fft.h"
-
-/* ----------------------------------------------------------------------------
- * FFT processing
- * -------------------------------------------------------------------------- */
-
-/**
- * Tables
- *
- * T_N[0..N-1] =
- * { cos(-2Pi i/N) + j sin(-2Pi i/N),
- * cos(-2Pi 2i/N) + j sin(-2Pi 2i/N) } , N=15, 45, 90
- *
- * T_N[0..N/2-1] =
- * cos(-2Pi i/N) + j sin(-2Pi i/N) , N=10, 20, ...
- */
-
-struct fft_bf2_twiddles {
- int n2;
- const struct fft_complex* t;
-};
-struct fft_bf3_twiddles {
- int n3;
- const struct fft_complex (*t)[2];
-};
-
-static const struct fft_bf2_twiddles twiddles_10 = {
- .n2 = 10 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00},
- {8.0901699e-01, -5.8778525e-01},
- {3.0901699e-01, -9.5105652e-01},
- {-3.0901699e-01, -9.5105652e-01},
- {-8.0901699e-01, -5.8778525e-01},
- }};
-
-static const struct fft_bf2_twiddles twiddles_20 = {
- .n2 = 20 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00},
- {9.5105652e-01, -3.0901699e-01},
- {8.0901699e-01, -5.8778525e-01},
- {5.8778525e-01, -8.0901699e-01},
- {3.0901699e-01, -9.5105652e-01},
- {6.1232340e-17, -1.0000000e+00},
- {-3.0901699e-01, -9.5105652e-01},
- {-5.8778525e-01, -8.0901699e-01},
- {-8.0901699e-01, -5.8778525e-01},
- {-9.5105652e-01, -3.0901699e-01},
- }};
-
-static const struct fft_bf2_twiddles twiddles_30 = {
- .n2 = 30 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00},
- {9.7814760e-01, -2.0791169e-01},
- {9.1354546e-01, -4.0673664e-01},
- {8.0901699e-01, -5.8778525e-01},
- {6.6913061e-01, -7.4314483e-01},
- {5.0000000e-01, -8.6602540e-01},
- {3.0901699e-01, -9.5105652e-01},
- {1.0452846e-01, -9.9452190e-01},
- {-1.0452846e-01, -9.9452190e-01},
- {-3.0901699e-01, -9.5105652e-01},
- {-5.0000000e-01, -8.6602540e-01},
- {-6.6913061e-01, -7.4314483e-01},
- {-8.0901699e-01, -5.8778525e-01},
- {-9.1354546e-01, -4.0673664e-01},
- {-9.7814760e-01, -2.0791169e-01},
- }};
-
-static const struct fft_bf2_twiddles twiddles_40 = {
- .n2 = 40 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00}, {9.8768834e-01, -1.5643447e-01},
- {9.5105652e-01, -3.0901699e-01}, {8.9100652e-01, -4.5399050e-01},
- {8.0901699e-01, -5.8778525e-01}, {7.0710678e-01, -7.0710678e-01},
- {5.8778525e-01, -8.0901699e-01}, {4.5399050e-01, -8.9100652e-01},
- {3.0901699e-01, -9.5105652e-01}, {1.5643447e-01, -9.8768834e-01},
- {6.1232340e-17, -1.0000000e+00}, {-1.5643447e-01, -9.8768834e-01},
- {-3.0901699e-01, -9.5105652e-01}, {-4.5399050e-01, -8.9100652e-01},
- {-5.8778525e-01, -8.0901699e-01}, {-7.0710678e-01, -7.0710678e-01},
- {-8.0901699e-01, -5.8778525e-01}, {-8.9100652e-01, -4.5399050e-01},
- {-9.5105652e-01, -3.0901699e-01}, {-9.8768834e-01, -1.5643447e-01},
- }};
-
-static const struct fft_bf2_twiddles twiddles_60 = {
- .n2 = 60 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00}, {9.9452190e-01, -1.0452846e-01},
- {9.7814760e-01, -2.0791169e-01}, {9.5105652e-01, -3.0901699e-01},
- {9.1354546e-01, -4.0673664e-01}, {8.6602540e-01, -5.0000000e-01},
- {8.0901699e-01, -5.8778525e-01}, {7.4314483e-01, -6.6913061e-01},
- {6.6913061e-01, -7.4314483e-01}, {5.8778525e-01, -8.0901699e-01},
- {5.0000000e-01, -8.6602540e-01}, {4.0673664e-01, -9.1354546e-01},
- {3.0901699e-01, -9.5105652e-01}, {2.0791169e-01, -9.7814760e-01},
- {1.0452846e-01, -9.9452190e-01}, {2.8327694e-16, -1.0000000e+00},
- {-1.0452846e-01, -9.9452190e-01}, {-2.0791169e-01, -9.7814760e-01},
- {-3.0901699e-01, -9.5105652e-01}, {-4.0673664e-01, -9.1354546e-01},
- {-5.0000000e-01, -8.6602540e-01}, {-5.8778525e-01, -8.0901699e-01},
- {-6.6913061e-01, -7.4314483e-01}, {-7.4314483e-01, -6.6913061e-01},
- {-8.0901699e-01, -5.8778525e-01}, {-8.6602540e-01, -5.0000000e-01},
- {-9.1354546e-01, -4.0673664e-01}, {-9.5105652e-01, -3.0901699e-01},
- {-9.7814760e-01, -2.0791169e-01}, {-9.9452190e-01, -1.0452846e-01},
- }};
-
-static const struct fft_bf2_twiddles twiddles_80 = {
- .n2 = 80 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00}, {9.9691733e-01, -7.8459096e-02},
- {9.8768834e-01, -1.5643447e-01}, {9.7236992e-01, -2.3344536e-01},
- {9.5105652e-01, -3.0901699e-01}, {9.2387953e-01, -3.8268343e-01},
- {8.9100652e-01, -4.5399050e-01}, {8.5264016e-01, -5.2249856e-01},
- {8.0901699e-01, -5.8778525e-01}, {7.6040597e-01, -6.4944805e-01},
- {7.0710678e-01, -7.0710678e-01}, {6.4944805e-01, -7.6040597e-01},
- {5.8778525e-01, -8.0901699e-01}, {5.2249856e-01, -8.5264016e-01},
- {4.5399050e-01, -8.9100652e-01}, {3.8268343e-01, -9.2387953e-01},
- {3.0901699e-01, -9.5105652e-01}, {2.3344536e-01, -9.7236992e-01},
- {1.5643447e-01, -9.8768834e-01}, {7.8459096e-02, -9.9691733e-01},
- {6.1232340e-17, -1.0000000e+00}, {-7.8459096e-02, -9.9691733e-01},
- {-1.5643447e-01, -9.8768834e-01}, {-2.3344536e-01, -9.7236992e-01},
- {-3.0901699e-01, -9.5105652e-01}, {-3.8268343e-01, -9.2387953e-01},
- {-4.5399050e-01, -8.9100652e-01}, {-5.2249856e-01, -8.5264016e-01},
- {-5.8778525e-01, -8.0901699e-01}, {-6.4944805e-01, -7.6040597e-01},
- {-7.0710678e-01, -7.0710678e-01}, {-7.6040597e-01, -6.4944805e-01},
- {-8.0901699e-01, -5.8778525e-01}, {-8.5264016e-01, -5.2249856e-01},
- {-8.9100652e-01, -4.5399050e-01}, {-9.2387953e-01, -3.8268343e-01},
- {-9.5105652e-01, -3.0901699e-01}, {-9.7236992e-01, -2.3344536e-01},
- {-9.8768834e-01, -1.5643447e-01}, {-9.9691733e-01, -7.8459096e-02},
- }};
-
-static const struct fft_bf2_twiddles twiddles_90 = {
- .n2 = 90 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00}, {9.9756405e-01, -6.9756474e-02},
- {9.9026807e-01, -1.3917310e-01}, {9.7814760e-01, -2.0791169e-01},
- {9.6126170e-01, -2.7563736e-01}, {9.3969262e-01, -3.4202014e-01},
- {9.1354546e-01, -4.0673664e-01}, {8.8294759e-01, -4.6947156e-01},
- {8.4804810e-01, -5.2991926e-01}, {8.0901699e-01, -5.8778525e-01},
- {7.6604444e-01, -6.4278761e-01}, {7.1933980e-01, -6.9465837e-01},
- {6.6913061e-01, -7.4314483e-01}, {6.1566148e-01, -7.8801075e-01},
- {5.5919290e-01, -8.2903757e-01}, {5.0000000e-01, -8.6602540e-01},
- {4.3837115e-01, -8.9879405e-01}, {3.7460659e-01, -9.2718385e-01},
- {3.0901699e-01, -9.5105652e-01}, {2.4192190e-01, -9.7029573e-01},
- {1.7364818e-01, -9.8480775e-01}, {1.0452846e-01, -9.9452190e-01},
- {3.4899497e-02, -9.9939083e-01}, {-3.4899497e-02, -9.9939083e-01},
- {-1.0452846e-01, -9.9452190e-01}, {-1.7364818e-01, -9.8480775e-01},
- {-2.4192190e-01, -9.7029573e-01}, {-3.0901699e-01, -9.5105652e-01},
- {-3.7460659e-01, -9.2718385e-01}, {-4.3837115e-01, -8.9879405e-01},
- {-5.0000000e-01, -8.6602540e-01}, {-5.5919290e-01, -8.2903757e-01},
- {-6.1566148e-01, -7.8801075e-01}, {-6.6913061e-01, -7.4314483e-01},
- {-7.1933980e-01, -6.9465837e-01}, {-7.6604444e-01, -6.4278761e-01},
- {-8.0901699e-01, -5.8778525e-01}, {-8.4804810e-01, -5.2991926e-01},
- {-8.8294759e-01, -4.6947156e-01}, {-9.1354546e-01, -4.0673664e-01},
- {-9.3969262e-01, -3.4202014e-01}, {-9.6126170e-01, -2.7563736e-01},
- {-9.7814760e-01, -2.0791169e-01}, {-9.9026807e-01, -1.3917310e-01},
- {-9.9756405e-01, -6.9756474e-02},
- }};
-
-static const struct fft_bf2_twiddles twiddles_120 = {
- .n2 = 120 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00}, {9.9862953e-01, -5.2335956e-02},
- {9.9452190e-01, -1.0452846e-01}, {9.8768834e-01, -1.5643447e-01},
- {9.7814760e-01, -2.0791169e-01}, {9.6592583e-01, -2.5881905e-01},
- {9.5105652e-01, -3.0901699e-01}, {9.3358043e-01, -3.5836795e-01},
- {9.1354546e-01, -4.0673664e-01}, {8.9100652e-01, -4.5399050e-01},
- {8.6602540e-01, -5.0000000e-01}, {8.3867057e-01, -5.4463904e-01},
- {8.0901699e-01, -5.8778525e-01}, {7.7714596e-01, -6.2932039e-01},
- {7.4314483e-01, -6.6913061e-01}, {7.0710678e-01, -7.0710678e-01},
- {6.6913061e-01, -7.4314483e-01}, {6.2932039e-01, -7.7714596e-01},
- {5.8778525e-01, -8.0901699e-01}, {5.4463904e-01, -8.3867057e-01},
- {5.0000000e-01, -8.6602540e-01}, {4.5399050e-01, -8.9100652e-01},
- {4.0673664e-01, -9.1354546e-01}, {3.5836795e-01, -9.3358043e-01},
- {3.0901699e-01, -9.5105652e-01}, {2.5881905e-01, -9.6592583e-01},
- {2.0791169e-01, -9.7814760e-01}, {1.5643447e-01, -9.8768834e-01},
- {1.0452846e-01, -9.9452190e-01}, {5.2335956e-02, -9.9862953e-01},
- {2.8327694e-16, -1.0000000e+00}, {-5.2335956e-02, -9.9862953e-01},
- {-1.0452846e-01, -9.9452190e-01}, {-1.5643447e-01, -9.8768834e-01},
- {-2.0791169e-01, -9.7814760e-01}, {-2.5881905e-01, -9.6592583e-01},
- {-3.0901699e-01, -9.5105652e-01}, {-3.5836795e-01, -9.3358043e-01},
- {-4.0673664e-01, -9.1354546e-01}, {-4.5399050e-01, -8.9100652e-01},
- {-5.0000000e-01, -8.6602540e-01}, {-5.4463904e-01, -8.3867057e-01},
- {-5.8778525e-01, -8.0901699e-01}, {-6.2932039e-01, -7.7714596e-01},
- {-6.6913061e-01, -7.4314483e-01}, {-7.0710678e-01, -7.0710678e-01},
- {-7.4314483e-01, -6.6913061e-01}, {-7.7714596e-01, -6.2932039e-01},
- {-8.0901699e-01, -5.8778525e-01}, {-8.3867057e-01, -5.4463904e-01},
- {-8.6602540e-01, -5.0000000e-01}, {-8.9100652e-01, -4.5399050e-01},
- {-9.1354546e-01, -4.0673664e-01}, {-9.3358043e-01, -3.5836795e-01},
- {-9.5105652e-01, -3.0901699e-01}, {-9.6592583e-01, -2.5881905e-01},
- {-9.7814760e-01, -2.0791169e-01}, {-9.8768834e-01, -1.5643447e-01},
- {-9.9452190e-01, -1.0452846e-01}, {-9.9862953e-01, -5.2335956e-02},
- }};
-
-static const struct fft_bf2_twiddles twiddles_160 = {
- .n2 = 160 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00}, {9.9922904e-01, -3.9259816e-02},
- {9.9691733e-01, -7.8459096e-02}, {9.9306846e-01, -1.1753740e-01},
- {9.8768834e-01, -1.5643447e-01}, {9.8078528e-01, -1.9509032e-01},
- {9.7236992e-01, -2.3344536e-01}, {9.6245524e-01, -2.7144045e-01},
- {9.5105652e-01, -3.0901699e-01}, {9.3819134e-01, -3.4611706e-01},
- {9.2387953e-01, -3.8268343e-01}, {9.0814317e-01, -4.1865974e-01},
- {8.9100652e-01, -4.5399050e-01}, {8.7249601e-01, -4.8862124e-01},
- {8.5264016e-01, -5.2249856e-01}, {8.3146961e-01, -5.5557023e-01},
- {8.0901699e-01, -5.8778525e-01}, {7.8531693e-01, -6.1909395e-01},
- {7.6040597e-01, -6.4944805e-01}, {7.3432251e-01, -6.7880075e-01},
- {7.0710678e-01, -7.0710678e-01}, {6.7880075e-01, -7.3432251e-01},
- {6.4944805e-01, -7.6040597e-01}, {6.1909395e-01, -7.8531693e-01},
- {5.8778525e-01, -8.0901699e-01}, {5.5557023e-01, -8.3146961e-01},
- {5.2249856e-01, -8.5264016e-01}, {4.8862124e-01, -8.7249601e-01},
- {4.5399050e-01, -8.9100652e-01}, {4.1865974e-01, -9.0814317e-01},
- {3.8268343e-01, -9.2387953e-01}, {3.4611706e-01, -9.3819134e-01},
- {3.0901699e-01, -9.5105652e-01}, {2.7144045e-01, -9.6245524e-01},
- {2.3344536e-01, -9.7236992e-01}, {1.9509032e-01, -9.8078528e-01},
- {1.5643447e-01, -9.8768834e-01}, {1.1753740e-01, -9.9306846e-01},
- {7.8459096e-02, -9.9691733e-01}, {3.9259816e-02, -9.9922904e-01},
- {6.1232340e-17, -1.0000000e+00}, {-3.9259816e-02, -9.9922904e-01},
- {-7.8459096e-02, -9.9691733e-01}, {-1.1753740e-01, -9.9306846e-01},
- {-1.5643447e-01, -9.8768834e-01}, {-1.9509032e-01, -9.8078528e-01},
- {-2.3344536e-01, -9.7236992e-01}, {-2.7144045e-01, -9.6245524e-01},
- {-3.0901699e-01, -9.5105652e-01}, {-3.4611706e-01, -9.3819134e-01},
- {-3.8268343e-01, -9.2387953e-01}, {-4.1865974e-01, -9.0814317e-01},
- {-4.5399050e-01, -8.9100652e-01}, {-4.8862124e-01, -8.7249601e-01},
- {-5.2249856e-01, -8.5264016e-01}, {-5.5557023e-01, -8.3146961e-01},
- {-5.8778525e-01, -8.0901699e-01}, {-6.1909395e-01, -7.8531693e-01},
- {-6.4944805e-01, -7.6040597e-01}, {-6.7880075e-01, -7.3432251e-01},
- {-7.0710678e-01, -7.0710678e-01}, {-7.3432251e-01, -6.7880075e-01},
- {-7.6040597e-01, -6.4944805e-01}, {-7.8531693e-01, -6.1909395e-01},
- {-8.0901699e-01, -5.8778525e-01}, {-8.3146961e-01, -5.5557023e-01},
- {-8.5264016e-01, -5.2249856e-01}, {-8.7249601e-01, -4.8862124e-01},
- {-8.9100652e-01, -4.5399050e-01}, {-9.0814317e-01, -4.1865974e-01},
- {-9.2387953e-01, -3.8268343e-01}, {-9.3819134e-01, -3.4611706e-01},
- {-9.5105652e-01, -3.0901699e-01}, {-9.6245524e-01, -2.7144045e-01},
- {-9.7236992e-01, -2.3344536e-01}, {-9.8078528e-01, -1.9509032e-01},
- {-9.8768834e-01, -1.5643447e-01}, {-9.9306846e-01, -1.1753740e-01},
- {-9.9691733e-01, -7.8459096e-02}, {-9.9922904e-01, -3.9259816e-02},
- }};
-
-static const struct fft_bf2_twiddles twiddles_180 = {
- .n2 = 180 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00}, {9.9939083e-01, -3.4899497e-02},
- {9.9756405e-01, -6.9756474e-02}, {9.9452190e-01, -1.0452846e-01},
- {9.9026807e-01, -1.3917310e-01}, {9.8480775e-01, -1.7364818e-01},
- {9.7814760e-01, -2.0791169e-01}, {9.7029573e-01, -2.4192190e-01},
- {9.6126170e-01, -2.7563736e-01}, {9.5105652e-01, -3.0901699e-01},
- {9.3969262e-01, -3.4202014e-01}, {9.2718385e-01, -3.7460659e-01},
- {9.1354546e-01, -4.0673664e-01}, {8.9879405e-01, -4.3837115e-01},
- {8.8294759e-01, -4.6947156e-01}, {8.6602540e-01, -5.0000000e-01},
- {8.4804810e-01, -5.2991926e-01}, {8.2903757e-01, -5.5919290e-01},
- {8.0901699e-01, -5.8778525e-01}, {7.8801075e-01, -6.1566148e-01},
- {7.6604444e-01, -6.4278761e-01}, {7.4314483e-01, -6.6913061e-01},
- {7.1933980e-01, -6.9465837e-01}, {6.9465837e-01, -7.1933980e-01},
- {6.6913061e-01, -7.4314483e-01}, {6.4278761e-01, -7.6604444e-01},
- {6.1566148e-01, -7.8801075e-01}, {5.8778525e-01, -8.0901699e-01},
- {5.5919290e-01, -8.2903757e-01}, {5.2991926e-01, -8.4804810e-01},
- {5.0000000e-01, -8.6602540e-01}, {4.6947156e-01, -8.8294759e-01},
- {4.3837115e-01, -8.9879405e-01}, {4.0673664e-01, -9.1354546e-01},
- {3.7460659e-01, -9.2718385e-01}, {3.4202014e-01, -9.3969262e-01},
- {3.0901699e-01, -9.5105652e-01}, {2.7563736e-01, -9.6126170e-01},
- {2.4192190e-01, -9.7029573e-01}, {2.0791169e-01, -9.7814760e-01},
- {1.7364818e-01, -9.8480775e-01}, {1.3917310e-01, -9.9026807e-01},
- {1.0452846e-01, -9.9452190e-01}, {6.9756474e-02, -9.9756405e-01},
- {3.4899497e-02, -9.9939083e-01}, {6.1232340e-17, -1.0000000e+00},
- {-3.4899497e-02, -9.9939083e-01}, {-6.9756474e-02, -9.9756405e-01},
- {-1.0452846e-01, -9.9452190e-01}, {-1.3917310e-01, -9.9026807e-01},
- {-1.7364818e-01, -9.8480775e-01}, {-2.0791169e-01, -9.7814760e-01},
- {-2.4192190e-01, -9.7029573e-01}, {-2.7563736e-01, -9.6126170e-01},
- {-3.0901699e-01, -9.5105652e-01}, {-3.4202014e-01, -9.3969262e-01},
- {-3.7460659e-01, -9.2718385e-01}, {-4.0673664e-01, -9.1354546e-01},
- {-4.3837115e-01, -8.9879405e-01}, {-4.6947156e-01, -8.8294759e-01},
- {-5.0000000e-01, -8.6602540e-01}, {-5.2991926e-01, -8.4804810e-01},
- {-5.5919290e-01, -8.2903757e-01}, {-5.8778525e-01, -8.0901699e-01},
- {-6.1566148e-01, -7.8801075e-01}, {-6.4278761e-01, -7.6604444e-01},
- {-6.6913061e-01, -7.4314483e-01}, {-6.9465837e-01, -7.1933980e-01},
- {-7.1933980e-01, -6.9465837e-01}, {-7.4314483e-01, -6.6913061e-01},
- {-7.6604444e-01, -6.4278761e-01}, {-7.8801075e-01, -6.1566148e-01},
- {-8.0901699e-01, -5.8778525e-01}, {-8.2903757e-01, -5.5919290e-01},
- {-8.4804810e-01, -5.2991926e-01}, {-8.6602540e-01, -5.0000000e-01},
- {-8.8294759e-01, -4.6947156e-01}, {-8.9879405e-01, -4.3837115e-01},
- {-9.1354546e-01, -4.0673664e-01}, {-9.2718385e-01, -3.7460659e-01},
- {-9.3969262e-01, -3.4202014e-01}, {-9.5105652e-01, -3.0901699e-01},
- {-9.6126170e-01, -2.7563736e-01}, {-9.7029573e-01, -2.4192190e-01},
- {-9.7814760e-01, -2.0791169e-01}, {-9.8480775e-01, -1.7364818e-01},
- {-9.9026807e-01, -1.3917310e-01}, {-9.9452190e-01, -1.0452846e-01},
- {-9.9756405e-01, -6.9756474e-02}, {-9.9939083e-01, -3.4899497e-02},
- }};
-
-static const struct fft_bf2_twiddles twiddles_240 = {
- .n2 = 240 / 2,
- .t = (const struct fft_complex[]){
- {1.0000000e+00, -0.0000000e+00}, {9.9965732e-01, -2.6176948e-02},
- {9.9862953e-01, -5.2335956e-02}, {9.9691733e-01, -7.8459096e-02},
- {9.9452190e-01, -1.0452846e-01}, {9.9144486e-01, -1.3052619e-01},
- {9.8768834e-01, -1.5643447e-01}, {9.8325491e-01, -1.8223553e-01},
- {9.7814760e-01, -2.0791169e-01}, {9.7236992e-01, -2.3344536e-01},
- {9.6592583e-01, -2.5881905e-01}, {9.5881973e-01, -2.8401534e-01},
- {9.5105652e-01, -3.0901699e-01}, {9.4264149e-01, -3.3380686e-01},
- {9.3358043e-01, -3.5836795e-01}, {9.2387953e-01, -3.8268343e-01},
- {9.1354546e-01, -4.0673664e-01}, {9.0258528e-01, -4.3051110e-01},
- {8.9100652e-01, -4.5399050e-01}, {8.7881711e-01, -4.7715876e-01},
- {8.6602540e-01, -5.0000000e-01}, {8.5264016e-01, -5.2249856e-01},
- {8.3867057e-01, -5.4463904e-01}, {8.2412619e-01, -5.6640624e-01},
- {8.0901699e-01, -5.8778525e-01}, {7.9335334e-01, -6.0876143e-01},
- {7.7714596e-01, -6.2932039e-01}, {7.6040597e-01, -6.4944805e-01},
- {7.4314483e-01, -6.6913061e-01}, {7.2537437e-01, -6.8835458e-01},
- {7.0710678e-01, -7.0710678e-01}, {6.8835458e-01, -7.2537437e-01},
- {6.6913061e-01, -7.4314483e-01}, {6.4944805e-01, -7.6040597e-01},
- {6.2932039e-01, -7.7714596e-01}, {6.0876143e-01, -7.9335334e-01},
- {5.8778525e-01, -8.0901699e-01}, {5.6640624e-01, -8.2412619e-01},
- {5.4463904e-01, -8.3867057e-01}, {5.2249856e-01, -8.5264016e-01},
- {5.0000000e-01, -8.6602540e-01}, {4.7715876e-01, -8.7881711e-01},
- {4.5399050e-01, -8.9100652e-01}, {4.3051110e-01, -9.0258528e-01},
- {4.0673664e-01, -9.1354546e-01}, {3.8268343e-01, -9.2387953e-01},
- {3.5836795e-01, -9.3358043e-01}, {3.3380686e-01, -9.4264149e-01},
- {3.0901699e-01, -9.5105652e-01}, {2.8401534e-01, -9.5881973e-01},
- {2.5881905e-01, -9.6592583e-01}, {2.3344536e-01, -9.7236992e-01},
- {2.0791169e-01, -9.7814760e-01}, {1.8223553e-01, -9.8325491e-01},
- {1.5643447e-01, -9.8768834e-01}, {1.3052619e-01, -9.9144486e-01},
- {1.0452846e-01, -9.9452190e-01}, {7.8459096e-02, -9.9691733e-01},
- {5.2335956e-02, -9.9862953e-01}, {2.6176948e-02, -9.9965732e-01},
- {2.8327694e-16, -1.0000000e+00}, {-2.6176948e-02, -9.9965732e-01},
- {-5.2335956e-02, -9.9862953e-01}, {-7.8459096e-02, -9.9691733e-01},
- {-1.0452846e-01, -9.9452190e-01}, {-1.3052619e-01, -9.9144486e-01},
- {-1.5643447e-01, -9.8768834e-01}, {-1.8223553e-01, -9.8325491e-01},
- {-2.0791169e-01, -9.7814760e-01}, {-2.3344536e-01, -9.7236992e-01},
- {-2.5881905e-01, -9.6592583e-01}, {-2.8401534e-01, -9.5881973e-01},
- {-3.0901699e-01, -9.5105652e-01}, {-3.3380686e-01, -9.4264149e-01},
- {-3.5836795e-01, -9.3358043e-01}, {-3.8268343e-01, -9.2387953e-01},
- {-4.0673664e-01, -9.1354546e-01}, {-4.3051110e-01, -9.0258528e-01},
- {-4.5399050e-01, -8.9100652e-01}, {-4.7715876e-01, -8.7881711e-01},
- {-5.0000000e-01, -8.6602540e-01}, {-5.2249856e-01, -8.5264016e-01},
- {-5.4463904e-01, -8.3867057e-01}, {-5.6640624e-01, -8.2412619e-01},
- {-5.8778525e-01, -8.0901699e-01}, {-6.0876143e-01, -7.9335334e-01},
- {-6.2932039e-01, -7.7714596e-01}, {-6.4944805e-01, -7.6040597e-01},
- {-6.6913061e-01, -7.4314483e-01}, {-6.8835458e-01, -7.2537437e-01},
- {-7.0710678e-01, -7.0710678e-01}, {-7.2537437e-01, -6.8835458e-01},
- {-7.4314483e-01, -6.6913061e-01}, {-7.6040597e-01, -6.4944805e-01},
- {-7.7714596e-01, -6.2932039e-01}, {-7.9335334e-01, -6.0876143e-01},
- {-8.0901699e-01, -5.8778525e-01}, {-8.2412619e-01, -5.6640624e-01},
- {-8.3867057e-01, -5.4463904e-01}, {-8.5264016e-01, -5.2249856e-01},
- {-8.6602540e-01, -5.0000000e-01}, {-8.7881711e-01, -4.7715876e-01},
- {-8.9100652e-01, -4.5399050e-01}, {-9.0258528e-01, -4.3051110e-01},
- {-9.1354546e-01, -4.0673664e-01}, {-9.2387953e-01, -3.8268343e-01},
- {-9.3358043e-01, -3.5836795e-01}, {-9.4264149e-01, -3.3380686e-01},
- {-9.5105652e-01, -3.0901699e-01}, {-9.5881973e-01, -2.8401534e-01},
- {-9.6592583e-01, -2.5881905e-01}, {-9.7236992e-01, -2.3344536e-01},
- {-9.7814760e-01, -2.0791169e-01}, {-9.8325491e-01, -1.8223553e-01},
- {-9.8768834e-01, -1.5643447e-01}, {-9.9144486e-01, -1.3052619e-01},
- {-9.9452190e-01, -1.0452846e-01}, {-9.9691733e-01, -7.8459096e-02},
- {-9.9862953e-01, -5.2335956e-02}, {-9.9965732e-01, -2.6176948e-02},
- }};
-
-static const struct fft_bf3_twiddles twiddles_15 = {
- .n3 = 15 / 3,
- .t = (const struct fft_complex[][2]){
- {{1.0000000e+0, -0.0000000e+0}, {1.0000000e+0, -0.0000000e+0}},
- {{9.1354546e-1, -4.0673664e-1}, {6.6913061e-1, -7.4314483e-1}},
- {{6.6913061e-1, -7.4314483e-1}, {-1.0452846e-1, -9.9452190e-1}},
- {{3.0901699e-1, -9.5105652e-1}, {-8.0901699e-1, -5.8778525e-1}},
- {{-1.0452846e-1, -9.9452190e-1}, {-9.7814760e-1, 2.0791169e-1}},
- {{-5.0000000e-1, -8.6602540e-1}, {-5.0000000e-1, 8.6602540e-1}},
- {{-8.0901699e-1, -5.8778525e-1}, {3.0901699e-1, 9.5105652e-1}},
- {{-9.7814760e-1, -2.0791169e-1}, {9.1354546e-1, 4.0673664e-1}},
- {{-9.7814760e-1, 2.0791169e-1}, {9.1354546e-1, -4.0673664e-1}},
- {{-8.0901699e-1, 5.8778525e-1}, {3.0901699e-1, -9.5105652e-1}},
- {{-5.0000000e-1, 8.6602540e-1}, {-5.0000000e-1, -8.6602540e-1}},
- {{-1.0452846e-1, 9.9452190e-1}, {-9.7814760e-1, -2.0791169e-1}},
- {{3.0901699e-1, 9.5105652e-1}, {-8.0901699e-1, 5.8778525e-1}},
- {{6.6913061e-1, 7.4314483e-1}, {-1.0452846e-1, 9.9452190e-1}},
- {{9.1354546e-1, 4.0673664e-1}, {6.6913061e-1, 7.4314483e-1}},
- }};
-
-static const struct fft_bf3_twiddles twiddles_45 = {
- .n3 = 45 / 3,
- .t = (const struct fft_complex[][2]){
- {{1.0000000e+0, -0.0000000e+0}, {1.0000000e+0, -0.0000000e+0}},
- {{9.9026807e-1, -1.3917310e-1}, {9.6126170e-1, -2.7563736e-1}},
- {{9.6126170e-1, -2.7563736e-1}, {8.4804810e-1, -5.2991926e-1}},
- {{9.1354546e-1, -4.0673664e-1}, {6.6913061e-1, -7.4314483e-1}},
- {{8.4804810e-1, -5.2991926e-1}, {4.3837115e-1, -8.9879405e-1}},
- {{7.6604444e-1, -6.4278761e-1}, {1.7364818e-1, -9.8480775e-1}},
- {{6.6913061e-1, -7.4314483e-1}, {-1.0452846e-1, -9.9452190e-1}},
- {{5.5919290e-1, -8.2903757e-1}, {-3.7460659e-1, -9.2718385e-1}},
- {{4.3837115e-1, -8.9879405e-1}, {-6.1566148e-1, -7.8801075e-1}},
- {{3.0901699e-1, -9.5105652e-1}, {-8.0901699e-1, -5.8778525e-1}},
- {{1.7364818e-1, -9.8480775e-1}, {-9.3969262e-1, -3.4202014e-1}},
- {{3.4899497e-2, -9.9939083e-1}, {-9.9756405e-1, -6.9756474e-2}},
- {{-1.0452846e-1, -9.9452190e-1}, {-9.7814760e-1, 2.0791169e-1}},
- {{-2.4192190e-1, -9.7029573e-1}, {-8.8294759e-1, 4.6947156e-1}},
- {{-3.7460659e-1, -9.2718385e-1}, {-7.1933980e-1, 6.9465837e-1}},
- {{-5.0000000e-1, -8.6602540e-1}, {-5.0000000e-1, 8.6602540e-1}},
- {{-6.1566148e-1, -7.8801075e-1}, {-2.4192190e-1, 9.7029573e-1}},
- {{-7.1933980e-1, -6.9465837e-1}, {3.4899497e-2, 9.9939083e-1}},
- {{-8.0901699e-1, -5.8778525e-1}, {3.0901699e-1, 9.5105652e-1}},
- {{-8.8294759e-1, -4.6947156e-1}, {5.5919290e-1, 8.2903757e-1}},
- {{-9.3969262e-1, -3.4202014e-1}, {7.6604444e-1, 6.4278761e-1}},
- {{-9.7814760e-1, -2.0791169e-1}, {9.1354546e-1, 4.0673664e-1}},
- {{-9.9756405e-1, -6.9756474e-2}, {9.9026807e-1, 1.3917310e-1}},
- {{-9.9756405e-1, 6.9756474e-2}, {9.9026807e-1, -1.3917310e-1}},
- {{-9.7814760e-1, 2.0791169e-1}, {9.1354546e-1, -4.0673664e-1}},
- {{-9.3969262e-1, 3.4202014e-1}, {7.6604444e-1, -6.4278761e-1}},
- {{-8.8294759e-1, 4.6947156e-1}, {5.5919290e-1, -8.2903757e-1}},
- {{-8.0901699e-1, 5.8778525e-1}, {3.0901699e-1, -9.5105652e-1}},
- {{-7.1933980e-1, 6.9465837e-1}, {3.4899497e-2, -9.9939083e-1}},
- {{-6.1566148e-1, 7.8801075e-1}, {-2.4192190e-1, -9.7029573e-1}},
- {{-5.0000000e-1, 8.6602540e-1}, {-5.0000000e-1, -8.6602540e-1}},
- {{-3.7460659e-1, 9.2718385e-1}, {-7.1933980e-1, -6.9465837e-1}},
- {{-2.4192190e-1, 9.7029573e-1}, {-8.8294759e-1, -4.6947156e-1}},
- {{-1.0452846e-1, 9.9452190e-1}, {-9.7814760e-1, -2.0791169e-1}},
- {{3.4899497e-2, 9.9939083e-1}, {-9.9756405e-1, 6.9756474e-2}},
- {{1.7364818e-1, 9.8480775e-1}, {-9.3969262e-1, 3.4202014e-1}},
- {{3.0901699e-1, 9.5105652e-1}, {-8.0901699e-1, 5.8778525e-1}},
- {{4.3837115e-1, 8.9879405e-1}, {-6.1566148e-1, 7.8801075e-1}},
- {{5.5919290e-1, 8.2903757e-1}, {-3.7460659e-1, 9.2718385e-1}},
- {{6.6913061e-1, 7.4314483e-1}, {-1.0452846e-1, 9.9452190e-1}},
- {{7.6604444e-1, 6.4278761e-1}, {1.7364818e-1, 9.8480775e-1}},
- {{8.4804810e-1, 5.2991926e-1}, {4.3837115e-1, 8.9879405e-1}},
- {{9.1354546e-1, 4.0673664e-1}, {6.6913061e-1, 7.4314483e-1}},
- {{9.6126170e-1, 2.7563736e-1}, {8.4804810e-1, 5.2991926e-1}},
- {{9.9026807e-1, 1.3917310e-1}, {9.6126170e-1, 2.7563736e-1}},
- }};
-
-/**
- * FFT 5 Points template
- * s Sign -1: Forward 1: Inverse
- * x, y Input and output coefficients, of size 5xn
- * n Number of interleaved transform to perform
- */
-static inline void xfft_5(const float s, const struct fft_complex* x,
- struct fft_complex* y, int n) {
- static const float cos1 = 0.3090169944; /* cos(-2Pi 1/5) */
- static const float cos2 = -0.8090169944; /* cos(-2Pi 2/5) */
-
- static const float sin1 = -0.9510565163; /* sin(-2Pi 1/5) */
- static const float sin2 = -0.5877852523; /* sin(-2Pi 2/5) */
-
- for (int i = 0; i < n; i++, x++, y += 5) {
- struct fft_complex s14 = {x[1 * n].re + x[4 * n].re,
- x[1 * n].im + x[4 * n].im};
- struct fft_complex d14 = {x[1 * n].re - x[4 * n].re,
- x[1 * n].im - x[4 * n].im};
-
- struct fft_complex s23 = {x[2 * n].re + x[3 * n].re,
- x[2 * n].im + x[3 * n].im};
- struct fft_complex d23 = {x[2 * n].re - x[3 * n].re,
- x[2 * n].im - x[3 * n].im};
-
- y[0].re = x[0].re + s14.re + s23.re;
- y[0].im = x[0].im + s14.im + s23.im;
-
- y[1].re = x[0].re + s14.re * cos1 + s * d14.im * sin1 + s23.re * cos2 +
- s * d23.im * sin2;
-
- y[1].im = x[0].im + s14.im * cos1 - s * d14.re * sin1 + s23.im * cos2 -
- s * d23.re * sin2;
-
- y[2].re = x[0].re + s14.re * cos2 + s * d14.im * sin2 + s23.re * cos1 -
- s * d23.im * sin1;
-
- y[2].im = x[0].im + s14.im * cos2 - s * d14.re * sin2 + s23.im * cos1 +
- s * d23.re * sin1;
-
- y[3].re = x[0].re + s14.re * cos2 - s * d14.im * sin2 + s23.re * cos1 +
- s * d23.im * sin1;
-
- y[3].im = x[0].im + s14.im * cos2 + s * d14.re * sin2 + s23.im * cos1 -
- s * d23.re * sin1;
-
- y[4].re = x[0].re + s14.re * cos1 - s * d14.im * sin1 + s23.re * cos2 -
- s * d23.im * sin2;
-
- y[4].im = x[0].im + s14.im * cos1 + s * d14.re * sin1 + s23.im * cos2 +
- s * d23.re * sin2;
- }
-}
-
-/**
- * FFT Butterfly 3 Points template
- * s Sign -1: Forward 1: Inverse
- * x, y Input and output coefficients
- * twiddles Twiddles factors, determine size of transform
- * n Number of interleaved transforms
- */
-static inline void xfft_bf3(const float s,
- const struct fft_bf3_twiddles* twiddles,
- const struct fft_complex* x, struct fft_complex* y,
- int n) {
- int n3 = twiddles->n3;
- const struct fft_complex(*w0)[2] = twiddles->t;
- const struct fft_complex(*w1)[2] = w0 + n3, (*w2)[2] = w1 + n3;
-
- const struct fft_complex *x0 = x, *x1 = x0 + n * n3, *x2 = x1 + n * n3;
- struct fft_complex *y0 = y, *y1 = y0 + n3, *y2 = y1 + n3;
-
- for (int i = 0; i < n; i++, y0 += 3 * n3, y1 += 3 * n3, y2 += 3 * n3) {
- for (int j = 0; j < n3; j++, x0++, x1++, x2++) {
- y0[j].re = x0->re + x1->re * w0[j][0].re + s * x1->im * w0[j][0].im +
- x2->re * w0[j][1].re + s * x2->im * w0[j][1].im;
-
- y0[j].im = x0->im + x1->im * w0[j][0].re - s * x1->re * w0[j][0].im +
- x2->im * w0[j][1].re - s * x2->re * w0[j][1].im;
-
- y1[j].re = x0->re + x1->re * w1[j][0].re + s * x1->im * w1[j][0].im +
- x2->re * w1[j][1].re + s * x2->im * w1[j][1].im;
-
- y1[j].im = x0->im + x1->im * w1[j][0].re - s * x1->re * w1[j][0].im +
- x2->im * w1[j][1].re - s * x2->re * w1[j][1].im;
-
- y2[j].re = x0->re + x1->re * w2[j][0].re + s * x1->im * w2[j][0].im +
- x2->re * w2[j][1].re + s * x2->im * w2[j][1].im;
-
- y2[j].im = x0->im + x1->im * w2[j][0].re - s * x1->re * w2[j][0].im +
- x2->im * w2[j][1].re - s * x2->re * w2[j][1].im;
- }
- }
-}
-
-/**
- * FFT Butterfly 2 Points template
- * s Sign -1: Forward 1: Inverse
- * twiddles Twiddles factors, determine size of transform
- * x, y Input and output coefficients
- * n Number of interleaved transforms
- */
-static inline void xfft_bf2(const float s,
- const struct fft_bf2_twiddles* twiddles,
- const struct fft_complex* x, struct fft_complex* y,
- int n) {
- int n2 = twiddles->n2;
- const struct fft_complex* w = twiddles->t;
-
- const struct fft_complex *x0 = x, *x1 = x0 + n * n2;
- struct fft_complex *y0 = y, *y1 = y0 + n2;
-
- for (int i = 0; i < n; i++, y0 += 2 * n2, y1 += 2 * n2) {
- for (int j = 0; j < n2; j++, x0++, x1++) {
- y0[j].re = x0->re + x1->re * w[j].re + s * x1->im * w[j].im;
- y0[j].im = x0->im + x1->im * w[j].re - s * x1->re * w[j].im;
-
- y1[j].re = x0->re - x1->re * w[j].re - s * x1->im * w[j].im;
- y1[j].im = x0->im - x1->im * w[j].re + s * x1->re * w[j].im;
- }
- }
-}
-
-/**
- * Forward FFT 5 Points
- * x, y Input and output coefficients, of size 5xn
- * n Number of interleaved transform to perform
- */
-static void ffft_5(const struct fft_complex* x, struct fft_complex* y, int n) {
- xfft_5(-1, x, y, n);
-}
-
-/**
- * Inverse FFT 5 Points
- * x, y Input and output coefficients, of size 5xn
- * n Number of interleaved transform to perform
- */
-static void ifft_5(const struct fft_complex* x, struct fft_complex* y, int n) {
- xfft_5(1, x, y, n);
-}
-
-/**
- * Forward FFT Butterfly 3 Points
- * twiddles Twiddles factors, determine size of transform
- * x, y Input and output coefficients
- * n Number of interleaved transforms
- */
-static void ffft_bf3(const struct fft_bf3_twiddles* twiddles,
- const struct fft_complex* x, struct fft_complex* y,
- int n) {
- xfft_bf3(-1, twiddles, x, y, n);
-}
-
-/**
- * Inverse FFT Butterfly 3 Points
- * twiddles Twiddles factors, determine size of transform
- * x, y Input and output coefficients
- * n Number of interleaved transforms
- */
-static void ifft_bf3(const struct fft_bf3_twiddles* twiddles,
- const struct fft_complex* x, struct fft_complex* y,
- int n) {
- xfft_bf3(1, twiddles, x, y, n);
-}
-
-/**
- * Forward FFT Butterfly 2 Points
- * twiddles Twiddles factors, determine size of transform
- * x, y Input and output coefficients
- * n Number of interleaved transforms
- */
-static void ffft_bf2(const struct fft_bf2_twiddles* twiddles,
- const struct fft_complex* x, struct fft_complex* y,
- int n) {
- xfft_bf2(-1, twiddles, x, y, n);
-}
-
-/**
- * InverseIFFT Butterfly 2 Points
- * twiddles Twiddles factors, determine size of transform
- * x, y Input and output coefficients
- * n Number of interleaved transforms
- */
-static void ifft_bf2(const struct fft_bf2_twiddles* twiddles,
- const struct fft_complex* x, struct fft_complex* y,
- int n) {
- xfft_bf2(1, twiddles, x, y, n);
-}
-
-/**
- * Perform FFT
- * inverse True on inverse transform else forward
- * x, y0, y1 Input, and 2 scratch buffers of size `n`
- * n Number of points 30, 40, 60, 80, 90, 120, 160, 180, 240
- * return The buffer `y0` or `y1` that hold the result
- *
- * Input `x` can be the same as the `y0` second scratch buffer
- */
-struct fft_complex* fft(bool inverse, const struct fft_complex* x, int n,
- struct fft_complex* y0, struct fft_complex* y1) {
- static const struct fft_bf3_twiddles* twiddles_bf3[] = {&twiddles_15,
- &twiddles_45};
-
- static const struct fft_bf2_twiddles* twiddles_bf2[][3] = {
- {&twiddles_10, &twiddles_30, &twiddles_90},
- {&twiddles_20, &twiddles_60, &twiddles_180},
- {&twiddles_40, &twiddles_120},
- {&twiddles_80, &twiddles_240},
- {&twiddles_160}};
-
- struct fft_complex* y[2] = {y1, y0};
- int i2, i3, is = 0;
-
- /* The number of points `n` can be decomposed as :
- *
- * n = 5^1 * 3^n3 * 2^n2
- *
- * for n = 40, 80, 160 n3 = 0, n2 = [3..5]
- * n = 30, 60, 120, 240 n3 = 1, n2 = [1..4]
- * n = 90, 180 n3 = 2, n2 = [1..2]
- *
- * Note that the expression `n & (n-1) == 0` is equivalent
- * to the check that `n` is a power of 2. */
-
- (inverse ? ifft_5 : ffft_5)(x, y[is], n /= 5);
-
- for (i3 = 0; n & (n - 1); i3++, is ^= 1)
- (inverse ? ifft_bf3 : ffft_bf3)(twiddles_bf3[i3], y[is], y[is ^ 1], n /= 3);
-
- for (i2 = 0; n > 1; i2++, is ^= 1)
- (inverse ? ifft_bf2 : ffft_bf2)(twiddles_bf2[i2][i3], y[is], y[is ^ 1],
- n >>= 1);
-
- return y[is];
-}
diff --git a/system/embdrv/lc3_dec/Common/fft/fft.h b/system/embdrv/lc3_dec/Common/fft/fft.h
deleted file mode 100644
index efc5e11..0000000
--- a/system/embdrv/lc3_dec/Common/fft/fft.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2021 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.
- *
- ******************************************************************************/
-
-#ifndef __LC3_OWN_FFT_H
-#define __LC3_OWN_FFT_H
-
-#include <stdbool.h>
-
-/**
- * Complex floating point number
- */
-
-struct fft_complex {
- float re, im;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Perform FFT
- * inverse True on inverse transform else forward
- * x, y0, y1 Input, and 2 scratch buffers of size `n`
- * n Number of points 30, 40, 60, 80, 90, 120, 160, 180, 240
- * return The buffer `y0` or `y1` that hold the result
- *
- * Input `x` can be the same as the `y0` second scratch buffer
- */
-struct fft_complex* fft(bool inverse, const struct fft_complex* x, int n,
- struct fft_complex* y0, struct fft_complex* y1);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __LC3_OWN_FFT_H */
\ No newline at end of file
diff --git a/system/embdrv/lc3_dec/Decoder/ArithmeticDec.cpp b/system/embdrv/lc3_dec/Decoder/ArithmeticDec.cpp
deleted file mode 100644
index d8ea214..0000000
--- a/system/embdrv/lc3_dec/Decoder/ArithmeticDec.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * ArithmeticDec.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "ArithmeticDec.hpp"
-
-#include <algorithm> // std::min
-#include <cmath>
-#include <cstring>
-
-#include "BitReader.hpp"
-#include "SpectralDataTables.hpp"
-#include "TemporalNoiseShapingTables.hpp"
-
-namespace Lc3Dec {
-
-ArithmeticDec::ArithmeticDec(uint16_t NF_, uint16_t NE_, uint16_t rateFlag_,
- uint8_t tns_lpc_weighting_)
- : NF(NF_),
- NE(NE_),
- rateFlag(rateFlag_),
- tns_lpc_weighting(tns_lpc_weighting_),
- X_hat_q_ari(nullptr),
- save_lev(nullptr),
- nf_seed(0),
- nbits_residual(0) {
- X_hat_q_ari = new int16_t[NE];
- save_lev = new uint8_t[NE];
-}
-
-ArithmeticDec::~ArithmeticDec() {
- delete[] X_hat_q_ari;
- delete[] save_lev;
-}
-
-void ac_dec_init(const uint8_t bytes[], uint16_t* bp, struct ac_dec_state* st) {
- st->low = 0;
- st->range = 0x00ffffff;
- for (uint8_t i = 0; i < 3; i++) {
- st->low <<= 8;
- st->low += bytes[(*bp)++];
- }
-}
-
-uint8_t ac_decode(const uint8_t bytes[], uint16_t* bp, struct ac_dec_state* st,
- int16_t cum_freq[], int16_t sym_freq[], uint8_t numsym,
- uint8_t& BEC_detect) {
- uint32_t tmp = st->range >> 10;
- if (st->low >= (tmp << 10)) {
- BEC_detect = 1;
- return 0;
- }
- uint8_t val = numsym - 1;
- while (st->low < tmp * cum_freq[val]) {
- val--;
- }
- st->low -= tmp * cum_freq[val];
- st->range = tmp * sym_freq[val];
- while (st->range < 0x10000) {
- st->low <<= 8;
- st->low &= 0x00ffffff;
- st->low += bytes[(*bp)++];
- st->range <<= 8;
- }
- return val;
-}
-
-double ArithmeticDec::rc_q(uint8_t k, uint8_t f) {
- // with Δ =π/17
- const double pi = std::acos(-1);
- double quantizer_stepsize = pi / 17.0;
- return sin(quantizer_stepsize * (rc_i[k + 8 * f] - 8));
-}
-
-void ArithmeticDec::run(const uint8_t* bytes, uint16_t& bp, uint16_t& bp_side,
- uint8_t& mask_side, int16_t& num_tns_filters,
- int16_t rc_order[], const uint8_t& lsbMode,
- const int16_t& lastnz, uint16_t nbits,
- uint8_t& BEC_detect) {
- int16_t c = 0;
-
- // make local copy of rc_order (is this really what we want)
- rc_order_ari[0] = rc_order[0];
- rc_order_ari[1] = rc_order[1];
-
- /* Arithmetic Decoder Initialization */
- ac_dec_init(bytes, &bp, &st);
-
- /* TNS data */
- // Note: some initialization code like that below can be found in d09r02,
- // but there has been none in d09r01. However, the complete
- // initialization has been added here, in order to get a proper match to
- // the reference output data
- for (uint8_t f = 0; f < 2; f++) {
- for (uint8_t k = 0; k < 8; k++) {
- rc_i[k + 8 * f] = 8;
- }
- }
- for (uint8_t f = 0; f < num_tns_filters; f++) {
- // if (𝑟𝑐𝑜𝑟𝑑𝑒𝑟(𝑓) > 0)
- if (rc_order[f] > 0) {
- //𝑟𝑐𝑜𝑟𝑑𝑒𝑟(𝑓) = ac_decode(bytes, &bp, &st,
- rc_order_ari[f] =
- ac_decode(bytes, &bp, &st, ac_tns_order_cumfreq[tns_lpc_weighting],
- ac_tns_order_freq[tns_lpc_weighting], 8, BEC_detect);
- if (BEC_detect) {
- // early exit to avoid unpredictable side-effects
- return;
- }
-
- rc_order_ari[f] = rc_order_ari[f] + 1;
- // specification (d09r02_F2F) proposes initialization
- // of rc_i at this place; here implemented above in order
- // to be performed independet from num_tns_filters
- for (uint8_t k = 0; k < rc_order_ari[f]; k++) {
- //𝑟𝑐𝑖(𝑘,𝑓) = ac_decode(bytes, &bp, &st, ac_tns_coef_cumfreq[k],
- // rc_i[k][f] = ac_decode(bytes, &bp, &st, ac_tns_coef_cumfreq[k],
- rc_i[k + 8 * f] = ac_decode(bytes, &bp, &st, ac_tns_coef_cumfreq[k],
- ac_tns_coef_freq[k], 17, BEC_detect);
- if (BEC_detect) {
- // early exit to avoid unpredictable side-effects
- return;
- }
- }
- }
- }
-
- /* Spectral data */
- for (uint16_t k = 0; k < lastnz; k += 2) {
- uint16_t t = c + rateFlag;
- // if (k > 𝑁𝐸/2)
- if (k > NE / 2) {
- t += 256;
- }
- //𝑋𝑞̂[k] = 𝑋𝑞̂[k+1] = 0;
- X_hat_q_ari[k] = X_hat_q_ari[k + 1] = 0;
- uint8_t lev;
- uint8_t sym;
- for (lev = 0; lev < 14; lev++) {
- uint8_t pki =
- ac_spec_lookup[t + std::min(lev, static_cast<uint8_t>(3U)) * 1024];
- sym = ac_decode(bytes, &bp, &st, ac_spec_cumfreq[pki], ac_spec_freq[pki],
- 17, BEC_detect);
- if (BEC_detect) {
- // early exit to avoid unpredictable side-effects
- return;
- }
- if (sym < 16) {
- break;
- }
- if (lsbMode == 0 || lev > 0) {
- uint8_t bit = read_bit(bytes, &bp_side, &mask_side);
- //𝑋𝑞̂[k] += bit << lev;
- X_hat_q_ari[k] += bit << lev;
- bit = read_bit(bytes, &bp_side, &mask_side);
- //𝑋𝑞̂[k+1] += bit << lev;
- X_hat_q_ari[k + 1] += bit << lev;
- }
- }
- if (lev == 14) {
- BEC_detect = 1;
- return;
- }
- if (lsbMode == 1) {
- save_lev[k] = lev;
- }
- uint8_t a = sym & 0x3;
- uint8_t b = sym >> 2;
- //𝑋𝑞̂[k] += a << lev;
- //𝑋𝑞̂[k+1] += b << lev;
- // if (𝑋𝑞̂[k] > 0)
- X_hat_q_ari[k] += a << lev;
- X_hat_q_ari[k + 1] += b << lev;
- if (X_hat_q_ari[k] > 0) {
- uint8_t bit = read_bit(bytes, &bp_side, &mask_side);
- if (bit == 1) {
- //𝑋𝑞̂[k] = -𝑋𝑞̂[k];
- X_hat_q_ari[k] = -X_hat_q_ari[k];
- }
- }
- // if (𝑋𝑞̂[k+1] > 0)
- if (X_hat_q_ari[k + 1] > 0) {
- uint8_t bit = read_bit(bytes, &bp_side, &mask_side);
- if (bit == 1) {
- //𝑋𝑞̂[k+1] = -𝑋𝑞̂[k+1];
- X_hat_q_ari[k + 1] = -X_hat_q_ari[k + 1];
- }
- }
- lev = std::min(lev, static_cast<uint8_t>(3));
- if (lev <= 1) {
- t = 1 + (a + b) * (lev + 1);
- } else {
- t = 12 + lev;
- }
- c = (c & 15) * 16 + t;
- // Note: specification of the following line hase been changed from d09r01
- // to d09r02_F2F
- if (bp - bp_side > 3) {
- BEC_detect = 1;
- return;
- }
- }
- // reset remaining fields in array X_hat_q_ari to simplify testing
- for (int16_t k = lastnz; k < NE; k++) {
- X_hat_q_ari[k] = 0;
- }
-
- // 3.4.2.6 Residual data and finalization (d09r02_F2F)
- /* Number of residual bits */
- int16_t nbits_side = nbits - (8 * bp_side + 8 - log2(mask_side));
- int16_t nbits_ari = (bp - 3) * 8;
- nbits_ari += 25 - floor(log2(st.range));
- int16_t nbits_residual_tmp = nbits - (nbits_side + nbits_ari);
- if (nbits_residual_tmp < 0) {
- BEC_detect = 1;
- return;
- }
- nbits_residual = nbits_residual_tmp;
-}
-
-void ArithmeticDec::registerDatapoints(DatapointContainer* datapoints) {
- if (nullptr != datapoints) {
- datapoints->addDatapoint("rateFlag", &rateFlag, sizeof(rateFlag));
- datapoints->addDatapoint("tns_lpc_weighting", &tns_lpc_weighting,
- sizeof(tns_lpc_weighting));
- datapoints->addDatapoint("rc_order_ari", &rc_order_ari[0],
- sizeof(rc_order_ari));
- datapoints->addDatapoint("rc_i", &rc_i[0], sizeof(rc_i));
- datapoints->addDatapoint("X_hat_q_ari", &X_hat_q_ari[0],
- sizeof(int16_t) * NE);
- datapoints->addDatapoint("nbits_residual", &nbits_residual,
- sizeof(nbits_residual));
- }
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/ArithmeticDec.hpp b/system/embdrv/lc3_dec/Decoder/ArithmeticDec.hpp
deleted file mode 100644
index 3e5dd7d..0000000
--- a/system/embdrv/lc3_dec/Decoder/ArithmeticDec.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * ArithmeticDec.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef __ARITHMETIC_DEC_HPP_
-#define __ARITHMETIC_DEC_HPP_
-
-#include <cstdint>
-
-#include "Datapoints.hpp"
-
-namespace Lc3Dec {
-
-struct ac_dec_state {
- uint32_t low;
- uint32_t range;
-};
-
-class ArithmeticDec {
- public:
- ArithmeticDec(uint16_t NF_, uint16_t NE_, uint16_t rateFlag_,
- uint8_t tns_lpc_weighting_);
- virtual ~ArithmeticDec();
-
- void registerDatapoints(DatapointContainer* datapoints);
-
- double rc_q(uint8_t k, uint8_t f);
-
- void run(const uint8_t* bytes, uint16_t& bp, uint16_t& bp_side,
- uint8_t& mask_side, int16_t& num_tns_filters, int16_t rc_order[],
- const uint8_t& lsbMode, const int16_t& lastnz, uint16_t nbits,
- uint8_t& BEC_detect);
-
- const uint16_t NF;
- const uint16_t NE;
- const uint16_t rateFlag;
- const uint8_t tns_lpc_weighting;
-
- // states & outputs
- int16_t* X_hat_q_ari;
- uint8_t* save_lev;
- int16_t nf_seed;
- int16_t rc_order_ari[2];
- int16_t rc_i[2 * 8]; // [max(rc_order[f])=8][max(num_tns_filters)=2]
- uint16_t nbits_residual;
-
- private:
- struct ac_dec_state st;
-};
-
-} // namespace Lc3Dec
-
-#endif // __ARITHMETIC_DEC_HPP_
diff --git a/system/embdrv/lc3_dec/Decoder/BitReader.cpp b/system/embdrv/lc3_dec/Decoder/BitReader.cpp
deleted file mode 100644
index 161dfb0..0000000
--- a/system/embdrv/lc3_dec/Decoder/BitReader.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * BitReader.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "BitReader.hpp"
-
-namespace Lc3Dec {
-
-uint8_t read_bit(const uint8_t bytes[], uint16_t* bp, uint8_t* mask) {
- uint8_t bit;
- if (bytes[*bp] & *mask) {
- bit = 1;
- } else {
- bit = 0;
- }
- if (*mask == 0x80) {
- *mask = 1;
- *bp -= 1;
- } else {
- *mask <<= 1;
- }
- return bit;
-}
-
-uint16_t read_uint(const uint8_t bytes[], uint16_t* bp, uint8_t* mask,
- uint8_t numbits) {
- uint16_t value = read_bit(bytes, bp, mask);
- for (uint8_t i = 1; i < numbits; i++) {
- uint16_t bit = read_bit(bytes, bp, mask);
- value += bit << i;
- }
- return value;
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/BitReader.hpp b/system/embdrv/lc3_dec/Decoder/BitReader.hpp
deleted file mode 100644
index a6def66..0000000
--- a/system/embdrv/lc3_dec/Decoder/BitReader.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * BitReader.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef __BIT_READER_HPP_
-#define __BIT_READER_HPP_
-
-#include <cstdint>
-
-namespace Lc3Dec {
-
-uint8_t read_bit(const uint8_t bytes[], uint16_t* bp, uint8_t* mask);
-uint16_t read_uint(const uint8_t bytes[], uint16_t* bp, uint8_t* mask,
- uint8_t numbits);
-
-} // namespace Lc3Dec
-
-#endif // __BIT_READER_HPP_
diff --git a/system/embdrv/lc3_dec/Decoder/DecoderFrame.cpp b/system/embdrv/lc3_dec/Decoder/DecoderFrame.cpp
deleted file mode 100644
index 5ce8ff8..0000000
--- a/system/embdrv/lc3_dec/Decoder/DecoderFrame.cpp
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * DecoderFrame.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "DecoderFrame.hpp"
-
-#include <cmath>
-#include <cstring>
-
-#include "BitReader.hpp"
-
-namespace Lc3Dec {
-
-DecoderFrame::DecoderFrame(ResidualSpectrum& residualSpectrum_,
- SpectralNoiseShaping& spectralNoiseShaping_,
- PacketLossConcealment& packetLossConcealment_,
- MdctDec& mdctDec_, const Lc3Config& lc3Config_,
- uint16_t nbytes_)
- : nbytes(nbytes_),
- nbits(nbytes_ * 8),
- lc3Config(lc3Config_),
- tns_lpc_weighting(
- (nbits <
- ((lc3Config.N_ms == Lc3Config::FrameDuration::d10ms) ? 480 : 360))
- ? 1
- : 0),
- sideInformation(lc3Config.NF, lc3Config.NE, lc3Config.Fs_ind),
- arithmeticDec(lc3Config.NF, lc3Config.NE,
- (nbits > (160 + lc3Config.Fs_ind * 160)) ? 512 : 0,
- tns_lpc_weighting),
- residualSpectrum(residualSpectrum_),
- spectralNoiseShaping(spectralNoiseShaping_),
- packetLossConcealment(packetLossConcealment_),
- mdctDec(mdctDec_),
- longTermPostfilter(lc3Config, nbits),
-
- datapoints(nullptr),
-
- frameN(0),
- lastnz(0),
- P_BW(0),
- lsbMode(0),
- gg_ind(0),
- num_tns_filters(0),
- pitch_present(0),
- pitch_index(0),
- ltpf_active(0),
- F_NF(0),
- ind_LF(0),
- ind_HF(0),
- Gind(0),
- LS_indA(0),
- LS_indB(0),
- idxA(0),
- idxB(0),
- nf_seed(0),
- zeroFrame(0),
- gg_off(0),
- X_hat_q_nf(nullptr),
- X_hat_f(nullptr),
- X_s_tns(nullptr),
- X_hat_ss(nullptr),
- x_hat_clip(nullptr) {
- rc_order[0] = 0;
- rc_order[1] = 0;
-
- X_hat_q_nf = new double[lc3Config.NE];
- X_hat_f = new double[lc3Config.NE];
- X_s_tns = new double[lc3Config.NE];
- X_hat_ss = new double[lc3Config.NE];
-}
-
-DecoderFrame::~DecoderFrame() {
- if (nullptr != X_hat_q_nf) {
- delete[] X_hat_q_nf;
- }
- if (nullptr != X_hat_f) {
- delete[] X_hat_f;
- }
- if (nullptr != X_s_tns) {
- delete[] X_s_tns;
- }
- if (nullptr != X_hat_ss) {
- delete[] X_hat_ss;
- }
- if (nullptr != x_hat_clip) {
- delete[] x_hat_clip;
- }
-}
-
-void DecoderFrame::linkPreviousFrame(DecoderFrame* previousFrame) {
- if (nullptr != previousFrame) {
- longTermPostfilter = previousFrame->longTermPostfilter;
- frameN = previousFrame->frameN;
- }
-}
-
-void DecoderFrame::noiseFilling() {
- // 3.4.4 Noise filling (d09r02_F2F)
- // including extensions according to:
- // section 3.4.4. Noise filling (d09r04)
- // Noise filling is performed only when zeroFrame is 0.
- for (int16_t k = 0; k < lc3Config.NE; k++) {
- X_hat_q_nf[k] = residualSpectrum.X_hat_q_residual[k];
- }
- if (0 == zeroFrame) {
- // bandwidth(𝑃𝑏𝑤)
- // NB WB SSWB SWB FB
- //𝑏𝑤_𝑠𝑡𝑜𝑝 80 160 240 320 400
- uint16_t bw_stop_table[5] = {80, 160, 240, 320, 400};
- uint16_t bw_stop = bw_stop_table[P_BW];
- if (lc3Config.N_ms == Lc3Config::FrameDuration::d7p5ms) {
- bw_stop *= 3;
- bw_stop /= 4;
- }
-
- uint16_t NFstart =
- (lc3Config.N_ms == Lc3Config::FrameDuration::d10ms) ? 24 : 18;
- uint16_t NFwidth =
- (lc3Config.N_ms == Lc3Config::FrameDuration::d10ms) ? 3 : 2;
-
- /*
- 𝐿𝑁𝐹 ̂ = (8-𝐹𝑁𝐹)/16;
- for k=0..bw_stop-1
- if 𝐼𝑁𝐹(k)==1
- nf_seed = (13849+nf_seed*31821) & 0xFFFF;
- if nf_seed<0x8000
- 𝑋𝑞 ̂(𝑘) = 𝐿𝑁𝐹 ̂ ;
- else
- 𝑋𝑞 ̂(𝑘) = −𝐿𝑁𝐹 ̂ ;
- */
- uint16_t nf_state = nf_seed;
- double L_NF_hat = (8 - F_NF) / 16.0;
- for (uint16_t k = 0; k < bw_stop; k++) {
- /*
- The indices for the relevant spectral coefficients are given by:
- 𝐼𝑁𝐹 (𝑘) = {
- 1 if 24 ≤ 𝑘 < 𝑏𝑤_𝑠𝑡𝑜𝑝 𝑎𝑛𝑑 𝑋𝑞 ̂(𝑖) == 0 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑖 = 𝑘 − 3. . min(𝑏𝑤𝑠𝑡𝑜𝑝
- − 1, 𝑘 + 3) 0 otherwise # (109) where 𝑏𝑤_𝑠𝑡𝑜𝑝 depends on the bandwidth
- information (see Section 3.4.2.4) as defined in Table 3.17.
- */
- uint8_t I_NF_k = 0;
- if ((NFstart <= k) && (k < bw_stop)) {
- uint16_t limit =
- ((bw_stop - 1) < (k + NFwidth)) ? (bw_stop - 1) : (k + NFwidth);
- I_NF_k = 1;
- for (uint16_t i = k - NFwidth; i <= limit; i++) {
- if (0 != residualSpectrum.X_hat_q_residual[i]) {
- I_NF_k = 0;
- break;
- }
- }
- }
-
- if (1 == I_NF_k) {
- nf_state = (13849 + nf_state * 31821) & 0xFFFF;
- if (nf_state < 0x8000) {
- X_hat_q_nf[k] = L_NF_hat;
- } else {
- X_hat_q_nf[k] = -L_NF_hat;
- }
- }
- }
- }
-}
-
-void DecoderFrame::applyGlobalGain() {
- // 3.4.5 Global gain (d09r02_F2F)
- // The global gain is applied to the spectrum after noise filling has been
- // applied using the following formula (110) & (111)
- int16_t v1 = nbits / (10 * (lc3Config.Fs_ind + 1));
- if (v1 > 115) {
- gg_off = -115;
- } else {
- gg_off = -v1;
- }
- gg_off -= 105;
- gg_off -= 5 * (lc3Config.Fs_ind + 1);
-
- double exponent = (gg_ind + gg_off) / 28.0;
- double gg = pow(10.0, exponent);
- for (int16_t k = 0; k < lc3Config.NE; k++) {
- X_hat_f[k] = gg * X_hat_q_nf[k];
- }
-}
-
-void DecoderFrame::temporalNoiseShaping() {
- // 3.4.6 TNS DecoderFrame (d09r02_F2F)
- /*
- for 𝑘 = 0 to 𝑁𝐸 − 1 do {
- 𝑋𝑠 ̂(𝑛) = 𝑋𝑓 ̂(𝑛)
- }
- s0 = s1 = s2 = s3 = s4 = s5 = s6 = s7 = 0
- for 𝑓 = 0 to num_tns_filters-1 do {
- if (𝑟𝑐𝑜𝑟𝑑𝑒𝑟 (𝑓) > 0)
- {
- for 𝑛 = start_freq(𝑓) to stop_freq(f) − 1 do {
- t = 𝑋𝑓 ̂ (𝑛) − 𝑟𝑐𝑞 (𝑟𝑐𝑜𝑟𝑑𝑒𝑟 (𝑓) − 1 , 𝑓) ∙ 𝑠𝑟𝑐𝑜𝑟𝑑𝑒𝑟(𝑓)−1
- for 𝑘 = 𝑟𝑐𝑜𝑟𝑑𝑒𝑟 (𝑓) − 2 to 0 do {
- 𝑡 = 𝑡 − 𝑟𝑐𝑞 (𝑘, 𝑓) ∙ 𝑠𝑘
- 𝑠𝑘+1 = 𝑟𝑐𝑞 (𝑘, 𝑓) ∙ 𝑡 + 𝑠𝑘
- }
- 𝑋𝑆 ̂(𝑛) = 𝑡
- 𝑠0 = 𝑡
- }
- }
- }
- */
- uint16_t start_freq[2] = {12, 160};
- uint16_t stop_freq[2];
- if (lc3Config.N_ms == Lc3Config::FrameDuration::d10ms) {
- if (4 == P_BW) start_freq[1] = 200;
- switch (P_BW) {
- case 0:
- stop_freq[0] = 80;
- break;
- case 1:
- stop_freq[0] = 160;
- break;
- case 2:
- stop_freq[0] = 240;
- break;
- case 3:
- stop_freq[0] = 160;
- stop_freq[1] = 320;
- break;
- case 4:
- stop_freq[0] = 200;
- stop_freq[1] = 400;
- break;
- }
- } else {
- start_freq[0] = 9;
- if (3 == P_BW) start_freq[1] = 120; // Errata 15098 implemented
- if (4 == P_BW) start_freq[1] = 150;
- switch (P_BW) {
- case 0:
- stop_freq[0] = 60;
- break;
- case 1:
- stop_freq[0] = 120;
- break;
- case 2:
- stop_freq[0] = 180;
- break;
- case 3:
- // stop_freq[0] = 119; // this value is specified in Table 3.19
- // (d09r06_KLG_AY_NH_FhG, 2019-12-20), but gives poor match to 32kHz
- // decoder tests compared to reference decoder
- stop_freq[0] = 120; // this value gives good match to reference decoder
- // and is more consistent to 10ms case
- stop_freq[1] = 240;
- break;
- case 4:
- stop_freq[0] = 150;
- stop_freq[1] = 300;
- break;
- }
- }
-
- for (int16_t k = 0; k < lc3Config.NE; k++) {
- X_s_tns[k] = X_hat_f[k];
- }
- double s[8];
- for (uint8_t k = 0; k < 8; k++) {
- s[k] = 0.0;
- }
- for (uint8_t f = 0; f < num_tns_filters; f++) {
- if (arithmeticDec.rc_order_ari[f] > 0) {
- for (uint16_t n = start_freq[f]; n < stop_freq[f]; n++) {
- double t = X_hat_f[n] -
- arithmeticDec.rc_q(arithmeticDec.rc_order_ari[f] - 1, f) *
- s[arithmeticDec.rc_order_ari[f] - 1];
- for (int8_t k = arithmeticDec.rc_order_ari[f] - 2; k >= 0; k--) {
- t = t - arithmeticDec.rc_q(k, f) * s[k];
- s[k + 1] = arithmeticDec.rc_q(k, f) * t + s[k];
- }
- X_s_tns[n] = t;
- s[0] = t;
- }
- }
- }
-}
-
-void DecoderFrame::runFloat(const uint8_t* bytes, uint8_t BFI,
- uint8_t& BEC_detect) {
- // increment frame counter
- frameN++;
-
- // 5.4.2.2 Initialization
- uint16_t bp = 0;
- uint16_t bp_side = nbytes - 1;
- uint8_t mask_side = 1;
- BEC_detect = BFI; // Note: the base specification initializes BEC_detect with
- // zero, but initialization with BFI is more meaningful
-
- // 5.4.2.3 Side information
- if (!BEC_detect) {
- sideInformation.run(bytes, bp_side, mask_side, P_BW, lastnz, lsbMode,
- gg_ind, num_tns_filters, rc_order, pitch_present,
- pitch_index, ltpf_active, F_NF, ind_LF, ind_HF, Gind,
- LS_indA, LS_indB, idxA, idxB, BEC_detect);
- }
-
- // 3.4.2.4 Bandwidth interpretation (d09r02_F2F)
- // ...included somewhere else?
-
- // 3.4.2.5 Arithmetic decoding (d09r02_F2F)
- if (!BEC_detect) {
- arithmeticDec.run(bytes, bp, bp_side, mask_side, num_tns_filters, rc_order,
- lsbMode, lastnz, nbits, BEC_detect);
- }
-
- if (!BEC_detect) {
- /* Decode residual bits */
- // and 3.4.3 Residual decoding (d09r02_F2F)
- residualSpectrum.run(bytes, bp_side, mask_side, lastnz,
- arithmeticDec.X_hat_q_ari,
- arithmeticDec.nbits_residual, arithmeticDec.save_lev,
- lsbMode, nf_seed, zeroFrame, gg_ind, F_NF);
-
- // 3.4.4 Noise filling (d09r02_F2F)
- noiseFilling();
-
- // 3.4.5 Global gain (d09r02_F2F)
- applyGlobalGain();
-
- // 3.4.6 TNS decoder (d09r02_F2F)
- temporalNoiseShaping();
-
- // 3.4.7 SNS decoder (d09r02_F2F)
- spectralNoiseShaping.run(
- X_s_tns, X_hat_ss, ind_LF, ind_HF, sideInformation.submodeMSB,
- sideInformation.submodeLSB, Gind, LS_indA, LS_indB, idxA, idxB);
- }
-
- // Appendix B. Packet Loss Concealment (d09r02_F2F)
- packetLossConcealment.run(BEC_detect, X_hat_ss, ltpf_active);
-
- // 3.4.8 Low delay MDCT synthesis (d09r02_F2F)
- mdctDec.run(X_hat_ss);
-
- // 3.4.9 Long Term Postfilter (d09r02_F2F)
- if (0 == pitch_present) {
- pitch_index = 0;
- ltpf_active = 0;
- }
- longTermPostfilter.setInputX(mdctDec.x_hat_mdct);
- longTermPostfilter.run(ltpf_active, pitch_index);
-}
-
-void DecoderFrame::registerDatapoints(DatapointContainer* datapoints_) {
- datapoints = datapoints_;
- if (nullptr != datapoints) {
- datapoints->addDatapoint("fs_idx", &lc3Config.Fs_ind,
- sizeof(lc3Config.Fs_ind));
-
- datapoints->addDatapoint("frameN", &frameN, sizeof(frameN));
-
- datapoints->addDatapoint("lastnz", &lastnz, sizeof(lastnz));
- datapoints->addDatapoint("P_BW", &P_BW, sizeof(P_BW));
- datapoints->addDatapoint("lsbMode", &lsbMode, sizeof(lsbMode));
- datapoints->addDatapoint("gg_ind", &gg_ind, sizeof(gg_ind));
- datapoints->addDatapoint("num_tns_filters", &num_tns_filters,
- sizeof(num_tns_filters));
- datapoints->addDatapoint("rc_order", &rc_order[0], sizeof(rc_order));
- datapoints->addDatapoint("pitch_index", &pitch_index, sizeof(pitch_index));
- datapoints->addDatapoint("pitch_present", &pitch_present,
- sizeof(pitch_present));
- datapoints->addDatapoint("ltpf_active", <pf_active, sizeof(ltpf_active));
- datapoints->addDatapoint("F_NF", &F_NF, sizeof(F_NF));
- datapoints->addDatapoint("ind_LF", &ind_LF, sizeof(ind_LF));
- datapoints->addDatapoint("ind_HF", &ind_HF, sizeof(ind_HF));
- datapoints->addDatapoint("Gind", &Gind, sizeof(Gind));
- datapoints->addDatapoint("LS_indA", &LS_indA, sizeof(LS_indA));
- datapoints->addDatapoint("idxA", &idxA, sizeof(idxA));
- datapoints->addDatapoint("idxB", &idxB, sizeof(idxB));
-
- datapoints->addDatapoint("nf_seed", &nf_seed, sizeof(nf_seed));
- datapoints->addDatapoint("zeroFrame", &zeroFrame, sizeof(zeroFrame));
-
- datapoints->addDatapoint("gg_off", &gg_off, sizeof(gg_off));
- datapoints->addDatapoint("rc_i_tns", &arithmeticDec.rc_i[0],
- sizeof(arithmeticDec.rc_i[0]) * 8);
-
- datapoints->addDatapoint("X_hat_q_nf", &X_hat_q_nf[0],
- sizeof(double) * lc3Config.NE);
- datapoints->addDatapoint("X_s_tns", &X_s_tns[0],
- sizeof(double) * lc3Config.NE);
- datapoints->addDatapoint("X_hat_ss", &X_hat_ss[0],
- sizeof(double) * lc3Config.NE);
-
- if (nullptr == x_hat_clip) {
- x_hat_clip = new double[lc3Config.NF];
- }
- datapoints->addDatapoint("x_hat_clip", &x_hat_clip[0],
- sizeof(double) * lc3Config.NF);
-
- sideInformation.registerDatapoints(datapoints);
- arithmeticDec.registerDatapoints(datapoints);
- longTermPostfilter.registerDatapoints(datapoints);
- }
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/DecoderFrame.hpp b/system/embdrv/lc3_dec/Decoder/DecoderFrame.hpp
deleted file mode 100644
index 4ce1c86..0000000
--- a/system/embdrv/lc3_dec/Decoder/DecoderFrame.hpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * DecoderFrame.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef __DECODER_FRAME_HPP_
-#define __DECODER_FRAME_HPP_
-
-#include <cstdint>
-
-#include "ArithmeticDec.hpp"
-#include "Datapoints.hpp"
-#include "Lc3Config.hpp"
-#include "LongTermPostfilter.hpp"
-#include "MdctDec.hpp"
-#include "PacketLossConcealment.hpp"
-#include "ResidualSpectrum.hpp"
-#include "SideInformation.hpp"
-#include "SpectralNoiseShaping.hpp"
-
-namespace Lc3Dec {
-
-class DecoderFrame {
- public:
- DecoderFrame(ResidualSpectrum& residualSpectrum_,
- SpectralNoiseShaping& spectralNoiseShaping_,
- PacketLossConcealment& packetLossConcealment_, MdctDec& mdctDec_,
- const Lc3Config& lc3Config_, uint16_t nbytes_);
- virtual ~DecoderFrame();
-
- void registerDatapoints(DatapointContainer* datapoints_);
-
- template <typename T>
- void run(const uint8_t* bytes, uint8_t BFI,
- uint16_t bits_per_audio_sample_dec, T* x_out, uint8_t& BEC_detect) {
- if (!lc3Config.isValid()) {
- return;
- }
-
- // main decoder implementation: 3.4.1 until 3.4.9 (d09r06)
- runFloat(bytes, BFI, BEC_detect);
-
- // 3.4.10 Output signal scaling and rounding (d09r06)
- const uint32_t outputScale = 1UL << (-15 + bits_per_audio_sample_dec - 1);
- for (uint16_t k = 0; k < lc3Config.NF; k++) {
- double x_hat_clip_local;
- if (longTermPostfilter.x_hat_ltpf[k] > 32767) {
- x_hat_clip_local = 32767;
- } else if (longTermPostfilter.x_hat_ltpf[k] < -32768) {
- x_hat_clip_local = -32768;
- } else {
- x_hat_clip_local = longTermPostfilter.x_hat_ltpf[k];
- }
-
- // datapoint buffer for x_hat_clip only prepared when datapoints are
- // available
- if (nullptr != x_hat_clip) {
- x_hat_clip[k] = x_hat_clip_local;
- }
-
- // Round 𝑥 to nearest integer, e.g., ⌊−4.5⌉ = −5, ⌊−3.2⌉ = −3, ⌊3.2⌉ = 3,
- // ⌊4.5⌉ = 5,
- if (x_hat_clip_local > 0) {
- x_out[k] = outputScale * x_hat_clip_local + 0.5;
- } else {
- x_out[k] = outputScale * x_hat_clip_local - 0.5;
- }
- }
-
- if (nullptr != datapoints) {
- datapoints->log("x_out", &x_out[0], sizeof(T) * lc3Config.NF);
- datapoints->log("BER_detect", &BEC_detect, sizeof(BEC_detect));
- }
- }
-
- void linkPreviousFrame(DecoderFrame* previousFrame);
-
- // per instance constant parameter
- const uint16_t nbytes;
- const uint16_t nbits;
- const Lc3Config& lc3Config;
- const uint8_t tns_lpc_weighting;
-
- private:
- void runFloat(const uint8_t* bytes, uint8_t BFI, uint8_t& BEC_detect);
-
- void noiseFilling();
- void applyGlobalGain();
- void temporalNoiseShaping();
-
- SideInformation sideInformation;
- ArithmeticDec arithmeticDec;
- ResidualSpectrum& residualSpectrum;
- SpectralNoiseShaping& spectralNoiseShaping;
- PacketLossConcealment& packetLossConcealment;
- MdctDec& mdctDec;
- LongTermPostfilter longTermPostfilter;
-
- DatapointContainer* datapoints;
-
- // states & outputs
- int16_t frameN;
-
- int16_t lastnz;
- int16_t P_BW;
- uint8_t lsbMode;
- int16_t gg_ind;
- int16_t num_tns_filters;
- int16_t rc_order[2];
- uint8_t pitch_present;
- int16_t pitch_index;
- int16_t ltpf_active;
- int16_t F_NF;
- int16_t ind_LF;
- int16_t ind_HF;
- int16_t Gind;
- int16_t LS_indA;
- int16_t LS_indB;
- int32_t idxA;
- int16_t idxB;
- uint16_t nf_seed;
- uint16_t zeroFrame;
- int16_t gg_off;
- double* X_hat_q_nf;
- double* X_hat_f;
- double* X_s_tns;
- double* X_hat_ss;
- double* x_hat_clip;
-};
-
-} // namespace Lc3Dec
-
-#endif // __DECODER_FRAME_HPP_
diff --git a/system/embdrv/lc3_dec/Decoder/DecoderTop.cpp b/system/embdrv/lc3_dec/Decoder/DecoderTop.cpp
deleted file mode 100644
index 5b7f6acb..0000000
--- a/system/embdrv/lc3_dec/Decoder/DecoderTop.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * DecoderTop.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "DecoderTop.hpp"
-
-namespace Lc3Dec {
-
-DecoderTop::DecoderTop(uint16_t fs_, DatapointContainer* datapoints_)
- : DecoderTop(Lc3Config(fs_, Lc3Config::FrameDuration::d10ms, 1),
- datapoints_) {}
-
-DecoderTop::DecoderTop(Lc3Config lc3Config_, DatapointContainer* datapoints_)
- : lc3Config(lc3Config_),
- datapoints(datapoints_),
- decoderCurrentFrame(nullptr),
- decoderPreviousFrame(nullptr),
- residualSpectrum(lc3Config_.NE),
- spectralNoiseShaping(lc3Config),
- packetLossConcealment(lc3Config_.NE),
- mdctDec(lc3Config) {
- if (nullptr != datapoints) {
- residualSpectrum.registerDatapoints(datapoints);
- spectralNoiseShaping.registerDatapoints(datapoints);
- packetLossConcealment.registerDatapoints(datapoints);
- mdctDec.registerDatapoints(datapoints);
- }
-}
-
-DecoderTop::~DecoderTop() {
- if (nullptr != decoderPreviousFrame) {
- delete decoderPreviousFrame;
- }
- if (nullptr != decoderCurrentFrame) {
- delete decoderCurrentFrame;
- }
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/DecoderTop.hpp b/system/embdrv/lc3_dec/Decoder/DecoderTop.hpp
deleted file mode 100644
index 268a574..0000000
--- a/system/embdrv/lc3_dec/Decoder/DecoderTop.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * DecoderTop.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef __DECODER_TOP_HPP_
-#define __DECODER_TOP_HPP_
-
-#include <cstdint>
-
-#include "Datapoints.hpp"
-#include "DecoderFrame.hpp"
-#include "Lc3Config.hpp"
-#include "MdctDec.hpp"
-#include "PacketLossConcealment.hpp"
-#include "ResidualSpectrum.hpp"
-#include "SpectralNoiseShaping.hpp"
-
-namespace Lc3Dec {
-
-class DecoderTop {
- public:
- DecoderTop(uint16_t fs_, DatapointContainer* datapoints_ = nullptr);
- DecoderTop(Lc3Config lc3Config_, DatapointContainer* datapoints_ = nullptr);
- virtual ~DecoderTop();
-
- template <typename T>
- void run(const uint8_t* bytes, uint16_t nbytes, uint8_t BFI,
- uint8_t bits_per_audio_sample_dec, T* x_out, uint8_t& BEC_detect) {
- if ((nullptr == decoderCurrentFrame) ||
- (decoderCurrentFrame->nbytes != nbytes)) {
- // We need to instantiate a new DecoderFrame only
- // when byte_count has been changed. Thus, frequent
- // dynamic memory allocation can be constrained to
- // rate optimized operation.
- if (nullptr != decoderPreviousFrame) {
- delete decoderPreviousFrame;
- }
- decoderPreviousFrame = decoderCurrentFrame;
- decoderCurrentFrame =
- new DecoderFrame(residualSpectrum, spectralNoiseShaping,
- packetLossConcealment, mdctDec, lc3Config, nbytes);
- decoderCurrentFrame->linkPreviousFrame(decoderPreviousFrame);
- if (nullptr != datapoints) {
- // Another way to make to call optional would be to split run() into
- // init(), registerDatapoints() & remaining run() -> we preferred the
- // simpler
- // API and thus designed this registration being dependent on the
- // availability of datapoints.
- decoderCurrentFrame->registerDatapoints(datapoints);
- }
- }
- decoderCurrentFrame->run<T>(bytes, BFI, bits_per_audio_sample_dec, x_out,
- BEC_detect);
- }
-
- const Lc3Config lc3Config;
-
- private:
- DatapointContainer* datapoints;
- DecoderFrame* decoderCurrentFrame;
- DecoderFrame* decoderPreviousFrame;
- ResidualSpectrum residualSpectrum;
- SpectralNoiseShaping spectralNoiseShaping;
- PacketLossConcealment packetLossConcealment;
- MdctDec mdctDec;
-};
-
-} // namespace Lc3Dec
-
-#endif // __DECODER_TOP_HPP_
diff --git a/system/embdrv/lc3_dec/Decoder/Lc3Decoder.cpp b/system/embdrv/lc3_dec/Decoder/Lc3Decoder.cpp
deleted file mode 100644
index ccc7cf4..0000000
--- a/system/embdrv/lc3_dec/Decoder/Lc3Decoder.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Lc3Decoder.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "Lc3Decoder.hpp"
-
-#include <cstring>
-
-#include "DecoderTop.hpp"
-
-using namespace Lc3Dec;
-
-Lc3Decoder::Lc3Decoder(uint16_t Fs, Lc3Config::FrameDuration frameDuration)
- : Lc3Decoder(Lc3Config(Fs, frameDuration, 1)) {}
-
-Lc3Decoder::Lc3Decoder(Lc3Config lc3Config_, uint8_t bits_per_audio_sample_dec_,
- uint16_t byte_count_max_dec_, void* datapoints)
- : lc3Config(lc3Config_),
- bits_per_audio_sample_dec(bits_per_audio_sample_dec_),
- byte_count_max_dec((byte_count_max_dec_ < 400) ? byte_count_max_dec_
- : 400),
- decoderList(lc3Config.Nc) {
- // proceed only with valid configuration
- if (lc3Config.isValid()) {
- for (uint8_t channelNr = 0; channelNr < lc3Config.Nc; channelNr++) {
- decoderList[channelNr] = new DecoderTop(
- lc3Config, reinterpret_cast<DatapointContainer*>(datapoints));
- }
- }
-}
-
-Lc3Decoder::~Lc3Decoder() {
- for (uint8_t channelNr = 0; channelNr < lc3Config.Nc; channelNr++) {
- DecoderTop* decoderTop = decoderList[channelNr];
- if (nullptr != decoderTop) {
- delete decoderTop;
- }
- }
-}
-
-uint8_t Lc3Decoder::run(const uint8_t* bytes, uint16_t byte_count, uint8_t BFI,
- int16_t* x_out, uint16_t x_out_size,
- uint8_t& BEC_detect, uint8_t channelNr) {
- if (!lc3Config.isValid()) {
- return INVALID_CONFIGURATION;
- }
- if ((byte_count < 20) || (byte_count > byte_count_max_dec)) {
- return INVALID_BYTE_COUNT;
- }
- if (lc3Config.NF != x_out_size) {
- return INVALID_X_OUT_SIZE;
- }
- if (bits_per_audio_sample_dec != 16) {
- return INVALID_BITS_PER_AUDIO_SAMPLE;
- }
- if (nullptr == decoderList[channelNr]) {
- return DECODER_ALLOCATION_ERROR;
- }
-
- decoderList[channelNr]->run<int16_t>(
- bytes, byte_count, BFI, bits_per_audio_sample_dec, x_out, BEC_detect);
- return ERROR_FREE;
-}
-
-uint8_t Lc3Decoder::run(const uint8_t* bytes, uint16_t byte_count, uint8_t BFI,
- int32_t* x_out, uint16_t x_out_size,
- uint8_t& BEC_detect, uint8_t channelNr) {
- if (!lc3Config.isValid()) {
- return INVALID_CONFIGURATION;
- }
- if ((byte_count < 20) || (byte_count > byte_count_max_dec)) {
- return INVALID_BYTE_COUNT;
- }
- if (lc3Config.NF != x_out_size) {
- return INVALID_X_OUT_SIZE;
- }
- if ((bits_per_audio_sample_dec != 16) && (bits_per_audio_sample_dec != 24) &&
- (bits_per_audio_sample_dec != 32)) {
- return INVALID_BITS_PER_AUDIO_SAMPLE;
- }
- if (nullptr == decoderList[channelNr]) {
- return DECODER_ALLOCATION_ERROR;
- }
-
- decoderList[channelNr]->run<int32_t>(
- bytes, byte_count, BFI, bits_per_audio_sample_dec, x_out, BEC_detect);
- return ERROR_FREE;
-}
-
-uint8_t Lc3Decoder::run(const uint8_t* bytes,
- const uint16_t* byte_count_per_channel,
- const uint8_t* BFI_per_channel, int16_t* x_out,
- uint32_t x_out_size, uint8_t* BEC_detect_per_channel) {
- if (!lc3Config.isValid()) {
- return INVALID_CONFIGURATION;
- }
- if (lc3Config.NF * lc3Config.Nc != x_out_size) {
- return INVALID_X_OUT_SIZE;
- }
-
- uint8_t returnCode = ERROR_FREE;
- uint32_t byteOffset = 0;
- for (uint8_t channelNr = 0; channelNr < lc3Config.Nc; channelNr++) {
- // Note: bitwise or of the single channel return code will not allow
- // uniquely to decode
- // the given error. The idea is to catch any error. This decision
- // makes the API more simple. However, when the precise error code is
- // needed, the single channel call has to be made separately.
- returnCode |=
- run(&bytes[byteOffset], byte_count_per_channel[channelNr],
- BFI_per_channel[channelNr], &x_out[channelNr * lc3Config.NF],
- lc3Config.NF, BEC_detect_per_channel[channelNr], channelNr);
- byteOffset += byte_count_per_channel[channelNr];
- }
- return returnCode;
-}
-
-uint8_t Lc3Decoder::run(const uint8_t* bytes,
- const uint16_t* byte_count_per_channel,
- const uint8_t* BFI_per_channel, int32_t* x_out,
- uint32_t x_out_size, uint8_t* BEC_detect_per_channel) {
- if (!lc3Config.isValid()) {
- return INVALID_CONFIGURATION;
- }
- if (lc3Config.NF * lc3Config.Nc != x_out_size) {
- return INVALID_X_OUT_SIZE;
- }
-
- uint8_t returnCode = ERROR_FREE;
- uint32_t byteOffset = 0;
- for (uint8_t channelNr = 0; channelNr < lc3Config.Nc; channelNr++) {
- // Note: bitwise or of the single channel return code will not allow
- // uniquely to decode
- // the given error. The idea is to catch any error. This decision
- // makes the API more simple. However, when the precise error code is
- // needed, the single channel call has to be made separately.
- returnCode |=
- run(&bytes[byteOffset], byte_count_per_channel[channelNr],
- BFI_per_channel[channelNr], &x_out[channelNr * lc3Config.NF],
- lc3Config.NF, BEC_detect_per_channel[channelNr], channelNr);
- byteOffset += byte_count_per_channel[channelNr];
- }
- return returnCode;
-}
diff --git a/system/embdrv/lc3_dec/Decoder/LongTermPostfilter.cpp b/system/embdrv/lc3_dec/Decoder/LongTermPostfilter.cpp
deleted file mode 100644
index 3838c7f..0000000
--- a/system/embdrv/lc3_dec/Decoder/LongTermPostfilter.cpp
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * LongTermPostfilter.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "LongTermPostfilter.hpp"
-
-#include <cmath>
-
-#include "LongTermPostfilterCoefficients.hpp"
-
-namespace Lc3Dec {
-
-LongTermPostfilter::LongTermPostfilter(const Lc3Config& lc3Config_,
- uint16_t nbits)
- : lc3Config(lc3Config_),
- numMemBlocks((lc3Config.N_ms == Lc3Config::FrameDuration::d10ms) ? 2 : 3),
- x_hat_ltpf(nullptr),
- ltpf_active_prev(0),
- blockStartIndex(0),
- c_num(nullptr),
- c_den(nullptr),
- c_num_mem(nullptr),
- c_den_mem(nullptr),
- x_hat_ltpfin(nullptr),
- x_hat_mem(nullptr),
- x_hat_ltpf_mem(nullptr),
- p_int(0),
- p_fr(0),
- p_int_mem(0),
- p_fr_mem(0) {
- x_hat_ltpfin = new double[lc3Config.NF];
- x_hat_mem = new double[lc3Config.NF * numMemBlocks];
- x_hat_ltpf = new double[lc3Config.NF];
- x_hat_ltpf_mem = new double[lc3Config.NF * numMemBlocks];
-
- for (uint16_t n = 0; n < lc3Config.NF * numMemBlocks; n++) {
- x_hat_mem[n] = 0.0;
- x_hat_ltpf_mem[n] = 0.0;
- }
-
- setGainParams(nbits);
-
- L_den = ceil(lc3Config.Fs / 4000.0);
- if (L_den < 4) L_den = 4;
- L_num = L_den - 2;
-
- c_num = new double[L_num + 1];
- c_den = new double[L_den + 1];
- c_num_mem = new double[L_num + 1];
- c_den_mem = new double[L_den + 1];
-}
-
-LongTermPostfilter::~LongTermPostfilter() {
- if (nullptr != x_hat_ltpfin) {
- delete[] x_hat_ltpfin;
- }
- if (nullptr != x_hat_mem) {
- delete[] x_hat_mem;
- }
- if (nullptr != x_hat_ltpf) {
- delete[] x_hat_ltpf;
- }
- if (nullptr != x_hat_ltpf_mem) {
- delete[] x_hat_ltpf_mem;
- }
- if (nullptr != c_num) {
- delete[] c_num;
- }
- if (nullptr != c_den) {
- delete[] c_den;
- }
- if (nullptr != c_num_mem) {
- delete[] c_num_mem;
- }
- if (nullptr != c_den_mem) {
- delete[] c_den_mem;
- }
-}
-
-LongTermPostfilter& LongTermPostfilter::operator=(
- const LongTermPostfilter& src) {
- // TODO we should assert, that NF is equal in src and *this!
-
- ltpf_active_prev = src.ltpf_active_prev;
- blockStartIndex = src.blockStartIndex;
- p_int = src.p_int;
- p_fr = src.p_fr;
- p_int_mem = src.p_int_mem;
- p_fr_mem = src.p_fr_mem;
-
- for (uint16_t k = 0; k < lc3Config.NF; k++) {
- x_hat_ltpfin[k] = src.x_hat_ltpfin[k];
- x_hat_mem[k] = src.x_hat_mem[k];
- x_hat_mem[k + lc3Config.NF] = src.x_hat_mem[k + lc3Config.NF];
- if (numMemBlocks > 2) {
- x_hat_mem[k + lc3Config.NF * 2] = src.x_hat_mem[k + lc3Config.NF * 2];
- }
- x_hat_ltpf[k] = src.x_hat_ltpf[k];
- x_hat_ltpf_mem[k] = src.x_hat_ltpf_mem[k];
- x_hat_ltpf_mem[k + lc3Config.NF] = src.x_hat_ltpf_mem[k + lc3Config.NF];
- if (numMemBlocks > 2) {
- x_hat_ltpf_mem[k + lc3Config.NF * 2] =
- src.x_hat_ltpf_mem[k + lc3Config.NF * 2];
- }
- }
- for (uint8_t k = 0; k < L_num + 1; k++) {
- c_num[k] = src.c_num[k];
- c_num_mem[k] = src.c_num_mem[k];
- }
- for (uint8_t k = 0; k < L_den + 1; k++) {
- c_den[k] = src.c_den[k];
- c_den_mem[k] = src.c_den_mem[k];
- }
-
- return *this;
-}
-
-void LongTermPostfilter::setGainParams(uint16_t nbits) {
- uint16_t t_nbits = (lc3Config.N_ms == Lc3Config::FrameDuration::d7p5ms)
- ? round(nbits * 10 / 7.5)
- : nbits;
-
- if (t_nbits < 320 + lc3Config.Fs_ind * 80) {
- gain_ltpf = 0.4;
- gain_ind = 0;
- } else if (t_nbits < 400 + lc3Config.Fs_ind * 80) {
- gain_ltpf = 0.35;
- gain_ind = 1;
- } else if (t_nbits < 480 + lc3Config.Fs_ind * 80) {
- gain_ltpf = 0.3;
- gain_ind = 2;
- } else if (t_nbits < 560 + lc3Config.Fs_ind * 80) {
- gain_ltpf = 0.25;
- gain_ind = 3;
- } else {
- gain_ltpf = 0;
- gain_ind = 4; // just a guess so far!
- }
-}
-
-void LongTermPostfilter::computeFilterCoeffs(uint16_t pitch_index) {
- uint16_t pitch_int;
- double pitch_fr;
- if (pitch_index >= 440) {
- pitch_int = pitch_index - 283;
- pitch_fr = 0.0;
- } else if (pitch_index >= 380) {
- pitch_int = pitch_index / 2 - 63;
- pitch_fr = 2 * pitch_index - 4 * pitch_int - 252;
- } else {
- pitch_int = pitch_index / 4 + 32;
- pitch_fr = pitch_index - 4 * pitch_int + 128;
- }
- double pitch = pitch_int + pitch_fr / 4;
-
- double pitch_fs = pitch * (8000 * ceil(lc3Config.Fs / 8000.0) / 12800.0);
- uint16_t p_up = (pitch_fs * 4) + 0.5;
-
- // update index parameters for current frame
- p_int = p_up / 4;
- p_fr = p_up - 4 * p_int;
-
- double* tab_ltpf_num_fs =
- tab_ltpf_num_8000[gain_ind]; // default to avoid warnings
- double* tab_ltpf_den_fs =
- tab_ltpf_den_8000[p_fr]; // default to avoid warnings
- switch (lc3Config.Fs) {
- case 8000:
- tab_ltpf_num_fs = tab_ltpf_num_8000[gain_ind];
- tab_ltpf_den_fs = tab_ltpf_den_8000[p_fr];
- break;
- case 16000:
- tab_ltpf_num_fs = tab_ltpf_num_16000[gain_ind];
- tab_ltpf_den_fs = tab_ltpf_den_16000[p_fr];
- break;
- case 24000:
- tab_ltpf_num_fs = tab_ltpf_num_24000[gain_ind];
- tab_ltpf_den_fs = tab_ltpf_den_24000[p_fr];
- break;
- case 32000:
- tab_ltpf_num_fs = tab_ltpf_num_32000[gain_ind];
- tab_ltpf_den_fs = tab_ltpf_den_32000[p_fr];
- break;
- case 44100:
- case 48000:
- tab_ltpf_num_fs = tab_ltpf_num_48000[gain_ind];
- tab_ltpf_den_fs = tab_ltpf_den_48000[p_fr];
- break;
- }
-
- for (uint8_t k = 0; k <= L_num; k++) {
- c_num[k] = 0.85 * gain_ltpf * tab_ltpf_num_fs[k];
- }
- for (uint8_t k = 0; k <= L_den; k++) {
- c_den[k] = gain_ltpf * tab_ltpf_den_fs[k];
- }
-}
-
-void LongTermPostfilter::setInputX(const double* const x_hat) {
- for (uint16_t n = 0; n < lc3Config.NF; n++) {
- x_hat_ltpfin[n] = x_hat[n];
- }
-}
-
-void LongTermPostfilter::run(int16_t ltpf_active, int16_t pitch_index) {
- // further register updates (maybe move to explicit registerUpdate method)
- p_int_mem = p_int;
- p_fr_mem = p_fr;
- for (uint8_t k = 0; k <= L_num; k++) {
- c_num_mem[k] = c_num[k];
- }
- for (uint8_t k = 0; k <= L_den; k++) {
- c_den_mem[k] = c_den[k];
- }
-
- // compute new coefficients
- if (1 == ltpf_active) {
- computeFilterCoeffs(pitch_index);
- } else {
- p_int = 0;
- p_fr = 0;
- for (uint8_t k = 0; k <= L_num; k++) {
- c_num[k] = 0;
- }
- for (uint8_t k = 0; k <= L_den; k++) {
- c_den[k] = 0;
- }
- }
-
- // start processing of input signal
- for (uint16_t n = 0; n < lc3Config.NF; n++) {
- x_hat_mem[blockStartIndex + n] = x_hat_ltpfin[n];
- }
- double norm = (lc3Config.N_ms == Lc3Config::FrameDuration::d10ms)
- ? lc3Config.NF / 4
- : lc3Config.NF / 3;
- uint16_t sample2p5ms =
- (lc3Config.Fs == 44100) ? 48000 / 400 : lc3Config.Fs / 400;
-
- if ((0 == ltpf_active) && (0 == ltpf_active_prev)) {
- //*** transition case 1 **********************************************
- for (uint16_t n = 0; n < lc3Config.NF; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] = x_hat_mem[blockStartIndex + n];
- }
- } else if ((1 == ltpf_active) && (0 == ltpf_active_prev)) {
- //*** transition case 2 **********************************************
- for (uint16_t n = 0; n < sample2p5ms; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] = x_hat_mem[blockStartIndex + n];
- double filtOut = 0.0;
- for (uint16_t k = 0; k <= L_num; k++) {
- int16_t x_hat_index = blockStartIndex + n - k;
- if (x_hat_index < 0) {
- x_hat_index += numMemBlocks * lc3Config.NF;
- }
- filtOut += c_num[k] * x_hat_mem[x_hat_index];
- }
- for (uint16_t k = 0; k <= L_den; k++) {
- int16_t x_hat_ltpf_index = blockStartIndex + n - p_int + L_den / 2 - k;
- if (x_hat_ltpf_index < 0) {
- x_hat_ltpf_index += numMemBlocks * lc3Config.NF;
- }
- filtOut -= c_den[k] * x_hat_ltpf_mem[x_hat_ltpf_index];
- }
- filtOut *= n / norm;
- x_hat_ltpf_mem[blockStartIndex + n] -= filtOut;
- }
-
- for (uint16_t n = sample2p5ms; n < lc3Config.NF; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] = x_hat_mem[blockStartIndex + n];
- double filtOut = 0.0;
- for (uint16_t k = 0; k <= L_num; k++) {
- int16_t x_hat_index = blockStartIndex + n - k;
- if (x_hat_index < 0) {
- x_hat_index += numMemBlocks * lc3Config.NF;
- }
- filtOut += c_num[k] * x_hat_mem[x_hat_index];
- }
- for (uint16_t k = 0; k <= L_den; k++) {
- int16_t x_hat_ltpf_index =
- blockStartIndex + n - p_int + L_den / 2.0 - k;
- if (x_hat_ltpf_index < 0) {
- x_hat_ltpf_index += numMemBlocks * lc3Config.NF;
- }
- filtOut -= c_den[k] * x_hat_ltpf_mem[x_hat_ltpf_index];
- }
- x_hat_ltpf_mem[blockStartIndex + n] -= filtOut;
- }
-
- } else if ((0 == ltpf_active) && (1 == ltpf_active_prev)) {
- //*** transition case 3 **********************************************
- for (uint16_t n = 0; n < sample2p5ms; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] = x_hat_mem[blockStartIndex + n];
- double filtOut = 0.0;
- for (uint16_t k = 0; k <= L_num; k++) {
- int16_t x_hat_index = blockStartIndex + n - k;
- if (x_hat_index < 0) {
- x_hat_index += numMemBlocks * lc3Config.NF;
- }
- filtOut += c_num_mem[k] * x_hat_mem[x_hat_index];
- }
- for (uint16_t k = 0; k <= L_den; k++) {
- int16_t x_hat_ltpf_index =
- blockStartIndex + n - p_int_mem + L_den / 2 - k;
- if (x_hat_ltpf_index < 0) {
- x_hat_ltpf_index += numMemBlocks * lc3Config.NF;
- }
- filtOut -= c_den_mem[k] * x_hat_ltpf_mem[x_hat_ltpf_index];
- }
- filtOut *= 1 - (n / norm);
- x_hat_ltpf_mem[blockStartIndex + n] -= filtOut;
- }
-
- for (uint16_t n = sample2p5ms; n < lc3Config.NF; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] = x_hat_mem[blockStartIndex + n];
- }
-
- } else {
- if ((p_int == p_int_mem) && (p_fr == p_fr_mem)) {
- //*** transition case 4 **********************************************
- for (uint16_t n = 0; n < lc3Config.NF; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] = x_hat_mem[blockStartIndex + n];
- double filtOut = 0.0;
- for (uint16_t k = 0; k <= L_num; k++) {
- int16_t x_hat_index = blockStartIndex + n - k;
- if (x_hat_index < 0) {
- x_hat_index += numMemBlocks * lc3Config.NF;
- }
- filtOut += c_num[k] * x_hat_mem[x_hat_index];
- }
- for (uint16_t k = 0; k <= L_den; k++) {
- int16_t x_hat_ltpf_index =
- blockStartIndex + n - p_int + L_den / 2 - k;
- if (x_hat_ltpf_index < 0) {
- x_hat_ltpf_index += numMemBlocks * lc3Config.NF;
- }
- filtOut -= c_den[k] * x_hat_ltpf_mem[x_hat_ltpf_index];
- }
- x_hat_ltpf_mem[blockStartIndex + n] -= filtOut;
- }
-
- } else {
- //*** transition case 5 **********************************************
- for (uint16_t n = 0; n < sample2p5ms; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] = x_hat_mem[blockStartIndex + n];
- double filtOut = 0.0;
- for (uint16_t k = 0; k <= L_num; k++) {
- int16_t x_hat_index = blockStartIndex + n - k;
- if (x_hat_index < 0) {
- x_hat_index += numMemBlocks * lc3Config.NF;
- }
- filtOut += c_num_mem[k] * x_hat_mem[x_hat_index];
- }
- for (uint16_t k = 0; k <= L_den; k++) {
- int16_t x_hat_ltpf_index =
- blockStartIndex + n - p_int_mem + L_den / 2 - k;
- if (x_hat_ltpf_index < 0) {
- x_hat_ltpf_index += numMemBlocks * lc3Config.NF;
- }
- filtOut -= c_den_mem[k] * x_hat_ltpf_mem[x_hat_ltpf_index];
- }
- filtOut *= 1 - (n / norm);
- x_hat_ltpf_mem[blockStartIndex + n] -= filtOut;
- }
-
- double x_hat_ltpf_temp[numMemBlocks *
- lc3Config.NF]; // is it good to place such a
- // buffer on the stack?
- for (int16_t m = -L_num; m < norm; m++) {
- int16_t idx = blockStartIndex + m;
- if (idx < 0) {
- idx += numMemBlocks * lc3Config.NF;
- }
- x_hat_ltpf_temp[idx] = x_hat_ltpf_mem[idx];
- }
-
- for (uint16_t n = 0; n < sample2p5ms; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] =
- x_hat_ltpf_temp[blockStartIndex + n];
- double filtOut = 0.0;
- for (uint16_t k = 0; k <= L_num; k++) {
- int16_t x_hat_index = blockStartIndex + n - k;
- if (x_hat_index < 0) {
- x_hat_index += numMemBlocks * lc3Config.NF;
- }
- filtOut += c_num[k] * x_hat_ltpf_temp[x_hat_index];
- }
- for (uint16_t k = 0; k <= L_den; k++) {
- int16_t x_hat_ltpf_index =
- blockStartIndex + n - p_int + L_den / 2 - k;
- if (x_hat_ltpf_index < 0) {
- x_hat_ltpf_index += numMemBlocks * lc3Config.NF;
- }
- filtOut -= c_den[k] * x_hat_ltpf_mem[x_hat_ltpf_index];
- }
- filtOut *= (n / norm);
- x_hat_ltpf_mem[blockStartIndex + n] -= filtOut;
- }
-
- for (uint16_t n = sample2p5ms; n < lc3Config.NF; n++) {
- x_hat_ltpf_mem[blockStartIndex + n] = x_hat_mem[blockStartIndex + n];
- double filtOut = 0.0;
- for (uint16_t k = 0; k <= L_num; k++) {
- int16_t x_hat_index = blockStartIndex + n - k;
- if (x_hat_index < 0) {
- x_hat_index += numMemBlocks * lc3Config.NF;
- }
- filtOut += c_num[k] * x_hat_mem[x_hat_index];
- }
- for (uint16_t k = 0; k <= L_den; k++) {
- int16_t x_hat_ltpf_index =
- blockStartIndex + n - p_int + L_den / 2.0 - k;
- if (x_hat_ltpf_index < 0) {
- x_hat_ltpf_index += numMemBlocks * lc3Config.NF;
- }
- filtOut -= c_den[k] * x_hat_ltpf_mem[x_hat_ltpf_index];
- }
- x_hat_ltpf_mem[blockStartIndex + n] -= filtOut;
- }
- }
- }
-
- // copy to output x_hat_ltpf
- for (uint16_t n = 0; n < lc3Config.NF; n++) {
- x_hat_ltpf[n] = x_hat_ltpf_mem[blockStartIndex + n];
- }
-
- // increment current block in block-ringbuffer
- blockStartIndex += lc3Config.NF;
- if (blockStartIndex > (numMemBlocks - 1) * lc3Config.NF) {
- blockStartIndex = 0;
- }
-
- // register updates
- ltpf_active_prev = ltpf_active;
-}
-
-void LongTermPostfilter::registerDatapoints(DatapointContainer* datapoints) {
- if (nullptr != datapoints) {
- datapoints->addDatapoint("x_hat_ltpfin", x_hat_ltpfin,
- sizeof(double) * lc3Config.NF);
- datapoints->addDatapoint("x_hat_ltpf", x_hat_ltpf,
- sizeof(double) * lc3Config.NF);
- datapoints->addDatapoint("x_hat_ltpf_mem", x_hat_ltpf_mem,
- sizeof(double) * lc3Config.NF * numMemBlocks);
- datapoints->addDatapoint("x_hat_mem", x_hat_mem,
- sizeof(double) * lc3Config.NF * numMemBlocks);
- datapoints->addDatapoint("c_num", c_num, sizeof(double) * (L_num + 1));
- datapoints->addDatapoint("c_den", c_den, sizeof(double) * (L_den + 1));
- datapoints->addDatapoint("c_num_mem", c_num_mem,
- sizeof(double) * (L_num + 1));
- datapoints->addDatapoint("c_den_mem", c_den_mem,
- sizeof(double) * (L_den + 1));
- datapoints->addDatapoint("p_int", &p_int, sizeof(p_int));
- }
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/LongTermPostfilter.hpp b/system/embdrv/lc3_dec/Decoder/LongTermPostfilter.hpp
deleted file mode 100644
index daeb31a..0000000
--- a/system/embdrv/lc3_dec/Decoder/LongTermPostfilter.hpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * LongTermPostfilter.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef LONG_TERM_POSTFILTER_H_
-#define LONG_TERM_POSTFILTER_H_
-
-#include <cstdint>
-
-#include "Datapoints.hpp"
-#include "Lc3Config.hpp"
-
-namespace Lc3Dec {
-
-class LongTermPostfilter {
- public:
- LongTermPostfilter(const Lc3Config& lc3Config_, uint16_t nbits);
- ~LongTermPostfilter();
-
- void registerDatapoints(DatapointContainer* datapoints);
-
- LongTermPostfilter& operator=(const LongTermPostfilter&);
-
- void setInputX(const double* const x_hat);
- void run(int16_t ltpf_active, int16_t pitch_index);
-
- const Lc3Config& lc3Config;
- const uint8_t numMemBlocks;
- double* x_hat_ltpf;
-
- private:
- void setGainParams(uint16_t nbits);
- void computeFilterCoeffs(uint16_t pitch_index);
-
- int16_t ltpf_active_prev;
- uint16_t blockStartIndex;
- double* c_num;
- double* c_den;
- double* c_num_mem;
- double* c_den_mem;
- double* x_hat_ltpfin;
- double* x_hat_mem;
- double* x_hat_ltpf_mem;
-
- uint8_t L_num;
- uint8_t L_den;
-
- double gain_ltpf;
- uint8_t gain_ind;
-
- uint16_t p_int;
- uint16_t p_fr;
- uint16_t p_int_mem;
- uint16_t p_fr_mem;
-};
-
-} // namespace Lc3Dec
-
-#endif // LONG_TERM_POSTFILTER_H_
diff --git a/system/embdrv/lc3_dec/Decoder/MPVQ.cpp b/system/embdrv/lc3_dec/Decoder/MPVQ.cpp
deleted file mode 100644
index aa3d4d6..0000000
--- a/system/embdrv/lc3_dec/Decoder/MPVQ.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * MPVQ.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "MPVQ.hpp"
-
-#include <cstdbool>
-
-#include "SnsQuantizationTables.hpp"
-
-namespace Lc3Dec {
-
-// declare local helper functions
-void mind2vec_tab(short dim_in, /* i: dimension */
- short k_max_local, /* i: nb unit pulses */
- short leading_sign, /* i: leading sign */
- unsigned int ind, /* i: MPVQ-index */
- short* vec_out, /* o: pulse train */
- unsigned int MPVQ_offsets[][11] /* i: offset matrix */
-);
-
-void mind2vec_one(short k_val_in, /* i: nb unit pulses */
- short leading_sign, /* i: leading sign -1, 1 */
- short* vec_out /* o: updated pulse train */
-);
-
-short setval_update_sign(short k_delta, /* i */
- short k_max_local_in, /* i */
- short* leading_sign, /* i/o */
- unsigned int* ind_in, /* i/o */
- short* vec_out /* i/o */
-);
-
-short get_lead_sign(unsigned int* ind_in);
-
-//
-// Implementation
-//
-
-void MPVQdeenum(uint8_t dim_in, /* i : dimension of vec_out */
- uint8_t k_val_in, /* i : number of unit pulses */
- int16_t LS_ind, /* i : leading sign index */
- int32_t MPVQ_ind, /* i : MPVQ shape index */
- int16_t* vec_out /* o : PVQ integer pulse train */
-) {
- for (uint8_t i = 0; i < dim_in; i++) {
- vec_out[i] = 0;
- }
- short leading_sign = 1;
- if (LS_ind != 0) {
- leading_sign = -1;
- }
- mind2vec_tab(dim_in, k_val_in, leading_sign, MPVQ_ind, vec_out, MPVQ_offsets);
-}
-
-void mind2vec_tab(short dim_in, /* i: dimension */
- short k_max_local, /* i: nb unit pulses */
- short leading_sign, /* i: leading sign */
- unsigned int ind, /* i: MPVQ-index */
- short* vec_out, /* o: pulse train */
- unsigned int MPVQ_offsets[][11] /* i: offset matrix */
-) {
- /* init */
- unsigned int* h_row_ptr = &(MPVQ_offsets[(dim_in - 1)][0]);
- short k_acc = k_max_local;
- /* loop over positions */
- for (uint8_t pos = 0; pos < dim_in; pos++) {
- short k_delta;
- if (ind != 0) {
- k_acc = k_max_local;
- ;
- unsigned int UL_tmp_offset = h_row_ptr[k_acc];
- bool wrap_flag = (ind < UL_tmp_offset);
- unsigned int UL_diff = 0;
- if (!wrap_flag) {
- // Note: due to android build using a integer-overflow sanitizer, we
- // have to avoid
- // computing the following difference when ind < UL_tmp_offset
- UL_diff = ind - UL_tmp_offset;
- }
- while (wrap_flag) {
- k_acc--;
- wrap_flag = (ind < h_row_ptr[k_acc]);
- if (!wrap_flag) {
- // Note: due to android build using a integer-overflow sanitizer, we
- // have to avoid
- // computing the following difference when ind < UL_tmp_offset
- UL_diff = ind - h_row_ptr[k_acc];
- }
- }
- ind = UL_diff;
- k_delta = k_max_local - k_acc;
- } else {
- mind2vec_one(k_max_local, leading_sign, &vec_out[pos]);
- break;
- }
- k_max_local = setval_update_sign(k_delta, k_max_local, &leading_sign, &ind,
- &vec_out[pos]);
- h_row_ptr -= 11; /* reduce dimension in MPVQ_offsets table */
- }
-}
-
-void mind2vec_one(short k_val_in, /* i: nb unit pulses */
- short leading_sign, /* i: leading sign -1, 1 */
- short* vec_out /* o: updated pulse train */
-) {
- short amp = k_val_in;
- if (leading_sign < 0) {
- amp = -k_val_in;
- }
- *vec_out = amp;
-}
-
-short setval_update_sign(
- short k_delta, /* i */
- short k_max_local_in, /* i */
- short* leading_sign, /* i/o */
- unsigned int* ind_in, /* i/o; needed to change type compared to spec */
- short* vec_out /* i/o */
-) {
- short k_max_local_out = k_max_local_in;
- if (k_delta != 0) {
- mind2vec_one(k_delta, *leading_sign, vec_out);
- *leading_sign = get_lead_sign(ind_in);
- k_max_local_out -= k_delta;
- }
- return k_max_local_out;
-}
-
-short get_lead_sign(
- unsigned int* ind) // renamed "ind_in" from spec to just "ind" (as already
- // found by yao.wang 28.06.2019)
-{
- short leading_sign = +1;
- if (((*ind) & 0x1) != 0) {
- leading_sign = -1;
- }
- (*ind) = (*ind >> 1);
- return leading_sign;
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/MPVQ.hpp b/system/embdrv/lc3_dec/Decoder/MPVQ.hpp
deleted file mode 100644
index e015d65..0000000
--- a/system/embdrv/lc3_dec/Decoder/MPVQ.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * MPVQ.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef __MPVQ_HPP_
-#define __MPVQ_HPP_
-
-#include <cstdint>
-
-namespace Lc3Dec {
-
-void MPVQdeenum(uint8_t dim_in, /* i : dimension of vec_out */
- uint8_t k_val_in, /* i : number of unit pulses */
- int16_t LS_ind, /* i : leading sign index */
- int32_t MPVQ_ind, /* i : MPVQ shape index */
- int16_t* vec_out /* o : PVQ integer pulse train */
-);
-
-} // namespace Lc3Dec
-
-#endif // __MPVQ_HPP_
diff --git a/system/embdrv/lc3_dec/Decoder/MdctDec.cpp b/system/embdrv/lc3_dec/Decoder/MdctDec.cpp
deleted file mode 100644
index ba56b5d..0000000
--- a/system/embdrv/lc3_dec/Decoder/MdctDec.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * MdctDec.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "MdctDec.hpp"
-
-#include <cmath>
-
-#include "MdctWindows.hpp"
-
-namespace Lc3Dec {
-
-MdctDec::MdctDec(const Lc3Config& lc3Config_)
- : lc3Config(lc3Config_),
- x_hat_mdct(nullptr),
- dctIVDbl(lc3Config.NF),
- mem_ola_add(nullptr),
- t_hat_mdct(nullptr),
- wN(nullptr) {
- mem_ola_add = new double[lc3Config.NF - lc3Config.Z];
- t_hat_mdct = new double[2 * lc3Config.NF];
- x_hat_mdct = new double[lc3Config.NF];
- for (uint16_t n = 0; n < (lc3Config.NF - lc3Config.Z); n++) {
- mem_ola_add[n] = 0;
- }
-
- // Note: we do not add additional configuration error checking at this level.
- // We assume that there will be nor processing with invalid configuration,
- // thus nonsense results for invalid lc3Config.N_ms and/or lc3Config.Fs_ind
- // are accepted here.
- wN = w_N80; // default initialization to avoid warnings
- if (lc3Config.N_ms == Lc3Config::FrameDuration::d7p5ms) {
- switch (lc3Config.NF) {
- case 60:
- wN = w_N60_7p5ms;
- break;
- case 120:
- wN = w_N120_7p5ms;
- break;
- case 180:
- wN = w_N180_7p5ms;
- break;
- case 240:
- wN = w_N240_7p5ms;
- break;
- case 360:
- wN = w_N360_7p5ms;
- break;
- }
- } else {
- // Lc3Config::FrameDuration::d10ms (and other as fallback)
- switch (lc3Config.NF) {
- case 80:
- wN = w_N80;
- break;
- case 160:
- wN = w_N160;
- break;
- case 240:
- wN = w_N240;
- break;
- case 320:
- wN = w_N320;
- break;
- case 480:
- wN = w_N480;
- break;
- }
- }
-}
-
-MdctDec::~MdctDec() {
- if (nullptr != mem_ola_add) {
- delete[] mem_ola_add;
- }
- if (nullptr != t_hat_mdct) {
- delete[] t_hat_mdct;
- }
- if (nullptr != x_hat_mdct) {
- delete[] x_hat_mdct;
- }
-}
-
-void MdctDec::MdctInvFastDbl() {
- dctIVDbl.run();
-
- for (uint16_t n = 0; n < lc3Config.NF; n++) {
- t_hat_mdct[n] = dctIVDbl.out[n];
- }
- for (uint16_t n = lc3Config.NF; n < 2 * lc3Config.NF; n++) {
- t_hat_mdct[n] = -dctIVDbl.out[2 * lc3Config.NF - 1 - n];
- }
-
- // TODO try to optimize out the mem-buffer
- double mem[lc3Config.NF / 2];
- for (uint16_t n = 0; n < lc3Config.NF / 2; n++) {
- mem[n] = t_hat_mdct[n];
- }
- for (uint16_t n = 0; n < 3 * lc3Config.NF / 2; n++) {
- t_hat_mdct[n] = t_hat_mdct[n + lc3Config.NF / 2];
- }
- for (uint16_t n = 3 * lc3Config.NF / 2; n < 2 * lc3Config.NF; n++) {
- t_hat_mdct[n] = -mem[n - 3 * lc3Config.NF / 2];
- }
-
- double gain = 1.0 / sqrt(2.0 * lc3Config.NF);
- for (uint16_t n = 0; n < 2 * lc3Config.NF; n++) {
- t_hat_mdct[n] *= gain;
- }
-}
-
-void MdctDec::run(const double* const X_hat) {
- if (!lc3Config.isValid()) {
- return;
- }
-
- for (uint16_t k = 0; k < lc3Config.NE; k++) {
- dctIVDbl.in[k] = X_hat[k];
- }
- for (uint16_t k = lc3Config.NE; k < lc3Config.NF; k++) {
- dctIVDbl.in[k] = 0;
- }
-
- // 1. Generation of time domain aliasing buffer
- MdctInvFastDbl();
-
- // 2. Windowing of time-aliased buffer
- for (uint16_t n = 0; n < 2 * lc3Config.NF; n++) {
- t_hat_mdct[n] *= wN[2 * lc3Config.NF - 1 - n];
- }
-
- // 3. Conduct overlapp-add operation
- for (uint16_t n = 0; n < lc3Config.NF - lc3Config.Z; n++) {
- x_hat_mdct[n] = mem_ola_add[n] + t_hat_mdct[lc3Config.Z + n];
- mem_ola_add[n] = t_hat_mdct[lc3Config.NF + lc3Config.Z + n];
- }
- for (uint16_t n = lc3Config.NF - lc3Config.Z; n < lc3Config.NF; n++) {
- x_hat_mdct[n] = t_hat_mdct[lc3Config.Z + n];
- }
-}
-
-void MdctDec::registerDatapoints(DatapointContainer* datapoints) {
- if (nullptr != datapoints) {
- datapoints->addDatapoint("X_hat_mdct", dctIVDbl.in,
- sizeof(double) * lc3Config.NF);
- datapoints->addDatapoint("t_hat_mdct", t_hat_mdct,
- sizeof(double) * 2 * lc3Config.NF);
- datapoints->addDatapoint("mem_ola_add", mem_ola_add,
- sizeof(double) * (lc3Config.NF - lc3Config.Z));
- datapoints->addDatapoint("x_hat_mdct", x_hat_mdct,
- sizeof(double) * lc3Config.NF);
- }
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/MdctDec.hpp b/system/embdrv/lc3_dec/Decoder/MdctDec.hpp
deleted file mode 100644
index 86e3ab6..0000000
--- a/system/embdrv/lc3_dec/Decoder/MdctDec.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * MdctDec.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef MDCT_DEC_H_
-#define MDCT_DEC_H_
-
-#include <cstdint>
-
-#include "Datapoints.hpp"
-#include "DctIV.hpp"
-#include "Lc3Config.hpp"
-
-namespace Lc3Dec {
-
-class MdctDec {
- public:
- MdctDec(const Lc3Config& lc3Config_);
- virtual ~MdctDec();
-
- void registerDatapoints(DatapointContainer* datapoints);
-
- void run(const double* const X_hat);
-
- const Lc3Config& lc3Config;
- double* x_hat_mdct;
-
- private:
- void MdctInvFastDbl();
-
- DctIVDbl dctIVDbl;
- double* mem_ola_add;
- double* t_hat_mdct;
- double* wN;
-};
-
-} // namespace Lc3Dec
-
-#endif // MDCT_DEC_H_
diff --git a/system/embdrv/lc3_dec/Decoder/PacketLossConcealment.cpp b/system/embdrv/lc3_dec/Decoder/PacketLossConcealment.cpp
deleted file mode 100644
index 0d03880..0000000
--- a/system/embdrv/lc3_dec/Decoder/PacketLossConcealment.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * PacketLossConcealment.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "PacketLossConcealment.hpp"
-
-namespace Lc3Dec {
-
-PacketLossConcealment::PacketLossConcealment(uint16_t NE_)
- : NE(NE_),
- plc_seed(24607), // this initialization need not be done every frame as
- // clarified by Errata 15114
- nbLostCmpt(0),
- alpha(1),
- X_hat_lastGood(nullptr) {
- X_hat_lastGood = new double[NE];
- for (uint16_t k = 0; k < NE; k++) {
- X_hat_lastGood[k] = 0.0;
- }
-}
-
-PacketLossConcealment::~PacketLossConcealment() { delete[] X_hat_lastGood; }
-
-void PacketLossConcealment::run(uint8_t BEC_detect, double* X_hat,
- int16_t& ltpf_active) {
- // Appendix B. Packet Loss Concealment (d09r02_F2F)
- if (0 == BEC_detect) {
- nbLostCmpt = 0;
- alpha = 1;
- for (uint16_t k = 0; k < NE; k++) {
- X_hat_lastGood[k] = X_hat[k];
- }
- } else {
- ltpf_active = 0; // errata 15097 implemented
-
- if (nbLostCmpt < 0xFF) {
- nbLostCmpt++;
- }
-
- // Note: from (d09r02_F2F) its is not perfectly clear,
- // whether alpha is modified before or after applying
- // it to the spectrum -> we may have to check the
- // given implementation with the LC3.exe reference
- if (nbLostCmpt >= 8) {
- alpha = 0.85 * alpha;
- } else if (nbLostCmpt >= 4) {
- alpha = 0.9 * alpha;
- }
-
- for (uint16_t k = 0; k < NE; k++) {
- plc_seed = (16831 + plc_seed * 12821) & 0xFFFF;
- if (plc_seed < 0x8000) {
- X_hat[k] = alpha * X_hat_lastGood[k];
- } else {
- X_hat[k] = -alpha * X_hat_lastGood[k];
- }
- }
- }
-}
-
-void PacketLossConcealment::registerDatapoints(DatapointContainer* datapoints) {
- if (nullptr != datapoints) {
- datapoints->addDatapoint("X_hat_lastGood", &X_hat_lastGood[0],
- sizeof(double) * NE);
- }
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/PacketLossConcealment.hpp b/system/embdrv/lc3_dec/Decoder/PacketLossConcealment.hpp
deleted file mode 100644
index e3eb067..0000000
--- a/system/embdrv/lc3_dec/Decoder/PacketLossConcealment.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * PacketLossConcealment.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef PACKET_LOSS_CONCEALMENT_H_
-#define PACKET_LOSS_CONCEALMENT_H_
-
-#include <cstdint>
-
-#include "Datapoints.hpp"
-
-namespace Lc3Dec {
-
-class PacketLossConcealment {
- public:
- PacketLossConcealment(uint16_t NE_);
- virtual ~PacketLossConcealment();
-
- void registerDatapoints(DatapointContainer* datapoints);
-
- void run(uint8_t BER_DETECT, double* X_hat, int16_t& ltpf_active);
-
- const uint16_t NE;
-
- private:
- uint16_t plc_seed;
- uint8_t nbLostCmpt;
- double alpha;
- double* X_hat_lastGood;
-};
-
-} // namespace Lc3Dec
-
-#endif // PACKET_LOSS_CONCEALMENT_H_
diff --git a/system/embdrv/lc3_dec/Decoder/ResidualSpectrum.cpp b/system/embdrv/lc3_dec/Decoder/ResidualSpectrum.cpp
deleted file mode 100644
index 55453ad..0000000
--- a/system/embdrv/lc3_dec/Decoder/ResidualSpectrum.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * ResidualSpectrum.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "ResidualSpectrum.hpp"
-
-#include <cmath>
-
-#include "BitReader.hpp"
-
-namespace Lc3Dec {
-
-ResidualSpectrum::ResidualSpectrum(uint16_t NE_)
- : NE(NE_), X_hat_q_residual(nullptr), nResBits(0) {
- X_hat_q_residual = new double[NE];
-}
-
-ResidualSpectrum::~ResidualSpectrum() { delete[] X_hat_q_residual; }
-
-void ResidualSpectrum::run(
- const uint8_t* bytes, uint16_t& bp_side, uint8_t& mask_side,
- const uint16_t lastnz, const int16_t* const X_hat_q_ari,
- uint16_t const nbits_residual, // the const is implementation dependent and
- // thus not repeated in header declaration
- uint8_t* save_lev, const uint8_t& lsbMode, uint16_t& nf_seed,
- uint16_t& zeroFrame, const int16_t gg_ind, int16_t F_NF) {
- // 3.4.2.6 Residual data and finalization (d09r02_F2F)
- /* Decode residual bits */
- for (uint16_t k = 0; k < lastnz; k++) {
- X_hat_q_residual[k] = X_hat_q_ari[k];
- }
- // for (k = lastnz; k < 𝑁𝐸; k++)
- for (uint16_t k = lastnz; k < NE; k++) {
- //𝑋𝑞 ̂[k] = 0;
- X_hat_q_residual[k] = 0;
- }
- uint8_t resBits[nbits_residual];
- uint16_t remaining_nbits_residual =
- nbits_residual; // changed relative to specification to ensure const
- // input into array allocation
- nResBits = 0;
- if (lsbMode == 0) {
- // for (k = 0; k < 𝑁𝐸; k++)
- for (uint16_t k = 0; k < NE; k++) {
- // if (𝑋𝑞 ̂[k] != 0)
- if (X_hat_q_residual[k] != 0) {
- if (nResBits == remaining_nbits_residual) {
- break;
- }
- resBits[nResBits++] = read_bit(bytes, &bp_side, &mask_side);
- }
- }
- } else {
- for (uint16_t k = 0; k < lastnz; k += 2) {
- if (save_lev[k] > 0) {
- if (remaining_nbits_residual == 0) {
- break;
- }
- uint8_t bit = read_bit(bytes, &bp_side, &mask_side);
- remaining_nbits_residual--;
- if (bit == 1) {
- // if (𝑋𝑞 ̂[k] > 0)
- if (X_hat_q_residual[k] > 0) {
- //𝑋𝑞 ̂[k] += 1;
- X_hat_q_residual[k] += 1;
- }
- // else if (𝑋𝑞 ̂[k] < 0)
- else if (X_hat_q_residual[k] < 0) {
- //𝑋𝑞 ̂[k] -= 1;
- X_hat_q_residual[k] -= 1;
- } else {
- if (remaining_nbits_residual == 0) {
- break;
- }
- bit = read_bit(bytes, &bp_side, &mask_side);
- remaining_nbits_residual--;
- if (bit == 0) {
- //𝑋𝑞 ̂[k] = 1;
- X_hat_q_residual[k] = 1;
- } else {
- //𝑋𝑞 ̂[k] = -1;
- X_hat_q_residual[k] = -1;
- }
- }
- }
- if (remaining_nbits_residual == 0) {
- break;
- }
- bit = read_bit(bytes, &bp_side, &mask_side);
- remaining_nbits_residual--;
- if (bit == 1) {
- // if (𝑋𝑞 ̂[k+1] > 0)
- if (X_hat_q_residual[k + 1] > 0) {
- //𝑋𝑞 ̂[k+1] += 1;
- X_hat_q_residual[k + 1] += 1;
- }
- // else if (𝑋𝑞 ̂[k+1] < 0)
- else if (X_hat_q_residual[k + 1] < 0) {
- //𝑋𝑞 ̂[k+1] -= 1;
- X_hat_q_residual[k + 1] -= 1;
- } else {
- if (remaining_nbits_residual == 0) {
- break;
- }
- bit = read_bit(bytes, &bp_side, &mask_side);
- remaining_nbits_residual--;
- if (bit == 0) {
- //𝑋𝑞 ̂[k+1] = 1;
- X_hat_q_residual[k + 1] = 1;
- } else {
- //𝑋𝑞 ̂[k+1] = -1;
- X_hat_q_residual[k + 1] = -1;
- }
- }
- }
- }
- }
- }
-
- /* Noise Filling Seed */
- int16_t tmp = 0;
- // for (k = 0; k < 𝑁𝐸; k++)
- for (uint16_t k = 0; k < NE; k++) {
- // tmp += abs(𝑋𝑞 ̂[k]) * k;
- tmp += abs(X_hat_q_residual[k]) * k;
- }
- nf_seed = tmp & 0xFFFF; /* Note that both tmp and nf_seed are 32-bit int*/
- /* Zero frame flag */
- // if (lastnz == 2 && 𝑋𝑞 ̂[0] == 0 && 𝑋𝑞 ̂[1] == 0 && 𝑔𝑔𝑖𝑛𝑑 == 0 && 𝐹𝑁𝐹 == 7)
- if ((lastnz == 2) && (X_hat_q_residual[0] == 0.0) &&
- (X_hat_q_residual[1] == 0.0) && (gg_ind == 0) && (F_NF == 7)) {
- zeroFrame = 1;
- } else {
- zeroFrame = 0;
- }
-
- // 3.4.3 Residual decoding (d09r02_F2F)
- // Residual decoding is performed only when lsbMode is 0.
- if (lsbMode == 0) {
- uint16_t k, n;
- k = n = 0;
- // while (k < 𝑁𝐸 && n < nResBits)
- while (k < NE && n < nResBits) {
- // if (𝑋𝑞 ̂[k] != 0)
- if (X_hat_q_residual[k] != 0) {
- if (resBits[n++] == 0) {
- // if (𝑋𝑞 ̂[k] > 0)
- if (X_hat_q_residual[k] > 0) {
- //𝑋𝑞 ̂[k] -= 0.1875;
- X_hat_q_residual[k] -= 0.1875;
- } else {
- //𝑋𝑞 ̂[k] -= 0.3125;
- X_hat_q_residual[k] -= 0.3125;
- }
- } else {
- // if (𝑋𝑞 ̂[k] > 0)
- if (X_hat_q_residual[k] > 0) {
- //𝑋𝑞 ̂[k] += 0.3125;
- X_hat_q_residual[k] += 0.3125;
- } else {
- //𝑋𝑞 ̂[k] += 0.1875;
- X_hat_q_residual[k] += 0.1875;
- }
- }
- }
- k++;
- }
- }
-}
-
-void ResidualSpectrum::registerDatapoints(DatapointContainer* datapoints) {
- if (nullptr != datapoints) {
- datapoints->addDatapoint("X_hat_q_residual", &X_hat_q_residual[0],
- sizeof(double) * NE);
- }
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/ResidualSpectrum.hpp b/system/embdrv/lc3_dec/Decoder/ResidualSpectrum.hpp
deleted file mode 100644
index 2f13a57..0000000
--- a/system/embdrv/lc3_dec/Decoder/ResidualSpectrum.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ResidualSpectrum.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef RESIDUAL_SPECTRUM_H_
-#define RESIDUAL_SPECTRUM_H_
-
-#include <cstdint>
-
-#include "Datapoints.hpp"
-
-namespace Lc3Dec {
-
-class ResidualSpectrum {
- public:
- ResidualSpectrum(uint16_t NE_);
-
- virtual ~ResidualSpectrum();
-
- void registerDatapoints(DatapointContainer* datapoints);
-
- void run(const uint8_t* bytes, uint16_t& bp_side, uint8_t& mask_side,
- const uint16_t lastnz, const int16_t* const X_hat_q_ari,
- uint16_t nbits_residual, uint8_t* save_lev, const uint8_t& lsbMode,
- uint16_t& nf_seed, uint16_t& zeroFrame, const int16_t gg_ind,
- int16_t F_NF);
-
- const uint16_t NE;
-
- double* X_hat_q_residual;
- uint16_t nResBits;
-
- private:
-};
-
-} // namespace Lc3Dec
-
-#endif // RESIDUAL_SPECTRUM_H_
diff --git a/system/embdrv/lc3_dec/Decoder/SideInformation.cpp b/system/embdrv/lc3_dec/Decoder/SideInformation.cpp
deleted file mode 100644
index 4516aab..0000000
--- a/system/embdrv/lc3_dec/Decoder/SideInformation.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * SideInformation.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "SideInformation.hpp"
-
-#include <cmath>
-
-#include "BitReader.hpp"
-
-namespace Lc3Dec {
-
-static const uint8_t nbits_bw_table[5] = {
- 0, 1, 2, 2, 3}; // see 3.4.2.4 Bandwidth interpretation (d09r02_F2F)
-
-SideInformation::SideInformation(uint16_t NF_, uint16_t NE_, uint8_t fs_ind_)
- : NF(NF_),
- NE(NE_),
- fs_ind(fs_ind_),
- nbits_bw(nbits_bw_table[fs_ind]),
- submodeMSB(0),
- submodeLSB(0) {}
-
-SideInformation::~SideInformation() {}
-
-void SideInformation::dec_split_st2VQ_CW(uint32_t cwRx, uint32_t szA,
- uint32_t szB, uint8_t& BEC_detect,
- int16_t& submodeLSB, int32_t& idxA,
- int32_t& idxBorGainLSB) {
- if (cwRx >= szB * szA) {
- idxA = 0;
- idxBorGainLSB = 0;
- submodeLSB = 0;
- BEC_detect = 1;
- return;
- }
- idxBorGainLSB = floor(cwRx / szA);
- idxA = cwRx - idxBorGainLSB * szA;
- submodeLSB = 0;
- idxBorGainLSB = idxBorGainLSB - 2;
- if (idxBorGainLSB < 0) {
- submodeLSB = 1;
- }
-
- idxBorGainLSB = idxBorGainLSB + 2 * submodeLSB;
- // BEC_detect = 0; // changed in comparision to specification -> variable is
- // handles as reference to overall BEC_detect
-}
-
-void SideInformation::run(const uint8_t* bytes, uint16_t& bp_side,
- uint8_t& mask_side, int16_t& P_BW, int16_t& lastnz,
- uint8_t& lsbMode, int16_t& gg_ind,
- int16_t& num_tns_filters, int16_t* rc_order,
- uint8_t& pitch_present, int16_t& pitch_index,
- int16_t& ltpf_active, int16_t& F_NF, int16_t& ind_LF,
- int16_t& ind_HF, int16_t& Gind, int16_t& LS_indA,
- int16_t& LS_indB, int32_t& idxA, int16_t& idxB,
-
- uint8_t& BEC_detect) {
- // 5.4.2.3 Side information
- /* Bandwidth */
- if (nbits_bw > 0) {
- P_BW = read_uint(bytes, &bp_side, &mask_side, nbits_bw);
- if (fs_ind < P_BW) {
- BEC_detect = 1;
- return;
- }
- } else {
- P_BW = 0;
- }
- /* Last non-zero tuple */
- nbits_lastnz = ceil(log2(NE / 2));
- int16_t tmp_lastnz = read_uint(bytes, &bp_side, &mask_side, nbits_lastnz);
- lastnz = (tmp_lastnz + 1) << 1;
- if (lastnz > NE) {
- /* consider this as bit error (BEC) */
- BEC_detect = 1;
- return;
- }
- /* LSB mode bit */
- lsbMode = read_bit(bytes, &bp_side, &mask_side);
- /* Global Gain */
- gg_ind = read_uint(bytes, &bp_side, &mask_side, 8);
- /* TNS activation flag */
- if (P_BW < 3) {
- num_tns_filters = 1;
- } else {
- num_tns_filters = 2;
- }
- rc_order[0] = 0; // not specified, but on the safe side
- rc_order[1] = 0; // not specified, but on the safe side
- for (uint8_t f = 0; f < num_tns_filters; f++) {
- rc_order[f] = read_bit(bytes, &bp_side, &mask_side);
- }
- /* Pitch present flag */
- pitch_present = read_bit(bytes, &bp_side, &mask_side);
- /* SNS-VQ integer bits */
- /* Read 5+5 bits of SNQ VQ decoding stage 1 according to Section 5.4.7.2.1
- * (d09r01) */
- /* Read 5+5 bits of SNQ VQ decoding stage 1 according to Section 3.4.7.2.1
- * (d09r02)(d09r02_F2F) */
- ind_LF = read_uint(bytes, &bp_side, &mask_side, 5); /* stage1 LF */
- ind_HF = read_uint(bytes, &bp_side, &mask_side, 5); /* stage1 HF */
-
- /* Read 28 bits of SNS VQ decoding stage 2 according to section 5.4.7.2.2
- * (d09r01) */
- // 3.4.7.2.2 Stage 2 SNS VQ decoding (d09r02_F2F)
- submodeMSB = read_bit(bytes, &bp_side, &mask_side);
- if (submodeMSB == 0) {
- Gind = read_uint(bytes, &bp_side, &mask_side, 1);
- } else {
- Gind = read_uint(bytes, &bp_side, &mask_side, 2);
- }
- LS_indA = read_bit(bytes, &bp_side, &mask_side); /* LS_indA 1 bit */
- if (submodeMSB == 0) {
- /* ‘regular’/’regular_lf’ demultiplexing, establish if shape_j is 0 or 1 */
- uint32_t tmp = read_uint(bytes, &bp_side, &mask_side, 13);
- tmp |= (read_uint(bytes, &bp_side, &mask_side, 12) << 13);
- int32_t idxBorGainLSB;
- //[ BEC_detect, submodeLSB, idxA, idxBorGainLSB ] = dec_split_st2VQ_CW(tmp,
- // 4780008U>>1, 14 );
- dec_split_st2VQ_CW(tmp, 4780008U >> 1, 14, BEC_detect, submodeLSB, idxA,
- idxBorGainLSB);
- if (BEC_detect) {
- // early exit to avoid unpredictable side-effects
- return;
- }
- if (submodeLSB != 0) {
- Gind = (Gind << 1) + idxBorGainLSB; /* for regular_lf */
- // just set some defined values (although nothing is specified for this
- // case)
- idxB = 0;
- LS_indB = 0;
- } else {
- idxB = idxBorGainLSB >> 1; /* for regular */
- LS_indB = idxBorGainLSB & 0x1;
- }
- } else {
- // Attention: the given reference intermediate results do not cover
- // this case -> tested with conformance tests only! (successful operation
- // observed already)
- /* outlier_* demultiplexing, establish if shape_j is 2 or 3 */
- int32_t tmp = read_uint(bytes, &bp_side, &mask_side, 12);
- tmp |=
- static_cast<int32_t>(read_uint(bytes, &bp_side, &mask_side, 12) << 12);
- idxA = tmp;
- // idxB = -1; // removed in pseudo-code of d09r02_F2F
- submodeLSB = 0;
- // this intialization does not seem to be correct here
- // (just from code reading; context of pseudo-code in specification is not
- // clear)
- // BEC_detect = 0;
- if (tmp >= static_cast<int32_t>((30316544U >> 1) + 1549824U)) {
- BEC_detect = 1;
- return;
- } else {
- tmp -= static_cast<int32_t>(30316544U >> 1);
- if (tmp >= 0) {
- submodeLSB = 1;
- Gind = (Gind << 1) + (tmp & 0x1);
- idxA = tmp >> 1;
- }
- }
- }
-
- /* LTPF data */
- if (pitch_present != 0) {
- ltpf_active = read_uint(bytes, &bp_side, &mask_side, 1);
- pitch_index = read_uint(bytes, &bp_side, &mask_side, 9);
- }
-
- /* Noise Level */
- F_NF = read_uint(bytes, &bp_side, &mask_side, 3);
-}
-
-void SideInformation::registerDatapoints(DatapointContainer* datapoints) {
- if (nullptr != datapoints) {
- datapoints->addDatapoint("nbits_lastnz", &nbits_lastnz,
- sizeof(nbits_lastnz));
- datapoints->addDatapoint("submodeMSB", &submodeMSB, sizeof(submodeMSB));
- }
-}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/SideInformation.hpp b/system/embdrv/lc3_dec/Decoder/SideInformation.hpp
deleted file mode 100644
index e6df7e4..0000000
--- a/system/embdrv/lc3_dec/Decoder/SideInformation.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SideInformation.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef SIDE_INFORMATION_H_
-#define SIDE_INFORMATION_H_
-
-#include <cstdint>
-
-#include "Datapoints.hpp"
-
-namespace Lc3Dec {
-
-class SideInformation {
- public:
- SideInformation(uint16_t NF_, uint16_t NE_, uint8_t fs_ind_);
-
- virtual ~SideInformation();
-
- void registerDatapoints(DatapointContainer* datapoints);
-
- void run(const uint8_t* bytes, uint16_t& bp_side, uint8_t& mask_side,
- int16_t& P_BW, int16_t& lastnz, uint8_t& lsbMode, int16_t& gg_ind,
- int16_t& num_tns_filters, int16_t* rc_order, uint8_t& pitch_present,
- int16_t& pitch_index, int16_t& ltpf_active, int16_t& F_NF,
- int16_t& ind_LF, int16_t& ind_HF, int16_t& Gind, int16_t& LS_indA,
- int16_t& LS_indB, int32_t& idxA, int16_t& idxB,
-
- uint8_t& BEC_detect);
-
- const uint16_t NF;
- const uint16_t NE;
- const uint8_t fs_ind;
- const uint8_t nbits_bw;
-
- int16_t submodeMSB;
- int16_t submodeLSB;
-
- private:
- uint8_t nbits_lastnz;
-
- void dec_split_st2VQ_CW(uint32_t cwRx, uint32_t szA, uint32_t szB,
- uint8_t& BEC_detect, int16_t& submodeLSB,
- int32_t& idxA, int32_t& idxBorGainLSB);
-};
-
-} // namespace Lc3Dec
-
-#endif // SIDE_INFORMATION_H_
diff --git a/system/embdrv/lc3_dec/Decoder/SpectralNoiseShaping.cpp b/system/embdrv/lc3_dec/Decoder/SpectralNoiseShaping.cpp
deleted file mode 100644
index b07de9d..0000000
--- a/system/embdrv/lc3_dec/Decoder/SpectralNoiseShaping.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * SpectralNoiseShaping.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include "SpectralNoiseShaping.hpp"
-
-#include <cmath>
-
-#include "BandIndexTables.hpp"
-#include "MPVQ.hpp"
-#include "SnsQuantizationTables.hpp"
-
-namespace Lc3Dec {
-
-SpectralNoiseShaping::SpectralNoiseShaping(const Lc3Config& lc3Config_)
- : lc3Config(lc3Config_), I_fs(nullptr) {
- // Note: we do not add additional configuration error checking at this level.
- // We assume that there will be nor processing with invalid configuration,
- // thus nonsense results for invalid lc3Config.N_ms and/or lc3Config.Fs_ind
- // are accepted here.
- if (lc3Config.N_ms == Lc3Config::FrameDuration::d7p5ms) {
- switch (lc3Config.Fs_ind) {
- case 0:
- I_fs = &I_8000_7p5ms[0];
- break;
- case 1:
- I_fs = &I_16000_7p5ms[0];
- break;
- case 2:
- I_fs = &I_24000_7p5ms[0];
- break;
- case 3:
- I_fs = &I_32000_7p5ms[0];
- break;
- case 4:
- I_fs = &I_48000_7p5ms[0];
- break;
- }
- } else {
- // Lc3Config::FrameDuration::d10ms (and other as fallback)
- switch (lc3Config.Fs_ind) {
- case 0:
- I_fs = &I_8000[0];
- break;
- case 1:
- I_fs = &I_16000[0];
- break;
- case 2:
- I_fs = &I_24000[0];
- break;
- case 3:
- I_fs = &I_32000[0];
- break;
- case 4:
- I_fs = &I_48000[0];
- break;
- }
- }
-}
-
-SpectralNoiseShaping::~SpectralNoiseShaping() {}
-
-void SpectralNoiseShaping::run(const double* const X_s_tns,
- double* const X_hat_ss, int16_t ind_LF,
- int16_t ind_HF, int16_t submodeMSB,
- int16_t submodeLSB, int16_t Gind,
- int16_t LS_indA, int16_t LS_indB, int32_t idxA,
- int16_t idxB) {
- if (!lc3Config.isValid()) {
- return;
- }
-
- // 3.4.7 SNS decoder (d09r02_F2F)
- // 3.4.7.2 SNS scale factor decoding (d09r02_F2F)
- // 3.4.7.2.1 Stage 1 SNS VQ decoding (d09r02_F2F)
- // already done earlier (see SideInformation)
-
- // The first stage vector is composed as:
- //𝑠𝑡1(𝑛) = 𝐿𝐹𝐶𝐵𝑖𝑛𝑑_𝐿𝐹 (𝑛), 𝑓𝑜𝑟 𝑛 = [0 … 7], # (33)
- //𝑠𝑡1(𝑛 + 8) = 𝐻𝐹𝐶𝐵𝑖𝑛𝑑_𝐻𝐹(𝑛), 𝑓𝑜𝑟 𝑛 = [0 … 7], # (34)
- double st1[16];
- for (uint8_t n = 0; n < 8; n++) {
- st1[n] = LFCB[ind_LF][n];
- st1[n + 8] = HFCB[ind_HF][n];
- }
-
- // 3.4.7.2.2 Stage 2 SNS VQ decoding (d09r02_F2F)
- // already done earlier -> submodeMSB, Gind, LS_indA, LS_indB, idxA, idxB
- int16_t shape_j = (submodeMSB << 1) + submodeLSB;
- int16_t gain_i = Gind;
-
- int16_t y[16];
- int16_t z[16];
-
- switch (shape_j) {
- case 0:
- MPVQdeenum(10, 10, LS_indA, idxA, y);
- MPVQdeenum(6, 1, LS_indB, idxB, z);
- for (uint8_t n = 10; n <= 15; n++) {
- y[n] = z[n - 10];
- }
- break;
- case 1:
- MPVQdeenum(10, 10, LS_indA, idxA, y);
- for (uint8_t n = 10; n <= 15; n++) {
- y[n] = 0;
- }
- break;
- case 2:
- MPVQdeenum(16, 8, LS_indA, idxA, y);
- break;
- case 3:
- MPVQdeenum(16, 6, LS_indA, idxA, y);
- break;
- }
-
- double yNorm = 0;
- for (uint8_t n = 0; n < 16; n++) {
- // yNorm += y[n]*(y[n]*1.0);
- yNorm += y[n] * y[n];
- }
- yNorm = std::sqrt(yNorm);
- // Note: we skipped intermediate signal xq_shape_j and applied yNorm
- // directly together with G_gain_i_shape_j
-
- double G_gain_i_shape_j =
- sns_vq_far_adj_gains[gain_i]; // default initialization to avoid warnings
- switch (shape_j) {
- case 0:
- G_gain_i_shape_j = sns_vq_reg_adj_gains[gain_i];
- break;
- case 1:
- G_gain_i_shape_j = sns_vq_reg_lf_adj_gains[gain_i];
- break;
- case 2:
- G_gain_i_shape_j = sns_vq_near_adj_gains[gain_i];
- break;
- case 3:
- G_gain_i_shape_j = sns_vq_far_adj_gains[gain_i];
- break;
- }
- if (0.0 != yNorm) // do we have to make this even more robust???
- {
- G_gain_i_shape_j /= yNorm;
- }
-
- // Synthesis of the Quantized SNS scale factor vector
- double scfQ[16];
- for (uint8_t n = 0; n < 16; n++) {
- double factor = 0;
- for (uint8_t col = 0; col < 16; col++) {
- factor += y[col] * D[n][col];
- }
- scfQ[n] = st1[n] + G_gain_i_shape_j * factor;
- }
-
- // 3.4.7.3 SNS scale factors interpolation (d09r02_F2F)
- double scfQint[64];
- scfQint[0] = scfQ[0];
- scfQint[1] = scfQ[0];
- for (uint8_t n = 0; n <= 14; n++) {
- scfQint[4 * n + 2] = scfQ[n] + (1.0 / 8.0 * (scfQ[n + 1] - scfQ[n]));
- scfQint[4 * n + 3] = scfQ[n] + (3.0 / 8.0 * (scfQ[n + 1] - scfQ[n]));
- scfQint[4 * n + 4] = scfQ[n] + (5.0 / 8.0 * (scfQ[n + 1] - scfQ[n]));
- scfQint[4 * n + 5] = scfQ[n] + (7.0 / 8.0 * (scfQ[n + 1] - scfQ[n]));
- }
- scfQint[62] = scfQ[15] + 1 / 8.0 * (scfQ[15] - scfQ[14]);
- scfQint[63] = scfQ[15] + 3 / 8.0 * (scfQ[15] - scfQ[14]);
-
- // add special handling for lc3Config.N_b=60 (happens for 7.5ms and fs=8kHz)
- // see section 3.4.7.3 SNS scale factors interpolation (d1.0r03 including
- // Errata 15036)
- const uint8_t n2 = 64 - lc3Config.N_b;
- if (n2 != 0) {
- for (uint8_t i = 0; i < n2; i++) {
- scfQint[i] = (scfQint[2 * i] + scfQint[2 * i + 1]) / 2;
- }
- for (uint8_t i = n2; i < lc3Config.N_b; i++) {
- scfQint[i] = scfQint[i + n2];
- }
- }
-
- double g_SNS[64];
- for (uint8_t b = 0; b < lc3Config.N_b; b++) {
- g_SNS[b] = exp2(scfQint[b]);
- }
-
- // 3.4.7.4 Spectral Shaping (d09r02_F2F)
- // for (b=0; b<𝑁𝑏; b++)
- for (uint8_t b = 0; b < lc3Config.N_b; b++) {
- // for (k=𝐼𝑓𝑠 (𝑏); k< 𝐼𝑓𝑠 (𝑏 + 1); k++)
- for (uint16_t k = I_fs[b]; k < I_fs[b + 1]; k++) {
- //𝑋 ̂(𝑘) = 𝑋𝑆 ̂(𝑘) ∙ 𝑔𝑆𝑁𝑆 (𝑏)
- X_hat_ss[k] = X_s_tns[k] * g_SNS[b];
- }
- }
-}
-
-void SpectralNoiseShaping::registerDatapoints(DatapointContainer* datapoints) {}
-
-} // namespace Lc3Dec
diff --git a/system/embdrv/lc3_dec/Decoder/SpectralNoiseShaping.hpp b/system/embdrv/lc3_dec/Decoder/SpectralNoiseShaping.hpp
deleted file mode 100644
index 939e503..0000000
--- a/system/embdrv/lc3_dec/Decoder/SpectralNoiseShaping.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SpectralNoiseShaping.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef SPECTRAL_NOISE_SHAPING_H_
-#define SPECTRAL_NOISE_SHAPING_H_
-
-#include <cstdint>
-
-#include "Datapoints.hpp"
-#include "Lc3Config.hpp"
-
-namespace Lc3Dec {
-
-class SpectralNoiseShaping {
- public:
- SpectralNoiseShaping(const Lc3Config& lc3Config_);
-
- virtual ~SpectralNoiseShaping();
-
- void registerDatapoints(DatapointContainer* datapoints);
-
- void run(const double* const X_s_tns, double* const X_hat_ss, int16_t ind_LF,
- int16_t ind_HF, int16_t submodeMSB, int16_t submodeLSB, int16_t Gind,
- int16_t LS_indA, int16_t LS_indB, int32_t idxA, int16_t idxB);
-
- const Lc3Config& lc3Config;
-
- private:
- int* I_fs;
-};
-
-} // namespace Lc3Dec
-
-#endif // SPECTRAL_NOISE_SHAPING_H_
diff --git a/system/embdrv/lc3_dec/Readme.txt b/system/embdrv/lc3_dec/Readme.txt
deleted file mode 100644
index 859d9bb..0000000
--- a/system/embdrv/lc3_dec/Readme.txt
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Readme.txt
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA - www.ehima.com
- *
- * 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.
- */
-
-Contents
-========
- (1) Introduction
- (2) Directory Structure
- (3) Naming Conventions
- (4) General Code Structure
- (5) Test and Debug Support
-
-(1) Introduction
-================
-(derived from Bluetooth SIG LC3 specification dr09r06)
-The Low Complexity Communication Codec (LC3) is an efficient Bluetooth Audio Codec for use in
-audio profiles. This codec can encode speech and music at a variety of bitrates. The LC3 can
-be incorporated in any Bluetooth audio profile.
-
-The LC3 specification allows floating point and fixed point implementations as long as the
-resulting decoded audio signals are sufficiently close in quality. The given implementation
-exploits floating point operation in the majority of the code.
-
-To deliver satisfactory audio quality under all channel conditions, it is strongly recommended
-that some form of Packet Loss Concealment (PLC) should be implemented on the receiving ends of
-audio connections. The purpose of packet loss concealment is to conceal the effect of unavailable
-or corrupted frame data for decoding. The given code implements the example PLC algorithm provided
-in the informative Appendix B of the LC3 specification. Alternative PLC schemes are possible, but have
-to meet or exceed the performance of the given implementation.
-
-The initial implementation of this codec has been made in year 2019 in parallel to final
-improvements and extensions to the LC3 specification. The final implementation has been matched
-to the specification, however, references in the code to the specification are not adapted to
-the latest formal changes in the specification. Thus, the revision of the specification referenced
-is given with each reference, so that it should be possible to track the links to the specification.
-
-(2) Directory Structure
-=======================
- |- Api -> include files needed by calling application code
- |- Common | -> implementation needed by LC3 encoder and decoder
- | |-- KissFft -> source code of kissfft library used for fast transforms
- | |-- Tables -> tables as given in Section 3.7 "Tables and constants" (dr09r06)
- |- Decoder -> implementation of LC3 decoder (*.hpp and *.cpp)
- |- Encoder -> implementation of LC3 encoder (*.hpp and *.cpp)
- |- TestSupport -> interface and dummy/demo implementation of "datapoint" access
- for test and debug support
-
-(3) Naming Conventions and Coding Style
-=======================================
- Names of variables/objects have been chosen to be as close as possible
-to the naming within the LC3 specification. This applies not only to the
-selected wording, but also to the chosen case and concatenation of words.
- Thus, variable naming may appear somewhat unorthodox to a standard C/C++ developer
-and is not always consistent in style. Nevertheless, the close link to the specification
-document is considered most valuable so that this approach has been followed.
- The LC3 specification contains textual descriptions, equations, pseudo-code, tables
-and reference intermediate outputs. The naming of variables is not perfectly consistent,
-particularly in the case of names for intermediate outputs in relation to the
-specification text. Thus, there are situations where we had to select one name out of
-different options or had to choose different names for internal variables and
-"datapoints" provided for test and debug support.
-
- Some parts of the code are directly converted from pseudo-code given in
-the specification document. Changes compared to the specification are made only
-when supported by technical arguments. Again, the close link to the specification
-is considered most valuable. Note that this implies in some situations that code
-is not optimized in terms of computation effort, memory usage and/or clarity of its structure.
-
-Further Conventions:
- - indentation using 4 spaces; no TABS at all
- - directory, file and class names are camel-case starting with a capital letter
-
-
-(4) General Code Structure
-==========================
- The implementation is in C++ where object oriented programming is mainly used to
- formulate the relations of higher level modules/classes. The code of the lower level
- modules is syntactically C++, but the style is more like plain old procedural
- programming. The latter is mainly due to the goal of formulating the code very close
- to the specification - not only with respect to its overall behaviour but also with
- respect to the organization. This is particularly true for the modules depending
- heavily on converted pseudo-code from the LC3 specification.
-
- A brief overview on the main class relationships is summarized in the following
- basic diagrams.
-
- Encoder:
- --------
- Lc3Encoder : main API and handling of multi-channel sessions
- | |(1)------(1) Lc3Config : configuration instance
- |
- |(1)-------(lc3Config.Nc) EncoderTop : toplevel class for single channel session;
- | | dynamically reallocates EncoderFrame instance in case
- | | of bitrate changes
- | |
- | |--- holds all sub-modules directly that are not dependent
- | on variable bitrate;
- |
- |(1)-----(1) EncoderFrame : toplevel processing per frame and
- reallocation of sub-modules in case
- of bitrate changes
-
- Decoder:
- --------
- Lc3Decoder : main API and handling of multi-channel sessions
- | |(1)------(1) Lc3Config : configuration instance
- |
- |(1)-------(lc3Config.Nc) DecoderTop : toplevel class for single channel session;
- | | dynamically reallocates DecoderFrame instance in case
- | | of bitrate changes
- | |
- | |--- holds all sub-modules directly that are not dependent
- | on variable bitrate;
- |
- |(1)-----(1) DecoderFrame : toplevel processing per frame and
- reallocation of sub-modules in case
- of bitrate changes
-
-
-(5) Test and Debug Support
-==========================
-The development of the codec implementation has been strongly based on close match of
-intermediate values with specified reference values. To be able to access the proper
-values in a standardized manner a simple "datapoint" API has been created.
- Note: this API is not fully optimized for usage within in android but may be extended
-for this purpose in future.
- The given API can be found in "TestSupport/Datapoints.hpp" with a basic (mainly dummy) implementation
-given in "TestSupport/DatapointsAndroid.cpp".
- To use this API an instance of "DatapointContainer" has to be created and provided to the
-Lc3Encoder and Lc3Decoder constructors when needed. Note: that this is not intended for final releases
-due to the additional resources needed.
diff --git a/system/embdrv/lc3_dec/TestSupport/Datapoints.hpp b/system/embdrv/lc3_dec/TestSupport/Datapoints.hpp
deleted file mode 100644
index 5817c96..0000000
--- a/system/embdrv/lc3_dec/TestSupport/Datapoints.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Datapoints.hpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#ifndef __DATAPOINTS_HPP_
-#define __DATAPOINTS_HPP_
-
-#include <cstdint>
-
-class Datapoint;
-class ContainerRealization;
-
-class DatapointContainer {
- public:
- DatapointContainer();
- virtual ~DatapointContainer();
-
- void addDatapoint(const char* label, void* pData, uint16_t sizeInBytes);
- void addDatapoint(const char* label, const void* pData, uint16_t sizeInBytes);
- void log(const char* label, const void* pData, uint16_t sizeInBytes);
-
- uint16_t getDatapointSize(const char* label);
- bool getDatapointValue(const char* label, void* pDataBuffer,
- uint16_t bufferSize);
- bool setDatapointValue(const char* label, const void* pDataBuffer,
- uint16_t bufferSize);
-
- private:
- void addDatapoint(const char* label, Datapoint* pDatapoint);
- ContainerRealization* m_pContainer;
-};
-
-#endif // __DATAPOINTS_HPP_
diff --git a/system/embdrv/lc3_dec/TestSupport/DatapointsAndroid.cpp b/system/embdrv/lc3_dec/TestSupport/DatapointsAndroid.cpp
deleted file mode 100644
index 2caa962..0000000
--- a/system/embdrv/lc3_dec/TestSupport/DatapointsAndroid.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * DatapointsDummy.cpp
- *
- * Copyright 2021 HIMSA II K/S - www.himsa.com. Represented by EHIMA -
- * www.ehima.com
- *
- * 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.
- */
-
-#include <base/logging.h>
-
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-
-#include "Datapoints.hpp"
-
-class ContainerRealization {};
-
-DatapointContainer::DatapointContainer() : m_pContainer(nullptr) {
- // nothing stored yet; we may integrate a complete datapoint container when
- // more debugging is needed in the android context
- (void)m_pContainer;
-}
-
-DatapointContainer::~DatapointContainer() {}
-
-void DatapointContainer::addDatapoint(const char* label,
- Datapoint* pDatapoint) {}
-
-void DatapointContainer::addDatapoint(const char* label, void* pData,
- uint16_t sizeInBytes) {}
-
-void DatapointContainer::addDatapoint(const char* label, const void* pData,
- uint16_t sizeInBytes) {}
-
-void DatapointContainer::log(const char* label, const void* pData,
- uint16_t sizeInBytes) {
- // Note: this is just a first simple step to demonstrate the possibilities we
- // have.
- // In this case the datapoint label its size in bytes and its content as
- // hex-byte-stream is send to the android LOG.
- const uint8_t* pByteData = reinterpret_cast<const uint8_t*>(pData);
- std::string valueAsHexString("0x");
- std::ostringstream vStream;
- vStream << "0x";
- for (uint16_t byteNr = 0; byteNr < sizeInBytes; byteNr++) {
- vStream << std::right << std::setw(2) << std::setfill('0') << std::hex
- << static_cast<int>(pByteData[byteNr]);
- }
- // TODO: uncomment for testing
- // LOG(INFO) << label << "[" << sizeInBytes << "]:" << vStream.str();
-}
-
-uint16_t DatapointContainer::getDatapointSize(const char* label) { return 0; }
-
-bool DatapointContainer::getDatapointValue(const char* label, void* pDataBuffer,
- uint16_t bufferSize) {
- return false;
-}
-
-bool DatapointContainer::setDatapointValue(const char* label,
- const void* pDataBuffer,
- uint16_t bufferSize) {
- return false;
-}
diff --git a/system/embdrv/lc3_dec/fuzzer/liblc3codec_decoder_fuzzer.cpp b/system/embdrv/lc3_dec/fuzzer/liblc3codec_decoder_fuzzer.cpp
deleted file mode 100644
index e453e6e..0000000
--- a/system/embdrv/lc3_dec/fuzzer/liblc3codec_decoder_fuzzer.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2021 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.
- */
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include "../Api/Lc3Decoder.hpp"
-
-using FrameDuration = Lc3Config::FrameDuration;
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- FuzzedDataProvider fdp(data, size);
-
- uint16_t fs = fdp.PickValueInArray({8000, 16000, 24000, 32000, 44100, 48000});
- FrameDuration fd =
- fdp.PickValueInArray({FrameDuration::d10ms, FrameDuration::d7p5ms});
- uint8_t bfi = fdp.ConsumeIntegralInRange(0, 1);
- uint8_t bec_detect = fdp.ConsumeIntegralInRange(0, 1);
-
- uint16_t input_byte_count = fdp.ConsumeIntegralInRange(20, 400);
-
- if (fdp.remaining_bytes() < input_byte_count) {
- return 0;
- }
-
- std::vector<uint8_t> encoded_bytes(input_byte_count);
-
- fdp.ConsumeData(encoded_bytes.data(), encoded_bytes.size());
-
- uint16_t output_frame_count = Lc3Config(fs, fd, 1).NF;
- std::vector<uint16_t> decoded_data(output_frame_count * 2);
-
- Lc3Decoder decoder(fs, fd);
- decoder.run(encoded_bytes.data(), encoded_bytes.size(), bfi,
- (int16_t*)decoded_data.data(), output_frame_count, bec_detect, 0);
-
- return 0;
-}
\ No newline at end of file
diff --git a/system/embdrv/lc3_dec/fuzzer/liblc3codec_encoder_fuzzer.cpp b/system/embdrv/lc3_dec/fuzzer/liblc3codec_encoder_fuzzer.cpp
deleted file mode 100644
index e1014f7..0000000
--- a/system/embdrv/lc3_dec/fuzzer/liblc3codec_encoder_fuzzer.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2021 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.
- */
-#include <fuzzer/FuzzedDataProvider.h>
-
-#include "../Api/Lc3Encoder.hpp"
-
-using FrameDuration = Lc3Config::FrameDuration;
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- FuzzedDataProvider fdp(data, size);
-
- uint16_t fs = fdp.PickValueInArray({8000, 16000, 24000, 32000, 44100, 48000});
- FrameDuration fd =
- fdp.PickValueInArray({FrameDuration::d10ms, FrameDuration::d7p5ms});
- uint16_t output_byte_count = fdp.ConsumeIntegralInRange(20, 400);
-
- Lc3Config config(fs, fd, 1);
- if (config.getErrorStatus() != Lc3Config::ERROR_FREE) {
- return 0;
- }
-
- uint16_t num_frames = config.NF * config.Nc;
-
- if (fdp.remaining_bytes() < num_frames * 2) {
- return 0;
- }
-
- std::vector<uint16_t> input_frames(num_frames);
-
- fdp.ConsumeData(input_frames.data(),
- input_frames.size() * 2 /* each frame is 2 bytes */);
-
- Lc3Encoder encoder(config);
-
- std::vector<uint8_t> output(output_byte_count);
- encoder.run((const int16_t*)input_frames.data(), output_byte_count,
- output.data());
- return 0;
-}
\ No newline at end of file
diff --git a/system/gd/att/att_module.h b/system/gd/att/att_module.h
index a04993c..1322394 100644
--- a/system/gd/att/att_module.h
+++ b/system/gd/att/att_module.h
@@ -25,6 +25,9 @@
class AttModule : public bluetooth::Module {
public:
AttModule() = default;
+ AttModule(const AttModule&) = delete;
+ AttModule& operator=(const AttModule&) = delete;
+
~AttModule() = default;
static const ModuleFactory Factory;
@@ -41,7 +44,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
- DISALLOW_COPY_AND_ASSIGN(AttModule);
};
} // namespace att
diff --git a/system/gd/btaa/activity_attribution.h b/system/gd/btaa/activity_attribution.h
index e286128..93f5549 100644
--- a/system/gd/btaa/activity_attribution.h
+++ b/system/gd/btaa/activity_attribution.h
@@ -50,6 +50,9 @@
class ActivityAttribution : public bluetooth::Module {
public:
ActivityAttribution() = default;
+ ActivityAttribution(const ActivityAttribution&) = delete;
+ ActivityAttribution& operator=(const ActivityAttribution&) = delete;
+
~ActivityAttribution() = default;
void Capture(const hal::HciPacket& packet, hal::SnoopLogger::PacketType type);
@@ -71,8 +74,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(ActivityAttribution);
};
} // namespace activity_attribution
diff --git a/system/gd/common/callback_list.h b/system/gd/common/callback_list.h
index a3ad6b1..441a5fa 100644
--- a/system/gd/common/callback_list.h
+++ b/system/gd/common/callback_list.h
@@ -68,6 +68,9 @@
public:
using CallbackType = CallbackWithHandler<void(Args...)>;
CallbackList() = default;
+ CallbackList(const CallbackList&) = delete;
+ CallbackList& operator=(const CallbackList&) = delete;
+
template <typename... RunArgs>
void Notify(RunArgs&&... args) {
auto it = this->GetIterator();
@@ -76,9 +79,6 @@
cb->handler->Post(base::Bind(cb->callback, args...));
}
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CallbackList);
};
} // namespace common
diff --git a/system/gd/common/contextual_callback.h b/system/gd/common/contextual_callback.h
index 5393529..ba78ed6 100644
--- a/system/gd/common/contextual_callback.h
+++ b/system/gd/common/contextual_callback.h
@@ -39,8 +39,8 @@
: callback_(std::move(callback)), context_(context) {}
constexpr ContextualOnceCallback() = default;
-
- DISALLOW_COPY_AND_ASSIGN(ContextualOnceCallback);
+ ContextualOnceCallback(const ContextualOnceCallback&) = delete;
+ ContextualOnceCallback& operator=(const ContextualOnceCallback&) = delete;
ContextualOnceCallback(ContextualOnceCallback&&) noexcept = default;
ContextualOnceCallback& operator=(ContextualOnceCallback&&) noexcept = default;
diff --git a/system/gd/hci/acl_manager.h b/system/gd/hci/acl_manager.h
index 72426bd..9c00801 100644
--- a/system/gd/hci/acl_manager.h
+++ b/system/gd/hci/acl_manager.h
@@ -57,6 +57,9 @@
public:
AclManager();
+ AclManager(const AclManager&) = delete;
+ AclManager& operator=(const AclManager&) = delete;
+
// NOTE: It is necessary to forward declare a default destructor that overrides the base class one, because
// "struct impl" is forwarded declared in .cc and compiler needs a concrete definition of "struct impl" when
// compiling AclManager's destructor. Hence we need to forward declare the destructor for AclManager to delay
@@ -148,8 +151,6 @@
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(AclManager);
};
} // namespace hci
diff --git a/system/gd/hci/acl_manager/acl_connection.h b/system/gd/hci/acl_manager/acl_connection.h
index c396b18..1347c82 100644
--- a/system/gd/hci/acl_manager/acl_connection.h
+++ b/system/gd/hci/acl_manager/acl_connection.h
@@ -28,6 +28,9 @@
class AclConnection {
public:
AclConnection() : queue_up_end_(nullptr), handle_(0){};
+ AclConnection(const AclConnection&) = delete;
+ AclConnection& operator=(const AclConnection&) = delete;
+
virtual ~AclConnection() = default;
uint16_t GetHandle() const {
@@ -47,7 +50,6 @@
AclConnection(QueueUpEnd* queue_up_end, uint16_t handle) : queue_up_end_(queue_up_end), handle_(handle) {}
QueueUpEnd* queue_up_end_;
uint16_t handle_;
- DISALLOW_COPY_AND_ASSIGN(AclConnection);
};
} // namespace acl_manager
diff --git a/system/gd/hci/acl_manager/classic_acl_connection.h b/system/gd/hci/acl_manager/classic_acl_connection.h
index 328cbb1..6870114 100644
--- a/system/gd/hci/acl_manager/classic_acl_connection.h
+++ b/system/gd/hci/acl_manager/classic_acl_connection.h
@@ -33,6 +33,9 @@
ClassicAclConnection();
ClassicAclConnection(std::shared_ptr<Queue> queue, AclConnectionInterface* acl_connection_interface, uint16_t handle,
Address address);
+ ClassicAclConnection(const ClassicAclConnection&) = delete;
+ ClassicAclConnection& operator=(const ClassicAclConnection&) = delete;
+
~ClassicAclConnection();
virtual Address GetAddress() const {
@@ -86,7 +89,6 @@
private:
struct impl;
struct impl* pimpl_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(ClassicAclConnection);
};
} // namespace acl_manager
diff --git a/system/gd/hci/acl_manager/le_acl_connection.h b/system/gd/hci/acl_manager/le_acl_connection.h
index fd81111..0fc14a9 100644
--- a/system/gd/hci/acl_manager/le_acl_connection.h
+++ b/system/gd/hci/acl_manager/le_acl_connection.h
@@ -39,6 +39,9 @@
AddressWithType local_address,
AddressWithType remote_address,
Role role);
+ LeAclConnection(const LeAclConnection&) = delete;
+ LeAclConnection& operator=(const LeAclConnection&) = delete;
+
~LeAclConnection();
virtual AddressWithType GetLocalAddress() const {
@@ -84,7 +87,6 @@
AddressWithType local_address_;
AddressWithType remote_address_;
Role role_;
- DISALLOW_COPY_AND_ASSIGN(LeAclConnection);
};
} // namespace acl_manager
diff --git a/system/gd/hci/command_interface.h b/system/gd/hci/command_interface.h
index eba01db..28fa627 100644
--- a/system/gd/hci/command_interface.h
+++ b/system/gd/hci/command_interface.h
@@ -28,8 +28,10 @@
class CommandInterface {
public:
CommandInterface() = default;
+ CommandInterface(const CommandInterface&) = delete;
+ CommandInterface& operator=(const CommandInterface&) = delete;
+
virtual ~CommandInterface() = default;
- DISALLOW_COPY_AND_ASSIGN(CommandInterface);
virtual void EnqueueCommand(std::unique_ptr<T> command,
common::ContextualOnceCallback<void(CommandCompleteView)> on_complete) = 0;
diff --git a/system/gd/hci/controller.h b/system/gd/hci/controller.h
index ea45aef..573c695 100644
--- a/system/gd/hci/controller.h
+++ b/system/gd/hci/controller.h
@@ -28,8 +28,10 @@
class Controller : public Module {
public:
Controller();
+ Controller(const Controller&) = delete;
+ Controller& operator=(const Controller&) = delete;
+
virtual ~Controller();
- DISALLOW_COPY_AND_ASSIGN(Controller);
using CompletedAclPacketsCallback =
common::ContextualCallback<void(uint16_t /* handle */, uint16_t /* num_packets */)>;
diff --git a/system/gd/hci/hci_layer.h b/system/gd/hci/hci_layer.h
index 8ff74d3..bde9915 100644
--- a/system/gd/hci/hci_layer.h
+++ b/system/gd/hci/hci_layer.h
@@ -43,8 +43,10 @@
// LINT.IfChange
public:
HciLayer();
+ HciLayer(const HciLayer&) = delete;
+ HciLayer& operator=(const HciLayer&) = delete;
+
virtual ~HciLayer();
- DISALLOW_COPY_AND_ASSIGN(HciLayer);
void EnqueueCommand(
std::unique_ptr<CommandBuilder> command,
diff --git a/system/gd/hci/le_advertising_manager.h b/system/gd/hci/le_advertising_manager.h
index 75040fb..557b110 100644
--- a/system/gd/hci/le_advertising_manager.h
+++ b/system/gd/hci/le_advertising_manager.h
@@ -102,6 +102,8 @@
static constexpr uint16_t kLeMaximumFragmentLength = 251;
static constexpr FragmentPreference kFragment_preference = FragmentPreference::CONTROLLER_SHOULD_NOT;
LeAdvertisingManager();
+ LeAdvertisingManager(const LeAdvertisingManager&) = delete;
+ LeAdvertisingManager& operator=(const LeAdvertisingManager&) = delete;
size_t GetNumberOfAdvertisingInstances() const;
@@ -153,7 +155,6 @@
os::Handler* handler);
struct impl;
std::unique_ptr<impl> pimpl_;
- DISALLOW_COPY_AND_ASSIGN(LeAdvertisingManager);
};
} // namespace hci
diff --git a/system/gd/hci/le_scanning_manager.h b/system/gd/hci/le_scanning_manager.h
index ca2cf13..6d5c6ac 100644
--- a/system/gd/hci/le_scanning_manager.h
+++ b/system/gd/hci/le_scanning_manager.h
@@ -42,6 +42,8 @@
static constexpr uint8_t kNotPeriodicAdvertisement = 0x00;
static constexpr ScannerId kInvalidScannerId = 0xFF;
LeScanningManager();
+ LeScanningManager(const LeScanningManager&) = delete;
+ LeScanningManager& operator=(const LeScanningManager&) = delete;
virtual void RegisterScanner(const Uuid app_uuid);
@@ -92,7 +94,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
- DISALLOW_COPY_AND_ASSIGN(LeScanningManager);
};
} // namespace hci
diff --git a/system/gd/hci/vendor_specific_event_manager.h b/system/gd/hci/vendor_specific_event_manager.h
index 7e0f333..3dba563 100644
--- a/system/gd/hci/vendor_specific_event_manager.h
+++ b/system/gd/hci/vendor_specific_event_manager.h
@@ -24,6 +24,8 @@
class VendorSpecificEventManager : public bluetooth::Module {
public:
VendorSpecificEventManager();
+ VendorSpecificEventManager(const VendorSpecificEventManager&) = delete;
+ VendorSpecificEventManager& operator=(const VendorSpecificEventManager&) = delete;
void RegisterEventHandler(VseSubeventCode event, common::ContextualCallback<void(VendorSpecificEventView)> handler);
@@ -43,7 +45,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
- DISALLOW_COPY_AND_ASSIGN(VendorSpecificEventManager);
};
} // namespace hci
diff --git a/system/gd/iso/iso_manager.h b/system/gd/iso/iso_manager.h
index d38405c..b40d6f5 100644
--- a/system/gd/iso/iso_manager.h
+++ b/system/gd/iso/iso_manager.h
@@ -37,6 +37,9 @@
*/
class IsoManager {
public:
+ IsoManager(const IsoManager&) = delete;
+ IsoManager& operator=(const IsoManager&) = delete;
+
friend class IsoModule;
void RegisterIsoEstablishedCallback(CisEstablishedCallback cb);
@@ -80,7 +83,6 @@
private:
os::Handler* iso_handler_ = nullptr;
internal::IsoManagerImpl* iso_manager_impl_;
- DISALLOW_COPY_AND_ASSIGN(IsoManager);
};
} // namespace iso
diff --git a/system/gd/iso/iso_module.h b/system/gd/iso/iso_module.h
index 6db880c..d767620 100644
--- a/system/gd/iso/iso_module.h
+++ b/system/gd/iso/iso_module.h
@@ -26,6 +26,9 @@
class IsoModule : public bluetooth::Module {
public:
IsoModule() = default;
+ IsoModule(const IsoModule&) = delete;
+ IsoModule& operator=(const IsoModule&) = delete;
+
~IsoModule() = default;
/**
@@ -47,7 +50,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
- DISALLOW_COPY_AND_ASSIGN(IsoModule);
};
} // namespace iso
diff --git a/system/gd/l2cap/classic/dynamic_channel_manager.h b/system/gd/l2cap/classic/dynamic_channel_manager.h
index 66e3aee..ab240ff 100644
--- a/system/gd/l2cap/classic/dynamic_channel_manager.h
+++ b/system/gd/l2cap/classic/dynamic_channel_manager.h
@@ -122,6 +122,9 @@
friend class L2capClassicModule;
+ DynamicChannelManager(const DynamicChannelManager&) = delete;
+ DynamicChannelManager& operator=(const DynamicChannelManager&) = delete;
+
virtual ~DynamicChannelManager() = default;
protected:
@@ -139,7 +142,6 @@
internal::DynamicChannelServiceManagerImpl* service_manager_ = nullptr;
internal::LinkManager* link_manager_ = nullptr;
os::Handler* l2cap_layer_handler_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(DynamicChannelManager);
};
} // namespace classic
diff --git a/system/gd/l2cap/classic/dynamic_channel_service.h b/system/gd/l2cap/classic/dynamic_channel_service.h
index f098db1..40ead1f 100644
--- a/system/gd/l2cap/classic/dynamic_channel_service.h
+++ b/system/gd/l2cap/classic/dynamic_channel_service.h
@@ -32,6 +32,8 @@
class DynamicChannelService {
public:
DynamicChannelService() = default;
+ DynamicChannelService(const DynamicChannelService&) = delete;
+ DynamicChannelService& operator=(const DynamicChannelService&) = delete;
using OnUnregisteredCallback = common::ContextualOnceCallback<void()>;
@@ -59,7 +61,6 @@
Psm psm_ = kDefaultPsm;
internal::DynamicChannelServiceManagerImpl* manager_ = nullptr;
os::Handler* l2cap_layer_handler_;
- DISALLOW_COPY_AND_ASSIGN(DynamicChannelService);
};
} // namespace classic
diff --git a/system/gd/l2cap/classic/fixed_channel_manager.h b/system/gd/l2cap/classic/fixed_channel_manager.h
index a3285e7..9c40bd1 100644
--- a/system/gd/l2cap/classic/fixed_channel_manager.h
+++ b/system/gd/l2cap/classic/fixed_channel_manager.h
@@ -129,6 +129,9 @@
virtual bool RegisterService(Cid cid, OnRegistrationCompleteCallback on_registration_complete,
OnConnectionOpenCallback on_connection_open, os::Handler* handler);
+ FixedChannelManager(const FixedChannelManager&) = delete;
+ FixedChannelManager& operator=(const FixedChannelManager&) = delete;
+
virtual ~FixedChannelManager() = default;
friend class L2capClassicModule;
@@ -143,7 +146,6 @@
internal::FixedChannelServiceManagerImpl* service_manager_ = nullptr;
internal::LinkManager* link_manager_ = nullptr;
os::Handler* l2cap_layer_handler_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(FixedChannelManager);
};
} // namespace classic
diff --git a/system/gd/l2cap/classic/fixed_channel_service.h b/system/gd/l2cap/classic/fixed_channel_service.h
index d5d213b..447d3a8 100644
--- a/system/gd/l2cap/classic/fixed_channel_service.h
+++ b/system/gd/l2cap/classic/fixed_channel_service.h
@@ -32,6 +32,8 @@
class FixedChannelService {
public:
FixedChannelService() = default;
+ FixedChannelService(const FixedChannelService&) = delete;
+ FixedChannelService& operator=(const FixedChannelService&) = delete;
using OnUnregisteredCallback = common::OnceCallback<void()>;
@@ -51,7 +53,6 @@
Cid cid_ = kInvalidCid;
internal::FixedChannelServiceManagerImpl* manager_ = nullptr;
os::Handler* l2cap_layer_handler_;
- DISALLOW_COPY_AND_ASSIGN(FixedChannelService);
};
} // namespace classic
diff --git a/system/gd/l2cap/classic/internal/fixed_channel_impl.h b/system/gd/l2cap/classic/internal/fixed_channel_impl.h
index 4c4e9f1..37efa1d 100644
--- a/system/gd/l2cap/classic/internal/fixed_channel_impl.h
+++ b/system/gd/l2cap/classic/internal/fixed_channel_impl.h
@@ -35,6 +35,9 @@
public:
FixedChannelImpl(Cid cid, Link* link, os::Handler* l2cap_handler);
+ FixedChannelImpl(const FixedChannelImpl&) = delete;
+ FixedChannelImpl& operator=(const FixedChannelImpl&) = delete;
+
virtual ~FixedChannelImpl() = default;
hci::Address GetDevice() const {
@@ -96,8 +99,6 @@
static constexpr size_t kChannelQueueSize = 10;
common::BidiQueue<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder> channel_queue_{
kChannelQueueSize};
-
- DISALLOW_COPY_AND_ASSIGN(FixedChannelImpl);
};
} // namespace internal
diff --git a/system/gd/l2cap/classic/internal/link.h b/system/gd/l2cap/classic/internal/link.h
index a5b17a9..2b61aae 100644
--- a/system/gd/l2cap/classic/internal/link.h
+++ b/system/gd/l2cap/classic/internal/link.h
@@ -51,6 +51,9 @@
DynamicChannelServiceManagerImpl* dynamic_service_manager, FixedChannelServiceManagerImpl* fixed_service_manager,
LinkManager* link_manager);
+ Link(const Link&) = delete;
+ Link& operator=(const Link&) = delete;
+
hci::AddressWithType GetDevice() const override {
return {acl_connection_->GetAddress(), hci::AddressType::PUBLIC_DEVICE_ADDRESS};
}
@@ -234,7 +237,6 @@
bool has_requested_authentication_ = false;
std::list<EncryptionChangeListener> encryption_change_listener_;
std::atomic_int remaining_packets_to_be_sent_ = 0;
- DISALLOW_COPY_AND_ASSIGN(Link);
};
} // namespace internal
diff --git a/system/gd/l2cap/classic/internal/link_manager.h b/system/gd/l2cap/classic/internal/link_manager.h
index a81b0f5..4d327ea 100644
--- a/system/gd/l2cap/classic/internal/link_manager.h
+++ b/system/gd/l2cap/classic/internal/link_manager.h
@@ -52,6 +52,9 @@
acl_manager_->RegisterCallbacks(this, l2cap_handler_);
}
+ LinkManager(const LinkManager&) = delete;
+ LinkManager& operator=(const LinkManager&) = delete;
+
struct PendingFixedChannelConnection {
os::Handler* handler_;
FixedChannelManager::OnConnectionFailureCallback on_fail_callback_;
@@ -147,8 +150,6 @@
os::Handler* link_property_callback_handler_ = nullptr;
std::unordered_set<hci::Address> disconnected_links_;
std::unordered_set<hci::Address> links_with_pending_packets_;
-
- DISALLOW_COPY_AND_ASSIGN(LinkManager);
};
} // namespace internal
diff --git a/system/gd/l2cap/classic/l2cap_classic_module.h b/system/gd/l2cap/classic/l2cap_classic_module.h
index f22f039..407de38 100644
--- a/system/gd/l2cap/classic/l2cap_classic_module.h
+++ b/system/gd/l2cap/classic/l2cap_classic_module.h
@@ -36,6 +36,9 @@
class L2capClassicModule : public bluetooth::Module {
public:
L2capClassicModule();
+ L2capClassicModule(const L2capClassicModule&) = delete;
+ L2capClassicModule& operator=(const L2capClassicModule&) = delete;
+
virtual ~L2capClassicModule();
/**
@@ -86,8 +89,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(L2capClassicModule);
};
} // namespace classic
diff --git a/system/gd/l2cap/internal/dynamic_channel_impl.h b/system/gd/l2cap/internal/dynamic_channel_impl.h
index a012fff..4ae959f 100644
--- a/system/gd/l2cap/internal/dynamic_channel_impl.h
+++ b/system/gd/l2cap/internal/dynamic_channel_impl.h
@@ -36,6 +36,9 @@
public:
DynamicChannelImpl(Psm psm, Cid cid, Cid remote_cid, l2cap::internal::ILink* link, os::Handler* l2cap_handler);
+ DynamicChannelImpl(const DynamicChannelImpl&) = delete;
+ DynamicChannelImpl& operator=(const DynamicChannelImpl&) = delete;
+
virtual ~DynamicChannelImpl() = default;
hci::AddressWithType GetDevice() const;
@@ -90,8 +93,6 @@
static constexpr size_t kChannelQueueSize = 5;
common::BidiQueue<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder> channel_queue_{
kChannelQueueSize};
-
- DISALLOW_COPY_AND_ASSIGN(DynamicChannelImpl);
};
} // namespace internal
diff --git a/system/gd/l2cap/le/dynamic_channel_manager.h b/system/gd/l2cap/le/dynamic_channel_manager.h
index e5334ef..2d1b24f 100644
--- a/system/gd/l2cap/le/dynamic_channel_manager.h
+++ b/system/gd/l2cap/le/dynamic_channel_manager.h
@@ -40,6 +40,9 @@
class DynamicChannelManager {
public:
+ DynamicChannelManager(const DynamicChannelManager&) = delete;
+ DynamicChannelManager& operator=(const DynamicChannelManager&) = delete;
+
enum class ConnectionResultCode {
SUCCESS = 0,
FAIL_NO_SERVICE_REGISTERED = 1, // No service is registered
@@ -138,7 +141,6 @@
internal::DynamicChannelServiceManagerImpl* service_manager_ = nullptr;
internal::LinkManager* link_manager_ = nullptr;
os::Handler* l2cap_layer_handler_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(DynamicChannelManager);
};
} // namespace le
diff --git a/system/gd/l2cap/le/dynamic_channel_service.h b/system/gd/l2cap/le/dynamic_channel_service.h
index 898c885..4294e59 100644
--- a/system/gd/l2cap/le/dynamic_channel_service.h
+++ b/system/gd/l2cap/le/dynamic_channel_service.h
@@ -32,6 +32,8 @@
class DynamicChannelService {
public:
DynamicChannelService() = default;
+ DynamicChannelService(const DynamicChannelService&) = delete;
+ DynamicChannelService& operator=(const DynamicChannelService&) = delete;
using OnUnregisteredCallback = common::OnceCallback<void()>;
@@ -58,7 +60,6 @@
Psm psm_ = kDefaultPsm;
internal::DynamicChannelServiceManagerImpl* manager_ = nullptr;
os::Handler* l2cap_layer_handler_;
- DISALLOW_COPY_AND_ASSIGN(DynamicChannelService);
};
} // namespace le
diff --git a/system/gd/l2cap/le/fixed_channel_manager.h b/system/gd/l2cap/le/fixed_channel_manager.h
index 1b059ac..9bd2c70 100644
--- a/system/gd/l2cap/le/fixed_channel_manager.h
+++ b/system/gd/l2cap/le/fixed_channel_manager.h
@@ -36,6 +36,9 @@
class FixedChannelManager {
public:
+ FixedChannelManager(const FixedChannelManager&) = delete;
+ FixedChannelManager& operator=(const FixedChannelManager&) = delete;
+
enum class ConnectionResultCode {
SUCCESS = 0,
FAIL_NO_SERVICE_REGISTERED = 1, // No service is registered
@@ -136,7 +139,6 @@
internal::FixedChannelServiceManagerImpl* service_manager_ = nullptr;
internal::LinkManager* link_manager_ = nullptr;
os::Handler* l2cap_layer_handler_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(FixedChannelManager);
};
} // namespace le
diff --git a/system/gd/l2cap/le/fixed_channel_service.h b/system/gd/l2cap/le/fixed_channel_service.h
index 0c4556e..7660e31 100644
--- a/system/gd/l2cap/le/fixed_channel_service.h
+++ b/system/gd/l2cap/le/fixed_channel_service.h
@@ -32,6 +32,8 @@
class FixedChannelService {
public:
FixedChannelService() = default;
+ FixedChannelService(const FixedChannelService&) = delete;
+ FixedChannelService& operator=(const FixedChannelService&) = delete;
using OnUnregisteredCallback = common::OnceCallback<void()>;
@@ -51,7 +53,6 @@
Cid cid_ = kInvalidCid;
internal::FixedChannelServiceManagerImpl* manager_ = nullptr;
os::Handler* l2cap_layer_handler_;
- DISALLOW_COPY_AND_ASSIGN(FixedChannelService);
};
} // namespace le
diff --git a/system/gd/l2cap/le/internal/fixed_channel_impl.h b/system/gd/l2cap/le/internal/fixed_channel_impl.h
index d4fb3a3..59a68ad 100644
--- a/system/gd/l2cap/le/internal/fixed_channel_impl.h
+++ b/system/gd/l2cap/le/internal/fixed_channel_impl.h
@@ -36,6 +36,9 @@
public:
FixedChannelImpl(Cid cid, Link* link, os::Handler* l2cap_handler);
+ FixedChannelImpl(const FixedChannelImpl&) = delete;
+ FixedChannelImpl& operator=(const FixedChannelImpl&) = delete;
+
virtual ~FixedChannelImpl() = default;
hci::AddressWithType GetDevice() const {
@@ -98,8 +101,6 @@
static constexpr size_t kChannelQueueSize = 10;
common::BidiQueue<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder> channel_queue_{
kChannelQueueSize};
-
- DISALLOW_COPY_AND_ASSIGN(FixedChannelImpl);
};
} // namespace internal
diff --git a/system/gd/l2cap/le/internal/link.h b/system/gd/l2cap/le/internal/link.h
index 518793e..a17ea33 100644
--- a/system/gd/l2cap/le/internal/link.h
+++ b/system/gd/l2cap/le/internal/link.h
@@ -49,6 +49,9 @@
DynamicChannelServiceManagerImpl* dynamic_service_manager, FixedChannelServiceManagerImpl* fixed_service_manager,
LinkManager* link_manager);
+ Link(const Link&) = delete;
+ Link& operator=(const Link&) = delete;
+
~Link() = default;
inline hci::AddressWithType GetDevice() const override {
@@ -170,7 +173,6 @@
uint16_t update_request_latency_;
uint16_t update_request_supervision_timeout_;
std::atomic_int remaining_packets_to_be_sent_ = 0;
- DISALLOW_COPY_AND_ASSIGN(Link);
// Received connection update complete from ACL manager. SignalId is bound to a valid number when we need to send a
// response to remote. If SignalId is bound to an invalid number, we don't send a response to remote, because the
diff --git a/system/gd/l2cap/le/internal/link_manager.h b/system/gd/l2cap/le/internal/link_manager.h
index c6ec046..836a3f6 100644
--- a/system/gd/l2cap/le/internal/link_manager.h
+++ b/system/gd/l2cap/le/internal/link_manager.h
@@ -56,6 +56,9 @@
acl_manager_->RegisterLeCallbacks(this, l2cap_handler_);
}
+ LinkManager(const LinkManager&) = delete;
+ LinkManager& operator=(const LinkManager&) = delete;
+
struct PendingFixedChannelConnection {
os::Handler* handler_;
FixedChannelManager::OnConnectionFailureCallback on_fail_callback_;
@@ -116,8 +119,6 @@
LinkPropertyListener* link_property_listener_ = nullptr;
std::unordered_set<hci::AddressWithType> disconnected_links_;
std::unordered_set<hci::AddressWithType> links_with_pending_packets_;
-
- DISALLOW_COPY_AND_ASSIGN(LinkManager);
};
} // namespace internal
diff --git a/system/gd/l2cap/le/l2cap_le_module.h b/system/gd/l2cap/le/l2cap_le_module.h
index 05cabd2..28352c0 100644
--- a/system/gd/l2cap/le/l2cap_le_module.h
+++ b/system/gd/l2cap/le/l2cap_le_module.h
@@ -39,6 +39,9 @@
class L2capLeModule : public bluetooth::Module {
public:
L2capLeModule();
+ L2capLeModule(const L2capLeModule&) = delete;
+ L2capLeModule& operator=(const L2capLeModule&) = delete;
+
virtual ~L2capLeModule();
/**
@@ -81,8 +84,6 @@
* This is not synchronized.
*/
virtual void SetLinkPropertyListener(os::Handler* handler, LinkPropertyListener* listener);
-
- DISALLOW_COPY_AND_ASSIGN(L2capLeModule);
};
} // namespace le
diff --git a/system/gd/neighbor/connectability.h b/system/gd/neighbor/connectability.h
index eebf741..0085805 100644
--- a/system/gd/neighbor/connectability.h
+++ b/system/gd/neighbor/connectability.h
@@ -29,6 +29,9 @@
bool IsConnectable() const;
ConnectabilityModule();
+ ConnectabilityModule(const ConnectabilityModule&) = delete;
+ ConnectabilityModule& operator=(const ConnectabilityModule&) = delete;
+
~ConnectabilityModule();
static const ModuleFactory Factory;
@@ -44,8 +47,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(ConnectabilityModule);
};
} // namespace neighbor
diff --git a/system/gd/neighbor/discoverability.h b/system/gd/neighbor/discoverability.h
index cce4b87..4c118c2 100644
--- a/system/gd/neighbor/discoverability.h
+++ b/system/gd/neighbor/discoverability.h
@@ -35,6 +35,9 @@
static const ModuleFactory Factory;
DiscoverabilityModule();
+ DiscoverabilityModule(const DiscoverabilityModule&) = delete;
+ DiscoverabilityModule& operator=(const DiscoverabilityModule&) = delete;
+
~DiscoverabilityModule();
protected:
@@ -48,8 +51,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(DiscoverabilityModule);
};
} // namespace neighbor
diff --git a/system/gd/neighbor/inquiry.h b/system/gd/neighbor/inquiry.h
index 1482af5..5304be5 100644
--- a/system/gd/neighbor/inquiry.h
+++ b/system/gd/neighbor/inquiry.h
@@ -67,6 +67,9 @@
static const ModuleFactory Factory;
InquiryModule();
+ InquiryModule(const InquiryModule&) = delete;
+ InquiryModule& operator=(const InquiryModule&) = delete;
+
~InquiryModule();
protected:
@@ -80,8 +83,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(InquiryModule);
};
} // namespace neighbor
diff --git a/system/gd/neighbor/name.h b/system/gd/neighbor/name.h
index 233757d..48d8ead 100644
--- a/system/gd/neighbor/name.h
+++ b/system/gd/neighbor/name.h
@@ -45,6 +45,9 @@
static const ModuleFactory Factory;
NameModule();
+ NameModule(const NameModule&) = delete;
+ NameModule& operator=(const NameModule&) = delete;
+
~NameModule();
protected:
@@ -58,8 +61,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(NameModule);
};
} // namespace neighbor
diff --git a/system/gd/neighbor/name_db.h b/system/gd/neighbor/name_db.h
index 1180cff..5164f72 100644
--- a/system/gd/neighbor/name_db.h
+++ b/system/gd/neighbor/name_db.h
@@ -40,6 +40,9 @@
static const ModuleFactory Factory;
NameDbModule();
+ NameDbModule(const NameDbModule&) = delete;
+ NameDbModule& operator=(const NameDbModule&) = delete;
+
~NameDbModule();
protected:
@@ -53,8 +56,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(NameDbModule);
};
} // namespace neighbor
diff --git a/system/gd/neighbor/page.h b/system/gd/neighbor/page.h
index 14c3ae6..19c55b9 100644
--- a/system/gd/neighbor/page.h
+++ b/system/gd/neighbor/page.h
@@ -43,6 +43,9 @@
static const ModuleFactory Factory;
PageModule();
+ PageModule(const PageModule&) = delete;
+ PageModule& operator=(const PageModule&) = delete;
+
~PageModule();
protected:
@@ -56,8 +59,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(PageModule);
};
} // namespace neighbor
diff --git a/system/gd/neighbor/scan.h b/system/gd/neighbor/scan.h
index e1699b4..6cea595 100644
--- a/system/gd/neighbor/scan.h
+++ b/system/gd/neighbor/scan.h
@@ -25,6 +25,9 @@
class ScanModule : public bluetooth::Module {
public:
ScanModule();
+ ScanModule(const ScanModule&) = delete;
+ ScanModule& operator=(const ScanModule&) = delete;
+
~ScanModule();
void SetInquiryScan();
@@ -48,8 +51,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(ScanModule);
};
} // namespace neighbor
diff --git a/system/gd/os/alarm.h b/system/gd/os/alarm.h
index 773c36f..4a689da 100644
--- a/system/gd/os/alarm.h
+++ b/system/gd/os/alarm.h
@@ -36,11 +36,12 @@
// Create and register a single-shot alarm on a given handler
explicit Alarm(Handler* handler);
+ Alarm(const Alarm&) = delete;
+ Alarm& operator=(const Alarm&) = delete;
+
// Unregister this alarm from the thread and release resource
~Alarm();
- DISALLOW_COPY_AND_ASSIGN(Alarm);
-
// Schedule the alarm with given delay
void Schedule(common::OnceClosure task, std::chrono::milliseconds delay);
diff --git a/system/gd/os/handler.h b/system/gd/os/handler.h
index a1ab389..1dabbde 100644
--- a/system/gd/os/handler.h
+++ b/system/gd/os/handler.h
@@ -38,11 +38,12 @@
// Create and register a handler on given thread
explicit Handler(Thread* thread);
+ Handler(const Handler&) = delete;
+ Handler& operator=(const Handler&) = delete;
+
// Unregister this handler from the thread and release resource. Unhandled events will be discarded and not executed.
virtual ~Handler();
- DISALLOW_COPY_AND_ASSIGN(Handler);
-
// Enqueue a closure to the queue of this handler
virtual void Post(common::OnceClosure closure) override;
diff --git a/system/gd/os/linux_generic/reactive_semaphore.h b/system/gd/os/linux_generic/reactive_semaphore.h
index 718666c..dd54b1a 100644
--- a/system/gd/os/linux_generic/reactive_semaphore.h
+++ b/system/gd/os/linux_generic/reactive_semaphore.h
@@ -26,6 +26,10 @@
public:
// Creates a new ReactiveSemaphore with an initial value of |value|.
explicit ReactiveSemaphore(unsigned int value);
+
+ ReactiveSemaphore(const ReactiveSemaphore&) = delete;
+ ReactiveSemaphore& operator=(const ReactiveSemaphore&) = delete;
+
~ReactiveSemaphore();
// Decrements the value of |fd_|, this will cause a crash if |fd_| unreadable.
void Decrease();
@@ -33,8 +37,6 @@
void Increase();
int GetFd();
- DISALLOW_COPY_AND_ASSIGN(ReactiveSemaphore);
-
private:
int fd_;
};
diff --git a/system/gd/os/reactor.h b/system/gd/os/reactor.h
index 4a5c377..c85625c 100644
--- a/system/gd/os/reactor.h
+++ b/system/gd/os/reactor.h
@@ -44,11 +44,12 @@
// Construct a reactor on the current thread
Reactor();
+ Reactor(const Reactor&) = delete;
+ Reactor& operator=(const Reactor&) = delete;
+
// Destruct this reactor and release its resources
~Reactor();
- DISALLOW_COPY_AND_ASSIGN(Reactor);
-
// Start the reactor. The current thread will be blocked until Stop() is invoked and handled.
void Run();
diff --git a/system/gd/os/repeating_alarm.h b/system/gd/os/repeating_alarm.h
index 6b37162..b261b5e 100644
--- a/system/gd/os/repeating_alarm.h
+++ b/system/gd/os/repeating_alarm.h
@@ -36,11 +36,12 @@
// Create and register a repeating alarm on a given handler
explicit RepeatingAlarm(Handler* handler);
+ RepeatingAlarm(const RepeatingAlarm&) = delete;
+ RepeatingAlarm& operator=(const RepeatingAlarm&) = delete;
+
// Unregister this alarm from the thread and release resource
~RepeatingAlarm();
- DISALLOW_COPY_AND_ASSIGN(RepeatingAlarm);
-
// Schedule a repeating alarm with given period
void Schedule(common::Closure task, std::chrono::milliseconds period);
diff --git a/system/gd/os/thread.h b/system/gd/os/thread.h
index d14d75e..4be792d 100644
--- a/system/gd/os/thread.h
+++ b/system/gd/os/thread.h
@@ -43,11 +43,12 @@
// priority: priority for kernel scheduler
Thread(const std::string& name, Priority priority);
+ Thread(const Thread&) = delete;
+ Thread& operator=(const Thread&) = delete;
+
// Stop and destroy this thread
~Thread();
- DISALLOW_COPY_AND_ASSIGN(Thread);
-
// Stop this thread. Must be invoked from another thread. After this thread is stopped, it cannot be started again.
bool Stop();
diff --git a/system/gd/rust/linux/client/src/command_handler.rs b/system/gd/rust/linux/client/src/command_handler.rs
index f789eaa..4715c03 100644
--- a/system/gd/rust/linux/client/src/command_handler.rs
+++ b/system/gd/rust/linux/client/src/command_handler.rs
@@ -85,7 +85,8 @@
String::from("adapter"),
CommandOption {
description: String::from(
- "Enable/Disable/Show default bluetooth adapter. (e.g. adapter enable)",
+ "Enable/Disable/Show default bluetooth adapter. (e.g. adapter enable)\n
+ Discoverable On/Off (e.g. adapter discoverable on)",
),
function_pointer: CommandHandler::cmd_adapter,
},
@@ -244,47 +245,94 @@
}
let default_adapter = self.context.lock().unwrap().default_adapter;
- enforce_arg_len(args, 1, "adapter <enable|disable|show>", || match &args[0][0..] {
- "enable" => {
- self.context.lock().unwrap().manager_dbus.start(default_adapter);
- }
- "disable" => {
- self.context.lock().unwrap().manager_dbus.stop(default_adapter);
- }
- "show" => {
- if !self.context.lock().unwrap().adapter_ready {
- self.adapter_not_ready();
- return;
+ enforce_arg_len(args, 1, "adapter <enable|disable|show|discoverable>", || {
+ match &args[0][0..] {
+ "enable" => {
+ self.context.lock().unwrap().manager_dbus.start(default_adapter);
}
+ "disable" => {
+ self.context.lock().unwrap().manager_dbus.stop(default_adapter);
+ }
+ "show" => {
+ if !self.context.lock().unwrap().adapter_ready {
+ self.adapter_not_ready();
+ return;
+ }
- let enabled = self.context.lock().unwrap().enabled;
- let address = match self.context.lock().unwrap().adapter_address.as_ref() {
- Some(x) => x.clone(),
- None => String::from(""),
- };
- let name = self.context.lock().unwrap().adapter_dbus.as_ref().unwrap().get_name();
- let uuids = self.context.lock().unwrap().adapter_dbus.as_ref().unwrap().get_uuids();
- let cod = self
- .context
- .lock()
- .unwrap()
- .adapter_dbus
- .as_ref()
- .unwrap()
- .get_bluetooth_class();
- print_info!("Address: {}", address);
- print_info!("Name: {}", name);
- print_info!("State: {}", if enabled { "enabled" } else { "disabled" });
- print_info!("Class: {:#06x}", cod);
- print_info!(
- "Uuids: {}",
- DisplayList(
- uuids.iter().map(|&x| UuidHelper::to_string(&x)).collect::<Vec<String>>()
- )
- );
- }
- _ => {
- println!("Invalid argument '{}'", args[0]);
+ let enabled = self.context.lock().unwrap().enabled;
+ let address = match self.context.lock().unwrap().adapter_address.as_ref() {
+ Some(x) => x.clone(),
+ None => String::from(""),
+ };
+ let name =
+ self.context.lock().unwrap().adapter_dbus.as_ref().unwrap().get_name();
+ let uuids =
+ self.context.lock().unwrap().adapter_dbus.as_ref().unwrap().get_uuids();
+ let is_discoverable = self
+ .context
+ .lock()
+ .unwrap()
+ .adapter_dbus
+ .as_ref()
+ .unwrap()
+ .get_discoverable();
+ let cod = self
+ .context
+ .lock()
+ .unwrap()
+ .adapter_dbus
+ .as_ref()
+ .unwrap()
+ .get_bluetooth_class();
+ print_info!("Address: {}", address);
+ print_info!("Name: {}", name);
+ print_info!("State: {}", if enabled { "enabled" } else { "disabled" });
+ print_info!("Discoverable: {}", is_discoverable);
+ print_info!("Class: {:#06x}", cod);
+ print_info!(
+ "Uuids: {}",
+ DisplayList(
+ uuids
+ .iter()
+ .map(|&x| UuidHelper::to_string(&x))
+ .collect::<Vec<String>>()
+ )
+ );
+ }
+ "discoverable" => match &args[1][0..] {
+ "on" => {
+ let discoverable = self
+ .context
+ .lock()
+ .unwrap()
+ .adapter_dbus
+ .as_ref()
+ .unwrap()
+ .set_discoverable(true, 60);
+ print_info!(
+ "Set discoverable for 60s: {}",
+ if discoverable { "succeeded" } else { "failed" }
+ );
+ }
+ "off" => {
+ let discoverable = self
+ .context
+ .lock()
+ .unwrap()
+ .adapter_dbus
+ .as_ref()
+ .unwrap()
+ .set_discoverable(false, 60);
+ print_info!(
+ "Turn discoverable off: {}",
+ if discoverable { "succeeded" } else { "failed" }
+ );
+ }
+ _ => println!("Invalid argument for adapter discoverable '{}'", args[1]),
+ },
+ _ => {
+ println!("Invalid argument '{}'", args[0]);
+ }
}
});
}
diff --git a/system/gd/rust/linux/client/src/dbus_iface.rs b/system/gd/rust/linux/client/src/dbus_iface.rs
index d3afcd0..e9b3b44 100644
--- a/system/gd/rust/linux/client/src/dbus_iface.rs
+++ b/system/gd/rust/linux/client/src/dbus_iface.rs
@@ -309,6 +309,14 @@
self.client_proxy.method("SetBluetoothClass", (cod,))
}
+ fn get_discoverable(&self) -> bool {
+ self.client_proxy.method("GetDiscoverable", ())
+ }
+
+ fn set_discoverable(&self, mode: bool, duration: u32) -> bool {
+ self.client_proxy.method("SetDiscoverable", (mode, duration))
+ }
+
fn start_discovery(&self) -> bool {
self.client_proxy.method("StartDiscovery", ())
}
diff --git a/system/gd/rust/linux/service/src/iface_bluetooth.rs b/system/gd/rust/linux/service/src/iface_bluetooth.rs
index 005de3e..6967a20 100644
--- a/system/gd/rust/linux/service/src/iface_bluetooth.rs
+++ b/system/gd/rust/linux/service/src/iface_bluetooth.rs
@@ -130,6 +130,16 @@
true
}
+ #[dbus_method("GetDiscoverable")]
+ fn get_discoverable(&self) -> bool {
+ true
+ }
+
+ #[dbus_method("SetDiscoverable")]
+ fn set_discoverable(&self, mode: bool, duration: u32) -> bool {
+ true
+ }
+
#[dbus_method("StartDiscovery")]
fn start_discovery(&self) -> bool {
true
diff --git a/system/gd/rust/linux/stack/src/bluetooth.rs b/system/gd/rust/linux/stack/src/bluetooth.rs
index ee0578c..8eb3d99 100644
--- a/system/gd/rust/linux/stack/src/bluetooth.rs
+++ b/system/gd/rust/linux/stack/src/bluetooth.rs
@@ -2,8 +2,8 @@
use bt_topshim::btif::{
BaseCallbacks, BaseCallbacksDispatcher, BluetoothInterface, BluetoothProperty, BtAclState,
- BtBondState, BtDiscoveryState, BtHciErrorCode, BtPinCode, BtPropertyType, BtSspVariant,
- BtState, BtStatus, BtTransport, RawAddress, Uuid, Uuid128Bit,
+ BtBondState, BtDiscoveryState, BtHciErrorCode, BtPinCode, BtPropertyType, BtScanMode,
+ BtSspVariant, BtState, BtStatus, BtTransport, RawAddress, Uuid, Uuid128Bit,
};
use bt_topshim::{
profiles::hid_host::{HHCallbacksDispatcher, HidHost},
@@ -25,6 +25,8 @@
use crate::uuid::{Profile, UuidHelper};
use crate::{BluetoothCallbackType, Message, RPCProxy};
+const DEFAULT_DISCOVERY_TIMEOUT_MS: u64 = 12800;
+
/// Defines the adapter API.
pub trait IBluetooth {
/// Adds a callback from a client who wishes to observe adapter events.
@@ -67,6 +69,12 @@
/// Sets the bluetooth class.
fn set_bluetooth_class(&self, cod: u32) -> bool;
+ /// Returns whether the adapter is discoverable.
+ fn get_discoverable(&self) -> bool;
+
+ /// Sets discoverability. If discoverable, limits the duration with given value.
+ fn set_discoverable(&self, mode: bool, duration: u32) -> bool;
+
/// Starts BREDR Inquiry.
fn start_discovery(&self) -> bool;
@@ -243,6 +251,7 @@
state: BtState,
tx: Sender<Message>,
uuid_helper: UuidHelper,
+ is_connectable: bool,
}
impl Bluetooth {
@@ -269,6 +278,7 @@
state: BtState::Off,
tx,
uuid_helper: UuidHelper::new(),
+ is_connectable: false,
}
}
@@ -322,6 +332,29 @@
}
}
+ fn get_connectable(&self) -> bool {
+ match self.properties.get(&BtPropertyType::AdapterScanMode) {
+ Some(prop) => match prop {
+ BluetoothProperty::AdapterScanMode(mode) => match *mode {
+ BtScanMode::Connectable | BtScanMode::ConnectableDiscoverable => true,
+ _ => false,
+ },
+ _ => false,
+ },
+ _ => false,
+ }
+ }
+
+ fn set_connectable(&mut self, mode: bool) -> bool {
+ self.is_connectable = mode;
+ if mode && self.get_discoverable() {
+ return true;
+ }
+ self.intf.lock().unwrap().set_adapter_property(BluetoothProperty::AdapterScanMode(
+ if mode { BtScanMode::Connectable } else { BtScanMode::None_ },
+ )) == 0
+ }
+
pub(crate) fn callback_disconnected(&mut self, id: u32, cb_type: BluetoothCallbackType) {
match cb_type {
BluetoothCallbackType::Adapter => {
@@ -786,6 +819,37 @@
self.intf.lock().unwrap().set_adapter_property(BluetoothProperty::ClassOfDevice(cod)) == 0
}
+ fn get_discoverable(&self) -> bool {
+ match self.properties.get(&BtPropertyType::AdapterScanMode) {
+ Some(prop) => match prop {
+ BluetoothProperty::AdapterScanMode(mode) => match mode {
+ BtScanMode::ConnectableDiscoverable => true,
+ _ => false,
+ },
+ _ => false,
+ },
+ _ => false,
+ }
+ }
+
+ fn set_discoverable(&self, mode: bool, duration: u32) -> bool {
+ self.intf
+ .lock()
+ .unwrap()
+ .set_adapter_property(BluetoothProperty::AdapterDiscoverableTimeout(duration));
+ self.intf.lock().unwrap().set_adapter_property(BluetoothProperty::AdapterScanMode(
+ if mode {
+ BtScanMode::ConnectableDiscoverable
+ } else {
+ if self.is_connectable {
+ BtScanMode::Connectable
+ } else {
+ BtScanMode::None_
+ }
+ },
+ )) == 0
+ }
+
fn start_discovery(&self) -> bool {
self.intf.lock().unwrap().start_discovery() == 0
}
@@ -803,20 +867,11 @@
return 0;
}
- match self.properties.get(&BtPropertyType::AdapterDiscoveryTimeout) {
- Some(variant) => match variant {
- BluetoothProperty::AdapterDiscoveryTimeout(timeout) => {
- let seconds: u64 = (*timeout).into();
- let elapsed = self.discovering_started.elapsed();
- if elapsed.as_secs() >= seconds {
- 0
- } else {
- seconds * 1000 - elapsed.as_millis() as u64
- }
- }
- _ => 0,
- },
- _ => 0,
+ let elapsed_ms = self.discovering_started.elapsed().as_millis() as u64;
+ if elapsed_ms >= DEFAULT_DISCOVERY_TIMEOUT_MS {
+ 0
+ } else {
+ DEFAULT_DISCOVERY_TIMEOUT_MS - elapsed_ms
}
}
diff --git a/system/gd/rust/topshim/facade/Android.bp b/system/gd/rust/topshim/facade/Android.bp
index c97cca8..95648c7 100644
--- a/system/gd/rust/topshim/facade/Android.bp
+++ b/system/gd/rust/topshim/facade/Android.bp
@@ -45,7 +45,6 @@
"libbt-sbc-encoder",
"libFraunhoferAAC",
"libg722codec",
- "liblc3codec",
"liblc3",
"libudrv-uipc",
"libbluetooth_gd", // Gabeldorsche
diff --git a/system/gd/rust/topshim/src/btif.rs b/system/gd/rust/topshim/src/btif.rs
index e0f21ff..6b76eac 100644
--- a/system/gd/rust/topshim/src/btif.rs
+++ b/system/gd/rust/topshim/src/btif.rs
@@ -134,7 +134,7 @@
ServiceRecord,
AdapterScanMode,
AdapterBondedDevices,
- AdapterDiscoveryTimeout,
+ AdapterDiscoverableTimeout,
RemoteFriendlyName,
RemoteRssi,
RemoteVersionInfo,
@@ -299,7 +299,7 @@
ServiceRecord(BtServiceRecord),
AdapterScanMode(BtScanMode),
AdapterBondedDevices(Vec<RawAddress>),
- AdapterDiscoveryTimeout(u32),
+ AdapterDiscoverableTimeout(u32),
RemoteFriendlyName(String),
RemoteRssi(i8),
RemoteVersionInfo(BtRemoteVersion),
@@ -327,8 +327,8 @@
BluetoothProperty::ServiceRecord(_) => BtPropertyType::ServiceRecord,
BluetoothProperty::AdapterScanMode(_) => BtPropertyType::AdapterScanMode,
BluetoothProperty::AdapterBondedDevices(_) => BtPropertyType::AdapterBondedDevices,
- BluetoothProperty::AdapterDiscoveryTimeout(_) => {
- BtPropertyType::AdapterDiscoveryTimeout
+ BluetoothProperty::AdapterDiscoverableTimeout(_) => {
+ BtPropertyType::AdapterDiscoverableTimeout
}
BluetoothProperty::RemoteFriendlyName(_) => BtPropertyType::RemoteFriendlyName,
BluetoothProperty::RemoteRssi(_) => BtPropertyType::RemoteRssi,
@@ -356,7 +356,7 @@
BluetoothProperty::AdapterBondedDevices(devlist) => {
devlist.len() * mem::size_of::<RawAddress>()
}
- BluetoothProperty::AdapterDiscoveryTimeout(_) => mem::size_of::<u32>(),
+ BluetoothProperty::AdapterDiscoverableTimeout(_) => mem::size_of::<u32>(),
BluetoothProperty::RemoteFriendlyName(name) => {
cmp::min(PROPERTY_NAME_MAX, name.len() + 1)
}
@@ -423,7 +423,7 @@
data[start..end].copy_from_slice(&dev.val);
}
}
- BluetoothProperty::AdapterDiscoveryTimeout(timeout) => {
+ BluetoothProperty::AdapterDiscoverableTimeout(timeout) => {
data.copy_from_slice(&timeout.to_ne_bytes());
}
BluetoothProperty::RemoteFriendlyName(name) => {
@@ -497,8 +497,8 @@
count,
))
}
- BtPropertyType::AdapterDiscoveryTimeout => {
- BluetoothProperty::AdapterDiscoveryTimeout(u32_from_bytes(slice))
+ BtPropertyType::AdapterDiscoverableTimeout => {
+ BluetoothProperty::AdapterDiscoverableTimeout(u32_from_bytes(slice))
}
BtPropertyType::RemoteFriendlyName => {
BluetoothProperty::RemoteFriendlyName(ascii_to_string(slice, len))
diff --git a/system/gd/security/facade_configuration_api.h b/system/gd/security/facade_configuration_api.h
index d6bab79..9feb8a4 100644
--- a/system/gd/security/facade_configuration_api.h
+++ b/system/gd/security/facade_configuration_api.h
@@ -35,6 +35,9 @@
*/
class FacadeConfigurationApi {
public:
+ FacadeConfigurationApi(const FacadeConfigurationApi&) = delete;
+ FacadeConfigurationApi& operator=(const FacadeConfigurationApi&) = delete;
+
friend class internal::SecurityManagerImpl;
friend class SecurityModule;
@@ -63,7 +66,6 @@
private:
os::Handler* security_handler_ = nullptr;
internal::SecurityManagerImpl* security_manager_impl_;
- DISALLOW_COPY_AND_ASSIGN(FacadeConfigurationApi);
};
} // namespace security
diff --git a/system/gd/security/security_manager.h b/system/gd/security/security_manager.h
index 627cc2a..1842761 100644
--- a/system/gd/security/security_manager.h
+++ b/system/gd/security/security_manager.h
@@ -36,6 +36,9 @@
*/
class SecurityManager : public UICallbacks {
public:
+ SecurityManager(const SecurityManager&) = delete;
+ SecurityManager& operator=(const SecurityManager&) = delete;
+
friend class SecurityModule;
/**
@@ -133,7 +136,6 @@
private:
os::Handler* security_handler_ = nullptr;
internal::SecurityManagerImpl* security_manager_impl_;
- DISALLOW_COPY_AND_ASSIGN(SecurityManager);
};
} // namespace security
diff --git a/system/gd/security/security_module.h b/system/gd/security/security_module.h
index 8890733..68ba2da 100644
--- a/system/gd/security/security_module.h
+++ b/system/gd/security/security_module.h
@@ -27,6 +27,9 @@
class SecurityModule : public bluetooth::Module {
public:
SecurityModule() = default;
+ SecurityModule(const SecurityModule&) = delete;
+ SecurityModule& operator=(const SecurityModule&) = delete;
+
~SecurityModule() = default;
/**
@@ -55,7 +58,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
- DISALLOW_COPY_AND_ASSIGN(SecurityModule);
};
} // namespace security
diff --git a/system/gd/security/test/mocks.h b/system/gd/security/test/mocks.h
index 3ddc909..dc8d325 100644
--- a/system/gd/security/test/mocks.h
+++ b/system/gd/security/test/mocks.h
@@ -30,6 +30,9 @@
class UIMock : public UI {
public:
UIMock() = default;
+ UIMock(const UIMock&) = delete;
+ UIMock& operator=(const UIMock&) = delete;
+
~UIMock() = default;
// Convert these to accept ConfirmationData
@@ -40,9 +43,6 @@
MOCK_METHOD1(DisplayEnterPasskeyDialog, void(ConfirmationData));
MOCK_METHOD1(DisplayPasskey, void(ConfirmationData));
MOCK_METHOD1(DisplayEnterPinDialog, void(ConfirmationData));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(UIMock);
};
class LeSecurityInterfaceMock : public hci::LeSecurityInterface {
diff --git a/system/gd/shim/dumpsys.h b/system/gd/shim/dumpsys.h
index 35c1936..04be062 100644
--- a/system/gd/shim/dumpsys.h
+++ b/system/gd/shim/dumpsys.h
@@ -36,6 +36,10 @@
os::Handler* GetGdShimHandler();
Dumpsys(const std::string& pre_bundled_schema);
+
+ Dumpsys(const Dumpsys&) = delete;
+ Dumpsys& operator=(const Dumpsys&) = delete;
+
~Dumpsys() = default;
static const ModuleFactory Factory;
@@ -51,7 +55,6 @@
struct impl;
std::unique_ptr<impl> pimpl_;
const dumpsys::ReflectionSchema reflection_schema_;
- DISALLOW_COPY_AND_ASSIGN(Dumpsys);
};
} // namespace shim
diff --git a/system/gd/storage/config_cache.h b/system/gd/storage/config_cache.h
index f0e1fe4..44229e4 100644
--- a/system/gd/storage/config_cache.h
+++ b/system/gd/storage/config_cache.h
@@ -52,10 +52,13 @@
class ConfigCache {
public:
ConfigCache(size_t temp_device_capacity, std::unordered_set<std::string_view> persistent_property_names);
+
+ ConfigCache(const ConfigCache&) = delete;
+ ConfigCache& operator=(const ConfigCache&) = delete;
+
virtual ~ConfigCache() = default;
// no copy
- DISALLOW_COPY_AND_ASSIGN(ConfigCache);
// can move
ConfigCache(ConfigCache&& other) noexcept;
diff --git a/system/gd/storage/storage_module.h b/system/gd/storage/storage_module.h
index 8853a4e..ba41b1a 100644
--- a/system/gd/storage/storage_module.h
+++ b/system/gd/storage/storage_module.h
@@ -47,6 +47,9 @@
static const std::string kAdapterSection;
+ StorageModule(const StorageModule&) = delete;
+ StorageModule& operator=(const StorageModule&) = delete;
+
~StorageModule();
static const ModuleFactory Factory;
@@ -146,8 +149,6 @@
bool is_restricted_mode_;
bool is_single_user_mode_;
static bool is_config_checksum_pass(int check_bit);
-
- DISALLOW_COPY_AND_ASSIGN(StorageModule);
};
} // namespace storage
diff --git a/system/include/hardware/bluetooth.h b/system/include/hardware/bluetooth.h
index ece112e..1613087 100644
--- a/system/include/hardware/bluetooth.h
+++ b/system/include/hardware/bluetooth.h
@@ -282,11 +282,11 @@
*/
BT_PROPERTY_ADAPTER_BONDED_DEVICES,
/**
- * Description - Bluetooth Adapter Discovery timeout (in seconds)
+ * Description - Bluetooth Adapter Discoverable timeout (in seconds)
* Access mode - GET and SET
* Data type - uint32_t
*/
- BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
+ BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT,
/* Properties unique to remote device */
/**
diff --git a/system/main/Android.bp b/system/main/Android.bp
index d2692da..c1cc24f 100644
--- a/system/main/Android.bp
+++ b/system/main/Android.bp
@@ -99,7 +99,6 @@
"libbt-sbc-encoder",
"libFraunhoferAAC",
"libg722codec",
- "liblc3codec",
"liblc3",
"libudrv-uipc",
"libprotobuf-cpp-lite",
diff --git a/system/main/shim/acl.h b/system/main/shim/acl.h
index d156f85..f90e641 100644
--- a/system/main/shim/acl.h
+++ b/system/main/shim/acl.h
@@ -43,6 +43,10 @@
public:
Acl(os::Handler* handler, const acl_interface_t& acl_interface,
uint8_t max_acceptlist_size, uint8_t max_address_resolution_size);
+
+ Acl(const Acl&) = delete;
+ Acl& operator=(const Acl&) = delete;
+
~Acl();
// hci::acl_manager::ConnectionCallbacks
@@ -120,7 +124,6 @@
struct impl;
std::unique_ptr<impl> pimpl_;
- DISALLOW_COPY_AND_ASSIGN(Acl);
};
} // namespace legacy
diff --git a/system/main/shim/stack.h b/system/main/shim/stack.h
index b105866..f32db43 100644
--- a/system/main/shim/stack.h
+++ b/system/main/shim/stack.h
@@ -39,6 +39,9 @@
static Stack* GetInstance();
Stack() = default;
+ Stack(const Stack&) = delete;
+ Stack& operator=(const Stack&) = delete;
+
~Stack() = default;
// Idle mode, config is loaded, but controller is not enabled
@@ -64,8 +67,6 @@
return rust_controller_;
}
- DISALLOW_COPY_AND_ASSIGN(Stack);
-
private:
mutable std::recursive_mutex mutex_;
StackManager stack_manager_;
diff --git a/system/packet/avrcp/avrcp_browse_packet.h b/system/packet/avrcp/avrcp_browse_packet.h
index 038f576..f6bd72e 100644
--- a/system/packet/avrcp/avrcp_browse_packet.h
+++ b/system/packet/avrcp/avrcp_browse_packet.h
@@ -17,7 +17,6 @@
#pragma once
#include <base/logging.h>
-#include <base/macros.h>
#include <iostream>
#include "hardware/avrcp/avrcp_common.h"
@@ -52,6 +51,9 @@
class BrowsePacket : public ::bluetooth::Packet {
public:
+ BrowsePacket(const BrowsePacket&) = delete;
+ BrowsePacket& operator=(const BrowsePacket&) = delete;
+
virtual ~BrowsePacket() = default;
static std::shared_ptr<BrowsePacket> Parse(
@@ -76,8 +78,7 @@
private:
virtual std::pair<size_t, size_t> GetPayloadIndecies() const override;
- DISALLOW_COPY_AND_ASSIGN(BrowsePacket);
};
} // namespace avrcp
-} // namespace bluetooth
\ No newline at end of file
+} // namespace bluetooth
diff --git a/system/packet/avrcp/avrcp_packet.h b/system/packet/avrcp/avrcp_packet.h
index ee0e0d5..7a44dc5 100644
--- a/system/packet/avrcp/avrcp_packet.h
+++ b/system/packet/avrcp/avrcp_packet.h
@@ -17,7 +17,6 @@
#pragma once
#include <base/logging.h>
-#include <base/macros.h>
#include <iostream>
#include "hardware/avrcp/avrcp_common.h"
@@ -62,6 +61,9 @@
class Packet : public ::bluetooth::Packet {
public:
+ Packet(const Packet&) = delete;
+ Packet& operator=(const Packet&) = delete;
+
virtual ~Packet() = default;
// TODO (apanicke): Right now we can use this to build an AvrcpPacket from
@@ -104,7 +106,6 @@
private:
virtual std::pair<size_t, size_t> GetPayloadIndecies() const override;
- DISALLOW_COPY_AND_ASSIGN(Packet);
};
} // namespace avrcp
diff --git a/system/profile/avrcp/connection_handler.h b/system/profile/avrcp/connection_handler.h
index 5320b63..67445a8 100644
--- a/system/profile/avrcp/connection_handler.h
+++ b/system/profile/avrcp/connection_handler.h
@@ -158,6 +158,9 @@
tAVRC_MSG* p_msg);
ConnectionHandler() : weak_ptr_factory_(this){};
+ ConnectionHandler(const ConnectionHandler&) = delete;
+ ConnectionHandler& operator=(const ConnectionHandler&) = delete;
+
virtual ~ConnectionHandler() = default;
// Callback for when sending a response to a device
@@ -165,7 +168,6 @@
std::unique_ptr<::bluetooth::PacketBuilder> message);
base::WeakPtrFactory<ConnectionHandler> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(ConnectionHandler);
};
} // namespace avrcp
diff --git a/system/profile/avrcp/device.h b/system/profile/avrcp/device.h
index fc5d736..07e1cac 100644
--- a/system/profile/avrcp/device.h
+++ b/system/profile/avrcp/device.h
@@ -65,6 +65,10 @@
std::unique_ptr<::bluetooth::PacketBuilder> message)>
send_msg_cb,
uint16_t ctrl_mtu, uint16_t browse_mtu);
+
+ Device(const Device&) = delete;
+ Device& operator=(const Device&) = delete;
+
virtual ~Device() = default;
/**
@@ -339,7 +343,6 @@
std::set<uint8_t> active_labels_;
int8_t volume_ = -1;
- DISALLOW_COPY_AND_ASSIGN(Device);
};
} // namespace avrcp
diff --git a/system/service/a2dp_sink.h b/system/service/a2dp_sink.h
index 7bf5902..7b6f3ce 100644
--- a/system/service/a2dp_sink.h
+++ b/system/service/a2dp_sink.h
@@ -16,8 +16,6 @@
#pragma once
-#include <base/macros.h>
-
#include <atomic>
#include <mutex>
#include <string>
@@ -47,6 +45,9 @@
virtual ~Delegate() = default;
};
+ A2dpSink(const A2dpSink&) = delete;
+ A2dpSink& operator=(const A2dpSink&) = delete;
+
~A2dpSink() override;
void SetDelegate(Delegate* delegate);
@@ -84,21 +85,19 @@
std::mutex mutex_;
std::mutex delegate_mutex_;
Delegate* delegate_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(A2dpSink);
};
class A2dpSinkFactory : public BluetoothInstanceFactory {
public:
A2dpSinkFactory();
+ A2dpSinkFactory(const A2dpSinkFactory&) = delete;
+ A2dpSinkFactory& operator=(const A2dpSinkFactory&) = delete;
+
~A2dpSinkFactory() override;
// BluetoothInstanceFactory override:
bool RegisterInstance(const Uuid& uuid,
const RegisterCallback& callback) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(A2dpSinkFactory);
};
} // namespace bluetooth
diff --git a/system/service/a2dp_source.h b/system/service/a2dp_source.h
index 801393f..5b1b554 100644
--- a/system/service/a2dp_source.h
+++ b/system/service/a2dp_source.h
@@ -16,8 +16,6 @@
#pragma once
-#include <base/macros.h>
-
#include <atomic>
#include <mutex>
#include <string>
@@ -50,6 +48,9 @@
virtual ~Delegate() = default;
};
+ A2dpSource(const A2dpSource&) = delete;
+ A2dpSource& operator=(const A2dpSource&) = delete;
+
~A2dpSource() override;
void SetDelegate(Delegate* delegate);
@@ -99,21 +100,19 @@
// delegate function which attempts to take 'clock'.
std::mutex delegate_mutex_;
Delegate* delegate_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(A2dpSource);
};
class A2dpSourceFactory : public BluetoothInstanceFactory {
public:
A2dpSourceFactory();
+ A2dpSourceFactory(const A2dpSourceFactory&) = delete;
+ A2dpSourceFactory& operator=(const A2dpSourceFactory&) = delete;
+
~A2dpSourceFactory() override;
// BluetoothInstanceFactory override:
bool RegisterInstance(const Uuid& uuid,
const RegisterCallback& callback) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(A2dpSourceFactory);
};
} // namespace bluetooth
diff --git a/system/service/adapter.cc b/system/service/adapter.cc
index 9c04688..19e7400 100644
--- a/system/service/adapter.cc
+++ b/system/service/adapter.cc
@@ -215,6 +215,9 @@
hal::BluetoothInterface::Get()->GetHALInterface()->get_adapter_properties();
}
+ AdapterImpl(const AdapterImpl&) = delete;
+ AdapterImpl& operator=(const AdapterImpl&) = delete;
+
~AdapterImpl() override {
hal::BluetoothInterface::Get()->RemoveObserver(this);
}
@@ -800,8 +803,6 @@
// Factory used to create per-app GattServer instances.
std::unique_ptr<GattServerFactory> gatt_server_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(AdapterImpl);
};
// static
diff --git a/system/service/adapter.h b/system/service/adapter.h
index a4e517c..e3fa306 100644
--- a/system/service/adapter.h
+++ b/system/service/adapter.h
@@ -20,8 +20,6 @@
#include <string>
#include <vector>
-#include <base/macros.h>
-
#include "service/common/bluetooth/adapter_state.h"
#include "service/common/bluetooth/remote_device_props.h"
@@ -102,6 +100,9 @@
// in tests; use MockAdapter instead.
static std::unique_ptr<Adapter> Create();
+ Adapter(const Adapter&) = delete;
+ Adapter& operator=(const Adapter&) = delete;
+
virtual ~Adapter() = default;
// Add or remove an observer.
@@ -221,9 +222,6 @@
protected:
Adapter() = default;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Adapter);
};
} // namespace bluetooth
diff --git a/system/service/avrcp_control.h b/system/service/avrcp_control.h
index eef36f8..47950e3 100644
--- a/system/service/avrcp_control.h
+++ b/system/service/avrcp_control.h
@@ -19,7 +19,6 @@
#include <atomic>
#include <mutex>
-#include "base/macros.h"
#include "bluetooth/uuid.h"
#include "service/bluetooth_instance.h"
#include "service/common/bluetooth/avrcp_media_attr.h"
@@ -50,6 +49,9 @@
virtual ~Delegate() = default;
};
+ AvrcpControl(const AvrcpControl&) = delete;
+ AvrcpControl& operator=(const AvrcpControl&) = delete;
+
// The destructor automatically unregisters this instance from the stack.
~AvrcpControl() override;
@@ -106,8 +108,6 @@
// Raw handle to the Delegate, which must outlive this AvrcpControl instance.
std::mutex delegate_mutex_;
Delegate* delegate_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(AvrcpControl);
};
// AvrcpControlFactory is used to register and obtain a per-application
@@ -121,6 +121,9 @@
// Don't construct/destruct directly except in tests. Instead, obtain a handle
// from an Adapter instance.
AvrcpControlFactory();
+ AvrcpControlFactory(const AvrcpControlFactory&) = delete;
+ AvrcpControlFactory& operator=(const AvrcpControlFactory&) = delete;
+
~AvrcpControlFactory() override;
// BluetoothInstanceFactory override:
@@ -129,7 +132,6 @@
private:
std::atomic<int> next_control_id_{0};
- DISALLOW_COPY_AND_ASSIGN(AvrcpControlFactory);
};
} // namespace bluetooth
diff --git a/system/service/avrcp_target.cc b/system/service/avrcp_target.cc
index f5d21b7..9a39b41 100644
--- a/system/service/avrcp_target.cc
+++ b/system/service/avrcp_target.cc
@@ -23,7 +23,6 @@
#include "array_utils.h"
#include "base/logging.h"
-#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "service/logging_helpers.h"
#include "stack/include/avrc_defs.h"
diff --git a/system/service/avrcp_target.h b/system/service/avrcp_target.h
index e0ee57b..76c5be0 100644
--- a/system/service/avrcp_target.h
+++ b/system/service/avrcp_target.h
@@ -20,7 +20,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
#include "service/bluetooth_instance.h"
#include "service/common/bluetooth/avrcp_int_value.h"
#include "service/common/bluetooth/avrcp_register_notification_response.h"
@@ -68,6 +67,9 @@
virtual ~Delegate() = default;
};
+ AvrcpTarget(const AvrcpTarget&) = delete;
+ AvrcpTarget& operator=(const AvrcpTarget&) = delete;
+
// The destructor automatically unregisters this instance from the stack.
~AvrcpTarget() override;
@@ -150,8 +152,6 @@
// Raw handle to the Delegate, which must outlive this AvrcpTarget instance.
std::mutex delegate_mutex_;
Delegate* delegate_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(AvrcpTarget);
};
// AvrcpTargetFactory is used to register and obtain a per-application
@@ -165,14 +165,14 @@
// Don't construct/destruct directly except in tests. Instead, obtain a handle
// from an Adapter instance.
AvrcpTargetFactory();
+ AvrcpTargetFactory(const AvrcpTargetFactory&) = delete;
+ AvrcpTargetFactory& operator=(const AvrcpTargetFactory&) = delete;
+
~AvrcpTargetFactory() override;
// BluetoothInstanceFactory override:
bool RegisterInstance(const Uuid& uuid,
const RegisterCallback& callback) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(AvrcpTargetFactory);
};
} // namespace bluetooth
diff --git a/system/service/bluetooth_instance.h b/system/service/bluetooth_instance.h
index d0146c5..5728d5e 100644
--- a/system/service/bluetooth_instance.h
+++ b/system/service/bluetooth_instance.h
@@ -19,7 +19,6 @@
#include <functional>
#include <memory>
-#include <base/macros.h>
#include <bluetooth/uuid.h>
#include "service/common/bluetooth/low_energy_constants.h"
@@ -31,6 +30,9 @@
// stack-assigned integer "instance_id" ID associated with it.
class BluetoothInstance {
public:
+ BluetoothInstance(const BluetoothInstance&) = delete;
+ BluetoothInstance& operator=(const BluetoothInstance&) = delete;
+
virtual ~BluetoothInstance() = default;
// Returns the app-specific unique ID used while registering this instance.
@@ -43,9 +45,6 @@
// Constructor shouldn't be called directly as instances are meant to be
// obtained from the factory.
BluetoothInstance() = default;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BluetoothInstance);
};
// A BluetoothInstanceFactory provides a common interface for factory
@@ -54,6 +53,9 @@
class BluetoothInstanceFactory {
public:
BluetoothInstanceFactory() = default;
+ BluetoothInstanceFactory(const BluetoothInstanceFactory&) = delete;
+ BluetoothInstanceFactory& operator=(const BluetoothInstanceFactory&) = delete;
+
virtual ~BluetoothInstanceFactory() = default;
// Callback invoked as a result of a call to RegisterInstance.
@@ -67,9 +69,6 @@
// the case of an error, the pointer will contain nullptr.
virtual bool RegisterInstance(const Uuid& app_uuid,
const RegisterCallback& callback) = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BluetoothInstanceFactory);
};
} // namespace bluetooth
diff --git a/system/service/bluetooth_interface.cc b/system/service/bluetooth_interface.cc
index aafa04f..1c178bd 100644
--- a/system/service/bluetooth_interface.cc
+++ b/system/service/bluetooth_interface.cc
@@ -239,7 +239,7 @@
switch (property->type) {
case BT_PROPERTY_BDNAME:
case BT_PROPERTY_ADAPTER_SCAN_MODE:
- case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
+ case BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT:
case BT_PROPERTY_CLASS_OF_DEVICE:
case BT_PROPERTY_LOCAL_IO_CAPS:
case BT_PROPERTY_LOCAL_IO_CAPS_BLE:
diff --git a/system/service/client/main.cc b/system/service/client/main.cc
index b4ab06e..b081369 100644
--- a/system/service/client/main.cc
+++ b/system/service/client/main.cc
@@ -20,7 +20,6 @@
#include <base/at_exit.h>
#include <base/command_line.h>
#include <base/logging.h>
-#include <base/macros.h>
#include <base/strings/string_number_conversions.h>
#include <base/strings/string_split.h>
#include <base/strings/string_util.h>
@@ -147,6 +146,8 @@
class CLIBluetoothCallback : public android::bluetooth::BnBluetoothCallback {
public:
CLIBluetoothCallback() = default;
+ CLIBluetoothCallback(const CLIBluetoothCallback&) = delete;
+ CLIBluetoothCallback& operator=(const CLIBluetoothCallback&) = delete;
~CLIBluetoothCallback() override = default;
// IBluetoothCallback overrides:
@@ -216,15 +217,15 @@
// no-op
return Status::ok();
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CLIBluetoothCallback);
};
class CLIBluetoothLowEnergyCallback
: public android::bluetooth::BnBluetoothLowEnergyCallback {
public:
CLIBluetoothLowEnergyCallback() = default;
+ CLIBluetoothLowEnergyCallback(const CLIBluetoothLowEnergyCallback&) = delete;
+ CLIBluetoothLowEnergyCallback& operator=(
+ const CLIBluetoothLowEnergyCallback&) = delete;
~CLIBluetoothLowEnergyCallback() override = default;
// IBluetoothLowEnergyCallback overrides:
@@ -262,15 +263,16 @@
EndAsyncOut();
return Status::ok();
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CLIBluetoothLowEnergyCallback);
};
class CLIBluetoothLeAdvertiserCallback
: public android::bluetooth::BnBluetoothLeAdvertiserCallback {
public:
CLIBluetoothLeAdvertiserCallback() = default;
+ CLIBluetoothLeAdvertiserCallback(const CLIBluetoothLeAdvertiserCallback&) =
+ delete;
+ CLIBluetoothLeAdvertiserCallback& operator=(
+ const CLIBluetoothLeAdvertiserCallback&) = delete;
~CLIBluetoothLeAdvertiserCallback() override = default;
// IBluetoothLowEnergyCallback overrides:
@@ -299,15 +301,15 @@
EndAsyncOut();
return Status::ok();
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CLIBluetoothLeAdvertiserCallback);
};
class CLIBluetoothLeScannerCallback
: public android::bluetooth::BnBluetoothLeScannerCallback {
public:
CLIBluetoothLeScannerCallback() = default;
+ CLIBluetoothLeScannerCallback(const CLIBluetoothLeScannerCallback&) = delete;
+ CLIBluetoothLeScannerCallback& operator=(
+ const CLIBluetoothLeScannerCallback&) = delete;
~CLIBluetoothLeScannerCallback() override = default;
// IBluetoothLowEnergyCallback overrides:
@@ -341,15 +343,14 @@
EndAsyncOut();
return Status::ok();
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CLIBluetoothLeScannerCallback);
};
class CLIGattClientCallback
: public android::bluetooth::BnBluetoothGattClientCallback {
public:
CLIGattClientCallback() = default;
+ CLIGattClientCallback(const CLIGattClientCallback&) = delete;
+ CLIGattClientCallback& operator=(const CLIGattClientCallback&) = delete;
~CLIGattClientCallback() override = default;
// IBluetoothGattClientCallback overrides:
@@ -367,9 +368,6 @@
gatt_registering = false;
return Status::ok();
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CLIGattClientCallback);
};
void PrintCommandStatus(bool status) { PrintOpStatus("Command", status); }
@@ -1051,6 +1049,8 @@
class BluetoothDeathRecipient : public android::IBinder::DeathRecipient {
public:
BluetoothDeathRecipient() = default;
+ BluetoothDeathRecipient(const BluetoothDeathRecipient&) = delete;
+ BluetoothDeathRecipient& operator=(const BluetoothDeathRecipient&) = delete;
~BluetoothDeathRecipient() override = default;
// android::IBinder::DeathRecipient override:
@@ -1063,9 +1063,6 @@
android::IPCThreadState::self()->stopProcess();
should_exit = true;
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BluetoothDeathRecipient);
};
int main(int argc, char* argv[]) {
diff --git a/system/service/common/bluetooth/advertise_data.h b/system/service/common/bluetooth/advertise_data.h
index bae83ee..796f7dc 100644
--- a/system/service/common/bluetooth/advertise_data.h
+++ b/system/service/common/bluetooth/advertise_data.h
@@ -20,8 +20,6 @@
#include <vector>
-#include <base/macros.h>
-
namespace bluetooth {
// Represents a data packet for Bluetooth Low Energy advertisements. This is the
diff --git a/system/service/common/bluetooth/advertise_settings.h b/system/service/common/bluetooth/advertise_settings.h
index 4aff4c9..e4aee53 100644
--- a/system/service/common/bluetooth/advertise_settings.h
+++ b/system/service/common/bluetooth/advertise_settings.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <base/time/time.h>
namespace bluetooth {
diff --git a/system/service/common/bluetooth/util/atomic_string.h b/system/service/common/bluetooth/util/atomic_string.h
index 46d4588..f5ed1c3 100644
--- a/system/service/common/bluetooth/util/atomic_string.h
+++ b/system/service/common/bluetooth/util/atomic_string.h
@@ -19,14 +19,16 @@
#include <mutex>
#include <string>
-#include <base/macros.h>
-
namespace util {
// A simple atomic container class for std::string.
class AtomicString final {
public:
explicit AtomicString(const std::string& str);
+
+ AtomicString(const AtomicString&) = delete;
+ AtomicString& operator=(const AtomicString&) = delete;
+
~AtomicString() = default;
std::string Get() const;
@@ -35,8 +37,6 @@
private:
std::mutex lock_;
std::string str_;
-
- DISALLOW_COPY_AND_ASSIGN(AtomicString);
};
} // namespace util
diff --git a/system/service/daemon.cc b/system/service/daemon.cc
index 4cd3842..11bfae1 100644
--- a/system/service/daemon.cc
+++ b/system/service/daemon.cc
@@ -42,6 +42,9 @@
public:
DaemonImpl() : initialized_(false) {}
+ DaemonImpl(const DaemonImpl&) = delete;
+ DaemonImpl& operator=(const DaemonImpl&) = delete;
+
~DaemonImpl() override {
if (!initialized_) return;
@@ -161,8 +164,6 @@
std::unique_ptr<Settings> settings_;
std::unique_ptr<Adapter> adapter_;
std::unique_ptr<ipc::IPCManager> ipc_manager_;
-
- DISALLOW_COPY_AND_ASSIGN(DaemonImpl);
};
} // namespace
diff --git a/system/service/daemon.h b/system/service/daemon.h
index 06afe91..a1f26a0 100644
--- a/system/service/daemon.h
+++ b/system/service/daemon.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include "abstract_message_loop.h"
namespace ipc {
@@ -62,13 +61,14 @@
protected:
Daemon() = default;
+ Daemon(const Daemon&) = delete;
+ Daemon& operator=(const Daemon&) = delete;
+
virtual ~Daemon() = default;
private:
// Internal instance helper called by Initialize().
virtual bool Init() = 0;
-
- DISALLOW_COPY_AND_ASSIGN(Daemon);
};
} // namespace bluetooth
diff --git a/system/service/example/heart_rate/heart_rate_server.cc b/system/service/example/heart_rate/heart_rate_server.cc
index 170042a..9777c20 100644
--- a/system/service/example/heart_rate/heart_rate_server.cc
+++ b/system/service/example/heart_rate/heart_rate_server.cc
@@ -41,6 +41,11 @@
android::sp<android::bluetooth::IBluetooth> bt)
: bt_(bt) {}
+ CLIBluetoothLeAdvertiserCallback(const CLIBluetoothLeAdvertiserCallback&) =
+ delete;
+ CLIBluetoothLeAdvertiserCallback& operator=(
+ const CLIBluetoothLeAdvertiserCallback&) = delete;
+
// IBluetoothLeAdvertiserCallback overrides:
Status OnAdvertiserRegistered(int status, int advertiser_id) {
if (status != bluetooth::BLE_STATUS_SUCCESS) {
@@ -90,7 +95,6 @@
private:
android::sp<android::bluetooth::IBluetooth> bt_;
- DISALLOW_COPY_AND_ASSIGN(CLIBluetoothLeAdvertiserCallback);
};
HeartRateServer::HeartRateServer(
diff --git a/system/service/example/heart_rate/heart_rate_server.h b/system/service/example/heart_rate/heart_rate_server.h
index e78c58a..1b716fd 100644
--- a/system/service/example/heart_rate/heart_rate_server.h
+++ b/system/service/example/heart_rate/heart_rate_server.h
@@ -19,7 +19,6 @@
#include <mutex>
#include <unordered_map>
-#include <base/macros.h>
#include <base/memory/ref_counted.h>
#include <base/memory/weak_ptr.h>
#if BASE_VER < 930627
@@ -44,6 +43,9 @@
HeartRateServer(android::sp<android::bluetooth::IBluetooth> bluetooth,
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
bool advertise);
+ HeartRateServer(const HeartRateServer&) = delete;
+ HeartRateServer& operator=(const HeartRateServer&) = delete;
+
~HeartRateServer() override;
// Set up the server and register the GATT services with the stack. This
@@ -141,8 +143,6 @@
// Note: This should remain the last member so that it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
base::WeakPtrFactory<HeartRateServer> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(HeartRateServer);
};
} // namespace heart_rate
diff --git a/system/service/gatt_client.h b/system/service/gatt_client.h
index 5a0322d..4ed1143 100644
--- a/system/service/gatt_client.h
+++ b/system/service/gatt_client.h
@@ -19,7 +19,6 @@
#include <mutex>
#include <unordered_map>
-#include <base/macros.h>
#include <bluetooth/uuid.h>
#include "service/bluetooth_instance.h"
@@ -32,6 +31,9 @@
// obtained through the factory.
class GattClient : public BluetoothInstance {
public:
+ GattClient(const GattClient&) = delete;
+ GattClient& operator=(const GattClient&) = delete;
+
~GattClient() override;
// BluetoothClientInstace overrides:
@@ -48,8 +50,6 @@
// See getters above for documentation.
Uuid app_identifier_;
int client_id_;
-
- DISALLOW_COPY_AND_ASSIGN(GattClient);
};
// GattClientFactory is used to register and obtain a per-application GattClient
@@ -61,6 +61,9 @@
// Don't construct/destruct directly except in tests. Instead, obtain a handle
// from an Adapter instance.
GattClientFactory();
+ GattClientFactory(const GattClientFactory&) = delete;
+ GattClientFactory& operator=(const GattClientFactory&) = delete;
+
~GattClientFactory() override;
// BluetoothInstanceFactory override:
@@ -76,8 +79,6 @@
// Map of pending calls to register.
std::mutex pending_calls_lock_;
std::unordered_map<Uuid, RegisterCallback> pending_calls_;
-
- DISALLOW_COPY_AND_ASSIGN(GattClientFactory);
};
} // namespace bluetooth
diff --git a/system/service/gatt_server.h b/system/service/gatt_server.h
index c46e8d0..7d670ae 100644
--- a/system/service/gatt_server.h
+++ b/system/service/gatt_server.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <bluetooth/uuid.h>
#include <deque>
@@ -45,6 +44,9 @@
class Delegate {
public:
Delegate() = default;
+ Delegate(const Delegate&) = delete;
+ Delegate& operator=(const Delegate&) = delete;
+
virtual ~Delegate() = default;
// Called when there is an incoming read request for the characteristic with
@@ -104,12 +106,12 @@
virtual void OnConnectionStateChanged(GattServer* gatt_server,
const std::string& device_addres,
bool connected) = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Delegate);
};
// The desctructor automatically unregisters this instance from the stack.
+ GattServer(const GattServer&) = delete;
+ GattServer& operator=(const GattServer&) = delete;
+
~GattServer() override;
// Assigns a delegate to this instance. |delegate| must out-live this
@@ -262,8 +264,6 @@
// Raw handle to the Delegate, which must outlive this GattServer instance.
Delegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(GattServer);
};
// GattServerFactory is used to register and obtain a per-application GattServer
@@ -275,6 +275,9 @@
// Don't construct/destruct directly except in tests. Instead, obtain a handle
// from an Adapter instance.
GattServerFactory();
+ GattServerFactory(const GattServerFactory&) = delete;
+ GattServerFactory& operator=(const GattServerFactory&) = delete;
+
~GattServerFactory() override;
// BluetoothInstanceFactory override:
@@ -290,8 +293,6 @@
// Map of pending calls to register.
std::mutex pending_calls_lock_;
std::unordered_map<Uuid, RegisterCallback> pending_calls_;
-
- DISALLOW_COPY_AND_ASSIGN(GattServerFactory);
};
} // namespace bluetooth
diff --git a/system/service/hal/bluetooth_av_interface.cc b/system/service/hal/bluetooth_av_interface.cc
index e4a759d..beabd96 100644
--- a/system/service/hal/bluetooth_av_interface.cc
+++ b/system/service/hal/bluetooth_av_interface.cc
@@ -147,6 +147,9 @@
class BluetoothAvInterfaceImpl : public BluetoothAvInterface {
public:
BluetoothAvInterfaceImpl() = default;
+ BluetoothAvInterfaceImpl(const BluetoothAvInterfaceImpl&) = delete;
+ BluetoothAvInterfaceImpl& operator=(const BluetoothAvInterfaceImpl&) = delete;
+
~BluetoothAvInterfaceImpl() override {
A2dpSinkDisable();
A2dpSourceDisable();
@@ -274,8 +277,6 @@
bool source_enabled_ = false;
bool sink_enabled_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothAvInterfaceImpl);
};
namespace {
diff --git a/system/service/hal/bluetooth_av_interface.h b/system/service/hal/bluetooth_av_interface.h
index 2b444b2..4f0b477 100644
--- a/system/service/hal/bluetooth_av_interface.h
+++ b/system/service/hal/bluetooth_av_interface.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_av.h>
@@ -90,10 +89,10 @@
protected:
BluetoothAvInterface() = default;
- virtual ~BluetoothAvInterface() = default;
+ BluetoothAvInterface(const BluetoothAvInterface&) = delete;
+ BluetoothAvInterface& operator=(const BluetoothAvInterface&) = delete;
- private:
- DISALLOW_COPY_AND_ASSIGN(BluetoothAvInterface);
+ virtual ~BluetoothAvInterface() = default;
};
} // namespace hal
diff --git a/system/service/hal/bluetooth_avrcp_interface.cc b/system/service/hal/bluetooth_avrcp_interface.cc
index 42ac0a6..cbb0317 100644
--- a/system/service/hal/bluetooth_avrcp_interface.cc
+++ b/system/service/hal/bluetooth_avrcp_interface.cc
@@ -490,6 +490,10 @@
public:
BluetoothAvrcpInterfaceImpl() : control_iface_(nullptr) {}
+ BluetoothAvrcpInterfaceImpl(const BluetoothAvrcpInterfaceImpl&) = delete;
+ BluetoothAvrcpInterfaceImpl& operator=(const BluetoothAvrcpInterfaceImpl&) =
+ delete;
+
~BluetoothAvrcpInterfaceImpl() override {
if (control_iface_) control_iface_->cleanup();
}
@@ -614,8 +618,6 @@
bool control_enabled_ = false;
bool target_enabled_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpInterfaceImpl);
};
namespace {
diff --git a/system/service/hal/bluetooth_avrcp_interface.h b/system/service/hal/bluetooth_avrcp_interface.h
index fc67c3c..4646880 100644
--- a/system/service/hal/bluetooth_avrcp_interface.h
+++ b/system/service/hal/bluetooth_avrcp_interface.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_rc.h>
@@ -130,6 +129,9 @@
uint8_t status);
};
+ BluetoothAvrcpInterface(const BluetoothAvrcpInterface&) = delete;
+ BluetoothAvrcpInterface& operator=(const BluetoothAvrcpInterface&) = delete;
+
// Initialize and clean up the BluetoothInterface singleton. Returns false if
// the underlying HAL interface failed to initialize, and true on success.
static bool Initialize();
@@ -172,9 +174,6 @@
protected:
BluetoothAvrcpInterface() = default;
virtual ~BluetoothAvrcpInterface() = default;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpInterface);
};
} // namespace hal
diff --git a/system/service/hal/bluetooth_gatt_interface.cc b/system/service/hal/bluetooth_gatt_interface.cc
index c9d165b..76cf5c9 100644
--- a/system/service/hal/bluetooth_gatt_interface.cc
+++ b/system/service/hal/bluetooth_gatt_interface.cc
@@ -443,6 +443,10 @@
public:
BluetoothGattInterfaceImpl() : hal_iface_(nullptr) {}
+ BluetoothGattInterfaceImpl(const BluetoothGattInterfaceImpl&) = delete;
+ BluetoothGattInterfaceImpl& operator=(const BluetoothGattInterfaceImpl&) =
+ delete;
+
~BluetoothGattInterfaceImpl() override {
if (hal_iface_) hal_iface_->cleanup();
}
@@ -536,8 +540,6 @@
// The HAL handle obtained from the shared library. We hold a weak reference
// to this since the actual data resides in the shared Bluetooth library.
const btgatt_interface_t* hal_iface_;
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothGattInterfaceImpl);
};
namespace {
diff --git a/system/service/hal/bluetooth_gatt_interface.h b/system/service/hal/bluetooth_gatt_interface.h
index 471dfc4..ad3f851 100644
--- a/system/service/hal/bluetooth_gatt_interface.h
+++ b/system/service/hal/bluetooth_gatt_interface.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_gatt.h>
@@ -254,14 +253,15 @@
protected:
BluetoothGattInterface() = default;
+ BluetoothGattInterface(const BluetoothGattInterface&) = delete;
+ BluetoothGattInterface& operator=(const BluetoothGattInterface&) = delete;
+
virtual ~BluetoothGattInterface() = default;
private:
// Used to keep a reference count for the different BLE scan clients.
std::mutex scan_clients_lock_;
std::unordered_set<int> scan_client_set_;
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothGattInterface);
};
} // namespace hal
diff --git a/system/service/hal/bluetooth_interface.cc b/system/service/hal/bluetooth_interface.cc
index 4f1858e..3acb572 100644
--- a/system/service/hal/bluetooth_interface.cc
+++ b/system/service/hal/bluetooth_interface.cc
@@ -296,6 +296,9 @@
public:
BluetoothInterfaceImpl() : hal_iface_(nullptr) {}
+ BluetoothInterfaceImpl(const BluetoothInterfaceImpl&) = delete;
+ BluetoothInterfaceImpl& operator=(const BluetoothInterfaceImpl&) = delete;
+
~BluetoothInterfaceImpl() override {
if (hal_iface_) hal_iface_->cleanup();
}
@@ -357,8 +360,6 @@
// The HAL handle obtained from the shared library. We hold a weak reference
// to this since the actual data resides in the shared Bluetooth library.
const bt_interface_t* hal_iface_;
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothInterfaceImpl);
};
namespace {
diff --git a/system/service/hal/bluetooth_interface.h b/system/service/hal/bluetooth_interface.h
index 0eaf8d8..da68c9c 100644
--- a/system/service/hal/bluetooth_interface.h
+++ b/system/service/hal/bluetooth_interface.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <hardware/bluetooth.h>
#include "types/raw_address.h"
@@ -126,10 +125,10 @@
protected:
BluetoothInterface() = default;
- virtual ~BluetoothInterface() = default;
+ BluetoothInterface(const BluetoothInterface&) = delete;
+ BluetoothInterface& operator=(const BluetoothInterface&) = delete;
- private:
- DISALLOW_COPY_AND_ASSIGN(BluetoothInterface);
+ virtual ~BluetoothInterface() = default;
};
} // namespace hal
diff --git a/system/service/hal/fake_bluetooth_av_interface.h b/system/service/hal/fake_bluetooth_av_interface.h
index c97c9a3..e4a45ce 100644
--- a/system/service/hal/fake_bluetooth_av_interface.h
+++ b/system/service/hal/fake_bluetooth_av_interface.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <base/observer_list.h>
#include "abstract_observer_list.h"
@@ -56,6 +55,10 @@
std::shared_ptr<TestA2dpSourceHandler> a2dp_source_handler);
FakeBluetoothAvInterface(
std::shared_ptr<TestA2dpSinkHandler> a2dp_sink_handler);
+
+ FakeBluetoothAvInterface(const FakeBluetoothAvInterface&) = delete;
+ FakeBluetoothAvInterface& operator=(const FakeBluetoothAvInterface&) = delete;
+
~FakeBluetoothAvInterface();
// The methods below can be used to notify observers with certain events and
@@ -92,8 +95,6 @@
private:
btbase::AbstractObserverList<A2dpSourceObserver> a2dp_source_observers_;
btbase::AbstractObserverList<A2dpSinkObserver> a2dp_sink_observers_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeBluetoothAvInterface);
};
} // namespace hal
diff --git a/system/service/hal/fake_bluetooth_gatt_interface.h b/system/service/hal/fake_bluetooth_gatt_interface.h
index d6e917f..eb3b9bf 100644
--- a/system/service/hal/fake_bluetooth_gatt_interface.h
+++ b/system/service/hal/fake_bluetooth_gatt_interface.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <base/observer_list.h>
#include <vector>
@@ -75,6 +74,11 @@
std::shared_ptr<BleScannerInterface> scanner_handler,
std::shared_ptr<TestClientHandler> client_handler,
std::shared_ptr<TestServerHandler> server_handler);
+
+ FakeBluetoothGattInterface(const FakeBluetoothGattInterface&) = delete;
+ FakeBluetoothGattInterface& operator=(const FakeBluetoothGattInterface&) =
+ delete;
+
~FakeBluetoothGattInterface();
// The methods below can be used to notify observers with certain events and
@@ -148,8 +152,6 @@
std::shared_ptr<BleScannerInterface> scanner_handler_;
std::shared_ptr<TestClientHandler> client_handler_;
std::shared_ptr<TestServerHandler> server_handler_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattInterface);
};
} // namespace hal
diff --git a/system/service/hal/fake_bluetooth_interface.h b/system/service/hal/fake_bluetooth_interface.h
index 9ea99b5..08f189a 100644
--- a/system/service/hal/fake_bluetooth_interface.h
+++ b/system/service/hal/fake_bluetooth_interface.h
@@ -14,7 +14,6 @@
// limitations under the License.
//
-#include <base/macros.h>
#include <base/observer_list.h>
#include "abstract_observer_list.h"
@@ -44,6 +43,9 @@
static Manager* GetManager();
FakeBluetoothInterface() = default;
+ FakeBluetoothInterface(const FakeBluetoothInterface&) = delete;
+ FakeBluetoothInterface& operator=(const FakeBluetoothInterface&) = delete;
+
~FakeBluetoothInterface() override = default;
// Notifies the observers that the adapter state changed to |state|.
@@ -70,8 +72,6 @@
private:
btbase::AbstractObserverList<Observer> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeBluetoothInterface);
};
} // namespace hal
diff --git a/system/service/ipc/binder/bluetooth_a2dp_sink_binder_server.h b/system/service/ipc/binder/bluetooth_a2dp_sink_binder_server.h
index e18af54..f54733c 100644
--- a/system/service/ipc/binder/bluetooth_a2dp_sink_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_a2dp_sink_binder_server.h
@@ -19,8 +19,6 @@
#include <map>
#include <string>
-#include <base/macros.h>
-
#include <android/bluetooth/BnBluetoothA2dpSink.h>
#include <android/bluetooth/IBluetoothA2dpSinkCallback.h>
@@ -40,6 +38,10 @@
public bluetooth::A2dpSink::Delegate {
public:
explicit BluetoothA2dpSinkBinderServer(bluetooth::Adapter* adapter);
+ BluetoothA2dpSinkBinderServer(const BluetoothA2dpSinkBinderServer&) = delete;
+ BluetoothA2dpSinkBinderServer& operator=(
+ const BluetoothA2dpSinkBinderServer&) = delete;
+
~BluetoothA2dpSinkBinderServer() override = default;
// IBluetoothA2dpSink implementation:
@@ -78,8 +80,6 @@
bluetooth::BluetoothInstance* instance) override;
bluetooth::Adapter* adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothA2dpSinkBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_a2dp_source_binder_server.h b/system/service/ipc/binder/bluetooth_a2dp_source_binder_server.h
index 160a38a..3800a96 100644
--- a/system/service/ipc/binder/bluetooth_a2dp_source_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_a2dp_source_binder_server.h
@@ -20,8 +20,6 @@
#include <string>
#include <vector>
-#include <base/macros.h>
-
#include <android/bluetooth/BnBluetoothA2dpSource.h>
#include <android/bluetooth/IBluetoothA2dpSourceCallback.h>
@@ -41,6 +39,11 @@
public bluetooth::A2dpSource::Delegate {
public:
explicit BluetoothA2dpSourceBinderServer(bluetooth::Adapter* adapter);
+ BluetoothA2dpSourceBinderServer(const BluetoothA2dpSourceBinderServer&) =
+ delete;
+ BluetoothA2dpSourceBinderServer& operator=(
+ const BluetoothA2dpSourceBinderServer&) = delete;
+
~BluetoothA2dpSourceBinderServer() override;
bool HasInstance();
@@ -87,8 +90,6 @@
bluetooth::BluetoothInstance* instance) override;
bluetooth::Adapter* const adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothA2dpSourceBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_avrcp_control_binder_server.h b/system/service/ipc/binder/bluetooth_avrcp_control_binder_server.h
index 11cf1f3..00b5921 100644
--- a/system/service/ipc/binder/bluetooth_avrcp_control_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_avrcp_control_binder_server.h
@@ -19,8 +19,6 @@
#include <map>
#include <string>
-#include "base/macros.h"
-
#include "android/bluetooth/BnBluetoothAvrcpControl.h"
#include "android/bluetooth/IBluetoothAvrcpControlCallback.h"
@@ -40,6 +38,11 @@
public bluetooth::AvrcpControl::Delegate {
public:
explicit BluetoothAvrcpControlBinderServer(bluetooth::Adapter* adapter);
+ BluetoothAvrcpControlBinderServer(const BluetoothAvrcpControlBinderServer&) =
+ delete;
+ BluetoothAvrcpControlBinderServer& operator=(
+ const BluetoothAvrcpControlBinderServer&) = delete;
+
~BluetoothAvrcpControlBinderServer() override = default;
// IBluetoothAvrcpControl implementation:
@@ -81,8 +84,6 @@
std::shared_ptr<bluetooth::AvrcpControl> GetAvrcpControl(int id);
bluetooth::Adapter* adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpControlBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_avrcp_target_binder_server.h b/system/service/ipc/binder/bluetooth_avrcp_target_binder_server.h
index 9d2bba0..aeab315 100644
--- a/system/service/ipc/binder/bluetooth_avrcp_target_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_avrcp_target_binder_server.h
@@ -20,8 +20,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
-
#include "android/bluetooth/BnBluetoothAvrcpTarget.h"
#include "android/bluetooth/IBluetoothAvrcpTargetCallback.h"
@@ -41,6 +39,11 @@
public bluetooth::AvrcpTarget::Delegate {
public:
explicit BluetoothAvrcpTargetBinderServer(bluetooth::Adapter* adapter);
+ BluetoothAvrcpTargetBinderServer(const BluetoothAvrcpTargetBinderServer&) =
+ delete;
+ BluetoothAvrcpTargetBinderServer& operator=(
+ const BluetoothAvrcpTargetBinderServer&) = delete;
+
~BluetoothAvrcpTargetBinderServer() override;
bool HasInstance();
@@ -123,8 +126,6 @@
std::shared_ptr<bluetooth::AvrcpTarget> GetAvrcpTarget();
bluetooth::Adapter* const adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpTargetBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_binder_server.h b/system/service/ipc/binder/bluetooth_binder_server.h
index 7131e8b..a389d3f 100644
--- a/system/service/ipc/binder/bluetooth_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_binder_server.h
@@ -19,7 +19,6 @@
#include <string>
#include <vector>
-#include <base/macros.h>
#include <utils/String16.h>
#include <utils/Vector.h>
@@ -66,6 +65,10 @@
public bluetooth::Adapter::Observer {
public:
explicit BluetoothBinderServer(bluetooth::Adapter* adapter);
+
+ BluetoothBinderServer(const BluetoothBinderServer&) = delete;
+ BluetoothBinderServer& operator=(const BluetoothBinderServer&) = delete;
+
~BluetoothBinderServer() override;
// IBluetooth overrides:
@@ -188,8 +191,6 @@
// The IBluetoothAvrcpTarget interface handle. This is lazily initialized on
// the first call to GetAvrcpTargetInterface().
android::sp<BluetoothAvrcpTargetBinderServer> avrcp_target_interface_;
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_gatt_client_binder_server.h b/system/service/ipc/binder/bluetooth_gatt_client_binder_server.h
index 65b8b60..28fa325 100644
--- a/system/service/ipc/binder/bluetooth_gatt_client_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_gatt_client_binder_server.h
@@ -16,8 +16,6 @@
#pragma once
-#include <base/macros.h>
-
#include <android/bluetooth/BnBluetoothGattClient.h>
#include <android/bluetooth/IBluetoothGattClientCallback.h>
@@ -41,6 +39,12 @@
public InterfaceWithInstancesBase {
public:
explicit BluetoothGattClientBinderServer(bluetooth::Adapter* adapter);
+
+ BluetoothGattClientBinderServer(const BluetoothGattClientBinderServer&) =
+ delete;
+ BluetoothGattClientBinderServer& operator=(
+ const BluetoothGattClientBinderServer&) = delete;
+
~BluetoothGattClientBinderServer() override = default;
// IBluetoothGattClient overrides:
@@ -67,8 +71,6 @@
bluetooth::BluetoothInstance* instance) override;
bluetooth::Adapter* adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothGattClientBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h b/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h
index 925339a..34fb7c5 100644
--- a/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_gatt_server_binder_server.h
@@ -16,8 +16,6 @@
#pragma once
-#include <base/macros.h>
-
#include <android/bluetooth/BnBluetoothGattServer.h>
#include <android/bluetooth/IBluetoothGattServerCallback.h>
@@ -42,6 +40,12 @@
public bluetooth::GattServer::Delegate {
public:
explicit BluetoothGattServerBinderServer(bluetooth::Adapter* adapter);
+
+ BluetoothGattServerBinderServer(const BluetoothGattServerBinderServer&) =
+ delete;
+ BluetoothGattServerBinderServer& operator=(
+ const BluetoothGattServerBinderServer&) = delete;
+
~BluetoothGattServerBinderServer() override = default;
// IBluetoothGattServer overrides:
@@ -109,8 +113,6 @@
bluetooth::BluetoothInstance* instance) override;
bluetooth::Adapter* adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothGattServerBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_le_advertiser_binder_server.h b/system/service/ipc/binder/bluetooth_le_advertiser_binder_server.h
index 6602f5a..a8fca24 100644
--- a/system/service/ipc/binder/bluetooth_le_advertiser_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_le_advertiser_binder_server.h
@@ -18,8 +18,6 @@
#include <memory>
-#include <base/macros.h>
-
#include <android/bluetooth/IBluetoothLeAdvertiserCallback.h>
#include "android/bluetooth/BnBluetoothLeAdvertiser.h"
@@ -45,6 +43,12 @@
public InterfaceWithInstancesBase {
public:
explicit BluetoothLeAdvertiserBinderServer(bluetooth::Adapter* adapter);
+
+ BluetoothLeAdvertiserBinderServer(const BluetoothLeAdvertiserBinderServer&) =
+ delete;
+ BluetoothLeAdvertiserBinderServer& operator=(
+ const BluetoothLeAdvertiserBinderServer&) = delete;
+
~BluetoothLeAdvertiserBinderServer() override;
// IBluetoothLowEnergy overrides:
@@ -77,8 +81,6 @@
bluetooth::BluetoothInstance* instance) override;
bluetooth::Adapter* adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothLeAdvertiserBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_le_scanner_binder_server.h b/system/service/ipc/binder/bluetooth_le_scanner_binder_server.h
index 0cc3ae9..3288a4c 100644
--- a/system/service/ipc/binder/bluetooth_le_scanner_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_le_scanner_binder_server.h
@@ -18,8 +18,6 @@
#include <memory>
-#include <base/macros.h>
-
#include <android/bluetooth/IBluetoothLeScannerCallback.h>
#include "android/bluetooth/BnBluetoothLeScanner.h"
@@ -47,6 +45,11 @@
public bluetooth::LowEnergyScanner::Delegate {
public:
explicit BluetoothLeScannerBinderServer(bluetooth::Adapter* adapter);
+ BluetoothLeScannerBinderServer(const BluetoothLeScannerBinderServer&) =
+ delete;
+ BluetoothLeScannerBinderServer& operator=(
+ const BluetoothLeScannerBinderServer&) = delete;
+
~BluetoothLeScannerBinderServer() override;
// IBluetoothLowEnergy overrides:
@@ -79,8 +82,6 @@
bluetooth::BluetoothInstance* instance) override;
bluetooth::Adapter* adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothLeScannerBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/bluetooth_low_energy_binder_server.h b/system/service/ipc/binder/bluetooth_low_energy_binder_server.h
index 4508b34..0db2312 100644
--- a/system/service/ipc/binder/bluetooth_low_energy_binder_server.h
+++ b/system/service/ipc/binder/bluetooth_low_energy_binder_server.h
@@ -18,8 +18,6 @@
#include <memory>
-#include <base/macros.h>
-
#include <android/bluetooth/IBluetoothLowEnergyCallback.h>
#include "android/bluetooth/BnBluetoothLowEnergy.h"
@@ -47,6 +45,11 @@
public bluetooth::LowEnergyClient::Delegate {
public:
explicit BluetoothLowEnergyBinderServer(bluetooth::Adapter* adapter);
+ BluetoothLowEnergyBinderServer(const BluetoothLowEnergyBinderServer&) =
+ delete;
+ BluetoothLowEnergyBinderServer& operator=(
+ const BluetoothLowEnergyBinderServer&) = delete;
+
~BluetoothLowEnergyBinderServer() override;
// IBluetoothLowEnergy overrides:
@@ -83,8 +86,6 @@
bluetooth::BluetoothInstance* instance) override;
bluetooth::Adapter* adapter_; // weak
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyBinderServer);
};
} // namespace binder
diff --git a/system/service/ipc/binder/interface_with_instances_base.h b/system/service/ipc/binder/interface_with_instances_base.h
index 05f2817..4501b00 100644
--- a/system/service/ipc/binder/interface_with_instances_base.h
+++ b/system/service/ipc/binder/interface_with_instances_base.h
@@ -19,8 +19,6 @@
#include <memory>
#include <unordered_map>
-#include <base/macros.h>
-
#include "bluetooth/uuid.h"
#include "service/bluetooth_instance.h"
#include "service/ipc/binder/remote_callback_map.h"
@@ -40,6 +38,10 @@
virtual public android::RefBase {
public:
InterfaceWithInstancesBase() = default;
+ InterfaceWithInstancesBase(const InterfaceWithInstancesBase&) = delete;
+ InterfaceWithInstancesBase& operator=(const InterfaceWithInstancesBase&) =
+ delete;
+
~InterfaceWithInstancesBase() override = default;
protected:
@@ -99,8 +101,6 @@
RemoteCallbackMap<int, IInterface> id_to_cb_;
std::unordered_map<int, std::shared_ptr<bluetooth::BluetoothInstance>>
id_to_instance_;
-
- DISALLOW_COPY_AND_ASSIGN(InterfaceWithInstancesBase);
};
} // namespace binder
diff --git a/system/service/ipc/binder/ipc_handler_binder.h b/system/service/ipc/binder/ipc_handler_binder.h
index 2edd323..e59aef4 100644
--- a/system/service/ipc/binder/ipc_handler_binder.h
+++ b/system/service/ipc/binder/ipc_handler_binder.h
@@ -16,8 +16,6 @@
#pragma once
-#include <base/macros.h>
-
#include "service/ipc/ipc_handler.h"
#include "service/ipc/ipc_manager.h"
@@ -27,6 +25,10 @@
class IPCHandlerBinder : public IPCHandler {
public:
IPCHandlerBinder(bluetooth::Adapter* adapter, IPCManager::Delegate* delegate);
+
+ IPCHandlerBinder(const IPCHandlerBinder&) = delete;
+ IPCHandlerBinder& operator=(const IPCHandlerBinder&) = delete;
+
~IPCHandlerBinder() override;
// IPCHandler overrides:
@@ -38,8 +40,6 @@
// Notify the delegate that IPC has started.
void NotifyStarted();
-
- DISALLOW_COPY_AND_ASSIGN(IPCHandlerBinder);
};
} // namespace ipc
diff --git a/system/service/ipc/binder/remote_callback_list.h b/system/service/ipc/binder/remote_callback_list.h
index e25e550..f78bc60 100644
--- a/system/service/ipc/binder/remote_callback_list.h
+++ b/system/service/ipc/binder/remote_callback_list.h
@@ -21,7 +21,6 @@
#include <unordered_map>
#include <base/logging.h>
-#include <base/macros.h>
#include <binder/IBinder.h>
#include <binder/IInterface.h>
@@ -53,6 +52,9 @@
class RemoteCallbackList final {
public:
RemoteCallbackList() = default;
+ RemoteCallbackList(const RemoteCallbackList&) = delete;
+ RemoteCallbackList& operator=(const RemoteCallbackList&) = delete;
+
~RemoteCallbackList();
// Register and unregister a callback interface. Registering will
@@ -91,8 +93,6 @@
std::mutex map_lock_;
CallbackMap callbacks_;
-
- DISALLOW_COPY_AND_ASSIGN(RemoteCallbackList);
};
// Template Implementation details below
diff --git a/system/service/ipc/binder/remote_callback_map.h b/system/service/ipc/binder/remote_callback_map.h
index 7f31b53..96a717b 100644
--- a/system/service/ipc/binder/remote_callback_map.h
+++ b/system/service/ipc/binder/remote_callback_map.h
@@ -20,7 +20,6 @@
#include <unordered_map>
#include <base/logging.h>
-#include <base/macros.h>
#include <binder/IBinder.h>
#include <binder/IInterface.h>
@@ -38,6 +37,9 @@
class RemoteCallbackMap final {
public:
RemoteCallbackMap() = default;
+ RemoteCallbackMap(const RemoteCallbackMap&) = delete;
+ RemoteCallbackMap& operator=(const RemoteCallbackMap&) = delete;
+
~RemoteCallbackMap();
// The Delegate interface is used to notify when a registered callback is
@@ -104,8 +106,6 @@
std::mutex map_lock_;
CallbackMap map_;
-
- DISALLOW_COPY_AND_ASSIGN(RemoteCallbackMap);
};
// Template Implementation details below
diff --git a/system/service/ipc/dbus/ipc_handler_dbus.h b/system/service/ipc/dbus/ipc_handler_dbus.h
index 2a83369..4c0a7e9 100644
--- a/system/service/ipc/dbus/ipc_handler_dbus.h
+++ b/system/service/ipc/dbus/ipc_handler_dbus.h
@@ -29,6 +29,10 @@
class IPCHandlerDBus : public IPCHandler {
public:
IPCHandlerDBus(bluetooth::Adapter* adapter, IPCManager::Delegate* delegate);
+
+ IPCHandlerDBus(const IPCHandlerDBus&) = delete;
+ IPCHandlerDBus& operator=(const IPCHandlerDBus&) = delete;
+
~IPCHandlerDBus() override;
void InitDbus();
@@ -41,8 +45,6 @@
base::Thread* dbus_thread_;
IPCHandlerDBus() = default;
-
- DISALLOW_COPY_AND_ASSIGN(IPCHandlerDBus);
};
} // namespace ipc
diff --git a/system/service/ipc/ipc_handler.h b/system/service/ipc/ipc_handler.h
index 9b7994c..473d6e0 100644
--- a/system/service/ipc/ipc_handler.h
+++ b/system/service/ipc/ipc_handler.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <base/memory/ref_counted.h>
#include "service/ipc/ipc_manager.h"
@@ -32,6 +31,10 @@
class IPCHandler : public base::RefCountedThreadSafe<IPCHandler> {
public:
IPCHandler(bluetooth::Adapter* adapter, IPCManager::Delegate* delegate);
+
+ IPCHandler(const IPCHandler&) = delete;
+ IPCHandler& operator=(const IPCHandler&) = delete;
+
virtual ~IPCHandler();
// Initializes and runs the IPC mechanism. Returns true on success, false
@@ -55,8 +58,6 @@
// The delegate that is interested in notifications from us.
IPCManager::Delegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(IPCHandler);
};
} // namespace ipc
diff --git a/system/service/ipc/ipc_handler_linux.h b/system/service/ipc/ipc_handler_linux.h
index 7cd6efa..765dda2 100644
--- a/system/service/ipc/ipc_handler_linux.h
+++ b/system/service/ipc/ipc_handler_linux.h
@@ -19,7 +19,6 @@
#include <atomic>
#include <base/files/file_path.h>
#include <base/files/scoped_file.h>
-#include <base/macros.h>
#include <base/threading/thread.h>
#include "service/ipc/ipc_handler.h"
@@ -35,6 +34,10 @@
class IPCHandlerLinux : public IPCHandler {
public:
IPCHandlerLinux(bluetooth::Adapter* adapter, IPCManager::Delegate* delegate);
+
+ IPCHandlerLinux(const IPCHandlerLinux&) = delete;
+ IPCHandlerLinux& operator=(const IPCHandlerLinux&) = delete;
+
~IPCHandlerLinux() override;
// IPCHandler overrides:
@@ -81,8 +84,6 @@
// The origin thread's task runner.
scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(IPCHandlerLinux);
};
} // namespace ipc
diff --git a/system/service/ipc/ipc_manager.h b/system/service/ipc/ipc_manager.h
index ee960ba..bc5a104 100644
--- a/system/service/ipc/ipc_manager.h
+++ b/system/service/ipc/ipc_manager.h
@@ -18,7 +18,6 @@
#include <memory>
-#include <base/macros.h>
#include <base/memory/ref_counted.h>
namespace bluetooth {
@@ -47,6 +46,9 @@
class Delegate {
public:
Delegate() = default;
+ Delegate(const Delegate&) = delete;
+ Delegate& operator=(const Delegate&) = delete;
+
virtual ~Delegate() = default;
// Called when an IPC mechanism has successfully started and is ready for
@@ -56,12 +58,12 @@
// Called when an IPC mechanism has stopped. This may happen due to an error
// in initialization or due to a regular shut down routine.
virtual void OnIPCHandlerStopped(Type type) = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Delegate);
};
explicit IPCManager(bluetooth::Adapter* adapter);
+ IPCManager(const IPCManager&) = delete;
+ IPCManager& operator=(const IPCManager&) = delete;
+
~IPCManager();
// Initialize the underlying IPC handler based on |type|, if that type has not
@@ -96,8 +98,6 @@
// The Bluetooth adapter instance. This is owned by Daemon so we keep a raw
// pointer to it.
bluetooth::Adapter* adapter_;
-
- DISALLOW_COPY_AND_ASSIGN(IPCManager);
};
} // namespace ipc
diff --git a/system/service/logging_helpers.cc b/system/service/logging_helpers.cc
index 8b53033..78a24e6 100644
--- a/system/service/logging_helpers.cc
+++ b/system/service/logging_helpers.cc
@@ -112,7 +112,7 @@
CASE_RETURN_TEXT(BT_PROPERTY_SERVICE_RECORD);
CASE_RETURN_TEXT(BT_PROPERTY_ADAPTER_SCAN_MODE);
CASE_RETURN_TEXT(BT_PROPERTY_ADAPTER_BONDED_DEVICES);
- CASE_RETURN_TEXT(BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT);
+ CASE_RETURN_TEXT(BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT);
CASE_RETURN_TEXT(BT_PROPERTY_REMOTE_FRIENDLY_NAME);
CASE_RETURN_TEXT(BT_PROPERTY_REMOTE_RSSI);
CASE_RETURN_TEXT(BT_PROPERTY_REMOTE_VERSION_INFO);
diff --git a/system/service/low_energy_advertiser.h b/system/service/low_energy_advertiser.h
index ec0dd74..46d5316 100644
--- a/system/service/low_energy_advertiser.h
+++ b/system/service/low_energy_advertiser.h
@@ -21,7 +21,6 @@
#include <map>
#include <mutex>
-#include <base/macros.h>
#include <bluetooth/uuid.h>
#include "service/bluetooth_instance.h"
@@ -42,6 +41,9 @@
// should be obtained through the factory.
class LowEnergyAdvertiser : public BluetoothInstance {
public:
+ LowEnergyAdvertiser(const LowEnergyAdvertiser&) = delete;
+ LowEnergyAdvertiser& operator=(const LowEnergyAdvertiser&) = delete;
+
// The destructor automatically unregisters this client instance from the
// stack.
~LowEnergyAdvertiser() override;
@@ -107,8 +109,6 @@
std::atomic_bool adv_started_;
std::unique_ptr<StatusCallback> adv_start_callback_;
std::unique_ptr<StatusCallback> adv_stop_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyAdvertiser);
};
// LowEnergyAdvertiserFactory is used to register and obtain a per-application
@@ -121,6 +121,10 @@
// Don't construct/destruct directly except in tests. Instead, obtain a handle
// from an Adapter instance.
explicit LowEnergyAdvertiserFactory();
+ LowEnergyAdvertiserFactory(const LowEnergyAdvertiserFactory&) = delete;
+ LowEnergyAdvertiserFactory& operator=(const LowEnergyAdvertiserFactory&) =
+ delete;
+
~LowEnergyAdvertiserFactory() override;
// BluetoothInstanceFactory override:
@@ -138,8 +142,6 @@
// Map of pending calls to register.
std::mutex pending_calls_lock_;
std::unordered_set<Uuid> pending_calls_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyAdvertiserFactory);
};
} // namespace bluetooth
diff --git a/system/service/low_energy_client.h b/system/service/low_energy_client.h
index a4b60c6..ba39357 100644
--- a/system/service/low_energy_client.h
+++ b/system/service/low_energy_client.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <bluetooth/uuid.h>
#include <atomic>
@@ -53,6 +52,9 @@
class Delegate {
public:
Delegate() = default;
+ Delegate(const Delegate&) = delete;
+ Delegate& operator=(const Delegate&) = delete;
+
virtual ~Delegate() = default;
// Called asynchronously to notify the delegate of connection state change
@@ -62,11 +64,11 @@
// Called asynchronously to notify the delegate of mtu change
virtual void OnMtuChanged(LowEnergyClient* client, int status,
const char* address, int mtu) = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Delegate);
};
+ LowEnergyClient(const LowEnergyClient&) = delete;
+ LowEnergyClient& operator=(const LowEnergyClient&) = delete;
+
// The destructor automatically unregisters this client instance from the
// stack.
~LowEnergyClient() override;
@@ -134,8 +136,6 @@
// Maps bluetooth address to connection id
// TODO(jpawlowski): change type to bimap
std::map<const RawAddress, int, ConnComparator> connection_ids_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyClient);
};
// LowEnergyClientFactory is used to register and obtain a per-application
@@ -149,6 +149,9 @@
// Don't construct/destruct directly except in tests. Instead, obtain a handle
// from an Adapter instance.
explicit LowEnergyClientFactory(Adapter& adapter);
+ LowEnergyClientFactory(const LowEnergyClientFactory&) = delete;
+ LowEnergyClientFactory& operator=(const LowEnergyClientFactory&) = delete;
+
~LowEnergyClientFactory() override;
// BluetoothInstanceFactory override:
@@ -169,8 +172,6 @@
// Raw pointer to the Adapter that owns this factory.
Adapter& adapter_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyClientFactory);
};
} // namespace bluetooth
diff --git a/system/service/low_energy_scanner.h b/system/service/low_energy_scanner.h
index 6325c41..627f287 100644
--- a/system/service/low_energy_scanner.h
+++ b/system/service/low_energy_scanner.h
@@ -16,7 +16,6 @@
#pragma once
-#include <base/macros.h>
#include <bluetooth/uuid.h>
#include <atomic>
@@ -49,17 +48,20 @@
class Delegate {
public:
Delegate() = default;
+ Delegate(const Delegate&) = delete;
+ Delegate& operator=(const Delegate&) = delete;
+
virtual ~Delegate() = default;
// Called asynchronously to notify the delegate of nearby BLE advertisers
// found during a device scan.
virtual void OnScanResult(LowEnergyScanner* client,
const ScanResult& scan_result) = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Delegate);
};
+ LowEnergyScanner(const LowEnergyScanner&) = delete;
+ LowEnergyScanner& operator=(const LowEnergyScanner&) = delete;
+
// The destructor automatically unregisters this client instance from the
// stack.
~LowEnergyScanner() override;
@@ -120,8 +122,6 @@
// instance.
std::mutex delegate_mutex_;
Delegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyScanner);
};
// LowEnergyScannerFactory is used to register and obtain a per-application
@@ -135,6 +135,9 @@
// Don't construct/destruct directly except in tests. Instead, obtain a handle
// from an Adapter instance.
explicit LowEnergyScannerFactory(Adapter& adapter);
+ LowEnergyScannerFactory(const LowEnergyScannerFactory&) = delete;
+ LowEnergyScannerFactory& operator=(const LowEnergyScannerFactory&) = delete;
+
~LowEnergyScannerFactory() override;
// BluetoothInstanceFactory override:
@@ -155,8 +158,6 @@
// Raw pointer to the Adapter that owns this factory.
Adapter& adapter_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyScannerFactory);
};
} // namespace bluetooth
diff --git a/system/service/settings.h b/system/service/settings.h
index 1f298d6..38e5ca9 100644
--- a/system/service/settings.h
+++ b/system/service/settings.h
@@ -19,7 +19,6 @@
#include <string>
#include <base/files/file_path.h>
-#include <base/macros.h>
namespace bluetooth {
@@ -32,6 +31,9 @@
static const char kHelp[];
Settings();
+ Settings(const Settings&) = delete;
+ Settings& operator=(const Settings&) = delete;
+
~Settings();
// TODO(armansito): Write an instance method for storing things into a file.
@@ -67,8 +69,6 @@
bool enable_on_start_;
std::string android_ipc_socket_suffix_;
base::FilePath create_ipc_socket_path_;
-
- DISALLOW_COPY_AND_ASSIGN(Settings);
};
} // namespace bluetooth
diff --git a/system/service/test/a2dp_sink_unittest.cc b/system/service/test/a2dp_sink_unittest.cc
index f51e112..69545c2 100644
--- a/system/service/test/a2dp_sink_unittest.cc
+++ b/system/service/test/a2dp_sink_unittest.cc
@@ -32,15 +32,15 @@
: public hal::FakeBluetoothAvInterface::TestA2dpSinkHandler {
public:
MockA2dpSinkHandler() = default;
+ MockA2dpSinkHandler(const MockA2dpSinkHandler&) = delete;
+ MockA2dpSinkHandler& operator=(const MockA2dpSinkHandler&) = delete;
+
~MockA2dpSinkHandler() override = default;
MOCK_METHOD1(Connect, bt_status_t(RawAddress));
MOCK_METHOD1(Disconnect, bt_status_t(RawAddress));
MOCK_METHOD1(SetAudioFocusState, void(int));
MOCK_METHOD1(SetAudioTrackGain, void(float));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockA2dpSinkHandler);
};
class TestDelegate : public A2dpSink::Delegate {
@@ -89,6 +89,9 @@
class A2dpSinkTest : public ::testing::Test {
public:
A2dpSinkTest() = default;
+ A2dpSinkTest(const A2dpSinkTest&) = delete;
+ A2dpSinkTest& operator=(const A2dpSinkTest&) = delete;
+
~A2dpSinkTest() override = default;
void SetUp() override {
@@ -107,14 +110,14 @@
hal::FakeBluetoothAvInterface* fake_hal_av_iface_;
std::shared_ptr<MockA2dpSinkHandler> mock_handler_;
std::unique_ptr<A2dpSinkFactory> factory_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(A2dpSinkTest);
};
class A2dpSinkPostRegisterTest : public A2dpSinkTest {
public:
A2dpSinkPostRegisterTest() = default;
+ A2dpSinkPostRegisterTest(const A2dpSinkPostRegisterTest&) = delete;
+ A2dpSinkPostRegisterTest& operator=(const A2dpSinkPostRegisterTest&) = delete;
+
~A2dpSinkPostRegisterTest() override = default;
void SetUp() override {
@@ -160,9 +163,6 @@
}
std::unique_ptr<A2dpSink> a2dp_sink_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(A2dpSinkPostRegisterTest);
};
TEST_F(A2dpSinkTest, RegisterA2dpSink) {
diff --git a/system/service/test/a2dp_source_unittest.cc b/system/service/test/a2dp_source_unittest.cc
index 5aede81..b291727 100644
--- a/system/service/test/a2dp_source_unittest.cc
+++ b/system/service/test/a2dp_source_unittest.cc
@@ -32,13 +32,13 @@
: public hal::FakeBluetoothAvInterface::TestA2dpSourceHandler {
public:
MockA2dpSourceHandler() = default;
+ MockA2dpSourceHandler(const MockA2dpSourceHandler&) = delete;
+ MockA2dpSourceHandler& operator=(const MockA2dpSourceHandler&) = delete;
+
~MockA2dpSourceHandler() override = default;
MOCK_METHOD1(Connect, bt_status_t(RawAddress));
MOCK_METHOD1(Disconnect, bt_status_t(RawAddress));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockA2dpSourceHandler);
};
class TestDelegate : public A2dpSource::Delegate {
@@ -86,6 +86,9 @@
class A2dpSourceTest : public ::testing::Test {
public:
A2dpSourceTest() = default;
+ A2dpSourceTest(const A2dpSourceTest&) = delete;
+ A2dpSourceTest& operator=(const A2dpSourceTest&) = delete;
+
~A2dpSourceTest() override = default;
void SetUp() override {
@@ -104,14 +107,15 @@
hal::FakeBluetoothAvInterface* fake_hal_av_iface_;
std::shared_ptr<MockA2dpSourceHandler> mock_handler_;
std::unique_ptr<A2dpSourceFactory> factory_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(A2dpSourceTest);
};
class A2dpSourcePostRegisterTest : public A2dpSourceTest {
public:
A2dpSourcePostRegisterTest() = default;
+ A2dpSourcePostRegisterTest(const A2dpSourcePostRegisterTest&) = delete;
+ A2dpSourcePostRegisterTest& operator=(const A2dpSourcePostRegisterTest&) =
+ delete;
+
~A2dpSourcePostRegisterTest() override = default;
void SetUp() override {
@@ -157,9 +161,6 @@
}
std::unique_ptr<A2dpSource> a2dp_source_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(A2dpSourcePostRegisterTest);
};
TEST_F(A2dpSourceTest, RegisterA2dpSource) {
diff --git a/system/service/test/adapter_unittest.cc b/system/service/test/adapter_unittest.cc
index 37b0abb..6c73609 100644
--- a/system/service/test/adapter_unittest.cc
+++ b/system/service/test/adapter_unittest.cc
@@ -16,7 +16,6 @@
#include "service/adapter.h"
-#include <base/macros.h>
#include <gtest/gtest.h>
#include "service/hal/fake_bluetooth_gatt_interface.h"
@@ -30,6 +29,9 @@
class AdapterTest : public ::testing::Test {
public:
AdapterTest() = default;
+ AdapterTest(const AdapterTest&) = delete;
+ AdapterTest& operator=(const AdapterTest&) = delete;
+
~AdapterTest() override = default;
void SetUp() override {
@@ -55,9 +57,6 @@
hal::FakeBluetoothInterface* fake_hal_iface_;
hal::FakeBluetoothInterface::Manager* fake_hal_manager_;
std::unique_ptr<Adapter> adapter_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(AdapterTest);
};
class TestObserver final : public bluetooth::Adapter::Observer {
@@ -71,6 +70,9 @@
adapter_->AddObserver(this);
}
+ TestObserver(const TestObserver&) = delete;
+ TestObserver& operator=(const TestObserver&) = delete;
+
~TestObserver() override { adapter_->RemoveObserver(this); }
bluetooth::AdapterState prev_state() const { return prev_state_; }
@@ -106,8 +108,6 @@
bluetooth::AdapterState prev_state_, cur_state_;
std::string last_connection_state_address_;
bool last_device_connected_state_;
-
- DISALLOW_COPY_AND_ASSIGN(TestObserver);
};
TEST_F(AdapterTest, IsEnabled) {
diff --git a/system/service/test/gatt_client_unittest.cc b/system/service/test/gatt_client_unittest.cc
index 71850cd..c7c0209 100644
--- a/system/service/test/gatt_client_unittest.cc
+++ b/system/service/test/gatt_client_unittest.cc
@@ -16,7 +16,6 @@
#include "service/gatt_client.h"
-#include <base/macros.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -33,6 +32,9 @@
: public hal::FakeBluetoothGattInterface::TestClientHandler {
public:
MockGattHandler() = default;
+ MockGattHandler(const MockGattHandler&) = delete;
+ MockGattHandler& operator=(const MockGattHandler&) = delete;
+
~MockGattHandler() override = default;
MOCK_METHOD2(RegisterClient,
@@ -41,14 +43,14 @@
MOCK_METHOD1(Scan, bt_status_t(bool));
MOCK_METHOD4(Connect, bt_status_t(int, const RawAddress&, bool, int));
MOCK_METHOD3(Disconnect, bt_status_t(int, const RawAddress&, int));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockGattHandler);
};
class GattClientTest : public ::testing::Test {
public:
GattClientTest() = default;
+ GattClientTest(const GattClientTest&) = delete;
+ GattClientTest& operator=(const GattClientTest&) = delete;
+
~GattClientTest() override = default;
void SetUp() override {
@@ -74,9 +76,6 @@
hal::FakeBluetoothGattInterface* fake_hal_gatt_iface_;
std::shared_ptr<MockGattHandler> mock_handler_;
std::unique_ptr<GattClientFactory> factory_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(GattClientTest);
};
TEST_F(GattClientTest, RegisterInstance) {
diff --git a/system/service/test/gatt_server_unittest.cc b/system/service/test/gatt_server_unittest.cc
index 467100c..f0e6f98 100644
--- a/system/service/test/gatt_server_unittest.cc
+++ b/system/service/test/gatt_server_unittest.cc
@@ -32,6 +32,9 @@
: public hal::FakeBluetoothGattInterface::TestServerHandler {
public:
MockGattHandler() = default;
+ MockGattHandler(const MockGattHandler&) = delete;
+ MockGattHandler& operator=(const MockGattHandler&) = delete;
+
~MockGattHandler() override = default;
MOCK_METHOD2(RegisterServer,
@@ -47,9 +50,6 @@
bt_status_t(int, int, int, int, std::vector<uint8_t>));
MOCK_METHOD4(SendResponse,
bt_status_t(int, int, int, const btgatt_response_t&));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockGattHandler);
};
class TestDelegate : public GattServer::Delegate {
@@ -179,6 +179,9 @@
class GattServerTest : public ::testing::Test {
public:
GattServerTest() = default;
+ GattServerTest(const GattServerTest&) = delete;
+ GattServerTest& operator=(const GattServerTest&) = delete;
+
~GattServerTest() override = default;
void SetUp() override {
@@ -201,9 +204,6 @@
hal::FakeBluetoothGattInterface* fake_hal_gatt_iface_;
std::shared_ptr<MockGattHandler> mock_handler_;
std::unique_ptr<GattServerFactory> factory_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(GattServerTest);
};
const int kDefaultServerId = 4;
@@ -211,6 +211,10 @@
class GattServerPostRegisterTest : public GattServerTest {
public:
GattServerPostRegisterTest() = default;
+ GattServerPostRegisterTest(const GattServerPostRegisterTest&) = delete;
+ GattServerPostRegisterTest& operator=(const GattServerPostRegisterTest&) =
+ delete;
+
~GattServerPostRegisterTest() override = default;
void SetUp() override {
@@ -295,9 +299,6 @@
uint16_t srvc_handle_;
uint16_t char_handle_;
uint16_t desc_handle_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(GattServerPostRegisterTest);
};
TEST_F(GattServerTest, RegisterServer) {
diff --git a/system/service/test/ipc_linux_unittest.cc b/system/service/test/ipc_linux_unittest.cc
index 176cd6a..0c3ab31 100644
--- a/system/service/test/ipc_linux_unittest.cc
+++ b/system/service/test/ipc_linux_unittest.cc
@@ -22,7 +22,6 @@
#include <base/at_exit.h>
#include <base/command_line.h>
#include <base/files/scoped_file.h>
-#include <base/macros.h>
#include <base/run_loop.h>
#include <base/strings/stringprintf.h>
#include <gtest/gtest.h>
@@ -45,6 +44,9 @@
class IPCLinuxTest : public ::testing::Test {
public:
IPCLinuxTest() = default;
+ IPCLinuxTest(const IPCLinuxTest&) = delete;
+ IPCLinuxTest& operator=(const IPCLinuxTest&) = delete;
+
~IPCLinuxTest() override = default;
void SetUp() override {
@@ -109,13 +111,14 @@
std::unique_ptr<bluetooth::Adapter> adapter_;
std::unique_ptr<ipc::IPCManager> ipc_manager_;
base::ScopedFD client_fd_;
-
- DISALLOW_COPY_AND_ASSIGN(IPCLinuxTest);
};
class IPCLinuxTestDisabled : public IPCLinuxTest {
public:
IPCLinuxTestDisabled() = default;
+ IPCLinuxTestDisabled(const IPCLinuxTestDisabled&) = delete;
+ IPCLinuxTestDisabled& operator=(const IPCLinuxTestDisabled&) = delete;
+
~IPCLinuxTestDisabled() override = default;
void SetUpCommandLine() override {
@@ -123,9 +126,6 @@
const base::CommandLine::CharType* argv[] = {"program"};
base::CommandLine::Init(ARRAY_SIZE(argv), argv);
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(IPCLinuxTestDisabled);
};
class TestDelegate : public ipc::IPCManager::Delegate,
@@ -133,6 +133,9 @@
public:
TestDelegate() : started_count_(0), stopped_count_(0) {}
+ TestDelegate(const TestDelegate&) = delete;
+ TestDelegate& operator=(const TestDelegate&) = delete;
+
void OnIPCHandlerStarted(ipc::IPCManager::Type type) override {
ASSERT_EQ(ipc::IPCManager::TYPE_LINUX, type);
started_count_++;
@@ -151,8 +154,6 @@
private:
int started_count_;
int stopped_count_;
-
- DISALLOW_COPY_AND_ASSIGN(TestDelegate);
};
TEST_F(IPCLinuxTestDisabled, StartWithNoSocketPath) {
diff --git a/system/service/test/low_energy_advertiser_unittest.cc b/system/service/test/low_energy_advertiser_unittest.cc
index 751eb2b..aa6c07c 100644
--- a/system/service/test/low_energy_advertiser_unittest.cc
+++ b/system/service/test/low_energy_advertiser_unittest.cc
@@ -14,7 +14,6 @@
// limitations under the License.
//
-#include <base/macros.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -43,6 +42,9 @@
class MockAdvertiserHandler : public BleAdvertiserInterface {
public:
MockAdvertiserHandler() {}
+ MockAdvertiserHandler(const MockAdvertiserHandler&) = delete;
+ MockAdvertiserHandler& operator=(const MockAdvertiserHandler&) = delete;
+
~MockAdvertiserHandler() override = default;
MOCK_METHOD1(RegisterAdvertiser, void(IdStatusCallback));
@@ -71,14 +73,14 @@
void(int, std::vector<uint8_t>, StatusCallback));
MOCK_METHOD3(SetPeriodicAdvertisingEnable, void(int, bool, StatusCallback));
MOCK_METHOD1(RegisterCallbacks, void(AdvertisingCallbacks* callbacks));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockAdvertiserHandler);
};
class LowEnergyAdvertiserTest : public ::testing::Test {
public:
LowEnergyAdvertiserTest() = default;
+ LowEnergyAdvertiserTest(const LowEnergyAdvertiserTest&) = delete;
+ LowEnergyAdvertiserTest& operator=(const LowEnergyAdvertiserTest&) = delete;
+
~LowEnergyAdvertiserTest() override = default;
void SetUp() override {
@@ -99,15 +101,17 @@
protected:
std::shared_ptr<MockAdvertiserHandler> mock_handler_;
std::unique_ptr<LowEnergyAdvertiserFactory> ble_advertiser_factory_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(LowEnergyAdvertiserTest);
};
// Used for tests that operate on a pre-registered advertiser.
class LowEnergyAdvertiserPostRegisterTest : public LowEnergyAdvertiserTest {
public:
LowEnergyAdvertiserPostRegisterTest() : next_client_id_(0) {}
+ LowEnergyAdvertiserPostRegisterTest(
+ const LowEnergyAdvertiserPostRegisterTest&) = delete;
+ LowEnergyAdvertiserPostRegisterTest& operator=(
+ const LowEnergyAdvertiserPostRegisterTest&) = delete;
+
~LowEnergyAdvertiserPostRegisterTest() override = default;
void SetUp() override {
@@ -201,8 +205,6 @@
private:
int next_client_id_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyAdvertiserPostRegisterTest);
};
TEST_F(LowEnergyAdvertiserTest, RegisterInstance) {
diff --git a/system/service/test/low_energy_client_unittest.cc b/system/service/test/low_energy_client_unittest.cc
index 389d758..f2669ba 100644
--- a/system/service/test/low_energy_client_unittest.cc
+++ b/system/service/test/low_energy_client_unittest.cc
@@ -16,7 +16,6 @@
#include "service/low_energy_client.h"
-#include <base/macros.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -40,6 +39,9 @@
: public hal::FakeBluetoothGattInterface::TestClientHandler {
public:
MockGattHandler(){};
+ MockGattHandler(const MockGattHandler&) = delete;
+ MockGattHandler& operator=(const MockGattHandler&) = delete;
+
~MockGattHandler() override = default;
MOCK_METHOD2(RegisterClient,
@@ -47,15 +49,15 @@
MOCK_METHOD1(UnregisterClient, bt_status_t(int));
MOCK_METHOD4(Connect, bt_status_t(int, const RawAddress&, bool, int));
MOCK_METHOD3(Disconnect, bt_status_t(int, const RawAddress&, int));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockGattHandler);
};
class TestDelegate : public LowEnergyClient::Delegate {
public:
TestDelegate() : connection_state_count_(0), last_mtu_(0) {}
+ TestDelegate(const TestDelegate&) = delete;
+ TestDelegate& operator=(const TestDelegate&) = delete;
+
~TestDelegate() override = default;
int connection_state_count() const { return connection_state_count_; }
@@ -76,13 +78,14 @@
int connection_state_count_;
int last_mtu_;
-
- DISALLOW_COPY_AND_ASSIGN(TestDelegate);
};
class LowEnergyClientTest : public ::testing::Test {
public:
LowEnergyClientTest() = default;
+ LowEnergyClientTest(const LowEnergyClientTest&) = delete;
+ LowEnergyClientTest& operator=(const LowEnergyClientTest&) = delete;
+
~LowEnergyClientTest() override = default;
void SetUp() override {
@@ -107,15 +110,18 @@
testing::MockAdapter mock_adapter_;
std::shared_ptr<MockGattHandler> mock_handler_;
std::unique_ptr<LowEnergyClientFactory> ble_factory_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(LowEnergyClientTest);
};
// Used for tests that operate on a pre-registered client.
class LowEnergyClientPostRegisterTest : public LowEnergyClientTest {
public:
LowEnergyClientPostRegisterTest() : next_client_id_(0) {}
+
+ LowEnergyClientPostRegisterTest(const LowEnergyClientPostRegisterTest&) =
+ delete;
+ LowEnergyClientPostRegisterTest& operator=(
+ const LowEnergyClientPostRegisterTest&) = delete;
+
~LowEnergyClientPostRegisterTest() override = default;
void SetUp() override {
@@ -164,8 +170,6 @@
private:
int next_client_id_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyClientPostRegisterTest);
};
TEST_F(LowEnergyClientTest, RegisterInstance) {
diff --git a/system/service/test/low_energy_scanner_unittest.cc b/system/service/test/low_energy_scanner_unittest.cc
index 4c59925..7d9a3b2 100644
--- a/system/service/test/low_energy_scanner_unittest.cc
+++ b/system/service/test/low_energy_scanner_unittest.cc
@@ -16,7 +16,6 @@
#include "service/low_energy_scanner.h"
-#include <base/macros.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -103,6 +102,9 @@
public:
TestDelegate() : scan_result_count_(0) {}
+ TestDelegate(const TestDelegate&) = delete;
+ TestDelegate& operator=(const TestDelegate&) = delete;
+
~TestDelegate() override = default;
int scan_result_count() const { return scan_result_count_; }
@@ -118,13 +120,14 @@
private:
int scan_result_count_;
ScanResult last_scan_result_;
-
- DISALLOW_COPY_AND_ASSIGN(TestDelegate);
};
class LowEnergyScannerTest : public ::testing::Test {
public:
LowEnergyScannerTest() = default;
+ LowEnergyScannerTest(const LowEnergyScannerTest&) = delete;
+ LowEnergyScannerTest& operator=(const LowEnergyScannerTest&) = delete;
+
~LowEnergyScannerTest() override = default;
void SetUp() override {
@@ -147,15 +150,18 @@
testing::MockAdapter mock_adapter_;
std::shared_ptr<MockScannerHandler> mock_handler_;
std::unique_ptr<LowEnergyScannerFactory> ble_factory_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(LowEnergyScannerTest);
};
// Used for tests that operate on a pre-registered scanner.
class LowEnergyScannerPostRegisterTest : public LowEnergyScannerTest {
public:
LowEnergyScannerPostRegisterTest() : next_scanner_id_(0) {}
+
+ LowEnergyScannerPostRegisterTest(const LowEnergyScannerPostRegisterTest&) =
+ delete;
+ LowEnergyScannerPostRegisterTest& operator=(
+ const LowEnergyScannerPostRegisterTest&) = delete;
+
~LowEnergyScannerPostRegisterTest() override = default;
void SetUp() override {
@@ -203,8 +209,6 @@
private:
int next_scanner_id_;
-
- DISALLOW_COPY_AND_ASSIGN(LowEnergyScannerPostRegisterTest);
};
TEST_F(LowEnergyScannerTest, RegisterInstance) {
diff --git a/system/service/test/mock_adapter.h b/system/service/test/mock_adapter.h
index b652026..4042f6a 100644
--- a/system/service/test/mock_adapter.h
+++ b/system/service/test/mock_adapter.h
@@ -26,6 +26,9 @@
class MockAdapter : public Adapter {
public:
MockAdapter() = default;
+ MockAdapter(const MockAdapter&) = delete;
+ MockAdapter& operator=(const MockAdapter&) = delete;
+
~MockAdapter() override = default;
MOCK_METHOD1(AddObserver, void(Observer*));
@@ -60,9 +63,6 @@
MOCK_CONST_METHOD0(GetLeScannerFactory, LowEnergyScannerFactory*());
MOCK_CONST_METHOD0(GetGattClientFactory, GattClientFactory*());
MOCK_CONST_METHOD0(GetGattServerFactory, GattServerFactory*());
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockAdapter);
};
} // namespace testing
diff --git a/system/service/test/mock_daemon.h b/system/service/test/mock_daemon.h
index 1c02622..410b962 100644
--- a/system/service/test/mock_daemon.h
+++ b/system/service/test/mock_daemon.h
@@ -27,15 +27,15 @@
class MockDaemon : public Daemon {
public:
MockDaemon() = default;
+ MockDaemon(const MockDaemon&) = delete;
+ MockDaemon& operator=(const MockDaemon&) = delete;
+
~MockDaemon() override = default;
MOCK_CONST_METHOD0(GetSettings, Settings*());
MOCK_CONST_METHOD0(GetMessageLoop, btbase::AbstractMessageLoop*());
MOCK_METHOD0(StartMainLoop, void());
MOCK_METHOD0(Init, bool());
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockDaemon);
};
} // namespace testing
diff --git a/system/service/test/settings_unittest.cc b/system/service/test/settings_unittest.cc
index 60d372e..31baaaa 100644
--- a/system/service/test/settings_unittest.cc
+++ b/system/service/test/settings_unittest.cc
@@ -16,7 +16,6 @@
#include <base/at_exit.h>
#include <base/command_line.h>
-#include <base/macros.h>
#include <gtest/gtest.h>
#include "array_utils.h"
@@ -31,6 +30,8 @@
class SettingsTest : public ::testing::Test {
public:
SettingsTest() = default;
+ SettingsTest(const SettingsTest&) = delete;
+ SettingsTest& operator=(const SettingsTest&) = delete;
void SetUp() override { base::CommandLine::Reset(); }
@@ -39,9 +40,6 @@
protected:
base::AtExitManager exit_manager_;
Settings settings_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SettingsTest);
};
TEST_F(SettingsTest, EmptyCommandLine) {
diff --git a/system/stack/Android.bp b/system/stack/Android.bp
index d4e322a..ac21f97 100644
--- a/system/stack/Android.bp
+++ b/system/stack/Android.bp
@@ -272,7 +272,6 @@
"libbt-hci",
"libbtdevice",
"libg722codec",
- "liblc3codec",
"liblc3",
"libosi",
"libudrv-uipc",
diff --git a/system/stack/btm/btm_ble.cc b/system/stack/btm/btm_ble.cc
index 94f862d..1097745 100644
--- a/system/stack/btm/btm_ble.cc
+++ b/system/stack/btm/btm_ble.cc
@@ -2073,32 +2073,6 @@
}));
}
-/* This function set a random address to local controller. It also temporarily
- * disable scans and adv before sending the command to the controller. */
-void btm_ble_set_random_address(const RawAddress& random_bda) {
- tBTM_LE_RANDOM_CB* p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
- tBTM_BLE_CB* p_ble_cb = &btm_cb.ble_ctr_cb;
- const bool adv_mode = btm_cb.ble_ctr_cb.inq_var.adv_mode;
-
- if (adv_mode == BTM_BLE_ADV_ENABLE)
- btsnd_hcic_ble_set_adv_enable(BTM_BLE_ADV_DISABLE);
- if (p_ble_cb->is_ble_scan_active()) {
- btm_ble_stop_scan();
- }
- btm_ble_suspend_bg_conn();
-
- p_cb->private_addr = random_bda;
- btsnd_hcic_ble_set_random_addr(p_cb->private_addr);
- LOG_DEBUG("Updating local random address:%s", PRIVATE_ADDRESS(random_bda));
-
- if (adv_mode == BTM_BLE_ADV_ENABLE)
- btsnd_hcic_ble_set_adv_enable(BTM_BLE_ADV_ENABLE);
- if (p_ble_cb->is_ble_scan_active()) {
- btm_ble_start_scan();
- }
- btm_ble_resume_bg_conn();
-}
-
/*******************************************************************************
*
* Function btm_ble_get_acl_remote_addr
diff --git a/system/stack/btm/btm_ble_addr.cc b/system/stack/btm/btm_ble_addr.cc
index 5d285e4..34424db 100644
--- a/system/stack/btm/btm_ble_addr.cc
+++ b/system/stack/btm/btm_ble_addr.cc
@@ -38,8 +38,6 @@
extern tBTM_CB btm_cb;
-void btm_ble_set_random_address(const RawAddress& random_bda);
-
/* This function generates Resolvable Private Address (RPA) from Identity
* Resolving Key |irk| and |random|*/
static RawAddress generate_rpa_from_irk_and_rand(const Octet16& irk,
diff --git a/system/stack/btm/btm_ble_int.h b/system/stack/btm/btm_ble_int.h
index 00c6aec..dfb9f22 100644
--- a/system/stack/btm/btm_ble_int.h
+++ b/system/stack/btm/btm_ble_int.h
@@ -137,7 +137,6 @@
extern bool btm_ble_topology_check(tBTM_BLE_STATE_MASK request);
extern bool btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state);
extern bool btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state);
-extern void btm_ble_set_random_address(const RawAddress& random_bda);
extern void btm_ble_scanner_init(void);
extern void btm_ble_scanner_cleanup(void);
diff --git a/system/stack/eatt/eatt.h b/system/stack/eatt/eatt.h
index d2071ab..2eac631 100644
--- a/system/stack/eatt/eatt.h
+++ b/system/stack/eatt/eatt.h
@@ -99,6 +99,9 @@
class EattExtension {
public:
EattExtension();
+ EattExtension(const EattExtension&) = delete;
+ EattExtension& operator=(const EattExtension&) = delete;
+
virtual ~EattExtension();
static EattExtension* GetInstance() {
@@ -277,8 +280,6 @@
private:
struct impl;
std::unique_ptr<impl> pimpl_;
-
- DISALLOW_COPY_AND_ASSIGN(EattExtension);
};
} // namespace eatt
diff --git a/system/stack/l2cap/l2c_ble.cc b/system/stack/l2cap/l2c_ble.cc
old mode 100644
new mode 100755
index 5bd9428..386f445
--- a/system/stack/l2cap/l2c_ble.cc
+++ b/system/stack/l2cap/l2c_ble.cc
@@ -671,7 +671,7 @@
con_info.l2cap_result = L2CAP_LE_RESULT_INVALID_PARAMETERS;
l2c_csm_execute(p_ccb, L2CEVT_L2CAP_CREDIT_BASED_CONNECT_RSP_NEG,
&con_info);
- break;
+ return;
}
/* At least some of the channels has been created and parameters are
@@ -698,8 +698,27 @@
for (int i = 0; i < p_lcb->pending_ecoc_conn_cnt; i++) {
uint16_t cid = p_lcb->pending_ecoc_connection_cids[i];
+ STREAM_TO_UINT16(rcid, p);
+ /* if duplicated remote cid then disconnect original channel
+ * and current channel by sending event to upper layer */
+ temp_p_ccb = l2cu_find_ccb_by_remote_cid(p_lcb, rcid);
+ if (temp_p_ccb != nullptr) {
+ L2CAP_TRACE_ERROR(
+ "Already Allocated Destination cid. "
+ "rcid = %d "
+ "send peer_disc_req", rcid);
+
+ l2cu_send_peer_disc_req(temp_p_ccb);
+
+ temp_p_ccb = l2cu_find_ccb_by_cid(p_lcb, cid);
+ con_info.l2cap_result = L2CAP_LE_RESULT_UNACCEPTABLE_PARAMETERS;
+ l2c_csm_execute(temp_p_ccb, L2CEVT_L2CAP_CREDIT_BASED_CONNECT_RSP_NEG,
+ &con_info);
+ continue;
+ }
+
temp_p_ccb = l2cu_find_ccb_by_cid(p_lcb, cid);
- STREAM_TO_UINT16(temp_p_ccb->remote_cid, p);
+ temp_p_ccb->remote_cid = rcid;
L2CAP_TRACE_DEBUG(
"local cid = %d "
@@ -779,7 +798,7 @@
return;
}
- if (p_ccb->peer_conn_cfg.mps > mps) {
+ if (p_ccb->peer_conn_cfg.mps > mps && num_of_channels > 1) {
L2CAP_TRACE_WARNING(
"L2CAP - rcvd config req mps reduction new mps < mps (%d < %d)",
mtu, p_ccb->peer_conn_cfg.mtu);
diff --git a/system/stack/test/ble_advertiser_test.cc b/system/stack/test/ble_advertiser_test.cc
index b4a8b85..3585516 100644
--- a/system/stack/test/ble_advertiser_test.cc
+++ b/system/stack/test/ble_advertiser_test.cc
@@ -89,6 +89,9 @@
class AdvertiserHciMock : public BleAdvertiserHciInterface {
public:
AdvertiserHciMock() = default;
+ AdvertiserHciMock(const AdvertiserHciMock&) = delete;
+ AdvertiserHciMock& operator=(const AdvertiserHciMock&) = delete;
+
~AdvertiserHciMock() override = default;
MOCK_METHOD1(ReadInstanceCount,
@@ -133,9 +136,6 @@
};
bool QuirkAdvertiserZeroHandle() override { return false; }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(AdvertiserHciMock);
};
} // namespace
diff --git a/system/stack/test/btm_iso_test.cc b/system/stack/test/btm_iso_test.cc
index 94e77fc..98c2ca2 100644
--- a/system/stack/test/btm_iso_test.cc
+++ b/system/stack/test/btm_iso_test.cc
@@ -69,6 +69,9 @@
class MockCigCallbacks : public bluetooth::hci::iso_manager::CigCallbacks {
public:
MockCigCallbacks() = default;
+ MockCigCallbacks(const MockCigCallbacks&) = delete;
+ MockCigCallbacks& operator=(const MockCigCallbacks&) = delete;
+
~MockCigCallbacks() override = default;
MOCK_METHOD((void), OnSetupIsoDataPath,
@@ -86,14 +89,14 @@
MOCK_METHOD((void), OnCisEvent, (uint8_t event, void* data), (override));
MOCK_METHOD((void), OnCigEvent, (uint8_t event, void* data), (override));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockCigCallbacks);
};
class MockBigCallbacks : public bluetooth::hci::iso_manager::BigCallbacks {
public:
MockBigCallbacks() = default;
+ MockBigCallbacks(const MockBigCallbacks&) = delete;
+ MockBigCallbacks& operator=(const MockBigCallbacks&) = delete;
+
~MockBigCallbacks() override = default;
MOCK_METHOD((void), OnSetupIsoDataPath,
@@ -104,9 +107,6 @@
(override));
MOCK_METHOD((void), OnBigEvent, (uint8_t event, void* data), (override));
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockBigCallbacks);
};
} // namespace
diff --git a/system/stack/test/common/mock_eatt.h b/system/stack/test/common/mock_eatt.h
index 8b5d9d5..a7b6c5f 100644
--- a/system/stack/test/common/mock_eatt.h
+++ b/system/stack/test/common/mock_eatt.h
@@ -27,6 +27,9 @@
class MockEattExtension : public EattExtension {
public:
MockEattExtension() = default;
+ MockEattExtension(const MockEattExtension&) = delete;
+ MockEattExtension& operator=(const MockEattExtension&) = delete;
+
~MockEattExtension() override = default;
static MockEattExtension* GetInstance();
@@ -65,7 +68,4 @@
MOCK_METHOD((void), Start, ());
MOCK_METHOD((void), Stop, ());
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockEattExtension);
};
diff --git a/system/stack/test/fuzzers/Android.bp b/system/stack/test/fuzzers/Android.bp
index 1dd4f61..fc26b01 100644
--- a/system/stack/test/fuzzers/Android.bp
+++ b/system/stack/test/fuzzers/Android.bp
@@ -34,7 +34,6 @@
"libbt-hci",
"libbtdevice",
"libg722codec",
- "liblc3codec",
"liblc3",
"libosi",
"libudrv-uipc",
diff --git a/system/test/headless/Android.bp b/system/test/headless/Android.bp
index b05e31c..eb8e2da 100644
--- a/system/test/headless/Android.bp
+++ b/system/test/headless/Android.bp
@@ -49,7 +49,6 @@
"libbtif",
"libflatbuffers-cpp",
"libg722codec",
- "liblc3codec",
"liblc3",
"libosi",
"libprotobuf-cpp-lite",
diff --git a/system/test/mock/mock_stack_btm_ble.cc b/system/test/mock/mock_stack_btm_ble.cc
index da844aa..5ebd1a5 100644
--- a/system/test/mock/mock_stack_btm_ble.cc
+++ b/system/test/mock/mock_stack_btm_ble.cc
@@ -230,9 +230,6 @@
tBTM_RAND_ENC_CB* p_enc_cplt_cback) {
mock_function_count_map[__func__]++;
}
-void btm_ble_set_random_address(const RawAddress& random_bda) {
- mock_function_count_map[__func__]++;
-}
void btm_ble_test_command_complete(uint8_t* p) {
mock_function_count_map[__func__]++;
}
diff --git a/system/test/suite/adapter/bluetooth_test.h b/system/test/suite/adapter/bluetooth_test.h
index 44f52c8..6b50be9 100644
--- a/system/test/suite/adapter/bluetooth_test.h
+++ b/system/test/suite/adapter/bluetooth_test.h
@@ -41,6 +41,9 @@
public bluetooth::hal::BluetoothInterface::Observer {
protected:
BluetoothTest() = default;
+ BluetoothTest(const BluetoothTest&) = delete;
+ BluetoothTest& operator=(const BluetoothTest&) = delete;
+
virtual ~BluetoothTest() = default;
// Getter for the bt_interface
@@ -115,8 +118,6 @@
bt_discovery_state_t discovery_state_;
bt_acl_state_t acl_state_;
bt_bond_state_t bond_state_;
-
- DISALLOW_COPY_AND_ASSIGN(BluetoothTest);
};
} // bttest
diff --git a/system/test/suite/gatt/gatt_test.h b/system/test/suite/gatt/gatt_test.h
index 1fcea73..da0d6d2 100644
--- a/system/test/suite/gatt/gatt_test.h
+++ b/system/test/suite/gatt/gatt_test.h
@@ -31,6 +31,9 @@
public bluetooth::hal::BluetoothGattInterface::ServerObserver {
protected:
GattTest() = default;
+ GattTest(const GattTest&) = delete;
+ GattTest& operator=(const GattTest&) = delete;
+
virtual ~GattTest() = default;
// Gets the gatt_scanner_interface
@@ -125,8 +128,6 @@
// The status of the last callback. Is BT_STATUS_SUCCESS if no issues.
int status_;
-
- DISALLOW_COPY_AND_ASSIGN(GattTest);
};
} // bttest
diff --git a/system/tools/bdtool/adapter.c b/system/tools/bdtool/adapter.c
index bfbbfeb..3b964a0 100644
--- a/system/tools/bdtool/adapter.c
+++ b/system/tools/bdtool/adapter.c
@@ -257,7 +257,7 @@
case BT_PROPERTY_SERVICE_RECORD:
case BT_PROPERTY_ADAPTER_SCAN_MODE:
case BT_PROPERTY_ADAPTER_BONDED_DEVICES:
- case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
+ case BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT:
case BT_PROPERTY_REMOTE_VERSION_INFO:
case BT_PROPERTY_LOCAL_LE_FEATURES:
case BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP:
diff --git a/system/vendor_libs/test_vendor_lib/include/le_advertisement.h b/system/vendor_libs/test_vendor_lib/include/le_advertisement.h
deleted file mode 100644
index a5c1396..0000000
--- a/system/vendor_libs/test_vendor_lib/include/le_advertisement.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2018 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.
- */
-
-#pragma once
-
-#include <cstdint>
-
-namespace test_vendor_lib {
-
-class LeAdvertisement {
- public:
- enum class AdvertisementType : uint8_t {
- ADV_IND = 0, // Connectable and scannable
- ADV_DIRECT_IND = 1, // Connectable directed
- ADV_SCAN_IND = 2, // Scannable undirected
- ADV_NONCONN_IND = 3, // Non connectable undirected
- SCAN_RESPONSE = 4,
- };
- enum class AddressType : uint8_t {
- PUBLIC = 0,
- RANDOM = 1,
- PUBLIC_IDENTITY = 2,
- RANDOM_IDENTITY = 3,
- };
-};
-
-} // namespace test_vendor_lib
diff --git a/system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc b/system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
index 910d1fb..8d4f08f 100644
--- a/system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
+++ b/system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
@@ -19,6 +19,7 @@
#include <memory>
#include <random>
+#include "crypto_toolbox/crypto_toolbox.h"
#include "os/log.h"
#include "packet/raw_builder.h"
@@ -231,6 +232,7 @@
SET_SUPPORTED(LE_ADD_DEVICE_TO_CONNECT_LIST, LeAddDeviceToConnectList);
SET_SUPPORTED(LE_REMOVE_DEVICE_FROM_CONNECT_LIST,
LeRemoveDeviceFromConnectList);
+ SET_SUPPORTED(LE_ENCRYPT, LeEncrypt);
SET_SUPPORTED(LE_RAND, LeRand);
SET_SUPPORTED(LE_READ_SUPPORTED_STATES, LeReadSupportedStates);
SET_HANDLER(LE_GET_VENDOR_CAPABILITIES, LeVendorCap);
@@ -2289,6 +2291,18 @@
status, kNumCommandPackets));
}
+void DualModeController::LeEncrypt(CommandView command) {
+ auto command_view = gd_hci::LeEncryptView::Create(
+ gd_hci::LeSecurityCommandView::Create(command));
+ ASSERT(command_view.IsValid());
+
+ auto encrypted_data = bluetooth::crypto_toolbox::aes_128(
+ command_view.GetKey(),
+ command_view.GetPlaintextData());
+
+ send_event_(bluetooth::hci::LeEncryptCompleteBuilder::Create(
+ kNumCommandPackets, ErrorCode::SUCCESS, encrypted_data));
+}
static std::random_device rd{};
static std::mt19937_64 s_mt{rd()};
diff --git a/system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h b/system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
index 1e88f51..785bc04 100644
--- a/system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
+++ b/system/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
@@ -471,6 +471,9 @@
// 7.8.21
void LeReadRemoteFeatures(CommandView args);
+ // 7.8.22
+ void LeEncrypt(CommandView args);
+
// 7.8.23
void LeRand(CommandView args);
diff --git a/system/vendor_libs/test_vendor_lib/model/controller/le_advertiser.cc b/system/vendor_libs/test_vendor_lib/model/controller/le_advertiser.cc
index 67519f2..661d7b7 100644
--- a/system/vendor_libs/test_vendor_lib/model/controller/le_advertiser.cc
+++ b/system/vendor_libs/test_vendor_lib/model/controller/le_advertiser.cc
@@ -17,6 +17,7 @@
#include "le_advertiser.h"
using namespace bluetooth::hci;
+using namespace std::literals;
namespace test_vendor_lib {
void LeAdvertiser::Initialize(AddressWithType address,
@@ -37,10 +38,15 @@
}
void LeAdvertiser::InitializeExtended(
- AddressType address_type, AddressWithType peer_address,
+ unsigned advertising_handle,
+ AddressType address_type,
+ AddressWithType peer_address,
LeScanningFilterPolicy filter_policy,
model::packets::AdvertisementType type,
- std::chrono::steady_clock::duration interval, uint8_t tx_power) {
+ std::chrono::steady_clock::duration interval,
+ uint8_t tx_power) {
+
+ advertising_handle_ = advertising_handle;
address_ = AddressWithType(address_.GetAddress(), address_type);
peer_address_ = peer_address;
filter_policy_ = filter_policy;
@@ -59,7 +65,7 @@
type_ = model::packets::AdvertisementType::ADV_IND;
advertisement_.clear();
scan_response_.clear();
- interval_ = std::chrono::milliseconds(0);
+ interval_ = 0ms;
enabled_ = false;
}
@@ -79,30 +85,55 @@
}
void LeAdvertiser::Enable() {
- enabled_ = true;
- last_le_advertisement_ = std::chrono::steady_clock::now() - interval_;
- num_events_ = 0;
- LOG_INFO("%s -> %s type = %hhx ad length %zu, scan length %zu",
- address_.ToString().c_str(), peer_address_.ToString().c_str(), type_,
- advertisement_.size(), scan_response_.size());
+ EnableExtended(0ms);
+ extended_ = false;
}
-void LeAdvertiser::EnableExtended(
- std::chrono::steady_clock::duration duration) {
- Enable();
- if (duration != std::chrono::milliseconds(0)) {
- ending_time_ = std::chrono::steady_clock::now() + duration;
- }
+void LeAdvertiser::EnableExtended(std::chrono::milliseconds duration_ms) {
+ enabled_ = true;
extended_ = true;
+ num_events_ = 0;
+
+ using Duration = std::chrono::steady_clock::duration;
+ using TimePoint = std::chrono::steady_clock::time_point;
+
+ Duration adv_direct_ind_timeout = 1280ms; // 1.28s
+ Duration adv_direct_ind_interval_low = 10000us; // 10ms
+ Duration adv_direct_ind_interval_high = 3750us; // 3.75ms
+ Duration duration = duration_ms;
+ TimePoint now = std::chrono::steady_clock::now();
+
+ switch (type_) {
+ // [Vol 6] Part B. 4.4.2.4.3 High duty cycle connectable directed advertising
+ case model::packets::AdvertisementType::ADV_DIRECT_IND:
+ duration = duration == 0ms ?
+ adv_direct_ind_timeout :
+ std::min(duration, adv_direct_ind_timeout);
+ interval_ = adv_direct_ind_interval_high;
+ break;
+
+ // [Vol 6] Part B. 4.4.2.4.2 Low duty cycle connectable directed advertising
+ case model::packets::AdvertisementType::SCAN_RESPONSE:
+ interval_ = adv_direct_ind_interval_low;
+ break;
+
+ // Duration set to parameter,
+ // interval set by Initialize().
+ default:
+ break;
+ }
+
+ last_le_advertisement_ = now - interval_;
+ ending_time_ = now + duration;
+ limited_ = duration != 0ms;
+
LOG_INFO("%s -> %s type = %hhx ad length %zu, scan length %zu",
address_.ToString().c_str(), peer_address_.ToString().c_str(), type_,
advertisement_.size(), scan_response_.size());
}
void LeAdvertiser::Disable() { enabled_ = false; }
-
bool LeAdvertiser::IsEnabled() const { return enabled_; }
-
bool LeAdvertiser::IsExtended() const { return extended_; }
bool LeAdvertiser::IsConnectable() const {
@@ -112,6 +143,38 @@
uint8_t LeAdvertiser::GetNumAdvertisingEvents() const { return num_events_; }
+std::unique_ptr<bluetooth::hci::EventBuilder>
+LeAdvertiser::GetEvent(std::chrono::steady_clock::time_point now) {
+ // Advertiser disabled.
+ if (!enabled_) {
+ return nullptr;
+ }
+
+ // [Vol 4] Part E 7.8.9 LE Set Advertising Enable command
+ // [Vol 4] Part E 7.8.56 LE Set Extended Advertising Enable command
+ if (type_ == model::packets::AdvertisementType::ADV_DIRECT_IND &&
+ now >= ending_time_ && limited_) {
+ LOG_INFO("Directed Advertising Timeout");
+ enabled_ = false;
+ return bluetooth::hci::LeConnectionCompleteBuilder::Create(
+ ErrorCode::ADVERTISING_TIMEOUT, 0,
+ bluetooth::hci::Role::CENTRAL,
+ bluetooth::hci::AddressType::PUBLIC_DEVICE_ADDRESS,
+ bluetooth::hci::Address(), 0, 0, 0,
+ bluetooth::hci::ClockAccuracy::PPM_500);
+ }
+
+ // [Vol 4] Part E 7.8.56 LE Set Extended Advertising Enable command
+ if (extended_ && now >= ending_time_ && limited_) {
+ LOG_INFO("Extended Advertising Timeout");
+ enabled_ = false;
+ return bluetooth::hci::LeAdvertisingSetTerminatedBuilder::Create(
+ ErrorCode::SUCCESS, advertising_handle_, 0, num_events_);
+ }
+
+ return nullptr;
+}
+
std::unique_ptr<model::packets::LinkLayerPacketBuilder>
LeAdvertiser::GetAdvertisement(std::chrono::steady_clock::time_point now) {
if (!enabled_) {
@@ -122,11 +185,6 @@
return nullptr;
}
- if (last_le_advertisement_ < ending_time_ && ending_time_ < now) {
- enabled_ = false;
- return nullptr;
- }
-
last_le_advertisement_ = now;
num_events_ += (num_events_ < 255 ? 1 : 0);
if (tx_power_ == kTxPowerUnavailable) {
diff --git a/system/vendor_libs/test_vendor_lib/model/controller/le_advertiser.h b/system/vendor_libs/test_vendor_lib/model/controller/le_advertiser.h
index eddf61a..37f7488 100644
--- a/system/vendor_libs/test_vendor_lib/model/controller/le_advertiser.h
+++ b/system/vendor_libs/test_vendor_lib/model/controller/le_advertiser.h
@@ -40,7 +40,8 @@
const std::vector<uint8_t>& scan_response,
std::chrono::steady_clock::duration interval);
- void InitializeExtended(bluetooth::hci::AddressType address_type,
+ void InitializeExtended(unsigned advertising_handle,
+ bluetooth::hci::AddressType address_type,
bluetooth::hci::AddressWithType peer_address,
bluetooth::hci::LeScanningFilterPolicy filter_policy,
model::packets::AdvertisementType type,
@@ -53,6 +54,12 @@
void SetScanResponse(const std::vector<uint8_t>& data);
+ // Generate LE Connection Complete or LE Extended Advertising Set Terminated
+ // events at the end of the advertising period. The advertiser is
+ // automatically disabled.
+ std::unique_ptr<bluetooth::hci::EventBuilder> GetEvent(
+ std::chrono::steady_clock::time_point);
+
std::unique_ptr<model::packets::LinkLayerPacketBuilder> GetAdvertisement(
std::chrono::steady_clock::time_point);
@@ -61,24 +68,18 @@
bluetooth::hci::Address scanner_address);
void Clear();
-
void Disable();
-
void Enable();
-
- void EnableExtended(std::chrono::steady_clock::duration duration);
+ void EnableExtended(std::chrono::milliseconds duration);
bool IsEnabled() const;
-
bool IsExtended() const;
-
bool IsConnectable() const;
uint8_t GetNumAdvertisingEvents() const;
-
bluetooth::hci::AddressWithType GetAddress() const;
- private:
+private:
bluetooth::hci::AddressWithType address_{};
bluetooth::hci::AddressWithType
peer_address_{}; // For directed advertisements
@@ -88,12 +89,14 @@
std::vector<uint8_t> scan_response_;
std::chrono::steady_clock::duration interval_{};
std::chrono::steady_clock::time_point ending_time_{};
+ std::chrono::steady_clock::time_point last_le_advertisement_{};
static constexpr uint8_t kTxPowerUnavailable = 0x7f;
uint8_t tx_power_{kTxPowerUnavailable};
uint8_t num_events_{0};
bool extended_{false};
bool enabled_{false};
- std::chrono::steady_clock::time_point last_le_advertisement_;
+ bool limited_{false}; // Set if the advertising set has a timeout.
+ unsigned advertising_handle_{0};
};
} // namespace test_vendor_lib
diff --git a/system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc b/system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
index 0f2c8b7..e79982f 100644
--- a/system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
+++ b/system/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
@@ -19,7 +19,6 @@
#include <hci/hci_packets.h>
#include "crypto_toolbox/crypto_toolbox.h"
-#include "include/le_advertisement.h"
#include "os/log.h"
#include "packet/raw_builder.h"
@@ -32,6 +31,7 @@
using namespace model::packets;
using model::packets::PacketType;
+using namespace std::literals;
namespace test_vendor_lib {
@@ -1834,8 +1834,7 @@
ASSERT(scan_response.IsValid());
vector<uint8_t> ad = scan_response.GetData();
auto adv_type = scan_response.GetAdvertisementType();
- auto address_type =
- static_cast<LeAdvertisement::AddressType>(scan_response.GetAddressType());
+ auto address_type = scan_response.GetAddressType();
if (le_scan_enable_ == bluetooth::hci::OpCode::LE_SET_SCAN_ENABLE) {
if (adv_type != model::packets::AdvertisementType::SCAN_RESPONSE) {
return;
@@ -2088,11 +2087,16 @@
void LinkLayerController::LeAdvertising() {
steady_clock::time_point now = steady_clock::now();
for (auto& advertiser : advertisers_) {
- auto ad = advertiser.GetAdvertisement(now);
- if (ad == nullptr) {
- continue;
+
+ auto event = advertiser.GetEvent(now);
+ if (event != nullptr) {
+ send_event_(std::move(event));
}
- SendLeLinkLayerPacket(std::move(ad));
+
+ auto advertisement = advertiser.GetAdvertisement(now);
+ if (advertisement != nullptr) {
+ SendLeLinkLayerPacket(std::move(advertisement));
+ }
}
}
@@ -3023,9 +3027,11 @@
peer = Address::kEmpty;
break;
case bluetooth::hci::LegacyAdvertisingProperties::ADV_DIRECT_IND_HIGH:
- case bluetooth::hci::LegacyAdvertisingProperties::ADV_DIRECT_IND_LOW:
ad_type = model::packets::AdvertisementType::ADV_DIRECT_IND;
break;
+ case bluetooth::hci::LegacyAdvertisingProperties::ADV_DIRECT_IND_LOW:
+ ad_type = model::packets::AdvertisementType::SCAN_RESPONSE;
+ break;
}
auto interval_ms =
static_cast<int>((interval_max + interval_min) * 0.625 / 2);
@@ -3082,10 +3088,13 @@
break;
}
- advertisers_[set].InitializeExtended(
- own_address_address_type, peer_address, scanning_filter_policy, ad_type,
- std::chrono::milliseconds(interval_ms), tx_power);
-
+ advertisers_[set].InitializeExtended(set,
+ own_address_address_type,
+ peer_address,
+ scanning_filter_policy,
+ ad_type,
+ std::chrono::milliseconds(interval_ms),
+ tx_power);
return ErrorCode::SUCCESS;
}
@@ -3546,6 +3555,7 @@
ErrorCode LinkLayerController::SetLeExtendedAdvertisingEnable(
bluetooth::hci::Enable enable,
const std::vector<bluetooth::hci::EnabledSet>& enabled_sets) {
+
for (const auto& set : enabled_sets) {
if (set.advertising_handle_ > advertisers_.size()) {
return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
@@ -3554,8 +3564,7 @@
for (const auto& set : enabled_sets) {
auto handle = set.advertising_handle_;
if (enable == bluetooth::hci::Enable::ENABLED) {
- advertisers_[handle].EnableExtended(
- std::chrono::milliseconds(10 * set.duration_));
+ advertisers_[handle].EnableExtended(10ms * set.duration_);
} else {
advertisers_[handle].Disable();
}
diff --git a/system/vendor_libs/test_vendor_lib/model/devices/loopback.cc b/system/vendor_libs/test_vendor_lib/model/devices/loopback.cc
index c13f95d..de1a358 100644
--- a/system/vendor_libs/test_vendor_lib/model/devices/loopback.cc
+++ b/system/vendor_libs/test_vendor_lib/model/devices/loopback.cc
@@ -16,7 +16,6 @@
#include "loopback.h"
-#include "le_advertisement.h"
#include "model/setup/device_boutique.h"
#include "os/log.h"
diff --git a/system/vendor_libs/test_vendor_lib/packets/link_layer_packets.pdl b/system/vendor_libs/test_vendor_lib/packets/link_layer_packets.pdl
index 090df63..c1336e7 100644
--- a/system/vendor_libs/test_vendor_lib/packets/link_layer_packets.pdl
+++ b/system/vendor_libs/test_vendor_lib/packets/link_layer_packets.pdl
@@ -142,11 +142,11 @@
}
enum AdvertisementType : 8 {
- ADV_IND = 0, // Connectable and scannable
- ADV_DIRECT_IND = 1, // Connectable directed
- ADV_SCAN_IND = 2, // Scannable undirected
- ADV_NONCONN_IND = 3, // Non connectable undirected
- SCAN_RESPONSE = 4,
+ ADV_IND = 0, // Connectable and scannable
+ ADV_DIRECT_IND = 1, // Connectable directed, high duty cycle
+ ADV_SCAN_IND = 2, // Scannable undirected
+ ADV_NONCONN_IND = 3, // Non connectable undirected
+ SCAN_RESPONSE = 4, // Aliased with connectable directed, low duty cycle
}
packet LeAdvertisement : LinkLayerPacket (type = LE_ADVERTISEMENT) {