Merge "aaudio: fix callback size for Legacy input"
diff --git a/apex/testing/Android.bp b/apex/testing/Android.bp
index 477c371..376d3e4 100644
--- a/apex/testing/Android.bp
+++ b/apex/testing/Android.bp
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-apex {
+apex_test {
name: "test_com.android.media",
manifest: "test_manifest.json",
file_contexts: ":com.android.media-file_contexts",
@@ -20,7 +20,7 @@
installable: false,
}
-apex {
+apex_test {
name: "test_com.android.media.swcodec",
manifest: "test_manifest_codec.json",
file_contexts: ":com.android.media.swcodec-file_contexts",
diff --git a/camera/CameraMetadata.cpp b/camera/CameraMetadata.cpp
index 15c295e..4745ee8 100644
--- a/camera/CameraMetadata.cpp
+++ b/camera/CameraMetadata.cpp
@@ -50,6 +50,15 @@
mBuffer = clone_camera_metadata(other.mBuffer);
}
+CameraMetadata::CameraMetadata(CameraMetadata &&other) :mBuffer(NULL), mLocked(false) {
+ acquire(other);
+}
+
+CameraMetadata &CameraMetadata::operator=(CameraMetadata &&other) {
+ acquire(other);
+ return *this;
+}
+
CameraMetadata::CameraMetadata(camera_metadata_t *buffer) :
mBuffer(NULL), mLocked(false) {
acquire(buffer);
diff --git a/camera/CaptureResult.cpp b/camera/CaptureResult.cpp
index 1d8e8c4..9cbfdb0 100644
--- a/camera/CaptureResult.cpp
+++ b/camera/CaptureResult.cpp
@@ -117,6 +117,12 @@
mMetadata(), mResultExtras() {
}
+CaptureResult::CaptureResult(CaptureResult &&otherResult) {
+ mMetadata = std::move(otherResult.mMetadata);
+ mResultExtras = otherResult.mResultExtras;
+ mPhysicalMetadatas = std::move(otherResult.mPhysicalMetadatas);
+}
+
CaptureResult::CaptureResult(const CaptureResult &otherResult) {
mResultExtras = otherResult.mResultExtras;
mMetadata = otherResult.mMetadata;
diff --git a/camera/cameraserver/Android.bp b/camera/cameraserver/Android.bp
index 22e9578..dc7f88a 100644
--- a/camera/cameraserver/Android.bp
+++ b/camera/cameraserver/Android.bp
@@ -48,6 +48,6 @@
init_rc: ["cameraserver.rc"],
vintf_fragments: [
- "manifest_android.frameworks.cameraservice.service@2.0.xml",
+ "manifest_android.frameworks.cameraservice.service@2.1.xml",
],
}
diff --git a/camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.0.xml b/camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.1.xml
similarity index 90%
rename from camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.0.xml
rename to camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.1.xml
index 601c717..5a15b35 100644
--- a/camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.0.xml
+++ b/camera/cameraserver/manifest_android.frameworks.cameraservice.service@2.1.xml
@@ -2,7 +2,7 @@
<hal>
<name>android.frameworks.cameraservice.service</name>
<transport>hwbinder</transport>
- <version>2.0</version>
+ <version>2.1</version>
<interface>
<name>ICameraService</name>
<instance>default</instance>
diff --git a/camera/include/camera/CameraMetadata.h b/camera/include/camera/CameraMetadata.h
index 844bb80..9d1b5c7 100644
--- a/camera/include/camera/CameraMetadata.h
+++ b/camera/include/camera/CameraMetadata.h
@@ -40,6 +40,11 @@
* dataCapacity extra storage */
CameraMetadata(size_t entryCapacity, size_t dataCapacity = 10);
+ /**
+ * Move constructor, acquires other's metadata buffer
+ */
+ CameraMetadata(CameraMetadata &&other);
+
~CameraMetadata();
/** Takes ownership of passed-in buffer */
@@ -54,6 +59,11 @@
CameraMetadata &operator=(const camera_metadata_t *buffer);
/**
+ * Move assignment operator, acquires other's metadata buffer
+ */
+ CameraMetadata &operator=(CameraMetadata &&other);
+
+ /**
* Get reference to the underlying metadata buffer. Ownership remains with
* the CameraMetadata object, but non-const CameraMetadata methods will not
* work until unlock() is called. Note that the lock has nothing to do with
diff --git a/camera/include/camera/CaptureResult.h b/camera/include/camera/CaptureResult.h
index ef830b5..dc3d282 100644
--- a/camera/include/camera/CaptureResult.h
+++ b/camera/include/camera/CaptureResult.h
@@ -135,6 +135,8 @@
CaptureResult(const CaptureResult& otherResult);
+ CaptureResult(CaptureResult &&captureResult);
+
status_t readFromParcel(android::Parcel* parcel);
status_t writeToParcel(android::Parcel* parcel) const;
};
diff --git a/camera/include/camera/VendorTagDescriptor.h b/camera/include/camera/VendorTagDescriptor.h
index 6f55890..b2fbf3a 100644
--- a/camera/include/camera/VendorTagDescriptor.h
+++ b/camera/include/camera/VendorTagDescriptor.h
@@ -188,8 +188,8 @@
sp<android::VendorTagDescriptor> *desc /*out*/);
// Parcelable interface
- status_t writeToParcel(Parcel* parcel) const override;
- status_t readFromParcel(const Parcel* parcel) override;
+ status_t writeToParcel(android::Parcel* parcel) const override;
+ status_t readFromParcel(const android::Parcel* parcel) override;
// Returns the number of vendor tags defined.
int getTagCount(metadata_vendor_id_t id) const;
diff --git a/camera/ndk/Android.bp b/camera/ndk/Android.bp
index 56f209c..7ba82c1 100644
--- a/camera/ndk/Android.bp
+++ b/camera/ndk/Android.bp
@@ -123,6 +123,7 @@
"android.frameworks.cameraservice.device@2.0",
"android.frameworks.cameraservice.common@2.0",
"android.frameworks.cameraservice.service@2.0",
+ "android.frameworks.cameraservice.service@2.1",
],
static_libs: [
"android.hardware.camera.common@1.0-helper",
@@ -140,9 +141,12 @@
}
cc_test {
- name: "AImageReaderVendorTest",
+ name: "ACameraNdkVendorTest",
vendor: true,
- srcs: ["ndk_vendor/tests/AImageReaderVendorTest.cpp"],
+ srcs: [
+ "ndk_vendor/tests/AImageReaderVendorTest.cpp",
+ "ndk_vendor/tests/ACameraManagerTest.cpp",
+ ],
shared_libs: [
"libcamera2ndk_vendor",
"libcamera_metadata",
diff --git a/camera/ndk/NdkCameraMetadata.cpp b/camera/ndk/NdkCameraMetadata.cpp
index 1fec3e1..7d3a53e 100644
--- a/camera/ndk/NdkCameraMetadata.cpp
+++ b/camera/ndk/NdkCameraMetadata.cpp
@@ -81,15 +81,16 @@
}
// Given cameraMetadata, an instance of android.hardware.camera2.CameraMetadata, invokes
-// cameraMetadata.getNativeMetadataPtr() and returns it as a CameraMetadata*.
-CameraMetadata* CameraMetadata_getNativeMetadataPtr(JNIEnv* env, jobject cameraMetadata) {
+// cameraMetadata.getNativeMetadataPtr() and returns it as a std::shared_ptr<CameraMetadata>*.
+std::shared_ptr<CameraMetadata>* CameraMetadata_getNativeMetadataPtr(JNIEnv* env,
+ jobject cameraMetadata) {
if (cameraMetadata == nullptr) {
ALOGE("%s: Invalid Java CameraMetadata object.", __FUNCTION__);
return nullptr;
}
jlong ret = env->CallLongMethod(cameraMetadata,
android_hardware_camera2_CameraMetadata_getNativeMetadataPtr);
- return reinterpret_cast<CameraMetadata *>(ret);
+ return reinterpret_cast<std::shared_ptr<CameraMetadata>* >(ret);
}
} // namespace
@@ -179,10 +180,9 @@
return nullptr;
}
- CameraMetadata* src = CameraMetadata_getNativeMetadataPtr(env,
- cameraMetadata);
- ACameraMetadata* output = new ACameraMetadata(src, type);
+ auto sharedData = CameraMetadata_getNativeMetadataPtr(env, cameraMetadata);
+ ACameraMetadata* output = new ACameraMetadata(*sharedData, type);
output->incStrong(/*id=*/(void*) ACameraMetadata_fromCameraMetadata);
return output;
}
-#endif /* __ANDROID_VNDK__ */
\ No newline at end of file
+#endif /* __ANDROID_VNDK__ */
diff --git a/camera/ndk/impl/ACameraManager.cpp b/camera/ndk/impl/ACameraManager.cpp
index 4870265..f408b6a 100644
--- a/camera/ndk/impl/ACameraManager.cpp
+++ b/camera/ndk/impl/ACameraManager.cpp
@@ -130,6 +130,11 @@
mCameraService->addListener(mCameraServiceListener, &cameraStatuses);
for (auto& c : cameraStatuses) {
onStatusChangedLocked(c.status, c.cameraId);
+
+ for (auto& unavailablePhysicalId : c.unavailablePhysicalIds) {
+ onStatusChangedLocked(hardware::ICameraServiceListener::STATUS_NOT_PRESENT,
+ c.cameraId, unavailablePhysicalId);
+ }
}
// setup vendor tags
@@ -200,9 +205,7 @@
void CameraManagerGlobal::registerExtendedAvailabilityCallback(
const ACameraManager_ExtendedAvailabilityCallbacks *callback) {
- Mutex::Autolock _l(mLock);
- Callback cb(callback);
- mCallbacks.insert(cb);
+ return registerAvailCallback<ACameraManager_ExtendedAvailabilityCallbacks>(callback);
}
void CameraManagerGlobal::unregisterExtendedAvailabilityCallback(
@@ -214,6 +217,18 @@
void CameraManagerGlobal::registerAvailabilityCallback(
const ACameraManager_AvailabilityCallbacks *callback) {
+ return registerAvailCallback<ACameraManager_AvailabilityCallbacks>(callback);
+}
+
+void CameraManagerGlobal::unregisterAvailabilityCallback(
+ const ACameraManager_AvailabilityCallbacks *callback) {
+ Mutex::Autolock _l(mLock);
+ Callback cb(callback);
+ mCallbacks.erase(cb);
+}
+
+template<class T>
+void CameraManagerGlobal::registerAvailCallback(const T *callback) {
Mutex::Autolock _l(mLock);
Callback cb(callback);
auto pair = mCallbacks.insert(cb);
@@ -227,24 +242,33 @@
if (!pair.second.supportsHAL3) {
continue;
}
+
+ // Camera available/unavailable callback
sp<AMessage> msg = new AMessage(kWhatSendSingleCallback, mHandler);
- ACameraManager_AvailabilityCallback cb = isStatusAvailable(status) ?
- callback->onCameraAvailable : callback->onCameraUnavailable;
- msg->setPointer(kCallbackFpKey, (void *) cb);
- msg->setPointer(kContextKey, callback->context);
+ ACameraManager_AvailabilityCallback cbFunc = isStatusAvailable(status) ?
+ cb.mAvailable : cb.mUnavailable;
+ msg->setPointer(kCallbackFpKey, (void *) cbFunc);
+ msg->setPointer(kContextKey, cb.mContext);
msg->setString(kCameraIdKey, AString(cameraId));
msg->post();
+
+ // Physical camera unavailable callback
+ std::set<String8> unavailablePhysicalCameras =
+ pair.second.getUnavailablePhysicalIds();
+ for (const auto& physicalCameraId : unavailablePhysicalCameras) {
+ sp<AMessage> msg = new AMessage(kWhatSendSinglePhysicalCameraCallback, mHandler);
+ ACameraManager_PhysicalCameraAvailabilityCallback cbFunc =
+ cb.mPhysicalCamUnavailable;
+ msg->setPointer(kCallbackFpKey, (void *) cbFunc);
+ msg->setPointer(kContextKey, cb.mContext);
+ msg->setString(kCameraIdKey, AString(cameraId));
+ msg->setString(kPhysicalCameraIdKey, AString(physicalCameraId));
+ msg->post();
+ }
}
}
}
-void CameraManagerGlobal::unregisterAvailabilityCallback(
- const ACameraManager_AvailabilityCallbacks *callback) {
- Mutex::Autolock _l(mLock);
- Callback cb(callback);
- mCallbacks.erase(cb);
-}
-
bool CameraManagerGlobal::supportsCamera2ApiLocked(const String8 &cameraId) {
bool camera2Support = false;
auto cs = getCameraServiceLocked();
@@ -550,6 +574,11 @@
return count > 0;
}
+std::set<String8> CameraManagerGlobal::StatusAndHAL3Support::getUnavailablePhysicalIds() {
+ std::lock_guard<std::mutex> lock(mLock);
+ return unavailablePhysicalIds;
+}
+
} // namespace acam
} // namespace android
diff --git a/camera/ndk/impl/ACameraManager.h b/camera/ndk/impl/ACameraManager.h
index 98cd934..836e037 100644
--- a/camera/ndk/impl/ACameraManager.h
+++ b/camera/ndk/impl/ACameraManager.h
@@ -70,6 +70,9 @@
const char* kCameraServiceName = "media.camera";
Mutex mLock;
+ template<class T>
+ void registerAvailCallback(const T *callback);
+
class DeathNotifier : public IBinder::DeathRecipient {
public:
explicit DeathNotifier(CameraManagerGlobal* cm) : mCameraManager(cm) {}
@@ -222,6 +225,7 @@
bool removeUnavailablePhysicalId(const String8& physicalCameraId);
int32_t getStatus();
void updateStatus(int32_t newStatus);
+ std::set<String8> getUnavailablePhysicalIds();
};
// Map camera_id -> status
diff --git a/camera/ndk/impl/ACameraMetadata.cpp b/camera/ndk/impl/ACameraMetadata.cpp
index 18c5d3c..1bbb9c2 100644
--- a/camera/ndk/impl/ACameraMetadata.cpp
+++ b/camera/ndk/impl/ACameraMetadata.cpp
@@ -28,33 +28,24 @@
* ACameraMetadata Implementation
*/
ACameraMetadata::ACameraMetadata(camera_metadata_t* buffer, ACAMERA_METADATA_TYPE type) :
- mData(new CameraMetadata(buffer)),
- mOwnsData(true),
+ mData(std::make_shared<CameraMetadata>(buffer)),
mType(type) {
init();
}
-ACameraMetadata::ACameraMetadata(CameraMetadata* cameraMetadata, ACAMERA_METADATA_TYPE type) :
+ACameraMetadata::ACameraMetadata(const std::shared_ptr<CameraMetadata>& cameraMetadata,
+ ACAMERA_METADATA_TYPE type) :
mData(cameraMetadata),
- mOwnsData(false),
mType(type) {
init();
}
ACameraMetadata::ACameraMetadata(const ACameraMetadata& other) :
- mOwnsData(other.mOwnsData),
+ mData(std::make_shared<CameraMetadata>(*(other.mData))),
mType(other.mType) {
- if (other.mOwnsData) {
- mData = new CameraMetadata(*(other.mData));
- } else {
- mData = other.mData;
- }
}
ACameraMetadata::~ACameraMetadata() {
- if (mOwnsData) {
- delete mData;
- }
}
void
@@ -373,7 +364,7 @@
Mutex::Autolock _l(mLock);
- camera_metadata_ro_entry rawEntry = static_cast<const CameraMetadata*>(mData)->find(tag);
+ camera_metadata_ro_entry rawEntry = static_cast<const CameraMetadata*>(mData.get())->find(tag);
if (rawEntry.count == 0) {
ALOGE("%s: cannot find metadata tag %d", __FUNCTION__, tag);
return ACAMERA_ERROR_METADATA_NOT_FOUND;
diff --git a/camera/ndk/impl/ACameraMetadata.h b/camera/ndk/impl/ACameraMetadata.h
index a57b2ff..084a60b 100644
--- a/camera/ndk/impl/ACameraMetadata.h
+++ b/camera/ndk/impl/ACameraMetadata.h
@@ -18,6 +18,7 @@
#include <unordered_set>
#include <vector>
+#include <memory>
#include <sys/types.h>
#include <utils/Mutex.h>
@@ -50,14 +51,13 @@
// Constructs a ACameraMetadata that takes ownership of `buffer`.
ACameraMetadata(camera_metadata_t* buffer, ACAMERA_METADATA_TYPE type);
- // Constructs a ACameraMetadata that is a view of `cameraMetadata`.
- // `cameraMetadata` will not be deleted by ~ACameraMetadata().
- ACameraMetadata(CameraMetadata* cameraMetadata, ACAMERA_METADATA_TYPE type);
+ // Constructs a ACameraMetadata that shares its data with something else, like a Java object
+ ACameraMetadata(const std::shared_ptr<CameraMetadata>& cameraMetadata,
+ ACAMERA_METADATA_TYPE type);
// Copy constructor.
//
- // If `other` owns its CameraMetadata, then makes a deep copy.
- // Otherwise, the new instance is also a view of the same data.
+ // Always makes a deep copy.
ACameraMetadata(const ACameraMetadata& other);
~ACameraMetadata();
@@ -125,9 +125,7 @@
// Guard access of public APIs: get/update/getTags.
mutable Mutex mLock;
- CameraMetadata* mData;
- // If true, has ownership of mData. Otherwise, mData is a view of an external instance.
- bool mOwnsData;
+ std::shared_ptr<CameraMetadata> mData;
mutable Vector<uint32_t> mTags; // Updated by `getTags()`, cleared by `update()`.
const ACAMERA_METADATA_TYPE mType;
diff --git a/camera/ndk/include/camera/NdkCameraMetadata.h b/camera/ndk/include/camera/NdkCameraMetadata.h
index ee75610..072bb02 100644
--- a/camera/ndk/include/camera/NdkCameraMetadata.h
+++ b/camera/ndk/include/camera/NdkCameraMetadata.h
@@ -274,10 +274,9 @@
* <p>The returned ACameraMetadata must be freed by the application by {@link ACameraMetadata_free}
* after application is done using it.</p>
*
- * <p>This function does not affect the lifetime of {@link cameraMetadata}. Attempting to use the
- * returned ACameraMetadata object after {@link cameraMetadata} has been garbage collected is
- * unsafe. To manage the lifetime beyond the current JNI function call, use
- * {@code env->NewGlobalRef()} and {@code env->DeleteGlobalRef()}.
+ * <p>The ACameraMetadata maintains a reference count to the underlying data, so
+ * it can be used independently of the Java object, and it remains valid even if
+ * the Java metadata is garbage collected.
*
* @param env the JNI environment.
* @param cameraMetadata the source {@link android.hardware.camera2.CameraMetadata} from which the
@@ -297,4 +296,4 @@
#endif /* _NDK_CAMERA_METADATA_H */
-/** @} */
\ No newline at end of file
+/** @} */
diff --git a/camera/ndk/ndk_vendor/impl/ACameraManager.cpp b/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
index 70c887a..a95fe2a 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
+++ b/camera/ndk/ndk_vendor/impl/ACameraManager.cpp
@@ -36,13 +36,13 @@
namespace android {
namespace acam {
-using frameworks::cameraservice::service::V2_0::CameraStatusAndId;
using frameworks::cameraservice::common::V2_0::ProviderIdAndVendorTagSections;
using android::hardware::camera::common::V1_0::helper::VendorTagDescriptor;
using android::hardware::camera::common::V1_0::helper::VendorTagDescriptorCache;
// Static member definitions
const char* CameraManagerGlobal::kCameraIdKey = "CameraId";
+const char* CameraManagerGlobal::kPhysicalCameraIdKey = "PhysicalCameraId";
const char* CameraManagerGlobal::kCallbackFpKey = "CallbackFp";
const char* CameraManagerGlobal::kContextKey = "CallbackContext";
Mutex CameraManagerGlobal::sLock;
@@ -258,9 +258,9 @@
if (mCameraServiceListener == nullptr) {
mCameraServiceListener = new CameraServiceListener(this);
}
- hidl_vec<CameraStatusAndId> cameraStatuses{};
+ hidl_vec<frameworks::cameraservice::service::V2_1::CameraStatusAndId> cameraStatuses{};
Status status = Status::NO_ERROR;
- auto remoteRet = mCameraService->addListener(mCameraServiceListener,
+ auto remoteRet = mCameraService->addListener_2_1(mCameraServiceListener,
[&status, &cameraStatuses](Status s,
auto &retStatuses) {
status = s;
@@ -277,7 +277,15 @@
}
for (auto& c : cameraStatuses) {
- onStatusChangedLocked(c);
+ onStatusChangedLocked(c.v2_0);
+
+ for (auto& unavailablePhysicalId : c.unavailPhysicalCameraIds) {
+ PhysicalCameraStatusAndId statusAndId;
+ statusAndId.deviceStatus = CameraDeviceStatus::STATUS_NOT_PRESENT;
+ statusAndId.cameraId = c.v2_0.cameraId;
+ statusAndId.physicalCameraId = unavailablePhysicalId;
+ onStatusChangedLocked(statusAndId);
+ }
}
}
return mCameraService;
@@ -293,7 +301,7 @@
for (auto& pair : cm->mDeviceStatusMap) {
CameraStatusAndId cameraStatusAndId;
cameraStatusAndId.cameraId = pair.first;
- cameraStatusAndId.deviceStatus = pair.second;
+ cameraStatusAndId.deviceStatus = pair.second.getStatus();
cm->onStatusChangedLocked(cameraStatusAndId);
}
cm->mCameraService.clear();
@@ -303,24 +311,7 @@
void CameraManagerGlobal::registerAvailabilityCallback(
const ACameraManager_AvailabilityCallbacks *callback) {
- Mutex::Autolock _l(mLock);
- Callback cb(callback);
- auto pair = mCallbacks.insert(cb);
- // Send initial callbacks if callback is newly registered
- if (pair.second) {
- for (auto& pair : mDeviceStatusMap) {
- const hidl_string& cameraId = pair.first;
- CameraDeviceStatus status = pair.second;
-
- sp<AMessage> msg = new AMessage(kWhatSendSingleCallback, mHandler);
- ACameraManager_AvailabilityCallback cb = isStatusAvailable(status) ?
- callback->onCameraAvailable : callback->onCameraUnavailable;
- msg->setPointer(kCallbackFpKey, (void *) cb);
- msg->setPointer(kContextKey, callback->context);
- msg->setString(kCameraIdKey, AString(cameraId.c_str()));
- msg->post();
- }
- }
+ return registerAvailCallback<ACameraManager_AvailabilityCallbacks>(callback);
}
void CameraManagerGlobal::unregisterAvailabilityCallback(
@@ -330,14 +321,63 @@
mCallbacks.erase(cb);
}
+void CameraManagerGlobal::registerExtendedAvailabilityCallback(
+ const ACameraManager_ExtendedAvailabilityCallbacks *callback) {
+ return registerAvailCallback<ACameraManager_ExtendedAvailabilityCallbacks>(callback);
+}
+
+void CameraManagerGlobal::unregisterExtendedAvailabilityCallback(
+ const ACameraManager_ExtendedAvailabilityCallbacks *callback) {
+ Mutex::Autolock _l(mLock);
+ Callback cb(callback);
+ mCallbacks.erase(cb);
+}
+
+template <class T>
+void CameraManagerGlobal::registerAvailCallback(const T *callback) {
+ Mutex::Autolock _l(mLock);
+ Callback cb(callback);
+ auto pair = mCallbacks.insert(cb);
+ // Send initial callbacks if callback is newly registered
+ if (pair.second) {
+ for (auto& pair : mDeviceStatusMap) {
+ const hidl_string& cameraId = pair.first;
+ CameraDeviceStatus status = pair.second.getStatus();
+
+ // Camera available/unavailable callback
+ sp<AMessage> msg = new AMessage(kWhatSendSingleCallback, mHandler);
+ ACameraManager_AvailabilityCallback cbFunc = isStatusAvailable(status) ?
+ cb.mAvailable : cb.mUnavailable;
+ msg->setPointer(kCallbackFpKey, (void *) cbFunc);
+ msg->setPointer(kContextKey, cb.mContext);
+ msg->setString(kCameraIdKey, AString(cameraId.c_str()));
+ msg->post();
+
+ // Physical camera unavailable callback
+ std::set<hidl_string> unavailPhysicalIds = pair.second.getUnavailablePhysicalIds();
+ for (const auto& physicalCameraId : unavailPhysicalIds) {
+ sp<AMessage> msg = new AMessage(kWhatSendSinglePhysicalCameraCallback, mHandler);
+ ACameraManager_PhysicalCameraAvailabilityCallback cbFunc =
+ cb.mPhysicalCamUnavailable;
+ msg->setPointer(kCallbackFpKey, (void *) cbFunc);
+ msg->setPointer(kContextKey, cb.mContext);
+ msg->setString(kCameraIdKey, AString(cameraId.c_str()));
+ msg->setString(kPhysicalCameraIdKey, AString(physicalCameraId.c_str()));
+ msg->post();
+ }
+ }
+ }
+}
+
void CameraManagerGlobal::getCameraIdList(std::vector<hidl_string>* cameraIds) {
// Ensure that we have initialized/refreshed the list of available devices
auto cs = getCameraService();
Mutex::Autolock _l(mLock);
for(auto& deviceStatus : mDeviceStatusMap) {
- if (deviceStatus.second == CameraDeviceStatus::STATUS_NOT_PRESENT ||
- deviceStatus.second == CameraDeviceStatus::STATUS_ENUMERATING) {
+ CameraDeviceStatus status = deviceStatus.second.getStatus();
+ if (status == CameraDeviceStatus::STATUS_NOT_PRESENT ||
+ status == CameraDeviceStatus::STATUS_ENUMERATING) {
continue;
}
cameraIds->push_back(deviceStatus.first);
@@ -391,6 +431,35 @@
(*cb)(context, cameraId.c_str());
break;
}
+ case kWhatSendSinglePhysicalCameraCallback:
+ {
+ ACameraManager_PhysicalCameraAvailabilityCallback cb;
+ void* context;
+ AString cameraId;
+ AString physicalCameraId;
+ bool found = msg->findPointer(kCallbackFpKey, (void**) &cb);
+ if (!found) {
+ ALOGE("%s: Cannot find camera callback fp!", __FUNCTION__);
+ return;
+ }
+ found = msg->findPointer(kContextKey, &context);
+ if (!found) {
+ ALOGE("%s: Cannot find callback context!", __FUNCTION__);
+ return;
+ }
+ found = msg->findString(kCameraIdKey, &cameraId);
+ if (!found) {
+ ALOGE("%s: Cannot find camera ID!", __FUNCTION__);
+ return;
+ }
+ found = msg->findString(kPhysicalCameraIdKey, &physicalCameraId);
+ if (!found) {
+ ALOGE("%s: Cannot find physical camera ID!", __FUNCTION__);
+ return;
+ }
+ (*cb)(context, cameraId.c_str(), physicalCameraId.c_str());
+ break;
+ }
default:
ALOGE("%s: unknown message type %d", __FUNCTION__, msg->what());
break;
@@ -426,7 +495,7 @@
bool firstStatus = (mDeviceStatusMap.count(cameraId) == 0);
CameraDeviceStatus oldStatus = firstStatus ?
status : // first status
- mDeviceStatusMap[cameraId];
+ mDeviceStatusMap[cameraId].getStatus();
if (!firstStatus &&
isStatusAvailable(status) == isStatusAvailable(oldStatus)) {
@@ -435,7 +504,7 @@
}
// Iterate through all registered callbacks
- mDeviceStatusMap[cameraId] = status;
+ mDeviceStatusMap[cameraId].updateStatus(status);
for (auto cb : mCallbacks) {
sp<AMessage> msg = new AMessage(kWhatSendSingleCallback, mHandler);
ACameraManager_AvailabilityCallback cbFp = isStatusAvailable(status) ?
@@ -450,6 +519,98 @@
}
}
+hardware::Return<void> CameraManagerGlobal::CameraServiceListener::onPhysicalCameraStatusChanged(
+ const PhysicalCameraStatusAndId &statusAndId) {
+ sp<CameraManagerGlobal> cm = mCameraManager.promote();
+ if (cm != nullptr) {
+ cm->onStatusChanged(statusAndId);
+ } else {
+ ALOGE("Cannot deliver status change. Global camera manager died");
+ }
+ return Void();
+}
+
+void CameraManagerGlobal::onStatusChanged(
+ const PhysicalCameraStatusAndId &statusAndId) {
+ Mutex::Autolock _l(mLock);
+ onStatusChangedLocked(statusAndId);
+}
+
+void CameraManagerGlobal::onStatusChangedLocked(
+ const PhysicalCameraStatusAndId &statusAndId) {
+ hidl_string cameraId = statusAndId.cameraId;
+ hidl_string physicalCameraId = statusAndId.physicalCameraId;
+ CameraDeviceStatus status = statusAndId.deviceStatus;
+ if (!validStatus(status)) {
+ ALOGE("%s: Invalid status %d", __FUNCTION__, status);
+ return;
+ }
+
+ auto logicalStatus = mDeviceStatusMap.find(cameraId);
+ if (logicalStatus == mDeviceStatusMap.end()) {
+ ALOGE("%s: Physical camera id %s status change on a non-present id %s",
+ __FUNCTION__, physicalCameraId.c_str(), cameraId.c_str());
+ return;
+ }
+ CameraDeviceStatus logicalCamStatus = mDeviceStatusMap[cameraId].getStatus();
+ if (logicalCamStatus != CameraDeviceStatus::STATUS_PRESENT &&
+ logicalCamStatus != CameraDeviceStatus::STATUS_NOT_AVAILABLE) {
+ ALOGE("%s: Physical camera id %s status %d change for an invalid logical camera state %d",
+ __FUNCTION__, physicalCameraId.c_str(), status, logicalCamStatus);
+ return;
+ }
+
+ bool updated = false;
+ if (status == CameraDeviceStatus::STATUS_PRESENT) {
+ updated = mDeviceStatusMap[cameraId].removeUnavailablePhysicalId(physicalCameraId);
+ } else {
+ updated = mDeviceStatusMap[cameraId].addUnavailablePhysicalId(physicalCameraId);
+ }
+
+ // Iterate through all registered callbacks
+ if (updated) {
+ for (auto cb : mCallbacks) {
+ sp<AMessage> msg = new AMessage(kWhatSendSinglePhysicalCameraCallback, mHandler);
+ ACameraManager_PhysicalCameraAvailabilityCallback cbFp = isStatusAvailable(status) ?
+ cb.mPhysicalCamAvailable : cb.mPhysicalCamUnavailable;
+ msg->setPointer(kCallbackFpKey, (void *) cbFp);
+ msg->setPointer(kContextKey, cb.mContext);
+ msg->setString(kCameraIdKey, AString(cameraId.c_str()));
+ msg->setString(kPhysicalCameraIdKey, AString(physicalCameraId.c_str()));
+ msg->post();
+ }
+ }
+}
+
+CameraDeviceStatus CameraManagerGlobal::CameraStatus::getStatus() {
+ std::lock_guard<std::mutex> lock(mLock);
+ return status;
+}
+
+void CameraManagerGlobal::CameraStatus::updateStatus(CameraDeviceStatus newStatus) {
+ std::lock_guard<std::mutex> lock(mLock);
+ status = newStatus;
+}
+
+bool CameraManagerGlobal::CameraStatus::addUnavailablePhysicalId(
+ const hidl_string& physicalCameraId) {
+ std::lock_guard<std::mutex> lock(mLock);
+ auto result = unavailablePhysicalIds.insert(physicalCameraId);
+ return result.second;
+}
+
+bool CameraManagerGlobal::CameraStatus::removeUnavailablePhysicalId(
+ const hidl_string& physicalCameraId) {
+ std::lock_guard<std::mutex> lock(mLock);
+ auto count = unavailablePhysicalIds.erase(physicalCameraId);
+ return count > 0;
+}
+
+std::set<hidl_string> CameraManagerGlobal::CameraStatus::getUnavailablePhysicalIds() {
+ std::lock_guard<std::mutex> lock(mLock);
+ return unavailablePhysicalIds;
+}
+
} // namespace acam
} // namespace android
diff --git a/camera/ndk/ndk_vendor/impl/ACameraManager.h b/camera/ndk/ndk_vendor/impl/ACameraManager.h
index 2c62d44..36c8e2b 100644
--- a/camera/ndk/ndk_vendor/impl/ACameraManager.h
+++ b/camera/ndk/ndk_vendor/impl/ACameraManager.h
@@ -21,6 +21,8 @@
#include <android-base/parseint.h>
#include <android/frameworks/cameraservice/service/2.0/ICameraService.h>
+#include <android/frameworks/cameraservice/service/2.1/ICameraService.h>
+#include <android/frameworks/cameraservice/service/2.1/ICameraServiceListener.h>
#include <CameraMetadata.h>
#include <utils/StrongPointer.h>
@@ -36,9 +38,10 @@
namespace android {
namespace acam {
-using ICameraService = frameworks::cameraservice::service::V2_0::ICameraService;
+using ICameraService = frameworks::cameraservice::service::V2_1::ICameraService;
using CameraDeviceStatus = frameworks::cameraservice::service::V2_0::CameraDeviceStatus;
-using ICameraServiceListener = frameworks::cameraservice::service::V2_0::ICameraServiceListener;
+using ICameraServiceListener = frameworks::cameraservice::service::V2_1::ICameraServiceListener;
+using PhysicalCameraStatusAndId = frameworks::cameraservice::service::V2_1::PhysicalCameraStatusAndId;
using CameraStatusAndId = frameworks::cameraservice::service::V2_0::CameraStatusAndId;
using Status = frameworks::cameraservice::common::V2_0::Status;
using VendorTagSection = frameworks::cameraservice::common::V2_0::VendorTagSection;
@@ -65,9 +68,9 @@
const ACameraManager_AvailabilityCallbacks *callback);
void registerExtendedAvailabilityCallback(
- const ACameraManager_ExtendedAvailabilityCallbacks* /*callback*/) {}
+ const ACameraManager_ExtendedAvailabilityCallbacks* callback);
void unregisterExtendedAvailabilityCallback(
- const ACameraManager_ExtendedAvailabilityCallbacks* /*callback*/) {}
+ const ACameraManager_ExtendedAvailabilityCallbacks* callback);
/**
* Return camera IDs that support camera2
@@ -94,6 +97,8 @@
explicit CameraServiceListener(CameraManagerGlobal* cm) : mCameraManager(cm) {}
android::hardware::Return<void> onStatusChanged(
const CameraStatusAndId &statusAndId) override;
+ android::hardware::Return<void> onPhysicalCameraStatusChanged(
+ const PhysicalCameraStatusAndId &statusAndId) override;
private:
const wp<CameraManagerGlobal> mCameraManager;
@@ -105,11 +110,25 @@
explicit Callback(const ACameraManager_AvailabilityCallbacks *callback) :
mAvailable(callback->onCameraAvailable),
mUnavailable(callback->onCameraUnavailable),
+ mAccessPriorityChanged(nullptr),
+ mPhysicalCamAvailable(nullptr),
+ mPhysicalCamUnavailable(nullptr),
mContext(callback->context) {}
+ explicit Callback(const ACameraManager_ExtendedAvailabilityCallbacks *callback) :
+ mAvailable(callback->availabilityCallbacks.onCameraAvailable),
+ mUnavailable(callback->availabilityCallbacks.onCameraUnavailable),
+ mAccessPriorityChanged(callback->onCameraAccessPrioritiesChanged),
+ mPhysicalCamAvailable(callback->onPhysicalCameraAvailable),
+ mPhysicalCamUnavailable(callback->onPhysicalCameraUnavailable),
+ mContext(callback->availabilityCallbacks.context) {}
+
bool operator == (const Callback& other) const {
return (mAvailable == other.mAvailable &&
mUnavailable == other.mUnavailable &&
+ mAccessPriorityChanged == other.mAccessPriorityChanged &&
+ mPhysicalCamAvailable == other.mPhysicalCamAvailable &&
+ mPhysicalCamUnavailable == other.mPhysicalCamUnavailable &&
mContext == other.mContext);
}
bool operator != (const Callback& other) const {
@@ -119,6 +138,12 @@
if (*this == other) return false;
if (mContext != other.mContext) return mContext < other.mContext;
if (mAvailable != other.mAvailable) return mAvailable < other.mAvailable;
+ if (mAccessPriorityChanged != other.mAccessPriorityChanged)
+ return mAccessPriorityChanged < other.mAccessPriorityChanged;
+ if (mPhysicalCamAvailable != other.mPhysicalCamAvailable)
+ return mPhysicalCamAvailable < other.mPhysicalCamAvailable;
+ if (mPhysicalCamUnavailable != other.mPhysicalCamUnavailable)
+ return mPhysicalCamUnavailable < other.mPhysicalCamUnavailable;
return mUnavailable < other.mUnavailable;
}
bool operator > (const Callback& other) const {
@@ -126,15 +151,20 @@
}
ACameraManager_AvailabilityCallback mAvailable;
ACameraManager_AvailabilityCallback mUnavailable;
+ ACameraManager_AccessPrioritiesChangedCallback mAccessPriorityChanged;
+ ACameraManager_PhysicalCameraAvailabilityCallback mPhysicalCamAvailable;
+ ACameraManager_PhysicalCameraAvailabilityCallback mPhysicalCamUnavailable;
void* mContext;
};
std::set<Callback> mCallbacks;
// definition of handler and message
enum {
- kWhatSendSingleCallback
+ kWhatSendSingleCallback,
+ kWhatSendSinglePhysicalCameraCallback,
};
static const char* kCameraIdKey;
+ static const char* kPhysicalCameraIdKey;
static const char* kCallbackFpKey;
static const char* kContextKey;
class CallbackHandler : public AHandler {
@@ -147,6 +177,8 @@
void onStatusChanged(const CameraStatusAndId &statusAndId);
void onStatusChangedLocked(const CameraStatusAndId &statusAndId);
+ void onStatusChanged(const PhysicalCameraStatusAndId &statusAndId);
+ void onStatusChangedLocked(const PhysicalCameraStatusAndId &statusAndId);
bool setupVendorTags();
// Utils for status
@@ -174,8 +206,27 @@
}
};
+ struct CameraStatus {
+ private:
+ CameraDeviceStatus status = CameraDeviceStatus::STATUS_NOT_PRESENT;
+ mutable std::mutex mLock;
+ std::set<hidl_string> unavailablePhysicalIds;
+ public:
+ CameraStatus(CameraDeviceStatus st): status(st) { };
+ CameraStatus() = default;
+
+ bool addUnavailablePhysicalId(const hidl_string& physicalCameraId);
+ bool removeUnavailablePhysicalId(const hidl_string& physicalCameraId);
+ CameraDeviceStatus getStatus();
+ void updateStatus(CameraDeviceStatus newStatus);
+ std::set<hidl_string> getUnavailablePhysicalIds();
+ };
+
+ template <class T>
+ void registerAvailCallback(const T *callback);
+
// Map camera_id -> status
- std::map<hidl_string, CameraDeviceStatus, CameraIdComparator> mDeviceStatusMap;
+ std::map<hidl_string, CameraStatus, CameraIdComparator> mDeviceStatusMap;
// For the singleton instance
static Mutex sLock;
diff --git a/camera/ndk/ndk_vendor/tests/ACameraManagerTest.cpp b/camera/ndk/ndk_vendor/tests/ACameraManagerTest.cpp
new file mode 100644
index 0000000..a20a290
--- /dev/null
+++ b/camera/ndk/ndk_vendor/tests/ACameraManagerTest.cpp
@@ -0,0 +1,238 @@
+/*
+ * Copyright (C) 2020 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 "ACameraManagerTest"
+//#define LOG_NDEBUG 0
+
+#include <gtest/gtest.h>
+
+#include <mutex>
+#include <set>
+#include <string>
+
+#include <utils/Log.h>
+#include <camera/NdkCameraError.h>
+#include <camera/NdkCameraManager.h>
+
+namespace {
+
+class CameraServiceListener {
+ public:
+ typedef std::set<std::pair<std::string, std::string>> StringPairSet;
+
+ static void onAvailable(void* obj, const char* cameraId) {
+ ALOGV("Camera %s onAvailable", cameraId);
+ if (obj == nullptr) {
+ return;
+ }
+ CameraServiceListener* thiz = reinterpret_cast<CameraServiceListener*>(obj);
+ std::lock_guard<std::mutex> lock(thiz->mMutex);
+ thiz->mOnAvailableCount++;
+ thiz->mAvailableMap[cameraId] = true;
+ return;
+ }
+
+ static void onUnavailable(void* obj, const char* cameraId) {
+ ALOGV("Camera %s onUnavailable", cameraId);
+ if (obj == nullptr) {
+ return;
+ }
+ CameraServiceListener* thiz = reinterpret_cast<CameraServiceListener*>(obj);
+ std::lock_guard<std::mutex> lock(thiz->mMutex);
+ thiz->mOnUnavailableCount++;
+ thiz->mAvailableMap[cameraId] = false;
+ return;
+ }
+
+ static void onCameraAccessPrioritiesChanged(void* /*obj*/) {
+ return;
+ }
+
+ static void onPhysicalCameraAvailable(void* obj, const char* cameraId,
+ const char* physicalCameraId) {
+ ALOGV("Camera %s : %s onAvailable", cameraId, physicalCameraId);
+ if (obj == nullptr) {
+ return;
+ }
+ CameraServiceListener* thiz = reinterpret_cast<CameraServiceListener*>(obj);
+ std::lock_guard<std::mutex> lock(thiz->mMutex);
+ thiz->mOnPhysicalCameraAvailableCount++;
+ return;
+ }
+
+ static void onPhysicalCameraUnavailable(void* obj, const char* cameraId,
+ const char* physicalCameraId) {
+ ALOGV("Camera %s : %s onUnavailable", cameraId, physicalCameraId);
+ if (obj == nullptr) {
+ return;
+ }
+ CameraServiceListener* thiz = reinterpret_cast<CameraServiceListener*>(obj);
+ std::lock_guard<std::mutex> lock(thiz->mMutex);
+ thiz->mUnavailablePhysicalCameras.emplace(cameraId, physicalCameraId);
+ return;
+ }
+
+ void resetCount() {
+ std::lock_guard<std::mutex> lock(mMutex);
+ mOnAvailableCount = 0;
+ mOnUnavailableCount = 0;
+ mOnPhysicalCameraAvailableCount = 0;
+ mUnavailablePhysicalCameras.clear();
+ return;
+ }
+
+ int getAvailableCount() {
+ std::lock_guard<std::mutex> lock(mMutex);
+ return mOnAvailableCount;
+ }
+
+ int getUnavailableCount() {
+ std::lock_guard<std::mutex> lock(mMutex);
+ return mOnUnavailableCount;
+ }
+
+ int getPhysicalCameraAvailableCount() {
+ std::lock_guard<std::mutex> lock(mMutex);
+ return mOnPhysicalCameraAvailableCount;
+ }
+
+ StringPairSet getUnavailablePhysicalCameras() {
+ std::lock_guard<std::mutex> lock(mMutex);
+ return mUnavailablePhysicalCameras;
+ }
+
+ bool isAvailable(const char* cameraId) {
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (mAvailableMap.count(cameraId) == 0) {
+ return false;
+ }
+ return mAvailableMap[cameraId];
+ }
+
+ private:
+ std::mutex mMutex;
+ int mOnAvailableCount = 0;
+ int mOnUnavailableCount = 0;
+ int mOnPhysicalCameraAvailableCount = 0;
+ std::map<std::string, bool> mAvailableMap;
+ StringPairSet mUnavailablePhysicalCameras;
+};
+
+class ACameraManagerTest : public ::testing::Test {
+ public:
+ void SetUp() override {
+ mCameraManager = ACameraManager_create();
+ if (mCameraManager == nullptr) {
+ ALOGE("Failed to create ACameraManager.");
+ return;
+ }
+
+ camera_status_t ret = ACameraManager_getCameraIdList(mCameraManager, &mCameraIdList);
+ if (ret != ACAMERA_OK) {
+ ALOGE("Failed to get cameraIdList: ret=%d", ret);
+ return;
+ }
+ if (mCameraIdList->numCameras < 1) {
+ ALOGW("Device has no camera on board.");
+ return;
+ }
+ }
+ void TearDown() override {
+ // Destroy camera manager
+ if (mCameraIdList) {
+ ACameraManager_deleteCameraIdList(mCameraIdList);
+ mCameraIdList = nullptr;
+ }
+ if (mCameraManager) {
+ ACameraManager_delete(mCameraManager);
+ mCameraManager = nullptr;
+ }
+ }
+
+ // Camera manager
+ ACameraManager* mCameraManager = nullptr;
+ ACameraIdList* mCameraIdList = nullptr;
+ CameraServiceListener mAvailabilityListener;
+ ACameraManager_ExtendedAvailabilityCallbacks mCbs = {
+ {
+ &mAvailabilityListener,
+ CameraServiceListener::onAvailable,
+ CameraServiceListener::onUnavailable
+ },
+ CameraServiceListener::onCameraAccessPrioritiesChanged,
+ CameraServiceListener::onPhysicalCameraAvailable,
+ CameraServiceListener::onPhysicalCameraUnavailable,
+ {}
+ };
+};
+
+TEST_F(ACameraManagerTest, testCameraManagerExtendedAvailabilityCallbacks) {
+ camera_status_t ret = ACameraManager_registerExtendedAvailabilityCallback(mCameraManager,
+ &mCbs);
+ ASSERT_EQ(ret, ACAMERA_OK);
+
+ sleep(1);
+
+ // Should at least get onAvailable for each camera once
+ ASSERT_EQ(mAvailabilityListener.getAvailableCount(), mCameraIdList->numCameras);
+
+ // Expect no available callbacks for physical cameras
+ int availablePhysicalCamera = mAvailabilityListener.getPhysicalCameraAvailableCount();
+ ASSERT_EQ(availablePhysicalCamera, 0);
+
+ CameraServiceListener::StringPairSet unavailablePhysicalCameras;
+ CameraServiceListener::StringPairSet physicalCameraIdPairs;
+
+ unavailablePhysicalCameras = mAvailabilityListener.getUnavailablePhysicalCameras();
+ for (int i = 0; i < mCameraIdList->numCameras; i++) {
+ const char* cameraId = mCameraIdList->cameraIds[i];
+ ASSERT_NE(cameraId, nullptr);
+ ASSERT_TRUE(mAvailabilityListener.isAvailable(cameraId));
+
+ ACameraMetadata* chars = nullptr;
+ ret = ACameraManager_getCameraCharacteristics(mCameraManager, cameraId, &chars);
+ ASSERT_EQ(ret, ACAMERA_OK);
+ ASSERT_NE(chars, nullptr);
+
+ size_t physicalCameraCnt = 0;
+ const char *const* physicalCameraIds = nullptr;
+ if (!ACameraMetadata_isLogicalMultiCamera(
+ chars, &physicalCameraCnt, &physicalCameraIds)) {
+ ACameraMetadata_free(chars);
+ continue;
+ }
+ for (size_t j = 0; j < physicalCameraCnt; j++) {
+ physicalCameraIdPairs.emplace(cameraId, physicalCameraIds[j]);
+ }
+ ACameraMetadata_free(chars);
+ }
+ for (const auto& unavailIdPair : unavailablePhysicalCameras) {
+ bool validPair = false;
+ for (const auto& idPair : physicalCameraIdPairs) {
+ if (idPair.first == unavailIdPair.first && idPair.second == unavailIdPair.second) {
+ validPair = true;
+ break;
+ }
+ }
+ // Expect valid unavailable physical cameras
+ ASSERT_TRUE(validPair);
+ }
+
+ ret = ACameraManager_unregisterExtendedAvailabilityCallback(mCameraManager, &mCbs);
+ ASSERT_EQ(ret, ACAMERA_OK);
+}
+
+} // namespace
diff --git a/drm/drmserver/Android.bp b/drm/drmserver/Android.bp
index fd71837..f427834 100644
--- a/drm/drmserver/Android.bp
+++ b/drm/drmserver/Android.bp
@@ -26,11 +26,13 @@
shared_libs: [
"libmedia",
"libmediametrics",
+ "libcutils",
"libutils",
"liblog",
"libbinder",
"libdl",
"libselinux",
+ "libstagefright_foundation",
],
static_libs: ["libdrmframeworkcommon"],
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index 38dc052..9a32cc5 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -16,9 +16,10 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "DrmManager(Native)"
-#include "utils/Log.h"
+#include <cutils/properties.h>
#include <utils/String8.h>
+#include <utils/Log.h>
#include <binder/IPCThreadState.h>
#include <drm/DrmInfo.h>
@@ -37,12 +38,30 @@
#include "DrmManager.h"
#include "ReadWriteUtils.h"
+#include <algorithm>
+
#define DECRYPT_FILE_ERROR (-1)
using namespace android;
const String8 DrmManager::EMPTY_STRING("");
+const std::map<const char*, size_t> DrmManager::kMethodIdMap {
+ {"getConstraints" , DrmManagerMethodId::GET_CONSTRAINTS },
+ {"getMetadata" , DrmManagerMethodId::GET_METADATA },
+ {"canHandle" , DrmManagerMethodId::CAN_HANDLE },
+ {"processDrmInfo" , DrmManagerMethodId::PROCESS_DRM_INFO },
+ {"acquireDrmInfo" , DrmManagerMethodId::ACQUIRE_DRM_INFO },
+ {"saveRights" , DrmManagerMethodId::SAVE_RIGHTS },
+ {"getOriginalMimeType", DrmManagerMethodId::GET_ORIGINAL_MIME_TYPE},
+ {"getDrmObjectType" , DrmManagerMethodId::GET_DRM_OBJECT_TYPE },
+ {"checkRightsStatus" , DrmManagerMethodId::CHECK_RIGHTS_STATUS },
+ {"removeRights" , DrmManagerMethodId::REMOVE_RIGHTS },
+ {"removeAllRights" , DrmManagerMethodId::REMOVE_ALL_RIGHTS },
+ {"openConvertSession" , DrmManagerMethodId::OPEN_CONVERT_SESSION },
+ {"openDecryptSession" , DrmManagerMethodId::OPEN_DECRYPT_SESSION }
+};
+
DrmManager::DrmManager() :
mDecryptSessionId(0),
mConvertId(0) {
@@ -51,42 +70,106 @@
}
DrmManager::~DrmManager() {
-
+ if (mMetricsLooper != NULL) {
+ mMetricsLooper->stop();
+ }
+ flushEngineMetrics();
}
-void DrmManager::reportEngineMetrics(
- const char func[], const String8& plugInId, const String8& mimeType) {
- IDrmEngine& engine = mPlugInManager.getPlugIn(plugInId);
+void DrmManager::initMetricsLooper() {
+ if (mMetricsLooper != NULL) {
+ return;
+ }
+ mMetricsLooper = new ALooper;
+ mMetricsLooper->setName("DrmManagerMetricsLooper");
+ mMetricsLooper->start();
+ mMetricsLooper->registerHandler(this);
- std::unique_ptr<mediametrics::Item> item(mediametrics::Item::create("drmmanager"));
- item->setUid(IPCThreadState::self()->getCallingUid());
- item->setCString("function_name", func);
- item->setCString("plugin_id", plugInId.getPathLeaf().getBasePath().c_str());
+ sp<AMessage> msg = new AMessage(kWhatFlushMetrics, this);
+ msg->post(getMetricsFlushPeriodUs());
+}
+void DrmManager::onMessageReceived(const sp<AMessage> &msg) {
+ switch (msg->what()) {
+ case kWhatFlushMetrics:
+ {
+ flushEngineMetrics();
+ msg->post(getMetricsFlushPeriodUs());
+ break;
+ }
+ default:
+ {
+ ALOGW("Unrecognized message type: %zd", msg->what());
+ }
+ }
+}
+
+int64_t DrmManager::getMetricsFlushPeriodUs() {
+ return 1000 * 1000 * std::max(1ll, property_get_int64("drmmanager.metrics.period", 86400));
+}
+
+void DrmManager::recordEngineMetrics(
+ const char func[], const String8& plugInId8, const String8& mimeType) {
+ IDrmEngine& engine = mPlugInManager.getPlugIn(plugInId8);
std::unique_ptr<DrmSupportInfo> info(engine.getSupportInfo(0));
- if (NULL != info) {
- item->setCString("description", info->getDescription().c_str());
+
+ uid_t callingUid = IPCThreadState::self()->getCallingUid();
+ std::string plugInId(plugInId8.getPathLeaf().getBasePath().c_str());
+ ALOGV("%d calling %s %s", callingUid, plugInId.c_str(), func);
+
+ Mutex::Autolock _l(mMetricsLock);
+ auto& metrics = mPluginMetrics[std::make_pair(callingUid, plugInId)];
+ if (metrics.mPluginId.empty()) {
+ metrics.mPluginId = plugInId;
+ metrics.mCallingUid = callingUid;
+ if (NULL != info) {
+ metrics.mDescription = info->getDescription().c_str();
+ }
}
if (!mimeType.isEmpty()) {
- item->setCString("mime_types", mimeType.c_str());
+ metrics.mMimeTypes.insert(mimeType.c_str());
} else if (NULL != info) {
DrmSupportInfo::MimeTypeIterator mimeIter = info->getMimeTypeIterator();
- String8 mimes;
while (mimeIter.hasNext()) {
- mimes += mimeIter.next();
- if (mimeIter.hasNext()) {
- mimes += ",";
- }
+ metrics.mMimeTypes.insert(mimeIter.next().c_str());
}
- item->setCString("mime_types", mimes.c_str());
}
- if (!item->selfrecord()) {
- ALOGE("Failed to record metrics");
+ size_t methodId = kMethodIdMap.at(func);
+ if (methodId < metrics.mMethodCounts.size()) {
+ metrics.mMethodCounts[methodId]++;
}
}
+void DrmManager::flushEngineMetrics() {
+ using namespace std::string_literals;
+ Mutex::Autolock _l(mMetricsLock);
+ for (auto kv : mPluginMetrics) {
+ DrmManagerMetrics& metrics = kv.second;
+ std::unique_ptr<mediametrics::Item> item(mediametrics::Item::create("drmmanager"));
+ item->setUid(metrics.mCallingUid);
+ item->setCString("plugin_id", metrics.mPluginId.c_str());
+ item->setCString("description", metrics.mDescription.c_str());
+
+ std::vector<std::string> mimeTypes(metrics.mMimeTypes.begin(), metrics.mMimeTypes.end());
+ std::string mimeTypesStr(mimeTypes.empty() ? "" : mimeTypes[0]);
+ for (size_t i = 1; i < mimeTypes.size() ; i++) {
+ mimeTypesStr.append(",").append(mimeTypes[i]);
+ }
+ item->setCString("mime_types", mimeTypesStr.c_str());
+
+ for (size_t i = 0; i < metrics.mMethodCounts.size() ; i++) {
+ item->setInt64(("method"s + std::to_string(i)).c_str(), metrics.mMethodCounts[i]);
+ }
+
+ if (!item->selfrecord()) {
+ ALOGE("Failed to record metrics");
+ }
+ }
+ mPluginMetrics.clear();
+}
+
int DrmManager::addUniqueId(bool isNative) {
Mutex::Autolock _l(mLock);
@@ -184,7 +267,6 @@
for (size_t index = 0; index < plugInIdList.size(); index++) {
IDrmEngine& rDrmEngine = mPlugInManager.getPlugIn(plugInIdList.itemAt(index));
rDrmEngine.terminate(uniqueId);
- reportEngineMetrics(__func__, plugInIdList[index]);
}
}
@@ -197,7 +279,7 @@
constraints = rDrmEngine.getConstraints(uniqueId, path, action);
}
if (NULL != constraints) {
- reportEngineMetrics(__func__, plugInId);
+ recordEngineMetrics(__func__, plugInId);
}
return constraints;
}
@@ -211,7 +293,7 @@
meta = rDrmEngine.getMetadata(uniqueId, path);
}
if (NULL != meta) {
- reportEngineMetrics(__func__, plugInId);
+ recordEngineMetrics(__func__, plugInId);
}
return meta;
}
@@ -222,7 +304,7 @@
bool result = (EMPTY_STRING != plugInId) ? true : false;
if (result) {
- reportEngineMetrics(__func__, plugInId, mimeType);
+ recordEngineMetrics(__func__, plugInId, mimeType);
}
if (0 < path.length()) {
@@ -249,7 +331,7 @@
infoStatus = rDrmEngine.processDrmInfo(uniqueId, drmInfo);
}
if (NULL != infoStatus) {
- reportEngineMetrics(__func__, plugInId, mimeType);
+ recordEngineMetrics(__func__, plugInId, mimeType);
}
return infoStatus;
}
@@ -263,7 +345,7 @@
result = rDrmEngine.canHandle(uniqueId, path);
if (result) {
- reportEngineMetrics(__func__, plugInPathList[i]);
+ recordEngineMetrics(__func__, plugInPathList[i]);
break;
}
}
@@ -280,7 +362,7 @@
info = rDrmEngine.acquireDrmInfo(uniqueId, drmInfoRequest);
}
if (NULL != info) {
- reportEngineMetrics(__func__, plugInId, mimeType);
+ recordEngineMetrics(__func__, plugInId, mimeType);
}
return info;
}
@@ -296,7 +378,7 @@
result = rDrmEngine.saveRights(uniqueId, drmRights, rightsPath, contentPath);
}
if (DRM_NO_ERROR == result) {
- reportEngineMetrics(__func__, plugInId, mimeType);
+ recordEngineMetrics(__func__, plugInId, mimeType);
}
return result;
}
@@ -310,7 +392,7 @@
mimeType = rDrmEngine.getOriginalMimeType(uniqueId, path, fd);
}
if (!mimeType.isEmpty()) {
- reportEngineMetrics(__func__, plugInId, mimeType);
+ recordEngineMetrics(__func__, plugInId, mimeType);
}
return mimeType;
}
@@ -324,7 +406,7 @@
type = rDrmEngine.getDrmObjectType(uniqueId, path, mimeType);
}
if (DrmObjectType::UNKNOWN != type) {
- reportEngineMetrics(__func__, plugInId, mimeType);
+ recordEngineMetrics(__func__, plugInId, mimeType);
}
return type;
}
@@ -338,7 +420,7 @@
rightsStatus = rDrmEngine.checkRightsStatus(uniqueId, path, action);
}
if (RightsStatus::RIGHTS_INVALID != rightsStatus) {
- reportEngineMetrics(__func__, plugInId);
+ recordEngineMetrics(__func__, plugInId);
}
return rightsStatus;
}
@@ -385,7 +467,7 @@
result = rDrmEngine.removeRights(uniqueId, path);
}
if (DRM_NO_ERROR == result) {
- reportEngineMetrics(__func__, plugInId);
+ recordEngineMetrics(__func__, plugInId);
}
return result;
}
@@ -399,7 +481,7 @@
if (DRM_NO_ERROR != result) {
break;
}
- reportEngineMetrics(__func__, plugInIdList[index]);
+ recordEngineMetrics(__func__, plugInIdList[index]);
}
return result;
}
@@ -416,7 +498,7 @@
++mConvertId;
convertId = mConvertId;
mConvertSessionMap.add(convertId, &rDrmEngine);
- reportEngineMetrics(__func__, plugInId, mimeType);
+ recordEngineMetrics(__func__, plugInId, mimeType);
}
}
return convertId;
@@ -497,7 +579,7 @@
if (DRM_NO_ERROR == result) {
++mDecryptSessionId;
mDecryptSessionMap.add(mDecryptSessionId, &rDrmEngine);
- reportEngineMetrics(__func__, plugInId, String8(mime));
+ recordEngineMetrics(__func__, plugInId, String8(mime));
break;
}
}
@@ -526,7 +608,7 @@
if (DRM_NO_ERROR == result) {
++mDecryptSessionId;
mDecryptSessionMap.add(mDecryptSessionId, &rDrmEngine);
- reportEngineMetrics(__func__, plugInId, String8(mime));
+ recordEngineMetrics(__func__, plugInId, String8(mime));
break;
}
}
@@ -556,7 +638,7 @@
if (DRM_NO_ERROR == result) {
++mDecryptSessionId;
mDecryptSessionMap.add(mDecryptSessionId, &rDrmEngine);
- reportEngineMetrics(__func__, plugInId, mimeType);
+ recordEngineMetrics(__func__, plugInId, mimeType);
break;
}
}
diff --git a/drm/drmserver/DrmManager.h b/drm/drmserver/DrmManager.h
index 75fc1a8..350fcf4 100644
--- a/drm/drmserver/DrmManager.h
+++ b/drm/drmserver/DrmManager.h
@@ -17,13 +17,26 @@
#ifndef __DRM_MANAGER_H__
#define __DRM_MANAGER_H__
+#include <drm/drm_framework_common.h>
+#include <media/stagefright/foundation/AHandler.h>
+#include <media/stagefright/foundation/ALooper.h>
+#include <media/stagefright/foundation/AMessage.h>
+#include <sys/types.h>
#include <utils/Errors.h>
#include <utils/threads.h>
-#include <drm/drm_framework_common.h>
+
#include "IDrmEngine.h"
#include "PlugInManager.h"
#include "IDrmServiceListener.h"
+#include <array>
+#include <cstddef>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
namespace android {
class IDrmManager;
@@ -40,6 +53,31 @@
class DrmSupportInfo;
class ActionDescription;
+enum DrmManagerMethodId {
+ GET_CONSTRAINTS,
+ GET_METADATA,
+ CAN_HANDLE,
+ PROCESS_DRM_INFO,
+ ACQUIRE_DRM_INFO,
+ SAVE_RIGHTS,
+ GET_ORIGINAL_MIME_TYPE,
+ GET_DRM_OBJECT_TYPE,
+ CHECK_RIGHTS_STATUS,
+ REMOVE_RIGHTS,
+ REMOVE_ALL_RIGHTS,
+ OPEN_CONVERT_SESSION,
+ OPEN_DECRYPT_SESSION,
+ NUM_METHODS,
+};
+
+struct DrmManagerMetrics {
+ std::string mPluginId;
+ std::string mDescription;
+ std::set<std::string> mMimeTypes;
+ std::array<int64_t, DrmManagerMethodId::NUM_METHODS> mMethodCounts{};
+ uid_t mCallingUid;
+};
+
/**
* This is implementation class for DRM Manager. This class delegates the
* functionality to corresponding DRM Engine.
@@ -47,7 +85,7 @@
* The DrmManagerService class creates an instance of this class.
*
*/
-class DrmManager : public IDrmEngine::OnInfoListener {
+class DrmManager : public AHandler, public IDrmEngine::OnInfoListener {
public:
DrmManager();
virtual ~DrmManager();
@@ -134,6 +172,8 @@
void onInfo(const DrmInfoEvent& event);
+ void initMetricsLooper();
+
private:
String8 getSupportedPlugInId(int uniqueId, const String8& path, const String8& mimeType);
@@ -143,16 +183,24 @@
bool canHandle(int uniqueId, const String8& path);
- void reportEngineMetrics(const char func[],
+ void onMessageReceived(const sp<AMessage> &msg);
+
+ int64_t getMetricsFlushPeriodUs();
+
+ void recordEngineMetrics(const char func[],
const String8& plugInId, const String8& mimeType = String8(""));
+ void flushEngineMetrics();
+
private:
enum {
kMaxNumUniqueIds = 0x1000,
+ kWhatFlushMetrics = 'metr',
};
bool mUniqueIdArray[kMaxNumUniqueIds];
static const String8 EMPTY_STRING;
+ static const std::map<const char*, size_t> kMethodIdMap;
int mDecryptSessionId;
int mConvertId;
@@ -160,11 +208,15 @@
Mutex mListenerLock;
Mutex mDecryptLock;
Mutex mConvertLock;
+ Mutex mMetricsLock;
TPlugInManager<IDrmEngine> mPlugInManager;
KeyedVector< DrmSupportInfo, String8 > mSupportInfoToPlugInIdMap;
KeyedVector< int, IDrmEngine*> mConvertSessionMap;
KeyedVector< int, sp<IDrmServiceListener> > mServiceListeners;
KeyedVector< int, IDrmEngine*> mDecryptSessionMap;
+
+ std::map<std::pair<uid_t, std::string>, DrmManagerMetrics> mPluginMetrics;
+ sp<ALooper> mMetricsLooper;
};
};
diff --git a/drm/drmserver/DrmManagerService.cpp b/drm/drmserver/DrmManagerService.cpp
index 2600a2c..4b8b3f6 100644
--- a/drm/drmserver/DrmManagerService.cpp
+++ b/drm/drmserver/DrmManagerService.cpp
@@ -130,13 +130,14 @@
mDrmManager(NULL) {
ALOGV("created");
mDrmManager = new DrmManager();
+ mDrmManager->initMetricsLooper();
mDrmManager->loadPlugIns();
}
DrmManagerService::~DrmManagerService() {
ALOGV("Destroyed");
mDrmManager->unloadPlugIns();
- delete mDrmManager; mDrmManager = NULL;
+ mDrmManager = NULL;
}
int DrmManagerService::addUniqueId(bool isNative) {
diff --git a/drm/drmserver/DrmManagerService.h b/drm/drmserver/DrmManagerService.h
index 2e27a3c..f9b8bef 100644
--- a/drm/drmserver/DrmManagerService.h
+++ b/drm/drmserver/DrmManagerService.h
@@ -142,7 +142,7 @@
virtual status_t dump(int fd, const Vector<String16>& args);
private:
- DrmManager* mDrmManager;
+ sp<DrmManager> mDrmManager;
};
};
diff --git a/drm/libmediadrm/Android.bp b/drm/libmediadrm/Android.bp
index 6ba1b9c..1700a95 100644
--- a/drm/libmediadrm/Android.bp
+++ b/drm/libmediadrm/Android.bp
@@ -50,6 +50,7 @@
"android.hardware.drm@1.0",
"android.hardware.drm@1.1",
"android.hardware.drm@1.2",
+ "android.hardware.drm@1.3",
"libhidlallocatorutils",
"libhidlbase",
],
diff --git a/drm/libmediadrm/DrmHal.cpp b/drm/libmediadrm/DrmHal.cpp
index 5b32a04..f218041 100644
--- a/drm/libmediadrm/DrmHal.cpp
+++ b/drm/libmediadrm/DrmHal.cpp
@@ -713,7 +713,8 @@
} while (retry);
if (err == OK) {
- std::shared_ptr<DrmSessionClient> client(new DrmSessionClient(this, sessionId));
+ std::shared_ptr<DrmSessionClient> client =
+ ndk::SharedRefBase::make<DrmSessionClient>(this, sessionId);
DrmSessionManager::Instance()->addSession(AIBinder_getCallingPid(),
std::static_pointer_cast<IResourceManagerClient>(client), sessionId);
mOpenSessions.push_back(client);
diff --git a/drm/libmediadrm/DrmUtils.cpp b/drm/libmediadrm/DrmUtils.cpp
index 3549637..51c2e24 100644
--- a/drm/libmediadrm/DrmUtils.cpp
+++ b/drm/libmediadrm/DrmUtils.cpp
@@ -25,6 +25,8 @@
#include <android/hardware/drm/1.1/IDrmFactory.h>
#include <android/hardware/drm/1.2/ICryptoFactory.h>
#include <android/hardware/drm/1.2/IDrmFactory.h>
+#include <android/hardware/drm/1.3/ICryptoFactory.h>
+#include <android/hardware/drm/1.3/IDrmFactory.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <hidl/HidlSupport.h>
@@ -144,6 +146,7 @@
MakeHidlFactories<::V1_0::IDrmFactory>(uuid, drmFactories);
MakeHidlFactories<::V1_1::IDrmFactory>(uuid, drmFactories);
MakeHidlFactories<::V1_2::IDrmFactory>(uuid, drmFactories);
+ MakeHidlFactories<::V1_3::IDrmFactory>(uuid, drmFactories);
return drmFactories;
}
@@ -161,6 +164,7 @@
MakeHidlFactories<::V1_0::ICryptoFactory>(uuid, cryptoFactories);
MakeHidlFactories<::V1_1::ICryptoFactory>(uuid, cryptoFactories);
MakeHidlFactories<::V1_2::ICryptoFactory>(uuid, cryptoFactories);
+ MakeHidlFactories<::V1_3::ICryptoFactory>(uuid, cryptoFactories);
return cryptoFactories;
}
diff --git a/media/codec2/TEST_MAPPING b/media/codec2/TEST_MAPPING
index e01f452..49614cd 100644
--- a/media/codec2/TEST_MAPPING
+++ b/media/codec2/TEST_MAPPING
@@ -1,31 +1,20 @@
{
- "presubmit": [
+ "postsubmit": [
{
- "name": "GtsMediaTestCases",
- "options" : [
+ // TODO: move to presubmit once we verify the tests are not flaky
+ "name": "CtsMediaTestCases",
+ "options": [
{
- "include-annotation": "android.platform.test.annotations.Presubmit"
+ "include-annotation": "android.platform.test.annotations.Presubmit"
},
{
- "include-filter": "com.google.android.media.gts.WidevineGenericOpsTests"
- }
- ]
- },
- {
- "name": "GtsExoPlayerTestCases",
- "options" : [
- {
- "include-annotation": "android.platform.test.annotations.SocPresubmit"
+ "exclude-annotation": "android.platform.test.annotations.RequiresDevice"
},
+ // TODO: b/149314419
{
- "include-filter": "com.google.android.exoplayer.gts.DashTest#testWidevine23FpsH264Fixed"
+ "exclude-filter": "android.media.cts.AudioPlaybackCaptureTest"
}
]
}
- ],
- "imports": [
- {
- "path": "frameworks/av/drm/mediadrm/plugins"
- }
]
}
diff --git a/media/codec2/components/aac/C2SoftAacDec.cpp b/media/codec2/components/aac/C2SoftAacDec.cpp
index 3568f7b..f39620e 100644
--- a/media/codec2/components/aac/C2SoftAacDec.cpp
+++ b/media/codec2/components/aac/C2SoftAacDec.cpp
@@ -40,6 +40,8 @@
#define DRC_DEFAULT_MOBILE_DRC_BOOST 1.0 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_HEAVY C2Config::DRC_COMPRESSION_HEAVY /* switch for heavy compression for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_EFFECT 3 /* MPEG-D DRC effect type; 3 => Limited playback range */
+#define DRC_DEFAULT_MOBILE_DRC_ALBUM 0 /* MPEG-D DRC album mode; 0 => album mode is disabled, 1 => album mode is enabled */
+#define DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS (0.25) /* decoder output loudness; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define DRC_DEFAULT_MOBILE_ENC_LEVEL (0.25) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define MAX_CHANNEL_COUNT 8 /* maximum number of audio channels that can be decoded */
// names of properties that can be used to override the default DRC settings
@@ -190,6 +192,24 @@
})
.withSetter(Setter<decltype(*mDrcEffectType)>::StrictValueWithNoDeps)
.build());
+
+ addParameter(
+ DefineParam(mDrcAlbumMode, C2_PARAMKEY_DRC_ALBUM_MODE)
+ .withDefault(new C2StreamDrcAlbumModeTuning::input(0u, C2Config::DRC_ALBUM_MODE_OFF))
+ .withFields({
+ C2F(mDrcAlbumMode, value).oneOf({
+ C2Config::DRC_ALBUM_MODE_OFF,
+ C2Config::DRC_ALBUM_MODE_ON})
+ })
+ .withSetter(Setter<decltype(*mDrcAlbumMode)>::StrictValueWithNoDeps)
+ .build());
+
+ addParameter(
+ DefineParam(mDrcOutputLoudness, C2_PARAMKEY_DRC_OUTPUT_LOUDNESS)
+ .withDefault(new C2StreamDrcOutputLoudnessTuning::output(0u, DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS))
+ .withFields({C2F(mDrcOutputLoudness, value).inRange(-57.75, 0.25)})
+ .withSetter(Setter<decltype(*mDrcOutputLoudness)>::StrictValueWithNoDeps)
+ .build());
}
bool isAdts() const { return mAacFormat->value == C2Config::AAC_PACKAGING_ADTS; }
@@ -204,6 +224,8 @@
int32_t getDrcBoostFactor() const { return mDrcBoostFactor->value * 127. + 0.5; }
int32_t getDrcAttenuationFactor() const { return mDrcAttenuationFactor->value * 127. + 0.5; }
int32_t getDrcEffectType() const { return mDrcEffectType->value; }
+ int32_t getDrcAlbumMode() const { return mDrcAlbumMode->value; }
+ int32_t getDrcOutputLoudness() const { return (mDrcOutputLoudness->value <= 0 ? -mDrcOutputLoudness->value * 4. + 0.5 : -1); }
private:
std::shared_ptr<C2StreamSampleRateInfo::output> mSampleRate;
@@ -218,6 +240,8 @@
std::shared_ptr<C2StreamDrcBoostFactorTuning::input> mDrcBoostFactor;
std::shared_ptr<C2StreamDrcAttenuationFactorTuning::input> mDrcAttenuationFactor;
std::shared_ptr<C2StreamDrcEffectTypeTuning::input> mDrcEffectType;
+ std::shared_ptr<C2StreamDrcAlbumModeTuning::input> mDrcAlbumMode;
+ std::shared_ptr<C2StreamDrcOutputLoudnessTuning::output> mDrcOutputLoudness;
// TODO Add : C2StreamAacSbrModeTuning
};
@@ -324,7 +348,7 @@
// DRC_PRES_MODE_WRAP_DESIRED_HEAVY
int32_t compressMode = mIntf->getDrcCompressMode();
- ALOGV("AAC decoder using desried DRC heavy compression switch of %d", compressMode);
+ ALOGV("AAC decoder using desired DRC heavy compression switch of %d", compressMode);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_HEAVY, (unsigned)compressMode);
// DRC_PRES_MODE_WRAP_ENCODER_TARGET
@@ -337,6 +361,11 @@
ALOGV("AAC decoder using MPEG-D DRC effect type %d", effectType);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, effectType);
+ // AAC_UNIDRC_ALBUM_MODE
+ int32_t albumMode = mIntf->getDrcAlbumMode();
+ ALOGV("AAC decoder using MPEG-D DRC album mode %d", albumMode);
+ aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);
+
// By default, the decoder creates a 5.1 channel downmix signal.
// For seven and eight channel input streams, enable 6.1 and 7.1 channel output
aacDecoder_SetParam(mAACDecoder, AAC_PCM_MAX_OUTPUT_CHANNELS, -1);
@@ -632,6 +661,7 @@
INT prevSampleRate = mStreamInfo->sampleRate;
INT prevNumChannels = mStreamInfo->numChannels;
+ INT prevOutLoudness = mStreamInfo->outputLoudness;
aacDecoder_Fill(mAACDecoder,
inBuffer,
@@ -640,6 +670,43 @@
// run DRC check
mDrcWrap.submitStreamData(mStreamInfo);
+
+ // apply runtime updates
+ // DRC_PRES_MODE_WRAP_DESIRED_TARGET
+ int32_t targetRefLevel = mIntf->getDrcTargetRefLevel();
+ ALOGV("AAC decoder using desired DRC target reference level of %d", targetRefLevel);
+ mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_TARGET, (unsigned)targetRefLevel);
+
+ // DRC_PRES_MODE_WRAP_DESIRED_ATT_FACTOR
+ int32_t attenuationFactor = mIntf->getDrcAttenuationFactor();
+ ALOGV("AAC decoder using desired DRC attenuation factor of %d", attenuationFactor);
+ mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_ATT_FACTOR, (unsigned)attenuationFactor);
+
+ // DRC_PRES_MODE_WRAP_DESIRED_BOOST_FACTOR
+ int32_t boostFactor = mIntf->getDrcBoostFactor();
+ ALOGV("AAC decoder using desired DRC boost factor of %d", boostFactor);
+ mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_BOOST_FACTOR, (unsigned)boostFactor);
+
+ // DRC_PRES_MODE_WRAP_DESIRED_HEAVY
+ int32_t compressMode = mIntf->getDrcCompressMode();
+ ALOGV("AAC decoder using desried DRC heavy compression switch of %d", compressMode);
+ mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_HEAVY, (unsigned)compressMode);
+
+ // DRC_PRES_MODE_WRAP_ENCODER_TARGET
+ int32_t encTargetLevel = mIntf->getDrcEncTargetLevel();
+ ALOGV("AAC decoder using encoder-side DRC reference level of %d", encTargetLevel);
+ mDrcWrap.setParam(DRC_PRES_MODE_WRAP_ENCODER_TARGET, (unsigned)encTargetLevel);
+
+ // AAC_UNIDRC_SET_EFFECT
+ int32_t effectType = mIntf->getDrcEffectType();
+ ALOGV("AAC decoder using MPEG-D DRC effect type %d", effectType);
+ aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, effectType);
+
+ // AAC_UNIDRC_ALBUM_MODE
+ int32_t albumMode = mIntf->getDrcAlbumMode();
+ ALOGV("AAC decoder using MPEG-D DRC album mode %d", albumMode);
+ aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);
+
mDrcWrap.update();
UINT inBufferUsedLength = inBufferLength[0] - bytesValid[0];
@@ -763,6 +830,23 @@
}
}
ALOGV("size = %zu", size);
+
+ if (mStreamInfo->outputLoudness != prevOutLoudness) {
+ C2StreamDrcOutputLoudnessTuning::output
+ drcOutLoudness(0u, (float) (mStreamInfo->outputLoudness*-0.25));
+
+ std::vector<std::unique_ptr<C2SettingResult>> failures;
+ c2_status_t err = mIntf->config(
+ { &drcOutLoudness },
+ C2_MAY_BLOCK,
+ &failures);
+ if (err == OK) {
+ work->worklets.front()->output.configUpdate.push_back(
+ C2Param::Copy(drcOutLoudness));
+ } else {
+ ALOGE("Getting output loudness failed");
+ }
+ }
} while (decoderErr == AAC_DEC_OK);
}
diff --git a/media/codec2/components/aac/DrcPresModeWrap.cpp b/media/codec2/components/aac/DrcPresModeWrap.cpp
index 5b9aebc..bee969b 100644
--- a/media/codec2/components/aac/DrcPresModeWrap.cpp
+++ b/media/codec2/components/aac/DrcPresModeWrap.cpp
@@ -47,10 +47,9 @@
mEncoderTarget = -1;
/* Values from last time. */
- /* Initialized to the same values as the desired values */
- mLastTarget = -1;
- mLastAttFactor = 0;
- mLastBoostFactor = 0;
+ mLastTarget = -2;
+ mLastAttFactor = -1;
+ mLastBoostFactor = -1;
mLastHeavy = 0;
}
@@ -163,7 +162,7 @@
if (mDataUpdate) {
// sanity check
- if (mDesTarget < MAX_TARGET_LEVEL){
+ if ((mDesTarget < MAX_TARGET_LEVEL) && (mDesTarget != -1)){
mDesTarget = MAX_TARGET_LEVEL; // limit target level to -10 dB or below
newTarget = MAX_TARGET_LEVEL;
}
diff --git a/media/codec2/core/include/C2Config.h b/media/codec2/core/include/C2Config.h
index f9eb2fa..74fdc8b 100644
--- a/media/codec2/core/include/C2Config.h
+++ b/media/codec2/core/include/C2Config.h
@@ -58,6 +58,8 @@
enum bitrate_mode_t : uint32_t; ///< bitrate control mode
enum drc_compression_mode_t : int32_t; ///< DRC compression mode
enum drc_effect_type_t : int32_t; ///< DRC effect type
+ enum drc_album_mode_t : int32_t; ///< DRC album mode
+ enum drc_output_loudness : int32_t; ///< DRC output loudness
enum intra_refresh_mode_t : uint32_t; ///< intra refresh modes
enum level_t : uint32_t; ///< coding level
enum ordinal_key_t : uint32_t; ///< work ordering keys
@@ -218,6 +220,8 @@
kParamIndexDrcBoostFactor, // drc, float (0-1)
kParamIndexDrcAttenuationFactor, // drc, float (0-1)
kParamIndexDrcEffectType, // drc, enum
+ kParamIndexDrcOutputLoudness, // drc, float (dBFS)
+ kParamIndexDrcAlbumMode, // drc, enum
/* ============================== platform-defined parameters ============================== */
@@ -1941,6 +1945,24 @@
C2StreamDrcEffectTypeTuning;
constexpr char C2_PARAMKEY_DRC_EFFECT_TYPE[] = "coding.drc.effect-type";
+/**
+ * DRC album mode. Used during decoding.
+ */
+C2ENUM(C2Config::drc_album_mode_t, int32_t,
+ DRC_ALBUM_MODE_OFF = 0,
+ DRC_ALBUM_MODE_ON = 1
+)
+typedef C2StreamParam<C2Info, C2SimpleValueStruct<C2Config::drc_album_mode_t>, kParamIndexDrcAlbumMode>
+ C2StreamDrcAlbumModeTuning;
+constexpr char C2_PARAMKEY_DRC_ALBUM_MODE[] = "coding.drc.album-mode";
+
+/**
+ * DRC output loudness in dBFS. Retrieved during decoding
+ */
+ typedef C2StreamParam<C2Info, C2FloatValue, kParamIndexDrcOutputLoudness>
+ C2StreamDrcOutputLoudnessTuning;
+ constexpr char C2_PARAMKEY_DRC_OUTPUT_LOUDNESS[] = "output.drc.output-loudness";
+
/* --------------------------------------- AAC components --------------------------------------- */
/**
diff --git a/media/codec2/hidl/1.0/utils/InputSurfaceConnection.cpp b/media/codec2/hidl/1.0/utils/InputSurfaceConnection.cpp
index 5cc0d53..5ec88ec 100644
--- a/media/codec2/hidl/1.0/utils/InputSurfaceConnection.cpp
+++ b/media/codec2/hidl/1.0/utils/InputSurfaceConnection.cpp
@@ -160,12 +160,12 @@
return false;
}
for (int32_t i = 0; i < kBufferCount; ++i) {
- if (!mSource->onInputBufferAdded(i).isOk()) {
+ if (mSource->onInputBufferAdded(i) != OK) {
LOG(WARNING) << "Impl::init: failed to populate GBS slots.";
return false;
}
}
- if (!mSource->start().isOk()) {
+ if (mSource->start() != OK) {
LOG(WARNING) << "Impl::init -- GBS failed to start.";
return false;
}
diff --git a/media/codec2/sfplugin/Android.bp b/media/codec2/sfplugin/Android.bp
index 94034b5..cb60a45 100644
--- a/media/codec2/sfplugin/Android.bp
+++ b/media/codec2/sfplugin/Android.bp
@@ -45,7 +45,7 @@
"libmedia_codeclist",
"libmedia_omx",
"libsfplugin_ccodec_utils",
- "libstagefright_bufferqueue_helper",
+ "libstagefright_bufferqueue_helper_client",
"libstagefright_codecbase",
"libstagefright_foundation",
"libstagefright_omx",
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index ae95336..035dca8 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -1263,10 +1263,12 @@
}
if (oStreamFormat.value == C2BufferData::LINEAR) {
- // WORKAROUND: if we're using early CSD workaround we convert to
- // array mode, to appease apps assuming the output
- // buffers to be of the same size.
- output->buffers = output->buffers->toArrayMode(numOutputSlots);
+ if (buffersBoundToCodec) {
+ // WORKAROUND: if we're using early CSD workaround we convert to
+ // array mode, to appease apps assuming the output
+ // buffers to be of the same size.
+ output->buffers = output->buffers->toArrayMode(numOutputSlots);
+ }
int32_t channelCount;
int32_t sampleRate;
diff --git a/media/codec2/sfplugin/CCodecConfig.cpp b/media/codec2/sfplugin/CCodecConfig.cpp
index d2f5ea7..b019d0d 100644
--- a/media/codec2/sfplugin/CCodecConfig.cpp
+++ b/media/codec2/sfplugin/CCodecConfig.cpp
@@ -34,6 +34,8 @@
#define DRC_DEFAULT_MOBILE_DRC_BOOST 127 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_HEAVY 1 /* switch for heavy compression for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_EFFECT 3 /* MPEG-D DRC effect type; 3 => Limited playback range */
+#define DRC_DEFAULT_MOBILE_DRC_ALBUM 0 /* MPEG-D DRC album mode; 0 => album mode is disabled, 1 => album mode is enabled */
+#define DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS -1 /* decoder output loudness; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define DRC_DEFAULT_MOBILE_ENC_LEVEL (-1) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
// names of properties that can be used to override the default DRC settings
#define PROP_DRC_OVERRIDE_REF_LEVEL "aac_drc_reference_level"
@@ -700,63 +702,101 @@
// convert to dBFS and add default
add(ConfigMapper(KEY_AAC_DRC_TARGET_REFERENCE_LEVEL, C2_PARAMKEY_DRC_TARGET_REFERENCE_LEVEL, "value")
- .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
- .withMapper([](C2Value v) -> C2Value {
+ .limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
+ .withMappers([](C2Value v) -> C2Value {
int32_t value;
- if (!v.get(&value) || value < 0) {
+ if (!v.get(&value) || value < -1) {
value = property_get_int32(PROP_DRC_OVERRIDE_REF_LEVEL, DRC_DEFAULT_MOBILE_REF_LEVEL);
}
return float(-0.25 * c2_min(value, 127));
+ },[](C2Value v) -> C2Value {
+ float value;
+ if (v.get(&value)) {
+ return (int32_t) (-4. * value);
+ }
+ return C2Value();
}));
// convert to 0-1 (%) and add default
add(ConfigMapper(KEY_AAC_DRC_ATTENUATION_FACTOR, C2_PARAMKEY_DRC_ATTENUATION_FACTOR, "value")
- .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
- .withMapper([](C2Value v) -> C2Value {
+ .limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
+ .withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
value = property_get_int32(PROP_DRC_OVERRIDE_CUT, DRC_DEFAULT_MOBILE_DRC_CUT);
}
return float(c2_min(value, 127) / 127.);
+ },[](C2Value v) -> C2Value {
+ float value;
+ if (v.get(&value)) {
+ return (int32_t) (value * 127. + 0.5);
+ }
+ else {
+ return C2Value();
+ }
}));
// convert to 0-1 (%) and add default
add(ConfigMapper(KEY_AAC_DRC_BOOST_FACTOR, C2_PARAMKEY_DRC_BOOST_FACTOR, "value")
- .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
- .withMapper([](C2Value v) -> C2Value {
+ .limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
+ .withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
value = property_get_int32(PROP_DRC_OVERRIDE_BOOST, DRC_DEFAULT_MOBILE_DRC_BOOST);
}
return float(c2_min(value, 127) / 127.);
+ },[](C2Value v) -> C2Value {
+ float value;
+ if (v.get(&value)) {
+ return (int32_t) (value * 127. + 0.5);
+ }
+ else {
+ return C2Value();
+ }
}));
// convert to compression type and add default
add(ConfigMapper(KEY_AAC_DRC_HEAVY_COMPRESSION, C2_PARAMKEY_DRC_COMPRESSION_MODE, "value")
- .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
- .withMapper([](C2Value v) -> C2Value {
+ .limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
+ .withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
value = property_get_int32(PROP_DRC_OVERRIDE_HEAVY, DRC_DEFAULT_MOBILE_DRC_HEAVY);
}
return value == 1 ? C2Config::DRC_COMPRESSION_HEAVY : C2Config::DRC_COMPRESSION_LIGHT;
+ },[](C2Value v) -> C2Value {
+ int32_t value;
+ if (v.get(&value)) {
+ return value;
+ }
+ else {
+ return C2Value();
+ }
}));
// convert to dBFS and add default
add(ConfigMapper(KEY_AAC_ENCODED_TARGET_LEVEL, C2_PARAMKEY_DRC_ENCODED_TARGET_LEVEL, "value")
- .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
- .withMapper([](C2Value v) -> C2Value {
+ .limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
+ .withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
value = property_get_int32(PROP_DRC_OVERRIDE_ENC_LEVEL, DRC_DEFAULT_MOBILE_ENC_LEVEL);
}
return float(-0.25 * c2_min(value, 127));
+ },[](C2Value v) -> C2Value {
+ float value;
+ if (v.get(&value)) {
+ return (int32_t) (-4. * value);
+ }
+ else {
+ return C2Value();
+ }
}));
// convert to effect type (these map to SDK values) and add default
add(ConfigMapper(KEY_AAC_DRC_EFFECT_TYPE, C2_PARAMKEY_DRC_EFFECT_TYPE, "value")
- .limitTo(D::AUDIO & D::DECODER & D::CONFIG)
- .withMapper([](C2Value v) -> C2Value {
+ .limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
+ .withMappers([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < -1 || value > 8) {
value = property_get_int32(PROP_DRC_OVERRIDE_EFFECT, DRC_DEFAULT_MOBILE_DRC_EFFECT);
@@ -766,13 +806,60 @@
}
}
return value;
+ },[](C2Value v) -> C2Value {
+ int32_t value;
+ if (v.get(&value)) {
+ return value;
+ }
+ else {
+ return C2Value();
+ }
+ }));
+
+ // convert to album mode and add default
+ add(ConfigMapper(KEY_AAC_DRC_ALBUM_MODE, C2_PARAMKEY_DRC_ALBUM_MODE, "value")
+ .limitTo(D::AUDIO & D::DECODER & (D::CONFIG | D::PARAM | D::READ))
+ .withMappers([](C2Value v) -> C2Value {
+ int32_t value;
+ if (!v.get(&value) || value < 0 || value > 1) {
+ value = DRC_DEFAULT_MOBILE_DRC_ALBUM;
+ // ensure value is within range
+ if (value < 0 || value > 1) {
+ value = DRC_DEFAULT_MOBILE_DRC_ALBUM;
+ }
+ }
+ return value;
+ },[](C2Value v) -> C2Value {
+ int32_t value;
+ if (v.get(&value)) {
+ return value;
+ }
+ else {
+ return C2Value();
+ }
+ }));
+
+ add(ConfigMapper(KEY_AAC_DRC_OUTPUT_LOUDNESS, C2_PARAMKEY_DRC_OUTPUT_LOUDNESS, "value")
+ .limitTo(D::OUTPUT & D::DECODER & D::READ)
+ .withMappers([](C2Value v) -> C2Value {
+ int32_t value;
+ if (!v.get(&value) || value < -1) {
+ value = DRC_DEFAULT_MOBILE_OUTPUT_LOUDNESS;
+ }
+ return float(-0.25 * c2_min(value, 127));
+ },[](C2Value v) -> C2Value {
+ float value;
+ if (v.get(&value)) {
+ return (int32_t) (-4. * value);
+ }
+ return C2Value();
}));
add(ConfigMapper(KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT, C2_PARAMKEY_MAX_CHANNEL_COUNT, "value")
- .limitTo(D::AUDIO));
+ .limitTo(D::AUDIO & (D::CONFIG | D::PARAM | D::READ)));
add(ConfigMapper(KEY_AAC_SBR_MODE, C2_PARAMKEY_AAC_SBR_MODE, "value")
- .limitTo(D::AUDIO & D::ENCODER & D::CONFIG)
+ .limitTo(D::AUDIO & D::ENCODER & (D::CONFIG | D::PARAM | D::READ))
.withMapper([](C2Value v) -> C2Value {
int32_t value;
if (!v.get(&value) || value < 0) {
diff --git a/media/codec2/vndk/Android.bp b/media/codec2/vndk/Android.bp
index a1f145b..51d6ffa 100644
--- a/media/codec2/vndk/Android.bp
+++ b/media/codec2/vndk/Android.bp
@@ -70,8 +70,6 @@
"libutils",
],
- tidy: false, // b/146435095, clang-tidy segmentation fault
-
cflags: [
"-Werror",
"-Wall",
diff --git a/media/extractors/aac/AACExtractor.cpp b/media/extractors/aac/AACExtractor.cpp
index 9d183d4..5d00d94 100644
--- a/media/extractors/aac/AACExtractor.cpp
+++ b/media/extractors/aac/AACExtractor.cpp
@@ -132,6 +132,7 @@
AACExtractor::AACExtractor(
DataSourceHelper *source, off64_t offset)
: mDataSource(source),
+ mMeta(nullptr),
mInitCheck(NO_INIT),
mFrameDurationUs(0) {
@@ -180,7 +181,9 @@
}
AACExtractor::~AACExtractor() {
- AMediaFormat_delete(mMeta);
+ if (mMeta != nullptr) {
+ AMediaFormat_delete(mMeta);
+ }
}
media_status_t AACExtractor::getMetaData(AMediaFormat *meta) {
diff --git a/media/extractors/midi/Android.bp b/media/extractors/midi/Android.bp
index 592ffa9..ca721df 100644
--- a/media/extractors/midi/Android.bp
+++ b/media/extractors/midi/Android.bp
@@ -11,8 +11,8 @@
static_libs: [
"libmedia_midiiowrapper",
"libsonivox",
- "libstagefright_foundation"
- ],
-
-
+ "libstagefright_foundation",
+ "libwatchdog",
+ "libbase",
+ ]
}
diff --git a/media/extractors/midi/MidiExtractor.cpp b/media/extractors/midi/MidiExtractor.cpp
index 9f4f9e6..d0efb2f 100644
--- a/media/extractors/midi/MidiExtractor.cpp
+++ b/media/extractors/midi/MidiExtractor.cpp
@@ -26,6 +26,7 @@
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaErrors.h>
#include <libsonivox/eas_reverb.h>
+#include <watchdog/Watchdog.h>
namespace android {
@@ -116,6 +117,7 @@
MediaBufferHelper **outBuffer, const ReadOptions *options)
{
ALOGV("MidiSource::read");
+
MediaBufferHelper *buffer;
// process an optional seek request
int64_t seekTimeUs;
@@ -139,6 +141,8 @@
}
// MidiEngine
+using namespace std::chrono_literals;
+static constexpr auto kTimeout = 10s;
MidiEngine::MidiEngine(CDataSource *dataSource,
AMediaFormat *fileMetadata,
@@ -147,6 +151,8 @@
mEasHandle(NULL),
mEasConfig(NULL),
mIsInitialized(false) {
+ Watchdog watchdog(kTimeout);
+
mIoWrapper = new MidiIoWrapper(dataSource);
// spin up a new EAS engine
EAS_I32 temp;
@@ -186,6 +192,8 @@
}
MidiEngine::~MidiEngine() {
+ Watchdog watchdog(kTimeout);
+
if (mEasHandle) {
EAS_CloseFile(mEasData, mEasHandle);
}
@@ -217,12 +225,16 @@
}
status_t MidiEngine::seekTo(int64_t positionUs) {
+ Watchdog watchdog(kTimeout);
+
ALOGV("seekTo %lld", (long long)positionUs);
EAS_RESULT result = EAS_Locate(mEasData, mEasHandle, positionUs / 1000, false);
return result == EAS_SUCCESS ? OK : UNKNOWN_ERROR;
}
MediaBufferHelper* MidiEngine::readBuffer() {
+ Watchdog watchdog(kTimeout);
+
EAS_STATE state;
EAS_State(mEasData, mEasHandle, &state);
if ((state == EAS_STATE_STOPPED) || (state == EAS_STATE_ERROR)) {
diff --git a/media/extractors/mp4/SampleTable.cpp b/media/extractors/mp4/SampleTable.cpp
index 59c8200..a00812b 100644
--- a/media/extractors/mp4/SampleTable.cpp
+++ b/media/extractors/mp4/SampleTable.cpp
@@ -652,12 +652,13 @@
}
mSampleTimeEntries = new (std::nothrow) SampleTimeEntry[mNumSampleSizes];
- memset(mSampleTimeEntries, 0, sizeof(SampleTimeEntry) * mNumSampleSizes);
+
if (!mSampleTimeEntries) {
ALOGE("Cannot allocate sample entry table with %llu entries.",
(unsigned long long)mNumSampleSizes);
return;
}
+ memset(mSampleTimeEntries, 0, sizeof(SampleTimeEntry) * mNumSampleSizes);
uint32_t sampleIndex = 0;
uint64_t sampleTime = 0;
diff --git a/media/extractors/mpeg2/Android.bp b/media/extractors/mpeg2/Android.bp
index ef8431e..d7c4b5c 100644
--- a/media/extractors/mpeg2/Android.bp
+++ b/media/extractors/mpeg2/Android.bp
@@ -29,7 +29,6 @@
"android.hidl.token@1.0",
"android.hidl.token@1.0-utils",
"libbase",
- "libbinderthreadstate",
"libcutils",
"libhidlbase",
"libhidlmemory",
diff --git a/media/extractors/tests/Android.bp b/media/extractors/tests/Android.bp
index 059c308..fa39b64 100644
--- a/media/extractors/tests/Android.bp
+++ b/media/extractors/tests/Android.bp
@@ -33,6 +33,7 @@
"libmp4extractor",
"libaudioutils",
"libdatasource",
+ "libwatchdog",
"libstagefright",
"libstagefright_id3",
@@ -65,6 +66,7 @@
"libcrypto",
"libhidlmemory",
"libhidlbase",
+ "libbase",
],
include_dirs: [
diff --git a/media/extractors/tests/AndroidTest.xml b/media/extractors/tests/AndroidTest.xml
new file mode 100644
index 0000000..6bb2c8a
--- /dev/null
+++ b/media/extractors/tests/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.
+-->
+<configuration description="Test module config for extractor unit tests">
+ <option name="test-suite-tag" value="ExtractorUnitTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="ExtractorUnitTest->/data/local/tmp/ExtractorUnitTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/extractors/tests/extractor.zip?unzip=true"
+ value="/data/local/tmp/ExtractorUnitTestRes/" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="ExtractorUnitTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/ExtractorUnitTestRes/" />
+ </test>
+</configuration>
diff --git a/media/extractors/tests/README.md b/media/extractors/tests/README.md
index 6e02d3e..69538b6 100644
--- a/media/extractors/tests/README.md
+++ b/media/extractors/tests/README.md
@@ -22,8 +22,8 @@
adb push ${OUT}/data/nativetest/ExtractorUnitTest/ExtractorUnitTest /data/local/tmp/
```
-The resource file for the tests is taken from [here](https://drive.google.com/drive/folders/1Z9nCIRB6pGLvb5mPkF8BURa5Nc6cY9pY). Push these files into device for testing.
-Download extractor folder and push all the files in this folder to /data/local/tmp/ on the device.
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/extractors/tests/extractor.zip). Download, unzip and push these files into device for testing.
+
```
adb push extractor /data/local/tmp/
```
@@ -32,3 +32,8 @@
```
adb shell /data/local/tmp/ExtractorUnitTest -P /data/local/tmp/extractor/
```
+Alternatively, the test can also be run using atest command.
+
+```
+atest ExtractorUnitTest -- --enable-module-dynamic-download=true
+```
diff --git a/media/libaaudio/include/aaudio/AAudio.h b/media/libaaudio/include/aaudio/AAudio.h
index 2f43b22..edc09a9 100644
--- a/media/libaaudio/include/aaudio/AAudio.h
+++ b/media/libaaudio/include/aaudio/AAudio.h
@@ -1030,6 +1030,10 @@
*
* After this call, the stream will be in {@link #AAUDIO_STREAM_STATE_CLOSING}
*
+ * This function is useful if you want to release the audio resources immediately,
+ * but still allow queries to the stream to occur from other threads. This often
+ * happens if you are monitoring stream progress from a UI thread.
+ *
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return {@link #AAUDIO_OK} or a negative error.
*/
diff --git a/media/libaudioclient/AudioPolicy.cpp b/media/libaudioclient/AudioPolicy.cpp
index d468239..0522099 100644
--- a/media/libaudioclient/AudioPolicy.cpp
+++ b/media/libaudioclient/AudioPolicy.cpp
@@ -86,6 +86,7 @@
mDeviceAddress = parcel->readString8();
mCbFlags = (uint32_t)parcel->readInt32();
mAllowPrivilegedPlaybackCapture = parcel->readBool();
+ mVoiceCommunicationCaptureAllowed = parcel->readBool();
size_t size = (size_t)parcel->readInt32();
if (size > MAX_CRITERIA_PER_MIX) {
size = MAX_CRITERIA_PER_MIX;
@@ -110,6 +111,7 @@
parcel->writeString8(mDeviceAddress);
parcel->writeInt32(mCbFlags);
parcel->writeBool(mAllowPrivilegedPlaybackCapture);
+ parcel->writeBool(mVoiceCommunicationCaptureAllowed);
size_t size = mCriteria.size();
if (size > MAX_CRITERIA_PER_MIX) {
size = MAX_CRITERIA_PER_MIX;
@@ -206,11 +208,4 @@
&& (mRouteFlags == MIX_ROUTE_FLAG_RENDER));
}
-bool AudioMix::hasMatchingRuleForUsage(std::function<bool (audio_usage_t)>const& func) const {
- return std::any_of(mCriteria.begin(), mCriteria.end(), [func](auto& criterion) {
- return criterion.mRule == RULE_MATCH_ATTRIBUTE_USAGE
- && func(criterion.mValue.mUsage);
- });
-}
-
} // namespace android
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index 1769062..2f67a18 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -842,13 +842,13 @@
return aps->handleDeviceConfigChange(device, address, name, encodedFormat);
}
-status_t AudioSystem::setPhoneState(audio_mode_t state)
+status_t AudioSystem::setPhoneState(audio_mode_t state, uid_t uid)
{
if (uint32_t(state) >= AUDIO_MODE_CNT) return BAD_VALUE;
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
if (aps == 0) return PERMISSION_DENIED;
- return aps->setPhoneState(state);
+ return aps->setPhoneState(state, uid);
}
status_t AudioSystem::setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config)
@@ -879,6 +879,7 @@
audio_stream_type_t *stream,
pid_t pid,
uid_t uid,
+ const String16& opPackageName,
const audio_config_t *config,
audio_output_flags_t flags,
audio_port_handle_t *selectedDeviceId,
@@ -888,7 +889,7 @@
const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
if (aps == 0) return NO_INIT;
return aps->getOutputForAttr(attr, output, session, stream, pid, uid,
- config,
+ opPackageName, config,
flags, selectedDeviceId, portId, secondaryOutputs);
}
diff --git a/media/libaudioclient/IAudioPolicyService.cpp b/media/libaudioclient/IAudioPolicyService.cpp
index cc78ec1..cccb131 100644
--- a/media/libaudioclient/IAudioPolicyService.cpp
+++ b/media/libaudioclient/IAudioPolicyService.cpp
@@ -170,11 +170,12 @@
return static_cast <status_t> (reply.readInt32());
}
- virtual status_t setPhoneState(audio_mode_t state)
+ virtual status_t setPhoneState(audio_mode_t state, uid_t uid)
{
Parcel data, reply;
data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
data.writeInt32(state);
+ data.writeInt32(uid);
remote()->transact(SET_PHONE_STATE, data, &reply);
return static_cast <status_t> (reply.readInt32());
}
@@ -213,6 +214,7 @@
audio_stream_type_t *stream,
pid_t pid,
uid_t uid,
+ const String16& opPackageName,
const audio_config_t *config,
audio_output_flags_t flags,
audio_port_handle_t *selectedDeviceId,
@@ -251,6 +253,7 @@
}
data.writeInt32(pid);
data.writeInt32(uid);
+ data.writeString16(opPackageName);
data.write(config, sizeof(audio_config_t));
data.writeInt32(static_cast <uint32_t>(flags));
data.writeInt32(*selectedDeviceId);
@@ -1596,7 +1599,8 @@
case SET_PHONE_STATE: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
reply->writeInt32(static_cast <uint32_t>(setPhoneState(
- (audio_mode_t) data.readInt32())));
+ (audio_mode_t) data.readInt32(),
+ (uid_t) data.readInt32())));
return NO_ERROR;
} break;
@@ -1643,6 +1647,11 @@
}
pid_t pid = (pid_t)data.readInt32();
uid_t uid = (uid_t)data.readInt32();
+ String16 opPackageName;
+ status = data.readString16(&opPackageName);
+ if (status != NO_ERROR) {
+ return status;
+ }
audio_config_t config;
memset(&config, 0, sizeof(audio_config_t));
data.read(&config, sizeof(audio_config_t));
@@ -1654,7 +1663,7 @@
std::vector<audio_io_handle_t> secondaryOutputs;
status = getOutputForAttr(&attr,
&output, session, &stream, pid, uid,
- &config,
+ opPackageName, &config,
flags, &selectedDeviceId, &portId, &secondaryOutputs);
reply->writeInt32(status);
status = reply->write(&attr, sizeof(audio_attributes_t));
diff --git a/media/libaudioclient/include/media/AudioPolicy.h b/media/libaudioclient/include/media/AudioPolicy.h
index 20d2c0b..00fe278 100644
--- a/media/libaudioclient/include/media/AudioPolicy.h
+++ b/media/libaudioclient/include/media/AudioPolicy.h
@@ -18,7 +18,6 @@
#ifndef ANDROID_AUDIO_POLICY_H
#define ANDROID_AUDIO_POLICY_H
-#include <functional>
#include <binder/Parcel.h>
#include <media/AudioDeviceTypeAddr.h>
#include <system/audio.h>
@@ -113,13 +112,6 @@
/** returns true if this mix can be used for uid-device affinity routing */
bool isDeviceAffinityCompatible() const;
- /**
- * returns true if the mix has a capture rule for a usage that
- * matches the given predicate
- */
- bool hasMatchingRuleForUsage(
- std::function<bool (audio_usage_t)>const& func) const;
-
mutable Vector<AudioMixMatchCriterion> mCriteria;
uint32_t mMixType;
audio_config_t mFormat;
@@ -129,6 +121,8 @@
uint32_t mCbFlags; // flags indicating which callbacks to use, see kCbFlag*
/** Ignore the AUDIO_FLAG_NO_MEDIA_PROJECTION */
bool mAllowPrivilegedPlaybackCapture = false;
+ /** Indicates if the caller can capture voice communication output */
+ bool mVoiceCommunicationCaptureAllowed = false;
};
diff --git a/media/libaudioclient/include/media/AudioSystem.h b/media/libaudioclient/include/media/AudioSystem.h
index 9d3f8b6..07a2292 100644
--- a/media/libaudioclient/include/media/AudioSystem.h
+++ b/media/libaudioclient/include/media/AudioSystem.h
@@ -230,7 +230,7 @@
const char *device_address,
const char *device_name,
audio_format_t encodedFormat);
- static status_t setPhoneState(audio_mode_t state);
+ static status_t setPhoneState(audio_mode_t state, uid_t uid);
static status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config);
static audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage);
@@ -240,6 +240,7 @@
audio_stream_type_t *stream,
pid_t pid,
uid_t uid,
+ const String16& opPackageName,
const audio_config_t *config,
audio_output_flags_t flags,
audio_port_handle_t *selectedDeviceId,
diff --git a/media/libaudioclient/include/media/IAudioFlinger.h b/media/libaudioclient/include/media/IAudioFlinger.h
index 8bc1d83..8658cfa 100644
--- a/media/libaudioclient/include/media/IAudioFlinger.h
+++ b/media/libaudioclient/include/media/IAudioFlinger.h
@@ -70,6 +70,7 @@
if (clientInfo.readFromParcel(parcel) != NO_ERROR) {
return DEAD_OBJECT;
}
+ opPackageName = parcel->readString16();
if (parcel->readInt32() != 0) {
// TODO: Using unsecurePointer() has some associated security
// pitfalls (see declaration for details).
@@ -97,6 +98,7 @@
(void)parcel->write(&attr, sizeof(audio_attributes_t));
(void)parcel->write(&config, sizeof(audio_config_t));
(void)clientInfo.writeToParcel(parcel);
+ (void)parcel->writeString16(opPackageName);
if (sharedBuffer != 0) {
(void)parcel->writeInt32(1);
(void)parcel->writeStrongBinder(IInterface::asBinder(sharedBuffer));
@@ -119,6 +121,7 @@
audio_attributes_t attr;
audio_config_t config;
AudioClient clientInfo;
+ String16 opPackageName;
sp<IMemory> sharedBuffer;
uint32_t notificationsPerBuffer;
float speed;
diff --git a/media/libaudioclient/include/media/IAudioPolicyService.h b/media/libaudioclient/include/media/IAudioPolicyService.h
index caa1d13..779ca43 100644
--- a/media/libaudioclient/include/media/IAudioPolicyService.h
+++ b/media/libaudioclient/include/media/IAudioPolicyService.h
@@ -53,7 +53,7 @@
const char *device_address,
const char *device_name,
audio_format_t encodedFormat) = 0;
- virtual status_t setPhoneState(audio_mode_t state) = 0;
+ virtual status_t setPhoneState(audio_mode_t state, uid_t uid) = 0;
virtual status_t setForceUse(audio_policy_force_use_t usage,
audio_policy_forced_cfg_t config) = 0;
virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) = 0;
@@ -64,6 +64,7 @@
audio_stream_type_t *stream,
pid_t pid,
uid_t uid,
+ const String16& opPackageName,
const audio_config_t *config,
audio_output_flags_t flags,
audio_port_handle_t *selectedDeviceId,
diff --git a/media/libaudiohal/Android.bp b/media/libaudiohal/Android.bp
index 74b48f3..1709d1e 100644
--- a/media/libaudiohal/Android.bp
+++ b/media/libaudiohal/Android.bp
@@ -4,6 +4,7 @@
srcs: [
"DevicesFactoryHalInterface.cpp",
"EffectsFactoryHalInterface.cpp",
+ "FactoryHalHidl.cpp",
],
cflags: [
@@ -12,11 +13,17 @@
"-Werror",
],
- shared_libs: [
+ required: [
"libaudiohal@2.0",
"libaudiohal@4.0",
"libaudiohal@5.0",
"libaudiohal@6.0",
+ ],
+
+ shared_libs: [
+ "libdl",
+ "libhidlbase",
+ "liblog",
"libutils",
],
diff --git a/media/libaudiohal/DevicesFactoryHalInterface.cpp b/media/libaudiohal/DevicesFactoryHalInterface.cpp
index d5336fa..325a547 100644
--- a/media/libaudiohal/DevicesFactoryHalInterface.cpp
+++ b/media/libaudiohal/DevicesFactoryHalInterface.cpp
@@ -14,16 +14,15 @@
* limitations under the License.
*/
-#include <libaudiohal/FactoryHalHidl.h>
-
#include <media/audiohal/DevicesFactoryHalInterface.h>
+#include <media/audiohal/FactoryHalHidl.h>
namespace android {
// static
sp<DevicesFactoryHalInterface> DevicesFactoryHalInterface::create() {
- return createPreferedImpl<DevicesFactoryHalInterface>();
+ return createPreferredImpl<DevicesFactoryHalInterface>(
+ "android.hardware.audio", "IDevicesFactory");
}
} // namespace android
-
diff --git a/media/libaudiohal/EffectsFactoryHalInterface.cpp b/media/libaudiohal/EffectsFactoryHalInterface.cpp
index d15b14e..bc3b4c1 100644
--- a/media/libaudiohal/EffectsFactoryHalInterface.cpp
+++ b/media/libaudiohal/EffectsFactoryHalInterface.cpp
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#include <libaudiohal/FactoryHalHidl.h>
-
#include <media/audiohal/EffectsFactoryHalInterface.h>
+#include <media/audiohal/FactoryHalHidl.h>
namespace android {
// static
sp<EffectsFactoryHalInterface> EffectsFactoryHalInterface::create() {
- return createPreferedImpl<EffectsFactoryHalInterface>();
+ return createPreferredImpl<EffectsFactoryHalInterface>(
+ "android.hardware.audio.effect", "IEffectsFactory");
}
// static
diff --git a/media/libaudiohal/FactoryHalHidl.cpp b/media/libaudiohal/FactoryHalHidl.cpp
new file mode 100644
index 0000000..5985ef0
--- /dev/null
+++ b/media/libaudiohal/FactoryHalHidl.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2020 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 "FactoryHalHidl"
+
+#include <media/audiohal/FactoryHalHidl.h>
+
+#include <dlfcn.h>
+
+#include <android/hidl/manager/1.0/IServiceManager.h>
+#include <hidl/ServiceManagement.h>
+#include <hidl/Status.h>
+#include <utils/Log.h>
+
+namespace android::detail {
+
+namespace {
+/** Supported HAL versions, in order of preference.
+ */
+const char* sAudioHALVersions[] = {
+ "6.0",
+ "5.0",
+ "4.0",
+ "2.0",
+ nullptr
+};
+
+bool createHalService(const std::string& version, const std::string& interface,
+ void** rawInterface) {
+ const std::string libName = "libaudiohal@" + version + ".so";
+ const std::string factoryFunctionName = "create" + interface;
+ constexpr int dlMode = RTLD_LAZY;
+ void* handle = nullptr;
+ dlerror(); // clear
+ handle = dlopen(libName.c_str(), dlMode);
+ if (handle == nullptr) {
+ const char* error = dlerror();
+ ALOGE("Failed to dlopen %s: %s", libName.c_str(),
+ error != nullptr ? error : "unknown error");
+ return false;
+ }
+ void* (*factoryFunction)();
+ *(void **)(&factoryFunction) = dlsym(handle, factoryFunctionName.c_str());
+ if (!factoryFunction) {
+ const char* error = dlerror();
+ ALOGE("Factory function %s not found in library %s: %s",
+ factoryFunctionName.c_str(), libName.c_str(),
+ error != nullptr ? error : "unknown error");
+ dlclose(handle);
+ return false;
+ }
+ *rawInterface = (*factoryFunction)();
+ ALOGW_IF(!*rawInterface, "Factory function %s from %s returned nullptr",
+ factoryFunctionName.c_str(), libName.c_str());
+ return true;
+}
+
+bool hasHalService(const std::string& package, const std::string& version,
+ const std::string& interface) {
+ using ::android::hidl::manager::V1_0::IServiceManager;
+ sp<IServiceManager> sm = ::android::hardware::defaultServiceManager();
+ if (!sm) {
+ ALOGE("Failed to obtain HIDL ServiceManager");
+ return false;
+ }
+ // Since audio HAL doesn't support multiple clients, avoid instantiating
+ // the interface right away. Instead, query the transport type for it.
+ using ::android::hardware::Return;
+ using Transport = IServiceManager::Transport;
+ const std::string fqName = package + "@" + version + "::" + interface;
+ const std::string instance = "default";
+ Return<Transport> transport = sm->getTransport(fqName, instance);
+ if (!transport.isOk()) {
+ ALOGE("Failed to obtain transport type for %s/%s: %s",
+ fqName.c_str(), instance.c_str(), transport.description().c_str());
+ return false;
+ }
+ return transport != Transport::EMPTY;
+}
+
+} // namespace
+
+void* createPreferredImpl(const std::string& package, const std::string& interface) {
+ for (auto version = detail::sAudioHALVersions; version != nullptr; ++version) {
+ void* rawInterface = nullptr;
+ if (hasHalService(package, *version, interface)
+ && createHalService(*version, interface, &rawInterface)) {
+ return rawInterface;
+ }
+ }
+ return nullptr;
+}
+
+} // namespace android::detail
diff --git a/media/libaudiohal/impl/Android.bp b/media/libaudiohal/impl/Android.bp
index e96a68c..967fba1 100644
--- a/media/libaudiohal/impl/Android.bp
+++ b/media/libaudiohal/impl/Android.bp
@@ -16,12 +16,11 @@
"StreamHalHidl.cpp",
],
- export_include_dirs: ["include"],
-
cflags: [
"-Wall",
"-Wextra",
"-Werror",
+ "-fvisibility=hidden",
],
shared_libs: [
"android.hardware.audio.common-util",
diff --git a/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp b/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
index c30da3c..e6e9688 100644
--- a/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
+++ b/media/libaudiohal/impl/DevicesFactoryHalHidl.cpp
@@ -20,7 +20,7 @@
#define LOG_TAG "DevicesFactoryHalHidl"
//#define LOG_NDEBUG 0
-#include "android/hidl/manager/1.0/IServiceManager.h"
+#include <android/hidl/manager/1.0/IServiceManager.h>
#include PATH(android/hardware/audio/FILE_VERSION/IDevice.h)
#include <media/audiohal/hidl/HalDeathHandler.h>
#include <utils/Log.h>
diff --git a/media/libaudiohal/impl/DevicesFactoryHalHybrid.cpp b/media/libaudiohal/impl/DevicesFactoryHalHybrid.cpp
index a5aef1b..52f150a 100644
--- a/media/libaudiohal/impl/DevicesFactoryHalHybrid.cpp
+++ b/media/libaudiohal/impl/DevicesFactoryHalHybrid.cpp
@@ -20,7 +20,6 @@
#include "DevicesFactoryHalHidl.h"
#include "DevicesFactoryHalHybrid.h"
#include "DevicesFactoryHalLocal.h"
-#include <libaudiohal/FactoryHalHidl.h>
namespace android {
namespace CPP_VERSION {
@@ -47,8 +46,7 @@
} // namespace CPP_VERSION
-template <>
-sp<DevicesFactoryHalInterface> createFactoryHal<AudioHALVersion::CPP_VERSION>() {
+extern "C" __attribute__((visibility("default"))) void* createIDevicesFactory() {
auto service = hardware::audio::CPP_VERSION::IDevicesFactory::getService();
return service ? new CPP_VERSION::DevicesFactoryHalHybrid(service) : nullptr;
}
diff --git a/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp b/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
index 867b72d..9192a31 100644
--- a/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
+++ b/media/libaudiohal/impl/EffectsFactoryHalHidl.cpp
@@ -24,7 +24,6 @@
#include "EffectHalHidl.h"
#include "EffectsFactoryHalHidl.h"
#include "HidlUtils.h"
-#include <libaudiohal/FactoryHalHidl.h>
using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils;
using ::android::hardware::Return;
@@ -162,8 +161,7 @@
} // namespace CPP_VERSION
} // namespace effect
-template<>
-sp<EffectsFactoryHalInterface> createFactoryHal<AudioHALVersion::CPP_VERSION>() {
+extern "C" __attribute__((visibility("default"))) void* createIEffectsFactory() {
auto service = hardware::audio::effect::CPP_VERSION::IEffectsFactory::getService();
return service ? new effect::CPP_VERSION::EffectsFactoryHalHidl(service) : nullptr;
}
diff --git a/media/libaudiohal/impl/include/libaudiohal/FactoryHalHidl.h b/media/libaudiohal/impl/include/libaudiohal/FactoryHalHidl.h
deleted file mode 100644
index 271bafc..0000000
--- a/media/libaudiohal/impl/include/libaudiohal/FactoryHalHidl.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#ifndef ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
-#define ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
-
-/** @file Library entry points to create the HAL factories. */
-
-#include <media/audiohal/DevicesFactoryHalInterface.h>
-#include <media/audiohal/EffectsFactoryHalInterface.h>
-#include <utils/StrongPointer.h>
-
-#include <array>
-#include <utility>
-
-namespace android {
-
-/** Supported HAL versions, in order of preference.
- * Implementation should use specialize the `create*FactoryHal` for their version.
- * Client should use `createPreferedImpl<*FactoryHal>()` to instantiate
- * the preferred available impl.
- */
-enum class AudioHALVersion {
- V6_0,
- V5_0,
- V4_0,
- V2_0,
- end, // used for iterating over supported versions
-};
-
-/** Template function to fully specialized for each version and each Interface. */
-template <AudioHALVersion, class Interface>
-sp<Interface> createFactoryHal();
-
-/** @Return the preferred available implementation or nullptr if none are available. */
-template <class Interface, AudioHALVersion version = AudioHALVersion{}>
-static sp<Interface> createPreferedImpl() {
- if constexpr (version == AudioHALVersion::end) {
- return nullptr; // tried all version, all returned nullptr
- } else {
- if (auto created = createFactoryHal<version, Interface>(); created != nullptr) {
- return created;
- }
-
- using Raw = std::underlying_type_t<AudioHALVersion>; // cast as enum class do not support ++
- return createPreferedImpl<Interface, AudioHALVersion(Raw(version) + 1)>();
- }
-}
-
-
-} // namespace android
-
-#endif // ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
diff --git a/media/libaudiohal/include/media/audiohal/FactoryHalHidl.h b/media/libaudiohal/include/media/audiohal/FactoryHalHidl.h
new file mode 100644
index 0000000..d353ed0
--- /dev/null
+++ b/media/libaudiohal/include/media/audiohal/FactoryHalHidl.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#ifndef ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
+#define ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
+
+#include <string>
+
+#include <utils/StrongPointer.h>
+
+namespace android {
+
+namespace detail {
+
+void* createPreferredImpl(const std::string& package, const std::string& interface);
+
+} // namespace detail
+
+/** @Return the preferred available implementation or nullptr if none are available. */
+template <class Interface>
+static sp<Interface> createPreferredImpl(const std::string& package, const std::string& interface) {
+ return sp<Interface>{static_cast<Interface*>(detail::createPreferredImpl(package, interface))};
+}
+
+} // namespace android
+
+#endif // ANDROID_HARDWARE_FACTORY_HAL_HIDL_H
diff --git a/media/libeffects/lvm/lib/Android.bp b/media/libeffects/lvm/lib/Android.bp
index 6d998d1..1f2a5e1 100644
--- a/media/libeffects/lvm/lib/Android.bp
+++ b/media/libeffects/lvm/lib/Android.bp
@@ -137,8 +137,6 @@
],
cppflags: [
"-fvisibility=hidden",
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-DSUPPORT_MC",
"-Wall",
@@ -208,8 +206,6 @@
cppflags: [
"-fvisibility=hidden",
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-Wall",
"-Werror",
diff --git a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
index 261a21a..948d79c 100644
--- a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
+++ b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
@@ -55,8 +55,6 @@
#ifndef __LVDBE_H__
#define __LVDBE_H__
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -65,7 +63,6 @@
#include "LVM_Types.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -82,7 +79,6 @@
#define LVDBE_EFFECT_12DB 12
#define LVDBE_EFFECT_15DB 15
-
/****************************************************************************************/
/* */
/* Types */
@@ -92,7 +88,6 @@
/* Instance handle */
typedef void *LVDBE_Handle_t;
-
/* Operating modes */
typedef enum
{
@@ -101,7 +96,6 @@
LVDBE_MODE_MAX = LVM_MAXINT_32
} LVDBE_Mode_en;
-
/* High pass filter */
typedef enum
{
@@ -110,7 +104,6 @@
LVDBE_HPF_MAX = LVM_MAXINT_32
} LVDBE_FilterSelect_en;
-
/* Volume control */
typedef enum
{
@@ -119,7 +112,6 @@
LVDBE_VOLUME_MAX = LVM_MAXINT_32
} LVDBE_Volume_en;
-
/* Memory Types */
typedef enum
{
@@ -131,7 +123,6 @@
} LVDBE_MemoryTypes_en;
-
/* Function return status */
typedef enum
{
@@ -143,7 +134,6 @@
LVDBE_STATUS_MAX = LVM_MAXINT_32
} LVDBE_ReturnStatus_en;
-
/****************************************************************************************/
/* */
/* Linked enumerated type and capability definitions */
@@ -182,7 +172,6 @@
LVDBE_CENTRE_MAX = LVM_MAXINT_32
} LVDBE_CentreFreq_en;
-
/*
* Supported sample rates in samples per second
*/
@@ -195,12 +184,10 @@
#define LVDBE_CAP_FS_32000 64
#define LVDBE_CAP_FS_44100 128
#define LVDBE_CAP_FS_48000 256
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
#define LVDBE_CAP_FS_88200 512
#define LVDBE_CAP_FS_96000 1024
#define LVDBE_CAP_FS_176400 2048
#define LVDBE_CAP_FS_192000 4096
-#endif
typedef enum
{
@@ -213,16 +200,13 @@
LVDBE_FS_32000 = 6,
LVDBE_FS_44100 = 7,
LVDBE_FS_48000 = 8,
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
LVDBE_FS_88200 = 9,
LVDBE_FS_96000 = 10,
LVDBE_FS_176400 = 11,
LVDBE_FS_192000 = 12,
-#endif
LVDBE_FS_MAX = LVM_MAXINT_32
} LVDBE_Fs_en;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -238,14 +222,12 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVDBE_MemoryRegion_t;
-
/* Memory table containing the region definitions */
typedef struct
{
LVDBE_MemoryRegion_t Region[LVDBE_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVDBE_MemTab_t;
-
/* Parameter structure */
typedef struct
{
@@ -263,7 +245,6 @@
} LVDBE_Params_t;
-
/* Capability structure */
typedef struct
{
@@ -272,7 +253,6 @@
LVM_UINT16 MaxBlockSize; /* Maximum block size in sample pairs */
} LVDBE_Capabilities_t;
-
/****************************************************************************************/
/* */
/* Function Prototypes */
@@ -314,7 +294,6 @@
LVDBE_MemTab_t *pMemoryTable,
LVDBE_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Init */
@@ -352,7 +331,6 @@
LVDBE_MemTab_t *pMemoryTable,
LVDBE_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_GetParameters */
@@ -376,7 +354,6 @@
LVDBE_ReturnStatus_en LVDBE_GetParameters(LVDBE_Handle_t hInstance,
LVDBE_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_GetCapabilities */
@@ -400,7 +377,6 @@
LVDBE_ReturnStatus_en LVDBE_GetCapabilities(LVDBE_Handle_t hInstance,
LVDBE_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Control */
@@ -441,7 +417,6 @@
LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
LVDBE_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Process */
@@ -462,17 +437,9 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#else
-LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#endif
-
#endif /* __LVDBE_H__ */
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
index 8f058e8..b364dae 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
@@ -18,8 +18,6 @@
#ifndef __LVDBE_COEFFS_H__
#define __LVDBE_COEFFS_H__
-
-#ifndef BUILD_FLOAT
/************************************************************************************/
/* */
/* General */
@@ -28,504 +26,6 @@
#define LVDBE_SCALESHIFT 10 /* As a power of 2 */
-
-/************************************************************************************/
-/* */
-/* High Pass Filter coefficients */
-/* */
-/************************************************************************************/
-
- /* Coefficients for centre frequency 55Hz */
-#define HPF_Fs8000_Fc55_A0 1029556328 /* Floating point value 0.958849 */
-#define HPF_Fs8000_Fc55_A1 (-2059112655) /* Floating point value -1.917698 */
-#define HPF_Fs8000_Fc55_A2 1029556328 /* Floating point value 0.958849 */
-#define HPF_Fs8000_Fc55_B1 (-2081986375) /* Floating point value -1.939001 */
-#define HPF_Fs8000_Fc55_B2 1010183914 /* Floating point value 0.940807 */
-#define HPF_Fs11025_Fc55_A0 1038210831 /* Floating point value 0.966909 */
-#define HPF_Fs11025_Fc55_A1 (-2076421662) /* Floating point value -1.933818 */
-#define HPF_Fs11025_Fc55_A2 1038210831 /* Floating point value 0.966909 */
-#define HPF_Fs11025_Fc55_B1 (-2099950710) /* Floating point value -1.955732 */
-#define HPF_Fs11025_Fc55_B2 1027238450 /* Floating point value 0.956690 */
-#define HPF_Fs12000_Fc55_A0 1040079943 /* Floating point value 0.968650 */
-#define HPF_Fs12000_Fc55_A1 (-2080159885) /* Floating point value -1.937300 */
-#define HPF_Fs12000_Fc55_A2 1040079943 /* Floating point value 0.968650 */
-#define HPF_Fs12000_Fc55_B1 (-2103811702) /* Floating point value -1.959327 */
-#define HPF_Fs12000_Fc55_B2 1030940477 /* Floating point value 0.960138 */
-#define HPF_Fs16000_Fc55_A0 1045381988 /* Floating point value 0.973588 */
-#define HPF_Fs16000_Fc55_A1 (-2090763976) /* Floating point value -1.947176 */
-#define HPF_Fs16000_Fc55_A2 1045381988 /* Floating point value 0.973588 */
-#define HPF_Fs16000_Fc55_B1 (-2114727793) /* Floating point value -1.969494 */
-#define HPF_Fs16000_Fc55_B2 1041478147 /* Floating point value 0.969952 */
-#define HPF_Fs22050_Fc55_A0 1049766523 /* Floating point value 0.977671 */
-#define HPF_Fs22050_Fc55_A1 (-2099533046) /* Floating point value -1.955343 */
-#define HPF_Fs22050_Fc55_A2 1049766523 /* Floating point value 0.977671 */
-#define HPF_Fs22050_Fc55_B1 (-2123714381) /* Floating point value -1.977863 */
-#define HPF_Fs22050_Fc55_B2 1050232780 /* Floating point value 0.978105 */
-#define HPF_Fs24000_Fc55_A0 1050711051 /* Floating point value 0.978551 */
-#define HPF_Fs24000_Fc55_A1 (-2101422103) /* Floating point value -1.957102 */
-#define HPF_Fs24000_Fc55_A2 1050711051 /* Floating point value 0.978551 */
-#define HPF_Fs24000_Fc55_B1 (-2125645498) /* Floating point value -1.979662 */
-#define HPF_Fs24000_Fc55_B2 1052123526 /* Floating point value 0.979866 */
-#define HPF_Fs32000_Fc55_A0 1053385759 /* Floating point value 0.981042 */
-#define HPF_Fs32000_Fc55_A1 (-2106771519) /* Floating point value -1.962084 */
-#define HPF_Fs32000_Fc55_A2 1053385759 /* Floating point value 0.981042 */
-#define HPF_Fs32000_Fc55_B1 (-2131104794) /* Floating point value -1.984746 */
-#define HPF_Fs32000_Fc55_B2 1057486949 /* Floating point value 0.984861 */
-#define HPF_Fs44100_Fc55_A0 1055592498 /* Floating point value 0.983097 */
-#define HPF_Fs44100_Fc55_A1 (-2111184995) /* Floating point value -1.966194 */
-#define HPF_Fs44100_Fc55_A2 1055592498 /* Floating point value 0.983097 */
-#define HPF_Fs44100_Fc55_B1 (-2135598658) /* Floating point value -1.988931 */
-#define HPF_Fs44100_Fc55_B2 1061922249 /* Floating point value 0.988992 */
-#define HPF_Fs48000_Fc55_A0 1056067276 /* Floating point value 0.983539 */
-#define HPF_Fs48000_Fc55_A1 (-2112134551) /* Floating point value -1.967079 */
-#define HPF_Fs48000_Fc55_A2 1056067276 /* Floating point value 0.983539 */
-#define HPF_Fs48000_Fc55_B1 (-2136564296) /* Floating point value -1.989831 */
-#define HPF_Fs48000_Fc55_B2 1062877714 /* Floating point value 0.989882 */
-
- /* Coefficients for centre frequency 66Hz */
-#define HPF_Fs8000_Fc66_A0 1023293271 /* Floating point value 0.953016 */
-#define HPF_Fs8000_Fc66_A1 (-2046586542) /* Floating point value -1.906032 */
-#define HPF_Fs8000_Fc66_A2 1023293271 /* Floating point value 0.953016 */
-#define HPF_Fs8000_Fc66_B1 (-2068896860) /* Floating point value -1.926810 */
-#define HPF_Fs8000_Fc66_B2 997931110 /* Floating point value 0.929396 */
-#define HPF_Fs11025_Fc66_A0 1033624228 /* Floating point value 0.962638 */
-#define HPF_Fs11025_Fc66_A1 (-2067248455) /* Floating point value -1.925275 */
-#define HPF_Fs11025_Fc66_A2 1033624228 /* Floating point value 0.962638 */
-#define HPF_Fs11025_Fc66_B1 (-2090448000) /* Floating point value -1.946881 */
-#define HPF_Fs11025_Fc66_B2 1018182305 /* Floating point value 0.948256 */
-#define HPF_Fs12000_Fc66_A0 1035857662 /* Floating point value 0.964718 */
-#define HPF_Fs12000_Fc66_A1 (-2071715325) /* Floating point value -1.929435 */
-#define HPF_Fs12000_Fc66_A2 1035857662 /* Floating point value 0.964718 */
-#define HPF_Fs12000_Fc66_B1 (-2095080333) /* Floating point value -1.951196 */
-#define HPF_Fs12000_Fc66_B2 1022587158 /* Floating point value 0.952359 */
-#define HPF_Fs16000_Fc66_A0 1042197528 /* Floating point value 0.970622 */
-#define HPF_Fs16000_Fc66_A1 (-2084395056) /* Floating point value -1.941244 */
-#define HPF_Fs16000_Fc66_A2 1042197528 /* Floating point value 0.970622 */
-#define HPF_Fs16000_Fc66_B1 (-2108177912) /* Floating point value -1.963394 */
-#define HPF_Fs16000_Fc66_B2 1035142690 /* Floating point value 0.964052 */
-#define HPF_Fs22050_Fc66_A0 1047445145 /* Floating point value 0.975509 */
-#define HPF_Fs22050_Fc66_A1 (-2094890289) /* Floating point value -1.951019 */
-#define HPF_Fs22050_Fc66_A2 1047445145 /* Floating point value 0.975509 */
-#define HPF_Fs22050_Fc66_B1 (-2118961025) /* Floating point value -1.973436 */
-#define HPF_Fs22050_Fc66_B2 1045593102 /* Floating point value 0.973784 */
-#define HPF_Fs24000_Fc66_A0 1048576175 /* Floating point value 0.976563 */
-#define HPF_Fs24000_Fc66_A1 (-2097152349) /* Floating point value -1.953125 */
-#define HPF_Fs24000_Fc66_A2 1048576175 /* Floating point value 0.976563 */
-#define HPF_Fs24000_Fc66_B1 (-2121278255) /* Floating point value -1.975594 */
-#define HPF_Fs24000_Fc66_B2 1047852379 /* Floating point value 0.975889 */
-#define HPF_Fs32000_Fc66_A0 1051780119 /* Floating point value 0.979547 */
-#define HPF_Fs32000_Fc66_A1 (-2103560237) /* Floating point value -1.959093 */
-#define HPF_Fs32000_Fc66_A2 1051780119 /* Floating point value 0.979547 */
-#define HPF_Fs32000_Fc66_B1 (-2127829187) /* Floating point value -1.981695 */
-#define HPF_Fs32000_Fc66_B2 1054265623 /* Floating point value 0.981861 */
-#define HPF_Fs44100_Fc66_A0 1054424722 /* Floating point value 0.982010 */
-#define HPF_Fs44100_Fc66_A1 (-2108849444) /* Floating point value -1.964019 */
-#define HPF_Fs44100_Fc66_A2 1054424722 /* Floating point value 0.982010 */
-#define HPF_Fs44100_Fc66_B1 (-2133221723) /* Floating point value -1.986718 */
-#define HPF_Fs44100_Fc66_B2 1059573993 /* Floating point value 0.986805 */
-#define HPF_Fs48000_Fc66_A0 1054993851 /* Floating point value 0.982540 */
-#define HPF_Fs48000_Fc66_A1 (-2109987702) /* Floating point value -1.965079 */
-#define HPF_Fs48000_Fc66_A2 1054993851 /* Floating point value 0.982540 */
-#define HPF_Fs48000_Fc66_B1 (-2134380475) /* Floating point value -1.987797 */
-#define HPF_Fs48000_Fc66_B2 1060718118 /* Floating point value 0.987871 */
-
- /* Coefficients for centre frequency 78Hz */
-#define HPF_Fs8000_Fc78_A0 1016504203 /* Floating point value 0.946693 */
-#define HPF_Fs8000_Fc78_A1 (-2033008405) /* Floating point value -1.893387 */
-#define HPF_Fs8000_Fc78_A2 1016504203 /* Floating point value 0.946693 */
-#define HPF_Fs8000_Fc78_B1 (-2054623390) /* Floating point value -1.913517 */
-#define HPF_Fs8000_Fc78_B2 984733853 /* Floating point value 0.917105 */
-#define HPF_Fs11025_Fc78_A0 1028643741 /* Floating point value 0.957999 */
-#define HPF_Fs11025_Fc78_A1 (-2057287482) /* Floating point value -1.915998 */
-#define HPF_Fs11025_Fc78_A2 1028643741 /* Floating point value 0.957999 */
-#define HPF_Fs11025_Fc78_B1 (-2080083769) /* Floating point value -1.937229 */
-#define HPF_Fs11025_Fc78_B2 1008393904 /* Floating point value 0.939140 */
-#define HPF_Fs12000_Fc78_A0 1031271067 /* Floating point value 0.960446 */
-#define HPF_Fs12000_Fc78_A1 (-2062542133) /* Floating point value -1.920892 */
-#define HPF_Fs12000_Fc78_A2 1031271067 /* Floating point value 0.960446 */
-#define HPF_Fs12000_Fc78_B1 (-2085557048) /* Floating point value -1.942326 */
-#define HPF_Fs12000_Fc78_B2 1013551620 /* Floating point value 0.943944 */
-#define HPF_Fs16000_Fc78_A0 1038734628 /* Floating point value 0.967397 */
-#define HPF_Fs16000_Fc78_A1 (-2077469256) /* Floating point value -1.934794 */
-#define HPF_Fs16000_Fc78_A2 1038734628 /* Floating point value 0.967397 */
-#define HPF_Fs16000_Fc78_B1 (-2101033380) /* Floating point value -1.956740 */
-#define HPF_Fs16000_Fc78_B2 1028275228 /* Floating point value 0.957656 */
-#define HPF_Fs22050_Fc78_A0 1044918584 /* Floating point value 0.973156 */
-#define HPF_Fs22050_Fc78_A1 (-2089837169) /* Floating point value -1.946313 */
-#define HPF_Fs22050_Fc78_A2 1044918584 /* Floating point value 0.973156 */
-#define HPF_Fs22050_Fc78_B1 (-2113775854) /* Floating point value -1.968607 */
-#define HPF_Fs22050_Fc78_B2 1040555007 /* Floating point value 0.969092 */
-#define HPF_Fs24000_Fc78_A0 1046252164 /* Floating point value 0.974398 */
-#define HPF_Fs24000_Fc78_A1 (-2092504328) /* Floating point value -1.948797 */
-#define HPF_Fs24000_Fc78_A2 1046252164 /* Floating point value 0.974398 */
-#define HPF_Fs24000_Fc78_B1 (-2116514229) /* Floating point value -1.971157 */
-#define HPF_Fs24000_Fc78_B2 1043212719 /* Floating point value 0.971568 */
-#define HPF_Fs32000_Fc78_A0 1050031301 /* Floating point value 0.977918 */
-#define HPF_Fs32000_Fc78_A1 (-2100062603) /* Floating point value -1.955836 */
-#define HPF_Fs32000_Fc78_A2 1050031301 /* Floating point value 0.977918 */
-#define HPF_Fs32000_Fc78_B1 (-2124255900) /* Floating point value -1.978367 */
-#define HPF_Fs32000_Fc78_B2 1050762639 /* Floating point value 0.978599 */
-#define HPF_Fs44100_Fc78_A0 1053152258 /* Floating point value 0.980824 */
-#define HPF_Fs44100_Fc78_A1 (-2106304516) /* Floating point value -1.961649 */
-#define HPF_Fs44100_Fc78_A2 1053152258 /* Floating point value 0.980824 */
-#define HPF_Fs44100_Fc78_B1 (-2130628742) /* Floating point value -1.984303 */
-#define HPF_Fs44100_Fc78_B2 1057018180 /* Floating point value 0.984425 */
-#define HPF_Fs48000_Fc78_A0 1053824087 /* Floating point value 0.981450 */
-#define HPF_Fs48000_Fc78_A1 (-2107648173) /* Floating point value -1.962900 */
-#define HPF_Fs48000_Fc78_A2 1053824087 /* Floating point value 0.981450 */
-#define HPF_Fs48000_Fc78_B1 (-2131998154) /* Floating point value -1.985578 */
-#define HPF_Fs48000_Fc78_B2 1058367200 /* Floating point value 0.985681 */
-
- /* Coefficients for centre frequency 90Hz */
-#define HPF_Fs8000_Fc90_A0 1009760053 /* Floating point value 0.940412 */
-#define HPF_Fs8000_Fc90_A1 (-2019520105) /* Floating point value -1.880825 */
-#define HPF_Fs8000_Fc90_A2 1009760053 /* Floating point value 0.940412 */
-#define HPF_Fs8000_Fc90_B1 (-2040357139) /* Floating point value -1.900231 */
-#define HPF_Fs8000_Fc90_B2 971711129 /* Floating point value 0.904977 */
-#define HPF_Fs11025_Fc90_A0 1023687217 /* Floating point value 0.953383 */
-#define HPF_Fs11025_Fc90_A1 (-2047374434) /* Floating point value -1.906766 */
-#define HPF_Fs11025_Fc90_A2 1023687217 /* Floating point value 0.953383 */
-#define HPF_Fs11025_Fc90_B1 (-2069722397) /* Floating point value -1.927579 */
-#define HPF_Fs11025_Fc90_B2 998699604 /* Floating point value 0.930111 */
-#define HPF_Fs12000_Fc90_A0 1026704754 /* Floating point value 0.956193 */
-#define HPF_Fs12000_Fc90_A1 (-2053409508) /* Floating point value -1.912387 */
-#define HPF_Fs12000_Fc90_A2 1026704754 /* Floating point value 0.956193 */
-#define HPF_Fs12000_Fc90_B1 (-2076035996) /* Floating point value -1.933459 */
-#define HPF_Fs12000_Fc90_B2 1004595918 /* Floating point value 0.935603 */
-#define HPF_Fs16000_Fc90_A0 1035283225 /* Floating point value 0.964183 */
-#define HPF_Fs16000_Fc90_A1 (-2070566451) /* Floating point value -1.928365 */
-#define HPF_Fs16000_Fc90_A2 1035283225 /* Floating point value 0.964183 */
-#define HPF_Fs16000_Fc90_B1 (-2093889811) /* Floating point value -1.950087 */
-#define HPF_Fs16000_Fc90_B2 1021453326 /* Floating point value 0.951303 */
-#define HPF_Fs22050_Fc90_A0 1042398116 /* Floating point value 0.970809 */
-#define HPF_Fs22050_Fc90_A1 (-2084796232) /* Floating point value -1.941618 */
-#define HPF_Fs22050_Fc90_A2 1042398116 /* Floating point value 0.970809 */
-#define HPF_Fs22050_Fc90_B1 (-2108591057) /* Floating point value -1.963778 */
-#define HPF_Fs22050_Fc90_B2 1035541188 /* Floating point value 0.964423 */
-#define HPF_Fs24000_Fc90_A0 1043933302 /* Floating point value 0.972239 */
-#define HPF_Fs24000_Fc90_A1 (-2087866604) /* Floating point value -1.944477 */
-#define HPF_Fs24000_Fc90_A2 1043933302 /* Floating point value 0.972239 */
-#define HPF_Fs24000_Fc90_B1 (-2111750495) /* Floating point value -1.966721 */
-#define HPF_Fs24000_Fc90_B2 1038593601 /* Floating point value 0.967266 */
-#define HPF_Fs32000_Fc90_A0 1048285391 /* Floating point value 0.976292 */
-#define HPF_Fs32000_Fc90_A1 (-2096570783) /* Floating point value -1.952584 */
-#define HPF_Fs32000_Fc90_A2 1048285391 /* Floating point value 0.976292 */
-#define HPF_Fs32000_Fc90_B1 (-2120682737) /* Floating point value -1.975040 */
-#define HPF_Fs32000_Fc90_B2 1047271295 /* Floating point value 0.975347 */
-#define HPF_Fs44100_Fc90_A0 1051881330 /* Floating point value 0.979641 */
-#define HPF_Fs44100_Fc90_A1 (-2103762660) /* Floating point value -1.959282 */
-#define HPF_Fs44100_Fc90_A2 1051881330 /* Floating point value 0.979641 */
-#define HPF_Fs44100_Fc90_B1 (-2128035809) /* Floating point value -1.981888 */
-#define HPF_Fs44100_Fc90_B2 1054468533 /* Floating point value 0.982050 */
-#define HPF_Fs48000_Fc90_A0 1052655619 /* Floating point value 0.980362 */
-#define HPF_Fs48000_Fc90_A1 (-2105311238) /* Floating point value -1.960724 */
-#define HPF_Fs48000_Fc90_A2 1052655619 /* Floating point value 0.980362 */
-#define HPF_Fs48000_Fc90_B1 (-2129615871) /* Floating point value -1.983359 */
-#define HPF_Fs48000_Fc90_B2 1056021492 /* Floating point value 0.983497 */
-
-
-/************************************************************************************/
-/* */
-/* Band Pass Filter coefficients */
-/* */
-/************************************************************************************/
-
- /* Coefficients for centre frequency 55Hz */
-#define BPF_Fs8000_Fc55_A0 9875247 /* Floating point value 0.009197 */
-#define BPF_Fs8000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc55_A2 (-9875247) /* Floating point value -0.009197 */
-#define BPF_Fs8000_Fc55_B1 (-2125519830) /* Floating point value -1.979545 */
-#define BPF_Fs8000_Fc55_B2 1053762629 /* Floating point value 0.981393 */
-#define BPF_Fs11025_Fc55_A0 7183952 /* Floating point value 0.006691 */
-#define BPF_Fs11025_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc55_A2 (-7183952) /* Floating point value -0.006691 */
-#define BPF_Fs11025_Fc55_B1 (-2131901658) /* Floating point value -1.985488 */
-#define BPF_Fs11025_Fc55_B2 1059207548 /* Floating point value 0.986464 */
-#define BPF_Fs12000_Fc55_A0 6603871 /* Floating point value 0.006150 */
-#define BPF_Fs12000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc55_A2 (-6603871) /* Floating point value -0.006150 */
-#define BPF_Fs12000_Fc55_B1 (-2133238092) /* Floating point value -1.986733 */
-#define BPF_Fs12000_Fc55_B2 1060381143 /* Floating point value 0.987557 */
-#define BPF_Fs16000_Fc55_A0 4960591 /* Floating point value 0.004620 */
-#define BPF_Fs16000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc55_A2 (-4960591) /* Floating point value -0.004620 */
-#define BPF_Fs16000_Fc55_B1 (-2136949052) /* Floating point value -1.990189 */
-#define BPF_Fs16000_Fc55_B2 1063705760 /* Floating point value 0.990653 */
-#define BPF_Fs22050_Fc55_A0 3604131 /* Floating point value 0.003357 */
-#define BPF_Fs22050_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc55_A2 (-3604131) /* Floating point value -0.003357 */
-#define BPF_Fs22050_Fc55_B1 (-2139929085) /* Floating point value -1.992964 */
-#define BPF_Fs22050_Fc55_B2 1066450095 /* Floating point value 0.993209 */
-#define BPF_Fs24000_Fc55_A0 3312207 /* Floating point value 0.003085 */
-#define BPF_Fs24000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc55_A2 (-3312207) /* Floating point value -0.003085 */
-#define BPF_Fs24000_Fc55_B1 (-2140560606) /* Floating point value -1.993552 */
-#define BPF_Fs24000_Fc55_B2 1067040703 /* Floating point value 0.993759 */
-#define BPF_Fs32000_Fc55_A0 2486091 /* Floating point value 0.002315 */
-#define BPF_Fs32000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc55_A2 (-2486091) /* Floating point value -0.002315 */
-#define BPF_Fs32000_Fc55_B1 (-2142328962) /* Floating point value -1.995199 */
-#define BPF_Fs32000_Fc55_B2 1068712067 /* Floating point value 0.995316 */
-#define BPF_Fs44100_Fc55_A0 1805125 /* Floating point value 0.001681 */
-#define BPF_Fs44100_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc55_A2 (-1805125) /* Floating point value -0.001681 */
-#define BPF_Fs44100_Fc55_B1 (-2143765772) /* Floating point value -1.996537 */
-#define BPF_Fs44100_Fc55_B2 1070089770 /* Floating point value 0.996599 */
-#define BPF_Fs48000_Fc55_A0 1658687 /* Floating point value 0.001545 */
-#define BPF_Fs48000_Fc55_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc55_A2 (-1658687) /* Floating point value -0.001545 */
-#define BPF_Fs48000_Fc55_B1 (-2144072292) /* Floating point value -1.996823 */
-#define BPF_Fs48000_Fc55_B2 1070386036 /* Floating point value 0.996875 */
-
- /* Coefficients for centre frequency 66Hz */
-#define BPF_Fs8000_Fc66_A0 13580189 /* Floating point value 0.012648 */
-#define BPF_Fs8000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc66_A2 (-13580189) /* Floating point value -0.012648 */
-#define BPF_Fs8000_Fc66_B1 (-2117161175) /* Floating point value -1.971760 */
-#define BPF_Fs8000_Fc66_B2 1046266945 /* Floating point value 0.974412 */
-#define BPF_Fs11025_Fc66_A0 9888559 /* Floating point value 0.009209 */
-#define BPF_Fs11025_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc66_A2 (-9888559) /* Floating point value -0.009209 */
-#define BPF_Fs11025_Fc66_B1 (-2125972738) /* Floating point value -1.979966 */
-#define BPF_Fs11025_Fc66_B2 1053735698 /* Floating point value 0.981368 */
-#define BPF_Fs12000_Fc66_A0 9091954 /* Floating point value 0.008468 */
-#define BPF_Fs12000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc66_A2 (-9091954) /* Floating point value -0.008468 */
-#define BPF_Fs12000_Fc66_B1 (-2127818004) /* Floating point value -1.981685 */
-#define BPF_Fs12000_Fc66_B2 1055347356 /* Floating point value 0.982869 */
-#define BPF_Fs16000_Fc66_A0 6833525 /* Floating point value 0.006364 */
-#define BPF_Fs16000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc66_A2 (-6833525) /* Floating point value -0.006364 */
-#define BPF_Fs16000_Fc66_B1 (-2132941739) /* Floating point value -1.986457 */
-#define BPF_Fs16000_Fc66_B2 1059916517 /* Floating point value 0.987124 */
-#define BPF_Fs22050_Fc66_A0 4967309 /* Floating point value 0.004626 */
-#define BPF_Fs22050_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc66_A2 (-4967309) /* Floating point value -0.004626 */
-#define BPF_Fs22050_Fc66_B1 (-2137056003) /* Floating point value -1.990288 */
-#define BPF_Fs22050_Fc66_B2 1063692170 /* Floating point value 0.990641 */
-#define BPF_Fs24000_Fc66_A0 4565445 /* Floating point value 0.004252 */
-#define BPF_Fs24000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc66_A2 (-4565445) /* Floating point value -0.004252 */
-#define BPF_Fs24000_Fc66_B1 (-2137927842) /* Floating point value -1.991100 */
-#define BPF_Fs24000_Fc66_B2 1064505202 /* Floating point value 0.991398 */
-#define BPF_Fs32000_Fc66_A0 3427761 /* Floating point value 0.003192 */
-#define BPF_Fs32000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc66_A2 (-3427761) /* Floating point value -0.003192 */
-#define BPF_Fs32000_Fc66_B1 (-2140369007) /* Floating point value -1.993374 */
-#define BPF_Fs32000_Fc66_B2 1066806920 /* Floating point value 0.993541 */
-#define BPF_Fs44100_Fc66_A0 2489466 /* Floating point value 0.002318 */
-#define BPF_Fs44100_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc66_A2 (-2489466) /* Floating point value -0.002318 */
-#define BPF_Fs44100_Fc66_B1 (-2142352342) /* Floating point value -1.995221 */
-#define BPF_Fs44100_Fc66_B2 1068705240 /* Floating point value 0.995309 */
-#define BPF_Fs48000_Fc66_A0 2287632 /* Floating point value 0.002131 */
-#define BPF_Fs48000_Fc66_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc66_A2 (-2287632) /* Floating point value -0.002131 */
-#define BPF_Fs48000_Fc66_B1 (-2142775436) /* Floating point value -1.995615 */
-#define BPF_Fs48000_Fc66_B2 1069113581 /* Floating point value 0.995690 */
-
- /* Coefficients for centre frequency 78Hz */
-#define BPF_Fs8000_Fc78_A0 19941180 /* Floating point value 0.018572 */
-#define BPF_Fs8000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc78_A2 (-19941180) /* Floating point value -0.018572 */
-#define BPF_Fs8000_Fc78_B1 (-2103186749) /* Floating point value -1.958745 */
-#define BPF_Fs8000_Fc78_B2 1033397648 /* Floating point value 0.962427 */
-#define BPF_Fs11025_Fc78_A0 14543934 /* Floating point value 0.013545 */
-#define BPF_Fs11025_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc78_A2 (-14543934) /* Floating point value -0.013545 */
-#define BPF_Fs11025_Fc78_B1 (-2115966638) /* Floating point value -1.970647 */
-#define BPF_Fs11025_Fc78_B2 1044317135 /* Floating point value 0.972596 */
-#define BPF_Fs12000_Fc78_A0 13376999 /* Floating point value 0.012458 */
-#define BPF_Fs12000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc78_A2 (-13376999) /* Floating point value -0.012458 */
-#define BPF_Fs12000_Fc78_B1 (-2118651708) /* Floating point value -1.973148 */
-#define BPF_Fs12000_Fc78_B2 1046678029 /* Floating point value 0.974795 */
-#define BPF_Fs16000_Fc78_A0 10064222 /* Floating point value 0.009373 */
-#define BPF_Fs16000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc78_A2 (-10064222) /* Floating point value -0.009373 */
-#define BPF_Fs16000_Fc78_B1 (-2126124342) /* Floating point value -1.980108 */
-#define BPF_Fs16000_Fc78_B2 1053380304 /* Floating point value 0.981037 */
-#define BPF_Fs22050_Fc78_A0 7321780 /* Floating point value 0.006819 */
-#define BPF_Fs22050_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc78_A2 (-7321780) /* Floating point value -0.006819 */
-#define BPF_Fs22050_Fc78_B1 (-2132143771) /* Floating point value -1.985714 */
-#define BPF_Fs22050_Fc78_B2 1058928700 /* Floating point value 0.986204 */
-#define BPF_Fs24000_Fc78_A0 6730640 /* Floating point value 0.006268 */
-#define BPF_Fs24000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc78_A2 (-6730640) /* Floating point value -0.006268 */
-#define BPF_Fs24000_Fc78_B1 (-2133421607) /* Floating point value -1.986904 */
-#define BPF_Fs24000_Fc78_B2 1060124669 /* Floating point value 0.987318 */
-#define BPF_Fs32000_Fc78_A0 5055965 /* Floating point value 0.004709 */
-#define BPF_Fs32000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc78_A2 (-5055965) /* Floating point value -0.004709 */
-#define BPF_Fs32000_Fc78_B1 (-2137003977) /* Floating point value -1.990240 */
-#define BPF_Fs32000_Fc78_B2 1063512802 /* Floating point value 0.990473 */
-#define BPF_Fs44100_Fc78_A0 3673516 /* Floating point value 0.003421 */
-#define BPF_Fs44100_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc78_A2 (-3673516) /* Floating point value -0.003421 */
-#define BPF_Fs44100_Fc78_B1 (-2139919394) /* Floating point value -1.992955 */
-#define BPF_Fs44100_Fc78_B2 1066309718 /* Floating point value 0.993078 */
-#define BPF_Fs48000_Fc78_A0 3375990 /* Floating point value 0.003144 */
-#define BPF_Fs48000_Fc78_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc78_A2 (-3375990) /* Floating point value -0.003144 */
-#define BPF_Fs48000_Fc78_B1 (-2140541906) /* Floating point value -1.993535 */
-#define BPF_Fs48000_Fc78_B2 1066911660 /* Floating point value 0.993639 */
-
- /* Coefficients for centre frequency 90Hz */
-#define BPF_Fs8000_Fc90_A0 24438548 /* Floating point value 0.022760 */
-#define BPF_Fs8000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc90_A2 (-24438548) /* Floating point value -0.022760 */
-#define BPF_Fs8000_Fc90_B1 (-2092801347) /* Floating point value -1.949073 */
-#define BPF_Fs8000_Fc90_B2 1024298757 /* Floating point value 0.953953 */
-#define BPF_Fs11025_Fc90_A0 17844385 /* Floating point value 0.016619 */
-#define BPF_Fs11025_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc90_A2 (-17844385) /* Floating point value -0.016619 */
-#define BPF_Fs11025_Fc90_B1 (-2108604921) /* Floating point value -1.963791 */
-#define BPF_Fs11025_Fc90_B2 1037639797 /* Floating point value 0.966377 */
-#define BPF_Fs12000_Fc90_A0 16416707 /* Floating point value 0.015289 */
-#define BPF_Fs12000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc90_A2 (-16416707) /* Floating point value -0.015289 */
-#define BPF_Fs12000_Fc90_B1 (-2111922936) /* Floating point value -1.966882 */
-#define BPF_Fs12000_Fc90_B2 1040528216 /* Floating point value 0.969067 */
-#define BPF_Fs16000_Fc90_A0 12359883 /* Floating point value 0.011511 */
-#define BPF_Fs16000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc90_A2 (-12359883) /* Floating point value -0.011511 */
-#define BPF_Fs16000_Fc90_B1 (-2121152162) /* Floating point value -1.975477 */
-#define BPF_Fs16000_Fc90_B2 1048735817 /* Floating point value 0.976711 */
-#define BPF_Fs22050_Fc90_A0 8997173 /* Floating point value 0.008379 */
-#define BPF_Fs22050_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc90_A2 (-8997173) /* Floating point value -0.008379 */
-#define BPF_Fs22050_Fc90_B1 (-2128580762) /* Floating point value -1.982395 */
-#define BPF_Fs22050_Fc90_B2 1055539113 /* Floating point value 0.983047 */
-#define BPF_Fs24000_Fc90_A0 8271818 /* Floating point value 0.007704 */
-#define BPF_Fs24000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc90_A2 (-8271818) /* Floating point value -0.007704 */
-#define BPF_Fs24000_Fc90_B1 (-2130157013) /* Floating point value -1.983863 */
-#define BPF_Fs24000_Fc90_B2 1057006621 /* Floating point value 0.984414 */
-#define BPF_Fs32000_Fc90_A0 6215918 /* Floating point value 0.005789 */
-#define BPF_Fs32000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc90_A2 (-6215918) /* Floating point value -0.005789 */
-#define BPF_Fs32000_Fc90_B1 (-2134574521) /* Floating point value -1.987977 */
-#define BPF_Fs32000_Fc90_B2 1061166033 /* Floating point value 0.988288 */
-#define BPF_Fs44100_Fc90_A0 4517651 /* Floating point value 0.004207 */
-#define BPF_Fs44100_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc90_A2 (-4517651) /* Floating point value -0.004207 */
-#define BPF_Fs44100_Fc90_B1 (-2138167926) /* Floating point value -1.991324 */
-#define BPF_Fs44100_Fc90_B2 1064601898 /* Floating point value 0.991488 */
-#define BPF_Fs48000_Fc90_A0 4152024 /* Floating point value 0.003867 */
-#define BPF_Fs48000_Fc90_A1 0 /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc90_A2 (-4152024) /* Floating point value -0.003867 */
-#define BPF_Fs48000_Fc90_B1 (-2138935002) /* Floating point value -1.992038 */
-#define BPF_Fs48000_Fc90_B2 1065341620 /* Floating point value 0.992177 */
-
-
-/************************************************************************************/
-/* */
-/* Automatic Gain Control time constants and gain settings */
-/* */
-/************************************************************************************/
-
-/* AGC Time constants */
-#define AGC_ATTACK_Fs8000 27571 /* Floating point value 0.841395 */
-#define AGC_ATTACK_Fs11025 28909 /* Floating point value 0.882223 */
-#define AGC_ATTACK_Fs12000 29205 /* Floating point value 0.891251 */
-#define AGC_ATTACK_Fs16000 30057 /* Floating point value 0.917276 */
-#define AGC_ATTACK_Fs22050 30778 /* Floating point value 0.939267 */
-#define AGC_ATTACK_Fs24000 30935 /* Floating point value 0.944061 */
-#define AGC_ATTACK_Fs32000 31383 /* Floating point value 0.957745 */
-#define AGC_ATTACK_Fs44100 31757 /* Floating point value 0.969158 */
-#define AGC_ATTACK_Fs48000 31838 /* Floating point value 0.971628 */
-#define DECAY_SHIFT 10 /* As a power of 2 */
-#define AGC_DECAY_Fs8000 44 /* Floating point value 0.000042 */
-#define AGC_DECAY_Fs11025 32 /* Floating point value 0.000030 */
-#define AGC_DECAY_Fs12000 29 /* Floating point value 0.000028 */
-#define AGC_DECAY_Fs16000 22 /* Floating point value 0.000021 */
-#define AGC_DECAY_Fs22050 16 /* Floating point value 0.000015 */
-#define AGC_DECAY_Fs24000 15 /* Floating point value 0.000014 */
-#define AGC_DECAY_Fs32000 11 /* Floating point value 0.000010 */
-#define AGC_DECAY_Fs44100 8 /* Floating point value 0.000008 */
-#define AGC_DECAY_Fs48000 7 /* Floating point value 0.000007 */
-
-/* AGC Gain settings */
-#define AGC_GAIN_SCALE 31 /* As a power of 2 */
-#define AGC_GAIN_SHIFT 4 /* As a power of 2 */
-#define AGC_TARGETLEVEL 33170337 /* Floating point value -0.100000dB */
-#define AGC_HPFGAIN_0dB 110739704 /* Floating point value 0.412538 */
-#define AGC_GAIN_0dB 0 /* Floating point value 0.000000 */
-#define AGC_HPFGAIN_1dB 157006071 /* Floating point value 0.584893 */
-#define AGC_GAIN_1dB 32754079 /* Floating point value 0.122018 */
-#define AGC_HPFGAIN_2dB 208917788 /* Floating point value 0.778279 */
-#define AGC_GAIN_2dB 69504761 /* Floating point value 0.258925 */
-#define AGC_HPFGAIN_3dB 267163693 /* Floating point value 0.995262 */
-#define AGC_GAIN_3dB 110739704 /* Floating point value 0.412538 */
-#define AGC_HPFGAIN_4dB 332516674 /* Floating point value 1.238721 */
-#define AGC_GAIN_4dB 157006071 /* Floating point value 0.584893 */
-#define AGC_HPFGAIN_5dB 405843924 /* Floating point value 1.511886 */
-#define AGC_GAIN_5dB 208917788 /* Floating point value 0.778279 */
-#define AGC_HPFGAIN_6dB 488118451 /* Floating point value 1.818383 */
-#define AGC_GAIN_6dB 267163693 /* Floating point value 0.995262 */
-#define AGC_HPFGAIN_7dB 580431990 /* Floating point value 2.162278 */
-#define AGC_GAIN_7dB 332516674 /* Floating point value 1.238721 */
-#define AGC_HPFGAIN_8dB 684009483 /* Floating point value 2.548134 */
-#define AGC_GAIN_8dB 405843924 /* Floating point value 1.511886 */
-#define AGC_HPFGAIN_9dB 800225343 /* Floating point value 2.981072 */
-#define AGC_GAIN_9dB 488118451 /* Floating point value 1.818383 */
-#define AGC_HPFGAIN_10dB 930621681 /* Floating point value 3.466836 */
-#define AGC_GAIN_10dB 580431990 /* Floating point value 2.162278 */
-#define AGC_HPFGAIN_11dB 1076928780 /* Floating point value 4.011872 */
-#define AGC_GAIN_11dB 684009483 /* Floating point value 2.548134 */
-#define AGC_HPFGAIN_12dB 1241088045 /* Floating point value 4.623413 */
-#define AGC_GAIN_12dB 800225343 /* Floating point value 2.981072 */
-#define AGC_HPFGAIN_13dB 1425277769 /* Floating point value 5.309573 */
-#define AGC_GAIN_13dB 930621681 /* Floating point value 3.466836 */
-#define AGC_HPFGAIN_14dB 1631942039 /* Floating point value 6.079458 */
-#define AGC_GAIN_14dB 1076928780 /* Floating point value 4.011872 */
-#define AGC_HPFGAIN_15dB 1863823163 /* Floating point value 6.943282 */
-#define AGC_GAIN_15dB 1241088045 /* Floating point value 4.623413 */
-
-
-/************************************************************************************/
-/* */
-/* Volume control */
-/* */
-/************************************************************************************/
-
-/* Volume control gain */
-#define VOLUME_MAX 0 /* In dBs */
-#define VOLUME_SHIFT 0 /* In dBs */
-
-/* Volume control time constants */
-#define VOL_TC_SHIFT 21 /* As a power of 2 */
-#define VOL_TC_Fs8000 25889 /* Floating point value 0.024690 */
-#define VOL_TC_Fs11025 18850 /* Floating point value 0.017977 */
-#define VOL_TC_Fs12000 17331 /* Floating point value 0.016529 */
-#define VOL_TC_Fs16000 13026 /* Floating point value 0.012422 */
-#define VOL_TC_Fs22050 9468 /* Floating point value 0.009029 */
-#define VOL_TC_Fs24000 8702 /* Floating point value 0.008299 */
-#define VOL_TC_Fs32000 6533 /* Floating point value 0.006231 */
-#define VOL_TC_Fs44100 4745 /* Floating point value 0.004525 */
-#define VOL_TC_Fs48000 4360 /* Floating point value 0.004158 */
-#define MIX_TC_Fs8000 29365 /* Floating point value 0.896151 */
-#define MIX_TC_Fs11025 30230 /* Floating point value 0.922548 */
-#define MIX_TC_Fs12000 30422 /* Floating point value 0.928415 */
-#define MIX_TC_Fs16000 30978 /* Floating point value 0.945387 */
-#define MIX_TC_Fs22050 31451 /* Floating point value 0.959804 */
-#define MIX_TC_Fs24000 31554 /* Floating point value 0.962956 */
-#define MIX_TC_Fs32000 31850 /* Floating point value 0.971973 */
-#define MIX_TC_Fs44100 32097 /* Floating point value 0.979515 */
-#define MIX_TC_Fs48000 32150 /* Floating point value 0.981150 */
-
-#else /*BUILD_FLOAT*/
-
-/************************************************************************************/
-/* */
-/* General */
-/* */
-/************************************************************************************/
-
-#define LVDBE_SCALESHIFT 10 /* As a power of 2 */
-
-
/************************************************************************************/
/* */
/* High Pass Filter coefficients */
@@ -579,7 +79,6 @@
#define HPF_Fs48000_Fc55_B1 (-1.989831f)
#define HPF_Fs48000_Fc55_B2 0.989882f
-#ifdef HIGHER_FS
#define HPF_Fs88200_Fc55_A0 0.985818f
#define HPF_Fs88200_Fc55_A1 (-1.971636f)
#define HPF_Fs88200_Fc55_A2 0.985818f
@@ -603,8 +102,6 @@
#define HPF_Fs192000_Fc55_A2 0.987294f
#define HPF_Fs192000_Fc55_B1 (-1.997458f)
#define HPF_Fs192000_Fc55_B2 0.997461f
-#endif
-
/* Coefficients for centre frequency 66Hz */
#define HPF_Fs8000_Fc66_A0 0.953016f
@@ -653,7 +150,6 @@
#define HPF_Fs48000_Fc66_B1 (-1.987797f)
#define HPF_Fs48000_Fc66_B2 0.987871f
-#ifdef HIGHER_FS
#define HPF_Fs88200_Fc66_A0 0.985273f
#define HPF_Fs88200_Fc66_A1 (-1.970546f)
#define HPF_Fs88200_Fc66_A2 0.985273f
@@ -677,7 +173,6 @@
#define HPF_Fs192000_Fc66_A2 0.987043f
#define HPF_Fs192000_Fc66_B1 (-1.996949f)
#define HPF_Fs192000_Fc66_B2 0.996954f
-#endif
/* Coefficients for centre frequency 78Hz */
#define HPF_Fs8000_Fc78_A0 0.946693f
@@ -726,7 +221,6 @@
#define HPF_Fs48000_Fc78_B1 (-1.985578f)
#define HPF_Fs48000_Fc78_B2 0.985681f
-#ifdef HIGHER_FS
#define HPF_Fs88200_Fc78_A0 0.984678f
#define HPF_Fs88200_Fc78_A1 (-1.969356f)
#define HPF_Fs88200_Fc78_A2 0.984678f
@@ -750,7 +244,6 @@
#define HPF_Fs192000_Fc78_A2 0.986769f
#define HPF_Fs192000_Fc78_B1 (-1.996394f)
#define HPF_Fs192000_Fc78_B2 0.996401f
-#endif
/* Coefficients for centre frequency 90Hz */
#define HPF_Fs8000_Fc90_A0 0.940412f
@@ -799,7 +292,6 @@
#define HPF_Fs48000_Fc90_B1 (-1.983359f)
#define HPF_Fs48000_Fc90_B2 0.983497f
-#ifdef HIGHER_FS
#define HPF_Fs88200_Fc90_A0 0.984084f
#define HPF_Fs88200_Fc90_A1 (-1.968168f)
#define HPF_Fs88200_Fc90_A2 0.984084f
@@ -823,7 +315,6 @@
#define HPF_Fs192000_Fc90_A2 0.986496f
#define HPF_Fs192000_Fc90_B1 (-1.995840f)
#define HPF_Fs192000_Fc90_B2 0.995848f
-#endif
/************************************************************************************/
/* */
@@ -878,7 +369,6 @@
#define BPF_Fs48000_Fc55_B1 (-1.996823f)
#define BPF_Fs48000_Fc55_B2 0.996875f
-#ifdef HIGHER_FS
#define BPF_Fs88200_Fc55_A0 0.000831f
#define BPF_Fs88200_Fc55_A1 0.000000f
#define BPF_Fs88200_Fc55_A2 (-0.000831f)
@@ -902,7 +392,6 @@
#define BPF_Fs192000_Fc55_A2 (-0.000381f)
#define BPF_Fs192000_Fc55_B1 (-1.999234f)
#define BPF_Fs192000_Fc55_B2 0.999238f
-#endif
/* Coefficients for centre frequency 66Hz */
#define BPF_Fs8000_Fc66_A0 0.012648f
@@ -951,7 +440,6 @@
#define BPF_Fs48000_Fc66_B1 (-1.995615f)
#define BPF_Fs48000_Fc66_B2 0.995690f
-#ifdef HIGHER_FS
#define BPF_Fs88200_Fc66_A0 0.001146f
#define BPF_Fs88200_Fc66_A1 0.000000f
#define BPF_Fs88200_Fc66_A2 (-0.001146f)
@@ -975,7 +463,6 @@
#define BPF_Fs192000_Fc66_A2 (-0.000528f)
#define BPF_Fs192000_Fc66_B1 (-1.998939f)
#define BPF_Fs192000_Fc66_B2 0.998945f
-#endif
/* Coefficients for centre frequency 78Hz */
#define BPF_Fs8000_Fc78_A0 0.018572f
@@ -1024,7 +511,6 @@
#define BPF_Fs48000_Fc78_B1 (-1.993535f)
#define BPF_Fs48000_Fc78_B2 0.993639f
-#ifdef HIGHER_FS
#define BPF_Fs88200_Fc78_A0 0.001693f
#define BPF_Fs88200_Fc78_A1 0.000000f
#define BPF_Fs88200_Fc78_A2 (-0.001693f)
@@ -1048,7 +534,6 @@
#define BPF_Fs192000_Fc78_A2 (-0.000778f)
#define BPF_Fs192000_Fc78_B1 (-1.998437f)
#define BPF_Fs192000_Fc78_B2 0.998444f
-#endif
/* Coefficients for centre frequency 90Hz */
#define BPF_Fs8000_Fc90_A0 0.022760f
@@ -1097,7 +582,6 @@
#define BPF_Fs48000_Fc90_B1 (-1.992038f)
#define BPF_Fs48000_Fc90_B2 0.992177f
-#ifdef HIGHER_FS
#define BPF_Fs88200_Fc90_A0 0.002083f
#define BPF_Fs88200_Fc90_A1 0.000000f
#define BPF_Fs88200_Fc90_A2 (-0.002083f)
@@ -1121,7 +605,6 @@
#define BPF_Fs192000_Fc90_A2 (-0.000958f)
#define BPF_Fs192000_Fc90_B1 (-1.998075f)
#define BPF_Fs192000_Fc90_B2 0.998085f
-#endif
/************************************************************************************/
/* */
@@ -1140,12 +623,10 @@
#define AGC_ATTACK_Fs44100 0.969158f
#define AGC_ATTACK_Fs48000 0.971628f
-#ifdef HIGHER_FS
#define AGC_ATTACK_Fs88200 0.984458f
#define AGC_ATTACK_Fs96000 0.985712f
#define AGC_ATTACK_Fs176400 0.992199f
#define AGC_ATTACK_Fs192000 0.992830f
-#endif
#define DECAY_SHIFT 10
@@ -1159,12 +640,10 @@
#define AGC_DECAY_Fs44100 0.000008f
#define AGC_DECAY_Fs48000 0.000007f
-#ifdef HIGHER_FS
#define AGC_DECAY_Fs88200 0.0000038f
#define AGC_DECAY_FS96000 0.0000035f
#define AGC_DECAY_Fs176400 0.00000188f
#define AGC_DECAY_FS192000 0.00000175f
-#endif
/* AGC Gain settings */
#define AGC_GAIN_SCALE 31 /* As a power of 2 */
@@ -1224,12 +703,10 @@
#define VOL_TC_Fs32000 0.006231f
#define VOL_TC_Fs44100 0.004525f
#define VOL_TC_Fs48000 0.004158f
-#ifdef HIGHER_FS
#define VOL_TC_Fs88200 0.002263f
#define VOL_TC_Fs96000 0.002079f
#define VOL_TC_Fs176400 0.001131f
#define VOL_TC_Fs192000 0.001039f
-#endif
#define MIX_TC_Fs8000 29365 /* Floating point value 0.896151 */
#define MIX_TC_Fs11025 30230 /* Floating point value 0.922548 */
#define MIX_TC_Fs12000 30422 /* Floating point value 0.928415 */
@@ -1239,14 +716,11 @@
#define MIX_TC_Fs32000 31850 /* Floating point value 0.971973 */
#define MIX_TC_Fs44100 32097 /* Floating point value 0.979515 */
#define MIX_TC_Fs48000 32150 /* Floating point value 0.981150 */
-#ifdef HIGHER_FS
/* Floating point value 0.989704 */
#define MIX_TC_Fs88200 32430
#define MIX_TC_Fs96000 32456 /* Floating point value 0.990530 */
/* Floating point value 0.994838 */
#define MIX_TC_Fs176400 32598
#define MIX_TC_Fs192000 32611 /* Floating point value 0.992524 */
-#endif
-#endif /*BUILD_FLOAT*/
#endif
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
index 513c67a..53feae8 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
@@ -58,7 +58,6 @@
return(LVDBE_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVDBE_GetCapabilities */
@@ -89,7 +88,6 @@
return(LVDBE_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVDBE_SetFilters */
@@ -107,72 +105,33 @@
LVDBE_Params_t *pParams)
{
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
/*
* Calculate the table offsets
*/
LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + \
(LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_192000)));
-#else
- /*
- * Calculate the table offsets
- */
- LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + \
- (LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_48000)));
-#endif
/*
* Setup the high pass filter
*/
-#ifndef BUILD_FLOAT
- LoadConst_16(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
- sizeof(pInstance->pData->HPFTaps)/sizeof(LVM_INT16)); /* Number of words */
-#else
LoadConst_Float(0, /* Clear the history, value 0 */
- (LVM_FLOAT *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+ (LVM_FLOAT *)&pInstance->pData->HPFTaps, /* Destination */
sizeof(pInstance->pData->HPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
-#endif
-#ifndef BUILD_FLOAT
- BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
- &pInstance->pData->HPFTaps,
- (BQ_C32_Coefs_t *)&LVDBE_HPF_Table[Offset]);
-#else
BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
&pInstance->pData->HPFTaps,
(BQ_FLOAT_Coefs_t *)&LVDBE_HPF_Table[Offset]);
-#endif
-
/*
* Setup the band pass filter
*/
-#ifndef BUILD_FLOAT
- LoadConst_16(0, /* Clear the history, value 0 */
- (void *)&pInstance->pData->BPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
- sizeof(pInstance->pData->BPFTaps)/sizeof(LVM_INT16)); /* Number of words */
-#else
LoadConst_Float(0, /* Clear the history, value 0 */
- (LVM_FLOAT *)&pInstance->pData->BPFTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+ (LVM_FLOAT *)&pInstance->pData->BPFTaps, /* Destination */
sizeof(pInstance->pData->BPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
-#endif
-#ifndef BUILD_FLOAT
- BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
- &pInstance->pData->BPFTaps,
- (BP_C32_Coefs_t *)&LVDBE_BPF_Table[Offset]);
-#else
BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
&pInstance->pData->BPFTaps,
(BP_FLOAT_Coefs_t *)&LVDBE_BPF_Table[Offset]);
-#endif
}
-
-
/************************************************************************************/
/* */
/* FUNCTION: LVDBE_SetAGC */
@@ -196,7 +155,6 @@
pInstance->pData->AGCInstance.AGC_Attack = LVDBE_AGC_ATTACK_Table[(LVM_UINT16)pParams->SampleRate]; /* Attack multiplier */
pInstance->pData->AGCInstance.AGC_Decay = LVDBE_AGC_DECAY_Table[(LVM_UINT16)pParams->SampleRate]; /* Decay multipler */
-
/*
* Get the boost gain
*/
@@ -208,14 +166,10 @@
{
pInstance->pData->AGCInstance.AGC_MaxGain = LVDBE_AGC_GAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter off */
}
-#ifndef BUILD_FLOAT
- pInstance->pData->AGCInstance.AGC_GainShift = AGC_GAIN_SHIFT;
-#endif
pInstance->pData->AGCInstance.AGC_Target = AGC_TARGETLEVEL;
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVDBE_SetVolume */
@@ -247,9 +201,7 @@
LVM_UINT16 dBOffset; /* Table offset */
LVM_INT16 Volume = 0; /* Required volume in dBs */
-#ifdef BUILD_FLOAT
LVM_FLOAT dBShifts_fac;
-#endif
/*
* Apply the volume if enabled
*/
@@ -268,68 +220,41 @@
}
}
-
/*
* Calculate the required gain and shifts
*/
dBOffset = (LVM_UINT16)(6 + Volume % 6); /* Get the dBs 0-5 */
dBShifts = (LVM_UINT16)(Volume / -6); /* Get the 6dB shifts */
-#ifdef BUILD_FLOAT
dBShifts_fac = (LVM_FLOAT)(1 << dBShifts);
-#endif
/*
* When DBE is enabled use AGC volume
*/
-#ifndef BUILD_FLOAT
- pInstance->pData->AGCInstance.Target = ((LVM_INT32)LVDBE_VolumeTable[dBOffset] << 16);
- pInstance->pData->AGCInstance.Target = pInstance->pData->AGCInstance.Target >> dBShifts;
-#else
pInstance->pData->AGCInstance.Target = (LVDBE_VolumeTable[dBOffset]);
pInstance->pData->AGCInstance.Target = pInstance->pData->AGCInstance.Target / dBShifts_fac;
-#endif
pInstance->pData->AGCInstance.VolumeTC = LVDBE_VolumeTCTable[(LVM_UINT16)pParams->SampleRate]; /* Volume update time constant */
-#ifndef BUILD_FLOAT
- pInstance->pData->AGCInstance.VolumeShift = VOLUME_SHIFT+1;
-#endif
/*
* When DBE is disabled use the bypass volume control
*/
if(dBShifts > 0)
{
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],(((LVM_INT32)LVDBE_VolumeTable[dBOffset]) >> dBShifts));
-#else
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_VolumeTable[dBOffset] / dBShifts_fac);
-#endif
}
else
{
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],(LVM_INT32)LVDBE_VolumeTable[dBOffset]);
-#else
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_VolumeTable[dBOffset]);
-#endif
}
pInstance->pData->BypassVolume.MixerStream[0].CallbackSet = 1;
-#ifndef BUILD_FLOAT
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_MIXER_TC,
(LVM_Fs_en)pInstance->Params.SampleRate,
2);
-#else
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->pData->BypassVolume.MixerStream[0],
- LVDBE_MIXER_TC,
- (LVM_Fs_en)pInstance->Params.SampleRate,
- 2);
-#endif
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Control */
@@ -372,12 +297,7 @@
{
LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
-#ifndef BUILD_FLOAT
- LVMixer3_2St_st *pBypassMixer_Instance = &pInstance->pData->BypassMixer;
-#else
LVMixer3_2St_FLOAT_st *pBypassMixer_Instance = &pInstance->pData->BypassMixer;
-#endif
-
/*
* Update the filters
@@ -389,7 +309,6 @@
pParams); /* New parameters */
}
-
/*
* Update the AGC is the effect level has changed
*/
@@ -399,24 +318,14 @@
{
LVDBE_SetAGC(pInstance, /* Instance pointer */
pParams); /* New parameters */
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
- LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
-
- LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
- LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
-#else
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate, 2);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate, 2);
-#endif
-
}
-
/*
* Update the Volume if the volume demand has changed
*/
@@ -431,23 +340,13 @@
if (pInstance->Params.OperatingMode==LVDBE_ON && pParams->OperatingMode==LVDBE_OFF)
{
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0],0);
- LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1],0x00007FFF);
-#else
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0], 0);
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1], 1.0f);
-#endif
}
if (pInstance->Params.OperatingMode==LVDBE_OFF && pParams->OperatingMode==LVDBE_ON)
{
-#ifndef BUILD_FLOAT
- LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0],0x00007FFF);
- LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1],0);
-#else
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0], 1.0f);
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1], 0);
-#endif
}
/*
@@ -455,6 +354,5 @@
*/
pInstance->Params = *pParams;
-
return(LVDBE_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp
index a5500ba..ad77696 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp
@@ -63,7 +63,6 @@
LVM_UINT32 ScratchSize;
LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *)hInstance;
-
/*
* Fill in the memory table
*/
@@ -80,11 +79,7 @@
/*
* Data memory
*/
-#ifdef BUILD_FLOAT
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_FLOAT_t);
-#else
- pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_t);
-#endif
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Alignment = LVDBE_PERSISTENT_DATA_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Type = LVDBE_PERSISTENT_DATA;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL;
@@ -92,11 +87,7 @@
/*
* Coef memory
*/
-#ifdef BUILD_FLOAT
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_FLOAT_t);
-#else
- pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_t);
-#endif
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Alignment = LVDBE_PERSISTENT_COEF_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Type = LVDBE_PERSISTENT_COEF;
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL;
@@ -104,12 +95,8 @@
/*
* Scratch memory
*/
-#ifdef BUILD_FLOAT
ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_FLOAT) * \
pCapabilities->MaxBlockSize);
-#else /*BUILD_FLOAT*/
- ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize);
-#endif
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Size = ScratchSize;
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Alignment = LVDBE_SCRATCH_ALIGN;
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Type = LVDBE_SCRATCH;
@@ -124,7 +111,6 @@
return(LVDBE_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVDBE_Init */
@@ -164,18 +150,11 @@
{
LVDBE_Instance_t *pInstance;
-#ifdef BUILD_FLOAT
LVMixer3_1St_FLOAT_st *pMixer_Instance;
LVMixer3_2St_FLOAT_st *pBypassMixer_Instance;
LVM_FLOAT MixGain;
-#else
- LVMixer3_1St_st *pMixer_Instance;
- LVMixer3_2St_st *pBypassMixer_Instance;
- LVM_INT32 MixGain;
-#endif
LVM_INT16 i;
-
/*
* Set the instance handle if not already initialised
*/
@@ -185,7 +164,6 @@
}
pInstance =(LVDBE_Instance_t *)*phInstance;
-
/*
* Check the memory table for NULL pointers and incorrectly aligned data
*/
@@ -203,19 +181,16 @@
}
}
-
/*
* Save the memory table in the instance structure
*/
pInstance->Capabilities = *pCapabilities;
-
/*
* Save the memory table in the instance structure
*/
pInstance->MemoryTable = *pMemoryTable;
-
/*
* Set the default instance parameters
*/
@@ -228,7 +203,6 @@
pInstance->Params.VolumeControl = LVDBE_VOLUME_OFF;
pInstance->Params.VolumedB = 0;
-
/*
* Set pointer to data and coef memory
*/
@@ -237,14 +211,12 @@
pInstance->pCoef =
(LVDBE_Coef_FLOAT_t *)pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress;
-
/*
* Initialise the filters
*/
LVDBE_SetFilters(pInstance, /* Set the filter taps and coefficients */
&pInstance->Params);
-
/*
* Initialise the AGC
*/
@@ -256,11 +228,7 @@
// initialize the mixer with some fixes values since otherwise LVDBE_SetVolume ends up
// reading uninitialized data
pMixer_Instance = &pInstance->pData->BypassVolume;
-#ifndef BUILD_FLOAT
- LVC_Mixer_Init(&pMixer_Instance->MixerStream[0],0x00007FFF,0x00007FFF);
-#else
LVC_Mixer_Init(&pMixer_Instance->MixerStream[0], 1.0, 1.0);
-#endif
/*
* Initialise the volume
@@ -270,13 +238,8 @@
pInstance->pData->AGCInstance.Volume = pInstance->pData->AGCInstance.Target;
/* Initialise as the target */
-#ifndef BUILD_FLOAT
- MixGain = LVC_Mixer_GetTarget(&pMixer_Instance->MixerStream[0]);
- LVC_Mixer_Init(&pMixer_Instance->MixerStream[0],MixGain,MixGain);
-#else
MixGain = LVC_Mixer_GetTarget(&pMixer_Instance->MixerStream[0]);
LVC_Mixer_Init(&pMixer_Instance->MixerStream[0], MixGain, MixGain);
-#endif
/* Configure the mixer process path */
pMixer_Instance->MixerStream[0].CallbackParam = 0;
@@ -309,15 +272,9 @@
pBypassMixer_Instance->MixerStream[1].pCallbackHandle = LVM_NULL;
pBypassMixer_Instance->MixerStream[1].pCallBack = LVM_NULL;
pBypassMixer_Instance->MixerStream[1].CallbackSet=0;
-#ifndef BUILD_FLOAT
- LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[1],0x00007FFF,0x00007FFF);
- LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
- LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate,2);
-#else
LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[1], 1.0, 1.0);
LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate, 2);
-#endif
return(LVDBE_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
index 458e9e8..f3faaed 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
@@ -27,8 +27,6 @@
#ifndef __LVDBE_PRIVATE_H__
#define __LVDBE_PRIVATE_H__
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -40,7 +38,6 @@
#include "LVC_Mixer.h"
#include "AGC.h"
-
/****************************************************************************************/
/* */
/* Defines */
@@ -71,7 +68,6 @@
#define LVDBE_MIXER_TC 5 /* Mixer time */
#define LVDBE_BYPASS_MIXER_TC 100 /* Bypass mixer time */
-
/****************************************************************************************/
/* */
/* Structures */
@@ -79,29 +75,6 @@
/****************************************************************************************/
/* Data structure */
-#ifndef BUILD_FLOAT
-typedef struct
-{
- /* AGC parameters */
- AGC_MIX_VOL_2St1Mon_D32_t AGCInstance; /* AGC instance parameters */
-
- /* Process variables */
- Biquad_2I_Order2_Taps_t HPFTaps; /* High pass filter taps */
- Biquad_1I_Order2_Taps_t BPFTaps; /* Band pass filter taps */
- LVMixer3_1St_st BypassVolume; /* Bypass volume scaler */
- LVMixer3_2St_st BypassMixer; /* Bypass Mixer for Click Removal */
-
-} LVDBE_Data_t;
-
-/* Coefs structure */
-typedef struct
-{
- /* Process variables */
- Biquad_Instance_t HPFInstance; /* High pass filter instance */
- Biquad_Instance_t BPFInstance; /* Band pass filter instance */
-
-} LVDBE_Coef_t;
-#else
/* Data structure */
typedef struct
{
@@ -123,7 +96,6 @@
Biquad_FLOAT_Instance_t HPFInstance; /* High pass filter instance */
Biquad_FLOAT_Instance_t BPFInstance; /* Band pass filter instance */
} LVDBE_Coef_FLOAT_t;
-#endif
/* Instance structure */
typedef struct
{
@@ -133,16 +105,10 @@
LVDBE_Capabilities_t Capabilities; /* Instance capabilities */
/* Data and coefficient pointers */
-#ifndef BUILD_FLOAT
- LVDBE_Data_t *pData; /* Instance data */
- LVDBE_Coef_t *pCoef; /* Instance coefficients */
-#else
LVDBE_Data_FLOAT_t *pData; /* Instance data */
LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */
-#endif
} LVDBE_Instance_t;
-
/****************************************************************************************/
/* */
/* Function prototypes */
@@ -152,14 +118,10 @@
void LVDBE_SetAGC(LVDBE_Instance_t *pInstance,
LVDBE_Params_t *pParams);
-
void LVDBE_SetVolume(LVDBE_Instance_t *pInstance,
LVDBE_Params_t *pParams);
-
void LVDBE_SetFilters(LVDBE_Instance_t *pInstance,
LVDBE_Params_t *pParams);
-
-
#endif /* __LVDBE_PRIVATE_H__ */
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp
index c4d3403..b4a71c7 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp
@@ -73,119 +73,6 @@
/* overall end to end gain is odB. */
/* */
/********************************************************************************************/
-#ifndef BUILD_FLOAT
-LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
- const LVM_INT16 *pInData, LVM_INT16 *pOutData, LVM_UINT16 NumSamples) {
-
- LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *) hInstance;
- LVM_INT32 *pScratch =
- (LVM_INT32 *) pInstance->MemoryTable.Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress;
- LVM_INT32 *pMono;
- LVM_INT16 *pInput = (LVM_INT16 *) pInData;
-
- /* Scratch for Volume Control starts at offset of 2*NumSamples short values from pScratch */
- LVM_INT16 *pScratchVol = (LVM_INT16 *) (&pScratch[NumSamples]);
-
- /* Scratch for Mono path starts at offset of 2*NumSamples 32-bit values from pScratch */
- pMono = &pScratch[2 * NumSamples];
-
- /*
- * Check the number of samples is not too large
- */
- if (NumSamples > pInstance->Capabilities.MaxBlockSize) {
- return (LVDBE_TOOMANYSAMPLES);
- }
-
- /*
- * Check if the algorithm is enabled
- */
- /* DBE path is processed when DBE is ON or during On/Off transitions */
- if ((pInstance->Params.OperatingMode == LVDBE_ON)
- || (LVC_Mixer_GetCurrent(
- &pInstance->pData->BypassMixer.MixerStream[0])
- != LVC_Mixer_GetTarget(
- &pInstance->pData->BypassMixer.MixerStream[0]))) {
-
- /*
- * Convert 16-bit samples to 32-bit and scale
- * (For a 16-bit implementation apply headroom loss here)
- */
- Int16LShiftToInt32_16x32(pInput, /* Source 16-bit data */
- pScratch, /* Dest. 32-bit data */
- (LVM_INT16) (2 * NumSamples), /* Left and right */
- LVDBE_SCALESHIFT); /* Shift scale */
-
- /*
- * Apply the high pass filter if selected
- */
- if (pInstance->Params.HPFSelect == LVDBE_HPF_ON) {
- BQ_2I_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance,/* Filter instance */
- (LVM_INT32 *) pScratch, /* Source */
- (LVM_INT32 *) pScratch, /* Destination */
- (LVM_INT16) NumSamples); /* Number of samples */
- }
-
- /*
- * Create the mono stream
- */
- From2iToMono_32(pScratch, /* Stereo source */
- pMono, /* Mono destination */
- (LVM_INT16) NumSamples); /* Number of samples */
-
- /*
- * Apply the band pass filter
- */
- BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
- (LVM_INT32 *) pMono, /* Source */
- (LVM_INT32 *) pMono, /* Destination */
- (LVM_INT16) NumSamples); /* Number of samples */
-
- /*
- * Apply the AGC and mix
- */
- AGC_MIX_VOL_2St1Mon_D32_WRA(&pInstance->pData->AGCInstance, /* Instance pointer */
- pScratch, /* Stereo source */
- pMono, /* Mono band pass source */
- pScratch, /* Stereo destination */
- NumSamples); /* Number of samples */
-
- /*
- * Convert 32-bit samples to 16-bit and saturate
- * (Not required for 16-bit implemenations)
- */
- Int32RShiftToInt16_Sat_32x16(pScratch, /* Source 32-bit data */
- (LVM_INT16 *) pScratch, /* Dest. 16-bit data */
- (LVM_INT16) (2 * NumSamples), /* Left and right */
- LVDBE_SCALESHIFT); /* Shift scale */
-
- }
-
- /* Bypass Volume path is processed when DBE is OFF or during On/Off transitions */
- if ((pInstance->Params.OperatingMode == LVDBE_OFF)
- || (LVC_Mixer_GetCurrent(
- &pInstance->pData->BypassMixer.MixerStream[1])
- != LVC_Mixer_GetTarget(
- &pInstance->pData->BypassMixer.MixerStream[1]))) {
-
- /*
- * The algorithm is disabled but volume management is required to compensate for
- * headroom and volume (if enabled)
- */
- LVC_MixSoft_1St_D16C31_SAT(&pInstance->pData->BypassVolume, pInData,
- pScratchVol, (LVM_INT16) (2 * NumSamples)); /* Left and right */
-
- }
-
- /*
- * Mix DBE processed path and bypass volume path
- */
- LVC_MixSoft_2St_D16C31_SAT(&pInstance->pData->BypassMixer,
- (LVM_INT16 *) pScratch, pScratchVol, pOutData,
- (LVM_INT16) (2 * NumSamples));
-
- return (LVDBE_SUCCESS);
-}
-#else /*BUILD_FLOAT*/
LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -362,4 +249,3 @@
#endif
return LVDBE_SUCCESS;
}
-#endif
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
index 058dcf6..728575c 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -27,7 +26,6 @@
#include "LVDBE_Tables.h"
#include "BIQUAD.h"
-
/************************************************************************************/
/* */
/* Coefficients constant table */
@@ -37,11 +35,7 @@
/*
* High Pass Filter Coefficient table
*/
-#ifndef BUILD_FLOAT
-const BQ_C32_Coefs_t LVDBE_HPF_Table[] = {
-#else /*BUILD_FLOAT*/
const BQ_FLOAT_Coefs_t LVDBE_HPF_Table[] = {
-#endif /*BUILD_FLOAT*/
/* Coefficients for 55Hz centre frequency */
{HPF_Fs8000_Fc55_A2, /* 8kS/s coefficients */
HPF_Fs8000_Fc55_A1,
@@ -88,7 +82,6 @@
HPF_Fs48000_Fc55_A0,
-HPF_Fs48000_Fc55_B2,
-HPF_Fs48000_Fc55_B1},
-#ifdef HIGHER_FS
{HPF_Fs88200_Fc55_A2, /* 88kS/s coefficients */
HPF_Fs88200_Fc55_A1,
HPF_Fs88200_Fc55_A0,
@@ -109,7 +102,6 @@
HPF_Fs192000_Fc55_A0,
-HPF_Fs192000_Fc55_B2,
-HPF_Fs192000_Fc55_B1},
-#endif
/* Coefficients for 66Hz centre frequency */
{HPF_Fs8000_Fc66_A2, /* 8kS/s coefficients */
@@ -157,7 +149,6 @@
HPF_Fs48000_Fc66_A0,
-HPF_Fs48000_Fc66_B2,
-HPF_Fs48000_Fc66_B1},
-#ifdef HIGHER_FS
{HPF_Fs88200_Fc66_A2, /* 88kS/s coefficients */
HPF_Fs88200_Fc66_A1,
HPF_Fs88200_Fc66_A0,
@@ -178,8 +169,6 @@
HPF_Fs192000_Fc66_A0,
-HPF_Fs192000_Fc66_B2,
-HPF_Fs192000_Fc66_B1},
-#endif
-
/* Coefficients for 78Hz centre frequency */
{HPF_Fs8000_Fc78_A2, /* 8kS/s coefficients */
@@ -227,7 +216,6 @@
HPF_Fs48000_Fc78_A0,
-HPF_Fs48000_Fc78_B2,
-HPF_Fs48000_Fc78_B1},
-#ifdef HIGHER_FS
{HPF_Fs88200_Fc78_A2, /* 88kS/s coefficients */
HPF_Fs88200_Fc78_A1,
HPF_Fs88200_Fc78_A0,
@@ -248,8 +236,6 @@
HPF_Fs192000_Fc78_A0,
-HPF_Fs192000_Fc78_B2,
-HPF_Fs192000_Fc78_B1},
-#endif
-
/* Coefficients for 90Hz centre frequency */
{HPF_Fs8000_Fc90_A2, /* 8kS/s coefficients */
@@ -298,7 +284,6 @@
-HPF_Fs48000_Fc90_B2,
-HPF_Fs48000_Fc90_B1}
-#ifdef HIGHER_FS
,
{HPF_Fs88200_Fc90_A2, /* 88kS/s coefficients */
HPF_Fs88200_Fc90_A1,
@@ -320,18 +305,13 @@
HPF_Fs192000_Fc90_A0,
-HPF_Fs192000_Fc90_B2,
-HPF_Fs192000_Fc90_B1}
-#endif
};
/*
* Band Pass Filter coefficient table
*/
-#ifndef BUILD_FLOAT
-const BP_C32_Coefs_t LVDBE_BPF_Table[] = {
-#else /*BUILD_FLOAT*/
const BP_FLOAT_Coefs_t LVDBE_BPF_Table[] = {
-#endif /*BUILD_FLOAT*/
/* Coefficients for 55Hz centre frequency */
{BPF_Fs8000_Fc55_A0, /* 8kS/s coefficients */
-BPF_Fs8000_Fc55_B2,
@@ -360,7 +340,6 @@
{BPF_Fs48000_Fc55_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc55_B2,
-BPF_Fs48000_Fc55_B1},
-#ifdef HIGHER_FS
{BPF_Fs88200_Fc55_A0, /* 88kS/s coefficients */
-BPF_Fs88200_Fc55_B2,
-BPF_Fs88200_Fc55_B1},
@@ -373,7 +352,6 @@
{BPF_Fs192000_Fc55_A0, /* 192kS/s coefficients */
-BPF_Fs192000_Fc55_B2,
-BPF_Fs192000_Fc55_B1},
-#endif
/* Coefficients for 66Hz centre frequency */
{BPF_Fs8000_Fc66_A0, /* 8kS/s coefficients */
@@ -403,7 +381,6 @@
{BPF_Fs48000_Fc66_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc66_B2,
-BPF_Fs48000_Fc66_B1},
-#ifdef HIGHER_FS
{BPF_Fs88200_Fc66_A0, /* 88kS/s coefficients */
-BPF_Fs88200_Fc66_B2,
-BPF_Fs88200_Fc66_B1},
@@ -416,7 +393,6 @@
{BPF_Fs192000_Fc66_A0, /* 192kS/s coefficients */
-BPF_Fs192000_Fc66_B2,
-BPF_Fs192000_Fc66_B1},
-#endif
/* Coefficients for 78Hz centre frequency */
{BPF_Fs8000_Fc78_A0, /* 8kS/s coefficients */
@@ -446,7 +422,6 @@
{BPF_Fs48000_Fc78_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc78_B2,
-BPF_Fs48000_Fc78_B1},
-#ifdef HIGHER_FS
{BPF_Fs88200_Fc66_A0, /* 88kS/s coefficients */
-BPF_Fs88200_Fc66_B2,
-BPF_Fs88200_Fc66_B1},
@@ -459,7 +434,6 @@
{BPF_Fs192000_Fc78_A0, /* 192kS/s coefficients */
-BPF_Fs192000_Fc78_B2,
-BPF_Fs192000_Fc78_B1},
-#endif
/* Coefficients for 90Hz centre frequency */
{BPF_Fs8000_Fc90_A0, /* 8kS/s coefficients */
@@ -489,7 +463,6 @@
{BPF_Fs48000_Fc90_A0, /* 48kS/s coefficients */
-BPF_Fs48000_Fc90_B2,
-BPF_Fs48000_Fc90_B1}
-#ifdef HIGHER_FS
,
{BPF_Fs88200_Fc90_A0, /* 88kS/s coefficients */
-BPF_Fs88200_Fc90_B2,
@@ -503,12 +476,9 @@
{BPF_Fs192000_Fc90_A0, /* 192kS/s coefficients */
-BPF_Fs192000_Fc90_B2,
-BPF_Fs192000_Fc90_B1}
-#endif
-
};
-
/************************************************************************************/
/* */
/* AGC constant tables */
@@ -516,11 +486,7 @@
/************************************************************************************/
/* Attack time (signal too large) */
-#ifndef BUILD_FLOAT
-const LVM_INT16 LVDBE_AGC_ATTACK_Table[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_AGC_ATTACK_Table[] = {
-#endif /*BUILD_FLOAT*/
AGC_ATTACK_Fs8000,
AGC_ATTACK_Fs11025,
AGC_ATTACK_Fs12000,
@@ -530,21 +496,15 @@
AGC_ATTACK_Fs32000,
AGC_ATTACK_Fs44100,
AGC_ATTACK_Fs48000
-#ifdef HIGHER_FS
,AGC_ATTACK_Fs88200
,AGC_ATTACK_Fs96000
,AGC_ATTACK_Fs176400
,AGC_ATTACK_Fs192000
-#endif
};
/* Decay time (signal too small) */
-#ifndef BUILD_FLOAT
-const LVM_INT16 LVDBE_AGC_DECAY_Table[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_AGC_DECAY_Table[] = {
-#endif /*BUILD_FLOAT*/
AGC_DECAY_Fs8000,
AGC_DECAY_Fs11025,
AGC_DECAY_Fs12000,
@@ -554,21 +514,15 @@
AGC_DECAY_Fs32000,
AGC_DECAY_Fs44100,
AGC_DECAY_Fs48000
-#ifdef HIGHER_FS
,AGC_DECAY_Fs88200
,AGC_DECAY_FS96000
,AGC_DECAY_Fs176400
,AGC_DECAY_FS192000
-#endif
};
/* Gain for use without the high pass filter */
-#ifndef BUILD_FLOAT
-const LVM_INT32 LVDBE_AGC_GAIN_Table[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_AGC_GAIN_Table[] = {
-#endif /*BUILD_FLOAT*/
AGC_GAIN_0dB,
AGC_GAIN_1dB,
AGC_GAIN_2dB,
@@ -587,11 +541,7 @@
AGC_GAIN_15dB};
/* Gain for use with the high pass filter */
-#ifndef BUILD_FLOAT
-const LVM_INT32 LVDBE_AGC_HPFGAIN_Table[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_AGC_HPFGAIN_Table[] = {
-#endif /*BUILD_FLOAT*/
AGC_HPFGAIN_0dB,
AGC_HPFGAIN_1dB,
AGC_HPFGAIN_2dB,
@@ -609,7 +559,6 @@
AGC_HPFGAIN_14dB,
AGC_HPFGAIN_15dB};
-
/************************************************************************************/
/* */
/* Volume control gain and time constant tables */
@@ -617,16 +566,6 @@
/************************************************************************************/
/* dB to linear conversion table */
-#ifndef BUILD_FLOAT
-const LVM_INT16 LVDBE_VolumeTable[] = {
- 0x4000, /* -6dB */
- 0x47FB, /* -5dB */
- 0x50C3, /* -4dB */
- 0x5A9E, /* -3dB */
- 0x65AD, /* -2dB */
- 0x7215, /* -1dB */
- 0x7FFF}; /* 0dB */
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_VolumeTable[] = {
0.500000f, /* -6dB */
0.562341f, /* -5dB */
@@ -635,13 +574,8 @@
0.794328f, /* -2dB */
0.891251f, /* -1dB */
1.000000f}; /* 0dB */
-#endif /*BUILD_FLOAT*/
-#ifndef BUILD_FLOAT
-const LVM_INT16 LVDBE_VolumeTCTable[] = {
-#else /*BUILD_FLOAT*/
const LVM_FLOAT LVDBE_VolumeTCTable[] = {
-#endif /*BUILD_FLOAT*/
VOL_TC_Fs8000,
VOL_TC_Fs11025,
VOL_TC_Fs12000,
@@ -651,16 +585,12 @@
VOL_TC_Fs32000,
VOL_TC_Fs44100,
VOL_TC_Fs48000
-#ifdef HIGHER_FS
,VOL_TC_Fs88200
,VOL_TC_Fs96000
,VOL_TC_Fs176400
,VOL_TC_Fs192000
-#endif
};
-
-
const LVM_INT16 LVDBE_MixerTCTable[] = {
MIX_TC_Fs8000,
@@ -672,11 +602,9 @@
MIX_TC_Fs32000,
MIX_TC_Fs44100,
MIX_TC_Fs48000
-#ifdef HIGHER_FS
,MIX_TC_Fs88200
,MIX_TC_Fs96000
,MIX_TC_Fs176400
,MIX_TC_Fs192000
-#endif
};
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
index fea09f3..6eabdd2 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -24,58 +23,9 @@
#ifndef __LVBDE_TABLES_H__
#define __LVBDE_TABLES_H__
-
#include "BIQUAD.h"
#include "LVM_Types.h"
-#ifndef BUILD_FLOAT
-/************************************************************************************/
-/* */
-/* Coefficients constant table */
-/* */
-/************************************************************************************/
-
-/*
- * High Pass Filter Coefficient table
- */
-extern const BQ_C32_Coefs_t LVDBE_HPF_Table[];
-
-/*
- * Band Pass Filter coefficient table
- */
-extern const BP_C32_Coefs_t LVDBE_BPF_Table[];
-
-/************************************************************************************/
-/* */
-/* AGC constant tables */
-/* */
-/************************************************************************************/
-
-/* Attack time (signal too large) */
-extern const LVM_INT16 LVDBE_AGC_ATTACK_Table[];
-
-/* Decay time (signal too small) */
-extern const LVM_INT16 LVDBE_AGC_DECAY_Table[];
-
-/* Gain for use without the high pass filter */
-extern const LVM_INT32 LVDBE_AGC_GAIN_Table[];
-
-/* Gain for use with the high pass filter */
-extern const LVM_INT32 LVDBE_AGC_HPFGAIN_Table[];
-
-/************************************************************************************/
-/* */
-/* Volume control gain and time constant tables */
-/* */
-/************************************************************************************/
-
-/* dB to linear conversion table */
-extern const LVM_INT16 LVDBE_VolumeTable[];
-
-extern const LVM_INT16 LVDBE_VolumeTCTable[];
-
-#else /*BUILD_FLOAT*/
-
/************************************************************************************/
/* */
/* Coefficients constant table */
@@ -120,10 +70,6 @@
extern const LVM_FLOAT LVDBE_VolumeTable[];
extern const LVM_FLOAT LVDBE_VolumeTCTable[];
-#endif /*BUILD_FLOAT*/
-
extern const LVM_INT16 LVDBE_MixerTCTable[];
-
-
#endif /* __LVBDE_TABLES_H__ */
diff --git a/media/libeffects/lvm/lib/Bundle/lib/LVM.h b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
index 3c089a0..e4e8450 100644
--- a/media/libeffects/lvm/lib/Bundle/lib/LVM.h
+++ b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
@@ -53,8 +53,6 @@
#ifndef __LVM_H__
#define __LVM_H__
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -63,7 +61,6 @@
#include "LVM_Types.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -105,7 +102,6 @@
/* Instance handle */
typedef void *LVM_Handle_t;
-
/* Status return values */
typedef enum
{
@@ -120,7 +116,6 @@
LVM_RETURNSTATUS_DUMMY = LVM_MAXENUM
} LVM_ReturnStatus_en;
-
/* Buffer Management mode */
typedef enum
{
@@ -224,7 +219,6 @@
LVM_CHAR *pPlatform; /* Pointer to the library platform type */
} LVM_VersionInfo_st;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -245,7 +239,6 @@
LVM_UINT16 QFactor; /* Band quality factor (x100) */
} LVM_EQNB_BandDef_t;
-
/* Headroom band definition */
typedef struct
{
@@ -254,7 +247,6 @@
LVM_INT16 Headroom_Offset; /* Headroom = biggest band gain - Headroom_Offset */
} LVM_HeadroomBandDef_t;
-
/* Control Parameter structure */
typedef struct
{
@@ -300,7 +292,6 @@
} LVM_ControlParams_t;
-
/* Instance Parameter structure */
typedef struct
{
@@ -330,7 +321,6 @@
/* */
/****************************************************************************************/
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetVersionInfo */
@@ -351,7 +341,6 @@
/****************************************************************************************/
LVM_ReturnStatus_en LVM_GetVersionInfo(LVM_VersionInfo_st *pVersion);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetMemoryTable */
@@ -388,7 +377,6 @@
LVM_MemTab_t *pMemoryTable,
LVM_InstParams_t *pInstParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetInstanceHandle */
@@ -415,7 +403,6 @@
LVM_MemTab_t *pMemoryTable,
LVM_InstParams_t *pInstParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_ClearAudioBuffers */
@@ -436,7 +423,6 @@
/****************************************************************************************/
LVM_ReturnStatus_en LVM_ClearAudioBuffers(LVM_Handle_t hInstance);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetControlParameters */
@@ -460,7 +446,6 @@
LVM_ReturnStatus_en LVM_GetControlParameters(LVM_Handle_t hInstance,
LVM_ControlParams_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_SetControlParameters */
@@ -484,7 +469,6 @@
LVM_ReturnStatus_en LVM_SetControlParameters(LVM_Handle_t hInstance,
LVM_ControlParams_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_Process */
@@ -515,20 +499,11 @@
/* STEREO the number of sample pairs in the block */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples,
LVM_UINT32 AudioTime);
-#else
-LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples,
- LVM_UINT32 AudioTime);
-#endif
-
/****************************************************************************************/
/* */
@@ -552,7 +527,6 @@
LVM_ReturnStatus_en LVM_SetHeadroomParams( LVM_Handle_t hInstance,
LVM_HeadroomParams_t *pHeadroomParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetHeadroomParams */
@@ -575,7 +549,6 @@
LVM_ReturnStatus_en LVM_GetHeadroomParams( LVM_Handle_t hInstance,
LVM_HeadroomParams_t *pHeadroomParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetSpectrum */
@@ -629,7 +602,5 @@
LVM_ReturnStatus_en LVM_SetVolumeNoSmoothing( LVM_Handle_t hInstance,
LVM_ControlParams_t *pParams);
-
-
#endif /* __LVM_H__ */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp
index 62d9ee3..e241cdd 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -60,7 +59,6 @@
pLVPSA_Handle_t *hPSAInstance;
LVPSA_RETURN LVPSA_Status;
-
if(pInstance == LVM_NULL)
{
return LVM_NULLADDRESS;
@@ -80,7 +78,6 @@
return LVM_NULLADDRESS;
}
-
/*
* Update new parameters if necessary
*/
@@ -115,7 +112,6 @@
return(LVM_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_SetVolumeNoSmoothing */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
index bdca5e3..3aeddbb 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -50,7 +49,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferManagedIn(LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT **pToProcess,
@@ -94,7 +92,6 @@
pBuffer->SamplesToOutput = 0; /* Samples to output is same as
number read for inplace processing */
-
/*
* Calculate the number of samples to process this call and update the buffer state
*/
@@ -131,7 +128,6 @@
}
*pNumSamples = (LVM_UINT16)SampleCount; /* Set the number of samples to process this call */
-
/*
* Copy samples from the delay buffer as required
*/
@@ -147,7 +143,6 @@
pDest += NumChannels * pBuffer->InDelaySamples; /* Update the destination pointer */
}
-
/*
* Copy the rest of the samples for this call from the input buffer
*/
@@ -165,7 +160,6 @@
pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput + NumSamples);
}
-
/*
* Update the sample count and input pointer
*/
@@ -173,7 +167,6 @@
pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount);
pInstance->pInputSamples = pStart; /* Update input sample pointer */
-
/*
* Save samples to the delay buffer if any left unprocessed
*/
@@ -190,7 +183,6 @@
(LVM_INT16)(NumChannels * NumSamples)); /* Number of input samples */
}
-
/*
* Update the delay sample count
*/
@@ -198,147 +190,6 @@
pInstance->SamplesToProcess = 0; /* All Samples used */
}
}
-#else
-void LVM_BufferManagedIn(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_INT16 SampleCount; /* Number of samples to be processed this call */
- LVM_INT16 NumSamples; /* Number of samples in scratch buffer */
- LVM_INT16 *pStart;
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer;
- LVM_INT16 *pDest;
- LVM_INT16 NumChannels = 2;
-
- /*
- * Set the processing address pointers
- */
- pBuffer = pInstance->pBufferManagement;
- pDest = pBuffer->pScratch;
- *pToProcess = pBuffer->pScratch;
- *pProcessed = pBuffer->pScratch;
-
- /*
- * Check if it is the first call of a block
- */
- if (pInstance->SamplesToProcess == 0)
- {
- /*
- * First call for a new block of samples
- */
- pInstance->SamplesToProcess = (LVM_INT16)(*pNumSamples + pBuffer->InDelaySamples);
- pInstance->pInputSamples = (LVM_INT16 *)pInData;
- pBuffer->BufferState = LVM_FIRSTCALL;
- }
- pStart = pInstance->pInputSamples; /* Pointer to the input samples */
- pBuffer->SamplesToOutput = 0; /* Samples to output is same as number read for inplace processing */
-
-
- /*
- * Calculate the number of samples to process this call and update the buffer state
- */
- if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
- {
- /*
- * Process the maximum bock size of samples.
- */
- SampleCount = pInstance->InternalBlockSize;
- NumSamples = pInstance->InternalBlockSize;
- }
- else
- {
- /*
- * Last call for the block, so calculate how many frames and samples to process
- */
- LVM_INT16 NumFrames;
-
- NumSamples = pInstance->SamplesToProcess;
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
- SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
-
- /*
- * Update the buffer state
- */
- if (pBuffer->BufferState == LVM_FIRSTCALL)
- {
- pBuffer->BufferState = LVM_FIRSTLASTCALL;
- }
- else
- {
- pBuffer->BufferState = LVM_LASTCALL;
- }
- }
- *pNumSamples = (LVM_UINT16)SampleCount; /* Set the number of samples to process this call */
-
-
- /*
- * Copy samples from the delay buffer as required
- */
- if (((pBuffer->BufferState == LVM_FIRSTCALL) ||
- (pBuffer->BufferState == LVM_FIRSTLASTCALL)) &&
- (pBuffer->InDelaySamples != 0))
- {
- Copy_16(&pBuffer->InDelayBuffer[0], /* Source */
- pDest, /* Destination */
- (LVM_INT16)(NumChannels*pBuffer->InDelaySamples)); /* Number of delay samples, left and right */
- NumSamples = (LVM_INT16)(NumSamples - pBuffer->InDelaySamples); /* Update sample count */
- pDest += NumChannels * pBuffer->InDelaySamples; /* Update the destination pointer */
- }
-
-
- /*
- * Copy the rest of the samples for this call from the input buffer
- */
- if (NumSamples > 0)
- {
- Copy_16(pStart, /* Source */
- pDest, /* Destination */
- (LVM_INT16)(NumChannels*NumSamples)); /* Number of input samples */
- pStart += NumChannels * NumSamples; /* Update the input pointer */
-
- /*
- * Update the input data pointer and samples to output
- */
- pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput + NumSamples); /* Update samples to output */
- }
-
-
- /*
- * Update the sample count and input pointer
- */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Update the count of samples */
- pInstance->pInputSamples = pStart; /* Update input sample pointer */
-
-
- /*
- * Save samples to the delay buffer if any left unprocessed
- */
- if ((pBuffer->BufferState == LVM_FIRSTLASTCALL) ||
- (pBuffer->BufferState == LVM_LASTCALL))
- {
- NumSamples = pInstance->SamplesToProcess;
- pStart = pBuffer->pScratch; /* Start of the buffer */
- pStart += NumChannels*SampleCount; /* Offset by the number of processed samples */
- if (NumSamples != 0)
- {
- Copy_16(pStart, /* Source */
- &pBuffer->InDelayBuffer[0], /* Destination */
- (LVM_INT16)(NumChannels*NumSamples)); /* Number of input samples */
- }
-
-
- /*
- * Update the delay sample count
- */
- pBuffer->InDelaySamples = NumSamples; /* Number of delay sample pairs */
- pInstance->SamplesToProcess = 0; /* All Samples used */
- }
-}
-#endif
/****************************************************************************************/
/* */
@@ -362,7 +213,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
LVM_FLOAT **pToProcess,
LVM_FLOAT **pProcessed,
@@ -371,7 +221,6 @@
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
/*
* Check if this is the first call of a block
*/
@@ -382,7 +231,6 @@
pInstance->pInputSamples = *pToProcess; /* Get the I/O pointers */
pInstance->pOutputSamples = *pProcessed;
-
/*
* Set te block size to process
*/
@@ -402,46 +250,6 @@
*pToProcess = pInstance->pInputSamples;
*pProcessed = pInstance->pOutputSamples;
}
-#else
-void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
-
- /*
- * Check if this is the first call of a block
- */
- if (pInstance->SamplesToProcess == 0)
- {
- pInstance->SamplesToProcess = (LVM_INT16)*pNumSamples; /* Get the number of samples on first call */
- pInstance->pInputSamples = *pToProcess; /* Get the I/O pointers */
- pInstance->pOutputSamples = *pProcessed;
-
-
- /*
- * Set te block size to process
- */
- if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
- {
- *pNumSamples = (LVM_UINT16)pInstance->InternalBlockSize;
- }
- else
- {
- *pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
- }
- }
-
- /*
- * Set the process pointers
- */
- *pToProcess = pInstance->pInputSamples;
- *pProcessed = pInstance->pOutputSamples;
-}
-#endif
/****************************************************************************************/
/* */
@@ -467,146 +275,6 @@
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-void LVM_BufferOptimisedIn(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
- LVM_INT16 *pDest;
- LVM_INT16 SampleCount;
- LVM_INT16 NumSamples;
- LVM_INT16 NumFrames;
-
- /*
- * Check if it is the first call for this block
- */
- if (pInstance->SamplesToProcess == 0)
- {
- /*
- * First call for a new block of samples
- */
- pBuffer->BufferState = LVM_FIRSTCALL;
- pInstance->pInputSamples = (LVM_INT16 *)pInData;
- pInstance->SamplesToProcess = (LVM_INT16)*pNumSamples;
- pBuffer->SamplesToOutput = (LVM_INT16)*pNumSamples;
- pDest = *pProcessed; /* The start of the output buffer */
-
-
- /*
- * Copy the already processed samples to the output buffer
- */
- if (pBuffer->OutDelaySamples != 0)
- {
- Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
- pDest, /* Destination */
- (LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of delay samples */
- pDest += 2 * pBuffer->OutDelaySamples; /* Update the output pointer */
- pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - pBuffer->OutDelaySamples); /* Update the numbr of samples to output */
- }
- *pToProcess = pDest; /* Set the address to start processing */
- *pProcessed = pDest; /* Process in the output buffer, now inplace */
-
- /*
- * Copy the input delay buffer (unprocessed) samples to the output buffer
- */
- if (pBuffer->InDelaySamples != 0)
- {
- Copy_16(&pBuffer->InDelayBuffer[0], /* Source */
- pDest, /* Destination */
- (LVM_INT16)(2*pBuffer->InDelaySamples)); /* Number of delay samples */
- pDest += 2 * pBuffer->InDelaySamples; /* Update the output pointer */
- }
-
-
- /*
- * Calculate how many input samples to process and copy
- */
- NumSamples = (LVM_INT16)(*pNumSamples - pBuffer->OutDelaySamples); /* Number that will fit in the output buffer */
- if (NumSamples >= pInstance->InternalBlockSize)
- {
- NumSamples = pInstance->InternalBlockSize;
- }
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
- SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
- *pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
- pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - SampleCount); /* Update the number of samples to output */
- SampleCount = (LVM_INT16)(SampleCount - pBuffer->InDelaySamples); /* The number of samples to copy from the input */
-
-
- /*
- * Copy samples from the input buffer and update counts and pointers
- */
- Copy_16(pInstance->pInputSamples, /* Source */
- pDest, /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Number of input samples */
- pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
- pInstance->pOutputSamples = pDest + (2 * SampleCount); /* Update the output pointer */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
- }
- else
- {
- /*
- * Second or subsequent call in optimised mode
- */
- if (pBuffer->SamplesToOutput >= MIN_INTERNAL_BLOCKSIZE)
- {
- /*
- * More samples can be processed directly in the output buffer
- */
- *pToProcess = pInstance->pOutputSamples; /* Set the address to start processing */
- *pProcessed = pInstance->pOutputSamples; /* Process in the output buffer, now inplace */
- NumSamples = pBuffer->SamplesToOutput; /* Number that will fit in the output buffer */
- if (NumSamples >= pInstance->InternalBlockSize)
- {
- NumSamples = pInstance->InternalBlockSize;
- }
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
- SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
- *pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
-
-
- /*
- * Copy samples from the input buffer and update counts and pointers
- */
- Copy_16(pInstance->pInputSamples, /* Source */
- pInstance->pOutputSamples, /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Number of input samples */
- pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
- pInstance->pOutputSamples += 2 * SampleCount; /* Update the output pointer */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
- pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - SampleCount); /* Number that will fit in the output buffer */
- }
- else
- {
- /*
- * The remaining samples can not be processed in the output buffer
- */
- pBuffer->BufferState = LVM_LASTCALL; /* Indicate this is the last bock to process */
- *pToProcess = pBuffer->pScratch; /* Set the address to start processing */
- *pProcessed = pBuffer->pScratch; /* Process in the output buffer, now inplace */
- NumSamples = pInstance->SamplesToProcess; /* Number left to be processed */
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
- SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
- *pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
-
-
- /*
- * Copy samples from the input buffer and update counts and pointers
- */
- Copy_16(pInstance->pInputSamples, /* Source */
- pBuffer->pScratch, /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Number of input samples */
- pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
- }
- }
-}
-#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferIn */
@@ -661,7 +329,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferIn(LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT **pToProcess,
@@ -671,7 +338,6 @@
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
/*
* Check which mode, managed or unmanaged
*/
@@ -691,37 +357,6 @@
pNumSamples);
}
}
-#else
-void LVM_BufferIn(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
-
- /*
- * Check which mode, managed or unmanaged
- */
- if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
- {
- LVM_BufferManagedIn(hInstance,
- pInData,
- pToProcess,
- pProcessed,
- pNumSamples);
- }
- else
- {
- LVM_BufferUnmanagedIn(hInstance,
- pToProcess,
- pProcessed,
- pNumSamples);
- }
-}
-#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferManagedOut */
@@ -742,7 +377,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferManagedOut(LVM_Handle_t hInstance,
LVM_FLOAT *pOutData,
LVM_UINT16 *pNumSamples)
@@ -777,7 +411,6 @@
}
pDest = pInstance->pOutputSamples; /* Set the output address */
-
/*
* If the number of samples is non-zero then there are still samples to send to
* the output buffer
@@ -859,7 +492,6 @@
}
}
-
/*
* Copy the processed results to the output
*/
@@ -920,7 +552,6 @@
}
}
-
/*
* Copy the remaining processed data to the output delay buffer
*/
@@ -950,157 +581,6 @@
/* This will terminate the loop when all samples processed */
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
}
-#else
-void LVM_BufferManagedOut(LVM_Handle_t hInstance,
- LVM_INT16 *pOutData,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
- LVM_INT16 SampleCount = (LVM_INT16)*pNumSamples;
- LVM_INT16 NumSamples;
- LVM_INT16 *pStart;
- LVM_INT16 *pDest;
-
-
- /*
- * Set the pointers
- */
- NumSamples = pBuffer->SamplesToOutput;
- pStart = pBuffer->pScratch;
-
-
- /*
- * check if it is the first call of a block
- */
- if ((pBuffer->BufferState == LVM_FIRSTCALL) ||
- (pBuffer->BufferState == LVM_FIRSTLASTCALL))
- {
- /* First call for a new block */
- pInstance->pOutputSamples = pOutData; /* Initialise the destination */
- }
- pDest = pInstance->pOutputSamples; /* Set the output address */
-
-
- /*
- * If the number of samples is non-zero then there are still samples to send to
- * the output buffer
- */
- if ((NumSamples != 0) &&
- (pBuffer->OutDelaySamples != 0))
- {
- /*
- * Copy the delayed output buffer samples to the output
- */
- if (pBuffer->OutDelaySamples <= NumSamples)
- {
- /*
- * Copy all output delay samples to the output
- */
- Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
- pDest, /* Detsination */
- (LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of delay samples */
-
- /*
- * Update the pointer and sample counts
- */
- pDest += 2*pBuffer->OutDelaySamples; /* Output sample pointer */
- NumSamples = (LVM_INT16)(NumSamples - pBuffer->OutDelaySamples); /* Samples left to send */
- pBuffer->OutDelaySamples = 0; /* No samples left in the buffer */
-
- }
- else
- {
- /*
- * Copy only some of the ouput delay samples to the output
- */
- Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
- pDest, /* Detsination */
- (LVM_INT16)(2*NumSamples)); /* Number of delay samples */
-
- /*
- * Update the pointer and sample counts
- */
- pDest += 2*NumSamples; /* Output sample pointer */
- pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples - NumSamples); /* No samples left in the buffer */
-
-
- /*
- * Realign the delay buffer data to avoid using circular buffer management
- */
- Copy_16(&pBuffer->OutDelayBuffer[2*NumSamples], /* Source */
- &pBuffer->OutDelayBuffer[0], /* Destination */
- (LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of samples to move */
- NumSamples = 0; /* Samples left to send */
- }
- }
-
-
- /*
- * Copy the processed results to the output
- */
- if ((NumSamples != 0) &&
- (SampleCount != 0))
- {
- if (SampleCount <= NumSamples)
- {
- /*
- * Copy all processed samples to the output
- */
- Copy_16(pStart, /* Source */
- pDest, /* Detsination */
- (LVM_INT16)(2*SampleCount)); /* Number of processed samples */
-
- /*
- * Update the pointer and sample counts
- */
- pDest += 2 * SampleCount; /* Output sample pointer */
- NumSamples = (LVM_INT16)(NumSamples - SampleCount); /* Samples left to send */
- SampleCount = 0; /* No samples left in the buffer */
- }
- else
- {
- /*
- * Copy only some processed samples to the output
- */
- Copy_16(pStart, /* Source */
- pDest, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Number of processed samples */
-
-
- /*
- * Update the pointers and sample counts
- */
- pStart += 2 * NumSamples; /* Processed sample pointer */
- pDest += 2 * NumSamples; /* Output sample pointer */
- SampleCount = (LVM_INT16)(SampleCount - NumSamples); /* Processed samples left */
- NumSamples = 0; /* Clear the sample count */
- }
- }
-
-
- /*
- * Copy the remaining processed data to the output delay buffer
- */
- if (SampleCount != 0)
- {
- Copy_16(pStart, /* Source */
- &pBuffer->OutDelayBuffer[2*pBuffer->OutDelaySamples], /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Number of processed samples */
- pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples + SampleCount); /* Update the buffer count */
- }
-
-
- /*
- * pointers, counts and set default buffer processing
- */
- pBuffer->SamplesToOutput = NumSamples; /* Samples left to send */
- pInstance->pOutputSamples = pDest; /* Output sample pointer */
- pBuffer->BufferState = LVM_MAXBLOCKCALL; /* Set for the default call block size */
- *pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess; /* This will terminate the loop when all samples processed */
-}
-#endif
/****************************************************************************************/
/* */
@@ -1139,7 +619,6 @@
LVM_INT16 NumChannels = 2;
#endif
-
/*
* Update sample counts
*/
@@ -1164,7 +643,6 @@
}
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferOptimisedOut */
@@ -1184,73 +662,6 @@
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-void LVM_BufferOptimisedOut(LVM_Handle_t hInstance,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
-
- /*
- * Check if it is the last block to process
- */
- if (pBuffer->BufferState == LVM_LASTCALL)
- {
- LVM_INT16 *pSrc = pBuffer->pScratch;
-
- /*
- * Copy the unprocessed samples to the input delay buffer
- */
- if (pInstance->SamplesToProcess != 0)
- {
- Copy_16(pInstance->pInputSamples, /* Source */
- &pBuffer->InDelayBuffer[0], /* Destination */
- (LVM_INT16)(2*pInstance->SamplesToProcess)); /* Number of input samples */
- pBuffer->InDelaySamples = pInstance->SamplesToProcess;
- pInstance->SamplesToProcess = 0;
- }
- else
- {
- pBuffer->InDelaySamples = 0;
- }
-
-
- /*
- * Fill the last empty spaces in the output buffer
- */
- if (pBuffer->SamplesToOutput != 0)
- {
- Copy_16(pSrc, /* Source */
- pInstance->pOutputSamples, /* Destination */
- (LVM_INT16)(2*pBuffer->SamplesToOutput)); /* Number of input samples */
- *pNumSamples = (LVM_UINT16)(*pNumSamples - pBuffer->SamplesToOutput);
- pSrc += 2 * pBuffer->SamplesToOutput; /* Update scratch pointer */
- pBuffer->SamplesToOutput = 0; /* No more samples in this block */
- }
-
-
- /*
- * Save any remaining processed samples in the output delay buffer
- */
- if (*pNumSamples != 0)
- {
- Copy_16(pSrc, /* Source */
- &pBuffer->OutDelayBuffer[0], /* Destination */
- (LVM_INT16)(2**pNumSamples)); /* Number of input samples */
-
- pBuffer->OutDelaySamples = (LVM_INT16)*pNumSamples;
-
- *pNumSamples = 0; /* No more samples in this block */
- }
- else
- {
- pBuffer->OutDelaySamples = 0;
- }
- }
-}
-#endif
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_BufferOut */
@@ -1287,7 +698,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
void LVM_BufferOut(LVM_Handle_t hInstance,
LVM_FLOAT *pOutData,
LVM_UINT16 *pNumSamples)
@@ -1295,7 +705,6 @@
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
/*
* Check which mode, managed or unmanaged
*/
@@ -1311,28 +720,3 @@
pNumSamples);
}
}
-#else
-void LVM_BufferOut(LVM_Handle_t hInstance,
- LVM_INT16 *pOutData,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
-
-
- /*
- * Check which mode, managed or unmanaged
- */
- if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
- {
- LVM_BufferManagedOut(hInstance,
- pOutData,
- pNumSamples);
- }
- else
- {
- LVM_BufferUnmanagedOut(hInstance,
- pNumSamples);
- }
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
index bab4049..812f8e5 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
@@ -18,7 +18,6 @@
#ifndef __LVM_COEFFS_H__
#define __LVM_COEFFS_H__
-
/************************************************************************************/
/* */
/* High Pass Shelving Filter coefficients */
@@ -29,7 +28,6 @@
#define TrebleBoostMinRate 4
#define TrebleBoostSteps 15
-#ifdef BUILD_FLOAT
/* Coefficients for sample rate 22050Hz */
/* Gain = 1.000000 dB */
#define HPF_Fs22050_Gain1_A0 1.038434
@@ -486,7 +484,6 @@
#define HPF_Fs48000_Gain15_B1 (-0.267949)
#define HPF_Fs48000_Gain15_B2 0.000000
-#ifdef HIGHER_FS
/* Coefficients for sample rate 88200 */
/* Gain = 1.000000 dB */
#define HPF_Fs88200_Gain1_A0 1.094374f
@@ -856,547 +853,3 @@
#define HPF_Fs192000_Gain15_B2 0.000000
#endif
-
-#else
-/* Coefficients for sample rate 22050Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs22050_Gain1_A0 5383 /* Floating point value 0.164291 */
-#define HPF_Fs22050_Gain1_A1 16859 /* Floating point value 0.514492 */
-#define HPF_Fs22050_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain1_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs22050_Gain2_A0 4683 /* Floating point value 0.142925 */
-#define HPF_Fs22050_Gain2_A1 17559 /* Floating point value 0.535858 */
-#define HPF_Fs22050_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain2_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs22050_Gain3_A0 3898 /* Floating point value 0.118953 */
-#define HPF_Fs22050_Gain3_A1 18345 /* Floating point value 0.559830 */
-#define HPF_Fs22050_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain3_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs22050_Gain4_A0 3016 /* Floating point value 0.092055 */
-#define HPF_Fs22050_Gain4_A1 19226 /* Floating point value 0.586728 */
-#define HPF_Fs22050_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain4_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs22050_Gain5_A0 2028 /* Floating point value 0.061876 */
-#define HPF_Fs22050_Gain5_A1 20215 /* Floating point value 0.616907 */
-#define HPF_Fs22050_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain5_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs22050_Gain6_A0 918 /* Floating point value 0.028013 */
-#define HPF_Fs22050_Gain6_A1 21324 /* Floating point value 0.650770 */
-#define HPF_Fs22050_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain6_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs22050_Gain7_A0 (-164) /* Floating point value -0.005002 */
-#define HPF_Fs22050_Gain7_A1 11311 /* Floating point value 0.345199 */
-#define HPF_Fs22050_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain7_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs22050_Gain8_A0 (-864) /* Floating point value -0.026368 */
-#define HPF_Fs22050_Gain8_A1 12012 /* Floating point value 0.366565 */
-#define HPF_Fs22050_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain8_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs22050_Gain9_A0 (-1650) /* Floating point value -0.050340 */
-#define HPF_Fs22050_Gain9_A1 12797 /* Floating point value 0.390537 */
-#define HPF_Fs22050_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain9_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs22050_Gain10_A0 (-2531) /* Floating point value -0.077238 */
-#define HPF_Fs22050_Gain10_A1 13679 /* Floating point value 0.417435 */
-#define HPF_Fs22050_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain10_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs22050_Gain11_A0 (-3520) /* Floating point value -0.107417 */
-#define HPF_Fs22050_Gain11_A1 14667 /* Floating point value 0.447615 */
-#define HPF_Fs22050_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain11_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs22050_Gain12_A0 (-4629) /* Floating point value -0.141279 */
-#define HPF_Fs22050_Gain12_A1 15777 /* Floating point value 0.481477 */
-#define HPF_Fs22050_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain12_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs22050_Gain13_A0 (-2944) /* Floating point value -0.089849 */
-#define HPF_Fs22050_Gain13_A1 8531 /* Floating point value 0.260352 */
-#define HPF_Fs22050_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain13_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs22050_Gain14_A0 (-3644) /* Floating point value -0.111215 */
-#define HPF_Fs22050_Gain14_A1 9231 /* Floating point value 0.281718 */
-#define HPF_Fs22050_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain14_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs22050_Gain15_A0 (-4430) /* Floating point value -0.135187 */
-#define HPF_Fs22050_Gain15_A1 10017 /* Floating point value 0.305690 */
-#define HPF_Fs22050_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain15_B1 12125 /* Floating point value 0.370033 */
-#define HPF_Fs22050_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs22050_Gain15_Shift 3 /* Shift value */
-
-
-/* Coefficients for sample rate 24000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs24000_Gain1_A0 3625 /* Floating point value 0.110628 */
-#define HPF_Fs24000_Gain1_A1 16960 /* Floating point value 0.517578 */
-#define HPF_Fs24000_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain1_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs24000_Gain2_A0 2811 /* Floating point value 0.085800 */
-#define HPF_Fs24000_Gain2_A1 17774 /* Floating point value 0.542406 */
-#define HPF_Fs24000_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain2_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs24000_Gain3_A0 1899 /* Floating point value 0.057943 */
-#define HPF_Fs24000_Gain3_A1 18686 /* Floating point value 0.570263 */
-#define HPF_Fs24000_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain3_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs24000_Gain4_A0 874 /* Floating point value 0.026687 */
-#define HPF_Fs24000_Gain4_A1 19711 /* Floating point value 0.601519 */
-#define HPF_Fs24000_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain4_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs24000_Gain5_A0 (-275) /* Floating point value -0.008383 */
-#define HPF_Fs24000_Gain5_A1 20860 /* Floating point value 0.636589 */
-#define HPF_Fs24000_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain5_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs24000_Gain6_A0 (-1564) /* Floating point value -0.047733 */
-#define HPF_Fs24000_Gain6_A1 22149 /* Floating point value 0.675938 */
-#define HPF_Fs24000_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain6_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs24000_Gain7_A0 (-1509) /* Floating point value -0.046051 */
-#define HPF_Fs24000_Gain7_A1 11826 /* Floating point value 0.360899 */
-#define HPF_Fs24000_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain7_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs24000_Gain8_A0 (-2323) /* Floating point value -0.070878 */
-#define HPF_Fs24000_Gain8_A1 12640 /* Floating point value 0.385727 */
-#define HPF_Fs24000_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain8_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs24000_Gain9_A0 (-3235) /* Floating point value -0.098736 */
-#define HPF_Fs24000_Gain9_A1 13552 /* Floating point value 0.413584 */
-#define HPF_Fs24000_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain9_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs24000_Gain10_A0 (-4260) /* Floating point value -0.129992 */
-#define HPF_Fs24000_Gain10_A1 14577 /* Floating point value 0.444841 */
-#define HPF_Fs24000_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain10_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs24000_Gain11_A0 (-5409) /* Floating point value -0.165062 */
-#define HPF_Fs24000_Gain11_A1 15726 /* Floating point value 0.479911 */
-#define HPF_Fs24000_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain11_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs24000_Gain12_A0 (-6698) /* Floating point value -0.204411 */
-#define HPF_Fs24000_Gain12_A1 17015 /* Floating point value 0.519260 */
-#define HPF_Fs24000_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain12_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs24000_Gain13_A0 (-4082) /* Floating point value -0.124576 */
-#define HPF_Fs24000_Gain13_A1 9253 /* Floating point value 0.282374 */
-#define HPF_Fs24000_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain13_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs24000_Gain14_A0 (-4896) /* Floating point value -0.149404 */
-#define HPF_Fs24000_Gain14_A1 10066 /* Floating point value 0.307202 */
-#define HPF_Fs24000_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain14_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs24000_Gain15_A0 (-5808) /* Floating point value -0.177261 */
-#define HPF_Fs24000_Gain15_A1 10979 /* Floating point value 0.335059 */
-#define HPF_Fs24000_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain15_B1 8780 /* Floating point value 0.267949 */
-#define HPF_Fs24000_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs24000_Gain15_Shift 3 /* Shift value */
-
-
-/* Coefficients for sample rate 32000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs32000_Gain1_A0 17225 /* Floating point value 0.525677 */
-#define HPF_Fs32000_Gain1_A1 (-990) /* Floating point value -0.030227 */
-#define HPF_Fs32000_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain1_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs32000_Gain2_A0 18337 /* Floating point value 0.559593 */
-#define HPF_Fs32000_Gain2_A1 (-2102) /* Floating point value -0.064142 */
-#define HPF_Fs32000_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain2_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs32000_Gain3_A0 19584 /* Floating point value 0.597646 */
-#define HPF_Fs32000_Gain3_A1 (-3349) /* Floating point value -0.102196 */
-#define HPF_Fs32000_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain3_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs32000_Gain4_A0 20983 /* Floating point value 0.640343 */
-#define HPF_Fs32000_Gain4_A1 (-4748) /* Floating point value -0.144893 */
-#define HPF_Fs32000_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain4_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs32000_Gain5_A0 22553 /* Floating point value 0.688250 */
-#define HPF_Fs32000_Gain5_A1 (-6318) /* Floating point value -0.192799 */
-#define HPF_Fs32000_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain5_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs32000_Gain6_A0 24314 /* Floating point value 0.742002 */
-#define HPF_Fs32000_Gain6_A1 (-8079) /* Floating point value -0.246551 */
-#define HPF_Fs32000_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain6_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs32000_Gain7_A0 13176 /* Floating point value 0.402109 */
-#define HPF_Fs32000_Gain7_A1 (-5040) /* Floating point value -0.153795 */
-#define HPF_Fs32000_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain7_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs32000_Gain8_A0 14288 /* Floating point value 0.436024 */
-#define HPF_Fs32000_Gain8_A1 (-6151) /* Floating point value -0.187711 */
-#define HPF_Fs32000_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain8_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs32000_Gain9_A0 15535 /* Floating point value 0.474078 */
-#define HPF_Fs32000_Gain9_A1 (-7398) /* Floating point value -0.225764 */
-#define HPF_Fs32000_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain9_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs32000_Gain10_A0 16934 /* Floating point value 0.516774 */
-#define HPF_Fs32000_Gain10_A1 (-8797) /* Floating point value -0.268461 */
-#define HPF_Fs32000_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain10_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs32000_Gain11_A0 18503 /* Floating point value 0.564681 */
-#define HPF_Fs32000_Gain11_A1 (-10367) /* Floating point value -0.316368 */
-#define HPF_Fs32000_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain11_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs32000_Gain12_A0 20265 /* Floating point value 0.618433 */
-#define HPF_Fs32000_Gain12_A1 (-12128) /* Floating point value -0.370120 */
-#define HPF_Fs32000_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain12_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs32000_Gain13_A0 11147 /* Floating point value 0.340178 */
-#define HPF_Fs32000_Gain13_A1 (-7069) /* Floating point value -0.215726 */
-#define HPF_Fs32000_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain13_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs32000_Gain14_A0 12258 /* Floating point value 0.374093 */
-#define HPF_Fs32000_Gain14_A1 (-8180) /* Floating point value -0.249642 */
-#define HPF_Fs32000_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain14_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs32000_Gain15_A0 13505 /* Floating point value 0.412147 */
-#define HPF_Fs32000_Gain15_A1 (-9427) /* Floating point value -0.287695 */
-#define HPF_Fs32000_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain15_B1 0 /* Floating point value -0.000000 */
-#define HPF_Fs32000_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs32000_Gain15_Shift 3 /* Shift value */
-
-
-/* Coefficients for sample rate 44100Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs44100_Gain1_A0 17442 /* Floating point value 0.532294 */
-#define HPF_Fs44100_Gain1_A1 (-4761) /* Floating point value -0.145294 */
-#define HPF_Fs44100_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain1_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs44100_Gain2_A0 18797 /* Floating point value 0.573633 */
-#define HPF_Fs44100_Gain2_A1 (-6116) /* Floating point value -0.186634 */
-#define HPF_Fs44100_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain2_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs44100_Gain3_A0 20317 /* Floating point value 0.620016 */
-#define HPF_Fs44100_Gain3_A1 (-7635) /* Floating point value -0.233017 */
-#define HPF_Fs44100_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain3_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs44100_Gain4_A0 22022 /* Floating point value 0.672059 */
-#define HPF_Fs44100_Gain4_A1 (-9341) /* Floating point value -0.285060 */
-#define HPF_Fs44100_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain4_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs44100_Gain5_A0 23935 /* Floating point value 0.730452 */
-#define HPF_Fs44100_Gain5_A1 (-11254) /* Floating point value -0.343453 */
-#define HPF_Fs44100_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain5_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs44100_Gain6_A0 26082 /* Floating point value 0.795970 */
-#define HPF_Fs44100_Gain6_A1 (-13401) /* Floating point value -0.408971 */
-#define HPF_Fs44100_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain6_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs44100_Gain7_A0 14279 /* Floating point value 0.435774 */
-#define HPF_Fs44100_Gain7_A1 (-7924) /* Floating point value -0.241815 */
-#define HPF_Fs44100_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain7_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs44100_Gain8_A0 15634 /* Floating point value 0.477113 */
-#define HPF_Fs44100_Gain8_A1 (-9278) /* Floating point value -0.283154 */
-#define HPF_Fs44100_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain8_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs44100_Gain9_A0 17154 /* Floating point value 0.523496 */
-#define HPF_Fs44100_Gain9_A1 (-10798) /* Floating point value -0.329537 */
-#define HPF_Fs44100_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain9_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs44100_Gain10_A0 18859 /* Floating point value 0.575539 */
-#define HPF_Fs44100_Gain10_A1 (-12504) /* Floating point value -0.381580 */
-#define HPF_Fs44100_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain10_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs44100_Gain11_A0 20773 /* Floating point value 0.633932 */
-#define HPF_Fs44100_Gain11_A1 (-14417) /* Floating point value -0.439973 */
-#define HPF_Fs44100_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain11_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs44100_Gain12_A0 22920 /* Floating point value 0.699450 */
-#define HPF_Fs44100_Gain12_A1 (-16564) /* Floating point value -0.505491 */
-#define HPF_Fs44100_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain12_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs44100_Gain13_A0 12694 /* Floating point value 0.387399 */
-#define HPF_Fs44100_Gain13_A1 (-9509) /* Floating point value -0.290189 */
-#define HPF_Fs44100_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain13_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs44100_Gain14_A0 14049 /* Floating point value 0.428738 */
-#define HPF_Fs44100_Gain14_A1 (-10864) /* Floating point value -0.331528 */
-#define HPF_Fs44100_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain14_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs44100_Gain15_A0 15569 /* Floating point value 0.475121 */
-#define HPF_Fs44100_Gain15_A1 (-12383) /* Floating point value -0.377912 */
-#define HPF_Fs44100_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain15_B1 (-7173) /* Floating point value -0.218894 */
-#define HPF_Fs44100_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain15_Shift 3 /* Shift value */
-
-
-/* Coefficients for sample rate 48000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs48000_Gain1_A0 17491 /* Floating point value 0.533777 */
-#define HPF_Fs48000_Gain1_A1 (-5606) /* Floating point value -0.171082 */
-#define HPF_Fs48000_Gain1_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain1_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain1_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain1_Shift 1 /* Shift value */
- /* Gain = 2.000000 dB */
-#define HPF_Fs48000_Gain2_A0 18900 /* Floating point value 0.576779 */
-#define HPF_Fs48000_Gain2_A1 (-7015) /* Floating point value -0.214085 */
-#define HPF_Fs48000_Gain2_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain2_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain2_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain2_Shift 1 /* Shift value */
- /* Gain = 3.000000 dB */
-#define HPF_Fs48000_Gain3_A0 20481 /* Floating point value 0.625029 */
-#define HPF_Fs48000_Gain3_A1 (-8596) /* Floating point value -0.262335 */
-#define HPF_Fs48000_Gain3_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain3_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain3_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain3_Shift 1 /* Shift value */
- /* Gain = 4.000000 dB */
-#define HPF_Fs48000_Gain4_A0 22255 /* Floating point value 0.679167 */
-#define HPF_Fs48000_Gain4_A1 (-10370) /* Floating point value -0.316472 */
-#define HPF_Fs48000_Gain4_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain4_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain4_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain4_Shift 1 /* Shift value */
- /* Gain = 5.000000 dB */
-#define HPF_Fs48000_Gain5_A0 24245 /* Floating point value 0.739910 */
-#define HPF_Fs48000_Gain5_A1 (-12361) /* Floating point value -0.377215 */
-#define HPF_Fs48000_Gain5_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain5_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain5_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain5_Shift 1 /* Shift value */
- /* Gain = 6.000000 dB */
-#define HPF_Fs48000_Gain6_A0 26479 /* Floating point value 0.808065 */
-#define HPF_Fs48000_Gain6_A1 (-14594) /* Floating point value -0.445370 */
-#define HPF_Fs48000_Gain6_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain6_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain6_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain6_Shift 1 /* Shift value */
- /* Gain = 7.000000 dB */
-#define HPF_Fs48000_Gain7_A0 14527 /* Floating point value 0.443318 */
-#define HPF_Fs48000_Gain7_A1 (-8570) /* Floating point value -0.261540 */
-#define HPF_Fs48000_Gain7_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain7_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain7_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain7_Shift 2 /* Shift value */
- /* Gain = 8.000000 dB */
-#define HPF_Fs48000_Gain8_A0 15936 /* Floating point value 0.486321 */
-#define HPF_Fs48000_Gain8_A1 (-9979) /* Floating point value -0.304543 */
-#define HPF_Fs48000_Gain8_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain8_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain8_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain8_Shift 2 /* Shift value */
- /* Gain = 9.000000 dB */
-#define HPF_Fs48000_Gain9_A0 17517 /* Floating point value 0.534571 */
-#define HPF_Fs48000_Gain9_A1 (-11560) /* Floating point value -0.352793 */
-#define HPF_Fs48000_Gain9_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain9_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain9_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain9_Shift 2 /* Shift value */
- /* Gain = 10.000000 dB */
-#define HPF_Fs48000_Gain10_A0 19291 /* Floating point value 0.588708 */
-#define HPF_Fs48000_Gain10_A1 (-13334) /* Floating point value -0.406930 */
-#define HPF_Fs48000_Gain10_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain10_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain10_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain10_Shift 2 /* Shift value */
- /* Gain = 11.000000 dB */
-#define HPF_Fs48000_Gain11_A0 21281 /* Floating point value 0.649452 */
-#define HPF_Fs48000_Gain11_A1 (-15325) /* Floating point value -0.467674 */
-#define HPF_Fs48000_Gain11_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain11_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain11_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain11_Shift 2 /* Shift value */
- /* Gain = 12.000000 dB */
-#define HPF_Fs48000_Gain12_A0 23515 /* Floating point value 0.717607 */
-#define HPF_Fs48000_Gain12_A1 (-17558) /* Floating point value -0.535829 */
-#define HPF_Fs48000_Gain12_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain12_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain12_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain12_Shift 2 /* Shift value */
- /* Gain = 13.000000 dB */
-#define HPF_Fs48000_Gain13_A0 13041 /* Floating point value 0.397982 */
-#define HPF_Fs48000_Gain13_A1 (-10056) /* Floating point value -0.306877 */
-#define HPF_Fs48000_Gain13_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain13_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain13_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain13_Shift 3 /* Shift value */
- /* Gain = 14.000000 dB */
-#define HPF_Fs48000_Gain14_A0 14450 /* Floating point value 0.440984 */
-#define HPF_Fs48000_Gain14_A1 (-11465) /* Floating point value -0.349880 */
-#define HPF_Fs48000_Gain14_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain14_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain14_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain14_Shift 3 /* Shift value */
- /* Gain = 15.000000 dB */
-#define HPF_Fs48000_Gain15_A0 16031 /* Floating point value 0.489234 */
-#define HPF_Fs48000_Gain15_A1 (-13046) /* Floating point value -0.398130 */
-#define HPF_Fs48000_Gain15_A2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain15_B1 (-8780) /* Floating point value -0.267949 */
-#define HPF_Fs48000_Gain15_B2 0 /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain15_Shift 3 /* Shift value */
-
-
-#endif
-#endif
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
index ab1c078..ff2c90a 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -56,7 +55,6 @@
{
LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
-
if ((pParams == LVM_NULL) || (hInstance == LVM_NULL))
{
return (LVM_NULLADDRESS);
@@ -67,17 +65,11 @@
if(
/* General parameters */
((pParams->OperatingMode != LVM_MODE_OFF) && (pParams->OperatingMode != LVM_MODE_ON)) ||
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
((pParams->SampleRate != LVM_FS_8000) && (pParams->SampleRate != LVM_FS_11025) && (pParams->SampleRate != LVM_FS_12000) &&
(pParams->SampleRate != LVM_FS_16000) && (pParams->SampleRate != LVM_FS_22050) && (pParams->SampleRate != LVM_FS_24000) &&
(pParams->SampleRate != LVM_FS_32000) && (pParams->SampleRate != LVM_FS_44100) && (pParams->SampleRate != LVM_FS_48000) &&
(pParams->SampleRate != LVM_FS_88200) && (pParams->SampleRate != LVM_FS_96000) &&
(pParams->SampleRate != LVM_FS_176400) && (pParams->SampleRate != LVM_FS_192000)) ||
-#else
- ((pParams->SampleRate != LVM_FS_8000) && (pParams->SampleRate != LVM_FS_11025) && (pParams->SampleRate != LVM_FS_12000) &&
- (pParams->SampleRate != LVM_FS_16000) && (pParams->SampleRate != LVM_FS_22050) && (pParams->SampleRate != LVM_FS_24000) &&
- (pParams->SampleRate != LVM_FS_32000) && (pParams->SampleRate != LVM_FS_44100) && (pParams->SampleRate != LVM_FS_48000)) ||
-#endif
#ifdef SUPPORT_MC
((pParams->SourceFormat != LVM_STEREO) &&
(pParams->SourceFormat != LVM_MONOINSTEREO) &&
@@ -204,7 +196,6 @@
return (LVM_OUTOFRANGE);
}
-
/*
* Set the flag to indicate there are new parameters to use
*
@@ -218,7 +209,6 @@
return(LVM_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetControlParameters */
@@ -245,7 +235,6 @@
{
LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
-
/*
* Check pointer
*/
@@ -272,7 +261,6 @@
return(LVM_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_SetTrebleBoost */
@@ -289,11 +277,7 @@
void LVM_SetTrebleBoost(LVM_Instance_t *pInstance,
LVM_ControlParams_t *pParams)
{
-#ifdef BUILD_FLOAT
extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-#else
- extern FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-#endif
LVM_INT16 Offset;
LVM_INT16 EffectLevel = 0;
@@ -324,7 +308,6 @@
* Load the coefficients and enabled the treble boost
*/
Offset = (LVM_INT16)(EffectLevel - 1 + TrebleBoostSteps * (pParams->SampleRate - TrebleBoostMinRate));
-#ifdef BUILD_FLOAT
FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(&pInstance->pTE_State->TrebleBoost_State,
&pInstance->pTE_Taps->TrebleBoost_Taps,
&LVM_TrebleBoostCoefs[Offset]);
@@ -337,19 +320,6 @@
Cast to void: no dereferencing in function */
(LVM_UINT16)(sizeof(pInstance->pTE_Taps->TrebleBoost_Taps) / \
sizeof(LVM_FLOAT))); /* Number of words */
-#else
- FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(&pInstance->pTE_State->TrebleBoost_State,
- &pInstance->pTE_Taps->TrebleBoost_Taps,
- &LVM_TrebleBoostCoefs[Offset]);
-
- /*
- * Clear the taps
- */
- LoadConst_16((LVM_INT16)0, /* Value */
- (void *)&pInstance->pTE_Taps->TrebleBoost_Taps, /* Destination.\
- Cast to void: no dereferencing in function */
- (LVM_UINT16)(sizeof(pInstance->pTE_Taps->TrebleBoost_Taps)/sizeof(LVM_INT16))); /* Number of words */
-#endif
}
}
else
@@ -363,7 +333,6 @@
return;
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVM_SetVolume */
@@ -383,9 +352,7 @@
LVM_UINT16 dBShifts; /* 6dB shifts */
LVM_UINT16 dBOffset; /* Table offset */
LVM_INT16 Volume = 0; /* Required volume in dBs */
-#ifdef BUILD_FLOAT
LVM_FLOAT Temp;
-#endif
/*
* Limit the gain to the maximum allowed
@@ -439,56 +406,36 @@
dBOffset = (LVM_UINT16)((-Volume) % 6); /* Get the dBs 0-5 */
dBShifts = (LVM_UINT16)(Volume / -6); /* Get the 6dB shifts */
-
/*
* Set the parameters
*/
if(dBShifts == 0)
{
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
(LVM_FLOAT)LVM_VolumeTable[dBOffset]);
-#else
- LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
- (LVM_INT32)LVM_VolumeTable[dBOffset]);
-#endif
}
else
{
-#ifdef BUILD_FLOAT
Temp = LVM_VolumeTable[dBOffset];
while(dBShifts) {
Temp = Temp / 2.0f;
dBShifts--;
}
LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0], Temp);
-#else
- LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
- (((LVM_INT32)LVM_VolumeTable[dBOffset])>>dBShifts));
-#endif
}
pInstance->VC_Volume.MixerStream[0].CallbackSet = 1;
if(pInstance->NoSmoothVolume == LVM_TRUE)
{
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0], 0,
pInstance->Params.SampleRate, 2);
-#else
- LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],0,pInstance->Params.SampleRate,2);
-#endif
}
else
{
-#ifdef BUILD_FLOAT
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],
LVM_VC_MIXER_TIME, pInstance->Params.SampleRate, 2);
-#else
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],LVM_VC_MIXER_TIME,pInstance->Params.SampleRate,2);
-#endif
}
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVM_SetHeadroom */
@@ -513,7 +460,6 @@
LVM_INT16 Headroom = 0;
LVM_INT16 MaxGain = 0;
-
if (((LVEQNB_Mode_en)pParams->EQNB_OperatingMode == LVEQNB_ON)
&& (pInstance->HeadroomParams.Headroom_OperatingMode == LVM_HEADROOM_ON))
{
@@ -546,7 +492,6 @@
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_ApplyNewSettings */
@@ -571,7 +516,6 @@
LVM_ControlParams_t LocalParams;
LVM_INT16 Count = 5;
-
/*
* Copy the new parameters but make sure they didn't change while copying
*/
@@ -628,13 +572,8 @@
/* Configure Mixer module for gradual changes to volume*/
if(LocalParams.VC_Balance < 0)
{
-#ifdef BUILD_FLOAT
LVM_FLOAT Target_Float;
-#else
- LVM_INT32 Target;
-#endif
/* Drop in right channel volume*/
-#ifdef BUILD_FLOAT
Target_Float = LVM_MAXFLOAT;
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0], Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
@@ -644,25 +583,11 @@
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1], Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
-#else
- Target = LVM_MAXINT_16;
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-
- Target = dB_to_Lin32((LVM_INT16)(LocalParams.VC_Balance<<4));
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-#endif
}
else if(LocalParams.VC_Balance >0)
{
-#ifdef BUILD_FLOAT
LVM_FLOAT Target_Float;
-#else
- LVM_INT32 Target;
-#endif
/* Drop in left channel volume*/
-#ifdef BUILD_FLOAT
Target_Float = dB_to_LinFloat((LVM_INT16)((-LocalParams.VC_Balance) << 4));
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0], Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
@@ -672,30 +597,12 @@
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1], Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
-#else
- Target = dB_to_Lin32((LVM_INT16)((-LocalParams.VC_Balance)<<4));
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-
- Target = LVM_MAXINT_16;
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-#endif
}
else
{
-#ifdef BUILD_FLOAT
LVM_FLOAT Target_Float;
-#else
- LVM_INT32 Target;
-#endif
/* No drop*/
-#ifdef BUILD_FLOAT
Target_Float = LVM_MAXFLOAT;
-#else
- Target = LVM_MAXINT_16;
-#endif
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],
LVM_VC_MIXER_TIME,LocalParams.SampleRate, 1);
@@ -703,13 +610,6 @@
LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target_Float);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],
LVM_VC_MIXER_TIME,LocalParams.SampleRate, 1);
-#else
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LocalParams.SampleRate,1);
-#endif
}
}
/*
@@ -720,7 +620,6 @@
LVDBE_Params_t DBE_Params;
LVDBE_Handle_t *hDBEInstance = (LVDBE_Handle_t *)pInstance->hDBEInstance;
-
/*
* Set the new parameters
*/
@@ -749,7 +648,6 @@
DBE_Status = LVDBE_Control(hDBEInstance,
&DBE_Params);
-
/*
* Quit if the changes were not accepted
*/
@@ -758,7 +656,6 @@
return((LVM_ReturnStatus_en)DBE_Status);
}
-
/*
* Set the control flag
*/
@@ -773,7 +670,6 @@
LVEQNB_Params_t EQNB_Params;
LVEQNB_Handle_t *hEQNBInstance = (LVEQNB_Handle_t *)pInstance->hEQNBInstance;
-
/*
* Set the new parameters
*/
@@ -830,7 +726,6 @@
EQNB_Status = LVEQNB_Control(hEQNBInstance,
&EQNB_Params);
-
/*
* Quit if the changes were not accepted
*/
@@ -841,7 +736,6 @@
}
-
/*
* Update concert sound
*/
@@ -917,7 +811,6 @@
CS_Status = LVCS_Control(hCSInstance,
&CS_Params);
-
/*
* Quit if the changes were not accepted
*/
@@ -936,7 +829,6 @@
LVPSA_ControlParams_t PSA_Params;
pLVPSA_Handle_t *hPSAInstance = (pLVPSA_Handle_t *)pInstance->hPSAInstance;
-
/*
* Set the new parameters
*/
@@ -973,11 +865,9 @@
pInstance->NoSmoothVolume = LVM_FALSE;
pInstance->Params = LocalParams;
-
return(LVM_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_SetHeadroomParams */
@@ -1071,14 +961,12 @@
pHeadroomParams->NHeadroomBands = pInstance->NewHeadroomParams.NHeadroomBands;
-
/* Copy settings in memory */
for(ii = 0; ii < pInstance->NewHeadroomParams.NHeadroomBands; ii++)
{
pInstance->pHeadroom_UserDefs[ii] = pInstance->pHeadroom_BandDefs[ii];
}
-
pHeadroomParams->pHeadroomDefinition = pInstance->pHeadroom_UserDefs;
pHeadroomParams->Headroom_OperatingMode = pInstance->NewHeadroomParams.Headroom_OperatingMode;
return(LVM_SUCCESS);
@@ -1157,30 +1045,17 @@
short CallBackParam)
{
LVM_Instance_t *pInstance =(LVM_Instance_t *)pBundleHandle;
-#ifdef BUILD_FLOAT
LVM_FLOAT Target;
-#else
- LVM_INT32 Target;
-#endif
(void) pGeneralPurpose;
(void) CallBackParam;
/* When volume mixer has reached 0 dB target then stop it to avoid
unnecessary processing. */
-#ifdef BUILD_FLOAT
Target = LVC_Mixer_GetTarget(&pInstance->VC_Volume.MixerStream[0]);
if(Target == 1.0f)
{
pInstance->VC_Active = LVM_FALSE;
}
-#else
- Target = LVC_Mixer_GetTarget(&pInstance->VC_Volume.MixerStream[0]);
-
- if(Target == 0x7FFF)
- {
- pInstance->VC_Active = LVM_FALSE;
- }
-#endif
return 1;
}
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp
index d773910..5620529 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp
@@ -139,7 +139,6 @@
INST_ALLOC AllocMem[LVM_NR_MEMORY_REGIONS];
LVM_INT16 i;
-
/*
* Check parameters
*/
@@ -148,7 +147,6 @@
return LVM_NULLADDRESS;
}
-
/*
* Return memory table if the instance has already been created
*/
@@ -227,20 +225,15 @@
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
sizeof(LVM_Instance_t));
-
/*
* Set the algorithm and bundle scratch requirements
*/
AlgScratchSize = 0;
if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS)
{
-#ifdef BUILD_FLOAT
BundleScratchSize = 3 * LVM_MAX_CHANNELS \
* (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) \
* sizeof(LVM_FLOAT);
-#else
- BundleScratchSize = 6 * (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) * sizeof(LVM_INT16);
-#endif
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST], /* Scratch buffer */
BundleScratchSize);
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
@@ -293,7 +286,6 @@
}
-
/*
* Dynamic Bass Enhancement requirements
*/
@@ -304,7 +296,6 @@
/*
* Set the capabilities
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 |
LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 |
LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 |
@@ -312,9 +303,6 @@
LVDBE_CAP_FS_48000 | LVDBE_CAP_FS_88200 |
LVDBE_CAP_FS_96000 | LVDBE_CAP_FS_176400 |
LVDBE_CAP_FS_192000;
-#else
- DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 | LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 | LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000;
-#endif
DBE_Capabilities.CentreFrequency = LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_66Hz | LVDBE_CAP_CENTRE_78Hz | LVDBE_CAP_CENTRE_90Hz;
DBE_Capabilities.MaxBlockSize = InternalBlockSize;
@@ -336,7 +324,6 @@
}
-
/*
* N-Band equaliser requirements
*/
@@ -347,7 +334,6 @@
/*
* Set the capabilities
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 |
LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 |
LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 |
@@ -355,9 +341,6 @@
LVEQNB_CAP_FS_48000 | LVEQNB_CAP_FS_88200 |
LVEQNB_CAP_FS_96000 | LVEQNB_CAP_FS_176400 |
LVEQNB_CAP_FS_192000;
-#else
- EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 | LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 | LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000;
-#endif
EQNB_Capabilities.SourceFormat = LVEQNB_CAP_STEREO | LVEQNB_CAP_MONOINSTEREO;
EQNB_Capabilities.MaxBlockSize = InternalBlockSize;
EQNB_Capabilities.MaxBands = pInstParams->EQNB_NumBands;
@@ -388,7 +371,6 @@
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
(LVM_HEADROOM_MAX_NBANDS * sizeof(LVM_HeadroomBandDef_t)));
-
/*
* Spectrum Analyzer memory requirements
*/
@@ -441,13 +423,8 @@
PSA_MemTab.Region[LVM_PERSISTENT_FAST_COEF].Size);
/* Fast Temporary */
-#ifdef BUILD_FLOAT
InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_FLOAT));
-#else
- InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
- MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_INT16));
-#endif
if (PSA_MemTab.Region[LVM_TEMPORARY_FAST].Size > AlgScratchSize)
{
@@ -493,7 +470,6 @@
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_GetInstanceHandle */
@@ -529,7 +505,6 @@
LVM_UINT16 InternalBlockSize;
LVM_INT32 BundleScratchSize;
-
/*
* Check valid points have been given
*/
@@ -592,7 +567,6 @@
pMemoryTable->Region[i].pBaseAddress);
}
-
/*
* Set the instance handle
*/
@@ -600,14 +574,12 @@
sizeof(LVM_Instance_t));
pInstance =(LVM_Instance_t *)*phInstance;
-
/*
* Save the memory table, parameters and capabilities
*/
pInstance->MemoryTable = *pMemoryTable;
pInstance->InstParams = *pInstParams;
-
/*
* Set the bundle scratch memory and initialse the buffer management
*/
@@ -624,7 +596,6 @@
}
pInstance->InternalBlockSize = (LVM_INT16)InternalBlockSize;
-
/*
* Common settings for managed and unmanaged buffers
*/
@@ -637,33 +608,22 @@
pInstance->pBufferManagement = (LVM_Buffer_t *)
InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
sizeof(LVM_Buffer_t));
-#ifdef BUILD_FLOAT
BundleScratchSize = (LVM_INT32)
(3 * LVM_MAX_CHANNELS \
* (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) \
* sizeof(LVM_FLOAT));
-#else
- BundleScratchSize = (LVM_INT32)(6 * (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) * sizeof(LVM_INT16));
-#endif
pInstance->pBufferManagement->pScratch = (LVM_FLOAT *)
InstAlloc_AddMember(
&AllocMem[LVM_MEMREGION_TEMPORARY_FAST], /* Scratch 1 buffer */
(LVM_UINT32)BundleScratchSize);
-#ifdef BUILD_FLOAT
LoadConst_Float(0, /* Clear the input delay buffer */
(LVM_FLOAT *)&pInstance->pBufferManagement->InDelayBuffer,
(LVM_INT16)(LVM_MAX_CHANNELS * MIN_INTERNAL_BLOCKSIZE));
-#else
- LoadConst_16(0, /* Clear the input delay buffer */
- (LVM_INT16 *)&pInstance->pBufferManagement->InDelayBuffer,
- (LVM_INT16)(2 * MIN_INTERNAL_BLOCKSIZE));
-#endif
pInstance->pBufferManagement->InDelaySamples = MIN_INTERNAL_BLOCKSIZE; /* Set the number of delay samples */
pInstance->pBufferManagement->OutDelaySamples = 0; /* No samples in the output buffer */
pInstance->pBufferManagement->BufferState = LVM_FIRSTCALL; /* Set the state ready for the first call */
}
-
/*
* Set default parameters
*/
@@ -679,7 +639,6 @@
*/
pInstance->CallBack = LVM_AlgoCallBack;
-
/*
* DC removal filter
*/
@@ -701,7 +660,6 @@
pInstance->Params.TE_EffectLevel = 0;
pInstance->TE_Active = LVM_FALSE;
-
/*
* Set the volume control and initialise Current to Target
*/
@@ -713,26 +671,14 @@
/* In managed buffering, start with low signal level as delay in buffer management causes a click*/
if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS)
{
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0], 0, 0);
-#else
- LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0],0,0);
-#endif
}
else
{
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0], LVM_MAXFLOAT, LVM_MAXFLOAT);
-#else
- LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0],LVM_MAXINT_16,LVM_MAXINT_16);
-#endif
}
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],0,LVM_FS_8000,2);
-#else
- LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0], 0, LVM_FS_8000, 2);
-#endif
pInstance->VC_VolumedB = 0;
pInstance->VC_AVLFixedVolume = 0;
@@ -742,22 +688,14 @@
pInstance->VC_BalanceMix.MixerStream[0].CallbackSet = 0;
pInstance->VC_BalanceMix.MixerStream[0].pCallbackHandle = pInstance;
pInstance->VC_BalanceMix.MixerStream[0].pCallBack = LVM_VCCallBack;
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[0], LVM_MAXFLOAT, LVM_MAXFLOAT);
-#else
- LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[0],LVM_MAXINT_16,LVM_MAXINT_16);
-#endif
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LVM_FS_8000,2);
pInstance->VC_BalanceMix.MixerStream[1].CallbackParam = 0;
pInstance->VC_BalanceMix.MixerStream[1].CallbackSet = 0;
pInstance->VC_BalanceMix.MixerStream[1].pCallbackHandle = pInstance;
pInstance->VC_BalanceMix.MixerStream[1].pCallBack = LVM_VCCallBack;
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[1], LVM_MAXFLOAT, LVM_MAXFLOAT);
-#else
- LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[1],LVM_MAXINT_16,LVM_MAXINT_16);
-#endif
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LVM_FS_8000,2);
/*
@@ -770,7 +708,6 @@
(LVM_EQNB_BandDef_t *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
(pInstParams->EQNB_NumBands * sizeof(LVM_EQNB_BandDef_t)));
-
/*
* Initialise the Concert Sound module
*/
@@ -795,7 +732,6 @@
CS_Capabilities.CallBack = pInstance->CallBack;
CS_Capabilities.pBundleInstance = (void*)pInstance;
-
/*
* Get the memory requirements and then set the address pointers, forcing alignment
*/
@@ -831,7 +767,6 @@
LVDBE_Capabilities_t DBE_Capabilities; /* Initial capabilities */
LVDBE_ReturnStatus_en LVDBE_Status; /* Function call status */
-
/*
* Set the initialisation parameters
*/
@@ -842,12 +777,9 @@
pInstance->DBE_Active = LVM_FALSE;
-
-
/*
* Set the initialisation capabilities
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 |
LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 |
LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 |
@@ -855,13 +787,9 @@
LVDBE_CAP_FS_48000 | LVDBE_CAP_FS_88200 |
LVDBE_CAP_FS_96000 | LVDBE_CAP_FS_176400 |
LVDBE_CAP_FS_192000;
-#else
- DBE_Capabilities.SampleRate = LVDBE_CAP_FS_8000 | LVDBE_CAP_FS_11025 | LVDBE_CAP_FS_12000 | LVDBE_CAP_FS_16000 | LVDBE_CAP_FS_22050 | LVDBE_CAP_FS_24000 | LVDBE_CAP_FS_32000 | LVDBE_CAP_FS_44100 | LVDBE_CAP_FS_48000;
-#endif
DBE_Capabilities.CentreFrequency = LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_55Hz | LVDBE_CAP_CENTRE_66Hz | LVDBE_CAP_CENTRE_78Hz | LVDBE_CAP_CENTRE_90Hz;
DBE_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
-
/*
* Get the memory requirements and then set the address pointers
*/
@@ -876,7 +804,6 @@
DBE_MemTab.Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST],
0);
-
/*
* Initialise the Dynamic Bass Enhancement instance and save the instance handle
*/
@@ -888,7 +815,6 @@
pInstance->hDBEInstance = hDBEInstance; /* Save the instance handle */
}
-
/*
* Initialise the N-Band Equaliser module
*/
@@ -898,7 +824,6 @@
LVEQNB_Capabilities_t EQNB_Capabilities; /* Initial capabilities */
LVEQNB_ReturnStatus_en LVEQNB_Status; /* Function call status */
-
/*
* Set the initialisation parameters
*/
@@ -907,11 +832,9 @@
pInstance->Params.pEQNB_BandDefinition = LVM_NULL;
pInstance->EQNB_Active = LVM_FALSE;
-
/*
* Set the initialisation capabilities
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 |
LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 |
LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 |
@@ -919,16 +842,12 @@
LVEQNB_CAP_FS_48000 | LVEQNB_CAP_FS_88200 |
LVEQNB_CAP_FS_96000 | LVEQNB_CAP_FS_176400 |
LVEQNB_CAP_FS_192000;
-#else
- EQNB_Capabilities.SampleRate = LVEQNB_CAP_FS_8000 | LVEQNB_CAP_FS_11025 | LVEQNB_CAP_FS_12000 | LVEQNB_CAP_FS_16000 | LVEQNB_CAP_FS_22050 | LVEQNB_CAP_FS_24000 | LVEQNB_CAP_FS_32000 | LVEQNB_CAP_FS_44100 | LVEQNB_CAP_FS_48000;
-#endif
EQNB_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
EQNB_Capabilities.MaxBands = pInstParams->EQNB_NumBands;
EQNB_Capabilities.SourceFormat = LVEQNB_CAP_STEREO | LVEQNB_CAP_MONOINSTEREO;
EQNB_Capabilities.CallBack = pInstance->CallBack;
EQNB_Capabilities.pBundleInstance = (void*)pInstance;
-
/*
* Get the memory requirements and then set the address pointers, forcing alignment
*/
@@ -943,7 +862,6 @@
EQNB_MemTab.Region[LVEQNB_MEMREGION_SCRATCH].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST],
0);
-
/*
* Initialise the Dynamic Bass Enhancement instance and save the instance handle
*/
@@ -980,7 +898,6 @@
pInstance->Headroom =0;
}
-
/*
* Initialise the PSA module
*/
@@ -1017,28 +934,20 @@
PSA_MemTab.Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_SLOW_DATA],
PSA_MemTab.Region[LVM_PERSISTENT_SLOW_DATA].Size);
-
/* Fast Data */
PSA_MemTab.Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_DATA],
PSA_MemTab.Region[LVM_PERSISTENT_FAST_DATA].Size);
-
/* Fast Coef */
PSA_MemTab.Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_PERSISTENT_FAST_COEF],
PSA_MemTab.Region[LVM_PERSISTENT_FAST_COEF].Size);
/* Fast Temporary */
-#ifdef BUILD_FLOAT
pInstance->pPSAInput = (LVM_FLOAT *)InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
(LVM_UINT32) MAX_INTERNAL_BLOCKSIZE * \
sizeof(LVM_FLOAT));
-#else
- pInstance->pPSAInput = InstAlloc_AddMember(&AllocMem[LVM_TEMPORARY_FAST],
- (LVM_UINT32) MAX_INTERNAL_BLOCKSIZE * sizeof(LVM_INT16));
-#endif
PSA_MemTab.Region[LVM_TEMPORARY_FAST].pBaseAddress = (void *)InstAlloc_AddMember(&AllocMem[LVM_MEMREGION_TEMPORARY_FAST],0);
-
/*Initialise PSA instance and save the instance handle*/
pInstance->PSA_ControlParams.Fs = LVM_FS_48000;
pInstance->PSA_ControlParams.LevelDetectionSpeed = LVPSA_SPEED_MEDIUM;
@@ -1073,7 +982,6 @@
*/
pInstance->NewParams = pInstance->Params;
-
/*
* Create configuration number
*/
@@ -1100,7 +1008,6 @@
return(Status);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVM_ClearAudioBuffers */
@@ -1128,7 +1035,6 @@
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance; /* Pointer to Instance */
LVM_HeadroomParams_t HeadroomParams;
-
if(hInstance == LVM_NULL){
return LVM_NULLADDRESS;
}
@@ -1166,5 +1072,3 @@
return LVM_SUCCESS;
}
-
-
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
index 2bae702..ddaac99 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
@@ -27,8 +27,6 @@
#ifndef __LVM_PRIVATE_H__
#define __LVM_PRIVATE_H__
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -44,7 +42,6 @@
#include "LVEQNB_Private.h" /* N-Band equaliser */
#include "LVPSA_Private.h" /* Parametric Spectrum Analyzer */
-
/************************************************************************************/
/* */
/* Defines */
@@ -110,7 +107,6 @@
#define LVM_TE_MASK 32
#define LVM_PSA_MASK 2048
-
/************************************************************************************/
/* */
/* Structures */
@@ -126,16 +122,13 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVM_IntMemoryRegion_t;
-
/* Memory table containing the region definitions */
typedef struct
{
LVM_IntMemoryRegion_t Region[LVM_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVM_IntMemTab_t;
-
/* Buffer Management */
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT *pScratch; /* Bundle scratch buffer */
@@ -158,39 +151,17 @@
left and right */
LVM_INT16 SamplesToOutput; /* Samples to write to the output */
} LVM_Buffer_t;
-#else
-typedef struct
-{
- LVM_INT16 *pScratch; /* Bundle scratch buffer */
-
- LVM_INT16 BufferState; /* Buffer status */
- LVM_INT16 InDelayBuffer[6*MIN_INTERNAL_BLOCKSIZE]; /* Input buffer delay line, left and right */
- LVM_INT16 InDelaySamples; /* Number of samples in the input delay buffer */
-
- LVM_INT16 OutDelayBuffer[2*MIN_INTERNAL_BLOCKSIZE]; /* Output buffer delay line */
- LVM_INT16 OutDelaySamples; /* Number of samples in the output delay buffer, left and right */
- LVM_INT16 SamplesToOutput; /* Samples to write to the output */
-} LVM_Buffer_t;
-#endif
/* Filter taps */
typedef struct
{
-#ifdef BUILD_FLOAT
Biquad_2I_Order1_FLOAT_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
-#else
- Biquad_2I_Order1_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
-#endif
} LVM_TE_Data_t;
/* Coefficients */
typedef struct
{
-#ifdef BUILD_FLOAT
Biquad_FLOAT_Instance_t TrebleBoost_State; /* State for the treble boost filter */
-#else
- Biquad_Instance_t TrebleBoost_State; /* State for the treble boost filter */
-#endif
} LVM_TE_Coefs_t;
typedef struct
@@ -208,24 +179,15 @@
LVM_INT16 InternalBlockSize; /* Maximum internal block size */
LVM_Buffer_t *pBufferManagement; /* Buffer management variables */
LVM_INT16 SamplesToProcess; /* Input samples left to process */
-#ifdef BUILD_FLOAT
LVM_FLOAT *pInputSamples; /* External input sample pointer */
LVM_FLOAT *pOutputSamples; /* External output sample pointer */
-#else
- LVM_INT16 *pInputSamples; /* External input sample pointer */
- LVM_INT16 *pOutputSamples; /* External output sample pointer */
-#endif
/* Configuration number */
LVM_INT32 ConfigurationNumber;
LVM_INT32 BlickSizeMultiple;
/* DC removal */
-#ifdef BUILD_FLOAT
Biquad_FLOAT_Instance_t DC_RemovalInstance; /* DC removal filter instance */
-#else
- Biquad_Instance_t DC_RemovalInstance; /* DC removal filter instance */
-#endif
/* Concert Sound */
LVCS_Handle_t hCSInstance; /* Concert Sound instance handle */
@@ -245,16 +207,8 @@
LVM_INT16 DBE_Active; /* Control flag */
/* Volume Control */
-#ifdef BUILD_FLOAT
LVMixer3_1St_FLOAT_st VC_Volume; /* Volume scaler */
-#else
- LVMixer3_1St_st VC_Volume; /* Volume scaler */
-#endif
-#ifdef BUILD_FLOAT
LVMixer3_2St_FLOAT_st VC_BalanceMix; /* VC balance mixer */
-#else
- LVMixer3_2St_st VC_BalanceMix; /* VC balance mixer */
-#endif
LVM_INT16 VC_VolumedB; /* Gain in dB */
LVM_INT16 VC_Active; /* Control flag */
LVM_INT16 VC_AVLFixedVolume; /* AVL fixed volume */
@@ -278,11 +232,7 @@
LVPSA_ControlParams_t PSA_ControlParams; /* Spectrum Analyzer control parameters */
LVM_INT16 PSA_GainOffset; /* Tone control flag */
LVM_Callback CallBack;
-#ifdef BUILD_FLOAT
LVM_FLOAT *pPSAInput; /* PSA input pointer */
-#else
- LVM_INT16 *pPSAInput; /* PSA input pointer */
-#endif
LVM_INT16 NoSmoothVolume; /* Enable or disable smooth volume changes*/
@@ -293,7 +243,6 @@
} LVM_Instance_t;
-
/************************************************************************************/
/* */
/* Function Prototypes */
@@ -314,33 +263,18 @@
void LVM_SetHeadroom( LVM_Instance_t *pInstance,
LVM_ControlParams_t *pParams);
-#ifdef BUILD_FLOAT
void LVM_BufferIn( LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT **pToProcess,
LVM_FLOAT **pProcessed,
LVM_UINT16 *pNumSamples);
-#else
-void LVM_BufferIn( LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 **pToProcess,
- LVM_INT16 **pProcessed,
- LVM_UINT16 *pNumSamples);
-#endif
-#ifdef BUILD_FLOAT
void LVM_BufferOut( LVM_Handle_t hInstance,
LVM_FLOAT *pOutData,
LVM_UINT16 *pNumSamples);
-#else
-void LVM_BufferOut( LVM_Handle_t hInstance,
- LVM_INT16 *pOutData,
- LVM_UINT16 *pNumSamples);
-#endif
LVM_INT32 LVM_AlgoCallBack( void *pBundleHandle,
void *pData,
LVM_INT16 callbackId);
-
#endif /* __LVM_PRIVATE_H__ */
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp
index bc666a9..dc86cfd 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -52,7 +51,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -80,7 +78,6 @@
return(LVM_SUCCESS);
}
-
/*
* Check valid points have been given
*/
@@ -111,7 +108,6 @@
}
}
-
/*
* Update new parameters if necessary
*/
@@ -130,7 +126,6 @@
}
}
-
/*
* Convert from Mono if necessary
*/
@@ -147,7 +142,6 @@
#endif
}
-
/*
* Process the data with managed buffers
*/
@@ -333,226 +327,3 @@
return(LVM_SUCCESS);
}
-#else
-LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples,
- LVM_UINT32 AudioTime)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_UINT16 SampleCount = NumSamples;
- LVM_INT16 *pInput = (LVM_INT16 *)pInData;
- LVM_INT16 *pToProcess = (LVM_INT16 *)pInData;
- LVM_INT16 *pProcessed = pOutData;
- LVM_ReturnStatus_en Status;
-
- /*
- * Check if the number of samples is zero
- */
- if (NumSamples == 0)
- {
- return(LVM_SUCCESS);
- }
-
-
- /*
- * Check valid points have been given
- */
- if ((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
- {
- return (LVM_NULLADDRESS);
- }
-
- /*
- * For unmanaged mode only
- */
- if(pInstance->InstParams.BufferMode == LVM_UNMANAGED_BUFFERS)
- {
- /*
- * Check if the number of samples is a good multiple (unmanaged mode only)
- */
- if((NumSamples % pInstance->BlickSizeMultiple) != 0)
- {
- return(LVM_INVALIDNUMSAMPLES);
- }
-
- /*
- * Check the buffer alignment
- */
- if((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0))
- {
- return(LVM_ALIGNMENTERROR);
- }
- }
-
-
- /*
- * Update new parameters if necessary
- */
- if (pInstance->ControlPending == LVM_TRUE)
- {
- Status = LVM_ApplyNewSettings(hInstance);
-
- if(Status != LVM_SUCCESS)
- {
- return Status;
- }
- }
-
-
- /*
- * Convert from Mono if necessary
- */
- if (pInstance->Params.SourceFormat == LVM_MONO)
- {
- MonoTo2I_16(pInData, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)NumSamples); /* Number of input samples */
- pInput = pOutData;
- pToProcess = pOutData;
- }
-
-
- /*
- * Process the data with managed buffers
- */
- while (SampleCount != 0)
- {
- /*
- * Manage the input buffer and frame processing
- */
- LVM_BufferIn(hInstance,
- pInput,
- &pToProcess,
- &pProcessed,
- &SampleCount);
-
- /*
- * Only process data when SampleCount is none zero, a zero count can occur when
- * the BufferIn routine is working in managed mode.
- */
- if (SampleCount != 0)
- {
-
- /*
- * Apply ConcertSound if required
- */
- if (pInstance->CS_Active == LVM_TRUE)
- {
- (void)LVCS_Process(pInstance->hCSInstance, /* Concert Sound instance handle */
- pToProcess,
- pProcessed,
- SampleCount);
- pToProcess = pProcessed;
- }
-
- /*
- * Apply volume if required
- */
- if (pInstance->VC_Active!=0)
- {
- LVC_MixSoft_1St_D16C31_SAT(&pInstance->VC_Volume,
- pToProcess,
- pProcessed,
- (LVM_INT16)(2*SampleCount)); /* Left and right*/
- pToProcess = pProcessed;
- }
-
- /*
- * Call N-Band equaliser if enabled
- */
- if (pInstance->EQNB_Active == LVM_TRUE)
- {
- LVEQNB_Process(pInstance->hEQNBInstance, /* N-Band equaliser instance handle */
- pToProcess,
- pProcessed,
- SampleCount);
- pToProcess = pProcessed;
- }
-
- /*
- * Call bass enhancement if enabled
- */
- if (pInstance->DBE_Active == LVM_TRUE)
- {
- LVDBE_Process(pInstance->hDBEInstance, /* Dynamic Bass Enhancement instance handle */
- pToProcess,
- pProcessed,
- SampleCount);
- pToProcess = pProcessed;
- }
-
- /*
- * Bypass mode or everything off, so copy the input to the output
- */
- if (pToProcess != pProcessed)
- {
- Copy_16(pToProcess, /* Source */
- pProcessed, /* Destination */
- (LVM_INT16)(2*SampleCount)); /* Left and right */
- }
-
- /*
- * Apply treble boost if required
- */
- if (pInstance->TE_Active == LVM_TRUE)
- {
- /*
- * Apply the filter
- */
- FO_2I_D16F32C15_LShx_TRC_WRA_01(&pInstance->pTE_State->TrebleBoost_State,
- pProcessed,
- pProcessed,
- (LVM_INT16)SampleCount);
-
- }
-
- /*
- * Volume balance
- */
- LVC_MixSoft_1St_2i_D16C31_SAT(&pInstance->VC_BalanceMix,
- pProcessed,
- pProcessed,
- SampleCount);
-
- /*
- * Perform Parametric Spectum Analysis
- */
- if ((pInstance->Params.PSA_Enable == LVM_PSA_ON)&&(pInstance->InstParams.PSA_Included==LVM_PSA_ON))
- {
- From2iToMono_16(pProcessed,
- pInstance->pPSAInput,
- (LVM_INT16) (SampleCount));
-
- LVPSA_Process(pInstance->hPSAInstance,
- pInstance->pPSAInput,
- (LVM_UINT16) (SampleCount),
- AudioTime);
- }
-
-
- /*
- * DC removal
- */
- DC_2I_D16_TRC_WRA_01(&pInstance->DC_RemovalInstance,
- pProcessed,
- pProcessed,
- (LVM_INT16)SampleCount);
-
-
- }
-
- /*
- * Manage the output buffer
- */
- LVM_BufferOut(hInstance,
- pOutData,
- &SampleCount);
-
- }
-
- return(LVM_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
index a5356d2..66392e2 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
@@ -29,7 +29,6 @@
/* Treble Boost Filter Coefficients */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
@@ -267,7 +266,6 @@
{HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
HPF_Fs48000_Gain15_A0,
-HPF_Fs48000_Gain15_B1}
-#ifdef HIGHER_FS
,
/* 88kHz Sampling rate */
{HPF_Fs88200_Gain1_A1, /* Gain Setting 1 */
@@ -456,322 +454,7 @@
{HPF_Fs192000_Gain15_A1, /* Gain setting 15 */
HPF_Fs192000_Gain15_A0,
-HPF_Fs192000_Gain15_B1}
-#endif
};
-#else
-FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
-
- /* 22kHz sampling rate */
- {HPF_Fs22050_Gain1_A1, /* Gain setting 1 */
- HPF_Fs22050_Gain1_A0,
- -HPF_Fs22050_Gain1_B1,
- HPF_Fs22050_Gain1_Shift},
- {HPF_Fs22050_Gain2_A1, /* Gain setting 2 */
- HPF_Fs22050_Gain2_A0,
- -HPF_Fs22050_Gain2_B1,
- HPF_Fs22050_Gain2_Shift},
- {HPF_Fs22050_Gain3_A1, /* Gain setting 3 */
- HPF_Fs22050_Gain3_A0,
- -HPF_Fs22050_Gain3_B1,
- HPF_Fs22050_Gain3_Shift},
- {HPF_Fs22050_Gain4_A1, /* Gain setting 4 */
- HPF_Fs22050_Gain4_A0,
- -HPF_Fs22050_Gain4_B1,
- HPF_Fs22050_Gain4_Shift},
- {HPF_Fs22050_Gain5_A1, /* Gain setting 5 */
- HPF_Fs22050_Gain5_A0,
- -HPF_Fs22050_Gain5_B1,
- HPF_Fs22050_Gain5_Shift},
- {HPF_Fs22050_Gain6_A1, /* Gain setting 6 */
- HPF_Fs22050_Gain6_A0,
- -HPF_Fs22050_Gain6_B1,
- HPF_Fs22050_Gain6_Shift},
- {HPF_Fs22050_Gain7_A1, /* Gain setting 7 */
- HPF_Fs22050_Gain7_A0,
- -HPF_Fs22050_Gain7_B1,
- HPF_Fs22050_Gain7_Shift},
- {HPF_Fs22050_Gain8_A1, /* Gain setting 8 */
- HPF_Fs22050_Gain8_A0,
- -HPF_Fs22050_Gain8_B1,
- HPF_Fs22050_Gain8_Shift},
- {HPF_Fs22050_Gain9_A1, /* Gain setting 9 */
- HPF_Fs22050_Gain9_A0,
- -HPF_Fs22050_Gain9_B1,
- HPF_Fs22050_Gain9_Shift},
- {HPF_Fs22050_Gain10_A1, /* Gain setting 10 */
- HPF_Fs22050_Gain10_A0,
- -HPF_Fs22050_Gain10_B1,
- HPF_Fs22050_Gain10_Shift},
- {HPF_Fs22050_Gain11_A1, /* Gain setting 11 */
- HPF_Fs22050_Gain11_A0,
- -HPF_Fs22050_Gain11_B1,
- HPF_Fs22050_Gain11_Shift},
- {HPF_Fs22050_Gain12_A1, /* Gain setting 12 */
- HPF_Fs22050_Gain12_A0,
- -HPF_Fs22050_Gain12_B1,
- HPF_Fs22050_Gain12_Shift},
- {HPF_Fs22050_Gain13_A1, /* Gain setting 13 */
- HPF_Fs22050_Gain13_A0,
- -HPF_Fs22050_Gain13_B1,
- HPF_Fs22050_Gain13_Shift},
- {HPF_Fs22050_Gain14_A1, /* Gain setting 14 */
- HPF_Fs22050_Gain14_A0,
- -HPF_Fs22050_Gain14_B1,
- HPF_Fs22050_Gain14_Shift},
- {HPF_Fs22050_Gain15_A1, /* Gain setting 15 */
- HPF_Fs22050_Gain15_A0,
- -HPF_Fs22050_Gain15_B1,
- HPF_Fs22050_Gain15_Shift},
-
- /* 24kHz sampling rate */
- {HPF_Fs24000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs24000_Gain1_A0,
- -HPF_Fs24000_Gain1_B1,
- HPF_Fs24000_Gain1_Shift},
- {HPF_Fs24000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs24000_Gain2_A0,
- -HPF_Fs24000_Gain2_B1,
- HPF_Fs24000_Gain2_Shift},
- {HPF_Fs24000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs24000_Gain3_A0,
- -HPF_Fs24000_Gain3_B1,
- HPF_Fs24000_Gain3_Shift},
- {HPF_Fs24000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs24000_Gain4_A0,
- -HPF_Fs24000_Gain4_B1,
- HPF_Fs24000_Gain4_Shift},
- {HPF_Fs24000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs24000_Gain5_A0,
- -HPF_Fs24000_Gain5_B1,
- HPF_Fs24000_Gain5_Shift},
- {HPF_Fs24000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs24000_Gain6_A0,
- -HPF_Fs24000_Gain6_B1,
- HPF_Fs24000_Gain6_Shift},
- {HPF_Fs24000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs24000_Gain7_A0,
- -HPF_Fs24000_Gain7_B1,
- HPF_Fs24000_Gain7_Shift},
- {HPF_Fs24000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs24000_Gain8_A0,
- -HPF_Fs24000_Gain8_B1,
- HPF_Fs24000_Gain8_Shift},
- {HPF_Fs24000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs24000_Gain9_A0,
- -HPF_Fs24000_Gain9_B1,
- HPF_Fs24000_Gain9_Shift},
- {HPF_Fs24000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs24000_Gain10_A0,
- -HPF_Fs24000_Gain10_B1,
- HPF_Fs24000_Gain10_Shift},
- {HPF_Fs24000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs24000_Gain11_A0,
- -HPF_Fs24000_Gain11_B1,
- HPF_Fs24000_Gain11_Shift},
- {HPF_Fs24000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs24000_Gain12_A0,
- -HPF_Fs24000_Gain12_B1,
- HPF_Fs24000_Gain12_Shift},
- {HPF_Fs24000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs24000_Gain13_A0,
- -HPF_Fs24000_Gain13_B1,
- HPF_Fs24000_Gain13_Shift},
- {HPF_Fs24000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs24000_Gain14_A0,
- -HPF_Fs24000_Gain14_B1,
- HPF_Fs24000_Gain14_Shift},
- {HPF_Fs24000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs24000_Gain15_A0,
- -HPF_Fs24000_Gain15_B1,
- HPF_Fs24000_Gain15_Shift},
-
- /* 32kHz sampling rate */
- {HPF_Fs32000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs32000_Gain1_A0,
- -HPF_Fs32000_Gain1_B1,
- HPF_Fs32000_Gain1_Shift},
- {HPF_Fs32000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs32000_Gain2_A0,
- -HPF_Fs32000_Gain2_B1,
- HPF_Fs32000_Gain2_Shift},
- {HPF_Fs32000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs32000_Gain3_A0,
- -HPF_Fs32000_Gain3_B1,
- HPF_Fs32000_Gain3_Shift},
- {HPF_Fs32000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs32000_Gain4_A0,
- -HPF_Fs32000_Gain4_B1,
- HPF_Fs32000_Gain4_Shift},
- {HPF_Fs32000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs32000_Gain5_A0,
- -HPF_Fs32000_Gain5_B1,
- HPF_Fs32000_Gain5_Shift},
- {HPF_Fs32000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs32000_Gain6_A0,
- -HPF_Fs32000_Gain6_B1,
- HPF_Fs32000_Gain6_Shift},
- {HPF_Fs32000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs32000_Gain7_A0,
- -HPF_Fs32000_Gain7_B1,
- HPF_Fs32000_Gain7_Shift},
- {HPF_Fs32000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs32000_Gain8_A0,
- -HPF_Fs32000_Gain8_B1,
- HPF_Fs32000_Gain8_Shift},
- {HPF_Fs32000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs32000_Gain9_A0,
- -HPF_Fs32000_Gain9_B1,
- HPF_Fs32000_Gain9_Shift},
- {HPF_Fs32000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs32000_Gain10_A0,
- -HPF_Fs32000_Gain10_B1,
- HPF_Fs32000_Gain10_Shift},
- {HPF_Fs32000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs32000_Gain11_A0,
- -HPF_Fs32000_Gain11_B1,
- HPF_Fs32000_Gain11_Shift},
- {HPF_Fs32000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs32000_Gain12_A0,
- -HPF_Fs32000_Gain12_B1,
- HPF_Fs32000_Gain12_Shift},
- {HPF_Fs32000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs32000_Gain13_A0,
- -HPF_Fs32000_Gain13_B1,
- HPF_Fs32000_Gain13_Shift},
- {HPF_Fs32000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs32000_Gain14_A0,
- -HPF_Fs32000_Gain14_B1,
- HPF_Fs32000_Gain14_Shift},
- {HPF_Fs32000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs32000_Gain15_A0,
- -HPF_Fs32000_Gain15_B1,
- HPF_Fs32000_Gain15_Shift},
-
- /* 44kHz sampling rate */
- {HPF_Fs44100_Gain1_A1, /* Gain setting 1 */
- HPF_Fs44100_Gain1_A0,
- -HPF_Fs44100_Gain1_B1,
- HPF_Fs44100_Gain1_Shift},
- {HPF_Fs44100_Gain2_A1, /* Gain setting 2 */
- HPF_Fs44100_Gain2_A0,
- -HPF_Fs44100_Gain2_B1,
- HPF_Fs44100_Gain2_Shift},
- {HPF_Fs44100_Gain3_A1, /* Gain setting 3 */
- HPF_Fs44100_Gain3_A0,
- -HPF_Fs44100_Gain3_B1,
- HPF_Fs44100_Gain3_Shift},
- {HPF_Fs44100_Gain4_A1, /* Gain setting 4 */
- HPF_Fs44100_Gain4_A0,
- -HPF_Fs44100_Gain4_B1,
- HPF_Fs44100_Gain4_Shift},
- {HPF_Fs44100_Gain5_A1, /* Gain setting 5 */
- HPF_Fs44100_Gain5_A0,
- -HPF_Fs44100_Gain5_B1,
- HPF_Fs44100_Gain5_Shift},
- {HPF_Fs44100_Gain6_A1, /* Gain setting 6 */
- HPF_Fs44100_Gain6_A0,
- -HPF_Fs44100_Gain6_B1,
- HPF_Fs44100_Gain6_Shift},
- {HPF_Fs44100_Gain7_A1, /* Gain setting 7 */
- HPF_Fs44100_Gain7_A0,
- -HPF_Fs44100_Gain7_B1,
- HPF_Fs44100_Gain7_Shift},
- {HPF_Fs44100_Gain8_A1, /* Gain setting 8 */
- HPF_Fs44100_Gain8_A0,
- -HPF_Fs44100_Gain8_B1,
- HPF_Fs44100_Gain8_Shift},
- {HPF_Fs44100_Gain9_A1, /* Gain setting 9 */
- HPF_Fs44100_Gain9_A0,
- -HPF_Fs44100_Gain9_B1,
- HPF_Fs44100_Gain9_Shift},
- {HPF_Fs44100_Gain10_A1, /* Gain setting 10 */
- HPF_Fs44100_Gain10_A0,
- -HPF_Fs44100_Gain10_B1,
- HPF_Fs44100_Gain10_Shift},
- {HPF_Fs44100_Gain11_A1, /* Gain setting 11 */
- HPF_Fs44100_Gain11_A0,
- -HPF_Fs44100_Gain11_B1,
- HPF_Fs44100_Gain11_Shift},
- {HPF_Fs44100_Gain12_A1, /* Gain setting 12 */
- HPF_Fs44100_Gain12_A0,
- -HPF_Fs44100_Gain12_B1,
- HPF_Fs44100_Gain12_Shift},
- {HPF_Fs44100_Gain13_A1, /* Gain setting 13 */
- HPF_Fs44100_Gain13_A0,
- -HPF_Fs44100_Gain13_B1,
- HPF_Fs44100_Gain13_Shift},
- {HPF_Fs44100_Gain14_A1, /* Gain setting 14 */
- HPF_Fs44100_Gain14_A0,
- -HPF_Fs44100_Gain14_B1,
- HPF_Fs44100_Gain14_Shift},
- {HPF_Fs44100_Gain15_A1, /* Gain setting 15 */
- HPF_Fs44100_Gain15_A0,
- -HPF_Fs44100_Gain15_B1,
- HPF_Fs44100_Gain15_Shift},
-
- /* 48kHz sampling rate */
- {HPF_Fs48000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs48000_Gain1_A0,
- -HPF_Fs48000_Gain1_B1,
- HPF_Fs48000_Gain1_Shift},
- {HPF_Fs48000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs48000_Gain2_A0,
- -HPF_Fs48000_Gain2_B1,
- HPF_Fs48000_Gain2_Shift},
- {HPF_Fs48000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs48000_Gain3_A0,
- -HPF_Fs48000_Gain3_B1,
- HPF_Fs48000_Gain3_Shift},
- {HPF_Fs48000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs48000_Gain4_A0,
- -HPF_Fs48000_Gain4_B1,
- HPF_Fs48000_Gain4_Shift},
- {HPF_Fs48000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs48000_Gain5_A0,
- -HPF_Fs48000_Gain5_B1,
- HPF_Fs48000_Gain5_Shift},
- {HPF_Fs48000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs48000_Gain6_A0,
- -HPF_Fs48000_Gain6_B1,
- HPF_Fs48000_Gain6_Shift},
- {HPF_Fs48000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs48000_Gain7_A0,
- -HPF_Fs48000_Gain7_B1,
- HPF_Fs48000_Gain7_Shift},
- {HPF_Fs48000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs48000_Gain8_A0,
- -HPF_Fs48000_Gain8_B1,
- HPF_Fs48000_Gain8_Shift},
- {HPF_Fs48000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs48000_Gain9_A0,
- -HPF_Fs48000_Gain9_B1,
- HPF_Fs48000_Gain9_Shift},
- {HPF_Fs48000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs48000_Gain10_A0,
- -HPF_Fs48000_Gain10_B1,
- HPF_Fs48000_Gain10_Shift},
- {HPF_Fs48000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs48000_Gain11_A0,
- -HPF_Fs48000_Gain11_B1,
- HPF_Fs48000_Gain11_Shift},
- {HPF_Fs48000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs48000_Gain12_A0,
- -HPF_Fs48000_Gain12_B1,
- HPF_Fs48000_Gain12_Shift},
- {HPF_Fs48000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs48000_Gain13_A0,
- -HPF_Fs48000_Gain13_B1,
- HPF_Fs48000_Gain13_Shift},
- {HPF_Fs48000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs48000_Gain14_A0,
- -HPF_Fs48000_Gain14_B1,
- HPF_Fs48000_Gain14_Shift},
- {HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs48000_Gain15_A0,
- -HPF_Fs48000_Gain15_B1,
- HPF_Fs48000_Gain15_Shift}
- };
-#endif
/************************************************************************************/
/* */
@@ -780,7 +463,6 @@
/************************************************************************************/
/* dB to linear conversion table */
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVM_VolumeTable[] = {
1.000f, /* 0dB */
0.891f, /* -1dB */
@@ -789,16 +471,6 @@
0.631f, /* -4dB */
0.562f, /* -5dB */
0.501f}; /* -6dB */
-#else
-const LVM_INT16 LVM_VolumeTable[] = {
- 0x7FFF, /* 0dB */
- 0x7215, /* -1dB */
- 0x65AD, /* -2dB */
- 0x5A9E, /* -3dB */
- 0x50C3, /* -4dB */
- 0x47FB, /* -5dB */
- 0x4000}; /* -6dB */
-#endif
/************************************************************************************/
/* */
@@ -816,7 +488,6 @@
#define LVM_MIX_TC_Fs44100 32734 /* Floating point value 0.998962402 */
#define LVM_MIX_TC_Fs48000 32737 /* Floating point value 0.999053955 */
-
const LVM_INT16 LVM_MixerTCTable[] = {
LVM_MIX_TC_Fs8000,
LVM_MIX_TC_Fs11025,
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
index 3fd2f89..fc82194 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
@@ -18,7 +18,6 @@
#ifndef __LVM_TABLES_H__
#define __LVM_TABLES_H__
-
/************************************************************************************/
/* */
/* Includes */
@@ -34,27 +33,16 @@
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-#else
-extern FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[];
-#endif
/************************************************************************************/
/* */
/* Volume control gain and time constant tables */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
extern const LVM_FLOAT LVM_VolumeTable[];
-#else
-extern const LVM_INT16 LVM_VolumeTable[];
-#endif
extern const LVM_INT16 LVM_MixerTCTable[];
-
-
#endif /* __LVM_TABLES_H__ */
-
diff --git a/media/libeffects/lvm/lib/Common/lib/AGC.h b/media/libeffects/lvm/lib/Common/lib/AGC.h
index f75d983..bef7fa1 100644
--- a/media/libeffects/lvm/lib/Common/lib/AGC.h
+++ b/media/libeffects/lvm/lib/Common/lib/AGC.h
@@ -18,8 +18,6 @@
#ifndef __AGC_H__
#define __AGC_H__
-
-
/**********************************************************************************/
/* */
/* Includes */
@@ -28,28 +26,11 @@
#include "LVM_Types.h"
-
/**********************************************************************************/
/* */
/* Types */
/* */
/**********************************************************************************/
-#ifndef BUILD_FLOAT
-typedef struct
-{
- LVM_INT32 AGC_Gain; /* The current AGC gain */
- LVM_INT32 AGC_MaxGain; /* The maximum AGC gain */
- LVM_INT32 Volume; /* The current volume setting */
- LVM_INT32 Target; /* The target volume setting */
- LVM_INT32 AGC_Target; /* AGC target level */
- LVM_INT16 AGC_Attack; /* AGC attack scaler */
- LVM_INT16 AGC_Decay; /* AGC decay scaler */
- LVM_INT16 AGC_GainShift; /* The gain shift */
- LVM_INT16 VolumeShift; /* Volume shift scaling */
- LVM_INT16 VolumeTC; /* Volume update time constant */
-
-} AGC_MIX_VOL_2St1Mon_D32_t;
-#else
typedef struct
{
LVM_FLOAT AGC_Gain; /* The current AGC gain */
@@ -62,14 +43,12 @@
LVM_FLOAT VolumeTC; /* Volume update time constant */
} AGC_MIX_VOL_2St1Mon_FLOAT_t;
-#endif
/**********************************************************************************/
/* */
/* Function Prototypes */
/* */
/**********************************************************************************/
-#ifdef BUILD_FLOAT
void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t *pInstance, /* Instance pointer */
const LVM_FLOAT *pStSrc, /* Stereo source */
const LVM_FLOAT *pMonoSrc, /* Mono source */
@@ -84,23 +63,5 @@
LVM_UINT16 NrChannels); /* Number of channels */
#endif
-#else
-void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_D32_t *pInstance, /* Instance pointer */
- const LVM_INT32 *pStSrc, /* Stereo source */
- const LVM_INT32 *pMonoSrc, /* Mono source */
- LVM_INT32 *pDst, /* Stereo destination */
- LVM_UINT16 n); /* Number of samples */
-#endif
-
-
#endif /* __AGC_H__ */
-
-
-
-
-
-
-
-
-
diff --git a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
index 2baba7c..c050cd0 100644
--- a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
+++ b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
@@ -18,13 +18,10 @@
#ifndef _BIQUAD_H_
#define _BIQUAD_H_
-
-
#include "LVM_Types.h"
/**********************************************************************************
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
#ifdef SUPPORT_MC
@@ -39,19 +36,11 @@
LVM_FLOAT Storage[6];
#endif
} Biquad_FLOAT_Instance_t;
-#else
-typedef struct
-{
- LVM_INT32 Storage[6];
-
-} Biquad_Instance_t;
-#endif
/**********************************************************************************
COEFFICIENT TYPE DEFINITIONS
***********************************************************************************/
/*** Biquad coefficients **********************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A2; /* a2 */
@@ -60,93 +49,31 @@
LVM_FLOAT B2; /* -b2! */
LVM_FLOAT B1; /* -b1! */
} BQ_FLOAT_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A2; /* a2 */
- LVM_INT16 A1; /* a1 */
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B2; /* -b2! */
- LVM_INT16 B1; /* -b1! */
-} BQ_C16_Coefs_t;
-
-typedef struct
-{
- LVM_INT32 A2; /* a2 */
- LVM_INT32 A1; /* a1 */
- LVM_INT32 A0; /* a0 */
- LVM_INT32 B2; /* -b2! */
- LVM_INT32 B1; /* -b1! */
-} BQ_C32_Coefs_t;
-#endif
/*** First order coefficients *****************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A1; /* a1 */
LVM_FLOAT A0; /* a0 */
LVM_FLOAT B1; /* -b1! */
} FO_FLOAT_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A1; /* a1 */
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B1; /* -b1! */
-} FO_C16_Coefs_t;
-
-typedef struct
-{
- LVM_INT32 A1; /* a1 */
- LVM_INT32 A0; /* a0 */
- LVM_INT32 B1; /* -b1! */
-} FO_C32_Coefs_t;
-#endif
/*** First order coefficients with Shift*****************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A1; /* a1 */
LVM_FLOAT A0; /* a0 */
LVM_FLOAT B1; /* -b1! */
} FO_FLOAT_LShx_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A1; /* a1 */
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B1; /* -b1! */
- LVM_INT16 Shift; /* Shift */
-} FO_C16_LShx_Coefs_t;
-#endif
/*** Band pass coefficients *******************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A0; /* a0 */
LVM_FLOAT B2; /* -b2! */
LVM_FLOAT B1; /* -b1! */
} BP_FLOAT_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B2; /* -b2! */
- LVM_INT16 B1; /* -b1! */
-} BP_C16_Coefs_t;
-
-typedef struct
-{
- LVM_INT32 A0; /* a0 */
- LVM_INT32 B2; /* -b2! */
- LVM_INT32 B1; /* -b1! */
-} BP_C32_Coefs_t;
-#endif
/*** Peaking coefficients *********************************************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT A0; /* a0 */
@@ -154,30 +81,12 @@
LVM_FLOAT B1; /* -b1! */
LVM_FLOAT G; /* Gain */
} PK_FLOAT_Coefs_t;
-#else
-typedef struct
-{
- LVM_INT16 A0; /* a0 */
- LVM_INT16 B2; /* -b2! */
- LVM_INT16 B1; /* -b1! */
- LVM_INT16 G; /* Gain */
-} PK_C16_Coefs_t;
-
-typedef struct
-{
- LVM_INT32 A0; /* a0 */
- LVM_INT32 B2; /* -b2! */
- LVM_INT32 B1; /* -b1! */
- LVM_INT16 G; /* Gain */
-} PK_C32_Coefs_t;
-#endif
/**********************************************************************************
TAPS TYPE DEFINITIONS
***********************************************************************************/
/*** Types used for first order and shelving filter *******************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT Storage[ (1 * 2) ]; /* One channel, two taps of size LVM_INT32 */
@@ -192,20 +101,8 @@
LVM_FLOAT Storage[ (2 * 2) ]; /* Two channels, two taps of size LVM_FLOAT */
#endif
} Biquad_2I_Order1_FLOAT_Taps_t;
-#else
-typedef struct
-{
- LVM_INT32 Storage[ (1*2) ]; /* One channel, two taps of size LVM_INT32 */
-} Biquad_1I_Order1_Taps_t;
-
-typedef struct
-{
- LVM_INT32 Storage[ (2*2) ]; /* Two channels, two taps of size LVM_INT32 */
-} Biquad_2I_Order1_Taps_t;
-#endif
/*** Types used for biquad, band pass and peaking filter **************************/
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT Storage[ (1 * 4) ]; /* One channel, four taps of size LVM_FLOAT */
@@ -220,17 +117,6 @@
LVM_FLOAT Storage[ (2 * 4) ]; /* Two channels, four taps of size LVM_FLOAT */
#endif
} Biquad_2I_Order2_FLOAT_Taps_t;
-#else
-typedef struct
-{
- LVM_INT32 Storage[ (1*4) ]; /* One channel, four taps of size LVM_INT32 */
-} Biquad_1I_Order2_Taps_t;
-
-typedef struct
-{
- LVM_INT32 Storage[ (2*4) ]; /* Two channels, four taps of size LVM_INT32 */
-} Biquad_2I_Order2_Taps_t;
-#endif
/* The names of the functions are changed to satisfy QAC rules: Name should be Unique withing 16 characters*/
#define BQ_2I_D32F32Cll_TRC_WRA_01_Init Init_BQ_2I_D32F32Cll_TRC_WRA_01
#define BP_1I_D32F32C30_TRC_WRA_02 TWO_BP_1I_D32F32C30_TRC_WRA_02
@@ -241,140 +127,57 @@
/*** 16 bit data path *************************************************************/
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
-#else
-void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef);
-#endif
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
-#else
-void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16C14_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_2I_D16F16C14_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef BUILD_FLOAT
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
-#else
-void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
-#else
-void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef);
-#endif
-
-#ifdef BUILD_FLOAT
void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-
-#endif
/*** 32 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef);
@@ -389,67 +192,30 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C32_Coefs_t *pCoef);
-
-void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES: FIRST ORDER FILTERS
***********************************************************************************/
/*** 16 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_Coefs_t *pCoef);
-#else
-void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
- Biquad_1I_Order1_Taps_t *pTaps,
- FO_C16_Coefs_t *pCoef);
-#endif
-#ifdef BUILD_FLOAT
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef BUILD_FLOAT
void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_LShx_Coefs_t *pCoef);
-#else
-void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
- Biquad_2I_Order1_Taps_t *pTaps,
- FO_C16_LShx_Coefs_t *pCoef);
-#endif
-#ifdef BUILD_FLOAT
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/*** 32 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_Coefs_t *pCoef);
@@ -464,22 +230,11 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
- Biquad_1I_Order1_Taps_t *pTaps,
- FO_C32_Coefs_t *pCoef);
-
-void FO_1I_D32F32C31_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES: BAND PASS FILTERS
***********************************************************************************/
/*** 16 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef);
@@ -494,27 +249,7 @@
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C16_Coefs_t *pCoef);
-
-void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-
-void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C32_Coefs_t *pCoef);
-
-void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/*** 32 bit data path *************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef);
@@ -522,37 +257,11 @@
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
-#else
-void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C32_Coefs_t *pCoef);
-
-void BP_1I_D32F32C30_TRC_WRA_02( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/*** 32 bit data path STEREO ******************************************************/
-#ifndef BUILD_FLOAT
-void PK_2I_D32F32CllGss_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- PK_C32_Coefs_t *pCoef);
-void PK_2I_D32F32C30G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-#ifdef BUILD_FLOAT
void PK_2I_D32F32CssGss_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
PK_FLOAT_Coefs_t *pCoef);
-#else
-void PK_2I_D32F32CssGss_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- PK_C16_Coefs_t *pCoef);
-#endif
-#ifdef BUILD_FLOAT
void PK_2I_D32F32C14G11_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -564,19 +273,12 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES: DC REMOVAL FILTERS
***********************************************************************************/
/*** 16 bit data path STEREO ******************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
void DC_Mc_D16_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance);
@@ -593,15 +295,6 @@
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples);
#endif
-#else
-void DC_2I_D16_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance);
-
-void DC_2I_D16_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples);
-#endif
-
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/lib/CompLim.h b/media/libeffects/lvm/lib/Common/lib/CompLim.h
index 4e7addd..5b7cb1b 100644
--- a/media/libeffects/lvm/lib/Common/lib/CompLim.h
+++ b/media/libeffects/lvm/lib/Common/lib/CompLim.h
@@ -18,8 +18,6 @@
#ifndef _COMP_LIM_H
#define _COMP_LIM_H
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -28,7 +26,6 @@
#include "LVM_Types.h"
-
/************************************************************************************/
/* */
/* Structures */
@@ -54,28 +51,17 @@
LVM_INT32 CompIntSlow; /* Compressor slow integrator current value */
LVM_INT32 CompIntFast; /* Compressor fast integrator current value */
-
} CompLim_Instance_t;
-
/************************************************************************************/
/* */
/* Function Prototypes */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
void NonLinComp_Float(LVM_FLOAT Gain,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT32 BlockLength);
-#else
-void NonLinComp_D16(LVM_INT16 Gain,
- LVM_INT16 *pSterBfIn,
- LVM_INT16 *pSterBfOut,
- LVM_INT32 BlockLength);
-#endif
#endif /* #ifndef _COMP_LIM_H */
-
-
diff --git a/media/libeffects/lvm/lib/Common/lib/Filter.h b/media/libeffects/lvm/lib/Common/lib/Filter.h
index 3133ce2..1eeb321 100644
--- a/media/libeffects/lvm/lib/Common/lib/Filter.h
+++ b/media/libeffects/lvm/lib/Common/lib/Filter.h
@@ -18,36 +18,27 @@
#ifndef _FILTER_H_
#define _FILTER_H_
-
/**********************************************************************************
INCLUDES
***********************************************************************************/
#include "LVM_Types.h"
#include "BIQUAD.h"
-
/**********************************************************************************
DEFINES
***********************************************************************************/
#define FILTER_LOSS 32730 /* -0.01dB loss to avoid wrapping due to band ripple */
-#ifdef BUILD_FLOAT
#define FILTER_LOSS_FLOAT 0.998849f
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES
***********************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Power10( LVM_FLOAT X);
LVM_FLOAT LVM_Polynomial(LVM_UINT16 N,
LVM_FLOAT *pCoefficients,
LVM_FLOAT X);
-#ifdef HIGHER_FS
LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc,
-#else
-LVM_FLOAT LVM_GetOmega(LVM_UINT16 Fc,
-#endif
LVM_Fs_en SampleRate);
LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
@@ -55,22 +46,6 @@
LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
FO_FLOAT_Coefs_t *pCoeffs);
-#else
-LVM_INT32 LVM_Polynomial(LVM_UINT16 N,
- LVM_INT32 *pCoefficients,
- LVM_INT32 X);
-
-LVM_INT32 LVM_Power10( LVM_INT32 X);
-
-LVM_INT32 LVM_FO_LPF( LVM_INT32 w,
- FO_C32_Coefs_t *pCoeffs);
-
-LVM_INT32 LVM_FO_HPF( LVM_INT32 w,
- FO_C32_Coefs_t *pCoeffs);
-
-LVM_INT32 LVM_GetOmega(LVM_UINT16 Fc,
- LVM_Fs_en SampleRate);
-#endif
/**********************************************************************************/
#endif /** _FILTER_H_ **/
diff --git a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
index 10b5775..bae84e7 100644
--- a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
+++ b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
@@ -18,7 +18,6 @@
#ifndef __INSTALLOC_H__
#define __INSTALLOC_H__
-
#include "LVM_Types.h"
/*######################################################################################*/
/* Type declarations */
@@ -29,7 +28,6 @@
uintptr_t pNextMember; /* Pointer to the next instance member to be allocated */
} INST_ALLOC;
-
/*######################################################################################*/
/* Function prototypes */
/*######################################################################################*/
@@ -45,7 +43,6 @@
void InstAlloc_Init( INST_ALLOC *pms, void *StartAddr );
-
/****************************************************************************************
* Name : InstAlloc_AddMember()
* Input : pms - Pointer to the INST_ALLOC instance
@@ -82,5 +79,4 @@
void InstAlloc_InitAll_NULL( INST_ALLOC *pms);
-
#endif /* __JBS_INSTALLOC_H__ */
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Common.h b/media/libeffects/lvm/lib/Common/lib/LVM_Common.h
index 96da872..49f16ad 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Common.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Common.h
@@ -23,12 +23,9 @@
/* */
/****************************************************************************************/
-
#ifndef __LVM_COMMON_H__
#define __LVM_COMMON_H__
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -36,7 +33,6 @@
/****************************************************************************************/
#include "LVM_Types.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -50,6 +46,5 @@
#define ALGORITHM_VC_ID 0x0500
#define ALGORITHM_TE_ID 0x0600
-
#endif /* __LVM_COMMON_H__ */
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h b/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
index 2ecc7f8..1a15125 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
@@ -18,7 +18,6 @@
#ifndef _LVM_MACROS_H_
#define _LVM_MACROS_H_
-
/**********************************************************************************
MUL32x32INTO32(A,B,C,ShiftR)
C = (A * B) >> ShiftR
@@ -29,7 +28,6 @@
of overflow is undefined.
***********************************************************************************/
-#ifndef MUL32x32INTO32
#define MUL32x32INTO32(A,B,C,ShiftR) \
{LVM_INT32 MUL32x32INTO32_temp,MUL32x32INTO32_temp2,MUL32x32INTO32_mask,MUL32x32INTO32_HH,MUL32x32INTO32_HL,MUL32x32INTO32_LH,MUL32x32INTO32_LL;\
LVM_INT32 shiftValue;\
@@ -55,7 +53,6 @@
}\
(C) = MUL32x32INTO32_temp2;\
}
-#endif
/**********************************************************************************
MUL32x16INTO32(A,B,C,ShiftR)
@@ -68,7 +65,6 @@
of overflow is undefined.
***********************************************************************************/
-#ifndef MUL32x16INTO32
#define MUL32x16INTO32(A,B,C,ShiftR) \
{LVM_INT32 MUL32x16INTO32_mask,MUL32x16INTO32_HH,MUL32x16INTO32_LL;\
LVM_INT32 shiftValue;\
@@ -88,7 +84,6 @@
else {\
(C)=MUL32x16INTO32_HH>>(shiftValue-16);}\
}
-#endif
/**********************************************************************************
ADD2_SAT_32x32(A,B,C)
@@ -96,7 +91,6 @@
A,B and C are 32 bit SIGNED numbers.
***********************************************************************************/
-#ifndef ADD2_SAT_32x32
#define ADD2_SAT_32x32(A,B,C) \
{(C)=(A)+(B);\
if ((((C) ^ (A)) & ((C) ^ (B))) >> 31)\
@@ -107,9 +101,6 @@
(C)=0x7FFFFFFFl;\
}\
}
-#endif
-
-
#endif /* _LVM_MACROS_H_ */
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h b/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
index 9722bf5..dbf9e6a 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
@@ -33,8 +33,6 @@
/* The timer currently does not suport changes in sampling rate while timing. */
/****************************************************************************************/
-
-
/****************************************************************************************/
/* TYPE DEFINITIONS */
/****************************************************************************************/
@@ -71,14 +69,11 @@
void LVM_Timer_Init ( LVM_Timer_Instance_t *pInstance,
LVM_Timer_Params_t *pParams );
-
void LVM_Timer ( LVM_Timer_Instance_t *pInstance,
LVM_INT16 BlockSize );
-
/****************************************************************************************/
/* END OF HEADER */
/****************************************************************************************/
-
#endif /* __LVM_TIMER_H__ */
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
index 3eae70e..8b687f6 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
@@ -25,7 +25,6 @@
#ifndef LVM_TYPES_H
#define LVM_TYPES_H
-
#include <stdint.h>
/****************************************************************************************/
@@ -93,32 +92,15 @@
typedef uint32_t LVM_UINT32; /* Unsigned 32-bit word */
typedef int64_t LVM_INT64; /* Signed 64-bit word */
-#ifdef BUILD_FLOAT
-
#define LVM_MAXFLOAT 1.f
typedef float LVM_FLOAT; /* single precision floating point */
-// If NATIVE_FLOAT_BUFFER is defined, we expose effects as floating point format;
-// otherwise we expose as integer 16 bit and translate to float for the effect libraries.
-// Hence, NATIVE_FLOAT_BUFFER should only be enabled under BUILD_FLOAT compilation.
-
-#define NATIVE_FLOAT_BUFFER
-
-#endif // BUILD_FLOAT
-
// Select whether we expose int16_t or float buffers.
-#ifdef NATIVE_FLOAT_BUFFER
#define EFFECT_BUFFER_FORMAT AUDIO_FORMAT_PCM_FLOAT
typedef float effect_buffer_t;
-#else // NATIVE_FLOAT_BUFFER
-
-#define EFFECT_BUFFER_FORMAT AUDIO_FORMAT_PCM_16_BIT
-typedef int16_t effect_buffer_t;
-
-#endif // NATIVE_FLOAT_BUFFER
#ifdef SUPPORT_MC
#define LVM_MAX_CHANNELS 8 // FCC_8
@@ -140,7 +122,6 @@
LVM_MODE_DUMMY = LVM_MAXENUM
} LVM_Mode_en;
-
/* Format */
typedef enum
{
@@ -153,7 +134,6 @@
LVM_SOURCE_DUMMY = LVM_MAXENUM
} LVM_Format_en;
-
/* LVM sampling rates */
typedef enum
{
@@ -166,17 +146,14 @@
LVM_FS_32000 = 6,
LVM_FS_44100 = 7,
LVM_FS_48000 = 8,
-#ifdef HIGHER_FS
LVM_FS_88200 = 9,
LVM_FS_96000 = 10,
LVM_FS_176400 = 11,
LVM_FS_192000 = 12,
-#endif
LVM_FS_INVALID = LVM_MAXENUM-1,
LVM_FS_DUMMY = LVM_MAXENUM
} LVM_Fs_en;
-
/* Memory Types */
typedef enum
{
@@ -187,7 +164,6 @@
LVM_MEMORYTYPE_DUMMY = LVM_MAXENUM
} LVM_MemoryTypes_en;
-
/* Memory region definition */
typedef struct
{
@@ -196,14 +172,12 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVM_MemoryRegion_st;
-
/* Memory table containing the region definitions */
typedef struct
{
LVM_MemoryRegion_st Region[LVM_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVM_MemoryTable_st;
-
/****************************************************************************************/
/* */
/* Standard Function Prototypes */
@@ -213,12 +187,10 @@
void *pGeneralPurpose, /* General purpose pointer (e.g. to a data structure needed in the callback) */
LVM_INT16 GeneralPurpose ); /* General purpose variable (e.g. to be used as callback ID) */
-
/****************************************************************************************/
/* */
/* End of file */
/* */
/****************************************************************************************/
-
#endif /* LVM_TYPES_H */
diff --git a/media/libeffects/lvm/lib/Common/lib/Mixer.h b/media/libeffects/lvm/lib/Common/lib/Mixer.h
index c63d882..b2e0195 100644
--- a/media/libeffects/lvm/lib/Common/lib/Mixer.h
+++ b/media/libeffects/lvm/lib/Common/lib/Mixer.h
@@ -18,16 +18,12 @@
#ifndef __MIXER_H__
#define __MIXER_H__
-
-
-
#include "LVM_Types.h"
/**********************************************************************************
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
-#ifdef BUILD_FLOAT /* BUILD_FLOAT*/
typedef struct
{
LVM_FLOAT Alpha; /* Time constant. Set by calling application. \
@@ -63,52 +59,11 @@
void *pGeneralPurpose2;
LVM_Callback pCallBack2;
} Mix_2St_Cll_FLOAT_t;
-#else
-typedef struct
-{
- LVM_INT32 Alpha; /* Time constant. Set by calling application. Can be changed at any time */
- LVM_INT32 Target; /* Target value. Set by calling application. Can be changed at any time */
- LVM_INT32 Current; /* Current value. Set by the mixer function. */
- LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application each time the target value is updated */
- LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
- void *pCallbackHandle; /* Pointer to the instance of the callback function */
- void *pGeneralPurpose; /* Pointer for general purpose usage */
- LVM_Callback pCallBack; /* Pointer to the callback function */
-} Mix_1St_Cll_t;
-
-typedef struct
-{
- LVM_INT32 Alpha1;
- LVM_INT32 Target1;
- LVM_INT32 Current1;
- LVM_INT16 CallbackSet1;
- LVM_INT16 CallbackParam1;
- void *pCallbackHandle1;
- void *pGeneralPurpose1;
- LVM_Callback pCallBack1;
-
- LVM_INT32 Alpha2; /* Warning the address of this location is passed as a pointer to Mix_1St_Cll_t in some functions */
- LVM_INT32 Target2;
- LVM_INT32 Current2;
- LVM_INT16 CallbackSet2;
- LVM_INT16 CallbackParam2;
- void *pCallbackHandle2;
- void *pGeneralPurpose2;
- LVM_Callback pCallBack2;
-
-} Mix_2St_Cll_t;
-
-#endif
/*** General functions ************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc,
-#ifdef HIGHER_FS
LVM_UINT32 Fs,
-#else
- LVM_UINT16 Fs,
-#endif
LVM_UINT16 NumChannels);
void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
@@ -126,34 +81,10 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32 tc,
- LVM_UINT16 Fs,
- LVM_UINT16 NumChannels);
-
-
-void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS)
***********************************************************************************/
-#ifdef BUILD_FLOAT
void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -167,24 +98,6 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
-
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
index a492a13..ae54419 100644
--- a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
@@ -18,8 +18,6 @@
#ifndef __SCALARARITHMETIC_H__
#define __SCALARARITHMETIC_H__
-
-
/*######################################################################################*/
/* Include files */
/*######################################################################################*/
@@ -32,11 +30,7 @@
/* Absolute value including the corner case for the extreme negative value */
-#ifdef BUILD_FLOAT
LVM_FLOAT Abs_Float(LVM_FLOAT input);
-#else
-LVM_INT32 Abs_32(LVM_INT32 input);
-#endif
/****************************************************************************************
* Name : dB_to_Lin32()
@@ -50,13 +44,7 @@
* (15->01) = decimal part
* Returns : Lin value format 1.16.15
****************************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix);
-#else
-LVM_INT32 dB_to_Lin32(LVM_INT16 db_fix);
-#endif
-
#endif /* __SCALARARITHMETIC_H__ */
-
diff --git a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
index ff789fd..b27bac5 100644
--- a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
@@ -18,29 +18,16 @@
#ifndef _VECTOR_ARITHMETIC_H_
#define _VECTOR_ARITHMETIC_H_
-
-
#include "LVM_Types.h"
/**********************************************************************************
VARIOUS FUNCTIONS
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LoadConst_Float( const LVM_FLOAT val,
LVM_FLOAT *dst,
LVM_INT16 n );
-#else
-void LoadConst_16( const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n );
-void LoadConst_32( const LVM_INT32 val,
- LVM_INT32 *dst,
- LVM_INT16 n );
-#endif
-
-#ifdef BUILD_FLOAT
void Copy_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n );
@@ -55,11 +42,6 @@
LVM_INT16 NrFrames,
LVM_INT32 NrChannels);
#endif
-#else
-void Copy_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n );
-#endif
/*********************************************************************************
* note: In Mult3s_16x16() saturation of result is not taken care when *
@@ -69,17 +51,10 @@
* This is the only case which will give wrong result. *
* For more information refer to Vector_Arithmetic.doc in /doc folder *
*********************************************************************************/
-#ifdef BUILD_FLOAT
void Mult3s_Float( const LVM_FLOAT *src,
const LVM_FLOAT val,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void Mult3s_16x16( const LVM_INT16 *src,
- const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
/*********************************************************************************
* note: In Mult3s_32x16() saturation of result is not taken care when *
@@ -93,55 +68,24 @@
const LVM_INT16 val,
LVM_INT32 *dst,
LVM_INT16 n);
-#ifdef BUILD_FLOAT
void DelayMix_Float(const LVM_FLOAT *src, /* Source 1, to be delayed */
LVM_FLOAT *delay, /* Delay buffer */
LVM_INT16 size, /* Delay size */
LVM_FLOAT *dst, /* Source/destination */
LVM_INT16 *pOffset, /* Delay offset */
LVM_INT16 n) ; /* Number of stereo samples */
-#else
-void DelayMix_16x16( const LVM_INT16 *src,
- LVM_INT16 *delay,
- LVM_INT16 size,
- LVM_INT16 *dst,
- LVM_INT16 *pOffset,
- LVM_INT16 n);
-#endif
void DelayWrite_32( const LVM_INT32 *src, /* Source 1, to be delayed */
LVM_INT32 *delay, /* Delay buffer */
LVM_UINT16 size, /* Delay size */
LVM_UINT16 *pOffset, /* Delay offset */
LVM_INT16 n);
-#ifdef BUILD_FLOAT
void Add2_Sat_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n );
-#else
-void Add2_Sat_16x16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n );
-
-void Add2_Sat_32x32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n );
-#endif
-#ifdef BUILD_FLOAT
void Mac3s_Sat_Float( const LVM_FLOAT *src,
const LVM_FLOAT val,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void Mac3s_Sat_16x16( const LVM_INT16 *src,
- const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n);
-
-void Mac3s_Sat_32x16( const LVM_INT32 *src,
- const LVM_INT16 val,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
void DelayAllPass_Sat_32x16To32( LVM_INT32 *delay, /* Delay buffer */
LVM_UINT16 size, /* Delay size */
LVM_INT16 coeff, /* All pass filter coefficient */
@@ -153,39 +97,16 @@
/**********************************************************************************
SHIFT FUNCTIONS
***********************************************************************************/
-#ifdef BUILD_FLOAT
void Shift_Sat_Float (const LVM_INT16 val,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void Shift_Sat_v16xv16 ( const LVM_INT16 val,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-
-void Shift_Sat_v32xv32 ( const LVM_INT16 val,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
/**********************************************************************************
AUDIO FORMAT CONVERSION FUNCTIONS
***********************************************************************************/
-#ifdef BUILD_FLOAT
void MonoTo2I_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void MonoTo2I_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-
-void MonoTo2I_32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
-#ifdef BUILD_FLOAT
void From2iToMono_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
@@ -195,47 +116,18 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void From2iToMono_32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
-#ifdef BUILD_FLOAT
void MSTo2i_Sat_Float( const LVM_FLOAT *srcM,
const LVM_FLOAT *srcS,
LVM_FLOAT *dst,
LVM_INT16 n );
-#else
-void MSTo2i_Sat_16x16( const LVM_INT16 *srcM,
- const LVM_INT16 *srcS,
- LVM_INT16 *dst,
- LVM_INT16 n );
-#endif
-#ifdef BUILD_FLOAT
void From2iToMS_Float( const LVM_FLOAT *src,
LVM_FLOAT *dstM,
LVM_FLOAT *dstS,
LVM_INT16 n );
-#else
-void From2iToMS_16x16( const LVM_INT16 *src,
- LVM_INT16 *dstM,
- LVM_INT16 *dstS,
- LVM_INT16 n );
-#endif
-#ifdef BUILD_FLOAT
void JoinTo2i_Float( const LVM_FLOAT *srcL,
const LVM_FLOAT *srcR,
LVM_FLOAT *dst,
LVM_INT16 n );
-#else
-void From2iToMono_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-void JoinTo2i_32x32( const LVM_INT32 *srcL,
- const LVM_INT32 *srcR,
- LVM_INT32 *dst,
- LVM_INT16 n );
-#endif
/**********************************************************************************
DATA TYPE CONVERSION FUNCTIONS
@@ -251,8 +143,6 @@
LVM_INT16 n,
LVM_INT16 shift );
-
-
/**********************************************************************************/
#endif /* _VECTOR_ARITHMETIC_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp b/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp
index 5c8655f..e18aa78 100644
--- a/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp
+++ b/media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp
@@ -24,7 +24,6 @@
#include "AGC.h"
#include "ScalarArithmetic.h"
-
/****************************************************************************************/
/* */
/* Defines */
@@ -33,10 +32,8 @@
#define VOL_TC_SHIFT 21 /* As a power of 2 */
#define DECAY_SHIFT 10 /* As a power of 2 */
-#ifdef BUILD_FLOAT
#define VOL_TC_FLOAT 2.0f /* As a power of 2 */
#define DECAY_FAC_FLOAT 64.0f /* As a power of 2 */
-#endif
/****************************************************************************************/
/* */
@@ -72,131 +69,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_D32_t *pInstance, /* Instance pointer */
- const LVM_INT32 *pStSrc, /* Stereo source */
- const LVM_INT32 *pMonoSrc, /* Mono source */
- LVM_INT32 *pDst, /* Stereo destination */
- LVM_UINT16 NumSamples) /* Number of samples */
-{
-
- /*
- * General variables
- */
- LVM_UINT16 i; /* Sample index */
- LVM_INT32 Left; /* Left sample */
- LVM_INT32 Right; /* Right sample */
- LVM_INT32 Mono; /* Mono sample */
- LVM_INT32 AbsPeak; /* Absolute peak signal */
- LVM_INT32 HighWord; /* High word in intermediate calculations */
- LVM_INT32 LowWord; /* Low word in intermediate calculations */
- LVM_INT16 AGC_Mult; /* Short AGC gain */
- LVM_INT16 Vol_Mult; /* Short volume */
-
-
- /*
- * Instance control variables
- */
- LVM_INT32 AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
- LVM_INT32 AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
- LVM_INT16 AGC_GainShift = pInstance->AGC_GainShift; /* Get the AGC shift */
- LVM_INT16 AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
- LVM_INT16 AGC_Decay = pInstance->AGC_Decay; /* Decay scaler */
- LVM_INT32 AGC_Target = pInstance->AGC_Target; /* Get the target level */
- LVM_INT32 Vol_Current = pInstance->Volume; /* Actual volume setting */
- LVM_INT32 Vol_Target = pInstance->Target; /* Target volume setting */
- LVM_INT16 Vol_Shift = pInstance->VolumeShift; /* Volume shift scaling */
- LVM_INT16 Vol_TC = pInstance->VolumeTC; /* Time constant */
-
-
- /*
- * Process on a sample by sample basis
- */
- for (i=0;i<NumSamples;i++) /* For each sample */
- {
-
- /*
- * Get the short scalers
- */
- AGC_Mult = (LVM_INT16)(AGC_Gain >> 16); /* Get the short AGC gain */
- Vol_Mult = (LVM_INT16)(Vol_Current >> 16); /* Get the short volume gain */
-
-
- /*
- * Get the input samples
- */
- Left = *pStSrc++; /* Get the left sample */
- Right = *pStSrc++; /* Get the right sample */
- Mono = *pMonoSrc++; /* Get the mono sample */
-
-
- /*
- * Apply the AGC gain to the mono input and mix with the stereo signal
- */
- HighWord = (AGC_Mult * (Mono >> 16)); /* signed long (Mono) by unsigned short (AGC_Mult) multiply */
- LowWord = (AGC_Mult * (Mono & 0xffff));
- Mono = (HighWord + (LowWord >> 16)) << (AGC_GainShift);
- Left += Mono; /* Mix in the mono signal */
- Right += Mono;
-
-
- /*
- * Apply the volume and write to the output stream
- */
- HighWord = (Vol_Mult * (Left >> 16)); /* signed long (Left) by unsigned short (Vol_Mult) multiply */
- LowWord = (Vol_Mult * (Left & 0xffff));
- Left = (HighWord + (LowWord >> 16)) << (Vol_Shift);
- HighWord = (Vol_Mult * (Right >> 16)); /* signed long (Right) by unsigned short (Vol_Mult) multiply */
- LowWord = (Vol_Mult * (Right & 0xffff));
- Right = (HighWord + (LowWord >> 16)) << (Vol_Shift);
- *pDst++ = Left; /* Save the results */
- *pDst++ = Right;
-
-
- /*
- * Update the AGC gain
- */
- AbsPeak = (Abs_32(Left)>Abs_32(Right)) ? Abs_32(Left) : Abs_32(Right); /* Get the absolute peak */
- if (AbsPeak > AGC_Target)
- {
- /*
- * The signal is too large so decrease the gain
- */
- HighWord = (AGC_Attack * (AGC_Gain >> 16)); /* signed long (AGC_Gain) by unsigned short (AGC_Attack) multiply */
- LowWord = (AGC_Attack * (AGC_Gain & 0xffff));
- AGC_Gain = (HighWord + (LowWord >> 16)) << 1;
- }
- else
- {
- /*
- * The signal is too small so increase the gain
- */
- if (AGC_Gain > AGC_MaxGain)
- {
- AGC_Gain -= (AGC_Decay << DECAY_SHIFT);
- }
- else
- {
- AGC_Gain += (AGC_Decay << DECAY_SHIFT);
- }
- }
-
- /*
- * Update the gain
- */
- Vol_Current += Vol_TC * ((Vol_Target - Vol_Current) >> VOL_TC_SHIFT);
- }
-
-
- /*
- * Update the parameters
- */
- pInstance->Volume = Vol_Current; /* Actual volume setting */
- pInstance->AGC_Gain = AGC_Gain;
-
- return;
-}
-#else
void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t *pInstance, /* Instance pointer */
const LVM_FLOAT *pStSrc, /* Stereo source */
const LVM_FLOAT *pMonoSrc, /* Mono source */
@@ -215,7 +87,6 @@
LVM_FLOAT AGC_Mult; /* Short AGC gain */
LVM_FLOAT Vol_Mult; /* Short volume */
-
/*
* Instance control variables
*/
@@ -228,7 +99,6 @@
LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
-
/*
* Process on a sample by sample basis
*/
@@ -241,7 +111,6 @@
AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the short AGC gain */
Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the short volume gain */
-
/*
* Get the input samples
*/
@@ -249,7 +118,6 @@
Right = *pStSrc++; /* Get the right sample */
Mono = *pMonoSrc++; /* Get the mono sample */
-
/*
* Apply the AGC gain to the mono input and mix with the stereo signal
*/
@@ -296,7 +164,6 @@
Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
}
-
/*
* Update the parameters
*/
@@ -360,7 +227,6 @@
LVM_FLOAT AGC_Mult; /* Short AGC gain */
LVM_FLOAT Vol_Mult; /* Short volume */
-
/*
* Instance control variables
*/
@@ -374,7 +240,6 @@
LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
-
/*
* Process on a sample by sample basis
*/
@@ -441,7 +306,6 @@
Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
}
-
/*
* Update the parameters
*/
@@ -451,4 +315,3 @@
return;
}
#endif /*SUPPORT_MC*/
-#endif /*BUILD_FLOAT*/
diff --git a/media/libeffects/lvm/lib/Common/src/Abs_32.cpp b/media/libeffects/lvm/lib/Common/src/Abs_32.cpp
index 84fabd8..e013809 100644
--- a/media/libeffects/lvm/lib/Common/src/Abs_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Abs_32.cpp
@@ -47,7 +47,6 @@
}
return input;
}
-#ifdef BUILD_FLOAT
LVM_FLOAT Abs_Float(LVM_FLOAT input)
{
if(input < 0)
@@ -57,4 +56,3 @@
}
return input;
}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp
index 66d6adb..a48e668 100644
--- a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp
@@ -21,7 +21,6 @@
#include "VectorArithmetic.h"
-
/**********************************************************************************
FUNCTION ADD2_SAT_32X32
***********************************************************************************/
@@ -57,7 +56,6 @@
return;
}
-#ifdef BUILD_FLOAT
void Add2_Sat_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n )
@@ -85,5 +83,4 @@
}
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.cpp
index 88f9986..1a5e07f 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.cpp
@@ -19,7 +19,6 @@
#include "BP_1I_D16F16Css_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -33,13 +32,11 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples)
-
{
LVM_FLOAT ynL;
LVM_INT16 ii;
@@ -48,7 +45,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -77,50 +73,4 @@
}
}
-#else
-void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
-
-
- {
- LVM_INT32 ynL;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL= (A0 (Q14) * (x(n)L (Q0) - x(n-2)L (Q0) ) ) in Q14
- ynL=(LVM_INT32)pBiquadState->coefs[0]* ((*pDataIn)-pBiquadState->pDelays[1]);
-
- // ynL+= ((-B2 (Q14) * y(n-2)L (Q0) ) ) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[3];
-
- // ynL+= ((-B1 (Q30) * y(n-1)L (Q0) ) ) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[2]*pBiquadState->pDelays[2];
-
- ynL=(LVM_INT16)(ynL>>14); // ynL in Q0
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.cpp
index 27ab57a..60b6c16 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "BP_1I_D16F16Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BP_1I_D16F16Css_TRC_WRA_01_Init */
@@ -38,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef)
@@ -50,19 +48,6 @@
pBiquadState->coefs[1] = pCoef->B2;
pBiquadState->coefs[2] = pCoef->B1;
}
-#else
-void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C16_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0]=pCoef->A0;
- pBiquadState->coefs[1]=pCoef->B2;
- pBiquadState->coefs[2]=pCoef->B1;
- }
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
index e194f92..8a000b6 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -27,7 +27,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
@@ -35,5 +34,4 @@
LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /*_BP_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.cpp
index 3abdd43..c844d03 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.cpp
@@ -19,7 +19,6 @@
#include "BP_1I_D16F32Cll_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -33,7 +32,6 @@
pBiquadState->pDelays[2] is y(n-1)L in Q16 format
pBiquadState->pDelays[3] is y(n-2)L in Q16 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -74,51 +72,3 @@
*pDataOut++ = (ynL); // Write Left output
}
}
-#else
-void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
-
-
- {
- LVM_INT32 ynL,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL= (A0 (Q30) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>14) in Q16
- templ= (LVM_INT32) *pDataIn-pBiquadState->pDelays[1];
- MUL32x32INTO32(pBiquadState->coefs[0],templ,ynL,14)
-
- // ynL+= ((-B2 (Q30) * y(n-2)L (Q16) ) >>30) in Q16
- MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[3],templ,30)
- ynL+=templ;
-
- // ynL+= ((-B1 (Q30) * y(n-1)L (Q16) ) >>30) in Q16
- MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[2],templ,30)
- ynL+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q16
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)(ynL>>16); // Write Left output in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.cpp
index d6e047a..eb15032 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "BP_1I_D16F32Cll_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BP_1I_D16F32Cll_TRC_WRA_01_Init */
@@ -48,7 +47,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef)
@@ -56,24 +54,10 @@
PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
pBiquadState->pDelays =(LVM_FLOAT *) pTaps;
-
pBiquadState->coefs[0] = pCoef->A0;
pBiquadState->coefs[1] = pCoef->B2;
pBiquadState->coefs[2] = pCoef->B1;
}
-#else
-void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C32_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0] = pCoef->A0;
- pBiquadState->coefs[1] = pCoef->B2;
- pBiquadState->coefs[2] = pCoef->B1;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D16F32Cll_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
index aa9e669..6d754e2 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
@@ -26,12 +26,10 @@
}Filter_State;
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
}Filter_State_Float;
typedef Filter_State_Float * PFilter_State_FLOAT ;
-#endif
#endif /*_BP_1I_D16F32CLL_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.cpp b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.cpp
index abdb2f7..d0ba206 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.cpp
@@ -19,7 +19,6 @@
#include "BP_1I_D32F32Cll_TRC_WRA_02_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -33,7 +32,6 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -46,7 +44,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -78,49 +75,3 @@
}
}
-#else
-void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL= (A0 (Q30) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>30) in Q0
- templ=(*pDataIn)-pBiquadState->pDelays[1];
- MUL32x32INTO32(pBiquadState->coefs[0],templ,ynL,30)
-
- // ynL+= ((-B2 (Q30) * y(n-2)L (Q0) ) >>30) in Q0
- MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[3],templ,30)
- ynL+=templ;
-
- // ynL+= ((-B1 (Q30) * y(n-1)L (Q0) ) >>30) in Q0
- MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[2],templ,30)
- ynL+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=ynL; // Write Left output in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.cpp b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.cpp
index 5590c32..6f7d0b5 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.cpp
@@ -37,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BP_FLOAT_Coefs_t *pCoef)
@@ -51,21 +50,6 @@
pBiquadState->coefs[2] = pCoef->B1;
}
-#else
-void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BP_C32_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0]=pCoef->A0;
-
- pBiquadState->coefs[1]=pCoef->B2;
-
- pBiquadState->coefs[2]=pCoef->B1;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BP_1I_D32F32Cll_TRC_WRA_02_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
index 80c3920..9f1c66a 100644
--- a/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
@@ -26,13 +26,11 @@
}Filter_State;
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
}Filter_State_Float;
typedef Filter_State_Float* PFilter_State_FLOAT ;
-#endif
#endif /*_BP_1I_D32F32CLL_TRC_WRA_02_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.cpp
index ee9bf7a..9aecc40 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.cpp
@@ -32,7 +32,6 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -45,7 +44,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -77,58 +75,6 @@
***************************************************************************/
*pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
-
}
}
-#else
-void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 (Q15) * x(n-2)L (Q0) in Q15
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[1];
-
- // ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q15) * x(n)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- // ynL+= (-B2 (Q15) * y(n-2)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[3];
-
- // ynL+= (-B1 (Q15) * y(n-1)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[2];
-
- ynL=ynL>>15; // ynL in Q0 format
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
-
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp
index 3d5befa..f0b5d06 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.cpp
@@ -37,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -56,27 +55,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
index 811da8b..fad345d 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -27,7 +27,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -35,5 +34,4 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /*_BQ_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.cpp
index c74a137..043bc5f 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.cpp
@@ -32,7 +32,6 @@
pBiquadState->pDelays[2] is y(n-1)L in Q16 format
pBiquadState->pDelays[3] is y(n-2)L in Q16 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -45,7 +44,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -79,53 +77,3 @@
}
}
-#else
-void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 (Q14) * x(n-2)L (Q0) in Q14
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[1];
-
- // ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q14) * x(n)L (Q0) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- // ynL+= ( (-B2 (Q14) * y(n-2)L (Q16) )>>16) in Q14
- MUL32x16INTO32(pBiquadState->pDelays[3],pBiquadState->coefs[3],templ,16)
- ynL+=templ;
-
- // ynL+= ( (-B1 (Q14) * y(n-1)L (Q16) )>>16) in Q14
- MUL32x16INTO32(pBiquadState->pDelays[2],pBiquadState->coefs[4],templ,16)
- ynL+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[2]=ynL<<2; // Update y(n-1)L in Q16
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)(ynL>>14); // Write Left output in Q0
-
- }
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
index 9812274..6a61d9a 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
@@ -27,7 +27,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -35,5 +34,4 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /*_BQ_1I_D16F32CSS_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.cpp b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.cpp
index feae20d..2b80691 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "BQ_1I_D16F32Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BQ_1I_D16F32Css_TRC_WRA_01_Init */
@@ -38,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -58,27 +56,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_1I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_1I_D16F32Css_TRC_WRA_01_Init */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.cpp
index 8ee76c9..51cd918 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.cpp
@@ -19,7 +19,6 @@
#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -37,7 +36,6 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -68,8 +66,6 @@
// ynL+=( -B1 * y(n-1)L )
ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[4];
-
-
/**************************************************************************
PROCESSING OF THE RIGHT CHANNEL
***************************************************************************/
@@ -88,7 +84,6 @@
// ynR+=( -B1 * y(n-1)R )
ynR += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[5];
-
/**************************************************************************
UPDATING THE DELAYS
***************************************************************************/
@@ -107,83 +102,6 @@
*pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
*pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
-
}
}
-#else
-void BQ_2I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 (Q14) * x(n-2)L (Q0) in Q14
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- // ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q14) * x(n)L (Q0) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- // ynL+= ( -B2 (Q14) * y(n-2)L (Q0) ) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[6];
-
- // ynL+=( -B1 (Q14) * y(n-1)L (Q0) ) in Q14
- ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[4];
-
- ynL=ynL>>14; // ynL in Q0 format
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- // ynR=A2 (Q14) * x(n-2)R (Q0) in Q14
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- // ynR+=A1 (Q14) * x(n-1)R (Q0) in Q14
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- // ynR+=A0 (Q14) * x(n)R (Q0) in Q14
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- // ynR+= ( -B2 (Q14) * y(n-2)R (Q0) ) in Q14
- ynR+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[7];
-
- // ynR+=( -B1 (Q14) * y(n-1)R (Q0) ) in Q14
- ynR+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[5];
-
- ynR=ynR>>14; // ynL in Q0 format
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; // y(n-2)R=y(n-1)R
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; // x(n-2)R=x(n-1)R
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[5]=ynR; // Update y(n-1)R in Q0
- pBiquadState->pDelays[4]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
- pBiquadState->pDelays[1]=(*pDataIn++); // Update x(n-1)R in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
- *pDataOut++=(LVM_INT16)ynR; // Write Right ouput in Q0
-
-
- }
-
- }
-
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.cpp
index f24db8f..8f74749 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.cpp
@@ -19,7 +19,6 @@
#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -37,7 +36,6 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -50,7 +48,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -69,8 +66,6 @@
// ynL+=( -B1 * y(n-1)L
ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[4];
-
-
/**************************************************************************
PROCESSING OF THE RIGHT CHANNEL
***************************************************************************/
@@ -89,7 +84,6 @@
// ynR+=( -B1 * y(n-1)R )
ynR += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[5];
-
/**************************************************************************
UPDATING THE DELAYS
***************************************************************************/
@@ -111,78 +105,3 @@
}
}
-#else
-void BQ_2I_D16F16C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 (Q15) * x(n-2)L (Q0) in Q15
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- // ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q15) * x(n)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- // ynL+= ( -B2 (Q15) * y(n-2)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[6];
-
- // ynL+=( -B1 (Q15) * y(n-1)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[4];
-
- ynL=ynL>>15; // ynL in Q0 format
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- // ynR=A2 (Q15) * x(n-2)R (Q0) in Q15
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- // ynR+=A1 (Q15) * x(n-1)R (Q0) in Q15
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- // ynR+=A0 (Q15) * x(n)R (Q0) in Q15
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- // ynR+= ( -B2 (Q15) * y(n-2)R (Q0) ) in Q15
- ynR+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[7];
-
- // ynR+=( -B1 (Q15) * y(n-1)R (Q0) ) in Q15
- ynR+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[5];
-
- ynR=ynR>>15; // ynL in Q0 format
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; // y(n-2)R=y(n-1)R
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; // y(n-2)L=y(n-1)L
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; // x(n-2)R=x(n-1)R
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
- pBiquadState->pDelays[5]=ynR; // Update y(n-1)R in Q0
- pBiquadState->pDelays[4]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
- pBiquadState->pDelays[1]=(*pDataIn++); // Update x(n-1)R in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
- *pDataOut++=(LVM_INT16)ynR; // Write Right ouput in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.cpp
index 39e1bda..987cbcf 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BQ_2I_D16F16Css_TRC_WRA_01_Init */
@@ -38,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -58,27 +56,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
index 0691b8c..5a9a0e9 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
@@ -28,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -36,6 +35,5 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _BQ_2I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp
index 61c07c7..331c97f 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.cpp
@@ -19,7 +19,6 @@
#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -37,7 +36,6 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -109,82 +107,3 @@
pDataOut++;
}
}
-#else
-void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 (Q13) * x(n-2)L (Q0) in Q13*/
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- /* ynL+=A1 (Q13) * x(n-1)L (Q0) in Q13*/
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- /* ynL+=A0 (Q13) * x(n)L (Q0) in Q13*/
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- /* ynL+= ( (-B2 (Q13) * y(n-2)L (Q16) )>>16) in Q13 */
- MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
- ynL+=templ;
-
- /* ynL+=( (-B1 (Q13) * y(n-1)L (Q16) )>>16) in Q13 */
- MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
- ynL+=templ;
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 (Q13) * x(n-2)R (Q0) in Q13*/
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- /* ynR+=A1 (Q13) * x(n-1)R (Q0) in Q13*/
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- /* ynR+=A0 (Q13) * x(n)R (Q0) in Q13*/
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- /* ynR+= ( (-B2 (Q13) * y(n-2)R (Q16) )>>16) in Q13*/
- MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
- ynR+=templ;
-
- /* ynR+=( (-B1 (Q13) * y(n-1)R (Q16) )>>16) in Q13 */
- MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
- ynR+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR<<3; /* Update y(n-1)R in Q16*/
- pBiquadState->pDelays[4]=ynL<<3; /* Update y(n-1)L in Q16*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=(LVM_INT16)(ynL>>13); /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=(LVM_INT16)(ynR>>13); /* Write Right ouput in Q0*/
- pDataOut++;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.cpp
index cf19e06..3a396df 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.cpp
@@ -36,7 +36,6 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -49,7 +48,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -65,7 +63,6 @@
/* ynL+= ( (-B2 * y(n-2)L ))*/
ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
-
/* ynL+=( (-B1 * y(n-1)L )) */
ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
@@ -111,82 +108,3 @@
}
}
-#else
-void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 (Q14) * x(n-2)L (Q0) in Q14*/
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- /* ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14*/
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- /* ynL+=A0 (Q14) * x(n)L (Q0) in Q14*/
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- /* ynL+= ( (-B2 (Q14) * y(n-2)L (Q16) )>>16) in Q14 */
- MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
- ynL+=templ;
-
- /* ynL+=( (-B1 (Q14) * y(n-1)L (Q16) )>>16) in Q14 */
- MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
- ynL+=templ;
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 (Q14) * x(n-2)R (Q0) in Q14*/
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- /* ynR+=A1 (Q14) * x(n-1)R (Q0) in Q14*/
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- /* ynR+=A0 (Q14) * x(n)R (Q0) in Q14*/
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- /* ynR+= ( (-B2 (Q14) * y(n-2)R (Q16) )>>16) in Q14*/
- MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
- ynR+=templ;
-
- /* ynR+=( (-B1 (Q14) * y(n-1)R (Q16) )>>16) in Q14 */
- MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
- ynR+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR<<2; /* Update y(n-1)R in Q16*/
- pBiquadState->pDelays[4]=ynL<<2; /* Update y(n-1)L in Q16*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=(LVM_INT16)(ynL>>14); /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=(LVM_INT16)(ynR>>14); /* Write Right ouput in Q0*/
- pDataOut++;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.cpp
index 2611b19..1cbff1a 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.cpp
@@ -36,7 +36,6 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -49,7 +48,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -65,11 +63,9 @@
/* ynL+= ( (-B2 * y(n-2)L ) */
ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
-
/* ynL+=( (-B1 * y(n-1)L )) */
ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
-
/**************************************************************************
PROCESSING OF THE RIGHT CHANNEL
***************************************************************************/
@@ -85,7 +81,6 @@
/* ynR+= ( (-B2 * y(n-2)R ) */
ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
-
/* ynR+=( (-B1 * y(n-1)R )) in Q15 */
ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
@@ -113,82 +108,3 @@
}
}
-#else
-void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 (Q15) * x(n-2)L (Q0) in Q15*/
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
- /* ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15*/
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
-
- /* ynL+=A0 (Q15) * x(n)L (Q0) in Q15*/
- ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
-
- /* ynL+= ( (-B2 (Q15) * y(n-2)L (Q16) )>>16) in Q15 */
- MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
- ynL+=templ;
-
- /* ynL+=( (-B1 (Q15) * y(n-1)L (Q16) )>>16) in Q15 */
- MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
- ynL+=templ;
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 (Q15) * x(n-2)R (Q0) in Q15*/
- ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
-
- /* ynR+=A1 (Q15) * x(n-1)R (Q0) in Q15*/
- ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
-
- /* ynR+=A0 (Q15) * x(n)R (Q0) in Q15*/
- ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
-
- /* ynR+= ( (-B2 (Q15) * y(n-2)R (Q16) )>>16) in Q15 */
- MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
- ynR+=templ;
-
- /* ynR+=( (-B1 (Q15) * y(n-1)R (Q16) )>>16) in Q15 */
- MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
- ynR+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR<<1; /* Update y(n-1)R in Q16*/
- pBiquadState->pDelays[4]=ynL<<1; /* Update y(n-1)L in Q16*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=(LVM_INT16)(ynL>>15); /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=(LVM_INT16)(ynR>>15); /* Write Right ouput in Q0*/
- pDataOut++;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
index c0319c9..314388a 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
@@ -28,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples \
@@ -36,6 +35,5 @@
LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _BQ_2I_D16F32CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.cpp
index 4d9bbfe..058541a 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.cpp
@@ -18,7 +18,6 @@
#include "BIQUAD.h"
#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* BQ_2I_D16F32Css_TRC_WRA_01_Init */
@@ -37,7 +36,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -56,27 +54,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D16F32Css_TRC_WRA_01_Init */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.cpp
index d63365c..78d1ba1 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.cpp
@@ -36,13 +36,11 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
LVM_INT16 NrSamples)
-
{
LVM_FLOAT ynL,ynR,templ,tempd;
LVM_INT16 ii;
@@ -51,7 +49,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -119,7 +116,6 @@
*pDataOut = (LVM_FLOAT)ynR; /* Write Right ouput */
pDataOut++;
-
}
}
@@ -151,7 +147,6 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels)
-
{
LVM_FLOAT yn, temp;
LVM_INT16 ii, jj;
@@ -204,91 +199,3 @@
}
#endif /*SUPPORT_MC*/
-#else
-void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
-
-
- {
- LVM_INT32 ynL,ynR,templ,tempd;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL= ( A2 (Q30) * x(n-2)L (Q0) ) >>30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[2],ynL,30)
-
- /* ynL+= ( A1 (Q30) * x(n-1)L (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[0],templ,30)
- ynL+=templ;
-
- /* ynL+= ( A0 (Q30) * x(n)L (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[2],*pDataIn,templ,30)
- ynL+=templ;
-
- /* ynL+= (-B2 (Q30) * y(n-2)L (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[3],pBiquadState->pDelays[6],templ,30)
- ynL+=templ;
-
- /* ynL+= (-B1 (Q30) * y(n-1)L (Q0) ) >> 30 in Q0 */
- MUL32x32INTO32(pBiquadState->coefs[4],pBiquadState->pDelays[4],templ,30)
- ynL+=templ;
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR= ( A2 (Q30) * x(n-2)R (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[3],ynR,30)
-
- /* ynR+= ( A1 (Q30) * x(n-1)R (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[1],templ,30)
- ynR+=templ;
-
- /* ynR+= ( A0 (Q30) * x(n)R (Q0) ) >> 30 in Q0*/
- tempd=*(pDataIn+1);
- MUL32x32INTO32(pBiquadState->coefs[2],tempd,templ,30)
- ynR+=templ;
-
- /* ynR+= (-B2 (Q30) * y(n-2)R (Q0) ) >> 30 in Q0*/
- MUL32x32INTO32(pBiquadState->coefs[3],pBiquadState->pDelays[7],templ,30)
- ynR+=templ;
-
- /* ynR+= (-B1 (Q30) * y(n-1)R (Q0) ) >> 30 in Q0 */
- MUL32x32INTO32(pBiquadState->coefs[4],pBiquadState->pDelays[5],templ,30)
- ynR+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=(LVM_INT32)ynR; /* Update y(n-1)R in Q0*/
- pBiquadState->pDelays[4]=(LVM_INT32)ynL; /* Update y(n-1)L in Q0*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=(LVM_INT32)ynL; /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=(LVM_INT32)ynR; /* Write Right ouput in Q0*/
- pDataOut++;
-
-
- }
-
- }
-#endif /*BUILD_FLOAT*/
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.cpp
index fff05ed..492a9e0 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.cpp
@@ -37,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
BQ_FLOAT_Coefs_t *pCoef)
@@ -56,27 +55,6 @@
temp = pCoef->B1;
pBiquadState->coefs[4] = temp;
}
-#else
-void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- BQ_C32_Coefs_t *pCoef)
-{
- LVM_INT32 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A2;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A1;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[2]=temp;
- temp=pCoef->B2;
- pBiquadState->coefs[3]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[4]=temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: BQ_2I_D32F32C32_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
index c0f0dcc..7eb6474 100644
--- a/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
@@ -18,7 +18,6 @@
#ifndef _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
#define _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
-
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
typedef struct _Filter_State_
@@ -29,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples \
@@ -37,6 +35,5 @@
LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/Copy_16.cpp b/media/libeffects/lvm/lib/Common/src/Copy_16.cpp
index 3eb3c14..3a50554 100644
--- a/media/libeffects/lvm/lib/Common/src/Copy_16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Copy_16.cpp
@@ -54,7 +54,6 @@
return;
}
-#ifdef BUILD_FLOAT
void Copy_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n )
@@ -145,5 +144,4 @@
}
}
#endif
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.cpp
index ea98041..5e77335 100644
--- a/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.cpp
@@ -25,7 +25,6 @@
/**********************************************************************************
FUNCTION CORE_MIXHARD_2ST_D32C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
@@ -55,35 +54,4 @@
*dst++ = Temp2;
}
}
-#else
-void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp1,Temp2,Temp3;
- LVM_INT16 ii;
- LVM_INT16 Current1Short;
- LVM_INT16 Current2Short;
-
- Current1Short = (LVM_INT16)(pInstance->Current1 >> 16);
- Current2Short = (LVM_INT16)(pInstance->Current2 >> 16);
-
- for (ii = n; ii != 0; ii--){
- Temp1=*src1++;
- MUL32x16INTO32(Temp1,Current1Short,Temp3,15)
- Temp2=*src2++;
- MUL32x16INTO32(Temp2,Current2Short,Temp1,15)
- Temp2=(Temp1>>1)+(Temp3>>1);
- if (Temp2 > 0x3FFFFFFF)
- Temp2 = 0x7FFFFFFF;
- else if (Temp2 < - 0x40000000)
- Temp2 = 0x80000000;
- else
- Temp2=(Temp2<<1);
- *dst++ = Temp2;
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.cpp
index 2814f19..8f5c0ae 100644
--- a/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.cpp
@@ -26,7 +26,6 @@
FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT /* BUILD_FLOAT */
void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -39,7 +38,6 @@
LVM_FLOAT CurrentTimesAlpha;
LVM_INT16 ii,jj;
-
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
OutLoop = (LVM_INT16)(n - (InLoop << 2));
@@ -89,69 +87,4 @@
}
}
}
-#else
-void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp1,Temp2,Temp3;
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 TargetTimesOneMinAlpha;
- LVM_INT32 CurrentTimesAlpha;
- LVM_INT16 ii,jj;
- LVM_INT16 CurrentShort;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- MUL32x32INTO32((0x7FFFFFFF-pInstance->Alpha),pInstance->Target,TargetTimesOneMinAlpha,31); /* Q31 * Q0 in Q0 */
- if (pInstance->Target >= pInstance->Current){
- TargetTimesOneMinAlpha +=2; /* Ceil*/
- }
-
- if (OutLoop){
- MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31); /* Q0 * Q31 in Q0 */
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q0 + Q0 into Q0*/
- CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- Temp1=*src++;
- Temp2=*dst;
- MUL32x16INTO32(Temp1,CurrentShort,Temp3,15)
- Temp1=(Temp2>>1)+(Temp3>>1);
-
- if (Temp1 > 0x3FFFFFFF)
- Temp1 = 0x7FFFFFFF;
- else if (Temp1 < - 0x40000000)
- Temp1 = 0x80000000;
- else
- Temp1=(Temp1<<1);
- *dst++ = Temp1;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31); /* Q0 * Q31 in Q0 */
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q0 + Q0 into Q0*/
- CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
-
- for (jj = 4; jj!=0 ; jj--){
- Temp1=*src++;
- Temp2=*dst;
- MUL32x16INTO32(Temp1,CurrentShort,Temp3,15)
- Temp1=(Temp2>>1)+(Temp3>>1);
-
- if (Temp1 > 0x3FFFFFFF)
- Temp1 = 0x7FFFFFFF;
- else if (Temp1 < - 0x40000000)
- Temp1 = 0x80000000;
- else
- Temp1=(Temp1<<1);
- *dst++ = Temp1;
- }
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.cpp b/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.cpp
index 814ccee..6ff7853 100644
--- a/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.cpp
@@ -25,7 +25,6 @@
/**********************************************************************************
FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT
void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -97,78 +96,4 @@
dst++;
}
}
-#else
-void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp1,Temp2;
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 TargetTimesOneMinAlpha;
- LVM_INT32 CurrentTimesAlpha;
- LVM_INT16 CurrentShort;
- LVM_INT16 ii;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- MUL32x32INTO32((0x7FFFFFFF-pInstance->Alpha),pInstance->Target,TargetTimesOneMinAlpha,31) /* Q31 * Q31 in Q31 */
- if (pInstance->Target >= pInstance->Current)
- {
- TargetTimesOneMinAlpha +=2; /* Ceil*/
- }
-
- if (OutLoop!=0)
- {
- MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31) /* Q31 * Q31 in Q31 */
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q31 + Q31 into Q31*/
- CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--)
- {
- Temp1=*src;
- src++;
-
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--)
- {
- MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31) /* Q31 * Q31 in Q31 */
- pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q31 + Q31 into Q31*/
- CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
- Temp1=*src;
- src++;
-
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
-
- Temp1=*src;
- src++;
-
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
-
- Temp1=*src;
- src++;
-
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
-
- Temp1=*src;
- src++;
- MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
- *dst = Temp2;
- dst++;
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.cpp
index 13fac5e..a7ce4d3 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.cpp
@@ -18,7 +18,6 @@
#include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-#ifdef BUILD_FLOAT
void DC_2I_D16_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -45,7 +44,6 @@
else {
LeftDC += DC_FLOAT_STEP; }
-
/* Subtract DC an saturate */
Diff =* (pDataIn++) - (RightDC);
if (Diff > 1.0f) {
@@ -62,7 +60,6 @@
pBiquadState->LeftDC = LeftDC;
pBiquadState->RightDC = RightDC;
-
}
#ifdef SUPPORT_MC
/*
@@ -116,50 +113,3 @@
}
#endif
-#else
-void DC_2I_D16_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 LeftDC,RightDC;
- LVM_INT32 Diff;
- LVM_INT32 j;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- LeftDC = pBiquadState->LeftDC;
- RightDC = pBiquadState->RightDC;
- for(j=NrSamples-1;j>=0;j--)
- {
- /* Subtract DC an saturate */
- Diff=*(pDataIn++)-(LeftDC>>16);
- if (Diff > 32767) {
- Diff = 32767; }
- else if (Diff < -32768) {
- Diff = -32768; }
- *(pDataOut++)=(LVM_INT16)Diff;
- if (Diff < 0) {
- LeftDC -= DC_D16_STEP; }
- else {
- LeftDC += DC_D16_STEP; }
-
-
- /* Subtract DC an saturate */
- Diff=*(pDataIn++)-(RightDC>>16);
- if (Diff > 32767) {
- Diff = 32767; }
- else if (Diff < -32768) {
- Diff = -32768; }
- *(pDataOut++)=(LVM_INT16)Diff;
- if (Diff < 0) {
- RightDC -= DC_D16_STEP; }
- else {
- RightDC += DC_D16_STEP; }
-
- }
- pBiquadState->LeftDC = LeftDC;
- pBiquadState->RightDC = RightDC;
-
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.cpp
index 0f941a0..beee112 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.cpp
@@ -17,7 +17,6 @@
#include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
-#ifdef BUILD_FLOAT
void DC_2I_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance)
{
PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State) pInstance;
@@ -35,11 +34,3 @@
}
}
#endif
-#else
-void DC_2I_D16_TRC_WRA_01_Init(Biquad_Instance_t *pInstance)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->LeftDC = 0;
- pBiquadState->RightDC = 0;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
index db3a6d3..6508b73 100644
--- a/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
@@ -18,16 +18,10 @@
#ifndef _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
#define _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
-#ifdef BUILD_FLOAT
#define DC_FLOAT_STEP 0.0000002384f;
-#else
-#define DC_D16_STEP 0x200;
-#endif
-
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use.*/
-#ifdef BUILD_FLOAT
typedef struct _Filter_FLOAT_State_
{
LVM_FLOAT LeftDC; /* LeftDC */
@@ -41,13 +35,4 @@
} Filter_FLOAT_State_Mc;
typedef Filter_FLOAT_State_Mc * PFilter_FLOAT_State_Mc ;
#endif
-#else
-typedef struct _Filter_State_
-{
- LVM_INT32 LeftDC; /* LeftDC */
- LVM_INT32 RightDC; /* RightDC */
-}Filter_State;
-
-typedef Filter_State * PFilter_State ;
-#endif
#endif /* _DC_2I_D16_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp b/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp
index b04e98e..771fae2 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp
@@ -63,7 +63,6 @@
*dst = c;
dst++;
-
MUL32x16INTO32(c, -coeff, temp, 15)
a = temp;
b = delay[AllPassOffset];
diff --git a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
index f502716..52d263f 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
@@ -47,7 +47,6 @@
Offset++;
src++;
-
/* Right channel */
temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) - (LVM_INT32)delay[Offset]) >> 1);
*dst = temp;
@@ -69,7 +68,6 @@
return;
}
-#ifdef BUILD_FLOAT
void DelayMix_Float(const LVM_FLOAT *src, /* Source 1, to be delayed */
LVM_FLOAT *delay, /* Delay buffer */
LVM_INT16 size, /* Delay size */
@@ -92,7 +90,6 @@
Offset++;
src++;
-
/* Right channel */
temp = (LVM_FLOAT)((LVM_FLOAT)(*dst - (LVM_FLOAT)delay[Offset]) / 2.0f);
*dst = temp;
@@ -114,5 +111,4 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.cpp
index 039c88c..bef0d62 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.cpp
@@ -31,7 +31,6 @@
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -70,45 +69,3 @@
}
}
-#else
-void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A1 (Q15) * x(n-1)L (Q0) in Q15
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[0];
-
- // ynL+=A0 (Q15) * x(n)L (Q0) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* (*pDataIn);
-
- // ynL+= (-B1 (Q15) * y(n-1)L (Q0) ) in Q15
- ynL+=(LVM_INT32)pBiquadState->coefs[2]*pBiquadState->pDelays[1];
-
-
- ynL=(LVM_INT16)(ynL>>15); // ynL in Q0 format
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.cpp
index b21b8a4..161225e 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.cpp
@@ -19,7 +19,6 @@
#include "BIQUAD.h"
#include "FO_1I_D16F16Css_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* FO_1I_D16F16Css_TRC_WRA_01_Init */
@@ -38,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_Coefs_t *pCoef)
@@ -53,23 +51,6 @@
temp = pCoef->B1;
pBiquadState->coefs[2] = temp;
}
-#else
-void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
- Biquad_1I_Order1_Taps_t *pTaps,
- FO_C16_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- temp=pCoef->A1;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[2]=temp;
-}
-#endif
/*------------------------------------------------*/
/* End Of File: FO_1I_D16F16Css_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
index 6fdb039..34f3df9 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
@@ -28,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples \
@@ -37,5 +36,4 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _FO_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp
index 416e8eb..e3efad7 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp
@@ -19,7 +19,6 @@
#include "FO_1I_D32F32Cll_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -31,7 +30,6 @@
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void FO_1I_D32F32C31_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -71,44 +69,3 @@
}
}
-#else
-void FO_1I_D32F32C31_TRC_WRA_01( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A1 (Q31) * x(n-1)L (Q0) >>31 in Q0
- MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[0],ynL,31)
-
- // ynL+=A0 (Q31) * x(n)L (Q0) >> 31 in Q0
- MUL32x32INTO32(pBiquadState->coefs[1],*pDataIn,templ,31)
- ynL+=templ;
-
- // ynL+= (-B1 (Q31) * y(n-1)L (Q0) ) >> 31 in Q0
- MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[1],templ,31)
- ynL+=templ;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q0
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=(LVM_INT32)ynL; // Write Left output in Q0
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp
index f33d24d..bb5295c 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp
@@ -18,7 +18,6 @@
#include "BIQUAD.h"
#include "FO_1I_D32F32Cll_TRC_WRA_01_Private.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* FO_1I_D32F32Cll_TRC_WRA_01_Init */
@@ -37,7 +36,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_FLOAT_Instance_t *pInstance,
Biquad_1I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_Coefs_t *pCoef)
@@ -53,23 +51,6 @@
temp = pCoef->B1;
pBiquadState->coefs[2] = temp;
}
-#else
-void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
- Biquad_1I_Order1_Taps_t *pTaps,
- FO_C32_Coefs_t *pCoef)
-{
- LVM_INT32 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays = (LVM_INT32 *) pTaps;
-
- temp=pCoef->A1;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[2]=temp;
-}
-#endif
/*------------------------------------------------*/
/* End Of File: FO_1I_D32F32Cll_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
index fdb528b..67d1384 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
@@ -18,7 +18,6 @@
#ifndef _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
#define _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
-
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
typedef struct _Filter_State_
@@ -29,7 +28,6 @@
typedef Filter_State * PFilter_State ;
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_FLOAT_
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -37,5 +35,4 @@
}Filter_State_FLOAT;
typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
-#endif
#endif /* _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.cpp
index 2a50f18..6ca819a 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.cpp
@@ -32,7 +32,6 @@
pBiquadState->pDelays[2] is x(n-1)R in Q15 format
pBiquadState->pDelays[3] is y(n-1)R in Q30 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -59,13 +58,11 @@
// ynR =A1 * x(n-1)R
ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
-
// ynL+=A0 * x(n)L
ynL += (LVM_FLOAT)pBiquadState->coefs[1] * (*pDataIn);
// ynR+=A0 * x(n)L
ynR += (LVM_FLOAT)pBiquadState->coefs[1] * (*(pDataIn+1));
-
// ynL += (-B1 * y(n-1)L )
Temp = pBiquadState->pDelays[1] * pBiquadState->coefs[2];
ynL += Temp;
@@ -73,7 +70,6 @@
Temp = pBiquadState->pDelays[3] * pBiquadState->coefs[2];
ynR += Temp;
-
/**************************************************************************
UPDATING THE DELAYS
***************************************************************************/
@@ -157,9 +153,6 @@
LVM_FLOAT A1 = pCoefs[0];
LVM_FLOAT B1 = pCoefs[2];
-
-
-
for (ii = NrFrames; ii != 0; ii--)
{
@@ -178,7 +171,6 @@
Temp = B1 * pDelays[1];
yn += Temp;
-
/**************************************************************************
UPDATING THE DELAYS
***************************************************************************/
@@ -204,97 +196,3 @@
}
}
#endif
-#else
-void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR;
- LVM_INT32 Temp;
- LVM_INT32 NegSatValue;
- LVM_INT16 ii;
- LVM_INT16 Shift;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- NegSatValue = LVM_MAXINT_16 +1;
- NegSatValue = -NegSatValue;
-
- Shift = pBiquadState->Shift;
-
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
-
- // ynL =A1 (Q15) * x(n-1)L (Q15) in Q30
- ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[0];
- // ynR =A1 (Q15) * x(n-1)R (Q15) in Q30
- ynR=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
-
-
- // ynL+=A0 (Q15) * x(n)L (Q15) in Q30
- ynL+=(LVM_INT32)pBiquadState->coefs[1]* (*pDataIn);
- // ynR+=A0 (Q15) * x(n)L (Q15) in Q30
- ynR+=(LVM_INT32)pBiquadState->coefs[1]* (*(pDataIn+1));
-
-
- // ynL += (-B1 (Q15) * y(n-1)L (Q30) ) in Q30
- MUL32x16INTO32(pBiquadState->pDelays[1],pBiquadState->coefs[2],Temp,15);
- ynL +=Temp;
- // ynR += (-B1 (Q15) * y(n-1)R (Q30) ) in Q30
- MUL32x16INTO32(pBiquadState->pDelays[3],pBiquadState->coefs[2],Temp,15);
- ynR +=Temp;
-
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q30
- pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q15
-
- pBiquadState->pDelays[3]=ynR; // Update y(n-1)R in Q30
- pBiquadState->pDelays[2]=(*pDataIn++); // Update x(n-1)R in Q15
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- /*Apply shift: Instead of left shift on 16-bit result, right shift of (15-shift) is applied
- for better SNR*/
- ynL = ynL>>(15-Shift);
- ynR = ynR>>(15-Shift);
-
- /*Saturate results*/
- if(ynL > LVM_MAXINT_16)
- {
- ynL = LVM_MAXINT_16;
- }
- else
- {
- if(ynL < NegSatValue)
- {
- ynL = NegSatValue;
- }
- }
-
- if(ynR > LVM_MAXINT_16)
- {
- ynR = LVM_MAXINT_16;
- }
- else
- {
- if(ynR < NegSatValue)
- {
- ynR = NegSatValue;
- }
- }
-
- *pDataOut++=(LVM_INT16)ynL;
- *pDataOut++=(LVM_INT16)ynR;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.cpp
index 33ca6cf..b81b976 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.cpp
@@ -37,7 +37,6 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order1_FLOAT_Taps_t *pTaps,
FO_FLOAT_LShx_Coefs_t *pCoef)
@@ -53,26 +52,6 @@
temp = pCoef->B1;
pBiquadState->coefs[2] = temp;
}
-#else
-void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
- Biquad_2I_Order1_Taps_t *pTaps,
- FO_C16_LShx_Coefs_t *pCoef)
-{
- LVM_INT16 temp;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
-
- temp=pCoef->A1;
- pBiquadState->coefs[0]=temp;
- temp=pCoef->A0;
- pBiquadState->coefs[1]=temp;
- temp=pCoef->B1;
- pBiquadState->coefs[2]=temp;
-
- temp=pCoef->Shift;
- pBiquadState->Shift = temp;
-}
-#endif
/*-------------------------------------------------------------------------*/
/* End Of File: FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c */
diff --git a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
index 368bfce..5022500 100644
--- a/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h
@@ -20,7 +20,6 @@
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_
{
LVM_FLOAT *pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -28,14 +27,4 @@
}Filter_Float_State;
typedef Filter_Float_State * PFilter_Float_State ;
-#else
-typedef struct _Filter_State_
-{
- LVM_INT32 *pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT16 coefs[3]; /* pointer to the filter coefficients */
- LVM_INT16 Shift; /* Shift value*/
-}Filter_State;
-
-typedef Filter_State * PFilter_State ;
-#endif
#endif /* _FO_2I_D16F32CSS_LSHX_TRC_WRA_01_PRIVATE_H_ */
diff --git a/media/libeffects/lvm/lib/Common/src/Filters.h b/media/libeffects/lvm/lib/Common/src/Filters.h
index 14b7226..b5db8f4 100644
--- a/media/libeffects/lvm/lib/Common/src/Filters.h
+++ b/media/libeffects/lvm/lib/Common/src/Filters.h
@@ -18,7 +18,6 @@
#ifndef FILTERS_H
#define FILTERS_H
-
#include "LVM_Types.h"
/************************************************************************************/
@@ -31,17 +30,6 @@
* Biquad with coefficients A0, A1, A2, B1 and B2 coefficients
*/
/* Single precision (16-bit) Biquad section coefficients */
-#ifndef BUILD_FLOAT
-typedef struct
-{
- LVM_INT16 A0;
- LVM_INT16 A1;
- LVM_INT16 A2;
- LVM_INT16 B1;
- LVM_INT16 B2;
- LVM_UINT16 Scale;
-} BiquadA012B12CoefsSP_t;
-#else
typedef struct
{
LVM_FLOAT A0;
@@ -51,20 +39,10 @@
LVM_FLOAT B2;
LVM_UINT16 Scale;
} BiquadA012B12CoefsSP_t;
-#endif
/*
* Biquad with coefficients A0, A1 and B1 coefficients
*/
/* Single precision (16-bit) Biquad section coefficients */
-#ifndef BUILD_FLOAT
-typedef struct
-{
- LVM_INT16 A0;
- LVM_INT16 A1;
- LVM_INT16 B1;
- LVM_UINT16 Scale;
-} BiquadA01B1CoefsSP_t;
-#else
typedef struct
{
LVM_FLOAT A0;
@@ -72,7 +50,6 @@
LVM_FLOAT B1;
LVM_UINT16 Scale;
} BiquadA01B1CoefsSP_t;
-#endif
#endif /* FILTERS_H */
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp
index 2c6e6c3..c3f6648 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp
@@ -53,7 +53,6 @@
return;
}
-#ifdef BUILD_FLOAT
void From2iToMS_Float( const LVM_FLOAT *src,
LVM_FLOAT *dstM,
LVM_FLOAT *dstS,
@@ -82,5 +81,4 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
index d02af88..a8688b4 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
@@ -46,7 +46,6 @@
return;
}
-#ifdef BUILD_FLOAT
void From2iToMono_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n)
@@ -110,5 +109,4 @@
}
#endif
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp b/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
index a89a5c3..a039bf5 100644
--- a/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
+++ b/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
@@ -33,7 +33,6 @@
pms->pNextMember = (((uintptr_t)StartAddr + 3) & (uintptr_t)~3);
}
-
/****************************************************************************************
* Name : InstAlloc_AddMember()
* Input : pms - Pointer to the INST_ALLOC instance
@@ -59,7 +58,6 @@
return(NewMemberAddress);
}
-
/****************************************************************************************
* Name : InstAlloc_GetTotal()
* Input : pms - Pointer to the INST_ALLOC instance
@@ -80,7 +78,6 @@
}
}
-
void InstAlloc_InitAll( INST_ALLOC *pms,
LVM_MemoryTable_st *pMemoryTable)
{
@@ -91,19 +88,16 @@
pms[0].TotalSize = 3;
pms[0].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
-
StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress;
pms[1].TotalSize = 3;
pms[1].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
-
StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress;
pms[2].TotalSize = 3;
pms[2].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
-
StartAddr = (uintptr_t)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress;
pms[3].TotalSize = 3;
@@ -125,7 +119,6 @@
pms[0].TotalSize = 3;
pms[0].pNextMember = 0;
-
pms[1].TotalSize = 3;
pms[1].pNextMember = 0;
@@ -137,7 +130,6 @@
}
-
void* InstAlloc_AddMemberAll( INST_ALLOC *pms,
LVM_UINT32 Size[],
LVM_MemoryTable_st *pMemoryTable)
@@ -172,7 +164,6 @@
return(NewMemberAddress);
}
-
void* InstAlloc_AddMemberAllRet( INST_ALLOC *pms,
LVM_UINT32 Size[],
void **ptr)
diff --git a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
index ebc477e..05df656 100644
--- a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
@@ -49,7 +49,6 @@
return;
}
-#ifdef BUILD_FLOAT
void JoinTo2i_Float( const LVM_FLOAT *srcL,
const LVM_FLOAT *srcR,
LVM_FLOAT *dst,
@@ -74,6 +73,5 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp
index db76cd1..14d61bd 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.cpp
@@ -23,11 +23,9 @@
#include "LVM_Macros.h"
#include "ScalarArithmetic.h"
-
/**********************************************************************************
FUNCTION LVC_Core_MixHard_1St_2i_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
LVMixer3_FLOAT_st *ptrInstance2,
const LVM_FLOAT *src,
@@ -57,7 +55,6 @@
*dst++ = (LVM_FLOAT)Temp;
}
-
}
#ifdef SUPPORT_MC
void LVC_Core_MixHard_1St_MC_float_SAT (Mix_Private_FLOAT_st **ptrInstance,
@@ -84,44 +81,4 @@
}
}
#endif
-#else
-void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp;
- LVM_INT16 ii;
- LVM_INT16 Current1Short;
- LVM_INT16 Current2Short;
- Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance1->PrivateParams);
- Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance2->PrivateParams);
-
-
- Current1Short = (LVM_INT16)(pInstance1->Current >> 16);
- Current2Short = (LVM_INT16)(pInstance2->Current >> 16);
-
- for (ii = n; ii != 0; ii--)
- {
- Temp = ((LVM_INT32)*(src++) * (LVM_INT32)Current1Short)>>15;
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
-
- Temp = ((LVM_INT32)*(src++) * (LVM_INT32)Current2Short)>>15;
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
-
-
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.cpp
index ec0baaf..841fa1e 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.cpp
@@ -24,7 +24,6 @@
/**********************************************************************************
FUNCTION LVCore_MIXHARD_2ST_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
LVMixer3_FLOAT_st *ptrInstance2,
const LVM_FLOAT *src1,
@@ -39,7 +38,6 @@
Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
Mix_Private_FLOAT_st *pInstance2 = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
-
Current1 = (pInstance1->Current);
Current2 = (pInstance2->Current);
@@ -54,35 +52,4 @@
*dst++ = Temp;
}
}
-#else
-void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src1,
- const LVM_INT16 *src2,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 Temp;
- LVM_INT16 ii;
- LVM_INT16 Current1Short;
- LVM_INT16 Current2Short;
- Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance1->PrivateParams);
- Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance2->PrivateParams);
-
-
- Current1Short = (LVM_INT16)(pInstance1->Current >> 16);
- Current2Short = (LVM_INT16)(pInstance2->Current >> 16);
-
- for (ii = n; ii != 0; ii--){
- Temp = (((LVM_INT32)*(src1++) * (LVM_INT32)Current1Short)>>15) +
- (((LVM_INT32)*(src2++) * (LVM_INT32)Current2Short)>>15);
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.cpp
index 419c7c5..318138d 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.cpp
@@ -25,7 +25,6 @@
/**********************************************************************************
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixInSoft_D16C31_SAT(LVMixer3_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -247,103 +246,4 @@
}
#endif
-#else
-void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_st *ptrInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
-
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT16 CurrentShort;
- LVM_INT32 ii,jj;
- Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->PrivateParams);
- LVM_INT32 Delta=pInstance->Delta;
- LVM_INT32 Current=pInstance->Current;
- LVM_INT32 Target=pInstance->Target;
- LVM_INT32 Temp;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- if(Current<Target){
- if (OutLoop){
- ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
- Current=Temp;
- if (Current > Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
- Current=Temp;
- if (Current > Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (jj = 4; jj!=0 ; jj--){
- Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
- }
- }
- else{
- if (OutLoop){
- Current -= Delta; /* Q31 + Q31 into Q31*/
- if (Current < Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- Current -= Delta; /* Q31 + Q31 into Q31*/
- if (Current < Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (jj = 4; jj!=0 ; jj--){
- Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
- if (Temp > 0x00007FFF)
- *dst++ = 0x7FFF;
- else if (Temp < -0x00008000)
- *dst++ = - 0x8000;
- else
- *dst++ = (LVM_INT16)Temp;
- }
- }
- }
- pInstance->Current=Current;
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp
index 56b5dae..1f4b08a 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp
@@ -26,7 +26,6 @@
/**********************************************************************************
FUNCTION LVC_Core_MixSoft_1St_2i_D16C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT
static LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a,
LVM_FLOAT b,
LVM_FLOAT c)
@@ -191,119 +190,4 @@
}
}
#endif
-#else
-void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT16 CurrentShortL;
- LVM_INT16 CurrentShortR;
- LVM_INT32 ii;
- Mix_Private_st *pInstanceL=(Mix_Private_st *)(ptrInstance1->PrivateParams);
- Mix_Private_st *pInstanceR=(Mix_Private_st *)(ptrInstance2->PrivateParams);
-
- LVM_INT32 DeltaL=pInstanceL->Delta;
- LVM_INT32 CurrentL=pInstanceL->Current;
- LVM_INT32 TargetL=pInstanceL->Target;
-
- LVM_INT32 DeltaR=pInstanceR->Delta;
- LVM_INT32 CurrentR=pInstanceR->Current;
- LVM_INT32 TargetR=pInstanceR->Target;
-
- LVM_INT32 Temp;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- if (OutLoop)
- {
- if(CurrentL<TargetL)
- {
- ADD2_SAT_32x32(CurrentL,DeltaL,Temp); /* Q31 + Q31 into Q31*/
- CurrentL=Temp;
- if (CurrentL > TargetL)
- CurrentL = TargetL;
- }
- else
- {
- CurrentL -= DeltaL; /* Q31 + Q31 into Q31*/
- if (CurrentL < TargetL)
- CurrentL = TargetL;
- }
-
- if(CurrentR<TargetR)
- {
- ADD2_SAT_32x32(CurrentR,DeltaR,Temp); /* Q31 + Q31 into Q31*/
- CurrentR=Temp;
- if (CurrentR > TargetR)
- CurrentR = TargetR;
- }
- else
- {
- CurrentR -= DeltaR; /* Q31 + Q31 into Q31*/
- if (CurrentR < TargetR)
- CurrentR = TargetR;
- }
-
- CurrentShortL = (LVM_INT16)(CurrentL>>16); /* From Q31 to Q15*/
- CurrentShortR = (LVM_INT16)(CurrentR>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop*2; ii != 0; ii-=2)
- {
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15); /* Q15*Q15>>15 into Q15 */
- }
- }
-
- for (ii = InLoop*2; ii != 0; ii-=2)
- {
- if(CurrentL<TargetL)
- {
- ADD2_SAT_32x32(CurrentL,DeltaL,Temp); /* Q31 + Q31 into Q31*/
- CurrentL=Temp;
- if (CurrentL > TargetL)
- CurrentL = TargetL;
- }
- else
- {
- CurrentL -= DeltaL; /* Q31 + Q31 into Q31*/
- if (CurrentL < TargetL)
- CurrentL = TargetL;
- }
-
- if(CurrentR<TargetR)
- {
- ADD2_SAT_32x32(CurrentR,DeltaR,Temp); /* Q31 + Q31 into Q31*/
- CurrentR=Temp;
- if (CurrentR > TargetR)
- CurrentR = TargetR;
- }
- else
- {
- CurrentR -= DeltaR; /* Q31 + Q31 into Q31*/
- if (CurrentR < TargetR)
- CurrentR = TargetR;
- }
-
- CurrentShortL = (LVM_INT16)(CurrentL>>16); /* From Q31 to Q15*/
- CurrentShortR = (LVM_INT16)(CurrentR>>16); /* From Q31 to Q15*/
-
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
- }
- pInstanceL->Current=CurrentL;
- pInstanceR->Current=CurrentR;
-
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.cpp
index 5bfdad8..5d8aadc 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.cpp
@@ -26,7 +26,6 @@
/**********************************************************************************
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixSoft_1St_D16C31_WRA(LVMixer3_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -106,7 +105,6 @@
pInstance->Current=Current;
}
-
#ifdef SUPPORT_MC
/*
* FUNCTION: LVC_Core_MixSoft_Mc_D16C31_WRA
@@ -218,80 +216,4 @@
}
#endif
-#else
-void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_st *ptrInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT16 CurrentShort;
- LVM_INT32 ii;
- Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->PrivateParams);
- LVM_INT32 Delta=pInstance->Delta;
- LVM_INT32 Current=pInstance->Current;
- LVM_INT32 Target=pInstance->Target;
- LVM_INT32 Temp;
-
- InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
- OutLoop = (LVM_INT16)(n - (InLoop << 2));
-
- if(Current<Target){
- if (OutLoop){
- ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
- Current=Temp;
- if (Current > Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
- Current=Temp;
- if (Current > Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- }
- }
- else{
- if (OutLoop){
- Current -= Delta; /* Q31 + Q31 into Q31*/
- if (Current < Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- for (ii = OutLoop; ii != 0; ii--){
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
- }
- }
-
- for (ii = InLoop; ii != 0; ii--){
- Current -= Delta; /* Q31 + Q31 into Q31*/
- if (Current < Target)
- Current = Target;
-
- CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
-
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- *(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
- }
- }
- pInstance->Current=Current;
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.cpp
index 65956f7..2bec3be 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.cpp
@@ -33,7 +33,6 @@
/**********************************************************************************
FUNCTION MIXINSOFT_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -84,7 +83,6 @@
}
}
-
/******************************************************************************
CALL BACK
*******************************************************************************/
@@ -107,8 +105,6 @@
}
-
-
#ifdef SUPPORT_MC
/*
* FUNCTION: LVC_MixInSoft_Mc_D16C31_SAT
@@ -185,7 +181,6 @@
}
}
-
/******************************************************************************
CALL BACK
*******************************************************************************/
@@ -209,81 +204,4 @@
}
#endif
-
-#else
-void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
- LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_INT32 TargetGain;
- Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Delta == 0x7FFFFFFF){
- pInstance->Current = pInstance->Target;
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }else if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }else{
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- if(pInstance->Shift!=0){
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
- LVC_Core_MixInSoft_D16C31_SAT( &(ptrInstance->MixerStream[0]), src, dst, n);
- }
- else
- LVC_Core_MixInSoft_D16C31_SAT( &(ptrInstance->MixerStream[0]), src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing){
- if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
- if ((pInstance->Target>>16) == 0x7FFF){
- if(pInstance->Shift!=0)
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
- Add2_Sat_16x16( src, dst, n );
- }
- else{
- if(pInstance->Shift!=0)
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
- Mac3s_Sat_16x16(src,(LVM_INT16)(pInstance->Target>>16),dst,n);
- pInstance->Current = pInstance->Target; /* In case the LVCore function would have changed the Current value */
- }
- }
- }
-
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
-
- if (ptrInstance->MixerStream[0].CallbackSet){
- if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(ptrInstance->MixerStream,TargetGain);
- ptrInstance->MixerStream[0].CallbackSet = FALSE;
- if (ptrInstance->MixerStream[0].pCallBack != 0){
- (*ptrInstance->MixerStream[0].pCallBack) ( ptrInstance->MixerStream[0].pCallbackHandle, ptrInstance->MixerStream[0].pGeneralPurpose,ptrInstance->MixerStream[0].CallbackParam );
- }
- }
- }
-
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp
index a4682d3..3153ada 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp
@@ -37,7 +37,6 @@
/**********************************************************************************
FUNCTION LVC_MixSoft_1St_2i_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
/* This threshold is used to decide on the processing to be applied on
* front center and back center channels
@@ -363,120 +362,4 @@
}
}
}
-#else
-void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_INT32 TargetGain;
- Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
- Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance->MixerStream[1].PrivateParams);
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if ((pInstance1->Current != pInstance1->Target)||(pInstance2->Current != pInstance2->Target))
- {
- if(pInstance1->Delta == 0x7FFFFFFF)
- {
- pInstance1->Current = pInstance1->Target;
- TargetGain=pInstance1->Target>>16; // TargetGain in Q16.15 format, no integer part
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }
- else if (Abs_32(pInstance1->Current-pInstance1->Target) < pInstance1->Delta)
- {
- pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance1->Target>>16; // TargetGain in Q16.15 format, no integer part
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }
- else
- {
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- }
-
- if(HardMixing == TRUE)
- {
- if(pInstance2->Delta == 0x7FFFFFFF)
- {
- pInstance2->Current = pInstance2->Target;
- TargetGain=pInstance2->Target>>16; // TargetGain in Q16.15 format, no integer part
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]),TargetGain);
- }
- else if (Abs_32(pInstance2->Current-pInstance2->Target) < pInstance2->Delta)
- {
- pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance2->Target>>16; // TargetGain in Q16.15 format, no integer part
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]),TargetGain);
- }
- else
- {
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- }
- }
-
- if(HardMixing == FALSE)
- {
- LVC_Core_MixSoft_1St_2i_D16C31_WRA( &(ptrInstance->MixerStream[0]),&(ptrInstance->MixerStream[1]), src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing)
- {
- if (((pInstance1->Target>>16) == 0x7FFF)&&((pInstance2->Target>>16) == 0x7FFF))
- {
- if(src!=dst)
- {
- Copy_16(src, dst, n);
- }
- }
- else
- {
- LVC_Core_MixHard_1St_2i_D16C31_SAT(&(ptrInstance->MixerStream[0]),&(ptrInstance->MixerStream[1]), src, dst, n);
- }
- }
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
-
- if (ptrInstance->MixerStream[0].CallbackSet)
- {
- if (Abs_32(pInstance1->Current-pInstance1->Target) < pInstance1->Delta)
- {
- pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance1->Target>>(16-pInstance1->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&ptrInstance->MixerStream[0],TargetGain);
- ptrInstance->MixerStream[0].CallbackSet = FALSE;
- if (ptrInstance->MixerStream[0].pCallBack != 0)
- {
- (*ptrInstance->MixerStream[0].pCallBack) ( ptrInstance->MixerStream[0].pCallbackHandle, ptrInstance->MixerStream[0].pGeneralPurpose,ptrInstance->MixerStream[0].CallbackParam );
- }
- }
- }
- if (ptrInstance->MixerStream[1].CallbackSet)
- {
- if (Abs_32(pInstance2->Current-pInstance2->Target) < pInstance2->Delta)
- {
- pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance2->Target>>(16-pInstance2->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&ptrInstance->MixerStream[1],TargetGain);
- ptrInstance->MixerStream[1].CallbackSet = FALSE;
- if (ptrInstance->MixerStream[1].pCallBack != 0)
- {
- (*ptrInstance->MixerStream[1].pCallBack) ( ptrInstance->MixerStream[1].pCallbackHandle, ptrInstance->MixerStream[1].pGeneralPurpose,ptrInstance->MixerStream[1].CallbackParam );
- }
- }
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp
index 0678ae0..4d229da 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp
@@ -33,7 +33,6 @@
/**********************************************************************************
FUNCTION LVMixer3_MIXSOFT_1ST_D16C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -198,79 +197,4 @@
#endif
-#else
-void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_INT32 TargetGain;
- Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Delta == 0x7FFFFFFF){
- pInstance->Current = pInstance->Target;
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }else if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
- }else{
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- if(pInstance->Shift!=0){
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,dst,n);
- LVC_Core_MixSoft_1St_D16C31_WRA( &(ptrInstance->MixerStream[0]), dst, dst, n);
- }
- else
- LVC_Core_MixSoft_1St_D16C31_WRA( &(ptrInstance->MixerStream[0]), src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing){
- if (pInstance->Target == 0)
- LoadConst_16(0, dst, n);
- else if(pInstance->Shift!=0){
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,dst,n);
- if ((pInstance->Target>>16) != 0x7FFF)
- Mult3s_16x16( dst, (LVM_INT16)(pInstance->Target>>16), dst, n );
- }
- else {
- if ((pInstance->Target>>16) != 0x7FFF)
- Mult3s_16x16( src, (LVM_INT16)(pInstance->Target>>16), dst, n );
- else if(src!=dst)
- Copy_16(src, dst, n);
- }
-
- }
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
-
- if (ptrInstance->MixerStream[0].CallbackSet){
- if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
- LVC_Mixer_SetTarget(ptrInstance->MixerStream,TargetGain);
- ptrInstance->MixerStream[0].CallbackSet = FALSE;
- if (ptrInstance->MixerStream[0].pCallBack != 0){
- (*ptrInstance->MixerStream[0].pCallBack) ( ptrInstance->MixerStream[0].pCallbackHandle, ptrInstance->MixerStream[0].pGeneralPurpose,ptrInstance->MixerStream[0].CallbackParam );
- }
- }
- }
-}
-#endif/*BUILD_FLOAT*/
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp
index 8a89de1..54ab79d 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_MixSoft_2St_D16C31_SAT.cpp
@@ -25,7 +25,6 @@
/**********************************************************************************
FUNCTION LVC_MixSoft_2St_D16C31_SAT.c
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st *ptrInstance,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
@@ -131,46 +130,4 @@
}
#endif
-#else
-void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
- const LVM_INT16 *src1,
- LVM_INT16 *src2,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
- Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance->MixerStream[1].PrivateParams);
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if ((pInstance1->Current == pInstance1->Target)&&(pInstance1->Current == 0)){
- LVC_MixSoft_1St_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[1]), src2, dst, n);
- }
- else if ((pInstance2->Current == pInstance2->Target)&&(pInstance2->Current == 0)){
- LVC_MixSoft_1St_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[0]), src1, dst, n);
- }
- else if ((pInstance1->Current != pInstance1->Target) || (pInstance2->Current != pInstance2->Target))
- {
- LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_st *)(&ptrInstance->MixerStream[0]), src1, dst, n);
- LVC_MixInSoft_D16C31_SAT( (LVMixer3_1St_st *)(&ptrInstance->MixerStream[1]), src2, dst, n);
- }
- else{
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
- if(pInstance2->Shift!=0)
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance2->Shift,src2,src2,n);
- if(pInstance1->Shift!=0)
- {
- Shift_Sat_v16xv16 ((LVM_INT16)pInstance1->Shift,src1,dst,n);
- LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1], dst, src2, dst, n);
- }
- else
- LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1], src1, src2, dst, n);
- }
-}
-#endif /*BUILD_FLOAT*/
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
index eac9726..ce42d2e 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
@@ -18,9 +18,6 @@
#ifndef __LVC_MIXER_H__
#define __LVC_MIXER_H__
-
-
-
#include "LVM_Types.h"
/**********************************************************************************
@@ -28,7 +25,6 @@
***********************************************************************************/
/* LVMixer3_st structure stores Instance parameters for one audio stream */
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT PrivateParams[3]; /* Private Instance params for \
@@ -40,45 +36,14 @@
void *pGeneralPurpose; /* Pointer for general purpose usage */
LVM_Callback pCallBack; /* Pointer to the callback function */
} LVMixer3_FLOAT_st;
-#else
-typedef struct
-{
- LVM_INT32 PrivateParams[4]; /* Private Instance params for Audio Stream */
- LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application each time the target value is updated */
- LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
- void *pCallbackHandle; /* Pointer to the instance of the callback function */
- void *pGeneralPurpose; /* Pointer for general purpose usage */
- LVM_Callback pCallBack; /* Pointer to the callback function */
-} LVMixer3_st;
-#endif
-#ifdef BUILD_FLOAT
typedef struct
{
LVMixer3_FLOAT_st MixerStream[1]; /* Instance Params for one Audio Stream */
} LVMixer3_1St_FLOAT_st;
-#else
-typedef struct
-{
- LVMixer3_st MixerStream[1]; /* Instance Params for one Audio Stream */
-} LVMixer3_1St_st;
-#endif
-#ifdef BUILD_FLOAT
typedef struct
{
LVMixer3_FLOAT_st MixerStream[2]; /* Instance Params for two Audio Streams */
} LVMixer3_2St_FLOAT_st;
-#else
-typedef struct
-{
- LVMixer3_st MixerStream[2]; /* Instance Params for two Audio Streams */
-} LVMixer3_2St_st;
-#endif
-#ifndef BUILD_FLOAT
-typedef struct
-{
- LVMixer3_st MixerStream[3]; /* Instance Params for three Audio Streams */
-} LVMixer3_3St_st;
-#endif
/**********************************************************************************
FUNCTION PROTOTYPES (HIGH LEVEL FUNCTIONS)
***********************************************************************************/
@@ -89,7 +54,6 @@
#define LVMixer3_MixSoft_2St_D16C31_SAT LVMixer3_2St_D16C31_SAT_MixSoft
#define LVMixer3_MixSoft_3St_D16C31_SAT LVMixer3_3St_D16C31_SAT_MixSoft
-
/*** General functions ************************************************************/
/**********************************************************************************/
@@ -98,62 +62,28 @@
/* then the calculation will give an incorrect value for alpha, see the mixer */
/* documentation for further details. */
/* ********************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_SetTarget( LVMixer3_FLOAT_st *pStream,
LVM_FLOAT TargetGain);
-#else
-void LVC_Mixer_SetTarget( LVMixer3_st *pStream,
- LVM_INT32 TargetGain);
-#endif
-#ifdef BUILD_FLOAT
LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream);
-#else
-LVM_INT32 LVC_Mixer_GetTarget( LVMixer3_st *pStream);
-#endif
-#ifdef BUILD_FLOAT
LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream);
-#else
-LVM_INT32 LVC_Mixer_GetCurrent( LVMixer3_st *pStream);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
LVM_FLOAT TargetGain,
LVM_FLOAT CurrentGain);
-#else
-void LVC_Mixer_Init( LVMixer3_st *pStream,
- LVM_INT32 TargetGain,
- LVM_INT32 CurrentGain);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Mixer_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels);
-#else
-void LVC_Mixer_SetTimeConstant( LVMixer3_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels);
-#else
-void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels);
-#endif
/*** 16 bit functions *************************************************************/
-#ifdef BUILD_FLOAT
void LVC_MixSoft_1St_D16C31_SAT(LVMixer3_1St_FLOAT_st *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -166,14 +96,6 @@
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_st *pInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
-
-#ifdef BUILD_FLOAT
void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -186,14 +108,6 @@
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_st *pInstance,
- LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
-
-#ifdef BUILD_FLOAT
void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st *pInstance,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
@@ -207,20 +121,12 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_MixSoft_2St_D16C31_SAT( LVMixer3_2St_st *pInstance,
- const LVM_INT16 *src1,
- LVM_INT16 *src2,
- LVM_INT16 *dst, /* dst cannot be equal to src2 */
- LVM_INT16 n);
-#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
/* MixerStream[0] applies to Left channel */
/* MixerStream[1] applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
void LVC_MixSoft_1St_MC_float_SAT(LVMixer3_2St_FLOAT_st *pInstance,
const LVM_FLOAT *src,
@@ -233,12 +139,6 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst, /* dst can be equal to src */
LVM_INT16 n); /* Number of stereo samples */
-#else
-void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_st *pInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst, /* dst can be equal to src */
- LVM_INT16 n); /* Number of stereo samples */
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp
index 5990412..d0b50e6 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp
@@ -19,7 +19,6 @@
#include "LVM_Macros.h"
#include "LVC_Mixer_Private.h"
-
/************************************************************************/
/* FUNCTION: */
/* LVMixer3_GetCurrent */
@@ -31,7 +30,6 @@
/* CurrentGain - CurrentGain value in Q 16.15 format */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream)
{
LVM_FLOAT CurrentGain;
@@ -39,12 +37,3 @@
CurrentGain = pInstance->Current; // CurrentGain
return CurrentGain;
}
-#else
-LVM_INT32 LVC_Mixer_GetCurrent( LVMixer3_st *pStream)
-{
- LVM_INT32 CurrentGain;
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- CurrentGain=pInstance->Current>>(16-pInstance->Shift); // CurrentGain in Q16.15 format
- return CurrentGain;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp
index 507eefa..3ae5ba4 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp
@@ -30,7 +30,6 @@
/* TargetGain - TargetGain value in Q 16.15 format */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream)
{
LVM_FLOAT TargetGain;
@@ -39,14 +38,3 @@
TargetGain = pInstance->Target; // TargetGain
return TargetGain;
}
-#else
-LVM_INT32 LVC_Mixer_GetTarget( LVMixer3_st *pStream)
-{
- LVM_INT32 TargetGain;
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
-
- TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
-
- return TargetGain;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp
index 737e26b..c9fd344 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp
@@ -44,7 +44,6 @@
/* void */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
LVM_FLOAT TargetGain,
LVM_FLOAT CurrentGain)
@@ -56,24 +55,3 @@
pInstance->Target = TargetGain; // Update fractional gain Target
pInstance->Current = CurrentGain; // Update fractional gain Current
}
-#else
-void LVC_Mixer_Init( LVMixer3_st *pStream,
- LVM_INT32 TargetGain,
- LVM_INT32 CurrentGain)
-{
- LVM_INT16 Shift=0;
- LVM_INT32 MaxGain=TargetGain; // MaxGain is in Q16.15 format
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- if(CurrentGain>MaxGain)
- MaxGain=CurrentGain; // MaxGain=max(CurrentGain,TargetGain)
-
- MaxGain=MaxGain>>15; // MaxGain in Q31.0 format i.e Integer part only
- while(MaxGain>0){ // Update Shift required to provide integer gain
- Shift++;
- MaxGain=MaxGain>>1;
- }
- pInstance->Target=TargetGain<<(16-Shift); // Update fractional gain Target
- pInstance->Current=CurrentGain<<(16-Shift); // Update fractional gain Current
- pInstance->Shift=Shift; // Update Shift
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
index 453a6a5..123d22b 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
@@ -26,7 +26,6 @@
#include "VectorArithmetic.h"
/* Instance parameter structure */
-#ifdef BUILD_FLOAT
typedef struct
{
/* General */
@@ -34,16 +33,6 @@
LVM_FLOAT Current; /*number specifying value of Current Gain */
LVM_FLOAT Delta; /*number specifying value of Delta Gain */
} Mix_Private_FLOAT_st;
-#else
-typedef struct
-{
- /* General */
- LVM_INT32 Target; /* 32 bit number specifying fractional value of Target Gain */
- LVM_INT32 Current; /* 32 bit number specifying fractional valude of Current Gain */
- LVM_INT32 Shift; /* Left Shift for Integer part of Gain */
- LVM_INT32 Delta; /* 32 bit number specifying the fractional value of Delta Gain */
-} Mix_Private_st;
-#endif
/**********************************************************************************
DEFINITIONS
@@ -57,7 +46,6 @@
***********************************************************************************/
/*** 16 bit functions *************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -69,13 +57,6 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_st *pInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -87,27 +68,12 @@
LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
#endif
-#else
-void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_st *pInstance,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
-#ifdef BUILD_FLOAT
void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_FLOAT_st *pInstance1,
LVMixer3_FLOAT_st *pInstance2,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_st *pInstance1,
- LVMixer3_st *pInstance2,
- const LVM_INT16 *src1,
- const LVM_INT16 *src2,
- LVM_INT16 *dst,
- LVM_INT16 n);
-#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
@@ -115,7 +81,6 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st **ptrInstance,
const LVM_FLOAT *src,
@@ -128,13 +93,6 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src,
- LVM_INT16 *dst, /* dst can be equal to src */
- LVM_INT16 n); /* Number of stereo samples */
-#endif
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
@@ -142,7 +100,6 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-#ifdef BUILD_FLOAT
#ifdef SUPPORT_MC
void LVC_Core_MixHard_1St_MC_float_SAT(Mix_Private_FLOAT_st **ptrInstance,
const LVM_FLOAT *src,
@@ -155,43 +112,9 @@
const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n);
-#else
-void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_st *ptrInstance1,
- LVMixer3_st *ptrInstance2,
- const LVM_INT16 *src,
- LVM_INT16 *dst, /* dst can be equal to src */
- LVM_INT16 n); /* Number of stereo samples */
-#endif
/*** 32 bit functions *************************************************************/
-#ifndef BUILD_FLOAT
-void LVC_Core_MixInSoft_D32C31_SAT( LVMixer3_st *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void LVC_Core_MixSoft_1St_D32C31_WRA( LVMixer3_st *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n);
-
-void LVC_Core_MixHard_2St_D32C31_SAT( LVMixer3_st *pInstance1,
- LVMixer3_st *pInstance2,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n);
-#endif
/**********************************************************************************/
#endif //#ifndef __LVC_MIXER_PRIVATE_H__
-
-
-
-
-
-
-
-
-
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp
index 577179d..47b0cec 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp
@@ -43,32 +43,9 @@
/* void */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_SetTarget(LVMixer3_FLOAT_st *pStream,
LVM_FLOAT TargetGain)
{
Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
pInstance->Target = TargetGain; // Update gain Target
}
-#else
-void LVC_Mixer_SetTarget(LVMixer3_st *pStream,
- LVM_INT32 TargetGain)
-{
- LVM_INT32 Shift=0;
- LVM_INT32 CurrentGain;
- LVM_INT32 MaxGain=TargetGain; // MaxGain is in Q16.15 format
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- CurrentGain=pInstance->Current>>(16-pInstance->Shift); // CurrentGain in Q16.15 format
- if(CurrentGain>MaxGain)
- MaxGain=CurrentGain; // MaxGain=max(CurrentGain,TargetGain)
-
- MaxGain=MaxGain>>15; // MaxGain in Q31.0 format i.e Integer part only
- while(MaxGain>0){ // Update Shift required to provide integer gain
- Shift++;
- MaxGain=MaxGain>>1;
- }
- pInstance->Target=TargetGain<<(16-Shift); // Update fractional gain Target
- pInstance->Current=CurrentGain<<(16-Shift); // Update fractional gain Current
- pInstance->Shift=Shift; // Update Shift
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp
index 9d3ee88..1a8da7a 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp
@@ -44,13 +44,11 @@
/* RETURNS: */
/* void */
/************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_SetTimeConstant(LVMixer3_FLOAT_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels)
{
-#ifdef HIGHER_FS
LVM_FLOAT DeltaTable[13] = {0.500000f,/*8000*/
0.362812f,/*11025*/
0.333333f,/*12000*/
@@ -64,17 +62,6 @@
0.041667f,/*96000*/
0.022676f,/*176400*/
0.020833f};/*192000*/
-#else
- LVM_FLOAT DeltaTable[9] = {0.500000f,/*8000*/
- 0.362812f,/*11025*/
- 0.333333f,/*12000*/
- 0.250000f,/*16000*/
- 0.181406f,/*22050*/
- 0.166666f,/*24000*/
- 0.125000f,/*32000*/
- 0.090703f,/*44100*/
- 0.083333f};/*48000*/
-#endif
Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
LVM_FLOAT Delta = DeltaTable[Fs];
@@ -90,33 +77,3 @@
assign minimum value to Delta */
pInstance->Delta = Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec)
}
-#else
-void LVC_Mixer_SetTimeConstant(LVMixer3_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels)
-{
- LVM_INT32 DeltaTable[9]={1073741824,
- 779132389,
- 715827882,
- 536870912,
- 389566194,
- 357913941,
- 268435456,
- 194783097,
- 178956971};
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- LVM_INT32 Delta=DeltaTable[Fs];
- Delta=Delta>>(NumChannels-1);
-
- if(Tc_millisec==0)
- Delta=0x7FFFFFFF;
- else
- Delta=Delta/Tc_millisec;
-
- if(Delta==0)
- Delta=1; // If Time Constant is so large that Delta is 0, assign minimum value to Delta
-
- pInstance->Delta=Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec) in Q 0.31 format
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp
index 0e0acf1..f335a1e 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_VarSlope_SetTimeConstant.cpp
@@ -19,7 +19,6 @@
#include "LVM_Macros.h"
#include "LVC_Mixer_Private.h"
-
/************************************************************************/
/* FUNCTION: */
/* LVMixer3_VarSlope_SetTimeConstant */
@@ -45,13 +44,11 @@
/* RETURNS: */
/* void */
/************************************************************************/
-#ifdef BUILD_FLOAT
void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
LVM_INT32 Tc_millisec,
LVM_Fs_en Fs,
LVM_INT16 NumChannels)
{
-#ifdef HIGHER_FS
LVM_FLOAT DeltaTable[13] = {0.500000f,/*8000*/
0.362812f,/*11025*/
0.333333f,/*12000*/
@@ -65,17 +62,6 @@
0.041666f,/*96000*/
0.022676f,/*176400*/
0.020833f};/*192000*/
-#else
- LVM_FLOAT DeltaTable[9] = {0.500000f,/*8000*/
- 0.362812f,/*11025*/
- 0.333333f,/*12000*/
- 0.250000f,/*16000*/
- 0.181406f,/*22050*/
- 0.166666f,/*24000*/
- 0.125000f,/*32000*/
- 0.090703f,/*44100*/
- 0.083333f};/*48000*/
-#endif
LVM_FLOAT Tc_millisec_float;
Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
LVM_FLOAT Delta = DeltaTable[Fs];
@@ -112,52 +98,3 @@
pInstance->Delta = Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec)
}
-#else
-void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels)
-{
- LVM_INT32 DeltaTable[9]={1073741824,
- 779132389,
- 715827882,
- 536870912,
- 389566194,
- 357913941,
- 268435456,
- 194783097,
- 178956971};
- Mix_Private_st *pInstance=(Mix_Private_st *)pStream->PrivateParams;
- LVM_INT32 Delta=DeltaTable[Fs];
-
- LVM_INT32 Current;
- LVM_INT32 Target;
-
- Delta=Delta>>(NumChannels-1);
-
- /* Get gain values */
- Current = LVC_Mixer_GetCurrent( pStream );
- Target = LVC_Mixer_GetTarget( pStream );
-
- if (Current != Target)
- {
- Tc_millisec = Tc_millisec * 32767 / (Current - Target);
- if (Tc_millisec<0) Tc_millisec = -Tc_millisec;
-
- if(Tc_millisec==0)
- Delta=0x7FFFFFFF;
- else
- Delta=Delta/Tc_millisec;
-
- if(Delta==0)
- Delta=1; // If Time Constant is so large that Delta is 0, assign minimum value to Delta
- }
- else
- {
- Delta =1; // Minimum value for proper call-backs (setting it to zero has some problems, to be corrected)
- }
-
-
- pInstance->Delta=Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec) in Q 0.31 format
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp b/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp
index 9094622..2497d29 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp
@@ -21,7 +21,6 @@
#include "BIQUAD.h"
#include "Filter.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* void LVM_FO_LPF( LVM_INT32 w , */
@@ -68,7 +67,6 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
FO_FLOAT_Coefs_t *pCoeffs)
{
@@ -97,33 +95,3 @@
return 1;
}
-#else
-LVM_INT32 LVM_FO_HPF( LVM_INT32 w,
- FO_C32_Coefs_t *pCoeffs)
-{
- LVM_INT32 Y,Coefficients[13]={ -8388571,
- 33547744,
- -66816791,
- 173375308,
- -388437573,
- 752975383,
- -1103016663,
- 1121848567,
- -688078159,
- 194669577,
- 8,
- 0,
- 0};
- Y=LVM_Polynomial( (LVM_UINT16)9,
- Coefficients,
- w);
- pCoeffs->B1=-Y; /* Store -B1 in filter structure instead of B1!*/
- /* A0=(1-B1)/2= B1/2 - 0.5*/
- Y=Y>>1; /* A0=Y=B1/2*/
- Y=Y-0x40000000; /* A0=Y=(B1/2 - 0.5)*/
- MUL32x16INTO32(Y, FILTER_LOSS ,pCoeffs->A0 ,15) /* Apply loss to avoid overflow*/
- pCoeffs->A1=-pCoeffs->A0; /* Store A1=-A0*/
-
- return 1;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp b/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp
index 9fe67f8..7bc6046 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp
@@ -21,7 +21,6 @@
#include "BIQUAD.h"
#include "Filter.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* void LVM_FO_LPF( LVM_INT32 w , */
@@ -68,7 +67,6 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
FO_FLOAT_Coefs_t *pCoeffs)
{
@@ -94,30 +92,3 @@
return 1;
}
-#else
-LVM_INT32 LVM_FO_LPF( LVM_INT32 w,
- FO_C32_Coefs_t *pCoeffs)
-{
- LVM_INT32 Y,Coefficients[13]={ -8388571,
- 33547744,
- -66816791,
- 173375308,
- -388437573,
- 752975383,
- -1103016663,
- 1121848567,
- -688078159,
- 194669577,
- 8};
- Y=LVM_Polynomial( (LVM_UINT16)9,
- Coefficients,
- w);
- pCoeffs->B1=-Y; // Store -B1 in filter structure instead of B1!
- // A0=(1+B1)/2= B1/2 + 0.5
- Y=Y>>1; // A0=Y=B1/2
- Y=Y+0x40000000; // A0=Y=(B1/2 + 0.5)
- MUL32x16INTO32(Y, FILTER_LOSS ,pCoeffs->A0 ,15) // Apply loss to avoid overflow
- pCoeffs->A1=pCoeffs->A0;
- return 1;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
index ed8e1fa..2a7cca2 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
@@ -32,16 +32,6 @@
#define LVVDL_2PiByFs_SHIFT1 12 /* Qformat shift for 8kHz, 11.025kHz and 12kHz i.e. 12=41-29 */
#define LVVDL_2PiByFs_SHIFT2 13 /* Qformat shift for 16kHz, 22.050kHz and 24kHz i.e. 13=42-29 */
#define LVVDL_2PiByFs_SHIFT3 14 /* Qformat shift for 32kHz, 44.1kHz and 48kHz i.e. 14=43-29 */
-#ifndef BUILD_FLOAT
-const LVM_INT32 LVVDL_2PiOnFsTable[] = {LVVDL_2PiBy_8000 , /* 8kHz in Q41, 16kHz in Q42, 32kHz in Q43 */
- LVVDL_2PiBy_11025, /* 11025 Hz in Q41, 22050Hz in Q42, 44100 Hz in Q43*/
- LVVDL_2PiBy_12000}; /* 12kHz in Q41, 24kHz in Q42, 48kHz in Q43 */
-
-const LVM_INT32 LVVDL_2PiOnFsShiftTable[]={LVVDL_2PiByFs_SHIFT1 , /* 8kHz, 11025Hz, 12kHz */
- LVVDL_2PiByFs_SHIFT2, /* 16kHz, 22050Hz, 24kHz*/
- LVVDL_2PiByFs_SHIFT3}; /* 32kHz, 44100Hz, 48kHz */
-#endif
-#ifdef BUILD_FLOAT
#define LVVDL_2PiBy_8000_f 0.000785398f
#define LVVDL_2PiBy_11025_f 0.000569903f
#define LVVDL_2PiBy_12000_f 0.000523599f
@@ -52,12 +42,10 @@
#define LVVDL_2PiBy_44100_f 0.000142476f
#define LVVDL_2PiBy_48000_f 0.000130900f
-#ifdef HIGHER_FS
#define LVVDL_2PiBy_88200_f 0.000071238f
#define LVVDL_2PiBy_96000_f 0.000065450f
#define LVVDL_2PiBy_176400_f 0.000035619f
#define LVVDL_2PiBy_192000_f 0.000032725f
-#endif
const LVM_FLOAT LVVDL_2PiOnFsTable[] = {LVVDL_2PiBy_8000_f,
LVVDL_2PiBy_11025_f,
LVVDL_2PiBy_12000_f,
@@ -67,14 +55,11 @@
LVVDL_2PiBy_32000_f,
LVVDL_2PiBy_44100_f,
LVVDL_2PiBy_48000_f
-#ifdef HIGHER_FS
,LVVDL_2PiBy_88200_f
,LVVDL_2PiBy_96000_f
,LVVDL_2PiBy_176400_f
,LVVDL_2PiBy_192000_f
-#endif
};
-#endif
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* LVM_GetOmega */
@@ -92,25 +77,10 @@
/* RETURNS: */
/* w=2*pi*Fc/Fs in Q2.29 format */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
-#ifdef HIGHER_FS
LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc,
LVM_Fs_en Fs)
-#else
-LVM_FLOAT LVM_GetOmega(LVM_UINT16 Fc,
- LVM_Fs_en Fs)
-#endif
{
LVM_FLOAT w;
w = (LVM_FLOAT)Fc * LVVDL_2PiOnFsTable[Fs];
return w;
}
-#else
-LVM_INT32 LVM_GetOmega(LVM_UINT16 Fc,
- LVM_Fs_en Fs)
-{
- LVM_INT32 w;
- MUL32x32INTO32((LVM_INT32)Fc,LVVDL_2PiOnFsTable[Fs%3],w,LVVDL_2PiOnFsShiftTable[Fs/3])
- return w;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
index f1e45fa..244f09d 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
@@ -27,7 +27,6 @@
#ifndef __LVM_MIXER_FILTER_COEFFS_H__
#define __LVM_MIXER_FILTER_COEFFS_H__
-
/************************************************************************************/
/* */
/* Alpha Time Constant table */
@@ -87,7 +86,6 @@
#define ALPHA_49 0 /* Floating point Alpha = 0.000000 */
#define ALPHA_50 0 /* Floating point Alpha = 0.000000 */
-#ifdef BUILD_FLOAT /* BUILD_FLOAT */
#define ALPHA_Float_0 0.999999f
#define ALPHA_Float_1 0.999998f
#define ALPHA_Float_2 0.999997f
@@ -139,6 +137,5 @@
#define ALPHA_Float_48 0.000000f
#define ALPHA_Float_49 0.000000f
#define ALPHA_Float_50 0.000000f
-#endif
#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp
index 18b2782..73da2cf 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp
@@ -20,7 +20,6 @@
#include "Mixer.h"
#include "LVM_Mixer_FilterCoeffs.h"
-
/************************************************************************/
/* FUNCTION: */
/* LVM_Mix_GetTimeConstant */
@@ -57,13 +56,8 @@
/* Alpha - the filter coefficient Q31 format */
/* */
/************************************************************************/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc,
-#ifdef HIGHER_FS
LVM_UINT32 Fs,
-#else
- LVM_UINT16 Fs,
-#endif
LVM_UINT16 NumChannels)
{
@@ -160,101 +154,3 @@
return ProductFloat;
}
-#else
-LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32 tc,
- LVM_UINT16 Fs,
- LVM_UINT16 NumChannels)
-{
-
- LVM_UINT32 Product;
- LVM_INT16 Interpolate;
- LVM_UINT16 Shift;
- LVM_INT32 Diff;
- LVM_UINT32 Table[] = {ALPHA_0, /* Log spaced look-up table */
- ALPHA_1,
- ALPHA_2,
- ALPHA_3,
- ALPHA_4,
- ALPHA_5,
- ALPHA_6,
- ALPHA_7,
- ALPHA_8,
- ALPHA_9,
- ALPHA_10,
- ALPHA_11,
- ALPHA_12,
- ALPHA_13,
- ALPHA_14,
- ALPHA_15,
- ALPHA_16,
- ALPHA_17,
- ALPHA_18,
- ALPHA_19,
- ALPHA_20,
- ALPHA_21,
- ALPHA_22,
- ALPHA_23,
- ALPHA_24,
- ALPHA_25,
- ALPHA_26,
- ALPHA_27,
- ALPHA_28,
- ALPHA_29,
- ALPHA_30,
- ALPHA_31,
- ALPHA_32,
- ALPHA_33,
- ALPHA_34,
- ALPHA_35,
- ALPHA_36,
- ALPHA_37,
- ALPHA_38,
- ALPHA_39,
- ALPHA_40,
- ALPHA_41,
- ALPHA_42,
- ALPHA_43,
- ALPHA_44,
- ALPHA_45,
- ALPHA_46,
- ALPHA_47,
- ALPHA_48,
- ALPHA_49,
- ALPHA_50};
-
-
- /* Calculate the product of the time constant and the sample rate */
- Product = ((tc >> 16) * (LVM_UINT32)Fs) << 13; /* Stereo value */
- Product = Product + (((tc & 0x0000FFFF) * (LVM_UINT32)Fs) >> 3);
-
- if (NumChannels == 1)
- {
- Product = Product >> 1; /* Mono value */
- }
-
- /* Normalize to get the table index and interpolation factor */
- for (Shift=0; Shift<((Alpha_TableSize-1)/2); Shift++)
- {
- if ((Product & 0x80000000)!=0)
- {
- break;
- }
-
- Product = Product << 1;
- }
- Shift = (LVM_UINT16)((Shift << 1));
-
- if ((Product & 0x40000000)==0)
- {
- Shift++;
- }
-
- Interpolate = (LVM_INT16)((Product >> 15) & 0x00007FFF);
-
- Diff = (LVM_INT32)(Table[Shift] - Table[Shift+1]);
- MUL32x16INTO32(Diff,Interpolate,Diff,15)
- Product = Table[Shift+1] + (LVM_UINT32)Diff;
-
- return Product;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
index cd57767..2c3e9ec 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
@@ -40,7 +40,6 @@
/* RETURNS: */
/* The result of the polynomial expansion in Q1.31 format */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Polynomial(LVM_UINT16 N,
LVM_FLOAT *pCoefficients,
LVM_FLOAT X)
@@ -62,7 +61,6 @@
sign *= Temp;
}
-
}
else
{
@@ -81,57 +79,3 @@
}
return Y;
}
-#else
-LVM_INT32 LVM_Polynomial(LVM_UINT16 N,
- LVM_INT32 *pCoefficients,
- LVM_INT32 X)
-{
- LVM_INT32 i;
- LVM_INT32 Y,A,XTemp,Temp,sign;
-
- Y=*pCoefficients; /* Y=A0*/
- pCoefficients++;
-
- if((LVM_UINT32)X==0x80000000)
- {
- Temp=-1;
- sign=Temp;
- for(i=1;i<=N;i++)
- {
- Y+=((*pCoefficients)*sign);
- pCoefficients++;
- sign*=Temp;
- }
-
-
- }
- else
- {
- XTemp=X;
- for(i=N-1;i>=0;i--)
- {
- A=*pCoefficients;
- pCoefficients++;
-
- MUL32x32INTO32(A,XTemp,Temp,31)
- Y+=Temp;
-
- MUL32x32INTO32(XTemp,X,Temp,31)
- XTemp=Temp;
- }
- }
- A=*pCoefficients;
- pCoefficients++;
-
- if(A<0)
- {
- A=Abs_32(A);
- Y=Y>>A;
- }
- else
- {
- Y = Y<<A;
- }
- return Y;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp b/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
index 8785594..ae8e9d1 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
@@ -20,7 +20,6 @@
#include "ScalarArithmetic.h"
#include "Filter.h"
-
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* LVM_Power10 */
@@ -54,7 +53,6 @@
/* RETURNS: */
/* The result of the 10x expansion in Q8.24 format */
/*-------------------------------------------------------------------------*/
-#ifdef BUILD_FLOAT
LVM_FLOAT LVM_Power10(LVM_FLOAT X)
{
LVM_FLOAT Y,Coefficients[13]={0.999906f,
@@ -75,25 +73,3 @@
X);
return Y;
}
-#else
-LVM_INT32 LVM_Power10(LVM_INT32 X)
-{
- LVM_INT32 Y,Coefficients[13]={ 16775636,
- 77258249,
- 178024032,
- 273199333,
- 312906284,
- 288662365,
- 228913700,
- 149470921,
- 71094558,
- 37565524,
- 31223618,
- 12619311,
- 0};
- Y=LVM_Polynomial((LVM_UINT16)11,
- Coefficients,
- X);
- return Y;
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Timer_Private.h b/media/libeffects/lvm/lib/Common/src/LVM_Timer_Private.h
index 0dd4272..a372b82 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Timer_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Timer_Private.h
@@ -18,9 +18,6 @@
#ifndef LVM_TIMER_PRIVATE_H
#define LVM_TIMER_PRIVATE_H
-
-
-
#include "LVM_Types.h"
/****************************************************************************************/
@@ -42,5 +39,4 @@
/* END OF HEADER */
/****************************************************************************************/
-
#endif /* LVM_TIMER_PRIVATE_H */
diff --git a/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp b/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
index 9e14c3b..c789756 100644
--- a/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
@@ -24,7 +24,6 @@
/**********************************************************************************
FUNCTION LoadConst_32
***********************************************************************************/
-#ifdef BUILD_FLOAT
void LoadConst_Float(const LVM_FLOAT val,
LVM_FLOAT *dst,
LVM_INT16 n )
@@ -39,21 +38,5 @@
return;
}
-#else
-void LoadConst_32(const LVM_INT32 val,
- LVM_INT32 *dst,
- LVM_INT16 n )
-{
- LVM_INT16 ii;
-
- for (ii = n; ii != 0; ii--)
- {
- *dst = val;
- dst++;
- }
-
- return;
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp b/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp
index 02c906a..1ea765a 100644
--- a/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp
@@ -33,7 +33,6 @@
LVM_INT32 temp,mVal,sVal;
LVM_INT16 ii;
-
for (ii = n; ii != 0; ii--)
{
mVal=(LVM_INT32)*srcM;
@@ -77,7 +76,6 @@
return;
}
-#ifdef BUILD_FLOAT
void MSTo2i_Sat_Float(const LVM_FLOAT *srcM,
const LVM_FLOAT *srcS,
LVM_FLOAT *dst,
@@ -86,7 +84,6 @@
LVM_FLOAT temp,mVal,sVal;
LVM_INT16 ii;
-
for (ii = n; ii != 0; ii--)
{
mVal = (LVM_FLOAT)*srcM;
@@ -130,5 +127,4 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp
index ef04ae8..6584251 100644
--- a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp
@@ -44,7 +44,6 @@
LVM_INT16 srcval;
LVM_INT32 Temp,dInVal;
-
for (ii = n; ii != 0; ii--)
{
srcval=*src;
@@ -77,5 +76,3 @@
/**********************************************************************************/
-
-
diff --git a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp
index 17fd833..5d5564f 100644
--- a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp
@@ -34,7 +34,6 @@
LVM_INT16 ii;
LVM_INT32 srcval,temp, dInVal, dOutVal;
-
for (ii = n; ii != 0; ii--)
{
srcval=*src;
@@ -45,7 +44,6 @@
dInVal = *dst;
dOutVal = temp + dInVal;
-
if ((((dOutVal ^ temp) & (dOutVal ^ dInVal)) >> 31)!=0) /* overflow / underflow */
{
if(temp<0)
@@ -64,7 +62,6 @@
return;
}
-#ifdef BUILD_FLOAT
void Mac3s_Sat_Float(const LVM_FLOAT *src,
const LVM_FLOAT val,
LVM_FLOAT *dst,
@@ -101,8 +98,5 @@
return;
}
-#endif
/**********************************************************************************/
-
-
diff --git a/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp
index 16e367b..7c7b36f 100644
--- a/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp
@@ -32,7 +32,6 @@
/**********************************************************************************
FUNCTION MIXINSOFT_D32C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -96,64 +95,4 @@
}
}
}
-#else
-void MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Alpha == 0){
- pInstance->Current = pInstance->Target;
- }else if ((pInstance->Current-pInstance->Target <POINT_ZERO_ONE_DB)&&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB)){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- }else{
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- Core_MixInSoft_D32C31_SAT( pInstance, src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing){
- if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
- if ((pInstance->Target>>16) == 0x7FFF)
- Add2_Sat_32x32( src, dst, n );
- else{
- Core_MixInSoft_D32C31_SAT( pInstance, src, dst, n);
- pInstance->Current = pInstance->Target; /* In case the core function would have changed the Current value */
- }
- }
- }
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
- /* Call back before the hard mixing, because in this case, hard mixing makes
- use of the core soft mix function which can change the Current value! */
-
- if (pInstance->CallbackSet){
- if ((pInstance->Current-pInstance->Target <POINT_ZERO_ONE_DB)&&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB)){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- pInstance->CallbackSet = FALSE;
- if (pInstance->pCallBack != 0){
- (*pInstance->pCallBack) ( pInstance->pCallbackHandle, pInstance->pGeneralPurpose,pInstance->CallbackParam );
- }
- }
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.cpp b/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.cpp
index 869293b..d3325ec 100644
--- a/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MixSoft_1St_D32C31_WRA.cpp
@@ -29,12 +29,9 @@
#define TRUE 1
#define FALSE 0
-
-
/**********************************************************************************
FUNCTION MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
-#ifdef BUILD_FLOAT
void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -95,62 +92,4 @@
}
}
}
-#else
-void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Alpha == 0){
- pInstance->Current = pInstance->Target;
- }else if ((pInstance->Current-pInstance->Target <POINT_ZERO_ONE_DB)&&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB)){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- }else{
- /* Soft mixing has to be applied */
- HardMixing = FALSE;
- Core_MixSoft_1St_D32C31_WRA( pInstance, src, dst, n);
- }
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- if (HardMixing){
- if (pInstance->Target == 0)
- LoadConst_32(0, dst, n);
- else if ((pInstance->Target>>16) == 0x7FFF){
- if (src != dst)
- Copy_16((LVM_INT16*)src, (LVM_INT16*)dst, (LVM_INT16)(n * 2));
- }
- else
- Mult3s_32x16( src, (LVM_INT16)(pInstance->Current>>16), dst, n );
- }
-
- /******************************************************************************
- CALL BACK
- *******************************************************************************/
-
- if (pInstance->CallbackSet){
- if ((pInstance->Current-pInstance->Target <POINT_ZERO_ONE_DB)&&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB)){
- pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
- pInstance->CallbackSet = FALSE;
- if (pInstance->pCallBack != 0){
- (*pInstance->pCallBack) ( pInstance->pCallbackHandle, pInstance->pGeneralPurpose,pInstance->CallbackParam );
- }
- }
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.cpp b/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.cpp
index e6faa74..b002738 100644
--- a/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MixSoft_2St_D32C31_SAT.cpp
@@ -22,11 +22,9 @@
#include "Mixer_private.h"
#include "VectorArithmetic.h"
-
/**********************************************************************************
FUNCTION MIXSOFT_2ST_D32C31_SAT
***********************************************************************************/
-#ifdef BUILD_FLOAT
void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
const LVM_FLOAT *src1,
const LVM_FLOAT *src2,
@@ -64,41 +62,5 @@
Core_MixHard_2St_D32C31_SAT(pInstance, src1, src2, dst, n);
}
}
-#else
-void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
- const LVM_INT32 *src1,
- const LVM_INT32 *src2,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
-
- if(n<=0) return;
-
- /******************************************************************************
- SOFT MIXING
- *******************************************************************************/
- if ((pInstance->Current1 != pInstance->Target1) || (pInstance->Current2 != pInstance->Target2))
- {
- MixSoft_1St_D32C31_WRA( (Mix_1St_Cll_t*) pInstance, src1, dst, n);
- MixInSoft_D32C31_SAT( (void *) &pInstance->Alpha2, /* Cast to void: no dereferencing in function*/
- src2, dst, n);
- }
-
- /******************************************************************************
- HARD MIXING
- *******************************************************************************/
-
- else
- {
- if (pInstance->Current1 == 0)
- MixSoft_1St_D32C31_WRA( (void *) &pInstance->Alpha2, /* Cast to void: no dereferencing in function*/
- src2, dst, n);
- else if (pInstance->Current2 == 0)
- MixSoft_1St_D32C31_WRA( (Mix_1St_Cll_t*) pInstance, src1, dst, n);
- else
- Core_MixHard_2St_D32C31_SAT( pInstance, src1, src2, dst, n);
- }
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mixer_private.h b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
index 00d55ed..1d653bb 100644
--- a/media/libeffects/lvm/lib/Common/src/Mixer_private.h
+++ b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
@@ -26,10 +26,8 @@
#define POINT_ZERO_ONE_DB 2473805 /* 0.01 dB on a full scale signal = (10^(0.01/20) -1) * 2^31 */
-#ifdef BUILD_FLOAT
#define POINT_ZERO_ONE_DB_FLOAT 0.001152 /* 0.01 dB on a full scale \
signal = (10^(0.01/20) -1) * 2^31 */
-#endif
/**********************************************************************************
DEFINITIONS
***********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
index 796a15c..603d1fc 100644
--- a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
@@ -45,7 +45,6 @@
return;
}
-#ifdef BUILD_FLOAT
void MonoTo2I_Float( const LVM_FLOAT *src,
LVM_FLOAT *dst,
LVM_INT16 n)
@@ -66,5 +65,4 @@
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
index c758560..370c39a 100644
--- a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
@@ -47,7 +47,6 @@
return;
}
-#ifdef BUILD_FLOAT
void Mult3s_Float( const LVM_FLOAT *src,
const LVM_FLOAT val,
LVM_FLOAT *dst,
@@ -65,5 +64,4 @@
}
return;
}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
index 5156edc..36d1149 100644
--- a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
@@ -71,7 +71,6 @@
LVM_INT32 SampleNo; /* Sample index */
LVM_INT16 Temp;
-
/*
* Process a block of samples
*/
@@ -84,7 +83,6 @@
Sample = *pDataIn;
pDataIn++;
-
/*
* Apply the compander, this compresses the signal at the expense of
* harmonic distortion. The amount of compression is control by the
@@ -103,18 +101,15 @@
}
}
-
/*
* Save the output
*/
*pDataOut = Sample;
pDataOut++;
-
}
}
-#ifdef BUILD_FLOAT
void NonLinComp_Float(LVM_FLOAT Gain,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -125,7 +120,6 @@
LVM_INT32 SampleNo; /* Sample index */
LVM_FLOAT Temp;
-
/*
* Process a block of samples
*/
@@ -137,7 +131,6 @@
Sample = *pDataIn;
pDataIn++;
-
/*
* Apply the compander, this compresses the signal at the expense of
* harmonic distortion. The amount of compression is control by the
@@ -156,7 +149,6 @@
}
}
-
/*
* Save the output
*/
@@ -164,4 +156,3 @@
pDataOut++;
}
}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp
index 6c8b2db..3f62f99 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp
@@ -27,7 +27,6 @@
pBiquadState->coefs[2] is -B1, these are in Q14 format
pBiquadState->coefs[3] is Gain, in Q11 format
-
DELAYS-
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
@@ -38,7 +37,6 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-#ifdef BUILD_FLOAT
void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
LVM_FLOAT *pDataIn,
LVM_FLOAT *pDataOut,
@@ -51,7 +49,6 @@
for (ii = NrSamples; ii != 0; ii--)
{
-
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
@@ -193,85 +190,3 @@
}
#endif
-#else
-void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,ynLO,ynRO,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL= (A0 (Q14) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>14) in Q0*/
- templ=(*pDataIn)-pBiquadState->pDelays[2];
- MUL32x16INTO32(templ,pBiquadState->coefs[0],ynL,14)
-
- /* ynL+= ((-B2 (Q14) * y(n-2)L (Q0) ) >>14) in Q0*/
- MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[1],templ,14)
- ynL+=templ;
-
- /* ynL+= ((-B1 (Q14) * y(n-1)L (Q0) ) >>14) in Q0 */
- MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[2],templ,14)
- ynL+=templ;
-
- /* ynLO= ((Gain (Q11) * ynL (Q0))>>11) in Q0*/
- MUL32x16INTO32(ynL,pBiquadState->coefs[3],ynLO,11)
-
- /* ynLO=( ynLO(Q0) + x(n)L (Q0) ) in Q0*/
- ynLO+= (*pDataIn);
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR= (A0 (Q14) * (x(n)R (Q0) - x(n-2)R (Q0) ) >>14) in Q0*/
- templ=(*(pDataIn+1))-pBiquadState->pDelays[3];
- MUL32x16INTO32(templ,pBiquadState->coefs[0],ynR,14)
-
- /* ynR+= ((-B2 (Q14) * y(n-2)R (Q0) ) >>14) in Q0*/
- MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[1],templ,14)
- ynR+=templ;
-
- /* ynR+= ((-B1 (Q14) * y(n-1)R (Q0) ) >>14) in Q0 */
- MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[2],templ,14)
- ynR+=templ;
-
- /* ynRO= ((Gain (Q11) * ynR (Q0))>>11) in Q0*/
- MUL32x16INTO32(ynR,pBiquadState->coefs[3],ynRO,11)
-
- /* ynRO=( ynRO(Q0) + x(n)R (Q0) ) in Q0*/
- ynRO+= (*(pDataIn+1));
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR; /* Update y(n-1)R in Q0*/
- pBiquadState->pDelays[4]=ynL; /* Update y(n-1)L in Q0*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=ynLO; /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=ynRO; /* Write Right ouput in Q0*/
- pDataOut++;
-
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.cpp b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.cpp
index f705cbf..41de1de 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.cpp
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.cpp
@@ -27,7 +27,6 @@
pBiquadState->coefs[2] is -B1, these are in Q30 format
pBiquadState->coefs[3] is Gain, in Q11 format
-
DELAYS-
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
@@ -38,83 +37,3 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-#ifndef BUILD_FLOAT
-void PK_2I_D32F32C30G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
- LVM_INT32 *pDataIn,
- LVM_INT32 *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_INT32 ynL,ynR,ynLO,ynRO,templ;
- LVM_INT16 ii;
- PFilter_State pBiquadState = (PFilter_State) pInstance;
-
- for (ii = NrSamples; ii != 0; ii--)
- {
-
-
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL= (A0 (Q30) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>30) in Q0*/
- templ=(*pDataIn)-pBiquadState->pDelays[2];
- MUL32x32INTO32(templ,pBiquadState->coefs[0],ynL,30)
-
- /* ynL+= ((-B2 (Q30) * y(n-2)L (Q0) ) >>30) in Q0*/
- MUL32x32INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[1],templ,30)
- ynL+=templ;
-
- /* ynL+= ((-B1 (Q30) * y(n-1)L (Q0) ) >>30) in Q0 */
- MUL32x32INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[2],templ,30)
- ynL+=templ;
-
- /* ynLO= ((Gain (Q11) * ynL (Q0))>>11) in Q0*/
- MUL32x16INTO32(ynL,pBiquadState->coefs[3],ynLO,11)
- /* ynLO=( ynLO(Q0) + x(n)L (Q0) ) in Q0*/
- ynLO+= (*pDataIn);
-
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR= (A0 (Q30) * (x(n)R (Q0) - x(n-2)R (Q0) ) >>30) in Q0*/
- templ=(*(pDataIn+1))-pBiquadState->pDelays[3];
- MUL32x32INTO32(templ,pBiquadState->coefs[0],ynR,30)
-
- /* ynR+= ((-B2 (Q30) * y(n-2)R (Q0) ) >>30) in Q0*/
- MUL32x32INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[1],templ,30)
- ynR+=templ;
-
- /* ynR+= ((-B1 (Q30) * y(n-1)R (Q0) ) >>30) in Q0 */
- MUL32x32INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[2],templ,30)
- ynR+=templ;
-
- /* ynRO= ((Gain (Q11) * ynR (Q0))>>11) in Q0*/
- MUL32x16INTO32(ynR,pBiquadState->coefs[3],ynRO,11)
-
- /* ynRO=( ynRO(Q0) + x(n)R (Q0) ) in Q0*/
- ynRO+= (*(pDataIn+1));
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
- pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
- pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
- pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
- pBiquadState->pDelays[5]=ynR; /* Update y(n-1)R in Q0*/
- pBiquadState->pDelays[4]=ynL; /* Update y(n-1)L in Q0*/
- pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
- pDataIn++;
- pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut=ynLO; /* Write Left output in Q0*/
- pDataOut++;
- *pDataOut=ynRO; /* Write Right ouput in Q0*/
- pDataOut++;
- }
-
- }
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp
index 65475a3..714aa52 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp
@@ -18,21 +18,3 @@
#include "BIQUAD.h"
#include "PK_2I_D32F32CllGss_TRC_WRA_01_Private.h"
-#ifndef BUILD_FLOAT
-void PK_2I_D32F32CllGss_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- PK_C32_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0]=pCoef->A0;
-
- pBiquadState->coefs[1]=pCoef->B2;
-
- pBiquadState->coefs[2]=pCoef->B1;
-
- pBiquadState->coefs[3]=pCoef->G;
-
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp
index a36330e..f6c05da 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp
@@ -17,7 +17,6 @@
#include "BIQUAD.h"
#include "PK_2I_D32F32CssGss_TRC_WRA_01_Private.h"
-#ifdef BUILD_FLOAT
void PK_2I_D32F32CssGss_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance,
Biquad_2I_Order2_FLOAT_Taps_t *pTaps,
PK_FLOAT_Coefs_t *pCoef)
@@ -33,21 +32,3 @@
pBiquadState->coefs[3] = pCoef->G;
}
-#else
-void PK_2I_D32F32CssGss_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
- Biquad_2I_Order2_Taps_t *pTaps,
- PK_C16_Coefs_t *pCoef)
-{
- PFilter_State pBiquadState = (PFilter_State) pInstance;
- pBiquadState->pDelays =(LVM_INT32 *) pTaps;
-
- pBiquadState->coefs[0]=pCoef->A0;
-
- pBiquadState->coefs[1]=pCoef->B2;
-
- pBiquadState->coefs[2]=pCoef->B1;
-
- pBiquadState->coefs[3]=pCoef->G;
-
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
index 1e32062..cc924c4 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Private.h
@@ -18,11 +18,9 @@
#ifndef _PK_2I_D32F32CSSGSS_TRC_WRA_01_PRIVATE_H_
#define _PK_2I_D32F32CSSGSS_TRC_WRA_01_PRIVATE_H_
-
/* The internal state variables are implemented in a (for the user) hidden structure */
/* In this (private) file, the internal structure is declared fro private use. */
-#ifdef BUILD_FLOAT
typedef struct _Filter_State_Float_
{
LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
@@ -30,7 +28,6 @@
}Filter_State_Float;
typedef Filter_State_Float * PFilter_State_Float ;
-#endif
typedef struct _Filter_State_
{
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
diff --git a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.cpp b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.cpp
index 28fea65..668a4b6 100644
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v16xv16.cpp
@@ -24,58 +24,4 @@
/**********************************************************************************
FUNCTION Shift_Sat_v16xv16
***********************************************************************************/
-#ifndef BUILD_FLOAT
-void Shift_Sat_v16xv16 (const LVM_INT16 val,
- const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 temp;
- LVM_INT32 ii;
- LVM_INT16 RShift;
- if(val>0)
- {
- for (ii = n; ii != 0; ii--)
- {
- temp = (LVM_INT32)*src;
- src++;
-
- temp = temp << val;
-
- if (temp > 0x00007FFF)
- {
- *dst = 0x7FFF;
- }
- else if (temp < -0x00008000)
- {
- *dst = - 0x8000;
- }
- else
- {
- *dst = (LVM_INT16)temp;
- }
- dst++;
- }
- }
- else if(val<0)
- {
- RShift=(LVM_INT16)(-val);
-
- for (ii = n; ii != 0; ii--)
- {
- *dst = (LVM_INT16)(*src >> RShift);
- dst++;
- src++;
- }
- }
- else
- {
- if(src!=dst)
- {
- Copy_16(src,dst,n);
- }
- }
- return;
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp
index fac9de7..97a04c1 100644
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp
@@ -24,7 +24,6 @@
/**********************************************************************************
FUNCTION Shift_Sat_v32xv32
***********************************************************************************/
-#ifdef BUILD_FLOAT
void Shift_Sat_Float (const LVM_INT16 val,
const LVM_FLOAT *src,
LVM_FLOAT *dst,
@@ -79,60 +78,4 @@
}
return;
}
-#else
-void Shift_Sat_v32xv32 (const LVM_INT16 val,
- const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
- LVM_INT32 ii;
- LVM_INT16 RShift;
-
- if(val>0)
- {
- LVM_INT32 a,b;
-
- for (ii = n; ii != 0; ii--)
- {
- a=*src;
- src++;
-
- b=(a<<val);
-
- if( (b>>val) != a ) /* if overflow occured, right shift will show difference*/
- {
- if(a<0)
- {
- b=0x80000000l;
- }
- else
- {
- b=0x7FFFFFFFl;
- }
- }
-
- *dst = b;
- dst++;
- }
- }
- else if(val<0)
- {
- RShift=(LVM_INT16)(-val);
- for (ii = n; ii != 0; ii--)
- {
- *dst = (*src >> RShift);
- dst++;
- src++;
- }
- }
- else
- {
- if(src!=dst)
- {
- Copy_16((LVM_INT16 *)src,(LVM_INT16 *)dst,(LVM_INT16)(n<<1));
- }
- }
- return;
-}
-#endif
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp b/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp
index 9a726f2..4da2013 100644
--- a/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp
@@ -29,10 +29,7 @@
/*######################################################################################*/
#include "ScalarArithmetic.h"
-#ifdef BUILD_FLOAT
#include <math.h>
-#endif
-
/****************************************************************************************
* Name : dB_to_Lin32()
@@ -67,7 +64,6 @@
#define SECOND_COEF 38836
#define MAX_VALUE 1536 /* 96 * 16 */
-#ifdef BUILD_FLOAT
LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix)
{
LVM_FLOAT dB_Float;
@@ -78,47 +74,3 @@
return LinFloat;
}
-#else
-LVM_INT32 dB_to_Lin32(LVM_INT16 db_fix)
-{
- LVM_INT32 Lin_val_32;
- LVM_INT16 Shift;
- LVM_INT32 Remain;
-
-
- /*
- * Check sign of the input
- */
- if (db_fix<0)
- {
- if (db_fix > -MAX_VALUE)
- {
- Shift = (LVM_INT16)((((LVM_UINT32)(-db_fix) >> 4) * FOUR_OVER_SIX) >> 17); /* Number of 6dB steps in Q11.4 format */
- Remain = -db_fix - (Shift * SIX_DB);
- Remain = (0x7FFFFFFF - (Remain * FIRST_COEF_NEG)) + (Remain * Remain * SECOND_COEF);
- Lin_val_32 = (LVM_INT32)((LVM_UINT32)Remain >> (16 + Shift));
- }
- else
- {
- Lin_val_32 = 0;
- }
- }
- else
- {
- if (db_fix < MAX_VALUE)
- {
- Shift = (LVM_INT16)((((LVM_UINT32)db_fix >> 4) * FOUR_OVER_SIX) >> 17); /* Number of 6dB steps in Q11.4 format */
- Remain = db_fix - (Shift * SIX_DB);
- Remain = 0x3FFFFFFF + (Remain * FIRST_COEF_POS) + (Remain * Remain * SECOND_COEF);
- Lin_val_32 = (LVM_INT32)((LVM_UINT32)Remain >> (15 - Shift));
- }
- else
- {
- Lin_val_32 = 0x7FFFFFFF;
- }
- }
-
-
- return Lin_val_32; /* format 1.16.15 */
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
index 7e2c3a4..c5ddf77 100644
--- a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
+++ b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
@@ -68,12 +68,9 @@
/* */
/****************************************************************************************/
-
#ifndef __LVEQNB_H__
#define __LVEQNB_H__
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -109,7 +106,6 @@
/* Instance handle */
typedef void *LVEQNB_Handle_t;
-
/* Operating modes */
typedef enum
{
@@ -118,7 +114,6 @@
LVEQNB_MODE_MAX = LVM_MAXINT_32
} LVEQNB_Mode_en;
-
/* Filter mode control */
typedef enum
{
@@ -127,7 +122,6 @@
LVEQNB_FILTER_DUMMY = LVM_MAXINT_32
} LVEQNB_FilterMode_en;
-
/* Memory Types */
typedef enum
{
@@ -138,7 +132,6 @@
LVEQNB_MEMORY_MAX = LVM_MAXINT_32
} LVEQNB_MemoryTypes_en;
-
/* Function return status */
typedef enum
{
@@ -149,7 +142,6 @@
LVEQNB_STATUS_MAX = LVM_MAXINT_32
} LVEQNB_ReturnStatus_en;
-
/****************************************************************************************/
/* */
/* Linked enumerated type and capability definitions */
@@ -187,7 +179,6 @@
LVEQNB_SOURCE_MAX = LVM_MAXINT_32
} LVEQNB_SourceFormat_en;
-
/*
* Supported sample rates in samples per second
*/
@@ -200,12 +191,10 @@
#define LVEQNB_CAP_FS_32000 64
#define LVEQNB_CAP_FS_44100 128
#define LVEQNB_CAP_FS_48000 256
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
#define LVEQNB_CAP_FS_88200 512
#define LVEQNB_CAP_FS_96000 1024
#define LVEQNB_CAP_FS_176400 2048
#define LVEQNB_CAP_FS_192000 4096
-#endif
typedef enum
{
@@ -218,16 +207,13 @@
LVEQNB_FS_32000 = 6,
LVEQNB_FS_44100 = 7,
LVEQNB_FS_48000 = 8,
-#ifdef HIGHER_FS
LVEQNB_FS_88200 = 9,
LVEQNB_FS_96000 = 10,
LVEQNB_FS_176400 = 11,
LVEQNB_FS_192000 = 12,
-#endif
LVEQNB_FS_MAX = LVM_MAXINT_32
} LVEQNB_Fs_en;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -243,14 +229,12 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVEQNB_MemoryRegion_t;
-
/* Memory table containing the region definitions */
typedef struct
{
LVEQNB_MemoryRegion_t Region[LVEQNB_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVEQNB_MemTab_t;
-
/* Equaliser band definition */
typedef struct
{
@@ -259,7 +243,6 @@
LVM_UINT16 QFactor; /* Band quality factor */
} LVEQNB_BandDef_t;
-
/* Parameter structure */
typedef struct
{
@@ -276,7 +259,6 @@
#endif
} LVEQNB_Params_t;
-
/* Capability structure */
typedef struct
{
@@ -293,7 +275,6 @@
} LVEQNB_Capabilities_t;
-
/****************************************************************************************/
/* */
/* Function Prototypes */
@@ -336,7 +317,6 @@
LVEQNB_MemTab_t *pMemoryTable,
LVEQNB_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Init */
@@ -376,7 +356,6 @@
LVEQNB_MemTab_t *pMemoryTable,
LVEQNB_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_GetParameters */
@@ -401,7 +380,6 @@
LVEQNB_ReturnStatus_en LVEQNB_GetParameters(LVEQNB_Handle_t hInstance,
LVEQNB_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_GetCapabilities */
@@ -426,7 +404,6 @@
LVEQNB_ReturnStatus_en LVEQNB_GetCapabilities(LVEQNB_Handle_t hInstance,
LVEQNB_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Control */
@@ -452,7 +429,6 @@
LVEQNB_ReturnStatus_en LVEQNB_Control(LVEQNB_Handle_t hInstance,
LVEQNB_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Process */
@@ -475,20 +451,10 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#else
-LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#endif
-
-
-
#endif /* __LVEQNB__ */
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp
index 482e3ba..c3c0fad 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp
@@ -22,9 +22,7 @@
/****************************************************************************************/
#include "LVEQNB_Private.h"
-#ifdef BUILD_FLOAT
#include <math.h>
-#endif
/****************************************************************************************/
/* */
@@ -78,101 +76,6 @@
/* */
/****************************************************************************************/
-
-#ifndef BUILD_FLOAT
-LVEQNB_ReturnStatus_en LVEQNB_DoublePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_C32_Coefs_t *pCoefficients)
-{
-
- extern LVM_INT16 LVEQNB_GainTable[];
- extern LVM_INT16 LVEQNB_TwoPiOnFsTable[];
- extern LVM_INT16 LVEQNB_DTable[];
- extern LVM_INT16 LVEQNB_DPCosCoef[];
-
- /*
- * Get the filter definition
- */
- LVM_INT16 Gain = pFilterDefinition->Gain;
- LVM_UINT16 Frequency = pFilterDefinition->Frequency;
- LVM_UINT16 QFactor = pFilterDefinition->QFactor;
-
- /*
- * Intermediate variables and temporary values
- */
- LVM_INT32 T0;
- LVM_INT16 D;
- LVM_INT32 A0;
- LVM_INT32 B1;
- LVM_INT32 B2;
- LVM_INT32 Dt0;
- LVM_INT32 B2_Den;
- LVM_INT32 B2_Num;
- LVM_INT32 CosErr;
- LVM_INT16 coef;
- LVM_INT32 factor;
- LVM_INT16 t0;
- LVM_INT16 i;
-
- /*
- * Calculating the intermediate values
- */
- T0 = (LVM_INT32)Frequency * LVEQNB_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
- if (Gain >= 0)
- {
- D = LVEQNB_DTable[15]; /* D = 1 if GaindB >= 0 */
- }
- else
- {
- D = LVEQNB_DTable[Gain+15]; /* D = 1 / (1 + G) if GaindB < 0 */
- }
-
- /*
- * Calculate the B2 coefficient
- */
- Dt0 = D * (T0 >> 10);
- B2_Den = ((LVM_INT32)QFactor << 19) + (Dt0 >> 2);
- B2_Num = (Dt0 >> 3) - ((LVM_INT32)QFactor << 18);
- B2 = (B2_Num / (B2_Den >> 16)) << 15;
-
- /*
- * Calculate the cosine error by a polynomial expansion using the equation:
- *
- * CosErr += coef(n) * t0^n For n = 0 to 4
- */
- T0 = (T0 >> 6) * 0x7f53; /* Scale to 1.0 in 16-bit for range 0 to fs/50 */
- t0 = (LVM_INT16)(T0 >> 16);
- factor = 0x7fff; /* Initialise to 1.0 for the a0 coefficient */
- CosErr = 0; /* Initialise the error to zero */
- for (i=1; i<5; i++)
- {
- coef = LVEQNB_DPCosCoef[i]; /* Get the nth coefficient */
- CosErr += (factor * coef) >> 5; /* The nth partial sum */
- factor = (factor * t0) >> 15; /* Calculate t0^n */
- }
- CosErr = CosErr << (LVEQNB_DPCosCoef[0]); /* Correct the scaling */
-
- /*
- * Calculate the B1 and A0 coefficients
- */
- B1 = (0x40000000 - B2); /* B1 = (0.5 - b2/2) */
- A0 = ((B1 >> 16) * (CosErr >> 10)) >> 6; /* Temporary storage for (0.5 - b2/2) * coserr(t0) */
- B1 -= A0; /* B1 = (0.5 - b2/2) * (1 - coserr(t0)) */
- A0 = (0x40000000 + B2) >> 1; /* A0 = (0.5 + b2) */
-
- /*
- * Write coeff into the data structure
- */
- pCoefficients->A0 = A0;
- pCoefficients->B1 = B1;
- pCoefficients->B2 = B2;
- pCoefficients->G = LVEQNB_GainTable[Gain+15];
-
- return(LVEQNB_SUCCESS);
-
-}
-#endif
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_SinglePrecCoefs */
@@ -208,7 +111,6 @@
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_FLOAT_Coefs_t *pCoefficients)
@@ -218,7 +120,6 @@
extern LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
extern LVM_FLOAT LVEQNB_DTable[];
-
/*
* Get the filter definition
*/
@@ -227,7 +128,6 @@
/* As mentioned in effectbundle.h */
LVM_FLOAT QFactor = (LVM_FLOAT)pFilterDefinition->QFactor / 100.0f;
-
/*
* Intermediate variables and temporary values
*/
@@ -268,95 +168,3 @@
return(LVEQNB_SUCCESS);
}
-#else
-LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_C16_Coefs_t *pCoefficients)
-{
-
- extern LVM_INT16 LVEQNB_GainTable[];
- extern LVM_INT16 LVEQNB_TwoPiOnFsTable[];
- extern LVM_INT16 LVEQNB_DTable[];
- extern LVM_INT16 LVEQNB_CosCoef[];
-
-
- /*
- * Get the filter definition
- */
- LVM_INT16 Gain = pFilterDefinition->Gain;
- LVM_UINT16 Frequency = pFilterDefinition->Frequency;
- LVM_UINT16 QFactor = pFilterDefinition->QFactor;
-
-
- /*
- * Intermediate variables and temporary values
- */
- LVM_INT32 T0;
- LVM_INT16 D;
- LVM_INT32 A0;
- LVM_INT32 B1;
- LVM_INT32 B2;
- LVM_INT32 Dt0;
- LVM_INT32 B2_Den;
- LVM_INT32 B2_Num;
- LVM_INT32 COS_T0;
- LVM_INT16 coef;
- LVM_INT32 factor;
- LVM_INT16 t0;
- LVM_INT16 i;
-
- /*
- * Calculating the intermediate values
- */
- T0 = (LVM_INT32)Frequency * LVEQNB_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
- if (Gain >= 0)
- {
- D = LVEQNB_DTable[15]; /* D = 1 if GaindB >= 0 */
- }
- else
- {
- D = LVEQNB_DTable[Gain+15]; /* D = 1 / (1 + G) if GaindB < 0 */
- }
-
- /*
- * Calculate the B2 coefficient
- */
- Dt0 = D * (T0 >> 10);
- B2_Den = ((LVM_INT32)QFactor << 19) + (Dt0 >> 2);
- B2_Num = (Dt0 >> 3) - ((LVM_INT32)QFactor << 18);
- B2 = (B2_Num / (B2_Den >> 16)) << 15;
-
- /*
- * Calculate the cosine by a polynomial expansion using the equation:
- *
- * Cos += coef(n) * t0^n For n = 0 to 6
- */
- T0 = (T0 >> 10) * 20859; /* Scale to 1.0 in 16-bit for range 0 to fs/2 */
- t0 = (LVM_INT16)(T0 >> 16);
- factor = 0x7fff; /* Initialise to 1.0 for the a0 coefficient */
- COS_T0 = 0; /* Initialise the error to zero */
- for (i=1; i<7; i++)
- {
- coef = LVEQNB_CosCoef[i]; /* Get the nth coefficient */
- COS_T0 += (factor * coef) >> 5; /* The nth partial sum */
- factor = (factor * t0) >> 15; /* Calculate t0^n */
- }
- COS_T0 = COS_T0 << (LVEQNB_CosCoef[0]+6); /* Correct the scaling */
-
-
- B1 = ((0x40000000 - B2) >> 16) * (COS_T0 >> 16); /* B1 = (0.5 - b2/2) * cos(t0) */
- A0 = (0x40000000 + B2) >> 1; /* A0 = (0.5 + b2/2) */
-
- /*
- * Write coeff into the data structure
- */
- pCoefficients->A0 = (LVM_INT16)(A0>>16);
- pCoefficients->B1 = (LVM_INT16)(B1>>15);
- pCoefficients->B2 = (LVM_INT16)(B2>>16);
- pCoefficients->G = LVEQNB_GainTable[Gain+15];
-
-
- return(LVEQNB_SUCCESS);
-
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
index 755141e..6329181 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
@@ -15,17 +15,14 @@
* limitations under the License.
*/
-
#ifndef __LVEQNB_COEFFS_H__
#define __LVEQNB_COEFFS_H__
-
/************************************************************************************/
/* */
/* Gain table for (10^(Gain/20) - 1) */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
#define LVEQNB_Gain_Neg15_dB (-0.822172f)
#define LVEQNB_Gain_Neg14_dB (-0.800474f)
#define LVEQNB_Gain_Neg13_dB (-0.776128f)
@@ -57,47 +54,12 @@
#define LVEQNB_Gain_13_dB 3.466836f
#define LVEQNB_Gain_14_dB 4.011872f
#define LVEQNB_Gain_15_dB 4.623413f
-#else
-#define LVEQNB_GAINSHIFT 11 /* As a power of 2 */
-#define LVEQNB_Gain_Neg15_dB (-1684) /* Floating point value -0.822172 */
-#define LVEQNB_Gain_Neg14_dB (-1639) /* Floating point value -0.800474 */
-#define LVEQNB_Gain_Neg13_dB (-1590) /* Floating point value -0.776128 */
-#define LVEQNB_Gain_Neg12_dB (-1534) /* Floating point value -0.748811 */
-#define LVEQNB_Gain_Neg11_dB (-1471) /* Floating point value -0.718162 */
-#define LVEQNB_Gain_Neg10_dB (-1400) /* Floating point value -0.683772 */
-#define LVEQNB_Gain_Neg9_dB (-1321) /* Floating point value -0.645187 */
-#define LVEQNB_Gain_Neg8_dB (-1233) /* Floating point value -0.601893 */
-#define LVEQNB_Gain_Neg7_dB (-1133) /* Floating point value -0.553316 */
-#define LVEQNB_Gain_Neg6_dB (-1022) /* Floating point value -0.498813 */
-#define LVEQNB_Gain_Neg5_dB (-896) /* Floating point value -0.437659 */
-#define LVEQNB_Gain_Neg4_dB (-756) /* Floating point value -0.369043 */
-#define LVEQNB_Gain_Neg3_dB (-598) /* Floating point value -0.292054 */
-#define LVEQNB_Gain_Neg2_dB (-421) /* Floating point value -0.205672 */
-#define LVEQNB_Gain_Neg1_dB (-223) /* Floating point value -0.108749 */
-#define LVEQNB_Gain_0_dB 0 /* Floating point value 0.000000 */
-#define LVEQNB_Gain_1_dB 250 /* Floating point value 0.122018 */
-#define LVEQNB_Gain_2_dB 530 /* Floating point value 0.258925 */
-#define LVEQNB_Gain_3_dB 845 /* Floating point value 0.412538 */
-#define LVEQNB_Gain_4_dB 1198 /* Floating point value 0.584893 */
-#define LVEQNB_Gain_5_dB 1594 /* Floating point value 0.778279 */
-#define LVEQNB_Gain_6_dB 2038 /* Floating point value 0.995262 */
-#define LVEQNB_Gain_7_dB 2537 /* Floating point value 1.238721 */
-#define LVEQNB_Gain_8_dB 3096 /* Floating point value 1.511886 */
-#define LVEQNB_Gain_9_dB 3724 /* Floating point value 1.818383 */
-#define LVEQNB_Gain_10_dB 4428 /* Floating point value 2.162278 */
-#define LVEQNB_Gain_11_dB 5219 /* Floating point value 2.548134 */
-#define LVEQNB_Gain_12_dB 6105 /* Floating point value 2.981072 */
-#define LVEQNB_Gain_13_dB 7100 /* Floating point value 3.466836 */
-#define LVEQNB_Gain_14_dB 8216 /* Floating point value 4.011872 */
-#define LVEQNB_Gain_15_dB 9469 /* Floating point value 4.623413 */
-#endif
/************************************************************************************/
/* */
/* Frequency table for 2*Pi/Fs */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
#define LVEQNB_2PiOn_8000 0.000785f
#define LVEQNB_2PiOn_11025 0.000570f
#define LVEQNB_2PiOn_12000 0.000524f
@@ -108,32 +70,16 @@
#define LVEQNB_2PiOn_44100 0.000142f
#define LVEQNB_2PiOn_48000 0.000131f
-#ifdef HIGHER_FS
#define LVEQNB_2PiOn_88200 0.000071f
#define LVEQNB_2PiOn_96000 0.000065f
#define LVEQNB_2PiOn_176400 0.000036f
#define LVEQNB_2PiOn_192000 0.000033f
-#endif
-
-#else
-#define LVEQNB_FREQSHIFT 25 /* As a power of 2 */
-#define LVEQNB_2PiOn_8000 26354 /* Floating point value 0.000785 */
-#define LVEQNB_2PiOn_11025 19123 /* Floating point value 0.000570 */
-#define LVEQNB_2PiOn_12000 17569 /* Floating point value 0.000524 */
-#define LVEQNB_2PiOn_16000 13177 /* Floating point value 0.000393 */
-#define LVEQNB_2PiOn_22050 9561 /* Floating point value 0.000285 */
-#define LVEQNB_2PiOn_24000 8785 /* Floating point value 0.000262 */
-#define LVEQNB_2PiOn_32000 6588 /* Floating point value 0.000196 */
-#define LVEQNB_2PiOn_44100 4781 /* Floating point value 0.000142 */
-#define LVEQNB_2PiOn_48000 4392 /* Floating point value 0.000131 */
-#endif
/************************************************************************************/
/* */
/* 50D table for 50 / ( 1 + Gain ) */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
#define LVEQNB_100D_Neg15_dB 5.623413f
#define LVEQNB_100D_Neg14_dB 5.011872f
#define LVEQNB_100D_Neg13_dB 4.466836f
@@ -150,24 +96,5 @@
#define LVEQNB_100D_Neg2_dB 1.258925f
#define LVEQNB_100D_Neg1_dB 1.122018f
#define LVEQNB_100D_0_dB 1.000000f
-#else
-#define LVEQNB_100DSHIFT 5 /* As a power of 2 */
-#define LVEQNB_100D_Neg15_dB 17995 /* Floating point value 5.623413 */
-#define LVEQNB_100D_Neg14_dB 16038 /* Floating point value 5.011872 */
-#define LVEQNB_100D_Neg13_dB 14294 /* Floating point value 4.466836 */
-#define LVEQNB_100D_Neg12_dB 12739 /* Floating point value 3.981072 */
-#define LVEQNB_100D_Neg11_dB 11354 /* Floating point value 3.548134 */
-#define LVEQNB_100D_Neg10_dB 10119 /* Floating point value 3.162278 */
-#define LVEQNB_100D_Neg9_dB 9019 /* Floating point value 2.818383 */
-#define LVEQNB_100D_Neg8_dB 8038 /* Floating point value 2.511886 */
-#define LVEQNB_100D_Neg7_dB 7164 /* Floating point value 2.238721 */
-#define LVEQNB_100D_Neg6_dB 6385 /* Floating point value 1.995262 */
-#define LVEQNB_100D_Neg5_dB 5690 /* Floating point value 1.778279 */
-#define LVEQNB_100D_Neg4_dB 5072 /* Floating point value 1.584893 */
-#define LVEQNB_100D_Neg3_dB 4520 /* Floating point value 1.412538 */
-#define LVEQNB_100D_Neg2_dB 4029 /* Floating point value 1.258925 */
-#define LVEQNB_100D_Neg1_dB 3590 /* Floating point value 1.122018 */
-#define LVEQNB_100D_0_dB 3200 /* Floating point value 1.000000 */
-#endif
#endif
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
index 7b0f341..6bb4a7e 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
@@ -26,7 +26,6 @@
#include "VectorArithmetic.h"
#include "BIQUAD.h"
-
/****************************************************************************************/
/* */
/* Defines */
@@ -76,7 +75,6 @@
return(LVEQNB_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVEQNB_GetCapabilities */
@@ -114,7 +112,6 @@
return(LVEQNB_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVEQNB_SetFilters */
@@ -140,18 +137,13 @@
void LVEQNB_SetFilters(LVEQNB_Instance_t *pInstance,
LVEQNB_Params_t *pParams)
{
-#ifdef HIGHER_FS
extern const LVM_UINT32 LVEQNB_SampleRateTab[]; /* Sample rate table */
-#else
- extern const LVM_UINT16 LVEQNB_SampleRateTab[]; /* Sample rate table */
-#endif
LVM_UINT16 i; /* Filter band index */
LVM_UINT32 fs = (LVM_UINT32)LVEQNB_SampleRateTab[(LVM_UINT16)pParams->SampleRate]; /* Sample rate */
LVM_UINT32 fc; /* Filter centre frequency */
LVM_INT16 QFactor; /* Filter Q factor */
-
pInstance->NBands = pParams->NBands;
for (i=0; i<pParams->NBands; i++)
@@ -162,30 +154,7 @@
fc = (LVM_UINT32)pParams->pBandDefinition[i].Frequency; /* Get the band centre frequency */
QFactor = (LVM_INT16)pParams->pBandDefinition[i].QFactor; /* Get the band Q factor */
-#ifdef BUILD_FLOAT
pInstance->pBiquadType[i] = LVEQNB_SinglePrecision_Float; /* Default to single precision */
-#else
- /*
- * For each filter set the type of biquad required
- */
- pInstance->pBiquadType[i] = LVEQNB_SinglePrecision; /* Default to single precision */
-#endif
-#ifndef BUILD_FLOAT
- if ((fc << 15) <= (LOW_FREQ * fs))
- {
- /*
- * fc <= fs/110
- */
- pInstance->pBiquadType[i] = LVEQNB_DoublePrecision;
- }
- else if (((fc << 15) <= (HIGH_FREQ * fs)) && (QFactor > 300))
- {
- /*
- * (fs/110 < fc < fs/85) & (Q>3)
- */
- pInstance->pBiquadType[i] = LVEQNB_DoublePrecision;
- }
-#endif
/*
* Check for out of range frequencies
@@ -195,7 +164,6 @@
pInstance->pBiquadType[i] = LVEQNB_OutOfRange;
}
-
/*
* Copy the filter definition to persistant memory
*/
@@ -204,7 +172,6 @@
}
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVEQNB_SetCoefficients */
@@ -225,7 +192,6 @@
LVM_UINT16 i; /* Filter band index */
LVEQNB_BiquadType_en BiquadType; /* Filter biquad type */
-
/*
* Set the coefficients for each band by the init function
*/
@@ -238,7 +204,6 @@
BiquadType = pInstance->pBiquadType[i];
switch (BiquadType)
{
-#ifdef BUILD_FLOAT
case LVEQNB_SinglePrecision_Float:
{
PK_FLOAT_Coefs_t Coefficients;
@@ -256,47 +221,6 @@
&Coefficients);
break;
}
-#else
- case LVEQNB_DoublePrecision:
- {
- PK_C32_Coefs_t Coefficients;
-
- /*
- * Calculate the double precision coefficients
- */
- LVEQNB_DoublePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
- &pInstance->pBandDefinitions[i],
- &Coefficients);
-
- /*
- * Set the coefficients
- */
- PK_2I_D32F32CllGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState[i],
- &pInstance->pEQNB_Taps[i],
- &Coefficients);
- break;
- }
-
- case LVEQNB_SinglePrecision:
- {
- PK_C16_Coefs_t Coefficients;
-
- /*
- * Calculate the single precision coefficients
- */
- LVEQNB_SinglePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
- &pInstance->pBandDefinitions[i],
- &Coefficients);
-
- /*
- * Set the coefficients
- */
- PK_2I_D32F32CssGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState[i],
- &pInstance->pEQNB_Taps[i],
- &Coefficients);
- break;
- }
-#endif
default:
break;
}
@@ -304,7 +228,6 @@
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVEQNB_ClearFilterHistory */
@@ -316,24 +239,6 @@
/* pInstance Pointer to the instance */
/* */
/************************************************************************************/
-#ifndef BUILD_FLOAT
-void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
-{
- LVM_INT16 *pTapAddress;
- LVM_INT16 NumTaps;
-
-
- pTapAddress = (LVM_INT16 *)pInstance->pEQNB_Taps;
- NumTaps = (LVM_INT16)((pInstance->Capabilities.MaxBands * sizeof(Biquad_2I_Order2_Taps_t))/sizeof(LVM_INT16));
-
- if (NumTaps != 0)
- {
- LoadConst_16(0, /* Clear the history, value 0 */
- pTapAddress, /* Destination */
- NumTaps); /* Number of words */
- }
-}
-#else
void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
{
LVM_FLOAT *pTapAddress;
@@ -350,7 +255,6 @@
NumTaps); /* Number of words */
}
}
-#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Control */
@@ -404,7 +308,6 @@
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
}
-
if( (pInstance->Params.NBands != pParams->NBands ) ||
(pInstance->Params.OperatingMode != pParams->OperatingMode ) ||
(pInstance->Params.pBandDefinition != pParams->pBandDefinition ) ||
@@ -429,7 +332,6 @@
}
}
-
// During operating mode transition, there is a race condition where the mode
// is still LVEQNB_ON, but the effect is considered disabled in the upper layers.
// modeChange handles this special race condition.
@@ -453,7 +355,6 @@
*/
pInstance->Params = *pParams;
-
/*
* Reset the filters except if the algo is switched off
*/
@@ -473,13 +374,8 @@
if (modeChange) {
if(pParams->OperatingMode == LVEQNB_ON)
{
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0], 1.0f);
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1], 0.0f);
-#else
- LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0],LVM_MAXINT_16);
- LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1],0);
-#endif
pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
}
@@ -489,13 +385,8 @@
// This may introduce a state race condition if the effect is enabled again
// while in transition. This is fixed in the modeChange logic.
pInstance->Params.OperatingMode = LVEQNB_ON;
-#ifdef BUILD_FLOAT
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0], 0.0f);
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1], 1.0f);
-#else
- LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0],0);
- LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1],LVM_MAXINT_16);
-#endif
pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
}
@@ -508,7 +399,6 @@
return(LVEQNB_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_BypassMixerCallBack */
@@ -530,13 +420,8 @@
/*
* Send an ALGOFF event if the ON->OFF switch transition is finished
*/
-#ifdef BUILD_FLOAT
if((LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0) &&
(CallbackParam == 0)){
-#else
- if((LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0x00000000) &&
- (CallbackParam == 0)){
-#endif
pInstance->Params.OperatingMode = LVEQNB_BYPASS;
if (CallBack != LVM_NULL){
CallBack(pInstance->Capabilities.pBundleInstance, LVM_NULL, ALGORITHM_EQNB_ID|LVEQNB_EVENT_ALGOFF);
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp
index 8e3c627..271a914 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/****************************************************************************************/
/* */
/* Includes */
@@ -67,13 +66,11 @@
INST_ALLOC AllocMem;
LVEQNB_Instance_t *pInstance = (LVEQNB_Instance_t *)hInstance;
-
if((pMemoryTable == LVM_NULL)|| (pCapabilities == LVM_NULL))
{
return LVEQNB_NULLADDRESS;
}
-
/*
* Fill in the memory table
*/
@@ -91,13 +88,11 @@
pMemoryTable->Region[LVEQNB_MEMREGION_INSTANCE].Type = LVEQNB_PERSISTENT;
pMemoryTable->Region[LVEQNB_MEMREGION_INSTANCE].pBaseAddress = LVM_NULL;
-
/*
* Persistant data memory
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
-#ifdef BUILD_FLOAT
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
sizeof(Biquad_2I_Order2_FLOAT_Taps_t));
InstAlloc_AddMember(&AllocMem, /* High pass filter */
@@ -111,18 +106,6 @@
/* Biquad types */
InstAlloc_AddMember(&AllocMem,
(pCapabilities->MaxBands * sizeof(LVEQNB_BiquadType_en)));
-#else
- InstAlloc_AddMember(&AllocMem, /* Low pass filter */
- sizeof(Biquad_2I_Order2_Taps_t));
- InstAlloc_AddMember(&AllocMem, /* High pass filter */
- sizeof(Biquad_2I_Order2_Taps_t));
- InstAlloc_AddMember(&AllocMem,
- (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_Taps_t))); /* Equaliser Biquad Taps */
- InstAlloc_AddMember(&AllocMem,
- (pCapabilities->MaxBands * sizeof(LVEQNB_BandDef_t))); /* Filter definitions */
- InstAlloc_AddMember(&AllocMem,
- (pCapabilities->MaxBands * sizeof(LVEQNB_BiquadType_en))); /* Biquad types */
-#endif
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Alignment = LVEQNB_DATA_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].Type = LVEQNB_PERSISTENT_DATA;
@@ -133,7 +116,6 @@
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
-#ifdef BUILD_FLOAT
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
sizeof(Biquad_FLOAT_Instance_t));
InstAlloc_AddMember(&AllocMem, /* High pass filter */
@@ -141,14 +123,6 @@
/* Equaliser Biquad Instance */
InstAlloc_AddMember(&AllocMem,
pCapabilities->MaxBands * sizeof(Biquad_FLOAT_Instance_t));
-#else
- InstAlloc_AddMember(&AllocMem, /* Low pass filter */
- sizeof(Biquad_Instance_t));
- InstAlloc_AddMember(&AllocMem, /* High pass filter */
- sizeof(Biquad_Instance_t));
- InstAlloc_AddMember(&AllocMem,
- pCapabilities->MaxBands * sizeof(Biquad_Instance_t)); /* Equaliser Biquad Instance */
-#endif
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Alignment = LVEQNB_COEF_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].Type = LVEQNB_PERSISTENT_COEF;
@@ -159,14 +133,9 @@
*/
InstAlloc_Init(&AllocMem,
LVM_NULL);
-#ifdef BUILD_FLOAT
InstAlloc_AddMember(&AllocMem, /* Low pass filter */
LVEQNB_SCRATCHBUFFERS * sizeof(LVM_FLOAT) * \
pCapabilities->MaxBlockSize);
-#else
- InstAlloc_AddMember(&AllocMem, /* Low pass filter */
- LVEQNB_SCRATCHBUFFERS*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize);
-#endif
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Size = InstAlloc_GetTotal(&AllocMem);
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Alignment = LVEQNB_SCRATCH_ALIGN;
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].Type = LVEQNB_SCRATCH;
@@ -181,7 +150,6 @@
return(LVEQNB_SUCCESS);
}
-
/****************************************************************************************/
/* */
/* FUNCTION: LVEQNB_Init */
@@ -260,14 +228,11 @@
}
pInstance =(LVEQNB_Instance_t *)*phInstance;
-
-
/*
* Save the memory table in the instance structure
*/
pInstance->Capabilities = *pCapabilities;
-
/*
* Save the memory table in the instance structure and
* set the structure pointers
@@ -280,17 +245,10 @@
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_COEF].pBaseAddress);
-#ifdef BUILD_FLOAT
/* Equaliser Biquad Instance */
pInstance->pEQNB_FilterState_Float = (Biquad_FLOAT_Instance_t *)
InstAlloc_AddMember(&AllocMem, pCapabilities->MaxBands * \
sizeof(Biquad_FLOAT_Instance_t));
-#else
- pInstance->pEQNB_FilterState = InstAlloc_AddMember(&AllocMem,
- pCapabilities->MaxBands * sizeof(Biquad_Instance_t)); /* Equaliser Biquad Instance */
-#endif
-
-
/*
* Allocate data memory
@@ -298,15 +256,9 @@
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_PERSISTENT_DATA].pBaseAddress);
-#ifdef BUILD_FLOAT
MemSize = (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_FLOAT_Taps_t));
pInstance->pEQNB_Taps_Float = (Biquad_2I_Order2_FLOAT_Taps_t *)InstAlloc_AddMember(&AllocMem,
MemSize);
-#else
- MemSize = (pCapabilities->MaxBands * sizeof(Biquad_2I_Order2_Taps_t));
- pInstance->pEQNB_Taps = (Biquad_2I_Order2_Taps_t *)InstAlloc_AddMember(&AllocMem,
- MemSize);
-#endif
MemSize = (pCapabilities->MaxBands * sizeof(LVEQNB_BandDef_t));
pInstance->pBandDefinitions = (LVEQNB_BandDef_t *)InstAlloc_AddMember(&AllocMem,
MemSize);
@@ -317,20 +269,14 @@
pInstance->pBiquadType = (LVEQNB_BiquadType_en *)InstAlloc_AddMember(&AllocMem,
MemSize);
-
/*
* Internally map, structure and allign scratch memory
*/
InstAlloc_Init(&AllocMem,
pMemoryTable->Region[LVEQNB_MEMREGION_SCRATCH].pBaseAddress);
-#ifdef BUILD_FLOAT
pInstance->pFastTemporary = (LVM_FLOAT *)InstAlloc_AddMember(&AllocMem,
sizeof(LVM_FLOAT));
-#else
- pInstance->pFastTemporary = (LVM_INT16 *)InstAlloc_AddMember(&AllocMem,
- sizeof(LVM_INT16));
-#endif
/*
* Update the instance parameters
@@ -362,18 +308,12 @@
LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[0],0,0);
LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],0,LVM_FS_8000,2);
-
pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
pInstance->BypassMixer.MixerStream[1].CallbackParam = 0;
pInstance->BypassMixer.MixerStream[1].pCallbackHandle = LVM_NULL;
pInstance->BypassMixer.MixerStream[1].pCallBack = LVM_NULL;
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[1], 0, 1.0f);
LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1], 0, LVM_FS_8000, 2);
-#else
- LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[1],0,LVM_MAXINT_16);
- LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],0,LVM_FS_8000,2);
-#endif
pInstance->bInOperatingModeTransition = LVM_FALSE;
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
index 4f70eec..40facfb 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
@@ -18,8 +18,6 @@
#ifndef __LVEQNB_PRIVATE_H__
#define __LVEQNB_PRIVATE_H__
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -62,24 +60,19 @@
/* Filter biquad types */
typedef enum
{
-#ifdef BUILD_FLOAT
LVEQNB_SinglePrecision_Float = -1,
-#endif
LVEQNB_SinglePrecision = 0,
LVEQNB_DoublePrecision = 1,
LVEQNB_OutOfRange = 2,
LVEQNB_BIQUADTYPE_MAX = LVM_MAXINT_32
} LVEQNB_BiquadType_en;
-
/****************************************************************************************/
/* */
/* Structures */
/* */
/****************************************************************************************/
-
-
/* Instance structure */
typedef struct
{
@@ -89,20 +82,10 @@
LVEQNB_Capabilities_t Capabilities; /* Instance capabilities */
/* Aligned memory pointers */
-#ifdef BUILD_FLOAT
LVM_FLOAT *pFastTemporary; /* Fast temporary data base address */
-#else
- LVM_INT16 *pFastTemporary; /* Fast temporary data base address */
-#endif
-#ifdef BUILD_FLOAT
Biquad_2I_Order2_FLOAT_Taps_t *pEQNB_Taps_Float; /* Equaliser Taps */
Biquad_FLOAT_Instance_t *pEQNB_FilterState_Float; /* State for each filter band */
-#else
- /* Process variables */
- Biquad_2I_Order2_Taps_t *pEQNB_Taps; /* Equaliser Taps */
- Biquad_Instance_t *pEQNB_FilterState; /* State for each filter band */
-#endif
/* Filter definitions and call back */
LVM_UINT16 NBands; /* Number of bands */
@@ -110,17 +93,12 @@
LVEQNB_BiquadType_en *pBiquadType; /* Filter biquad types */
/* Bypass variable */
-#ifdef BUILD_FLOAT
LVMixer3_2St_FLOAT_st BypassMixer;
-#else
- LVMixer3_2St_st BypassMixer; /* Bypass mixer used in transitions */
-#endif
LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */
} LVEQNB_Instance_t;
-
/****************************************************************************************/
/* */
/* Function prototypes */
@@ -133,22 +111,11 @@
void LVEQNB_SetCoefficients(LVEQNB_Instance_t *pInstance);
void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance);
-#ifdef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
LVEQNB_BandDef_t *pFilterDefinition,
PK_FLOAT_Coefs_t *pCoefficients);
-#else
-LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_C16_Coefs_t *pCoefficients);
-
-LVEQNB_ReturnStatus_en LVEQNB_DoublePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_C32_Coefs_t *pCoefficients);
-#endif
LVM_INT32 LVEQNB_BypassMixerCallBack (void* hInstance, void *pGeneralPurpose, LVM_INT16 CallbackParam);
-
#endif /* __LVEQNB_PRIVATE_H__ */
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp
index d188c0e..65eff53 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp
@@ -58,7 +58,6 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -123,7 +122,6 @@
*/
Biquad_FLOAT_Instance_t *pBiquad = &pInstance->pEQNB_FilterState_Float[i];
-
/*
* Select single or double precision as required
*/
@@ -152,7 +150,6 @@
}
}
-
if(pInstance->bInOperatingModeTransition == LVM_TRUE){
#ifdef SUPPORT_MC
LVC_MixSoft_2Mc_D16C31_SAT(&pInstance->BypassMixer,
@@ -194,145 +191,3 @@
return LVEQNB_SUCCESS;
}
-#else
-LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVM_UINT16 i;
- Biquad_Instance_t *pBiquad;
- LVEQNB_Instance_t *pInstance = (LVEQNB_Instance_t *)hInstance;
- LVM_INT32 *pScratch;
-
-
- /* Check for NULL pointers */
- if((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
- {
- return LVEQNB_NULLADDRESS;
- }
-
- /* Check if the input and output data buffers are 32-bit aligned */
- if ((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0))
- {
- return LVEQNB_ALIGNMENTERROR;
- }
-
- pScratch = (LVM_INT32 *)pInstance->pFastTemporary;
-
- /*
- * Check the number of samples is not too large
- */
- if (NumSamples > pInstance->Capabilities.MaxBlockSize)
- {
- return(LVEQNB_TOOMANYSAMPLES);
- }
-
- if (pInstance->Params.OperatingMode == LVEQNB_ON)
- {
- /*
- * Convert from 16-bit to 32-bit
- */
- Int16LShiftToInt32_16x32((LVM_INT16 *)pInData, /* Source */
- pScratch, /* Destination */
- (LVM_INT16)(2*NumSamples), /* Left and Right */
- SHIFT); /* Scaling shift */
-
- /*
- * For each section execte the filter unless the gain is 0dB
- */
- if (pInstance->NBands != 0)
- {
- for (i=0; i<pInstance->NBands; i++)
- {
- /*
- * Check if band is non-zero dB gain
- */
- if (pInstance->pBandDefinitions[i].Gain != 0)
- {
- /*
- * Get the address of the biquad instance
- */
- pBiquad = &pInstance->pEQNB_FilterState[i];
-
-
- /*
- * Select single or double precision as required
- */
- switch (pInstance->pBiquadType[i])
- {
- case LVEQNB_SinglePrecision:
- {
- PK_2I_D32F32C14G11_TRC_WRA_01(pBiquad,
- (LVM_INT32 *)pScratch,
- (LVM_INT32 *)pScratch,
- (LVM_INT16)NumSamples);
- break;
- }
-
- case LVEQNB_DoublePrecision:
- {
- PK_2I_D32F32C30G11_TRC_WRA_01(pBiquad,
- (LVM_INT32 *)pScratch,
- (LVM_INT32 *)pScratch,
- (LVM_INT16)NumSamples);
- break;
- }
- default:
- break;
- }
- }
- }
- }
-
-
- if(pInstance->bInOperatingModeTransition == LVM_TRUE){
- /*
- * Convert from 32-bit to 16- bit and saturate
- */
- Int32RShiftToInt16_Sat_32x16(pScratch, /* Source */
- (LVM_INT16 *)pScratch, /* Destination */
- (LVM_INT16)(2*NumSamples), /* Left and Right */
- SHIFT); /* Scaling shift */
-
- LVC_MixSoft_2St_D16C31_SAT(&pInstance->BypassMixer,
- (LVM_INT16 *)pScratch,
- (LVM_INT16 *)pInData,
- (LVM_INT16 *)pScratch,
- (LVM_INT16)(2*NumSamples));
-
- Copy_16((LVM_INT16*)pScratch, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and Right samples */
- }
- else{
-
- /*
- * Convert from 32-bit to 16- bit and saturate
- */
- Int32RShiftToInt16_Sat_32x16(pScratch, /* Source */
- pOutData, /* Destination */
- (LVM_INT16 )(2*NumSamples), /* Left and Right */
- SHIFT); /* Scaling shift */
- }
- }
- else
- {
- /*
- * Mode is OFF so copy the data if necessary
- */
- if (pInData != pOutData)
- {
- Copy_16(pInData, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and Right samples */
- }
- }
-
-
-
- return(LVEQNB_SUCCESS);
-
-}
-#endif
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
index d3d4ba0..0628114 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -26,7 +25,6 @@
#include "LVEQNB_Coeffs.h"
#include "LVEQNB_Tables.h"
-
/************************************************************************************/
/* */
/* Sample rate table */
@@ -37,7 +35,6 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
const LVM_UINT32 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
11025,
12000,
@@ -52,18 +49,6 @@
176400,
192000
};
-#else
-const LVM_UINT16 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000
-};
-#endif
/************************************************************************************/
/* */
@@ -74,7 +59,6 @@
/*
* Table for 2 * Pi / Fs
*/
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
LVEQNB_2PiOn_11025,
LVEQNB_2PiOn_12000,
@@ -84,29 +68,15 @@
LVEQNB_2PiOn_32000,
LVEQNB_2PiOn_44100,
LVEQNB_2PiOn_48000
-#ifdef HIGHER_FS
,LVEQNB_2PiOn_88200
,LVEQNB_2PiOn_96000
,LVEQNB_2PiOn_176400
,LVEQNB_2PiOn_192000
-#endif
};
-#else
-const LVM_INT16 LVEQNB_TwoPiOnFsTable[] = {LVEQNB_2PiOn_8000, /* 8kS/s */
- LVEQNB_2PiOn_11025,
- LVEQNB_2PiOn_12000,
- LVEQNB_2PiOn_16000,
- LVEQNB_2PiOn_22050,
- LVEQNB_2PiOn_24000,
- LVEQNB_2PiOn_32000,
- LVEQNB_2PiOn_44100,
- LVEQNB_2PiOn_48000}; /* 48kS/s */
-#endif
/*
* Gain table
*/
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVEQNB_GainTable[] = {LVEQNB_Gain_Neg15_dB, /* -15dB gain */
LVEQNB_Gain_Neg14_dB,
LVEQNB_Gain_Neg13_dB,
@@ -138,44 +108,9 @@
LVEQNB_Gain_13_dB,
LVEQNB_Gain_14_dB,
LVEQNB_Gain_15_dB}; /* +15dB gain */
-#else
-const LVM_INT16 LVEQNB_GainTable[] = {LVEQNB_Gain_Neg15_dB, /* -15dB gain */
- LVEQNB_Gain_Neg14_dB,
- LVEQNB_Gain_Neg13_dB,
- LVEQNB_Gain_Neg12_dB,
- LVEQNB_Gain_Neg11_dB,
- LVEQNB_Gain_Neg10_dB,
- LVEQNB_Gain_Neg9_dB,
- LVEQNB_Gain_Neg8_dB,
- LVEQNB_Gain_Neg7_dB,
- LVEQNB_Gain_Neg6_dB,
- LVEQNB_Gain_Neg5_dB,
- LVEQNB_Gain_Neg4_dB,
- LVEQNB_Gain_Neg3_dB,
- LVEQNB_Gain_Neg2_dB,
- LVEQNB_Gain_Neg1_dB,
- LVEQNB_Gain_0_dB, /* 0dB gain */
- LVEQNB_Gain_1_dB,
- LVEQNB_Gain_2_dB,
- LVEQNB_Gain_3_dB,
- LVEQNB_Gain_4_dB,
- LVEQNB_Gain_5_dB,
- LVEQNB_Gain_6_dB,
- LVEQNB_Gain_7_dB,
- LVEQNB_Gain_8_dB,
- LVEQNB_Gain_9_dB,
- LVEQNB_Gain_10_dB,
- LVEQNB_Gain_11_dB,
- LVEQNB_Gain_12_dB,
- LVEQNB_Gain_13_dB,
- LVEQNB_Gain_14_dB,
- LVEQNB_Gain_15_dB}; /* +15dB gain */
-
-#endif
/*
* D table for 100 / (Gain + 1)
*/
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVEQNB_DTable[] = {LVEQNB_100D_Neg15_dB, /* -15dB gain */
LVEQNB_100D_Neg14_dB,
LVEQNB_100D_Neg13_dB,
@@ -192,25 +127,6 @@
LVEQNB_100D_Neg2_dB,
LVEQNB_100D_Neg1_dB,
LVEQNB_100D_0_dB}; /* 0dB gain */
-#else
-const LVM_INT16 LVEQNB_DTable[] = {LVEQNB_100D_Neg15_dB, /* -15dB gain */
- LVEQNB_100D_Neg14_dB,
- LVEQNB_100D_Neg13_dB,
- LVEQNB_100D_Neg12_dB,
- LVEQNB_100D_Neg11_dB,
- LVEQNB_100D_Neg10_dB,
- LVEQNB_100D_Neg9_dB,
- LVEQNB_100D_Neg8_dB,
- LVEQNB_100D_Neg7_dB,
- LVEQNB_100D_Neg6_dB,
- LVEQNB_100D_Neg5_dB,
- LVEQNB_100D_Neg4_dB,
- LVEQNB_100D_Neg3_dB,
- LVEQNB_100D_Neg2_dB,
- LVEQNB_100D_Neg1_dB,
- LVEQNB_100D_0_dB}; /* 0dB gain */
-
-#endif
/************************************************************************************/
/* */
/* Filter polynomial coefficients */
@@ -254,4 +170,3 @@
16586, /* a2 */
-44}; /* a3 */
-
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h
index dc3fbb6..a71eeb9 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h
@@ -27,11 +27,7 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-#ifdef HIGHER_FS
extern const LVM_UINT32 LVEQNB_SampleRateTab[];
-#else
-extern const LVM_UINT16 LVEQNB_SampleRateTab[];
-#endif
/************************************************************************************/
/* */
diff --git a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
index 4f052b1..8c91ea9 100644
--- a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
+++ b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
@@ -28,8 +28,6 @@
#ifndef __LVREV_H__
#define __LVREV_H__
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -37,7 +35,6 @@
/****************************************************************************************/
#include "LVM_Types.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -50,7 +47,6 @@
/* Memory table*/
#define LVREV_NR_MEMORY_REGIONS 4 /* Number of memory regions */
-
/****************************************************************************************/
/* */
/* Types */
@@ -59,7 +55,6 @@
/* Instance handle */
typedef void *LVREV_Handle_t;
-
/* Status return values */
typedef enum
{
@@ -70,7 +65,6 @@
LVREV_RETURNSTATUS_DUMMY = LVM_MAXENUM
} LVREV_ReturnStatus_en;
-
/* Reverb delay lines */
typedef enum
{
@@ -80,7 +74,6 @@
LVREV_DELAYLINES_DUMMY = LVM_MAXENUM
} LVREV_NumDelayLines_en;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -93,7 +86,6 @@
LVM_MemoryRegion_st Region[LVREV_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVREV_MemoryTable_st;
-
/* Control Parameter structure */
typedef struct
{
@@ -104,13 +96,8 @@
/* Parameters for REV */
LVM_UINT16 Level; /* Level, 0 to 100 representing percentage of reverb */
-#ifndef HIGHER_FS
- LVM_UINT16 LPF; /* Low pass filter, in Hz */
- LVM_UINT16 HPF; /* High pass filter, in Hz */
-#else
LVM_UINT32 LPF; /* Low pass filter, in Hz */
LVM_UINT32 HPF; /* High pass filter, in Hz */
-#endif
LVM_UINT16 T60; /* Decay time constant, in ms */
LVM_UINT16 Density; /* Echo density, 0 to 100 for minimum to maximum density */
@@ -119,7 +106,6 @@
} LVREV_ControlParams_st;
-
/* Instance Parameter structure */
typedef struct
{
@@ -132,7 +118,6 @@
} LVREV_InstanceParams_st;
-
/****************************************************************************************/
/* */
/* Function Prototypes */
@@ -179,7 +164,6 @@
LVREV_MemoryTable_st *pMemoryTable,
LVREV_InstanceParams_st *pInstanceParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_GetInstanceHandle */
@@ -210,7 +194,6 @@
LVREV_MemoryTable_st *pMemoryTable,
LVREV_InstanceParams_st *pInstanceParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVXX_GetControlParameters */
@@ -234,7 +217,6 @@
LVREV_ReturnStatus_en LVREV_GetControlParameters(LVREV_Handle_t hInstance,
LVREV_ControlParams_st *pControlParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_SetControlParameters */
@@ -257,7 +239,6 @@
LVREV_ReturnStatus_en LVREV_SetControlParameters(LVREV_Handle_t hInstance,
LVREV_ControlParams_st *pNewParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_ClearAudioBuffers */
@@ -278,7 +259,6 @@
/****************************************************************************************/
LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t hInstance);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_Process */
@@ -300,18 +280,10 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
const LVM_UINT16 NumSamples);
-#else
-LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
- const LVM_INT32 *pInData,
- LVM_INT32 *pOutData,
- const LVM_UINT16 NumSamples);
-#endif
-
#endif /* __LVREV_H__ */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp
index 2c46baa..1f0d39b 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp
@@ -41,567 +41,12 @@
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
{
LVM_Mode_en OperatingMode;
LVM_INT32 NumberOfDelayLines;
-
- /* Check for NULL pointer */
- if(pPrivate == LVM_NULL)
- {
- return LVREV_NULLADDRESS;
- }
-
- OperatingMode = pPrivate->NewParams.OperatingMode;
-
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
- NumberOfDelayLines = 4;
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
- {
- NumberOfDelayLines = 2;
- }
- else
- {
- NumberOfDelayLines = 1;
- }
-
- /*
- * Update the high pass filter coefficients
- */
- if((pPrivate->NewParams.HPF != pPrivate->CurrentParams.HPF) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_INT32 Omega;
- FO_C32_Coefs_t Coeffs;
-
- Omega = LVM_GetOmega(pPrivate->NewParams.HPF, pPrivate->NewParams.SampleRate);
- LVM_FO_HPF(Omega, &Coeffs);
- FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->HPCoefs, &pPrivate->pFastData->HPTaps, &Coeffs);
- LoadConst_32(0,
- (void *)&pPrivate->pFastData->HPTaps, /* Destination Cast to void: no dereferencing in function*/
- sizeof(Biquad_1I_Order1_Taps_t)/sizeof(LVM_INT32));
- }
-
-
- /*
- * Update the low pass filter coefficients
- */
- if((pPrivate->NewParams.LPF != pPrivate->CurrentParams.LPF) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_INT32 Omega;
- FO_C32_Coefs_t Coeffs;
-
-
- Coeffs.A0 = 0x7FFFFFFF;
- Coeffs.A1 = 0;
- Coeffs.B1 = 0;
- if(pPrivate->NewParams.LPF <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
- {
- Omega = LVM_GetOmega(pPrivate->NewParams.LPF, pPrivate->NewParams.SampleRate);
-
- /*
- * Do not apply filter if w =2*pi*fc/fs >= 2.9
- */
- if(Omega<=LVREV_2_9_INQ29)
- {
- LVM_FO_LPF(Omega, &Coeffs);
- }
- }
- FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->LPCoefs, &pPrivate->pFastData->LPTaps, &Coeffs);
- LoadConst_32(0,
- (void *)&pPrivate->pFastData->LPTaps, /* Destination Cast to void: no dereferencing in function*/
- sizeof(Biquad_1I_Order1_Taps_t)/sizeof(LVM_INT32));
- }
-
-
- /*
- * Calculate the room size parameter
- */
- if( pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize)
- {
- /* Room size range is 10ms to 200ms
- * 0% -- 10ms
- * 50% -- 65ms
- * 100% -- 120ms
- */
- pPrivate->RoomSizeInms = 10 + (((pPrivate->NewParams.RoomSize*11) + 5)/10);
- }
-
-
- /*
- * Update the T delay number of samples and the all pass delay number of samples
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_UINT32 Temp;
- LVM_INT32 APDelaySize;
- LVM_INT32 Fs = LVM_GetFsFromTable(pPrivate->NewParams.SampleRate);
- LVM_UINT32 DelayLengthSamples = (LVM_UINT32)(Fs * pPrivate->RoomSizeInms);
- LVM_INT16 i;
- LVM_INT16 ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4, LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
- LVM_INT16 MaxT_Delay[] = {LVREV_MAX_T0_DELAY, LVREV_MAX_T1_DELAY, LVREV_MAX_T2_DELAY, LVREV_MAX_T3_DELAY};
- LVM_INT16 MaxAP_Delay[] = {LVREV_MAX_AP0_DELAY, LVREV_MAX_AP1_DELAY, LVREV_MAX_AP2_DELAY, LVREV_MAX_AP3_DELAY};
-
-
- /*
- * For each delay line
- */
- for (i=0; i<NumberOfDelayLines; i++)
- {
- if (i != 0)
- {
- LVM_INT32 Temp1; /* to avoid QAC warning on type conversion */
- LVM_INT32 Temp2; /* to avoid QAC warning on type conversion */
-
- Temp2=(LVM_INT32)DelayLengthSamples;
- MUL32x16INTO32(Temp2, ScaleTable[i], Temp1, 15)
- Temp=(LVM_UINT32)Temp1;
- }
- else
- {
- Temp = DelayLengthSamples;
- }
- APDelaySize = Temp / 1500;
-
-
- /*
- * Set the fixed delay
- */
- Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 48000;
- pPrivate->Delay_AP[i] = pPrivate->T[i] - Temp;
-
-
- /*
- * Set the tap selection
- */
- if (pPrivate->AB_Selection)
- {
- /* Smooth from tap A to tap B */
- pPrivate->pOffsetB[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - Temp - APDelaySize];
- pPrivate->B_DelaySize[i] = APDelaySize;
- pPrivate->Mixer_APTaps[i].Target1 = 0;
- pPrivate->Mixer_APTaps[i].Target2 = 0x7fffffff;
- }
- else
- {
- /* Smooth from tap B to tap A */
- pPrivate->pOffsetA[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - Temp - APDelaySize];
- pPrivate->A_DelaySize[i] = APDelaySize;
- pPrivate->Mixer_APTaps[i].Target2 = 0;
- pPrivate->Mixer_APTaps[i].Target1 = 0x7fffffff;
- }
-
- /*
- * Set the maximum block size to the smallest delay size
- */
- pPrivate->MaxBlkLen = Temp;
- if (pPrivate->MaxBlkLen > pPrivate->A_DelaySize[i])
- {
- pPrivate->MaxBlkLen = pPrivate->A_DelaySize[i];
- }
- if (pPrivate->MaxBlkLen > pPrivate->B_DelaySize[i])
- {
- pPrivate->MaxBlkLen = pPrivate->B_DelaySize[i];
- }
- }
- if (pPrivate->AB_Selection)
- {
- pPrivate->AB_Selection = 0;
- }
- else
- {
- pPrivate->AB_Selection = 1;
- }
-
-
- /*
- * Limit the maximum block length
- */
- pPrivate->MaxBlkLen=pPrivate->MaxBlkLen-2; /* Just as a precausion, but no problem if we remove this line */
- if(pPrivate->MaxBlkLen > pPrivate->InstanceParams.MaxBlockSize)
- {
- pPrivate->MaxBlkLen = (LVM_INT32)pPrivate->InstanceParams.MaxBlockSize;
- }
- }
-
-
- /*
- * Update the low pass filter coefficient
- */
- if( (pPrivate->NewParams.Damping != pPrivate->CurrentParams.Damping) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_INT32 Temp;
- LVM_INT32 Omega;
- FO_C32_Coefs_t Coeffs;
- LVM_INT16 i;
- LVM_INT16 Damping = (LVM_INT16)((pPrivate->NewParams.Damping * 100) + 1000);
- LVM_INT32 ScaleTable[] = {LVREV_T_3_Power_0_on_4, LVREV_T_3_Power_1_on_4, LVREV_T_3_Power_2_on_4, LVREV_T_3_Power_3_on_4};
-
-
- /*
- * For each filter
- */
- for (i=0; i<NumberOfDelayLines; i++)
- {
- if (i != 0)
- {
- MUL32x16INTO32(ScaleTable[i], Damping, Temp, 15)
- }
- else
- {
- Temp = Damping;
- }
- if(Temp <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
- {
- Omega = LVM_GetOmega((LVM_UINT16)Temp, pPrivate->NewParams.SampleRate);
- LVM_FO_LPF(Omega, &Coeffs);
- }
- else
- {
- Coeffs.A0 = 0x7FF00000;
- Coeffs.A1 = 0;
- Coeffs.B1 = 0;
- }
- FO_1I_D32F32Cll_TRC_WRA_01_Init(&pPrivate->pFastCoef->RevLPCoefs[i], &pPrivate->pFastData->RevLPTaps[i], &Coeffs);
- }
- }
-
-
- /*
- * Update All-pass filter mixer time constants
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density))
- {
- LVM_INT16 i;
- LVM_INT32 Alpha = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_ALLPASS_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), 1);
- LVM_INT32 AlphaTap = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_ALLPASS_TAP_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), 1);
-
- for (i=0; i<4; i++)
- {
- pPrivate->Mixer_APTaps[i].Alpha1 = AlphaTap;
- pPrivate->Mixer_APTaps[i].Alpha2 = AlphaTap;
- pPrivate->Mixer_SGFeedback[i].Alpha = Alpha;
- pPrivate->Mixer_SGFeedforward[i].Alpha = Alpha;
- }
- }
-
-
- /*
- * Update the feed back gain
- */
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_INT32 G[4]; /* Feedback gain (Q7.24) */
-
- if(pPrivate->NewParams.T60 == 0)
- {
- G[3] = 0;
- G[2] = 0;
- G[1] = 0;
- G[0] = 0;
- }
- else
- {
- LVM_INT32 Temp1;
- LVM_INT32 Temp2;
- LVM_INT16 i;
- LVM_INT16 ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4, LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
-
-
- /*
- * For each delay line
- */
- for (i=0; i<NumberOfDelayLines; i++)
- {
- Temp1 = (3 * pPrivate->RoomSizeInms * ScaleTable[i]) / pPrivate->NewParams.T60;
- if(Temp1 >= (4 << 15))
- {
- G[i] = 0;
- }
- else if((Temp1 >= (2 << 15)))
- {
- Temp2 = LVM_Power10(-(Temp1 << 14));
- Temp1 = LVM_Power10(-(Temp1 << 14));
- MUL32x32INTO32(Temp1,Temp2,Temp1,24)
- }
- else
- {
- Temp1 = LVM_Power10(-(Temp1 << 15));
- }
- if (NumberOfDelayLines == 1)
- {
- G[i] = Temp1;
- }
- else
- {
- LVM_INT32 TempG;
- MUL32x16INTO32(Temp1,ONE_OVER_SQRT_TWO,TempG,15)
- G[i]=TempG;
- }
- }
- }
-
- /* Set up the feedback mixers for four delay lines */
- pPrivate->FeedbackMixer[0].Target=G[0]<<7;
- pPrivate->FeedbackMixer[1].Target=G[1]<<7;
- pPrivate->FeedbackMixer[2].Target=G[2]<<7;
- pPrivate->FeedbackMixer[3].Target=G[3]<<7;
- }
-
-
- /*
- * Calculate the gain correction
- */
- if((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
- (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) ||
- (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) )
- {
- LVM_INT32 Index=0;
- LVM_INT32 i=0;
- LVM_INT32 Gain=0;
- LVM_INT32 RoomSize=0;
- LVM_INT32 T60;
- LVM_INT32 Coefs[5];
-
- if(pPrivate->NewParams.RoomSize==0)
- {
- RoomSize=1;
- }
- else
- {
- RoomSize=(LVM_INT32)pPrivate->NewParams.RoomSize;
- }
-
- if(pPrivate->NewParams.T60<100)
- {
- T60 = 100 * LVREV_T60_SCALE;
- }
- else
- {
- T60 = pPrivate->NewParams.T60 * LVREV_T60_SCALE;
- }
-
- /* Find the nearest room size in table */
- for(i=0;i<24;i++)
- {
- if(RoomSize<= LVREV_GainPolyTable[i][0])
- {
- Index=i;
- break;
- }
- }
-
-
- if(RoomSize==LVREV_GainPolyTable[Index][0])
- {
- /* Take table values if the room size is in table */
- for(i=1;i<5;i++)
- {
- Coefs[i-1]=LVREV_GainPolyTable[Index][i];
- }
- Coefs[4]=0;
- Gain=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
- }
- else
- {
- /* Interpolate the gain between nearest room sizes */
-
- LVM_INT32 Gain1,Gain2;
- LVM_INT32 Tot_Dist,Dist;
-
- Tot_Dist=LVREV_GainPolyTable[Index][0]-LVREV_GainPolyTable[Index-1][0];
- Dist=RoomSize-LVREV_GainPolyTable[Index-1][0];
-
-
- /* Get gain for first */
- for(i=1;i<5;i++)
- {
- Coefs[i-1]=LVREV_GainPolyTable[Index-1][i];
- }
- Coefs[4]=0;
-
- Gain1=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
-
- /* Get gain for second */
- for(i=1;i<5;i++)
- {
- Coefs[i-1]=LVREV_GainPolyTable[Index][i];
- }
- Coefs[4]=0;
-
- Gain2=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
-
- /* Linear Interpolate the gain */
- Gain = Gain1+ (((Gain2-Gain1)*Dist)/(Tot_Dist));
- }
-
-
- /*
- * Get the inverse of gain: Q.15
- * Gain is mostly above one except few cases, take only gains above 1
- */
- if(Gain < 16777216L)
- {
- pPrivate->Gain= 32767;
- }
- else
- {
- pPrivate->Gain=(LVM_INT16)(LVM_MAXINT_32/(Gain>>8));
- }
-
-
- Index=((32767*100)/(100+pPrivate->NewParams.Level));
- pPrivate->Gain=(LVM_INT16)((pPrivate->Gain*Index)>>15);
- pPrivate->GainMixer.Target = pPrivate->Gain*Index;
- }
-
-
- /*
- * Update the all pass comb filter coefficient
- */
- if( (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_INT16 i;
- LVM_INT32 b = pPrivate->NewParams.Density * LVREV_B_8_on_1000;
-
- for (i=0;i<4; i++)
- {
- pPrivate->Mixer_SGFeedback[i].Target = b;
- pPrivate->Mixer_SGFeedforward[i].Target = b;
- }
- }
-
-
- /*
- * Update the bypass mixer time constant
- */
- if((pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_UINT16 NumChannels = 1; /* Assume MONO format */
- LVM_INT32 Alpha;
-
- Alpha = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_FEEDBACKMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
- pPrivate->FeedbackMixer[0].Alpha=Alpha;
- pPrivate->FeedbackMixer[1].Alpha=Alpha;
- pPrivate->FeedbackMixer[2].Alpha=Alpha;
- pPrivate->FeedbackMixer[3].Alpha=Alpha;
-
- NumChannels = 2; /* Always stereo output */
- pPrivate->BypassMixer.Alpha1 = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
- pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
- pPrivate->GainMixer.Alpha = pPrivate->BypassMixer.Alpha1;
- }
-
-
- /*
- * Update the bypass mixer targets
- */
- if( (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) &&
- (pPrivate->NewParams.OperatingMode == LVM_MODE_ON))
- {
- pPrivate->BypassMixer.Target2 = ((LVM_INT32)(pPrivate->NewParams.Level * 32767)/100)<<16;
- pPrivate->BypassMixer.Target1 = 0x00000000;
- if ((pPrivate->NewParams.Level == 0) && (pPrivate->bFirstControl == LVM_FALSE))
- {
- pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
- }
- if (pPrivate->NewParams.Level != 0)
- {
- pPrivate->bDisableReverb = LVM_FALSE;
- }
- }
-
- if(pPrivate->NewParams.OperatingMode != pPrivate->CurrentParams.OperatingMode)
- {
- if(pPrivate->NewParams.OperatingMode == LVM_MODE_ON)
- {
- pPrivate->BypassMixer.Target2 = ((LVM_INT32)(pPrivate->NewParams.Level * 32767)/100)<<16;
- pPrivate->BypassMixer.Target1 = 0x00000000;
-
- pPrivate->BypassMixer.CallbackSet2 = LVM_FALSE;
- OperatingMode = LVM_MODE_ON;
- if (pPrivate->NewParams.Level == 0)
- {
- pPrivate->bDisableReverb = LVM_TRUE;
- }
- else
- {
- pPrivate->bDisableReverb = LVM_FALSE;
- }
- }
- else if (pPrivate->bFirstControl == LVM_FALSE)
- {
- pPrivate->BypassMixer.Target2 = 0x00000000;
- pPrivate->BypassMixer.Target1 = 0x00000000;
- pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
- pPrivate->GainMixer.Target = 0x03FFFFFF;
- OperatingMode = LVM_MODE_ON;
- }
- else
- {
- OperatingMode = LVM_MODE_OFF;
- }
- }
-
-
- /*
- * If it is the first call to ApplyNew settings force the current to the target to begin immediate playback of the effect
- */
- if(pPrivate->bFirstControl == LVM_TRUE)
- {
- pPrivate->BypassMixer.Current1 = pPrivate->BypassMixer.Target1;
- pPrivate->BypassMixer.Current2 = pPrivate->BypassMixer.Target2;
- }
-
-
- /*
- * Copy the new parameters
- */
- pPrivate->CurrentParams = pPrivate->NewParams;
- pPrivate->CurrentParams.OperatingMode = OperatingMode;
-
-
- /*
- * Update flag
- */
- if(pPrivate->bFirstControl == LVM_TRUE)
- {
- pPrivate->bFirstControl = LVM_FALSE;
- }
-
-
- return LVREV_SUCCESS;
-}
-#else /* BUILD_FLOAT*/
-LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
-{
-
- LVM_Mode_en OperatingMode;
- LVM_INT32 NumberOfDelayLines;
-
-
/* Check for NULL pointer */
if(pPrivate == LVM_NULL)
{
@@ -638,12 +83,10 @@
FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->HPCoefs,
&pPrivate->pFastData->HPTaps, &Coeffs);
LoadConst_Float(0,
- (LVM_FLOAT *)&pPrivate->pFastData->HPTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+ (LVM_FLOAT *)&pPrivate->pFastData->HPTaps,
sizeof(Biquad_1I_Order1_FLOAT_Taps_t) / sizeof(LVM_FLOAT));
}
-
/*
* Update the low pass filter coefficients
*/
@@ -672,12 +115,10 @@
FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->LPCoefs,
&pPrivate->pFastData->LPTaps, &Coeffs);
LoadConst_Float(0,
- (LVM_FLOAT *)&pPrivate->pFastData->LPTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+ (LVM_FLOAT *)&pPrivate->pFastData->LPTaps,
sizeof(Biquad_1I_Order1_FLOAT_Taps_t) / sizeof(LVM_FLOAT));
}
-
/*
* Calculate the room size parameter
*/
@@ -691,7 +132,6 @@
pPrivate->RoomSizeInms = 10 + (((pPrivate->NewParams.RoomSize*11) + 5) / 10);
}
-
/*
* Update the T delay number of samples and the all pass delay number of samples
*/
@@ -712,7 +152,6 @@
LVM_INT16 MaxAP_Delay[] = {LVREV_MAX_AP0_DELAY, LVREV_MAX_AP1_DELAY, \
LVREV_MAX_AP2_DELAY, LVREV_MAX_AP3_DELAY};
-
/*
* For each delay line
*/
@@ -731,19 +170,13 @@
}
APDelaySize = Temp / 1500;
-
/*
* Set the fixed delay
*/
-#ifdef HIGHER_FS
Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 192000;
-#else
- Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 48000;
-#endif
pPrivate->Delay_AP[i] = pPrivate->T[i] - Temp;
-
/*
* Set the tap selection
*/
@@ -788,7 +221,6 @@
pPrivate->AB_Selection = 1;
}
-
/*
* Limit the maximum block length
*/
@@ -800,8 +232,6 @@
}
}
-
-
/*
* Update the low pass filter coefficient
*/
@@ -818,7 +248,6 @@
LVM_FLOAT ScaleTable[] = {LVREV_T_3_Power_0_on_4, LVREV_T_3_Power_1_on_4,
LVREV_T_3_Power_2_on_4, LVREV_T_3_Power_3_on_4};
-
/*
* For each filter
*/
@@ -848,7 +277,6 @@
}
}
-
/*
* Update All-pass filter mixer time constants
*/
@@ -877,7 +305,6 @@
}
}
-
/*
* Update the feed back gain
*/
@@ -904,7 +331,6 @@
LVM_FLOAT ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4,
LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
-
/*
* For each delay line
*/
@@ -945,7 +371,6 @@
pPrivate->FeedbackMixer[3].Target=G[3];
}
-
/*
* Calculate the gain correction
*/
@@ -961,7 +386,6 @@
LVM_FLOAT T60;
LVM_FLOAT Coefs[5];
-
if(pPrivate->NewParams.RoomSize == 0)
{
RoomSize = 1;
@@ -971,7 +395,6 @@
RoomSize = (LVM_INT32)pPrivate->NewParams.RoomSize;
}
-
if(pPrivate->NewParams.T60 < 100)
{
T60 = 100 * LVREV_T60_SCALE;
@@ -991,7 +414,6 @@
}
}
-
if(RoomSize == LVREV_GainPolyTable[Index][0])
{
/* Take table values if the room size is in table */
@@ -1013,7 +435,6 @@
(LVM_UINT32)LVREV_GainPolyTable[Index-1][0];
Dist = RoomSize - (LVM_UINT32)LVREV_GainPolyTable[Index - 1][0];
-
/* Get gain for first */
for(i = 1; i < 5; i++)
{
@@ -1036,7 +457,6 @@
Gain = Gain1 + (((Gain2 - Gain1) * Dist) / (Tot_Dist));
}
-
/*
* Get the inverse of gain: Q.15
* Gain is mostly above one except few cases, take only gains above 1
@@ -1055,7 +475,6 @@
pPrivate->GainMixer.Target = (pPrivate->Gain*Index_FLOAT) / 2;
}
-
/*
* Update the all pass comb filter coefficient
*/
@@ -1072,7 +491,6 @@
}
}
-
/*
* Update the bypass mixer time constant
*/
@@ -1097,7 +515,6 @@
pPrivate->GainMixer.Alpha = pPrivate->BypassMixer.Alpha1;
}
-
/*
* Update the bypass mixer targets
*/
@@ -1148,7 +565,6 @@
}
}
-
/* If it is the first call to ApplyNew settings force the current to the target \
to begin immediate playback of the effect */
if(pPrivate->bFirstControl == LVM_TRUE)
@@ -1157,14 +573,12 @@
pPrivate->BypassMixer.Current2 = pPrivate->BypassMixer.Target2;
}
-
/*
* Copy the new parameters
*/
pPrivate->CurrentParams = pPrivate->NewParams;
pPrivate->CurrentParams.OperatingMode = OperatingMode;
-
/*
* Update flag
*/
@@ -1173,10 +587,8 @@
pPrivate->bFirstControl = LVM_FALSE;
}
-
return LVREV_SUCCESS;
}
-#endif /*BUILD_FLOAT*/
/****************************************************************************************/
/* */
/* FUNCTION: BypassMixer_Callback */
@@ -1201,14 +613,12 @@
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)pCallbackData;
-
/*
* Avoid build warnings
*/
(void)pGeneralPurpose;
(void)GeneralPurpose;
-
/*
* Turn off
*/
@@ -1216,7 +626,6 @@
pLVREV_Private->bDisableReverb = LVM_TRUE;
LVREV_ClearAudioBuffers((LVREV_Handle_t)pCallbackData);
-
return 0;
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
index 0f41f09..586539f 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
@@ -23,7 +23,6 @@
#include "LVREV_Private.h"
#include "VectorArithmetic.h"
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_ClearAudioBuffers */
@@ -47,7 +46,6 @@
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-
/*
* Check for error conditions
*/
@@ -61,36 +59,14 @@
* Clear all filter tap data, delay-lines and other signal related data
*/
-#ifdef BUILD_FLOAT
LoadConst_Float(0,
- (LVM_FLOAT *)&pLVREV_Private->pFastData->HPTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+ (LVM_FLOAT *)&pLVREV_Private->pFastData->HPTaps,
2);
LoadConst_Float(0,
- (LVM_FLOAT *)&pLVREV_Private->pFastData->LPTaps, /* Destination Cast to void: \
- no dereferencing in function*/
+ (LVM_FLOAT *)&pLVREV_Private->pFastData->LPTaps,
2);
-#else
- LoadConst_32(0,
- (void *)&pLVREV_Private->pFastData->HPTaps, /* Destination Cast to void: no dereferencing in function*/
- 2);
- LoadConst_32(0,
- (void *)&pLVREV_Private->pFastData->LPTaps, /* Destination Cast to void: no dereferencing in function*/
- 2);
-#endif
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
{
-#ifndef BUILD_FLOAT
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[3], 2);
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[2], 2);
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[3], (LVM_INT16)LVREV_MAX_T3_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[2], (LVM_INT16)LVREV_MAX_T2_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
-#else
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[3], 2);
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[2], 2);
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
@@ -100,35 +76,21 @@
LoadConst_Float(0, pLVREV_Private->pDelay_T[2], LVREV_MAX_T2_DELAY);
LoadConst_Float(0, pLVREV_Private->pDelay_T[1], LVREV_MAX_T1_DELAY);
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
-#endif
}
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_2)
{
-#ifndef BUILD_FLOAT
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
-#else
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
LoadConst_Float(0, pLVREV_Private->pDelay_T[1], LVREV_MAX_T1_DELAY);
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
-#endif
}
if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_1)
{
-#ifndef BUILD_FLOAT
- LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
-#else
LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
-#endif
}
return LVREV_SUCCESS;
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp
index 7cee26d..e0b0142 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp
@@ -22,7 +22,6 @@
/****************************************************************************************/
#include "LVREV_Private.h"
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_GetControlParameters */
@@ -49,7 +48,6 @@
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-
/*
* Check for error conditions
*/
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
index 8a27371..68f883a 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
@@ -23,7 +23,6 @@
#include "LVREV_Private.h"
#include "InstAlloc.h"
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_GetInstanceHandle */
@@ -59,7 +58,6 @@
LVM_INT16 i;
LVM_UINT16 MaxBlockSize;
-
/*
* Check for error conditions
*/
@@ -108,7 +106,6 @@
/*
* Zero all memory regions
*/
-#ifdef BUILD_FLOAT
LoadConst_Float(0,
(LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress,
(LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size) / \
@@ -125,12 +122,6 @@
(LVM_FLOAT *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress,
(LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size) / \
sizeof(LVM_FLOAT)));
-#else
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size)/sizeof(LVM_INT16)));
- LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size)/sizeof(LVM_INT16)));
-#endif
/*
* Set the instance handle if not already initialised
*/
@@ -159,58 +150,12 @@
MaxBlockSize=pInstanceParams->MaxBlockSize;
}
-
/*
* Set the data, coefficient and temporary memory pointers
*/
/* Fast data memory base address */
pLVREV_Private->pFastData = (LVREV_FastData_st *)
InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st));
-#ifndef BUILD_FLOAT
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
- {
- pLVREV_Private->pDelay_T[3] = InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
- pLVREV_Private->pDelay_T[2] = InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_INT32));
- pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-
- for( i = 0; i < 4; i++)
- {
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
- }
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[3] ,(LVM_INT16)LVREV_MAX_T3_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[2] ,(LVM_INT16)LVREV_MAX_T2_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[1] ,(LVM_INT16)LVREV_MAX_T1_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0] ,(LVM_INT16)LVREV_MAX_T0_DELAY);
- }
-
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
- {
- pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-
- for( i = 0; i < 2; i++)
- {
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
- }
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[1] , (LVM_INT16)LVREV_MAX_T1_DELAY);
- LoadConst_32(0,pLVREV_Private->pDelay_T[0] , (LVM_INT16)LVREV_MAX_T0_DELAY);
- }
-
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
- {
- pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-
- for( i = 0; i < 1; i++)
- {
- pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
- }
-
- LoadConst_32(0,pLVREV_Private->pDelay_T[0] , (LVM_INT16)LVREV_MAX_T0_DELAY);
- }
-#else
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
pLVREV_Private->pDelay_T[3] =
@@ -276,7 +221,6 @@
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
}
-#endif
/* All-pass delay buffer addresses and sizes */
pLVREV_Private->T[0] = LVREV_MAX_T0_DELAY;
pLVREV_Private->T[1] = LVREV_MAX_T1_DELAY;
@@ -287,15 +231,6 @@
/* Fast coefficient memory base address */
pLVREV_Private->pFastCoef =
(LVREV_FastCoef_st *)InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st));
-#ifndef BUILD_FLOAT
- /* General purpose scratch */
- pLVREV_Private->pScratch =
- (LVM_FLOAT *)InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize);
- /* Mono->stereo input save for end mix */
- pLVREV_Private->pInputSave =
- (LVM_FLOAT *)InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_INT32) * MaxBlockSize);
- LoadConst_32(0, pLVREV_Private->pInputSave, (LVM_INT16)(MaxBlockSize*2));
-#else
/* General purpose scratch */
pLVREV_Private->pScratch =
(LVM_FLOAT *)InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * \
@@ -305,14 +240,12 @@
(LVM_FLOAT *)InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * \
MaxBlockSize);
LoadConst_Float(0, pLVREV_Private->pInputSave, (LVM_INT16)(MaxBlockSize * 2));
-#endif
/*
* Save the instance parameters in the instance structure
*/
pLVREV_Private->InstanceParams = *pInstanceParams;
-
/*
* Set the parameters to invalid
*/
@@ -324,7 +257,6 @@
pLVREV_Private->bFirstControl = LVM_TRUE;
pLVREV_Private->bDisableReverb = LVM_FALSE;
-
/*
* Set mixer parameters
*/
@@ -345,7 +277,6 @@
pLVREV_Private->RoomSizeInms = 100; // 100 msec
-
/*
* Set the output gain mixer parameters
*/
@@ -354,13 +285,8 @@
pLVREV_Private->GainMixer.pGeneralPurpose = LVM_NULL;
pLVREV_Private->GainMixer.pCallBack = LVM_NULL;
pLVREV_Private->GainMixer.CallbackSet = LVM_FALSE;
-#ifndef BUILD_FLOAT
- pLVREV_Private->GainMixer.Current = 0x03ffffff;
- pLVREV_Private->GainMixer.Target = 0x03ffffff;
-#else
pLVREV_Private->GainMixer.Current = 0.03125f;//0x03ffffff;
pLVREV_Private->GainMixer.Target = 0.03125f;//0x03ffffff;
-#endif
/*
* Set the All-Pass Filter mixers
@@ -383,11 +309,7 @@
pLVREV_Private->Mixer_APTaps[i].pCallBack1 = LVM_NULL;
pLVREV_Private->Mixer_APTaps[i].CallbackSet1 = LVM_FALSE;
pLVREV_Private->Mixer_APTaps[i].Current1 = 0;
-#ifndef BUILD_FLOAT
- pLVREV_Private->Mixer_APTaps[i].Target1 = 0x7fffffff;
-#else
pLVREV_Private->Mixer_APTaps[i].Target1 = 1;
-#endif
/* Feedforward mixer */
pLVREV_Private->Mixer_SGFeedforward[i].CallbackParam = 0;
pLVREV_Private->Mixer_SGFeedforward[i].pCallbackHandle = LVM_NULL;
@@ -423,7 +345,6 @@
pLVREV_Private->A_DelaySize[3] = LVREV_MAX_AP3_DELAY;
pLVREV_Private->B_DelaySize[3] = LVREV_MAX_AP3_DELAY;
-
LVREV_ClearAudioBuffers(*phInstance);
return LVREV_SUCCESS;
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
index f6d446b..f59933c 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
@@ -68,7 +68,6 @@
LVM_INT16 i;
LVM_UINT16 MaxBlockSize;
-
/*
* Check for error conditions
*/
@@ -109,7 +108,6 @@
InstAlloc_Init(&FastCoef, (void *)LVM_NULL);
InstAlloc_Init(&Temporary, (void *)LVM_NULL);
-
/*
* Fill in the memory table
*/
@@ -123,7 +121,6 @@
return(LVREV_NULLADDRESS);
}
-
/*
* Select the maximum internal block size
*/
@@ -145,7 +142,6 @@
MaxBlockSize=pInstanceParams->MaxBlockSize;
}
-
/*
* Slow data memory
*/
@@ -154,51 +150,33 @@
pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Type = LVM_PERSISTENT_SLOW_DATA;
pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress = LVM_NULL;
-
/*
* Persistent fast data memory
*/
InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st));
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
- InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_INT32));
- InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
- InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-#else
InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
-#endif
}
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
- InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-#else
InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
-#endif
}
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
-#else
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
-#endif
}
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size = InstAlloc_GetTotal(&FastData);
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Type = LVM_PERSISTENT_FAST_DATA;
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress = LVM_NULL;
-
/*
* Persistent fast coefficient memory
*/
@@ -207,29 +185,19 @@
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Type = LVM_PERSISTENT_FAST_COEF;
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress = LVM_NULL;
-
/*
* Temporary fast memory
*/
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* General purpose scratch memory */
- InstAlloc_AddMember(&Temporary, 2*sizeof(LVM_INT32) * MaxBlockSize); /* Mono->stereo input saved for end mix */
-#else
/* General purpose scratch memory */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
/* Mono->stereo input saved for end mix */
InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * MaxBlockSize);
-#endif
if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
{
for(i=0; i<4; i++)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
-#else
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
-#endif
}
}
@@ -237,12 +205,8 @@
{
for(i=0; i<2; i++)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
-#else
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
-#endif
}
}
@@ -250,12 +214,8 @@
{
for(i=0; i<1; i++)
{
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
-#else
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
-#endif
}
}
@@ -268,14 +228,12 @@
{
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-
/*
* Read back memory allocation table
*/
*pMemoryTable = pLVREV_Private->MemoryTable;
}
-
return(LVREV_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
index 3379d65..2c27c6e 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
@@ -18,8 +18,6 @@
#ifndef __LVREV_PRIVATE_H__
#define __LVREV_PRIVATE_H__
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -33,43 +31,22 @@
#include "Mixer.h"
#include "LVM_Macros.h"
-
/****************************************************************************************/
/* */
/* Defines */
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-/* General */
-#define ONE_OVER_SQRT_TWO 23170 /* 1/sqrt(2) * 2^15 */
-#define LVREV_B_8_on_1000 17179869 /* 0.8 * 2^31 */
-#define LVREV_HEADROOM 8192 /* -12dB * 2^15 */
-#define LVREV_2_9_INQ29 1583769190L /* 2.9 in Q29 format */
-#define LVREV_MIN3DB 0x5A82 /* -3dB in Q15 format */
-#else
/* General */
#define ONE_OVER_SQRT_TWO 0.707107f /* 1/sqrt(2) * 2^15 */
#define LVREV_B_8_on_1000 0.008f /* 0.8 * 2^31 */
#define LVREV_HEADROOM 0.25f /* -12dB * 2^15 */
#define LVREV_2_9_INQ29 2.9f /* 2.9 in Q29 format */
#define LVREV_MIN3DB 0.7079457f /* -3dB in Q15 format */
-#endif
/* Intenal constants */
#define LVREV_LP_Poly_Order 4
#define LVREV_LP_Poly_Shift 5
-#ifndef BUILD_FLOAT
-#define LVREV_T_3_Power_0_on_4 32768
-#define LVREV_T_3_Power_1_on_4 43125
-#define LVREV_T_3_Power_2_on_4 56755
-#define LVREV_T_3_Power_3_on_4 74694
-#define LVREV_T60_SCALE 306774 /*(32767/7000)<<16 */
-#define LVREV_T_3_Power_minus0_on_4 32767 /* 3^(-0/4) * 2^15 */
-#define LVREV_T_3_Power_minus1_on_4 24898 /* 3^(-1/4) * 2^15 */
-#define LVREV_T_3_Power_minus2_on_4 18919 /* 3^(-2/4) * 2^15 */
-#define LVREV_T_3_Power_minus3_on_4 14375 /* 3^(-3/4) * 2^15 */
-#else/*BUILD_FLOAT*/
#define LVREV_T60_SCALE 0.000142f /*(1/7000) */
#define LVREV_T_3_Power_0_on_4 1.0f
@@ -80,18 +57,7 @@
#define LVREV_T_3_Power_minus1_on_4 0.759836f /* 3^(-1/4) * 2^15 */
#define LVREV_T_3_Power_minus2_on_4 0.577350f /* 3^(-2/4) * 2^15 */
#define LVREV_T_3_Power_minus3_on_4 0.438691f /* 3^(-3/4) * 2^15 */
-#endif
-#ifndef HIGHER_FS
-#define LVREV_MAX_T3_DELAY 2527 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T2_DELAY 3326 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T1_DELAY 4377 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T0_DELAY 5760 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
-#define LVREV_MAX_AP3_DELAY 1685 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP2_DELAY 2218 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP1_DELAY 2918 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP0_DELAY 3840 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
-#else
/* ((192000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1000 */
#define LVREV_MAX_T3_DELAY 10108
/* ((192000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1000 */
@@ -108,7 +74,6 @@
#define LVREV_MAX_AP1_DELAY 11672
/* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
#define LVREV_MAX_AP0_DELAY 15360
-#endif
#define LVREV_BYPASSMIXER_TC 1000 /* Bypass mixer time constant*/
#define LVREV_ALLPASS_TC 1000 /* All-pass filter time constant */
@@ -117,11 +82,7 @@
#define LVREV_OUTPUTGAIN_SHIFT 5 /* Bits shift for output gain correction */
/* Parameter limits */
-#ifndef HIGHER_FS
-#define LVREV_NUM_FS 9 /* Number of supported sample rates */
-#else
#define LVREV_NUM_FS 13 /* Number of supported sample rates */
-#endif
#define LVREV_MAXBLKSIZE_LIMIT 64 /* Maximum block size low limit */
#define LVREV_MAX_LEVEL 100 /* Maximum level, 100% */
@@ -134,81 +95,11 @@
#define LVREV_MAX_DAMPING 100 /* Maximum damping, 100% */
#define LVREV_MAX_ROOMSIZE 100 /* Maximum room size, 100% */
-
-
/****************************************************************************************/
/* */
/* Structures */
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-/* Fast data structure */
-typedef struct
-{
-
- Biquad_1I_Order1_Taps_t HPTaps; /* High pass filter taps */
- Biquad_1I_Order1_Taps_t LPTaps; /* Low pass filter taps */
- Biquad_1I_Order1_Taps_t RevLPTaps[4]; /* Reverb low pass filters taps */
-
-} LVREV_FastData_st;
-
-
-/* Fast coefficient structure */
-typedef struct
-{
-
- Biquad_Instance_t HPCoefs; /* High pass filter coefficients */
- Biquad_Instance_t LPCoefs; /* Low pass filter coefficients */
- Biquad_Instance_t RevLPCoefs[4]; /* Reverb low pass filters coefficients */
-
-} LVREV_FastCoef_st;
-
-
-/* Instance parameter structure */
-typedef struct
-{
- /* General */
- LVREV_InstanceParams_st InstanceParams; /* Initialisation time instance parameters */
- LVREV_MemoryTable_st MemoryTable; /* Memory table */
- LVREV_ControlParams_st CurrentParams; /* Parameters being used */
- LVREV_ControlParams_st NewParams; /* New parameters from the calling application */
- LVM_CHAR bControlPending; /* Flag to indicate new parameters are available */
- LVM_CHAR bFirstControl; /* Flag to indicate that the control function is called for the first time */
- LVM_CHAR bDisableReverb; /* Flag to indicate that the mix level is 0% and the reverb can be disabled */
- LVM_INT32 RoomSizeInms; /* Room size in msec */
- LVM_INT32 MaxBlkLen; /* Maximum block size for internal processing */
-
- /* Aligned memory pointers */
- LVREV_FastData_st *pFastData; /* Fast data memory base address */
- LVREV_FastCoef_st *pFastCoef; /* Fast coefficient memory base address */
- LVM_INT32 *pScratchDelayLine[4]; /* Delay line scratch memory */
- LVM_INT32 *pScratch; /* Multi ussge scratch */
- LVM_INT32 *pInputSave; /* Reverb block input save for dry/wet mixing*/
-
- /* Feedback matrix */
- Mix_1St_Cll_t FeedbackMixer[4]; /* Mixer for Pop and Click Supression caused by feedback Gain */
-
- /* All-Pass Filter */
- LVM_INT32 T[4]; /* Maximum delay size of buffer */
- LVM_INT32 *pDelay_T[4]; /* Pointer to delay buffers */
- LVM_INT32 Delay_AP[4]; /* Offset to AP delay buffer start */
- LVM_INT16 AB_Selection; /* Smooth from tap A to B when 1 otherwise B to A */
- LVM_INT32 A_DelaySize[4]; /* A delay length in samples */
- LVM_INT32 B_DelaySize[4]; /* B delay length in samples */
- LVM_INT32 *pOffsetA[4]; /* Offset for the A delay tap */
- LVM_INT32 *pOffsetB[4]; /* Offset for the B delay tap */
- Mix_2St_Cll_t Mixer_APTaps[4]; /* Smoothed AP delay mixer */
- Mix_1St_Cll_t Mixer_SGFeedback[4]; /* Smoothed SAfeedback gain */
- Mix_1St_Cll_t Mixer_SGFeedforward[4]; /* Smoothed AP feedforward gain */
-
- /* Output gain */
- Mix_2St_Cll_t BypassMixer; /* Dry/wet mixer */
- LVM_INT16 Gain; /* Gain applied to output to maintain average signal power */
- Mix_1St_Cll_t GainMixer; /* Gain smoothing */
-
-} LVREV_Instance_st;
-
-#else /* BUILD_FLOAT */
/* Fast data structure */
typedef struct
@@ -219,7 +110,6 @@
} LVREV_FastData_st;
-
/* Fast coefficient structure */
typedef struct
{
@@ -259,7 +149,6 @@
Mix_1St_Cll_FLOAT_t FeedbackMixer[4]; /* Mixer for Pop and Click Supression \
caused by feedback Gain */
-
/* All-Pass Filter */
LVM_INT32 T[4]; /* Maximum delay size of buffer */
LVM_FLOAT *pDelay_T[4]; /* Pointer to delay buffers */
@@ -282,7 +171,6 @@
} LVREV_Instance_st;
-#endif
/****************************************************************************************/
/* */
/* Function prototypes */
@@ -290,23 +178,14 @@
/****************************************************************************************/
LVREV_ReturnStatus_en LVREV_ApplyNewSettings(LVREV_Instance_st *pPrivate);
-#ifdef BUILD_FLOAT
void ReverbBlock(LVM_FLOAT *pInput,
LVM_FLOAT *pOutput,
LVREV_Instance_st *pPrivate,
LVM_UINT16 NumSamples);
-#else
-void ReverbBlock(LVM_INT32 *pInput,
- LVM_INT32 *pOutput,
- LVREV_Instance_st *pPrivate,
- LVM_UINT16 NumSamples);
-#endif
LVM_INT32 BypassMixer_Callback(void *pCallbackData,
void *pGeneralPurpose,
LVM_INT16 GeneralPurpose );
-
-
#endif /** __LVREV_PRIVATE_H__ **/
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp
index 1d1283e..35f9ad8 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp
@@ -23,7 +23,6 @@
#include "LVREV_Private.h"
#include "VectorArithmetic.h"
-
/****************************************************************************************/
/* */
/* FUNCTION: LVREV_Process */
@@ -46,26 +45,14 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
const LVM_UINT16 NumSamples)
-#else
-LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
- const LVM_INT32 *pInData,
- LVM_INT32 *pOutData,
- const LVM_UINT16 NumSamples)
-#endif
{
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-#ifdef BUILD_FLOAT
LVM_FLOAT *pInput = (LVM_FLOAT *)pInData;
LVM_FLOAT *pOutput = pOutData;
-#else
- LVM_INT32 *pInput = (LVM_INT32 *)pInData;
- LVM_INT32 *pOutput = pOutData;
-#endif
LVM_INT32 SamplesToProcess, RemainingSamples;
LVM_INT32 format = 1;
@@ -117,15 +104,6 @@
/*
* Copy the data to the output buffer, convert to stereo is required
*/
-#ifndef BUILD_FLOAT
- if(pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO){
- MonoTo2I_32(pInput, pOutput, NumSamples);
- } else {
- Copy_16((LVM_INT16 *)pInput,
- (LVM_INT16 *)pOutput,
- (LVM_INT16)(NumSamples << 2)); // 32 bit data, stereo
- }
-#else
if(pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO){
MonoTo2I_Float(pInput, pOutput, NumSamples);
} else {
@@ -133,7 +111,6 @@
pOutput,
(LVM_INT16)(NumSamples << 1)); // 32 bit data, stereo
}
-#endif
}
return LVREV_SUCCESS;
@@ -164,20 +141,13 @@
}
ReverbBlock(pInput, pOutput, pLVREV_Private, (LVM_UINT16)SamplesToProcess);
-#ifdef BUILD_FLOAT
pInput = (LVM_FLOAT *)(pInput + (SamplesToProcess * format));
pOutput = (LVM_FLOAT *)(pOutput + (SamplesToProcess * 2)); // Always stereo output
-#else
- pInput = (LVM_INT32 *)(pInput +(SamplesToProcess*format));
- pOutput = (LVM_INT32 *)(pOutput+(SamplesToProcess*2));
-#endif
}
return LVREV_SUCCESS;
}
-
-
/****************************************************************************************/
/* */
/* FUNCTION: ReverbBlock */
@@ -200,311 +170,6 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-#ifndef BUILD_FLOAT
-void ReverbBlock(LVM_INT32 *pInput, LVM_INT32 *pOutput, LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
-{
- LVM_INT16 j, size;
- LVM_INT32 *pDelayLine;
- LVM_INT32 *pDelayLineInput = pPrivate->pScratch;
- LVM_INT32 *pScratch = pPrivate->pScratch;
- LVM_INT32 *pIn;
- LVM_INT32 *pTemp = pPrivate->pInputSave;
- LVM_INT32 NumberOfDelayLines;
-
- /******************************************************************************
- * All calculations will go into the buffer pointed to by pTemp, this will *
- * then be mixed with the original input to create the final output. *
- * *
- * When INPLACE processing is selected this must be a temporary buffer and *
- * hence this is the worst case, so for simplicity this will ALWAYS be so *
- * *
- * The input buffer will remain untouched until the output of the mixer if *
- * INPLACE processing is selected. *
- * *
- * The temp buffer will always be NumSamples in size regardless of MONO or *
- * STEREO input. In the case of stereo input all processing is done in MONO *
- * and the final output is converted to STEREO after the mixer *
- ******************************************************************************/
-
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4 )
- {
- NumberOfDelayLines = 4;
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2 )
- {
- NumberOfDelayLines = 2;
- }
- else
- {
- NumberOfDelayLines = 1;
- }
-
- if(pPrivate->CurrentParams.SourceFormat == LVM_MONO)
- {
- pIn = pInput;
- }
- else
- {
- /*
- * Stereo to mono conversion
- */
-
- From2iToMono_32( pInput,
- pTemp,
- (LVM_INT16)NumSamples);
-
- pIn = pTemp;
- }
-
- Mult3s_32x16(pIn,
- (LVM_INT16)LVREV_HEADROOM,
- pTemp,
- (LVM_INT16)NumSamples);
-
- /*
- * High pass filter
- */
- FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->HPCoefs,
- pTemp,
- pTemp,
- (LVM_INT16)NumSamples);
- /*
- * Low pass filter
- */
- FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->LPCoefs,
- pTemp,
- pTemp,
- (LVM_INT16)NumSamples);
-
- /*
- * Process all delay lines
- */
-
- for(j = 0; j < NumberOfDelayLines; j++)
- {
- pDelayLine = pPrivate->pScratchDelayLine[j];
-
- /*
- * All-pass filter with pop and click suppression
- */
- /* Get the smoothed, delayed output. Put it in the output buffer */
- MixSoft_2St_D32C31_SAT(&pPrivate->Mixer_APTaps[j],
- pPrivate->pOffsetA[j],
- pPrivate->pOffsetB[j],
- pDelayLine,
- (LVM_INT16)NumSamples);
- /* Re-align the all pass filter delay buffer and copying the fixed delay data to the AP delay in the process */
- Copy_16((LVM_INT16 *)&pPrivate->pDelay_T[j][NumSamples],
- (LVM_INT16 *)pPrivate->pDelay_T[j],
- (LVM_INT16)((pPrivate->T[j]-NumSamples) << 1)); /* 32-bit data */
- /* Apply the smoothed feedback and save to fixed delay input (currently empty) */
- MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedback[j],
- pDelayLine,
- &pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- (LVM_INT16)NumSamples);
- /* Sum into the AP delay line */
- Mac3s_Sat_32x16(&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- -0x7fff, /* Invert since the feedback coefficient is negative */
- &pPrivate->pDelay_T[j][pPrivate->Delay_AP[j]-NumSamples],
- (LVM_INT16)NumSamples);
- /* Apply smoothed feedforward sand save to fixed delay input (currently empty) */
- MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedforward[j],
- &pPrivate->pDelay_T[j][pPrivate->Delay_AP[j]-NumSamples],
- &pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- (LVM_INT16)NumSamples);
- /* Sum into the AP output */
- Mac3s_Sat_32x16(&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- 0x7fff,
- pDelayLine,
- (LVM_INT16)NumSamples);
-
- /*
- * Feedback gain
- */
- MixSoft_1St_D32C31_WRA(&pPrivate->FeedbackMixer[j], pDelayLine, pDelayLine, NumSamples);
-
- /*
- * Low pass filter
- */
- FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->RevLPCoefs[j],
- pDelayLine,
- pDelayLine,
- (LVM_INT16)NumSamples);
- }
-
- /*
- * Apply rotation matrix and delay samples
- */
- for(j = 0; j < NumberOfDelayLines; j++)
- {
-
- Copy_16( (LVM_INT16*)(pTemp),
- (LVM_INT16*)(pDelayLineInput),
- (LVM_INT16)(NumSamples << 1));
-
- /*
- * Rotation matrix mix
- */
- switch(j)
- {
- case 3:
- /*
- * Add delay line 1 and 2 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[2], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
-
- break;
- case 2:
-
- /*
- * Add delay line 0 and 3 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[3], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
-
- break;
- case 1:
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
- /*
- * Add delay line 0 and 3 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[3], pDelayLineInput, (LVM_INT16)NumSamples);
-
- }
- else
- {
- /*
- * Add delay line 0 and 1 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
-
- }
- break;
- case 0:
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
- /*
- * Add delay line 1 and 2 contribution
- */
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[2], pDelayLineInput, (LVM_INT16)NumSamples);
-
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
- {
- /*
- * Add delay line 0 and 1 contribution
- */
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[0], pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
-
- }
- else
- {
- /*
- * Add delay line 0 contribution
- */
-
- /* SOURCE DESTINATION*/
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[0], pDelayLineInput, (LVM_INT16)NumSamples);
- }
- break;
- default:
- break;
- }
-
- /*
- * Delay samples
- */
- Copy_16((LVM_INT16 *)pDelayLineInput,
- (LVM_INT16 *)&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
- (LVM_INT16)(NumSamples << 1)); /* 32-bit data */
-
- }
-
-
- /*
- * Create stereo output
- */
- switch(pPrivate->InstanceParams.NumDelays)
- {
- case LVREV_DELAYLINES_4:
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[3],
- pPrivate->pScratchDelayLine[0],
- (LVM_INT16)NumSamples);
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[2],
- pPrivate->pScratchDelayLine[1],
- (LVM_INT16)NumSamples);
-
-
- JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
- pPrivate->pScratchDelayLine[1],
- pTemp,
- (LVM_INT16)NumSamples);
-
-
- break;
- case LVREV_DELAYLINES_2:
-
- Copy_16( (LVM_INT16*)pPrivate->pScratchDelayLine[1],
- (LVM_INT16*)pScratch,
- (LVM_INT16)(NumSamples << 1));
-
- Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0],
- -0x8000,
- pScratch,
- (LVM_INT16)NumSamples);
-
- Add2_Sat_32x32(pPrivate->pScratchDelayLine[1],
- pPrivate->pScratchDelayLine[0],
- (LVM_INT16)NumSamples);
-
-
- JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
- pScratch,
- pTemp,
- (LVM_INT16)NumSamples);
- break;
- case LVREV_DELAYLINES_1:
- MonoTo2I_32(pPrivate->pScratchDelayLine[0],
- pTemp,
- (LVM_INT16)NumSamples);
- break;
- default:
- break;
- }
-
-
- /*
- * Dry/wet mixer
- */
-
- size = (LVM_INT16)(NumSamples << 1);
- MixSoft_2St_D32C31_SAT(&pPrivate->BypassMixer,
- pTemp,
- pTemp,
- pOutput,
- size);
-
- /* Apply Gain*/
-
- Shift_Sat_v32xv32 (LVREV_OUTPUTGAIN_SHIFT,
- pOutput,
- pOutput,
- size);
-
- MixSoft_1St_D32C31_WRA(&pPrivate->GainMixer,
- pOutput,
- pOutput,
- size);
-
- return;
-}
-#else
void ReverbBlock(LVM_FLOAT *pInput, LVM_FLOAT *pOutput,
LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
{
@@ -742,7 +407,6 @@
(LVM_INT16)(NumSamples)); /* 32-bit data */
}
-
/*
* Create stereo output
*/
@@ -756,13 +420,11 @@
pPrivate->pScratchDelayLine[1],
(LVM_INT16)NumSamples);
-
JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
pPrivate->pScratchDelayLine[1],
pTemp,
(LVM_INT16)NumSamples);
-
break;
case LVREV_DELAYLINES_2:
@@ -779,7 +441,6 @@
pPrivate->pScratchDelayLine[0],
(LVM_INT16)NumSamples);
-
JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
pScratch,
pTemp,
@@ -794,7 +455,6 @@
break;
}
-
/*
* Dry/wet mixer
*/
@@ -820,6 +480,5 @@
return;
}
-#endif
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp
index dfed28e..2a75559 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp
@@ -48,7 +48,6 @@
LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
-
/*
* Check for error conditions
*/
@@ -67,10 +66,8 @@
(pNewParams->SampleRate != LVM_FS_32000) &&
(pNewParams->SampleRate != LVM_FS_44100) &&
(pNewParams->SampleRate != LVM_FS_48000)
-#ifdef HIGHER_FS
&& (pNewParams->SampleRate != LVM_FS_88200) && (pNewParams->SampleRate != LVM_FS_96000)
&& (pNewParams->SampleRate != LVM_FS_176400) && (pNewParams->SampleRate != LVM_FS_192000)
-#endif
)
#ifdef SUPPORT_MC
|| ((pNewParams->SourceFormat != LVM_STEREO) &&
@@ -84,7 +81,6 @@
return (LVREV_OUTOFRANGE);
}
-
if (pNewParams->Level > LVREV_MAX_LEVEL)
{
return LVREV_OUTOFRANGE;
@@ -120,8 +116,6 @@
return LVREV_OUTOFRANGE;
}
-
-
/*
* Copy the new parameters and set the flag to indicate they are available
*/
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
index 1ea10a2..5cd623e 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
@@ -30,19 +30,6 @@
/****************************************************************************************/
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
-#ifndef HIGHER_FS
-const LVM_UINT16 LVM_FsTable[] = {
- 8000 ,
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000
-};
-#else
const LVM_UINT32 LVM_FsTable[] = {
8000 ,
11025,
@@ -58,23 +45,13 @@
176400,
192000
};
-#endif
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
-#ifndef HIGHER_FS
-LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
- if (FsIndex > LVM_FS_48000)
- return 0;
-
- return (LVM_FsTable[FsIndex]);
-}
-#else
LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
if (FsIndex > LVM_FS_192000)
return 0;
return (LVM_FsTable[FsIndex]);
}
-#endif
/* In order to maintain consistant input and out put signal strengths
output gain/attenuation is applied. This gain depends on T60 and Rooms
@@ -96,33 +73,6 @@
*/
/* Normalizing output including Reverb Level part (only shift up)*/
-#ifndef BUILD_FLOAT
-const LVM_INT32 LVREV_GainPolyTable[24][5]={{1,17547434,128867434,-120988896,50761228,},
- {2,18256869,172666902,-193169292,88345744,},
- {3,16591311,139250151,-149667234,66770059,},
- {4,17379977,170835131,-173579321,76278163,},
- {5,18963512,210364934,-228623519,103435022,},
- {6,17796318,135756417,-144084053,64327698,},
- {7,17454695,174593214,-187513064,85146582,},
- {8,17229257,140715570,-145790588,65361740,},
- {9,17000547,163195946,-176733969,79562130,},
- {10,16711699,142476304,-133339887,58366547,},
- {13,18108419,149223697,-161762020,74397589,},
- {15,16682043,124844884,-134284487,60082180,},
- {17,16627346,120936430,-121766674,53146421,},
- {20,17338325,125432694,-126616983,56534237,},
- {25,16489146,99218217,-94597467,40616506,},
- {30,15582373,84479043,-75365006,30952348,},
- {40,16000669,84896611,-75031127,30696306,},
- {50,15087054,71695031,-59349268,23279669,},
- {60,15830714,68672971,-58211201,23671158,},
- {70,15536061,66657972,-55901437,22560153,},
- {75,15013145,48179917,-24138354,5232074,},
- {80,15688738,50195036,-34206760,11515792,},
- {90,16003322,48323661,-35607378,13153872,},
- {100,15955223,48558201,-33706865,11715792,},
- };
-#else
const LVM_FLOAT LVREV_GainPolyTable[24][5]={{1,1.045909f,7.681098f,-7.211500f,3.025605f,},
{2,1.088194f,10.291749f,-11.513787f,5.265817f,},
{3,0.988919f,8.299956f,-8.920862f,3.979806f,},
@@ -148,6 +98,5 @@
{90,0.953872f,2.880315f,-2.122365f,0.784032f,},
{100,0.951005f,2.894294f,-2.009086f,0.698316f,},
};
-#endif
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
index 06b534c..e100d8a 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
@@ -15,12 +15,9 @@
* limitations under the License.
*/
-
#ifndef _LVREV_TABLES_H_
#define _LVREV_TABLES_H_
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -34,19 +31,10 @@
/* */
/****************************************************************************************/
-#ifndef HIGHER_FS
-extern const LVM_UINT16 LVM_FsTable[];
-extern LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
-#else
extern const LVM_UINT32 LVM_FsTable[];
extern LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
-#endif
-#ifndef BUILD_FLOAT
-extern LVM_INT32 LVREV_GainPolyTable[24][5];
-#else
extern const LVM_FLOAT LVREV_GainPolyTable[24][5];
-#endif
#endif /** _LVREV_TABLES_H_ **/
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
index 1377655..c9fa7ad 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
@@ -18,11 +18,8 @@
#ifndef _LVPSA_H_
#define _LVPSA_H_
-
#include "LVM_Types.h"
-
-
/****************************************************************************************/
/* */
/* CONSTANTS DEFINITIONS */
@@ -113,8 +110,6 @@
LVPSA_RETURN_DUMMY = LVM_MAXINT_32 /* Force 32 bits enum, don't use it! */
} LVPSA_RETURN;
-
-
/*********************************************************************************************************************************
FUNCTIONS PROTOTYPE
**********************************************************************************************************************************/
@@ -213,17 +208,10 @@
/* otherwise Error due to bad parameters */
/* */
/*********************************************************************************************************************************/
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
LVM_FLOAT *pLVPSA_InputSamples,
LVM_UINT16 InputBlockSize,
LVPSA_Time AudioTime );
-#else
-LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
- LVM_INT16 *pLVPSA_InputSamples,
- LVM_UINT16 InputBlockSize,
- LVPSA_Time AudioTime );
-#endif
/*********************************************************************************************************************************/
/* */
/* FUNCTION: LVPSA_GetSpectrum */
@@ -285,6 +273,4 @@
LVPSA_RETURN LVPSA_GetInitParams ( pLVPSA_Handle_t hInstance,
LVPSA_InitParams_t *pParams );
-
-
#endif /* _LVPSA_H */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp
index f6c4ea7..deafaa7 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp
@@ -28,7 +28,6 @@
LVPSA_RETURN LVPSA_SetQPFCoefficients( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams );
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_FLOAT_Coefs_t *pCoefficients);
@@ -36,27 +35,11 @@
LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_FLOAT_Coefs_t *pCoefficients);
-#else
-LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C16_Coefs_t *pCoefficients);
-
-LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C32_Coefs_t *pCoefficients);
-
-LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C32_Coefs_t *pCoefficients);
-#endif
LVPSA_RETURN LVPSA_SetBPFCoefficients( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams );
LVPSA_RETURN LVPSA_ClearFilterHistory( LVPSA_InstancePr_t *pInst);
-
-
-
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_Control */
@@ -129,7 +112,6 @@
return(LVPSA_OK);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_GetInitParams */
@@ -163,7 +145,6 @@
return(LVPSA_OK);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_ApplyNewSettings */
@@ -188,14 +169,9 @@
LVM_UINT16 Freq;
LVPSA_ControlParams_t Params;
extern LVM_INT16 LVPSA_nSamplesBufferUpdate[];
-#ifndef HIGHER_FS
- extern LVM_UINT16 LVPSA_SampleRateTab[];
-#else
extern LVM_UINT32 LVPSA_SampleRateTab[];
-#endif
extern LVM_UINT16 LVPSA_DownSamplingFactor[];
-
if(pInst == 0)
{
return(LVPSA_ERROR_NULLADDRESS);
@@ -280,11 +256,7 @@
LVPSA_RETURN LVPSA_SetBPFiltersType ( LVPSA_InstancePr_t *pInst,
LVPSA_ControlParams_t *pParams )
{
-#ifndef HIGHER_FS
- extern LVM_UINT16 LVPSA_SampleRateTab[]; /* Sample rate table */
-#else
extern LVM_UINT32 LVPSA_SampleRateTab[]; /* Sample rate table */
-#endif
LVM_UINT16 ii; /* Filter band index */
LVM_UINT32 fs = (LVM_UINT32)LVPSA_SampleRateTab[(LVM_UINT16)pParams->Fs]; /* Sample rate */
LVM_UINT32 fc; /* Filter centre frequency */
@@ -298,7 +270,6 @@
fc = (LVM_UINT32)pInst->pFiltersParams[ii].CenterFrequency; /* Get the band centre frequency */
QFactor =(LVM_INT16) pInst->pFiltersParams[ii].QFactor; /* Get the band Q factor */
-
/*
* For each filter set the type of biquad required
*/
@@ -358,22 +329,6 @@
{
case LVPSA_DoublePrecisionFilter:
{
-#ifndef BUILD_FLOAT
- BP_C32_Coefs_t Coefficients;
-
- /*
- * Calculate the double precision coefficients
- */
- LVPSA_BPDoublePrecCoefs((LVM_UINT16)pParams->Fs,
- &pInst->pFiltersParams[ii],
- &Coefficients);
- /*
- * Set the coefficients
- */
- BP_1I_D16F32Cll_TRC_WRA_01_Init ( &pInst->pBP_Instances[ii],
- &pInst->pBP_Taps[ii],
- &Coefficients);
-#else
BP_FLOAT_Coefs_t Coefficients;
/*
* Calculate the double precision coefficients
@@ -387,29 +342,11 @@
BP_1I_D16F32Cll_TRC_WRA_01_Init ( &pInst->pBP_Instances[ii],
&pInst->pBP_Taps[ii],
&Coefficients);
-#endif
break;
}
case LVPSA_SimplePrecisionFilter:
{
-#ifndef BUILD_FLOAT
- BP_C16_Coefs_t Coefficients;
-
- /*
- * Calculate the single precision coefficients
- */
- LVPSA_BPSinglePrecCoefs((LVM_UINT16)pParams->Fs,
- &pInst->pFiltersParams[ii],
- &Coefficients);
-
- /*
- * Set the coefficients
- */
- BP_1I_D16F16Css_TRC_WRA_01_Init (&pInst->pBP_Instances[ii],
- &pInst->pBP_Taps[ii],
- &Coefficients);
-#else
BP_FLOAT_Coefs_t Coefficients;
/*
@@ -425,7 +362,6 @@
BP_1I_D16F16Css_TRC_WRA_01_Init (&pInst->pBP_Instances[ii],
&pInst->pBP_Taps[ii],
&Coefficients);
-#endif
break;
}
}
@@ -434,7 +370,6 @@
return(LVPSA_OK);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_SetQPFCoefficients */
@@ -458,31 +393,17 @@
{
LVM_UINT16 ii;
LVM_Fs_en Fs = pParams->Fs;
-#ifndef BUILD_FLOAT
- QPD_C32_Coefs *pCoefficients;
- extern QPD_C32_Coefs LVPSA_QPD_Coefs[];
-
- pCoefficients = &LVPSA_QPD_Coefs[(pParams->LevelDetectionSpeed * LVPSA_NR_SUPPORTED_RATE) + Fs];
-#else
QPD_FLOAT_Coefs *pCoefficients;
extern QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[];
pCoefficients = &LVPSA_QPD_Float_Coefs[(pParams->LevelDetectionSpeed * \
LVPSA_NR_SUPPORTED_RATE) + Fs];
-#endif
-
for (ii = 0; ii < pInst->nRelevantFilters; ii++)
{
-#ifndef BUILD_FLOAT
- LVPSA_QPD_Init (&pInst->pQPD_States[ii],
- &pInst->pQPD_Taps[ii],
- pCoefficients );
-#else
LVPSA_QPD_Init_Float (&pInst->pQPD_States[ii],
&pInst->pQPD_Taps[ii],
pCoefficients );
-#endif
}
return(LVPSA_OK);
@@ -522,7 +443,6 @@
/* of the n bands equalizer (LVEQNB */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_FLOAT_Coefs_t *pCoefficients)
@@ -531,7 +451,6 @@
extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
extern LVM_FLOAT LVPSA_Float_CosCoef[];
-
/*
* Intermediate variables and temporary values
*/
@@ -549,7 +468,6 @@
LVM_FLOAT t0;
LVM_INT16 i;
-
/*
* Get the filter definition
*/
@@ -589,7 +507,6 @@
}
COS_T0 = COS_T0 * 8; /*LVPSA_CosCoef_float[0]*/ /* Correct the scaling */
-
B1 = ((LVM_FLOAT)0.5 - B2) * (COS_T0); /* B1 = (0.5 - b2) * cos(t0) */
A0 = ((LVM_FLOAT)0.5 + B2) / 2; /* A0 = (0.5 + b2) / 2 */
@@ -602,89 +519,6 @@
return(LVPSA_OK);
}
-#else
-LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C16_Coefs_t *pCoefficients)
-{
-
- extern LVM_INT16 LVPSA_TwoPiOnFsTable[];
- extern LVM_INT16 LVPSA_CosCoef[];
-
-
- /*
- * Intermediate variables and temporary values
- */
- LVM_INT32 T0;
- LVM_INT16 D;
- LVM_INT32 A0;
- LVM_INT32 B1;
- LVM_INT32 B2;
- LVM_INT32 Dt0;
- LVM_INT32 B2_Den;
- LVM_INT32 B2_Num;
- LVM_INT32 COS_T0;
- LVM_INT16 coef;
- LVM_INT32 factor;
- LVM_INT16 t0;
- LVM_INT16 i;
-
-
- /*
- * Get the filter definition
- */
- LVM_UINT16 Frequency = pFilterParams->CenterFrequency;
- LVM_UINT16 QFactor = pFilterParams->QFactor;
-
-
- /*
- * Calculating the intermediate values
- */
- T0 = (LVM_INT32)Frequency * LVPSA_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
- D = 3200; /* Floating point value 1.000000 (1*100*2^5) */
- /* Force D = 1 : the function was originally used for a peaking filter.
- The D parameter do not exist for a BandPass filter coefficients */
-
- /*
- * Calculate the B2 coefficient
- */
- Dt0 = D * (T0 >> 10);
- B2_Den = (LVM_INT32)(((LVM_UINT32)QFactor << 19) + (LVM_UINT32)(Dt0 >> 2));
- B2_Num = (LVM_INT32)((LVM_UINT32)(Dt0 >> 3) - ((LVM_UINT32)QFactor << 18));
- B2 = (B2_Num / (B2_Den >> 16)) << 15;
-
- /*
- * Calculate the cosine by a polynomial expansion using the equation:
- *
- * Cos += coef(n) * t0^n For n = 0 to 6
- */
- T0 = (T0 >> 10) * 20859; /* Scale to 1.0 in 16-bit for range 0 to fs/2 */
- t0 = (LVM_INT16)(T0 >> 16);
- factor = 0x7fff; /* Initialise to 1.0 for the a0 coefficient */
- COS_T0 = 0; /* Initialise the error to zero */
- for (i=1; i<7; i++)
- {
- coef = LVPSA_CosCoef[i]; /* Get the nth coefficient */
- COS_T0 += (factor * coef) >> 5; /* The nth partial sum */
- factor = (factor * t0) >> 15; /* Calculate t0^n */
- }
- COS_T0 = COS_T0 << (LVPSA_CosCoef[0]+6); /* Correct the scaling */
-
-
- B1 = ((0x40000000 - B2) >> 16) * (COS_T0 >> 16); /* B1 = (0.5 - b2) * cos(t0) */
- A0 = (0x40000000 + B2) >> 1; /* A0 = (0.5 + b2) / 2 */
-
- /*
- * Write coeff into the data structure
- */
- pCoefficients->A0 = (LVM_INT16)(A0>>16);
- pCoefficients->B1 = (LVM_INT16)(B1>>15);
- pCoefficients->B2 = (LVM_INT16)(B2>>16);
-
-
- return(LVPSA_OK);
-}
-#endif
/****************************************************************************************/
/* */
/* FUNCTION: LVPSA_BPDoublePrecCoefs */
@@ -727,7 +561,6 @@
/* of the n bands equalizer (LVEQNB */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
LVPSA_FilterParam_t *pFilterParams,
BP_FLOAT_Coefs_t *pCoefficients)
@@ -759,7 +592,6 @@
LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
-
/*
* Calculating the intermediate values
*/
@@ -810,90 +642,6 @@
return(LVPSA_OK);
}
-#else
-LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_C32_Coefs_t *pCoefficients)
-{
-
- extern LVM_INT16 LVPSA_TwoPiOnFsTable[];
- extern LVM_INT16 LVPSA_DPCosCoef[];
-
- /*
- * Intermediate variables and temporary values
- */
- LVM_INT32 T0;
- LVM_INT16 D;
- LVM_INT32 A0;
- LVM_INT32 B1;
- LVM_INT32 B2;
- LVM_INT32 Dt0;
- LVM_INT32 B2_Den;
- LVM_INT32 B2_Num;
- LVM_INT32 CosErr;
- LVM_INT16 coef;
- LVM_INT32 factor;
- LVM_INT16 t0;
- LVM_INT16 i;
-
- /*
- * Get the filter definition
- */
- LVM_UINT16 Frequency = pFilterParams->CenterFrequency;
- LVM_UINT16 QFactor = pFilterParams->QFactor;
-
-
- /*
- * Calculating the intermediate values
- */
- T0 = (LVM_INT32)Frequency * LVPSA_TwoPiOnFsTable[Fs]; /* T0 = 2 * Pi * Fc / Fs */
- D = 3200; /* Floating point value 1.000000 (1*100*2^5) */
- /* Force D = 1 : the function was originally used for a peaking filter.
- The D parameter do not exist for a BandPass filter coefficients */
-
- /*
- * Calculate the B2 coefficient
- */
- Dt0 = D * (T0 >> 10);
- B2_Den = (LVM_INT32)(((LVM_UINT32)QFactor << 19) + (LVM_UINT32)(Dt0 >> 2));
- B2_Num = (LVM_INT32)((LVM_UINT32)(Dt0 >> 3) - ((LVM_UINT32)QFactor << 18));
- B2 = (B2_Num / (B2_Den >> 16)) << 15;
-
- /*
- * Calculate the cosine error by a polynomial expansion using the equation:
- *
- * CosErr += coef(n) * t0^n For n = 0 to 4
- */
- T0 = (T0 >> 6) * 0x7f53; /* Scale to 1.0 in 16-bit for range 0 to fs/50 */
- t0 = (LVM_INT16)(T0 >> 16);
- factor = 0x7fff; /* Initialise to 1.0 for the a0 coefficient */
- CosErr = 0; /* Initialise the error to zero */
- for (i=1; i<5; i++)
- {
- coef = LVPSA_DPCosCoef[i]; /* Get the nth coefficient */
- CosErr += (factor * coef) >> 5; /* The nth partial sum */
- factor = (factor * t0) >> 15; /* Calculate t0^n */
- }
- CosErr = CosErr << (LVPSA_DPCosCoef[0]); /* Correct the scaling */
-
- /*
- * Calculate the B1 and A0 coefficients
- */
- B1 = (0x40000000 - B2); /* B1 = (0.5 - b2) */
- A0 = ((B1 >> 16) * (CosErr >> 10)) >> 6; /* Temporary storage for (0.5 - b2) * coserr(t0) */
- B1 -= A0; /* B1 = (0.5 - b2) * (1 - coserr(t0)) */
- A0 = (0x40000000 + B2) >> 1; /* A0 = (0.5 + b2) / 2 */
-
- /*
- * Write coeff into the data structure
- */
- pCoefficients->A0 = A0;
- pCoefficients->B1 = B1;
- pCoefficients->B2 = B2;
-
- return(LVPSA_OK);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_ClearFilterHistory */
@@ -917,17 +665,10 @@
/* Band Pass filters taps */
pTapAddress = (LVM_INT8 *)pInst->pBP_Taps;
-#ifdef BUILD_FLOAT
for(i = 0; i < pInst->nBands * sizeof(Biquad_1I_Order2_FLOAT_Taps_t); i++)
{
pTapAddress[i] = 0;
}
-#else
- for(i = 0; i < pInst->nBands * sizeof(Biquad_1I_Order2_Taps_t); i++)
- {
- pTapAddress[i] = 0;
- }
-#endif
/* Quasi-peak filters taps */
pTapAddress = (LVM_INT8 *)pInst->pQPD_Taps;
for(i = 0; i < pInst->nBands * sizeof(QPD_Taps_t); i++)
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
index ff4b275..9fcd82f 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
@@ -47,11 +47,7 @@
LVPSA_InstancePr_t *pLVPSA_Inst;
LVPSA_RETURN errorCode = LVPSA_OK;
LVM_UINT32 ii;
-#ifndef BUILD_FLOAT
- extern LVM_INT16 LVPSA_GainTable[];
-#else
extern LVM_FLOAT LVPSA_Float_GainTable[];
-#endif
LVM_UINT32 BufferLength = 0;
/* Ints_Alloc instances, needed for memory alignment management */
@@ -87,14 +83,12 @@
}
}
-
/*Inst_Alloc instances initialization */
InstAlloc_Init( &Instance , pMemoryTable->Region[LVPSA_MEMREGION_INSTANCE].pBaseAddress);
InstAlloc_Init( &Scratch , pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].pBaseAddress);
InstAlloc_Init( &Data , pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].pBaseAddress);
InstAlloc_Init( &Coef , pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].pBaseAddress);
-
/* Set the instance handle if not already initialised */
if (*phInstance == LVM_NULL)
{
@@ -102,7 +96,6 @@
}
pLVPSA_Inst =(LVPSA_InstancePr_t*)*phInstance;
-
/* Check the memory table for NULL pointers */
for (ii = 0; ii < LVPSA_NR_MEMORY_REGIONS; ii++)
{
@@ -143,14 +136,9 @@
pLVPSA_Inst->SpectralDataBufferLength = BufferLength;
}
-
/* Assign the pointers */
-#ifndef BUILD_FLOAT
- pLVPSA_Inst->pPostGains = InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_UINT16) );
-#else
pLVPSA_Inst->pPostGains =
(LVM_FLOAT *)InstAlloc_AddMember(&Instance, pInitParams->nBands * sizeof(LVM_FLOAT));
-#endif
pLVPSA_Inst->pFiltersParams = (LVPSA_FilterParam_t *)
InstAlloc_AddMember(&Instance, pInitParams->nBands * sizeof(LVPSA_FilterParam_t));
pLVPSA_Inst->pSpectralDataBufferStart = (LVM_UINT8 *)
@@ -161,30 +149,19 @@
pLVPSA_Inst->pBPFiltersPrecision = (LVPSA_BPFilterPrecision_en *)
InstAlloc_AddMember(&Instance, pInitParams->nBands * \
sizeof(LVPSA_BPFilterPrecision_en));
-#ifndef BUILD_FLOAT
- pLVPSA_Inst->pBP_Instances = InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_Instance_t) );
- pLVPSA_Inst->pQPD_States = InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_State_t) );
-#else
pLVPSA_Inst->pBP_Instances = (Biquad_FLOAT_Instance_t *)
InstAlloc_AddMember(&Coef, pInitParams->nBands * \
sizeof(Biquad_FLOAT_Instance_t));
pLVPSA_Inst->pQPD_States = (QPD_FLOAT_State_t *)
InstAlloc_AddMember(&Coef, pInitParams->nBands * \
sizeof(QPD_FLOAT_State_t));
-#endif
-#ifndef BUILD_FLOAT
- pLVPSA_Inst->pBP_Taps = InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_Taps_t) );
- pLVPSA_Inst->pQPD_Taps = InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_Taps_t) );
-
-#else
pLVPSA_Inst->pBP_Taps = (Biquad_1I_Order2_FLOAT_Taps_t *)
InstAlloc_AddMember(&Data, pInitParams->nBands * \
sizeof(Biquad_1I_Order2_FLOAT_Taps_t));
pLVPSA_Inst->pQPD_Taps = (QPD_FLOAT_Taps_t *)
InstAlloc_AddMember(&Data, pInitParams->nBands * \
sizeof(QPD_FLOAT_Taps_t));
-#endif
/* Copy filters parameters in the private instance */
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
@@ -195,16 +172,11 @@
/* Set Post filters gains*/
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
{
-#ifndef BUILD_FLOAT
- pLVPSA_Inst->pPostGains[ii] =(LVM_UINT16) LVPSA_GainTable[pInitParams->pFiltersParams[ii].PostGain + 15];
-#else
pLVPSA_Inst->pPostGains[ii] = LVPSA_Float_GainTable[15 + \
pInitParams->pFiltersParams[ii].PostGain];
-#endif
}
pLVPSA_Inst->pSpectralDataBufferWritePointer = pLVPSA_Inst->pSpectralDataBufferStart;
-
/* Initialize control dependant internal parameters */
errorCode = LVPSA_Control (*phInstance, pControlParams);
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.cpp
index 06a8f9d..eafcbe6 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Memory.cpp
@@ -59,19 +59,16 @@
INST_ALLOC Coef;
LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
-
InstAlloc_Init( &Instance , LVM_NULL);
InstAlloc_Init( &Scratch , LVM_NULL);
InstAlloc_Init( &Data , LVM_NULL);
InstAlloc_Init( &Coef , LVM_NULL);
-
if((pMemoryTable == LVM_NULL) || (pInitParams == LVM_NULL))
{
return(LVPSA_ERROR_NULLADDRESS);
}
-
/*
* Fill in the memory table
*/
@@ -106,11 +103,7 @@
*/
InstAlloc_AddMember( &Instance, sizeof(LVPSA_InstancePr_t) );
-#ifdef BUILD_FLOAT
InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_FLOAT) );
-#else
- InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVM_UINT16) );
-#endif
InstAlloc_AddMember( &Instance, pInitParams->nBands * sizeof(LVPSA_FilterParam_t) );
{
@@ -123,7 +116,6 @@
BufferLength=(LVM_UINT32)BL;
}
-
if((BufferLength * LVPSA_InternalRefreshTime) != pInitParams->SpectralDataBufferDuration)
{
BufferLength++;
@@ -138,11 +130,7 @@
/*
* Scratch memory
*/
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember( &Scratch, 2 * pInitParams->MaxInputBlockSize * sizeof(LVM_INT16) );
-#else
InstAlloc_AddMember( &Scratch, 2 * pInitParams->MaxInputBlockSize * sizeof(LVM_FLOAT) );
-#endif
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].Size = InstAlloc_GetTotal(&Scratch);
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].Type = LVPSA_SCRATCH;
pMemoryTable->Region[LVPSA_MEMREGION_SCRATCH].pBaseAddress = LVM_NULL;
@@ -150,13 +138,8 @@
/*
* Persistent coefficients memory
*/
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_Instance_t) );
- InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_State_t) );
-#else
InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(Biquad_FLOAT_Instance_t) );
InstAlloc_AddMember( &Coef, pInitParams->nBands * sizeof(QPD_FLOAT_State_t) );
-#endif
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].Size = InstAlloc_GetTotal(&Coef);
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].Type = LVPSA_PERSISTENT_COEF;
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL;
@@ -164,13 +147,8 @@
/*
* Persistent data memory
*/
-#ifndef BUILD_FLOAT
- InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_Taps_t) );
- InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_Taps_t) );
-#else
InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(Biquad_1I_Order2_FLOAT_Taps_t) );
InstAlloc_AddMember( &Data, pInitParams->nBands * sizeof(QPD_FLOAT_Taps_t) );
-#endif
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].Size = InstAlloc_GetTotal(&Data);
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].Type = LVPSA_PERSISTENT_DATA;
pMemoryTable->Region[LVPSA_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL;
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
index bce23c9..61987b5 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
@@ -23,9 +23,6 @@
#include "LVPSA_QPD.h"
#include "LVM_Macros.h"
-
-
-
/**********************************************************************************
CONSTANT DEFINITIONS
***********************************************************************************/
@@ -40,11 +37,7 @@
#define LVPSA_MEMREGION_PERSISTENT_COEF 1 /* Offset to persistent coefficients memory region in memory table */
#define LVPSA_MEMREGION_PERSISTENT_DATA 2 /* Offset to persistent taps memory region in memory table */
#define LVPSA_MEMREGION_SCRATCH 3 /* Offset to scratch memory region in memory table */
-#ifndef HIGHER_FS
-#define LVPSA_NR_SUPPORTED_RATE 9 /* From 8000Hz to 48000Hz*/
-#else
#define LVPSA_NR_SUPPORTED_RATE 13 /* From 8000Hz to 192000Hz*/
-#endif
#define LVPSA_NR_SUPPORTED_SPEED 3 /* LOW, MEDIUM, HIGH */
#define LVPSA_MAXBUFFERDURATION 4000 /* Maximum length in ms of the levels buffer */
@@ -74,7 +67,6 @@
#define LVPSA_InternalRefreshTimeInv 0x0666 /* 1/20ms left shifted by 15 */
#define LVPSA_InternalRefreshTimeShift 15
-
/* Precision of the filter */
typedef enum
{
@@ -93,12 +85,6 @@
LVPSA_MemTab_t MemoryTable;
LVPSA_BPFilterPrecision_en *pBPFiltersPrecision; /* Points a nBands elements array that contains the filter precision for each band */
-#ifndef BUILD_FLOAT
- Biquad_Instance_t *pBP_Instances; /* Points a nBands elements array that contains the band pass filter instance for each band */
- Biquad_1I_Order2_Taps_t *pBP_Taps; /* Points a nBands elements array that contains the band pass filter taps for each band */
- QPD_State_t *pQPD_States; /* Points a nBands elements array that contains the QPD filter instance for each band */
- QPD_Taps_t *pQPD_Taps; /* Points a nBands elements array that contains the QPD filter taps for each band */
-#else
Biquad_FLOAT_Instance_t *pBP_Instances;
/* Points a nBands elements array that contains the band pass filter taps for each band */
Biquad_1I_Order2_FLOAT_Taps_t *pBP_Taps;
@@ -106,17 +92,11 @@
QPD_FLOAT_State_t *pQPD_States;
/* Points a nBands elements array that contains the QPD filter taps for each band */
QPD_FLOAT_Taps_t *pQPD_Taps;
-#endif
-#ifndef BUILD_FLOAT
- LVM_UINT16 *pPostGains; /* Points a nBands elements array that contains the post-filter gains for each band */
-#else
/* Points a nBands elements array that contains the post-filter gains for each band */
LVM_FLOAT *pPostGains;
-#endif
LVPSA_FilterParam_t *pFiltersParams; /* Copy of the filters parameters from the input parameters */
-
LVM_UINT16 nSamplesBufferUpdate; /* Number of samples to make 20ms */
LVM_INT32 BufferUpdateSamplesCount; /* Counter used to know when to put a new value in the buffer */
LVM_UINT16 nRelevantFilters; /* Number of relevent filters depending on sampling frequency and bands center frequency */
@@ -137,8 +117,6 @@
}LVPSA_InstancePr_t, *pLVPSA_InstancePr_t;
-
-
/**********************************************************************************
FUNCTIONS PROTOTYPE
***********************************************************************************/
@@ -159,5 +137,4 @@
/************************************************************************************/
LVPSA_RETURN LVPSA_ApplyNewSettings (LVPSA_InstancePr_t *pInst);
-
#endif /* _LVPSA_PRIVATE_H */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp
index 61899fe..81a88c5 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp
@@ -54,7 +54,6 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
LVM_FLOAT *pLVPSA_InputSamples,
LVM_UINT16 InputBlockSize,
@@ -121,7 +120,6 @@
break;
}
-
LVPSA_QPD_Process_Float ( pLVPSA_Inst,
pScratch + InputBlockSize,
(LVM_INT16)InputBlockSize,
@@ -143,95 +141,6 @@
return(LVPSA_OK);
}
-#else
-LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
- LVM_INT16 *pLVPSA_InputSamples,
- LVM_UINT16 InputBlockSize,
- LVPSA_Time AudioTime )
-
-{
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- LVM_INT16 *pScratch;
- LVM_INT16 ii;
- LVM_INT32 AudioTimeInc;
- extern LVM_UINT32 LVPSA_SampleRateInvTab[];
- LVM_UINT8 *pWrite_Save; /* Position of the write pointer at the beginning of the process */
-
- /******************************************************************************
- CHECK PARAMETERS
- *******************************************************************************/
- if(hInstance == LVM_NULL || pLVPSA_InputSamples == LVM_NULL)
- {
- return(LVPSA_ERROR_NULLADDRESS);
- }
- if(InputBlockSize == 0 || InputBlockSize > pLVPSA_Inst->MaxInputBlockSize)
- {
- return(LVPSA_ERROR_INVALIDPARAM);
- }
-
- pScratch = (LVM_INT16*)pLVPSA_Inst->MemoryTable.Region[LVPSA_MEMREGION_SCRATCH].pBaseAddress;
- pWrite_Save = pLVPSA_Inst->pSpectralDataBufferWritePointer;
-
- /******************************************************************************
- APPLY NEW SETTINGS IF NEEDED
- *******************************************************************************/
- if (pLVPSA_Inst->bControlPending == LVM_TRUE)
- {
- pLVPSA_Inst->bControlPending = 0;
- LVPSA_ApplyNewSettings( pLVPSA_Inst);
- }
-
- /******************************************************************************
- PROCESS SAMPLES
- *******************************************************************************/
- /* Put samples in range [-0.5;0.5[ for BP filters (see Biquads documentation) */
- Copy_16( pLVPSA_InputSamples,pScratch,(LVM_INT16)InputBlockSize);
- Shift_Sat_v16xv16(-1,pScratch,pScratch,(LVM_INT16)InputBlockSize);
-
- for (ii = 0; ii < pLVPSA_Inst->nRelevantFilters; ii++)
- {
- switch(pLVPSA_Inst->pBPFiltersPrecision[ii])
- {
- case LVPSA_SimplePrecisionFilter:
- BP_1I_D16F16C14_TRC_WRA_01 ( &pLVPSA_Inst->pBP_Instances[ii],
- pScratch,
- pScratch + InputBlockSize,
- (LVM_INT16)InputBlockSize);
- break;
-
- case LVPSA_DoublePrecisionFilter:
- BP_1I_D16F32C30_TRC_WRA_01 ( &pLVPSA_Inst->pBP_Instances[ii],
- pScratch,
- pScratch + InputBlockSize,
- (LVM_INT16)InputBlockSize);
- break;
- default:
- break;
- }
-
-
- LVPSA_QPD_Process ( pLVPSA_Inst,
- pScratch + InputBlockSize,
- (LVM_INT16)InputBlockSize,
- ii);
- }
-
- /******************************************************************************
- UPDATE SpectralDataBufferAudioTime
- *******************************************************************************/
-
- if(pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite_Save)
- {
- MUL32x32INTO32((AudioTime + (LVM_INT32)((LVM_INT32)pLVPSA_Inst->LocalSamplesCount*1000)),
- (LVM_INT32)LVPSA_SampleRateInvTab[pLVPSA_Inst->CurrentParams.Fs],
- AudioTimeInc,
- LVPSA_FsInvertShift)
- pLVPSA_Inst->SpectralDataBufferAudioTime = AudioTime + AudioTimeInc;
- }
-
- return(LVPSA_OK);
-}
-#endif
/************************************************************************************/
/* */
@@ -269,7 +178,6 @@
return(LVPSA_ERROR_NULLADDRESS);
}
-
/* First find the place where to look in the status buffer */
if(GetSpectrumAudioTime <= pLVPSA_Inst->SpectralDataBufferAudioTime)
{
@@ -320,7 +228,6 @@
pRead = pLVPSA_Inst->pSpectralDataBufferWritePointer - StatusDelta * pLVPSA_Inst->nBands;
}
-
/* Read the status buffer and fill the output buffers */
for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
{
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
index 552703b..609a485 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
@@ -20,22 +20,18 @@
#include "LVM_Types.h"
-
-
typedef struct
{
LVM_INT32 *pDelay; /* pointer to the delayed samples (data of 32 bits) */
LVM_INT32 Coefs[2]; /* pointer to the filter coefficients */
}QPD_State_t, *pQPD_State_t;
-#ifdef BUILD_FLOAT
typedef struct
{
/* pointer to the delayed samples (data of 32 bits) */
LVM_FLOAT *pDelay;
LVM_FLOAT Coefs[2]; /* pointer to the filter coefficients */
}QPD_FLOAT_State_t, *pQPD_FLOAT_State_t;
-#endif
typedef struct
{
@@ -44,15 +40,12 @@
} QPD_C32_Coefs, *PQPD_C32_Coefs;
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT KP; /*should store a0*/
LVM_FLOAT KM; /*should store b2*/
} QPD_FLOAT_Coefs, *PQPD_FLOAT_Coefs;
-#endif
-
typedef struct
{
@@ -60,14 +53,12 @@
} QPD_Taps_t, *pQPD_Taps_t;
-#ifdef BUILD_FLOAT
typedef struct
{
LVM_FLOAT Storage[1];
} QPD_FLOAT_Taps_t, *pQPD_FLOAT_Taps_t;
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Process */
@@ -86,12 +77,10 @@
LVM_INT16 numSamples,
LVM_INT16 BandIndex);
-#ifdef BUILD_FLOAT
void LVPSA_QPD_Process_Float ( void *hInstance,
LVM_FLOAT *pInSamps,
LVM_INT16 numSamples,
LVM_INT16 BandIndex);
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Init */
@@ -110,12 +99,10 @@
void LVPSA_QPD_Init ( QPD_State_t *pInstance,
QPD_Taps_t *pTaps,
QPD_C32_Coefs *pCoef );
-#ifdef BUILD_FLOAT
void LVPSA_QPD_Init_Float ( QPD_FLOAT_State_t *pInstance,
QPD_FLOAT_Taps_t *pTaps,
QPD_FLOAT_Coefs *pCoef );
-#endif
#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp
index 2cc32ab..2dbf694 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp
@@ -41,7 +41,6 @@
pQPD_State->Coefs[1] = pCoef->KM;
}
-#ifdef BUILD_FLOAT
void LVPSA_QPD_Init_Float ( pQPD_FLOAT_State_t pQPD_State,
QPD_FLOAT_Taps_t *pTaps,
QPD_FLOAT_Coefs *pCoef )
@@ -50,4 +49,3 @@
pQPD_State->Coefs[0] = ((LVM_FLOAT)pCoef->KP);
pQPD_State->Coefs[1] = ((LVM_FLOAT)pCoef->KM);
}
-#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp
index e233172..8805420 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp
@@ -39,12 +39,10 @@
LVM_INT16 BandIndex,
LVM_INT16 Value );
-#ifdef BUILD_FLOAT
void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
LVM_UINT8 **ppWrite,
LVM_INT16 BandIndex,
LVM_FLOAT Value );
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Process */
@@ -58,127 +56,6 @@
/* RETURNS: void */
/* */
/************************************************************************************/
-#ifndef BUILD_FLOAT
-void LVPSA_QPD_Process ( void *hInstance,
- LVM_INT16 *pInSamps,
- LVM_INT16 numSamples,
- LVM_INT16 BandIndex)
-{
-
- /******************************************************************************
- PARAMETERS
- *******************************************************************************/
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- QPD_State_t *pQPDState = (QPD_State_t*)&pLVPSA_Inst->pQPD_States[BandIndex];
-
- /* Pointer to taps */
- LVM_INT32* pDelay = pQPDState->pDelay;
-
- /* Parameters needed during quasi peak calculations */
- LVM_INT32 X0;
- LVM_INT32 temp,temp2;
- LVM_INT32 accu;
- LVM_INT16 Xg0;
- LVM_INT16 D0;
- LVM_INT16 V0 = (LVM_INT16)(*pDelay);
-
- /* Filter's coef */
- LVM_INT32 Kp = pQPDState->Coefs[0];
- LVM_INT32 Km = pQPDState->Coefs[1];
-
- LVM_INT16 ii = numSamples;
-
- LVM_UINT8 *pWrite = pLVPSA_Inst->pSpectralDataBufferWritePointer;
- LVM_INT32 BufferUpdateSamplesCount = pLVPSA_Inst->BufferUpdateSamplesCount;
- LVM_UINT16 DownSamplingFactor = pLVPSA_Inst->DownSamplingFactor;
-
- /******************************************************************************
- INITIALIZATION
- *******************************************************************************/
- /* Correct the pointer to take the first down sampled signal sample */
- pInSamps += pLVPSA_Inst->DownSamplingCount;
- /* Correct also the number of samples */
- ii = (LVM_INT16)(ii - (LVM_INT16)pLVPSA_Inst->DownSamplingCount);
-
- while (ii > 0)
- {
- /* Apply post gain */
- X0 = ((*pInSamps) * pLVPSA_Inst->pPostGains[BandIndex]) >> (LVPSA_GAINSHIFT-1); /* - 1 to compensate scaling in process function*/
- pInSamps = pInSamps + DownSamplingFactor;
-
- /* Saturate and take absolute value */
- if(X0 < 0)
- X0 = -X0;
- if (X0 > 0x7FFF)
- Xg0 = 0x7FFF;
- else
- Xg0 = (LVM_INT16)(X0);
-
-
- /* Quasi peak filter calculation */
- D0 = (LVM_INT16)(Xg0 - V0);
-
- temp2 = (LVM_INT32)D0;
- MUL32x32INTO32(temp2,Kp,accu,31);
-
- D0 = (LVM_INT16)(D0>>1);
- if (D0 < 0){
- D0 = (LVM_INT16)(-D0);
- }
-
- temp2 = (LVM_INT32)D0;
- MUL32x32INTO32((LVM_INT32)D0,Km,temp,31);
- accu +=temp + Xg0;
-
- if (accu > 0x7FFF)
- accu = 0x7FFF;
- else if(accu < 0)
- accu = 0x0000;
-
- V0 = (LVM_INT16)accu;
-
- if(((pLVPSA_Inst->nSamplesBufferUpdate - BufferUpdateSamplesCount) < DownSamplingFactor))
- {
- LVPSA_QPD_WritePeak( pLVPSA_Inst,
- &pWrite,
- BandIndex,
- V0);
- BufferUpdateSamplesCount -= pLVPSA_Inst->nSamplesBufferUpdate;
- pLVPSA_Inst->LocalSamplesCount = (LVM_UINT16)(numSamples - ii);
- }
- BufferUpdateSamplesCount+=DownSamplingFactor;
-
- ii = (LVM_INT16)(ii-DownSamplingFactor);
-
- }
-
- /* Store last taps in memory */
- *pDelay = (LVM_INT32)(V0);
-
- /* If this is the last call to the function after last band processing,
- update the parameters. */
- if(BandIndex == (pLVPSA_Inst->nRelevantFilters-1))
- {
- pLVPSA_Inst->pSpectralDataBufferWritePointer = pWrite;
- /* Adjustment for 11025Hz input, 220,5 is normally
- the exact number of samples for 20ms.*/
- if((pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite)&&(pLVPSA_Inst->CurrentParams.Fs == LVM_FS_11025))
- {
- if(pLVPSA_Inst->nSamplesBufferUpdate == 220)
- {
- pLVPSA_Inst->nSamplesBufferUpdate = 221;
- }
- else
- {
- pLVPSA_Inst->nSamplesBufferUpdate = 220;
- }
- }
- pLVPSA_Inst->pSpectralDataBufferWritePointer = pWrite;
- pLVPSA_Inst->BufferUpdateSamplesCount = BufferUpdateSamplesCount;
- pLVPSA_Inst->DownSamplingCount = (LVM_UINT16)(-ii);
- }
-}
-#else
void LVPSA_QPD_Process_Float ( void *hInstance,
LVM_FLOAT *pInSamps,
LVM_INT16 numSamples,
@@ -235,7 +112,6 @@
else
Xg0 =X0;
-
/* Quasi peak filter calculation */
D0 = Xg0 - V0;
@@ -302,7 +178,6 @@
pLVPSA_Inst->DownSamplingCount = (LVM_UINT16)(-ii);
}
}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_WritePeak */
@@ -326,7 +201,6 @@
{
LVM_UINT8 *pWrite = *ppWrite;
-
/* Write the value and update the write pointer */
*(pWrite + BandIndex) = (LVM_UINT8)(Value>>7);
pWrite += pLVPSA_Inst->nBands;
@@ -338,7 +212,6 @@
*ppWrite = pWrite;
}
-#ifdef BUILD_FLOAT
void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
LVM_UINT8 **ppWrite,
LVM_INT16 BandIndex,
@@ -357,4 +230,3 @@
*ppWrite = pWrite;
}
-#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
index 045a502..9f0aa02 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -35,17 +34,6 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-#ifndef HIGHER_FS
-const LVM_UINT16 LVPSA_SampleRateTab[] = { 8000, /* 8kS/s */
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000}; /* 48kS/s */
-#else
const LVM_UINT32 LVPSA_SampleRateTab[] = { 8000, /* 8kS/s */
11025,
12000,
@@ -59,7 +47,6 @@
96000,
176400,
192000}; /* 192kS/s */
-#endif
/************************************************************************************/
/* */
@@ -80,16 +67,12 @@
67109,
48696,
44739
-#ifdef HIGHER_FS
,24348
,22369
,12174
,11185 /* 192kS/s */
-#endif
};
-
-
/************************************************************************************/
/* */
/* Number of samples in 20ms */
@@ -109,12 +92,10 @@
640,
882,
960
-#ifdef HIGHER_FS
,1764
,1920
,3528
,3840 /* 192kS/s */
-#endif
};
/************************************************************************************/
/* */
@@ -134,15 +115,12 @@
21, /* 32000 S/s */
30, /* 44100 S/s */
32 /* 48000 S/s */
-#ifdef HIGHER_FS
,60 /* 88200 S/s */
,64 /* 96000 S/s */
,120 /* 176400 S/s */
,128 /*192000 S/s */
-#endif
};
-
/************************************************************************************/
/* */
/* Coefficient calculation tables */
@@ -161,15 +139,12 @@
6588,
4781,
4392
-#ifdef HIGHER_FS
,2390
,2196
,1195
,1098 /* 192kS/s */
-#endif
};
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[] = { 0.8042847f, /* 8kS/s */
0.5836054f,
0.5361796f,
@@ -179,15 +154,12 @@
0.2010559f,
0.1459089f,
0.1340372f
-#ifdef HIGHER_FS
,0.0729476f
,0.0670186f
,0.0364738f
,0.0335093f /* 192kS/s */
-#endif
};
-#endif
/*
* Gain table
*/
@@ -223,7 +195,6 @@
10264,
11576}; /* +15dB gain */
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVPSA_Float_GainTable[]={ 0.177734375f, /* -15dB gain */
0.199218750f,
0.223632812f,
@@ -255,7 +226,6 @@
4.466796875f,
5.011718750f,
5.652343750f}; /* +15dB gain */
-#endif
/************************************************************************************/
/* */
/* Cosone polynomial coefficients */
@@ -278,7 +248,6 @@
-2671, /* a3 */
23730, /* a4 */
-9490}; /* a5 */
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVPSA_Float_CosCoef[] = { 3, /* Shifts */
0.1250038f, /* a0 */
-0.0010986f, /* a1 */
@@ -286,7 +255,6 @@
-0.0815149f, /* a3 */
0.7242042f, /* a4 */
-0.2896206f}; /* a5 */
-#endif
/*
* Coefficients for calculating the cosine error with the equation:
*
@@ -306,13 +274,11 @@
-6, /* a1 */
16586, /* a2 */
-44}; /* a3 */
-#ifdef BUILD_FLOAT
const LVM_FLOAT LVPSA_Float_DPCosCoef[] = {1.0f, /* Shifts */
0.0f, /* a0 */
-0.00008311f, /* a1 */
0.50617999f, /* a2 */
-0.00134281f}; /* a3 */
-#endif
/************************************************************************************/
/* */
/* Quasi peak filter coefficients table */
@@ -352,7 +318,6 @@
{(LVM_INT32)0xA375B2C6,0x1E943BBC},
{(LVM_INT32)0xA2E1E950,0x1E2A532E}}; /* 48kS/s */
-#ifdef BUILD_FLOAT
const QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[] = {
/* 8kS/s */ /* LVPSA_SPEED_LOW */
@@ -366,12 +331,10 @@
{-0.9931269618682563f,0.0067592649720609f},
/* 48kS/s */
{-0.9932638457976282f,0.0066249934025109f},
-#ifdef HIGHER_FS
{-0.9931269618682563f,0.0067592649720609f},
{-0.9932638457976282f,0.0066249934025109f},
{-0.9931269618682563f,0.0067592649720609f},
{-0.9932638457976282f,0.0066249934025109f},
-#endif
/* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
{-0.9568079425953329f,0.0418742666952312f},
{-0.9561413046903908f,0.0425090822391212f},
@@ -384,12 +347,10 @@
{-0.9531011912040412f,0.0453995238058269f},
/* 48kS/s */
{-0.9540119562298059f,0.0445343819446862f},
-#ifdef HIGHER_FS
{-0.9531011912040412f,0.0453995238058269f},
{-0.9540119562298059f,0.0445343819446862f},
{-0.9531011912040412f,0.0453995238058269f},
{-0.9540119562298059f,0.0445343819446862f},
-#endif
/* 8kS/s */ /* LVPSA_SPEED_HIGH */
{-0.7415186790749431f,0.2254409026354551f},
{-0.7381451204419136f,0.2279209652915597f},
@@ -401,11 +362,8 @@
{-0.7229706319049001f,0.2388987224549055f},
/* 48kS/s */
{-0.7274807319045067f,0.2356666540727019f}
-#ifdef HIGHER_FS
,{-0.7229706319049001f,0.2388987224549055f}
,{-0.7274807319045067f,0.2356666540727019f}
,{-0.7229706319049001f,0.2388987224549055f}
,{-0.7274807319045067f,0.2356666540727019f}
-#endif
};
-#endif
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h
index caaf3ba..65872fe 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h
@@ -27,11 +27,7 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-#ifndef HIGHER_FS
-extern const LVM_UINT16 LVPSA_SampleRateTab[];
-#else
extern const LVM_UINT32 LVPSA_SampleRateTab[];
-#endif
/************************************************************************************/
/* */
diff --git a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
index 174c86a..0adfd1b 100644
--- a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
+++ b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
@@ -56,8 +56,6 @@
#ifndef LVCS_H
#define LVCS_H
-
-
/****************************************************************************************/
/* */
/* Includes */
@@ -67,7 +65,6 @@
#include "LVM_Types.h"
#include "LVM_Common.h"
-
/****************************************************************************************/
/* */
/* Definitions */
@@ -90,7 +87,6 @@
#define LVCS_EVENT_NONE 0x0000 /* Not a valid event */
#define LVCS_EVENT_ALGOFF 0x0001 /* CS has completed switch off */
-
/****************************************************************************************/
/* */
/* Types */
@@ -100,7 +96,6 @@
/* Instance handle */
typedef void *LVCS_Handle_t;
-
/* Operating modes */
typedef enum
{
@@ -109,7 +104,6 @@
LVCS_MAX = LVM_MAXENUM
} LVCS_Modes_en;
-
/* Memory Types */
typedef enum
{
@@ -120,7 +114,6 @@
LVCS_MEMORYTYPE_MAX = LVM_MAXENUM
} LVCS_MemoryTypes_en;
-
/* Function return status */
typedef enum
{
@@ -132,7 +125,6 @@
LVCS_STATUSMAX = LVM_MAXENUM
} LVCS_ReturnStatus_en;
-
/*
* Source data formats
*/
@@ -143,7 +135,6 @@
LVCS_SOURCEMAX = LVM_MAXENUM
} LVCS_SourceFormat_en;
-
/*
* Supported output devices
*/
@@ -169,7 +160,6 @@
void *pTable8;
} LVCS_CSMS_Coef_Tables_t;
-
/****************************************************************************************/
/* */
/* Structures */
@@ -184,14 +174,12 @@
void *pBaseAddress; /* Pointer to the region base address */
} LVCS_MemoryRegion_t;
-
/* Memory table containing the region definitions */
typedef struct
{
LVCS_MemoryRegion_t Region[LVCS_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVCS_MemTab_t;
-
/* Concert Sound parameter structure */
typedef struct
{
@@ -207,7 +195,6 @@
#endif
} LVCS_Params_t;
-
/* Concert Sound Capability structure */
typedef struct
{
@@ -220,7 +207,6 @@
} LVCS_Capabilities_t;
-
/****************************************************************************************/
/* */
/* Function Prototypes */
@@ -267,7 +253,6 @@
LVCS_MemTab_t *pMemoryTable,
LVCS_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVCS_Init */
@@ -305,7 +290,6 @@
LVCS_MemTab_t *pMemoryTable,
LVCS_Capabilities_t *pCapabilities);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVCS_GetParameters */
@@ -329,7 +313,6 @@
LVCS_ReturnStatus_en LVCS_GetParameters(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVCS_Control */
@@ -352,7 +335,6 @@
LVCS_ReturnStatus_en LVCS_Control(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-
/****************************************************************************************/
/* */
/* FUNCTION: LVCS_Process */
@@ -374,17 +356,9 @@
/* NOTES: */
/* */
/****************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#else
-LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#endif
-
#endif /* LVCS_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp
index 29e3c9e..ba152c0 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp
@@ -70,19 +70,12 @@
{
LVM_UINT16 Offset;
-#ifndef BUILD_FLOAT
- LVM_UINT32 Gain;
- LVM_INT32 Current;
-#else
LVM_FLOAT Gain;
LVM_FLOAT Current;
-#endif
LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
LVCS_BypassMix_t *pConfig = (LVCS_BypassMix_t *)&pInstance->BypassMix;
const Gain_t *pOutputGainTable;
-
-
/*
* Set the transition gain
*/
@@ -91,11 +84,7 @@
&& (pInstance->MSTarget1 != 0x7FFF) /* this indicates an off->on transtion */
)
{
-#ifndef BUILD_FLOAT
- pInstance->TransitionGain = pParams->EffectLevel;
-#else
pInstance->TransitionGain = ((LVM_FLOAT)pParams->EffectLevel / 32767);
-#endif
}
else
{
@@ -112,38 +101,21 @@
/*
* Setup the mixer gain for the processed path
*/
-#ifndef BUILD_FLOAT
- Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * pInstance->TransitionGain);
-#else
Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * pInstance->TransitionGain);
-#endif
pConfig->Mixer_Instance.MixerStream[0].CallbackParam = 0;
pConfig->Mixer_Instance.MixerStream[0].pCallbackHandle = LVM_NULL;
pConfig->Mixer_Instance.MixerStream[0].pCallBack = LVM_NULL;
pConfig->Mixer_Instance.MixerStream[0].CallbackSet=1;
-#ifndef BUILD_FLOAT
- Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[0]);
- LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[0],(LVM_INT32)(Gain >> 15),Current);
- LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
-#else
Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[0]);
LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[0], (LVM_FLOAT)(Gain), Current);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
-#endif
/*
* Setup the mixer gain for the unprocessed path
*/
-#ifndef BUILD_FLOAT
- Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * (0x7FFF - pInstance->TransitionGain));
- Gain = (LVM_UINT32)pOutputGainTable[Offset].UnprocLoss * (Gain >> 15);
- Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[1]);
- LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[1],(LVM_INT32)(Gain >> 15),Current);
- LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
-#else
Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * (1.0 - \
(LVM_FLOAT)pInstance->TransitionGain));
Gain = (LVM_FLOAT)pOutputGainTable[Offset].UnprocLoss * Gain;
@@ -151,7 +123,6 @@
LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[1], (LVM_FLOAT)(Gain), Current);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
-#endif
pConfig->Mixer_Instance.MixerStream[1].CallbackParam = 0;
pConfig->Mixer_Instance.MixerStream[1].pCallbackHandle = hInstance;
pConfig->Mixer_Instance.MixerStream[1].CallbackSet=1;
@@ -162,50 +133,10 @@
*/
pConfig->Output_Shift = pOutputGainTable[Offset].Shift;
-
/*
* Correct gain for the effect level
*/
{
-#ifndef BUILD_FLOAT
- LVM_INT16 GainCorrect;
- LVM_INT32 Gain1;
- LVM_INT32 Gain2;
-
- Gain1 = LVC_Mixer_GetTarget(&pConfig->Mixer_Instance.MixerStream[0]);
- Gain2 = LVC_Mixer_GetTarget(&pConfig->Mixer_Instance.MixerStream[1]);
- /*
- * Calculate the gain correction
- */
- if (pInstance->Params.CompressorMode == LVM_MODE_ON)
- {
- GainCorrect = (LVM_INT16)( pInstance->VolCorrect.GainMin
- - (((LVM_INT32)pInstance->VolCorrect.GainMin * (LVM_INT32)pInstance->TransitionGain) >> 15)
- + (((LVM_INT32)pInstance->VolCorrect.GainFull * (LVM_INT32)pInstance->TransitionGain) >> 15) );
-
- /*
- * Apply the gain correction and shift, note the result is in Q3.13 format
- */
- Gain1 = (Gain1 * GainCorrect) << 4;
- Gain2 = (Gain2 * GainCorrect) << 4;
- }
- else
- {
- Gain1 = Gain1 << 16;
- Gain2 = Gain2 << 16;
- }
-
-
-
- /*
- * Set the gain values
- */
- pConfig->Output_Shift = pConfig->Output_Shift;
- LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[0],Gain1>>16);
- LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[0],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
- LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[1],Gain2>>16);
- LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
-#else
LVM_FLOAT GainCorrect;
LVM_FLOAT Gain1;
LVM_FLOAT Gain2;
@@ -241,7 +172,6 @@
LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[1],Gain2);
LVC_Mixer_VarSlope_SetTimeConstant(&pConfig->Mixer_Instance.MixerStream[1],
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
-#endif
}
return(LVCS_SUCCESS);
@@ -276,15 +206,9 @@
/************************************************************************************/
LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
-#ifndef BUILD_FLOAT
- const LVM_INT16 *pProcessed,
- const LVM_INT16 *pUnprocessed,
- LVM_INT16 *pOutData,
-#else
const LVM_FLOAT *pProcessed,
const LVM_FLOAT *pUnprocessed,
LVM_FLOAT *pOutData,
-#endif
LVM_UINT16 NumSamples)
{
@@ -299,21 +223,6 @@
/*
* Apply the bypass mix
*/
-#ifndef BUILD_FLOAT
- LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance,
- pProcessed,
- (LVM_INT16 *) pUnprocessed,
- pOutData,
- (LVM_INT16)(2*NumSamples));
-
- /*
- * Apply output gain correction shift
- */
- Shift_Sat_v16xv16 ((LVM_INT16)pConfig->Output_Shift,
- (LVM_INT16*)pOutData,
- (LVM_INT16*)pOutData,
- (LVM_INT16)(2*NumSamples)); /* Left and right*/
-#else
LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance,
pProcessed,
(LVM_FLOAT *) pUnprocessed,
@@ -326,13 +235,11 @@
(LVM_FLOAT*)pOutData,
(LVM_FLOAT*)pOutData,
(LVM_INT16)(2 * NumSamples)); /* Left and right*/
-#endif
}
return(LVCS_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVCS_MixerCallback */
@@ -368,7 +275,6 @@
}
}
-
if ((pInstance->OutputDevice == LVCS_HEADPHONE) &&
(pInstance->MSTarget0 == 1) &&
(pInstance->bTimerDone == LVM_TRUE)){
@@ -380,5 +286,3 @@
return 1;
}
-
-
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
index 6ec2ac5..fcd8ee3 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
@@ -18,8 +18,6 @@
#ifndef __LVCS_BYPASSMIX_H__
#define __LVCS_BYPASSMIX_H__
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -28,7 +26,6 @@
#include "LVC_Mixer.h"
-
/************************************************************************************/
/* */
/* Structures */
@@ -39,25 +36,11 @@
typedef struct
{
/* Mixer settings */
-#ifdef BUILD_FLOAT
LVMixer3_2St_FLOAT_st Mixer_Instance; /* Mixer instance */
-#else
- LVMixer3_2St_st Mixer_Instance; /* Mixer instance */
-#endif
LVM_UINT16 Output_Shift; /* Correcting gain output shift */
} LVCS_BypassMix_t;
-#ifndef BUILD_FLOAT
-/* Output gain type */
-typedef struct
-{
- /* Output gain settings, Gain = (Loss/32768) * 2^Shift */
- LVM_UINT16 Shift; /* Left shifts required */
- LVM_UINT16 Loss; /* Loss required */
- LVM_UINT16 UnprocLoss; /* Unprocessed path loss */
-} Gain_t;
-#else
typedef struct
{
/* Output gain settings, Gain = (Loss/32768) * 2^Shift */
@@ -65,7 +48,6 @@
LVM_FLOAT Loss; /* Loss required */
LVM_FLOAT UnprocLoss; /* Unprocessed path loss */
} Gain_t;
-#endif
/************************************************************************************/
/* */
/* Function prototypes */
@@ -75,18 +57,10 @@
LVCS_ReturnStatus_en LVCS_BypassMixInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-#ifndef BUILD_FLOAT
-LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
- const LVM_INT16 *pProcessed,
- const LVM_INT16 *unProcessed,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#else
LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
const LVM_FLOAT *pProcessed,
const LVM_FLOAT *unProcessed,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#endif
#endif /* BYPASSMIX_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp
index 3bf6ec6..50db03d 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp
@@ -56,7 +56,6 @@
return(LVCS_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Control */
@@ -120,29 +119,8 @@
pInstance->VolCorrect = pLVCS_VolCorrectTable[Offset];
pInstance->CompressGain = pInstance->VolCorrect.CompMin;
-#ifdef BUILD_FLOAT
LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0], 0, 0);
-#else
- LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],0,0);
-#endif
{
-#ifndef BUILD_FLOAT
- LVM_UINT32 Gain;
- const Gain_t *pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
- Gain = (LVM_UINT32)(pOutputGainTable[Offset].Loss * LVM_MAXINT_16);
- Gain = (LVM_UINT32)pOutputGainTable[Offset].UnprocLoss * (Gain >> 15);
- Gain=Gain>>15;
- /*
- * Apply the gain correction and shift, note the result is in Q3.13 format
- */
- Gain = (Gain * pInstance->VolCorrect.GainMin) >>12;
-
- LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],0,Gain);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],
- LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],
- LVCS_BYPASS_MIXER_TC,pParams->SampleRate,2);
-#else
LVM_FLOAT Gain;
const Gain_t *pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss);
@@ -158,10 +136,8 @@
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
-#endif
}
-
err=LVCS_SEnhancerInit(hInstance,
pParams);
@@ -176,7 +152,6 @@
}
-
/*
* Check if the effect level or source format has changed
*/
@@ -243,7 +218,6 @@
pInstance->MSTarget0=0;
}
-
/* Set transition flag */
pInstance->bInOperatingModeTransition = LVM_TRUE;
}
@@ -272,7 +246,6 @@
pInstance->bTimerDone = LVM_TRUE;
-
return;
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
index cd53a11..431b7e3 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
@@ -53,7 +53,6 @@
/* NOTES: */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -92,8 +91,7 @@
Coeffs.B2 = (LVM_FLOAT)-pEqualiserCoefTable[Offset].B2;
LoadConst_Float((LVM_INT16)0, /* Value */
- (LVM_FLOAT *)&pData->EqualiserBiquadTaps, /* Destination Cast to void:\
- no dereferencing in function*/
+ (LVM_FLOAT *)&pData->EqualiserBiquadTaps, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->EqualiserBiquadTaps) / sizeof(LVM_FLOAT)));
@@ -118,66 +116,6 @@
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
-
- LVM_UINT16 Offset;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
- LVCS_Data_t *pData = (LVCS_Data_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
- LVCS_Coefficient_t *pCoefficients = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- BQ_C16_Coefs_t Coeffs;
- const BiquadA012B12CoefsSP_t *pEqualiserCoefTable;
-
- /*
- * If the sample rate changes re-initialise the filters
- */
- if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
- (pInstance->Params.SpeakerType != pParams->SpeakerType))
- {
- /*
- * Setup the filter coefficients and clear the history
- */
- Offset = (LVM_UINT16)(pParams->SampleRate + (pParams->SpeakerType * (1+LVM_FS_48000)));
- pEqualiserCoefTable = (BiquadA012B12CoefsSP_t*)&LVCS_EqualiserCoefTable[0];
-
- /* Left and right filters */
- /* Convert incoming coefficients to the required format/ordering */
- Coeffs.A0 = (LVM_INT16) pEqualiserCoefTable[Offset].A0;
- Coeffs.A1 = (LVM_INT16) pEqualiserCoefTable[Offset].A1;
- Coeffs.A2 = (LVM_INT16) pEqualiserCoefTable[Offset].A2;
- Coeffs.B1 = (LVM_INT16)-pEqualiserCoefTable[Offset].B1;
- Coeffs.B2 = (LVM_INT16)-pEqualiserCoefTable[Offset].B2;
-
- LoadConst_16((LVM_INT16)0, /* Value */
- (void *)&pData->EqualiserBiquadTaps, /* Destination Cast to void:\
- no dereferencing in function*/
- (LVM_UINT16)(sizeof(pData->EqualiserBiquadTaps)/sizeof(LVM_INT16))); /* Number of words */
-
- BQ_2I_D16F32Css_TRC_WRA_01_Init(&pCoefficients->EqualiserBiquadInstance,
- &pData->EqualiserBiquadTaps,
- &Coeffs);
-
- /* Callbacks */
- switch(pEqualiserCoefTable[Offset].Scale)
- {
- case 13:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C13_TRC_WRA_01;
- break;
- case 14:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C14_TRC_WRA_01;
- break;
- case 15:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C15_TRC_WRA_01;
- break;
- }
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Equaliser */
@@ -197,7 +135,6 @@
/* 1. Always processes in place. */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
LVM_FLOAT *pInputOutput,
LVM_UINT16 NumSamples)
@@ -207,11 +144,9 @@
LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
LVCS_Coefficient_t *pCoefficients;
-
pCoefficients = (LVCS_Coefficient_t *) \
pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
-
/*
* Check if the equaliser is required
*/
@@ -227,29 +162,3 @@
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
- LVM_INT16 *pInputOutput,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
- LVCS_Coefficient_t *pCoefficients = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
-
-
- /*
- * Check if the equaliser is required
- */
- if ((pInstance->Params.OperatingMode & LVCS_EQUALISERSWITCH) != 0)
- {
- /* Apply filter to the left and right channels */
- (pConfig->pBiquadCallBack)((Biquad_Instance_t*)&pCoefficients->EqualiserBiquadInstance,
- (LVM_INT16 *)pInputOutput,
- (LVM_INT16 *)pInputOutput,
- (LVM_INT16)NumSamples);
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
index 55c4815..918d931 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
@@ -18,8 +18,6 @@
#ifndef __LVCS_EQUALISER_H__
#define __LVCS_EQUALISER_H__
-
-
/************************************************************************************/
/* */
/* Structures */
@@ -29,14 +27,9 @@
/* Equaliser structure */
typedef struct
{
-#ifndef BUILD_FLOAT
- void (*pBiquadCallBack) (Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
-#else
void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*, LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
-#endif
} LVCS_Equaliser_t;
-
/************************************************************************************/
/* */
/* Function prototypes */
@@ -45,14 +38,8 @@
LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-#ifndef BUILD_FLOAT
-LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
- LVM_INT16 *pInputOutput,
- LVM_UINT16 NumSamples);
-#else
LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
LVM_FLOAT *pInputOutput,
LVM_UINT16 NumSamples);
-#endif
#endif /* EQUALISER_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
index ba05577..c7ee232 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
@@ -18,13 +18,11 @@
#ifndef __LVCS_HEADPHONE_COEFFS_H__
#define __LVCS_HEADPHONE_COEFFS_H__
-
/************************************************************************************/
/* */
/* The Stereo Enhancer */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
/* Stereo Enhancer coefficients for 8000 Hz sample rate, scaled with 0.161258 */
#define CS_MIDDLE_8000_A0 0.227720
#define CS_MIDDLE_8000_A1 (-0.215125)
@@ -151,7 +149,6 @@
#define CS_SIDE_48000_B2 0.630405
#define CS_SIDE_48000_SCALE 14
-#ifdef HIGHER_FS
/* Coefficients for 88200Hz sample rate.
* The filter coefficients are obtained by carrying out
* state-space analysis using the coefficients available
@@ -222,7 +219,6 @@
#define CS_SIDE_192000_B1 (-1.891380f)
#define CS_SIDE_192000_B2 0.8923460f
#define CS_SIDE_192000_SCALE 14
-#endif
/************************************************************************************/
/* */
@@ -286,7 +282,6 @@
#define CS_REVERB_22050_B2 (-0.290990)
#define CS_REVERB_22050_SCALE 15
-
/* Reverb coefficients for 24000Hz sample rate, scaled with 1.038030 */
#define CS_REVERB_24000_A0 0.479565
#define CS_REVERB_24000_A1 0.000000
@@ -319,7 +314,6 @@
#define CS_REVERB_48000_B2 0.303347
#define CS_REVERB_48000_SCALE 14
-#ifdef HIGHER_FS
/* Reverb coefficients for 88200Hz sample rate, scaled with 0.8 */
/* Band pass filter with fc1=500 and fc2=8000 */
#define CS_REVERB_88200_A0 0.171901f
@@ -354,9 +348,6 @@
#define CS_REVERB_192000_B2 0.7804076
#define CS_REVERB_192000_SCALE 14
-#endif
-
-
/* Reverb Gain Settings */
#define LVCS_HEADPHONE_DELAYGAIN 0.800000 /* Algorithm delay path gain */
#define LVCS_HEADPHONE_OUTPUTGAIN 1.000000 /* Algorithm output gain */
@@ -505,8 +496,6 @@
#define CSEX_EQUALISER_48000_B2 (-0.347332)
#define CSEX_EQUALISER_48000_SCALE 13
-
-#ifdef HIGHER_FS
/* Equaliser coefficients for 88200Hz sample rate.
* The filter coefficients are obtained by carrying out
* state-space analysis using the coefficients available
@@ -567,8 +556,6 @@
#define CSEX_EQUALISER_192000_B1 (-1.31074)
#define CSEX_EQUALISER_192000_B2 0.31312
#define CSEX_EQUALISER_192000_SCALE 13
-#endif
-
#define LVCS_HEADPHONE_SHIFT 2 /* Output Shift */
#define LVCS_HEADPHONE_SHIFTLOSS 0.8477735 /* Output Shift loss */
@@ -576,376 +563,5 @@
#define LVCS_EX_HEADPHONE_SHIFT 3 /* EX Output Shift */
#define LVCS_EX_HEADPHONE_SHIFTLOSS 0.569225 /* EX Output Shift loss */
#define LVCS_EX_HEADPHONE_GAIN 0.07794425 /* EX Unprocessed path gain */
-#else
-/* Stereo Enhancer coefficients for 8000 Hz sample rate, scaled with 0.161258 */
-#define CS_MIDDLE_8000_A0 7462 /* Floating point value 0.227720 */
-#define CS_MIDDLE_8000_A1 (-7049) /* Floating point value -0.215125 */
-#define CS_MIDDLE_8000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_8000_B1 (-30209) /* Floating point value -0.921899 */
-#define CS_MIDDLE_8000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_8000_SCALE 15
-#define CS_SIDE_8000_A0 20036 /* Floating point value 0.611441 */
-#define CS_SIDE_8000_A1 (-12463) /* Floating point value -0.380344 */
-#define CS_SIDE_8000_A2 (-7573) /* Floating point value -0.231097 */
-#define CS_SIDE_8000_B1 (-20397) /* Floating point value -0.622470 */
-#define CS_SIDE_8000_B2 (-4285) /* Floating point value -0.130759 */
-#define CS_SIDE_8000_SCALE 15
-
-/* Stereo Enhancer coefficients for 11025Hz sample rate, scaled with 0.162943 */
-#define CS_MIDDLE_11025_A0 7564 /* Floating point value 0.230838 */
-#define CS_MIDDLE_11025_A1 (-7260) /* Floating point value -0.221559 */
-#define CS_MIDDLE_11025_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_11025_B1 (-30902) /* Floating point value -0.943056 */
-#define CS_MIDDLE_11025_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_11025_SCALE 15
-#define CS_SIDE_11025_A0 18264 /* Floating point value 0.557372 */
-#define CS_SIDE_11025_A1 (-12828) /* Floating point value -0.391490 */
-#define CS_SIDE_11025_A2 (-5436) /* Floating point value -0.165881 */
-#define CS_SIDE_11025_B1 (-28856) /* Floating point value -0.880608 */
-#define CS_SIDE_11025_B2 1062 /* Floating point value 0.032397 */
-#define CS_SIDE_11025_SCALE 15
-
-/* Stereo Enhancer coefficients for 12000Hz sample rate, scaled with 0.162191 */
-#define CS_MIDDLE_12000_A0 7534 /* Floating point value 0.229932 */
-#define CS_MIDDLE_12000_A1 (-7256) /* Floating point value -0.221436 */
-#define CS_MIDDLE_12000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_12000_B1 (-31051) /* Floating point value -0.947616 */
-#define CS_MIDDLE_12000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_12000_SCALE 15
-#define CS_SIDE_12000_A0 18298 /* Floating point value 0.558398 */
-#define CS_SIDE_12000_A1 (-12852) /* Floating point value -0.392211 */
-#define CS_SIDE_12000_A2 (-5446) /* Floating point value -0.166187 */
-#define CS_SIDE_12000_B1 (-29247) /* Floating point value -0.892550 */
-#define CS_SIDE_12000_B2 1077 /* Floating point value 0.032856 */
-#define CS_SIDE_12000_SCALE 15
-
-/* Stereo Enhancer coefficients for 16000Hz sample rate, scaled with 0.162371 */
-#define CS_MIDDLE_16000_A0 7558 /* Floating point value 0.230638 */
-#define CS_MIDDLE_16000_A1 (-7348) /* Floating point value -0.224232 */
-#define CS_MIDDLE_16000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_16000_B1 (-31475) /* Floating point value -0.960550 */
-#define CS_MIDDLE_16000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_16000_SCALE 15
-#define CS_SIDE_16000_A0 8187 /* Floating point value 0.499695 */
-#define CS_SIDE_16000_A1 (-5825) /* Floating point value -0.355543 */
-#define CS_SIDE_16000_A2 (-2362) /* Floating point value -0.144152 */
-#define CS_SIDE_16000_B1 (-17216) /* Floating point value -1.050788 */
-#define CS_SIDE_16000_B2 2361 /* Floating point value 0.144104 */
-#define CS_SIDE_16000_SCALE 14
-
-/* Stereo Enhancer coefficients for 22050Hz sample rate, scaled with 0.160781 */
-#define CS_MIDDLE_22050_A0 7496 /* Floating point value 0.228749 */
-#define CS_MIDDLE_22050_A1 (-7344) /* Floating point value -0.224128 */
-#define CS_MIDDLE_22050_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_22050_B1 (-31826) /* Floating point value -0.971262 */
-#define CS_MIDDLE_22050_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_22050_SCALE 15
-#define CS_SIDE_22050_A0 7211 /* Floating point value 0.440112 */
-#define CS_SIDE_22050_A1 (-4278) /* Floating point value -0.261096 */
-#define CS_SIDE_22050_A2 (-2933) /* Floating point value -0.179016 */
-#define CS_SIDE_22050_B1 (-18297) /* Floating point value -1.116786 */
-#define CS_SIDE_22050_B2 2990 /* Floating point value 0.182507 */
-#define CS_SIDE_22050_SCALE 14
-
-/* Stereo Enhancer coefficients for 24000Hz sample rate, scaled with 0.161882 */
-#define CS_MIDDLE_24000_A0 7550 /* Floating point value 0.230395 */
-#define CS_MIDDLE_24000_A1 (-7409) /* Floating point value -0.226117 */
-#define CS_MIDDLE_24000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_24000_B1 (-31902) /* Floating point value -0.973573 */
-#define CS_MIDDLE_24000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_24000_SCALE 15
-#define CS_SIDE_24000_A0 6796 /* Floating point value 0.414770 */
-#define CS_SIDE_24000_A1 (-4705) /* Floating point value -0.287182 */
-#define CS_SIDE_24000_A2 (-2090) /* Floating point value -0.127588 */
-#define CS_SIDE_24000_B1 (-20147) /* Floating point value -1.229648 */
-#define CS_SIDE_24000_B2 4623 /* Floating point value 0.282177 */
-#define CS_SIDE_24000_SCALE 14
-
-/* Stereo Enhancer coefficients for 32000Hz sample rate, scaled with 0.160322 */
-#define CS_MIDDLE_32000_A0 7484 /* Floating point value 0.228400 */
-#define CS_MIDDLE_32000_A1 (-7380) /* Floating point value -0.225214 */
-#define CS_MIDDLE_32000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_32000_B1 (-32117) /* Floating point value -0.980126 */
-#define CS_MIDDLE_32000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_32000_SCALE 15
-#define CS_SIDE_32000_A0 5973 /* Floating point value 0.364579 */
-#define CS_SIDE_32000_A1 (-3397) /* Floating point value -0.207355 */
-#define CS_SIDE_32000_A2 (-2576) /* Floating point value -0.157224 */
-#define CS_SIDE_32000_B1 (-20877) /* Floating point value -1.274231 */
-#define CS_SIDE_32000_B2 5120 /* Floating point value 0.312495 */
-#define CS_SIDE_32000_SCALE 14
-
-/* Stereo Enhancer coefficients for 44100Hz sample rate, scaled with 0.163834 */
-#define CS_MIDDLE_44100_A0 7654 /* Floating point value 0.233593 */
-#define CS_MIDDLE_44100_A1 (-7577) /* Floating point value -0.231225 */
-#define CS_MIDDLE_44100_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_44100_B1 (-32294) /* Floating point value -0.985545 */
-#define CS_MIDDLE_44100_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_44100_SCALE 15
-#define CS_SIDE_44100_A0 4662 /* Floating point value 0.284573 */
-#define CS_SIDE_44100_A1 (-4242) /* Floating point value -0.258910 */
-#define CS_SIDE_44100_A2 (-420) /* Floating point value -0.025662 */
-#define CS_SIDE_44100_B1 (-25760) /* Floating point value -1.572248 */
-#define CS_SIDE_44100_B2 9640 /* Floating point value 0.588399 */
-#define CS_SIDE_44100_SCALE 14
-
-/* Stereo Enhancer coefficients for 48000Hz sample rate, scaled with 0.164402 */
-#define CS_MIDDLE_48000_A0 7682 /* Floating point value 0.234445 */
-#define CS_MIDDLE_48000_A1 (-7611) /* Floating point value -0.232261 */
-#define CS_MIDDLE_48000_A2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_48000_B1 (-32333) /* Floating point value -0.986713 */
-#define CS_MIDDLE_48000_B2 0 /* Floating point value 0.000000 */
-#define CS_MIDDLE_48000_SCALE 15
-#define CS_SIDE_48000_A0 4466 /* Floating point value 0.272606 */
-#define CS_SIDE_48000_A1 (-4374) /* Floating point value -0.266952 */
-#define CS_SIDE_48000_A2 (-93) /* Floating point value -0.005654 */
-#define CS_SIDE_48000_B1 (-26495) /* Floating point value -1.617141 */
-#define CS_SIDE_48000_B2 10329 /* Floating point value 0.630405 */
-#define CS_SIDE_48000_SCALE 14
-
-
-/************************************************************************************/
-/* */
-/* The Reverb Unit */
-/* */
-/************************************************************************************/
-
-/* Reverb delay settings in samples */
-#define LVCS_STEREODELAY_CS_8KHZ 93 /* Sample rate 8kS/s */
-#define LVCS_STEREODELAY_CS_11KHZ 128 /* Sample rate 11kS/s */
-#define LVCS_STEREODELAY_CS_12KHZ 139 /* Sample rate 12kS/s */
-#define LVCS_STEREODELAY_CS_16KHZ 186 /* Sample rate 16kS/s */
-#define LVCS_STEREODELAY_CS_22KHZ 256 /* Sample rate 22kS/s */
-#define LVCS_STEREODELAY_CS_24KHZ 279 /* Sample rate 24kS/s */
-#define LVCS_STEREODELAY_CS_32KHZ 372 /* Sample rate 32kS/s */
-#define LVCS_STEREODELAY_CS_44KHZ 512 /* Sample rate 44kS/s */
-#define LVCS_STEREODELAY_CS_48KHZ 512 /* Sample rate 48kS/s */
-
-/* Reverb coefficients for 8000 Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_8000_A0 21865 /* Floating point value 0.667271 */
-#define CS_REVERB_8000_A1 (-21865) /* Floating point value -0.667271 */
-#define CS_REVERB_8000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_8000_B1 (-21895) /* Floating point value -0.668179 */
-#define CS_REVERB_8000_B2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_8000_SCALE 15
-
-/* Reverb coefficients for 11025Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_11025_A0 22926 /* Floating point value 0.699638 */
-#define CS_REVERB_11025_A1 (-22926) /* Floating point value -0.699638 */
-#define CS_REVERB_11025_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_11025_B1 (-24546) /* Floating point value -0.749096 */
-#define CS_REVERB_11025_B2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_11025_SCALE 15
-
-/* Reverb coefficients for 12000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_12000_A0 23165 /* Floating point value 0.706931 */
-#define CS_REVERB_12000_A1 (-23165) /* Floating point value -0.706931 */
-#define CS_REVERB_12000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_12000_B1 (-25144) /* Floating point value -0.767327 */
-#define CS_REVERB_12000_B2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_12000_SCALE 15
-
-/* Reverb coefficients for 16000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_16000_A0 23864 /* Floating point value 0.728272 */
-#define CS_REVERB_16000_A1 (-23864) /* Floating point value -0.728272 */
-#define CS_REVERB_16000_A2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_16000_B1 (-26892) /* Floating point value -0.820679 */
-#define CS_REVERB_16000_B2 0 /* Floating point value 0.000000 */
-#define CS_REVERB_16000_SCALE 15
-
-/* Reverb coefficients for 22050Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_22050_A0 16921 /* Floating point value 0.516396 */
-#define CS_REVERB_22050_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_22050_A2 (-16921) /* Floating point value -0.516396 */
-#define CS_REVERB_22050_B1 (-16991) /* Floating point value -0.518512 */
-#define CS_REVERB_22050_B2 (-9535) /* Floating point value -0.290990 */
-#define CS_REVERB_22050_SCALE 15
-
-/* Reverb coefficients for 24000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_24000_A0 15714 /* Floating point value 0.479565 */
-#define CS_REVERB_24000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_24000_A2 (-15714) /* Floating point value -0.479565 */
-#define CS_REVERB_24000_B1 (-20898) /* Floating point value -0.637745 */
-#define CS_REVERB_24000_B2 (-6518) /* Floating point value -0.198912 */
-#define CS_REVERB_24000_SCALE 15
-
-/* Reverb coefficients for 32000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_32000_A0 12463 /* Floating point value 0.380349 */
-#define CS_REVERB_32000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_32000_A2 (-12463) /* Floating point value -0.380349 */
-#define CS_REVERB_32000_B1 (-31158) /* Floating point value -0.950873 */
-#define CS_REVERB_32000_B2 1610 /* Floating point value 0.049127 */
-#define CS_REVERB_32000_SCALE 15
-
-/* Reverb coefficients for 44100Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_44100_A0 4872 /* Floating point value 0.297389 */
-#define CS_REVERB_44100_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_44100_A2 (-4872) /* Floating point value -0.297389 */
-#define CS_REVERB_44100_B1 (-19668) /* Floating point value -1.200423 */
-#define CS_REVERB_44100_B2 4203 /* Floating point value 0.256529 */
-#define CS_REVERB_44100_SCALE 14
-
-/* Reverb coefficients for 48000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_48000_A0 4566 /* Floating point value 0.278661 */
-#define CS_REVERB_48000_A1 0 /* Floating point value 0.000000 */
-#define CS_REVERB_48000_A2 (-4566) /* Floating point value -0.278661 */
-#define CS_REVERB_48000_B1 (-20562) /* Floating point value -1.254993 */
-#define CS_REVERB_48000_B2 4970 /* Floating point value 0.303347 */
-#define CS_REVERB_48000_SCALE 14
-
-/* Reverb Gain Settings */
-#define LVCS_HEADPHONE_DELAYGAIN 0.800000 /* Algorithm delay path gain */
-#define LVCS_HEADPHONE_OUTPUTGAIN 1.000000 /* Algorithm output gain */
-#define LVCS_HEADPHONE_PROCGAIN 18403 /* Processed path gain */
-#define LVCS_HEADPHONE_UNPROCGAIN 18403 /* Unprocessed path gain */
-#define LVCS_HEADPHONE_GAINCORRECT 1.009343 /* Delay mixer gain correction */
-
-
-/************************************************************************************/
-/* */
-/* The Equaliser */
-/* */
-/************************************************************************************/
-
-/* Equaliser coefficients for 8000 Hz sample rate, CS scaled with 1.038497 and CSEX scaled with 0.775480 */
-#define CS_EQUALISER_8000_A0 20698 /* Floating point value 1.263312 */
-#define CS_EQUALISER_8000_A1 (-9859) /* Floating point value -0.601748 */
-#define CS_EQUALISER_8000_A2 (-4599) /* Floating point value -0.280681 */
-#define CS_EQUALISER_8000_B1 (-7797) /* Floating point value -0.475865 */
-#define CS_EQUALISER_8000_B2 (-6687) /* Floating point value -0.408154 */
-#define CS_EQUALISER_8000_SCALE 14
-#define CSEX_EQUALISER_8000_A0 30912 /* Floating point value 0.943357 */
-#define CSEX_EQUALISER_8000_A1 (-14724) /* Floating point value -0.449345 */
-#define CSEX_EQUALISER_8000_A2 (-6868) /* Floating point value -0.209594 */
-#define CSEX_EQUALISER_8000_B1 (-15593) /* Floating point value -0.475865 */
-#define CSEX_EQUALISER_8000_B2 (-13374) /* Floating point value -0.408154 */
-#define CSEX_EQUALISER_8000_SCALE 15
-
-/* Equaliser coefficients for 11025Hz sample rate, CS scaled with 1.027761 and CSEX scaled with 0.767463 */
-#define CS_EQUALISER_11025_A0 18041 /* Floating point value 1.101145 */
-#define CS_EQUALISER_11025_A1 2278 /* Floating point value 0.139020 */
-#define CS_EQUALISER_11025_A2 (-14163) /* Floating point value -0.864423 */
-#define CS_EQUALISER_11025_B1 402 /* Floating point value 0.024541 */
-#define CS_EQUALISER_11025_B2 (-14892) /* Floating point value -0.908930 */
-#define CS_EQUALISER_11025_SCALE 14
-#define CSEX_EQUALISER_11025_A0 31983 /* Floating point value 0.976058 */
-#define CSEX_EQUALISER_11025_A1 (-22784) /* Floating point value -0.695326 */
-#define CSEX_EQUALISER_11025_A2 (-2976) /* Floating point value -0.090809 */
-#define CSEX_EQUALISER_11025_B1 (-20008) /* Floating point value -0.610594 */
-#define CSEX_EQUALISER_11025_B2 (-10196) /* Floating point value -0.311149 */
-#define CSEX_EQUALISER_11025_SCALE 15
-
-/* Equaliser coefficients for 12000Hz sample rate, CS scaled with 1.032521 and CSEX scaled with 0.771017 */
-#define CS_EQUALISER_12000_A0 20917 /* Floating point value 1.276661 */
-#define CS_EQUALISER_12000_A1 (-16671) /* Floating point value -1.017519 */
-#define CS_EQUALISER_12000_A2 (-723) /* Floating point value -0.044128 */
-#define CS_EQUALISER_12000_B1 (-11954) /* Floating point value -0.729616 */
-#define CS_EQUALISER_12000_B2 (-3351) /* Floating point value -0.204532 */
-#define CS_EQUALISER_12000_SCALE 14
-#define CSEX_EQUALISER_12000_A0 16500 /* Floating point value 1.007095 */
-#define CSEX_EQUALISER_12000_A1 (-14285) /* Floating point value -0.871912 */
-#define CSEX_EQUALISER_12000_A2 381 /* Floating point value 0.023232 */
-#define CSEX_EQUALISER_12000_B1 (-12220) /* Floating point value -0.745857 */
-#define CSEX_EQUALISER_12000_B2 (-3099) /* Floating point value -0.189171 */
-#define CSEX_EQUALISER_12000_SCALE 14
-
-/* Equaliser coefficients for 16000Hz sample rate, CS scaled with 1.031378 and CSEX scaled with 0.770164 */
-#define CS_EQUALISER_16000_A0 20998 /* Floating point value 1.281629 */
-#define CS_EQUALISER_16000_A1 (-17627) /* Floating point value -1.075872 */
-#define CS_EQUALISER_16000_A2 (-678) /* Floating point value -0.041365 */
-#define CS_EQUALISER_16000_B1 (-11882) /* Floating point value -0.725239 */
-#define CS_EQUALISER_16000_B2 (-3676) /* Floating point value -0.224358 */
-#define CS_EQUALISER_16000_SCALE 14
-#define CSEX_EQUALISER_16000_A0 17713 /* Floating point value 1.081091 */
-#define CSEX_EQUALISER_16000_A1 (-14208) /* Floating point value -0.867183 */
-#define CSEX_EQUALISER_16000_A2 (-1151) /* Floating point value -0.070247 */
-#define CSEX_EQUALISER_16000_B1 (-8440) /* Floating point value -0.515121 */
-#define CSEX_EQUALISER_16000_B2 (-6978) /* Floating point value -0.425893 */
-#define CSEX_EQUALISER_16000_SCALE 14
-
-/* Equaliser coefficients for 22050Hz sample rate, CS scaled with 1.041576 and CSEX scaled with 0.777779 */
-#define CS_EQUALISER_22050_A0 22751 /* Floating point value 1.388605 */
-#define CS_EQUALISER_22050_A1 (-21394) /* Floating point value -1.305799 */
-#define CS_EQUALISER_22050_A2 654 /* Floating point value 0.039922 */
-#define CS_EQUALISER_22050_B1 (-11788) /* Floating point value -0.719494 */
-#define CS_EQUALISER_22050_B2 (-3985) /* Floating point value -0.243245 */
-#define CS_EQUALISER_22050_SCALE 14
-#define CSEX_EQUALISER_22050_A0 20855 /* Floating point value 1.272910 */
-#define CSEX_EQUALISER_22050_A1 (-21971) /* Floating point value -1.341014 */
-#define CSEX_EQUALISER_22050_A2 2744 /* Floating point value 0.167462 */
-#define CSEX_EQUALISER_22050_B1 (-10063) /* Floating point value -0.614219 */
-#define CSEX_EQUALISER_22050_B2 (-5659) /* Floating point value -0.345384 */
-#define CSEX_EQUALISER_22050_SCALE 14
-
-/* Equaliser coefficients for 24000Hz sample rate, CS scaled with 1.034495 and CSEX scaled with 0.772491 */
-#define CS_EQUALISER_24000_A0 23099 /* Floating point value 1.409832 */
-#define CS_EQUALISER_24000_A1 (-23863) /* Floating point value -1.456506 */
-#define CS_EQUALISER_24000_A2 2481 /* Floating point value 0.151410 */
-#define CS_EQUALISER_24000_B1 (-13176) /* Floating point value -0.804201 */
-#define CS_EQUALISER_24000_B2 (-2683) /* Floating point value -0.163783 */
-#define CS_EQUALISER_24000_SCALE 14
-#define CSEX_EQUALISER_24000_A0 21286 /* Floating point value 1.299198 */
-#define CSEX_EQUALISER_24000_A1 (-23797) /* Floating point value -1.452447 */
-#define CSEX_EQUALISER_24000_A2 3940 /* Floating point value 0.240489 */
-#define CSEX_EQUALISER_24000_B1 (-10966) /* Floating point value -0.669303 */
-#define CSEX_EQUALISER_24000_B2 (-4833) /* Floating point value -0.294984 */
-#define CSEX_EQUALISER_24000_SCALE 14
-
-/* Equaliser coefficients for 32000Hz sample rate, CS scaled with 1.044559 and CSEX scaled with 0.780006 */
-#define CS_EQUALISER_32000_A0 25575 /* Floating point value 1.560988 */
-#define CS_EQUALISER_32000_A1 (-30765) /* Floating point value -1.877724 */
-#define CS_EQUALISER_32000_A2 6386 /* Floating point value 0.389741 */
-#define CS_EQUALISER_32000_B1 (-14867) /* Floating point value -0.907410 */
-#define CS_EQUALISER_32000_B2 (-1155) /* Floating point value -0.070489 */
-#define CS_EQUALISER_32000_SCALE 14
-#define CSEX_EQUALISER_32000_A0 14623 /* Floating point value 1.785049 */
-#define CSEX_EQUALISER_32000_A1 (-18297) /* Floating point value -2.233497 */
-#define CSEX_EQUALISER_32000_A2 4313 /* Floating point value 0.526431 */
-#define CSEX_EQUALISER_32000_B1 (-3653) /* Floating point value -0.445939 */
-#define CSEX_EQUALISER_32000_B2 (-4280) /* Floating point value -0.522446 */
-#define CSEX_EQUALISER_32000_SCALE 13
-
-/* Equaliser coefficients for 44100Hz sample rate, CS scaled with 1.022170 and CSEX scaled with 0.763288 */
-#define CS_EQUALISER_44100_A0 13304 /* Floating point value 1.623993 */
-#define CS_EQUALISER_44100_A1 (-18602) /* Floating point value -2.270743 */
-#define CS_EQUALISER_44100_A2 5643 /* Floating point value 0.688829 */
-#define CS_EQUALISER_44100_B1 (-9152) /* Floating point value -1.117190 */
-#define CS_EQUALISER_44100_B2 1067 /* Floating point value 0.130208 */
-#define CS_EQUALISER_44100_SCALE 13
-#define CSEX_EQUALISER_44100_A0 16616 /* Floating point value 2.028315 */
-#define CSEX_EQUALISER_44100_A1 (-23613) /* Floating point value -2.882459 */
-#define CSEX_EQUALISER_44100_A2 7410 /* Floating point value 0.904535 */
-#define CSEX_EQUALISER_44100_B1 (-4860) /* Floating point value -0.593308 */
-#define CSEX_EQUALISER_44100_B2 (-3161) /* Floating point value -0.385816 */
-#define CSEX_EQUALISER_44100_SCALE 13
-
-/* Equaliser coefficients for 48000Hz sample rate, CS scaled with 1.018635 and CSEX scaled with 0.760648 */
-#define CS_EQUALISER_48000_A0 13445 /* Floating point value 1.641177 */
-#define CS_EQUALISER_48000_A1 (-19372) /* Floating point value -2.364687 */
-#define CS_EQUALISER_48000_A2 6225 /* Floating point value 0.759910 */
-#define CS_EQUALISER_48000_B1 (-9558) /* Floating point value -1.166774 */
-#define CS_EQUALISER_48000_B2 1459 /* Floating point value 0.178074 */
-#define CS_EQUALISER_48000_SCALE 13
-#define CSEX_EQUALISER_48000_A0 17200 /* Floating point value 2.099655 */
-#define CSEX_EQUALISER_48000_A1 (-25110) /* Floating point value -3.065220 */
-#define CSEX_EQUALISER_48000_A2 8277 /* Floating point value 1.010417 */
-#define CSEX_EQUALISER_48000_B1 (-5194) /* Floating point value -0.634021 */
-#define CSEX_EQUALISER_48000_B2 (-2845) /* Floating point value -0.347332 */
-#define CSEX_EQUALISER_48000_SCALE 13
-
-
-/************************************************************************************/
-/* */
-/* The Output Gain Correction */
-/* */
-/************************************************************************************/
-
-#define LVCS_HEADPHONE_SHIFT 2 /* Output Shift */
-#define LVCS_HEADPHONE_SHIFTLOSS 27779 /* Output Shift loss */
-#define LVCS_HEADPHONE_GAIN 6840 /* Unprocessed path gain */
-#define LVCS_EX_HEADPHONE_SHIFT 3 /* EX Output Shift */
-#define LVCS_EX_HEADPHONE_SHIFTLOSS 18600 /* EX Output Shift loss */
-#define LVCS_EX_HEADPHONE_GAIN 5108 /* EX Unprocessed path gain */
-#endif
#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
index d4c7627..630ecf7 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
@@ -68,7 +68,6 @@
LVM_UINT32 ScratchSize;
LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
-
/*
* Fill in the memory table
*/
@@ -98,13 +97,9 @@
/*
* Scratch memory
*/
-#ifdef BUILD_FLOAT
/* Inplace processing */
ScratchSize = (LVM_UINT32) \
(LVCS_SCRATCHBUFFERS * sizeof(LVM_FLOAT) * pCapabilities->MaxBlockSize);
-#else
- ScratchSize = (LVM_UINT32)(LVCS_SCRATCHBUFFERS*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize); /* Inplace processing */
-#endif
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].Size = ScratchSize;
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].Type = LVCS_SCRATCH;
pMemoryTable->Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress = LVM_NULL;
@@ -118,7 +113,6 @@
return(LVCS_SUCCESS);
}
-
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Init */
@@ -160,7 +154,6 @@
LVCS_Instance_t *pInstance;
LVCS_VolCorrect_t *pLVCS_VolCorrectTable;
-
/*
* Set the instance handle if not already initialised
*/
@@ -170,7 +163,6 @@
}
pInstance =(LVCS_Instance_t *)*phInstance;
-
/*
* Save the capabilities in the instance structure
*/
@@ -181,7 +173,6 @@
*/
pInstance->MemoryTable = *pMemoryTable;
-
/*
* Set all initial parameters to invalid to force a full initialisation
*/
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
index 513758d..154ea55 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
@@ -27,8 +27,6 @@
#ifndef __LVCS_PRIVATE_H__
#define __LVCS_PRIVATE_H__
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -42,7 +40,6 @@
#include "LVCS_BypassMix.h" /* Bypass Mixer module definitions */
#include "LVM_Timer.h"
-
/************************************************************************************/
/* */
/* Defines */
@@ -80,7 +77,6 @@
#define LVCS_NR_OF_FS 9
#define LVCS_NR_OF_CHAN_CFG 2
-
/************************************************************************************/
/* */
/* Types */
@@ -95,7 +91,6 @@
LVCS_DEVICE_MAX = LVM_MAXENUM
} LVCS_OutputDevice_en;
-
/************************************************************************************/
/* */
/* Structures */
@@ -105,17 +100,10 @@
/* Volume correction structure */
typedef struct
{
-#ifdef BUILD_FLOAT
LVM_FLOAT CompFull; /* Post CS compression 100% effect */
LVM_FLOAT CompMin; /* Post CS compression 0% effect */
LVM_FLOAT GainFull; /* CS gain correct 100% effect */
LVM_FLOAT GainMin; /* CS gain correct 0% effect */
-#else
- LVM_INT16 CompFull; /* Post CS compression 100% effect */
- LVM_INT16 CompMin; /* Post CS compression 0% effect */
- LVM_INT16 GainFull; /* CS gain correct 100% effect */
- LVM_INT16 GainMin; /* CS gain correct 0% effect */
-#endif
} LVCS_VolCorrect_t;
/* Instance structure */
@@ -129,13 +117,8 @@
/* Private parameters */
LVCS_OutputDevice_en OutputDevice; /* Selected output device type */
LVCS_VolCorrect_t VolCorrect; /* Volume correction settings */
-#ifndef BUILD_FLOAT
- LVM_INT16 TransitionGain; /* Transition gain */
- LVM_INT16 CompressGain; /* Last used compressor gain*/
-#else
LVM_FLOAT TransitionGain; /* Transition gain */
LVM_FLOAT CompressGain; /* Last used compressor gain*/
-#endif
/* Sub-block configurations */
LVCS_StereoEnhancer_t StereoEnhancer; /* Stereo enhancer configuration */
@@ -156,41 +139,24 @@
/* Coefficient Structure */
typedef struct
{
-#ifdef BUILD_FLOAT
Biquad_FLOAT_Instance_t EqualiserBiquadInstance;
Biquad_FLOAT_Instance_t ReverbBiquadInstance;
Biquad_FLOAT_Instance_t SEBiquadInstanceMid;
Biquad_FLOAT_Instance_t SEBiquadInstanceSide;
-#else
- Biquad_Instance_t EqualiserBiquadInstance;
- Biquad_Instance_t ReverbBiquadInstance;
- Biquad_Instance_t SEBiquadInstanceMid;
- Biquad_Instance_t SEBiquadInstanceSide;
-#endif
} LVCS_Coefficient_t;
/* Data Structure */
typedef struct
{
-#ifdef BUILD_FLOAT
Biquad_2I_Order2_FLOAT_Taps_t EqualiserBiquadTaps;
Biquad_2I_Order2_FLOAT_Taps_t ReverbBiquadTaps;
Biquad_1I_Order1_FLOAT_Taps_t SEBiquadTapsMid;
Biquad_1I_Order2_FLOAT_Taps_t SEBiquadTapsSide;
-#else
- Biquad_2I_Order2_Taps_t EqualiserBiquadTaps;
- Biquad_2I_Order2_Taps_t ReverbBiquadTaps;
- Biquad_1I_Order1_Taps_t SEBiquadTapsMid;
- Biquad_1I_Order2_Taps_t SEBiquadTapsSide;
-#endif
} LVCS_Data_t;
void LVCS_TimerCallBack ( void* hInstance,
void* pCallBackParams,
LVM_INT32 CallbackParam);
-
-
#endif /* PRIVATE_H */
-
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp
index 56fb04f..8e09be2 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -66,7 +65,6 @@
/* NOTES: */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -178,74 +176,6 @@
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
- const LVM_INT16 *pInput;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVM_INT16 *pScratch = (LVM_INT16 *)pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
- LVCS_ReturnStatus_en err;
-
- /*
- * Check if the processing is inplace
- */
- if (pInData == pOutData)
- {
- /* Processing inplace */
- pInput = pScratch + (2*NumSamples);
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pInput, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
- }
- else
- {
- /* Processing outplace */
- pInput = pInData;
- }
-
- /*
- * Call the stereo enhancer
- */
- err=LVCS_StereoEnhancer(hInstance, /* Instance handle */
- pInData, /* Pointer to the input data */
- pOutData, /* Pointer to the output data */
- NumSamples); /* Number of samples to process */
-
- /*
- * Call the reverb generator
- */
- err=LVCS_ReverbGenerator(hInstance, /* Instance handle */
- pOutData, /* Pointer to the input data */
- pOutData, /* Pointer to the output data */
- NumSamples); /* Number of samples to process */
-
- /*
- * Call the equaliser
- */
- err=LVCS_Equaliser(hInstance, /* Instance handle */
- pOutData, /* Pointer to the input data */
- NumSamples); /* Number of samples to process */
-
- /*
- * Call the bypass mixer
- */
- err=LVCS_BypassMixer(hInstance, /* Instance handle */
- pOutData, /* Pointer to the processed data */
- pInput, /* Pointer to the input (unprocessed) data */
- pOutData, /* Pointer to the output data */
- NumSamples); /* Number of samples to process */
-
- if(err !=LVCS_SUCCESS)
- {
- return err;
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Process */
@@ -272,7 +202,6 @@
/* NOTES: */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -343,7 +272,6 @@
NumSamples);
#endif
-
/*
* Compress to reduce expansion effect of Concert Sound and correct volume
* differences for difference settings. Not applied in test modes
@@ -446,7 +374,6 @@
pInstance->CompressGain = Gain;
}
-
if(pInstance->bInOperatingModeTransition == LVM_TRUE){
/*
@@ -499,168 +426,5 @@
}
}
-
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance =(LVCS_Instance_t *)hInstance;
- LVCS_ReturnStatus_en err;
-
- /*
- * Check the number of samples is not too large
- */
- if (NumSamples > pInstance->Capabilities.MaxBlockSize)
- {
- return(LVCS_TOOMANYSAMPLES);
- }
-
- /*
- * Check if the algorithm is enabled
- */
- if (pInstance->Params.OperatingMode != LVCS_OFF)
- {
- /*
- * Call CS process function
- */
- err=LVCS_Process_CS(hInstance,
- pInData,
- pOutData,
- NumSamples);
-
- /*
- * Compress to reduce expansion effect of Concert Sound and correct volume
- * differences for difference settings. Not applied in test modes
- */
- if ((pInstance->Params.OperatingMode == LVCS_ON)&&(pInstance->Params.CompressorMode == LVM_MODE_ON))
- {
- LVM_INT16 Gain = pInstance->VolCorrect.CompMin;
- LVM_INT32 Current1;
-
- Current1 = LVC_Mixer_GetCurrent(&pInstance->BypassMix.Mixer_Instance.MixerStream[0]);
- Gain = (LVM_INT16)( pInstance->VolCorrect.CompMin
- - (((LVM_INT32)pInstance->VolCorrect.CompMin * (Current1)) >> 15)
- + (((LVM_INT32)pInstance->VolCorrect.CompFull * (Current1)) >> 15) );
-
- if(NumSamples < LVCS_COMPGAINFRAME)
- {
- NonLinComp_D16(Gain, /* Compressor gain setting */
- pOutData,
- pOutData,
- (LVM_INT32)(2*NumSamples));
- }
- else
- {
- LVM_INT16 GainStep;
- LVM_INT16 FinalGain;
- LVM_INT16 SampleToProcess = NumSamples;
- LVM_INT16 *pOutPtr;
-
- /* Large changes in Gain can cause clicks in output
- Split data into small blocks and use interpolated gain values */
-
- GainStep = (LVM_INT16)(((Gain-pInstance->CompressGain) * LVCS_COMPGAINFRAME)/NumSamples);
-
- if((GainStep ==0)&&(pInstance->CompressGain < Gain))
- {
- GainStep=1;
- }
- else
- {
- if((GainStep ==0)&&(pInstance->CompressGain > Gain))
- {
- GainStep=-1;
- }
- }
-
- FinalGain = Gain;
- Gain = pInstance->CompressGain;
- pOutPtr = pOutData;
-
- while(SampleToProcess > 0)
- {
- Gain = (LVM_INT16)(Gain + GainStep);
- if((GainStep > 0)&& (FinalGain <= Gain))
- {
- Gain = FinalGain;
- GainStep =0;
- }
-
- if((GainStep < 0)&& (FinalGain > Gain))
- {
- Gain = FinalGain;
- GainStep =0;
- }
-
- if(SampleToProcess > LVCS_COMPGAINFRAME)
- {
- NonLinComp_D16(Gain, /* Compressor gain setting */
- pOutPtr,
- pOutPtr,
- (LVM_INT32)(2*LVCS_COMPGAINFRAME));
- pOutPtr +=(2*LVCS_COMPGAINFRAME);
- SampleToProcess = (LVM_INT16)(SampleToProcess-LVCS_COMPGAINFRAME);
- }
- else
- {
- NonLinComp_D16(Gain, /* Compressor gain setting */
- pOutPtr,
- pOutPtr,
- (LVM_INT32)(2*SampleToProcess));
-
- SampleToProcess = 0;
- }
-
- }
- }
-
- /* Store gain value*/
- pInstance->CompressGain = Gain;
- }
-
-
- if(pInstance->bInOperatingModeTransition == LVM_TRUE){
-
- /*
- * Re-init bypass mix when timer has completed
- */
- if ((pInstance->bTimerDone == LVM_TRUE) &&
- (pInstance->BypassMix.Mixer_Instance.MixerStream[1].CallbackSet == 0))
- {
- err=LVCS_BypassMixInit(hInstance,
- &pInstance->Params);
-
- if(err != LVCS_SUCCESS)
- {
- return err;
- }
-
- }
- else{
- LVM_Timer ( &pInstance->TimerInstance,
- (LVM_INT16)NumSamples);
- }
- }
- }
- else
- {
- if (pInData != pOutData)
- {
- /*
- * The algorithm is disabled so just copy the data
- */
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
- }
- }
-
-
- return(LVCS_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
index fbdf57b..d0e6e09 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
@@ -57,7 +57,6 @@
/* 2. The numerator coefficients of the filter are negated to cause an inversion. */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -71,7 +70,6 @@
BQ_FLOAT_Coefs_t Coeffs;
const BiquadA012B12CoefsSP_t *pReverbCoefTable;
-
pData = (LVCS_Data_t *) \
pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
@@ -91,7 +89,6 @@
*/
Delay = (LVM_UINT16)LVCS_StereoDelayCS[(LVM_UINT16)pParams->SampleRate];
-
pConfig->DelaySize = (LVM_INT16)(2 * Delay);
pConfig->DelayOffset = 0;
LoadConst_Float(0, /* Value */
@@ -112,8 +109,7 @@
Coeffs.B2 = (LVM_FLOAT)-pReverbCoefTable[Offset].B2;
LoadConst_Float(0, /* Value */
- (LVM_FLOAT *)&pData->ReverbBiquadTaps, /* Destination Cast to void:
- no dereferencing in function*/
+ (LVM_FLOAT *)&pData->ReverbBiquadTaps, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->ReverbBiquadTaps) / sizeof(LVM_FLOAT)));
@@ -132,7 +128,6 @@
break;
}
-
/*
* Setup the mixer
*/
@@ -148,90 +143,6 @@
}
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
-
- LVM_UINT16 Delay;
- LVM_UINT16 Offset;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
- LVCS_Data_t *pData = (LVCS_Data_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
- LVCS_Coefficient_t *pCoefficients = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- BQ_C16_Coefs_t Coeffs;
- const BiquadA012B12CoefsSP_t *pReverbCoefTable;
-
- /*
- * Initialise the delay and filters if:
- * - the sample rate has changed
- * - the speaker type has changed to or from the mobile speaker
- */
- if(pInstance->Params.SampleRate != pParams->SampleRate ) /* Sample rate change test */
-
- {
- /*
- * Setup the delay
- */
- Delay = (LVM_UINT16)LVCS_StereoDelayCS[(LVM_UINT16)pParams->SampleRate];
-
-
- pConfig->DelaySize = (LVM_INT16)(2 * Delay);
- pConfig->DelayOffset = 0;
- LoadConst_16(0, /* Value */
- (LVM_INT16 *)&pConfig->StereoSamples[0], /* Destination */
- (LVM_UINT16)(sizeof(pConfig->StereoSamples)/sizeof(LVM_INT16))); /* Number of words */
-
- /*
- * Setup the filters
- */
- Offset = (LVM_UINT16)pParams->SampleRate;
- pReverbCoefTable = (BiquadA012B12CoefsSP_t*)&LVCS_ReverbCoefTable[0];
-
- /* Convert incoming coefficients to the required format/ordering */
- Coeffs.A0 = (LVM_INT16)pReverbCoefTable[Offset].A0;
- Coeffs.A1 = (LVM_INT16)pReverbCoefTable[Offset].A1;
- Coeffs.A2 = (LVM_INT16)pReverbCoefTable[Offset].A2;
- Coeffs.B1 = (LVM_INT16)-pReverbCoefTable[Offset].B1;
- Coeffs.B2 = (LVM_INT16)-pReverbCoefTable[Offset].B2;
-
- LoadConst_16(0, /* Value */
- (void *)&pData->ReverbBiquadTaps, /* Destination Cast to void: no dereferencing in function*/
- (LVM_UINT16)(sizeof(pData->ReverbBiquadTaps)/sizeof(LVM_INT16))); /* Number of words */
-
- BQ_2I_D16F16Css_TRC_WRA_01_Init(&pCoefficients->ReverbBiquadInstance,
- &pData->ReverbBiquadTaps,
- &Coeffs);
-
- /* Callbacks */
- switch(pReverbCoefTable[Offset].Scale)
- {
- case 14:
- pConfig->pBiquadCallBack = BQ_2I_D16F16C14_TRC_WRA_01;
- break;
- case 15:
- pConfig->pBiquadCallBack = BQ_2I_D16F16C15_TRC_WRA_01;
- break;
- }
-
-
- /*
- * Setup the mixer
- */
- pConfig->ProcGain = (LVM_UINT16)(HEADPHONEGAINPROC);
- pConfig->UnprocGain = (LVM_UINT16)(HEADPHONEGAINUNPROC);
- }
-
- if(pInstance->Params.ReverbLevel != pParams->ReverbLevel)
- {
- LVM_INT32 ReverbPercentage=83886; // 1 Percent Reverb i.e 1/100 in Q 23 format
- ReverbPercentage*=pParams->ReverbLevel; // Actual Reverb Level in Q 23 format
- pConfig->ReverbLevel=(LVM_INT16)(ReverbPercentage>>8); // Reverb Level in Q 15 format
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_Reverb */
@@ -270,7 +181,6 @@
/* 2. The Gain is combined with the LPF and incorporated in to the coefficients */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -301,7 +211,6 @@
(LVM_INT16)(2 * NumSamples)); /* Left and right */
}
-
/*
* Check if the reverb is required
*/
@@ -338,7 +247,6 @@
(LVM_FLOAT *)pScratch,
(LVM_INT16)(2 * NumSamples));
-
/*
* Apply the delay mix
*/
@@ -349,87 +257,7 @@
&pConfig->DelayOffset,
(LVM_INT16)NumSamples);
-
}
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
- LVCS_Coefficient_t *pCoefficients = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- LVM_INT16 *pScratch = (LVM_INT16 *)pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
-
-
- /*
- * Copy the data to the output in outplace processing
- */
- if (pInData != pOutData)
- {
- /*
- * Reverb not required so just copy the data
- */
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
- }
-
-
- /*
- * Check if the reverb is required
- */
- if (((pInstance->Params.SpeakerType == LVCS_HEADPHONE) || /* Disable when CS4MS in stereo mode */
- (pInstance->Params.SpeakerType == LVCS_EX_HEADPHONES) ||
- (pInstance->Params.SourceFormat != LVCS_STEREO)) &&
- ((pInstance->Params.OperatingMode & LVCS_REVERBSWITCH) !=0)) /* For validation testing */
- {
- /********************************************************************************/
- /* */
- /* Copy the input data to scratch memory and filter it */
- /* */
- /********************************************************************************/
-
- /*
- * Copy the input data to the scratch memory
- */
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pScratch, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
-
-
- /*
- * Filter the data
- */
- (pConfig->pBiquadCallBack)((Biquad_Instance_t*)&pCoefficients->ReverbBiquadInstance,
- (LVM_INT16 *)pScratch,
- (LVM_INT16 *)pScratch,
- (LVM_INT16)NumSamples);
-
- Mult3s_16x16( (LVM_INT16 *)pScratch,
- pConfig->ReverbLevel,
- (LVM_INT16 *)pScratch,
- (LVM_INT16)(2*NumSamples));
-
-
- /*
- * Apply the delay mix
- */
- DelayMix_16x16((LVM_INT16 *)pScratch,
- &pConfig->StereoSamples[0],
- pConfig->DelaySize,
- pOutData,
- &pConfig->DelayOffset,
- (LVM_INT16)NumSamples);
-
-
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
index c1c0207..1bc4338 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
@@ -18,8 +18,6 @@
#ifndef __LVCS_REVERBGENERATOR_H__
#define __LVCS_REVERBGENERATOR_H__
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -28,7 +26,6 @@
#include "LVC_Mixer.h"
-
/************************************************************************************/
/* */
/* Defines */
@@ -38,14 +35,12 @@
#define HEADPHONEGAINPROC LVCS_HEADPHONE_PROCGAIN
#define HEADPHONEGAINUNPROC LVCS_HEADPHONE_UNPROCGAIN
-
/************************************************************************************/
/* */
/* Structures */
/* */
/************************************************************************************/
-
/* Reverberation module structure */
typedef struct
{
@@ -55,23 +50,14 @@
LVM_INT16 DelayOffset;
LVM_INT16 ProcGain;
LVM_INT16 UnprocGain;
-#ifndef BUILD_FLOAT
- LVM_INT16 StereoSamples[2*LVCS_STEREODELAY_CS_48KHZ];
- /* Reverb Level */
- LVM_INT16 ReverbLevel;
- /* Filter */
- void (*pBiquadCallBack) (Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
-#else
LVM_FLOAT StereoSamples[2 * LVCS_STEREODELAY_CS_MAX_VAL];
/* Reverb Level */
LVM_FLOAT ReverbLevel;
/* Filter */
void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*,
LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
-#endif
} LVCS_ReverbGenerator_t;
-
/************************************************************************************/
/* */
/* Function prototypes */
@@ -80,16 +66,9 @@
LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInput,
LVM_FLOAT *pOutput,
LVM_UINT16 NumSamples);
-#else
-LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInput,
- LVM_INT16 *pOutput,
- LVM_UINT16 NumSamples);
-#endif
#endif /* REVERB_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp
index f73fc28..7fd8444 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp
@@ -49,7 +49,6 @@
/* NOTES: */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams)
{
@@ -63,7 +62,6 @@
BQ_FLOAT_Coefs_t CoeffsSide;
const BiquadA012B12CoefsSP_t *pSESideCoefs;
-
pData = (LVCS_Data_t *) \
pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
@@ -89,8 +87,7 @@
/* Clear the taps */
LoadConst_Float(0, /* Value */
- (LVM_FLOAT *)&pData->SEBiquadTapsMid, /* Destination Cast to void:\
- no dereferencing in function*/
+ (LVM_FLOAT *)&pData->SEBiquadTapsMid, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->SEBiquadTapsMid) / sizeof(LVM_FLOAT)));
@@ -117,8 +114,7 @@
/* Clear the taps */
LoadConst_Float(0, /* Value */
- (LVM_FLOAT *)&pData->SEBiquadTapsSide, /* Destination Cast to void:\
- no dereferencing in function*/
+ (LVM_FLOAT *)&pData->SEBiquadTapsSide, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->SEBiquadTapsSide) / sizeof(LVM_FLOAT)));
/* Callbacks */
@@ -142,99 +138,8 @@
}
-
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
-
- LVM_UINT16 Offset;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_StereoEnhancer_t *pConfig = (LVCS_StereoEnhancer_t *)&pInstance->StereoEnhancer;
- LVCS_Data_t *pData = (LVCS_Data_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_DATA].pBaseAddress;
- LVCS_Coefficient_t *pCoefficient = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- FO_C16_Coefs_t CoeffsMid;
- BQ_C16_Coefs_t CoeffsSide;
- const BiquadA012B12CoefsSP_t *pSESideCoefs;
-
- /*
- * If the sample rate or speaker type has changed update the filters
- */
- if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
- (pInstance->Params.SpeakerType != pParams->SpeakerType))
- {
- /*
- * Set the filter coefficients based on the sample rate
- */
- /* Mid filter */
- Offset = (LVM_UINT16)pParams->SampleRate;
-
- /* Convert incoming coefficients to the required format/ordering */
- CoeffsMid.A0 = (LVM_INT16) LVCS_SEMidCoefTable[Offset].A0;
- CoeffsMid.A1 = (LVM_INT16) LVCS_SEMidCoefTable[Offset].A1;
- CoeffsMid.B1 = (LVM_INT16)-LVCS_SEMidCoefTable[Offset].B1;
-
- /* Clear the taps */
- LoadConst_16(0, /* Value */
- (void *)&pData->SEBiquadTapsMid, /* Destination Cast to void:\
- no dereferencing in function*/
- (LVM_UINT16)(sizeof(pData->SEBiquadTapsMid)/sizeof(LVM_UINT16))); /* Number of words */
-
- FO_1I_D16F16Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceMid,
- &pData->SEBiquadTapsMid,
- &CoeffsMid);
-
- /* Callbacks */
- if(LVCS_SEMidCoefTable[Offset].Scale==15)
- {
- pConfig->pBiquadCallBack_Mid = FO_1I_D16F16C15_TRC_WRA_01;
- }
-
- Offset = (LVM_UINT16)(pParams->SampleRate);
- pSESideCoefs = (BiquadA012B12CoefsSP_t*)&LVCS_SESideCoefTable[0];
-
- /* Side filter */
- /* Convert incoming coefficients to the required format/ordering */
- CoeffsSide.A0 = (LVM_INT16) pSESideCoefs[Offset].A0;
- CoeffsSide.A1 = (LVM_INT16) pSESideCoefs[Offset].A1;
- CoeffsSide.A2 = (LVM_INT16) pSESideCoefs[Offset].A2;
- CoeffsSide.B1 = (LVM_INT16)-pSESideCoefs[Offset].B1;
- CoeffsSide.B2 = (LVM_INT16)-pSESideCoefs[Offset].B2;
-
- /* Clear the taps */
- LoadConst_16(0, /* Value */
- (void *)&pData->SEBiquadTapsSide, /* Destination Cast to void:\
- no dereferencing in function*/
- (LVM_UINT16)(sizeof(pData->SEBiquadTapsSide)/sizeof(LVM_UINT16))); /* Number of words */
-
-
- /* Callbacks */
- switch(pSESideCoefs[Offset].Scale)
- {
- case 14:
- BQ_1I_D16F32Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceSide,
- &pData->SEBiquadTapsSide,
- &CoeffsSide);
-
- pConfig->pBiquadCallBack_Side = BQ_1I_D16F32C14_TRC_WRA_01;
- break;
- case 15:
- BQ_1I_D16F16Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceSide,
- &pData->SEBiquadTapsSide,
- &CoeffsSide);
-
- pConfig->pBiquadCallBack_Side = BQ_1I_D16F16C15_TRC_WRA_01;
- break;
- }
-
- }
-
-
- return(LVCS_SUCCESS);
-}
-#endif
/************************************************************************************/
/* */
/* FUNCTION: LVCS_StereoEnhance */
@@ -273,7 +178,6 @@
/* 1. The side filter is not used in Mobile Speaker mode */
/* */
/************************************************************************************/
-#ifdef BUILD_FLOAT
LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
@@ -356,81 +260,3 @@
return(LVCS_SUCCESS);
}
-#else
-LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_StereoEnhancer_t *pConfig = (LVCS_StereoEnhancer_t *)&pInstance->StereoEnhancer;
- LVCS_Coefficient_t *pCoefficient = (LVCS_Coefficient_t *)pInstance->MemoryTable.Region[LVCS_MEMREGION_PERSISTENT_FAST_COEF].pBaseAddress;
- LVM_INT16 *pScratch = (LVM_INT16 *)pInstance->MemoryTable.Region[LVCS_MEMREGION_TEMPORARY_FAST].pBaseAddress;
-
- /*
- * Check if the Stereo Enhancer is enabled
- */
- if ((pInstance->Params.OperatingMode & LVCS_STEREOENHANCESWITCH) != 0)
- {
- /*
- * Convert from stereo to middle and side
- */
- From2iToMS_16x16(pInData,
- pScratch,
- pScratch+NumSamples,
- (LVM_INT16)NumSamples);
-
- /*
- * Apply filter to the middle signal
- */
- if (pInstance->OutputDevice == LVCS_HEADPHONE)
- {
- (pConfig->pBiquadCallBack_Mid)((Biquad_Instance_t*)&pCoefficient->SEBiquadInstanceMid,
- (LVM_INT16 *)pScratch,
- (LVM_INT16 *)pScratch,
- (LVM_INT16)NumSamples);
- }
- else
- {
- Mult3s_16x16(pScratch, /* Source */
- (LVM_INT16)pConfig->MidGain, /* Gain */
- pScratch, /* Destination */
- (LVM_INT16)NumSamples); /* Number of samples */
- }
-
- /*
- * Apply the filter the side signal only in stereo mode for headphones
- * and in all modes for mobile speakers
- */
- if (pInstance->Params.SourceFormat == LVCS_STEREO)
- {
- (pConfig->pBiquadCallBack_Side)((Biquad_Instance_t*)&pCoefficient->SEBiquadInstanceSide,
- (LVM_INT16 *)(pScratch + NumSamples),
- (LVM_INT16 *)(pScratch + NumSamples),
- (LVM_INT16)NumSamples);
- }
-
- /*
- * Convert from middle and side to stereo
- */
- MSTo2i_Sat_16x16(pScratch,
- pScratch+NumSamples,
- pOutData,
- (LVM_INT16)NumSamples);
-
- }
- else
- {
- /*
- * The stereo enhancer is disabled so just copy the data
- */
- Copy_16((LVM_INT16 *)pInData, /* Source */
- (LVM_INT16 *)pOutData, /* Destination */
- (LVM_INT16)(2*NumSamples)); /* Left and right */
-
- }
-
- return(LVCS_SUCCESS);
-}
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
index 79ebb67..12a5982 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
@@ -18,8 +18,6 @@
#ifndef __LVCS_STEREOENHANCER_H__
#define __LVCS_STEREOENHANCER_H__
-
-
/************************************************************************************/
/* */
/* Includes */
@@ -30,7 +28,6 @@
#include "LVCS_Headphone_Coeffs.h" /* Headphone coefficients */
#include "BIQUAD.h"
-
/************************************************************************************/
/* */
/* Structures */
@@ -41,17 +38,6 @@
typedef struct
{
-#ifndef BUILD_FLOAT
- /*
- * Middle filter
- */
- void (*pBiquadCallBack_Mid)(Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
- /*
- * Side filter
- */
- void (*pBiquadCallBack_Side)(Biquad_Instance_t*, LVM_INT16*, LVM_INT16*, LVM_INT16);
- LVM_UINT16 MidGain; /* Middle gain in mobile speaker mode */
-#else
/*
* Middle filter
*/
@@ -64,10 +50,8 @@
void (*pBiquadCallBack_Side)(Biquad_FLOAT_Instance_t*,
LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
LVM_FLOAT MidGain; /* Middle gain in mobile speaker mode */
-#endif
} LVCS_StereoEnhancer_t;
-
/************************************************************************************/
/* */
/* Function prototypes */
@@ -77,16 +61,9 @@
LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
LVCS_Params_t *pParams);
-#ifndef BUILD_FLOAT
-LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
- const LVM_INT16 *pInData,
- LVM_INT16 *pOutData,
- LVM_UINT16 NumSamples);
-#else
LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
const LVM_FLOAT *pInData,
LVM_FLOAT *pOutData,
LVM_UINT16 NumSamples);
-#endif
#endif /* STEREOENHANCE_H */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp
index 1964c8c..d79db61 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
/************************************************************************************/
/* */
/* Includes */
@@ -28,7 +27,6 @@
#include "BIQUAD.h" /* Biquad definitions */
#include "LVCS_Headphone_Coeffs.h" /* Headphone coefficients */
-
/************************************************************************************/
/* */
/* Stereo Enhancer coefficient constant tables */
@@ -73,7 +71,6 @@
CS_MIDDLE_48000_A1,
CS_MIDDLE_48000_B1,
(LVM_UINT16 )CS_MIDDLE_48000_SCALE}
-#ifdef HIGHER_FS
,
{CS_MIDDLE_88200_A0, /* 88kS/s coefficients */
CS_MIDDLE_88200_A1,
@@ -91,7 +88,6 @@
CS_MIDDLE_192000_A1,
CS_MIDDLE_192000_B1,
(LVM_UINT16 )CS_MIDDLE_192000_SCALE}
-#endif
};
/* Coefficient table for the side filter */
@@ -151,7 +147,6 @@
CS_SIDE_48000_B1,
CS_SIDE_48000_B2,
(LVM_UINT16 )CS_SIDE_48000_SCALE}
-#ifdef HIGHER_FS
,
{CS_SIDE_88200_A0, /* 88kS/s coefficients */
CS_SIDE_88200_A1,
@@ -177,10 +172,8 @@
CS_SIDE_192000_B1,
CS_SIDE_192000_B2,
(LVM_UINT16 )CS_SIDE_192000_SCALE}
-#endif
};
-
/************************************************************************************/
/* */
/* Equaliser coefficient constant tables */
@@ -243,7 +236,6 @@
CS_EQUALISER_48000_B1,
CS_EQUALISER_48000_B2,
(LVM_UINT16 )CS_EQUALISER_48000_SCALE},
-#ifdef HIGHER_FS
{CS_EQUALISER_88200_A0, /* 88kS/s coeffieients */
CS_EQUALISER_88200_A1,
CS_EQUALISER_88200_A2,
@@ -268,7 +260,6 @@
CS_EQUALISER_192000_B1,
CS_EQUALISER_192000_B2,
(LVM_UINT16 )CS_EQUALISER_192000_SCALE},
-#endif
/* Concert Sound EX Headphone coefficients */
{CSEX_EQUALISER_8000_A0, /* 8kS/s coefficients */
@@ -325,7 +316,6 @@
CSEX_EQUALISER_48000_B1,
CSEX_EQUALISER_48000_B2,
(LVM_UINT16 )CSEX_EQUALISER_48000_SCALE}
-#ifdef HIGHER_FS
,
{CSEX_EQUALISER_88200_A0, /* 88kS/s coefficients */
CSEX_EQUALISER_88200_A1,
@@ -351,10 +341,8 @@
CSEX_EQUALISER_192000_B1,
CSEX_EQUALISER_192000_B2,
(LVM_UINT16 )CSEX_EQUALISER_192000_SCALE}
-#endif
};
-
/************************************************************************************/
/* */
/* Reverb delay constant tables */
@@ -440,7 +428,6 @@
CS_REVERB_48000_B1,
CS_REVERB_48000_B2,
(LVM_UINT16 )CS_REVERB_48000_SCALE}
-#ifdef HIGHER_FS
,
{CS_REVERB_88200_A0, /* 88kS/s coefficients */
CS_REVERB_88200_A1,
@@ -466,10 +453,8 @@
CS_REVERB_192000_B1,
CS_REVERB_192000_B2,
(LVM_UINT16 )CS_REVERB_192000_SCALE}
-#endif
};
-
/************************************************************************************/
/* */
/* Bypass mixer constant tables */
@@ -491,7 +476,6 @@
LVCS_EX_HEADPHONE_GAIN}
};
-
/************************************************************************************/
/* */
/* Volume correction table */
@@ -518,7 +502,6 @@
/* */
/************************************************************************************/
const LVCS_VolCorrect_t LVCS_VolCorrectTable[] = {
-#ifdef BUILD_FLOAT
{0.433362f, /* Headphone, stereo mode */
0.000000f,
1.000024f,
@@ -535,24 +518,6 @@
0.000000f,
1.000024f,
1.412640f}
-#else
- {14200, /* Headphone, stereo mode */
- 0,
- 4096,
- 5786},
- {14200, /* EX Headphone, stereo mode */
- 0,
- 4096,
- 5786},
- {32767, /* Headphone, mono mode */
- 0,
- 4096,
- 5786},
- {32767, /* EX Headphone, mono mode */
- 0,
- 4096,
- 5786}
-#endif
};
/************************************************************************************/
@@ -570,14 +535,11 @@
#define LVCS_VOL_TC_Fs32000 32721 /* Floating point value 0.998565674 */
#define LVCS_VOL_TC_Fs44100 32734 /* Floating point value 0.998962402 */
#define LVCS_VOL_TC_Fs48000 32737 /* Floating point value 0.999053955 */
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
#define LVCS_VOL_TC_Fs88200 32751 /* Floating point value 0.999481066 */
#define LVCS_VOL_TC_Fs96000 32751 /* Floating point value 0.999511703 */ /* Todo @ need to re check this value*/
#define LVCS_VOL_TC_Fs176400 32759 /* Floating point value 0.999740499 */
#define LVCS_VOL_TC_Fs192000 32763 /* Floating point value 0.999877925 */ /* Todo @ need to re check this value*/
-#endif
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
const LVM_INT16 LVCS_VolumeTCTable[13] = {LVCS_VOL_TC_Fs8000,
LVCS_VOL_TC_Fs11025,
LVCS_VOL_TC_Fs12000,
@@ -592,25 +554,12 @@
LVCS_VOL_TC_Fs176400,
LVCS_VOL_TC_Fs192000
};
-#else
-const LVM_INT16 LVCS_VolumeTCTable[9] = {LVCS_VOL_TC_Fs8000,
- LVCS_VOL_TC_Fs11025,
- LVCS_VOL_TC_Fs12000,
- LVCS_VOL_TC_Fs16000,
- LVCS_VOL_TC_Fs22050,
- LVCS_VOL_TC_Fs24000,
- LVCS_VOL_TC_Fs32000,
- LVCS_VOL_TC_Fs44100,
- LVCS_VOL_TC_Fs48000
-};
-#endif
/************************************************************************************/
/* */
/* Sample rate table */
/* */
/************************************************************************************/
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
const LVM_INT32 LVCS_SampleRateTable[13] = {8000,
11025,
12000,
@@ -625,15 +574,3 @@
176400,
192000
};
-#else
-const LVM_INT16 LVCS_SampleRateTable[9] = {8000,
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000
-};
-#endif
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
index 8609ad6..5490699 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
@@ -18,7 +18,6 @@
#ifndef __LVCS_TABLES_H__
#define __LVCS_TABLES_H__
-
/************************************************************************************/
/* */
/* Includes */
@@ -101,7 +100,6 @@
extern const LVCS_VolCorrect_t LVCS_VolCorrectTable[];
extern const LVM_INT16 LVCS_VolumeTCTable[];
-
/************************************************************************************/
/* */
/* Sample rates */
@@ -110,7 +108,6 @@
extern const LVM_INT32 LVCS_SampleRateTable[];
-
/*Speaker coeffient tables*/
extern LVM_UINT16 LVCS_MS_Small_SEMiddleGainTable[];
extern BiquadA012B12CoefsSP_t LVCS_MS_Small_SESideCoefTable[];
@@ -139,8 +136,5 @@
extern LVCS_VolCorrect_t LVCS_MS_Large_VolCorrectTable[];
extern LVM_UINT16 LVCS_MS_Large_ReverbGainTable[];
-
-
-
#endif /* __LVCS_TABLES_H__ */
diff --git a/media/libeffects/lvm/tests/Android.bp b/media/libeffects/lvm/tests/Android.bp
index 003ce9e..674c246 100644
--- a/media/libeffects/lvm/tests/Android.bp
+++ b/media/libeffects/lvm/tests/Android.bp
@@ -35,8 +35,6 @@
srcs: ["lvmtest.cpp"],
cflags: [
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-DSUPPORT_MC",
"-Wall",
diff --git a/media/libeffects/lvm/tests/lvmtest.cpp b/media/libeffects/lvm/tests/lvmtest.cpp
index 5b58dd1..a4ace6c 100644
--- a/media/libeffects/lvm/tests/lvmtest.cpp
+++ b/media/libeffects/lvm/tests/lvmtest.cpp
@@ -482,10 +482,6 @@
pContext->pBundledContext->SamplesToExitCountVirt = 0;
pContext->pBundledContext->SamplesToExitCountBb = 0;
pContext->pBundledContext->SamplesToExitCountEq = 0;
-#if defined(BUILD_FLOAT) && !defined(NATIVE_FLOAT_BUFFER)
- pContext->pBundledContext->pInputBuffer = NULL;
- pContext->pBundledContext->pOutputBuffer = NULL;
-#endif
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
}
diff --git a/media/libeffects/lvm/wrapper/Android.bp b/media/libeffects/lvm/wrapper/Android.bp
index 5fb6d12..afc4220 100644
--- a/media/libeffects/lvm/wrapper/Android.bp
+++ b/media/libeffects/lvm/wrapper/Android.bp
@@ -1,6 +1,3 @@
-// The wrapper -DBUILD_FLOAT needs to match
-// the lvm library -DBUILD_FLOAT.
-
// music bundle wrapper
cc_library_shared {
name: "libbundlewrapper",
@@ -16,8 +13,6 @@
cppflags: [
"-fvisibility=hidden",
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-DSUPPORT_MC",
"-Wall",
@@ -58,8 +53,6 @@
cppflags: [
"-fvisibility=hidden",
- "-DBUILD_FLOAT",
- "-DHIGHER_FS",
"-Wall",
"-Werror",
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 0a2850f..6fca0e7 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -81,7 +81,6 @@
} \
}
-
// NXP SW BassBoost UUID
const effect_descriptor_t gBassBoostDescriptor = {
{0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
@@ -258,26 +257,6 @@
pContext->pBundledContext->firstVolume = LVM_TRUE;
pContext->pBundledContext->volume = 0;
- #ifdef LVM_PCM
- char fileName[256];
- snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_in.pcm", pContext->pBundledContext);
- pContext->pBundledContext->PcmInPtr = fopen(fileName, "w");
- if (pContext->pBundledContext->PcmInPtr == NULL) {
- ALOGV("cannot open %s", fileName);
- ret = -EINVAL;
- goto exit;
- }
-
- snprintf(fileName, 256, "/data/tmp/bundle_%p_pcm_out.pcm", pContext->pBundledContext);
- pContext->pBundledContext->PcmOutPtr = fopen(fileName, "w");
- if (pContext->pBundledContext->PcmOutPtr == NULL) {
- ALOGV("cannot open %s", fileName);
- fclose(pContext->pBundledContext->PcmInPtr);
- pContext->pBundledContext->PcmInPtr = NULL;
- ret = -EINVAL;
- goto exit;
- }
- #endif
/* Saved strength is used to return the exact strength that was used in the set to the get
* because we map the original strength range of 0:1000 to 1:15, and this will avoid
@@ -295,10 +274,6 @@
pContext->pBundledContext->SamplesToExitCountVirt = 0;
pContext->pBundledContext->SamplesToExitCountBb = 0;
pContext->pBundledContext->SamplesToExitCountEq = 0;
-#if defined(BUILD_FLOAT) && !defined(NATIVE_FLOAT_BUFFER)
- pContext->pBundledContext->pInputBuffer = NULL;
- pContext->pBundledContext->pOutputBuffer = NULL;
-#endif
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
}
@@ -443,17 +418,6 @@
(pSessionContext->bEqualizerInstantiated ==LVM_FALSE) &&
(pSessionContext->bVirtualizerInstantiated==LVM_FALSE))
{
-#ifdef LVM_PCM
- if (pContext->pBundledContext->PcmInPtr != NULL) {
- fclose(pContext->pBundledContext->PcmInPtr);
- pContext->pBundledContext->PcmInPtr = NULL;
- }
- if (pContext->pBundledContext->PcmOutPtr != NULL) {
- fclose(pContext->pBundledContext->PcmOutPtr);
- pContext->pBundledContext->PcmOutPtr = NULL;
- }
-#endif
-
// Clear the SessionIndex
for(int i=0; i<LVM_MAX_SESSIONS; i++){
@@ -474,10 +438,6 @@
if (pContext->pBundledContext->workBuffer != NULL) {
free(pContext->pBundledContext->workBuffer);
}
-#if defined(BUILD_FLOAT) && !defined(NATIVE_FLOAT_BUFFER)
- free(pContext->pBundledContext->pInputBuffer);
- free(pContext->pBundledContext->pOutputBuffer);
-#endif
delete pContext->pBundledContext;
pContext->pBundledContext = LVM_NULL;
}
@@ -759,7 +719,6 @@
// pOut: pointer to updated stereo 16 bit output data
//
//----------------------------------------------------------------------------
-#ifdef BUILD_FLOAT
int LvmBundle_process(effect_buffer_t *pIn,
effect_buffer_t *pOut,
int frameCount,
@@ -769,30 +728,6 @@
effect_buffer_t *pOutTmp;
const LVM_INT32 NrChannels =
audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
-#ifndef NATIVE_FLOAT_BUFFER
- if (pContext->pBundledContext->pInputBuffer == nullptr ||
- pContext->pBundledContext->frameCount < frameCount) {
- free(pContext->pBundledContext->pInputBuffer);
- pContext->pBundledContext->pInputBuffer =
- (LVM_FLOAT *)calloc(frameCount, sizeof(LVM_FLOAT) * NrChannels);
- }
-
- if (pContext->pBundledContext->pOutputBuffer == nullptr ||
- pContext->pBundledContext->frameCount < frameCount) {
- free(pContext->pBundledContext->pOutputBuffer);
- pContext->pBundledContext->pOutputBuffer =
- (LVM_FLOAT *)calloc(frameCount, sizeof(LVM_FLOAT) * NrChannels);
- }
-
- if (pContext->pBundledContext->pInputBuffer == nullptr ||
- pContext->pBundledContext->pOutputBuffer == nullptr) {
- ALOGE("LVM_ERROR : LvmBundle_process memory allocation for float buffer's failed");
- return -EINVAL;
- }
-
- LVM_FLOAT * const pInputBuff = pContext->pBundledContext->pInputBuffer;
- LVM_FLOAT * const pOutputBuff = pContext->pBundledContext->pOutputBuffer;
-#endif
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){
pOutTmp = pOut;
@@ -814,123 +749,25 @@
return -EINVAL;
}
-#ifdef LVM_PCM
- fwrite(pIn,
- frameCount * sizeof(effect_buffer_t) * NrChannels,
- 1,
- pContext->pBundledContext->PcmInPtr);
- fflush(pContext->pBundledContext->PcmInPtr);
-#endif
-#ifndef NATIVE_FLOAT_BUFFER
- /* Converting input data from fixed point to float point */
- memcpy_to_float_from_i16(pInputBuff, pIn, frameCount * NrChannels);
-
- /* Process the samples */
- LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
- pInputBuff, /* Input buffer */
- pOutputBuff, /* Output buffer */
- (LVM_UINT16)frameCount, /* Number of samples to read */
- 0); /* Audio Time */
-
- /* Converting output data from float point to fixed point */
- memcpy_to_i16_from_float(pOutTmp, pOutputBuff, frameCount * NrChannels);
-
-#else
/* Process the samples */
LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
pIn, /* Input buffer */
pOutTmp, /* Output buffer */
(LVM_UINT16)frameCount, /* Number of samples to read */
0); /* Audio Time */
-#endif
LVM_ERROR_CHECK(LvmStatus, "LVM_Process", "LvmBundle_process")
if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-#ifdef LVM_PCM
- fwrite(pOutTmp,
- frameCount * sizeof(effect_buffer_t) * NrChannels,
- 1,
- pContext->pBundledContext->PcmOutPtr);
- fflush(pContext->pBundledContext->PcmOutPtr);
-#endif
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
for (int i = 0; i < frameCount * NrChannels; i++) {
-#ifndef NATIVE_FLOAT_BUFFER
- pOut[i] = clamp16((LVM_INT32)pOut[i] + (LVM_INT32)pOutTmp[i]);
-#else
pOut[i] = pOut[i] + pOutTmp[i];
-#endif
}
}
return 0;
} /* end LvmBundle_process */
-#else // BUILD_FLOAT
-
-int LvmBundle_process(LVM_INT16 *pIn,
- LVM_INT16 *pOut,
- int frameCount,
- EffectContext *pContext) {
-
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
- LVM_INT16 *pOutTmp;
-
- if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){
- pOutTmp = pOut;
- } else if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
- if (pContext->pBundledContext->frameCount != frameCount) {
- if (pContext->pBundledContext->workBuffer != NULL) {
- free(pContext->pBundledContext->workBuffer);
- }
- pContext->pBundledContext->workBuffer =
- (effect_buffer_t *)calloc(frameCount, sizeof(effect_buffer_t) * FCC_2);
- if (pContext->pBundledContext->workBuffer == NULL) {
- return -ENOMEM;
- }
- pContext->pBundledContext->frameCount = frameCount;
- }
- pOutTmp = pContext->pBundledContext->workBuffer;
- } else {
- ALOGV("LVM_ERROR : LvmBundle_process invalid access mode");
- return -EINVAL;
- }
-
-#ifdef LVM_PCM
- fwrite(pIn, frameCount * sizeof(*pIn) * FCC_2,
- 1 /* nmemb */, pContext->pBundledContext->PcmInPtr);
- fflush(pContext->pBundledContext->PcmInPtr);
-#endif
-
- //ALOGV("Calling LVM_Process");
-
- /* Process the samples */
- LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
- pIn, /* Input buffer */
- pOutTmp, /* Output buffer */
- (LVM_UINT16)frameCount, /* Number of samples to read */
- 0); /* Audio Time */
-
- LVM_ERROR_CHECK(LvmStatus, "LVM_Process", "LvmBundle_process")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
-
-#ifdef LVM_PCM
- fwrite(pOutTmp, frameCount * sizeof(*pOutTmp) * FCC_2,
- 1 /* nmemb */, pContext->pBundledContext->PcmOutPtr);
- fflush(pContext->pBundledContext->PcmOutPtr);
-#endif
-
- if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
- for (int i=0; i<frameCount*2; i++){
- pOut[i] = clamp16((LVM_INT32)pOut[i] + (LVM_INT32)pOutTmp[i]);
- }
- }
- return 0;
-} /* end LvmBundle_process */
-
-#endif // BUILD_FLOAT
-
//----------------------------------------------------------------------------
// EqualizerUpdateActiveParams()
//----------------------------------------------------------------------------
@@ -953,7 +790,6 @@
//ALOGV("\tEqualizerUpdateActiveParams just Got -> %d\n",
// ActiveParams.pEQNB_BandDefinition[band].Gain);
-
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
ActiveParams.pEQNB_BandDefinition[i].Frequency = EQNB_5BandPresetsFrequencies[i];
ActiveParams.pEQNB_BandDefinition[i].QFactor = EQNB_5BandPresetsQFactors[i];
@@ -1290,7 +1126,6 @@
SampleRate = LVM_FS_48000;
pContext->pBundledContext->SamplesPerSecond = 48000 * NrChannels;
break;
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
case 88200:
SampleRate = LVM_FS_88200;
pContext->pBundledContext->SamplesPerSecond = 88200 * NrChannels;
@@ -1307,7 +1142,6 @@
SampleRate = LVM_FS_192000;
pContext->pBundledContext->SamplesPerSecond = 192000 * NrChannels;
break;
-#endif
default:
ALOGV("\tEffect_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
@@ -2051,8 +1885,6 @@
LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
LVM_INT16 Balance = 0;
-
-
pContext->pBundledContext->positionSaved = position;
Balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
@@ -2097,7 +1929,6 @@
return 0;
} /* end VolumeSetStereoPosition */
-
//----------------------------------------------------------------------------
// VolumeGetStereoPosition()
//----------------------------------------------------------------------------
@@ -2970,7 +2801,6 @@
return status;
} /* end Volume_getParameter */
-
//----------------------------------------------------------------------------
// Volume_setParameter()
//----------------------------------------------------------------------------
@@ -3422,17 +3252,10 @@
pContext->pBundledContext->NumberEffectsCalled = 0;
/* Process all the available frames, block processing is
handled internalLY by the LVM bundle */
-#ifdef NATIVE_FLOAT_BUFFER
processStatus = android::LvmBundle_process(inBuffer->f32,
outBuffer->f32,
outBuffer->frameCount,
pContext);
-#else
- processStatus = android::LvmBundle_process(inBuffer->s16,
- outBuffer->s16,
- outBuffer->frameCount,
- pContext);
-#endif
if (processStatus != 0){
ALOGV("\tLVM_ERROR : LvmBundle_process returned error %d", processStatus);
if (status == 0) {
@@ -3447,11 +3270,7 @@
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
for (size_t i = 0; i < outBuffer->frameCount * NrChannels; ++i) {
-#ifdef NATIVE_FLOAT_BUFFER
outBuffer->f32[i] += inBuffer->f32[i];
-#else
- outBuffer->s16[i] = clamp16((LVM_INT32)outBuffer->s16[i] + inBuffer->s16[i]);
-#endif
}
} else if (outBuffer->raw != inBuffer->raw) {
memcpy(outBuffer->raw,
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
index d8e2ec6..524e103 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
@@ -23,7 +23,6 @@
#include <LVM.h>
#include <limits.h>
-
#define FIVEBAND_NUMBANDS 5
#define MAX_NUM_BANDS 5
#define MAX_CALL_SIZE 256
@@ -34,7 +33,6 @@
#define EQUALIZER_CUP_LOAD_ARM9E 220 // Expressed in 0.1 MIPS
#define VOLUME_CUP_LOAD_ARM9E 0 // Expressed in 0.1 MIPS
#define BUNDLE_MEM_USAGE 25 // Expressed in kB
-//#define LVM_PCM
#ifndef OPENSL_ES_H_
static const effect_uuid_t SL_IID_VOLUME_ = { 0x09e8ede0, 0xddde, 0x11db, 0xb4f6,
@@ -96,14 +94,6 @@
int frameCount;
int32_t bandGaindB[FIVEBAND_NUMBANDS];
int volume;
- #ifdef LVM_PCM
- FILE *PcmInPtr;
- FILE *PcmOutPtr;
- #endif
-#if defined(BUILD_FLOAT) && !defined(NATIVE_FLOAT_BUFFER)
- LVM_FLOAT *pInputBuffer;
- LVM_FLOAT *pOutputBuffer;
-#endif
#ifdef SUPPORT_MC
LVM_INT32 ChMask;
#endif
@@ -134,7 +124,6 @@
BundledEffectContext *pBundledContext;
};
-
/* enumerated parameter settings for Volume effect */
typedef enum
{
@@ -225,6 +214,4 @@
static const float LimitLevel_virtualizerContribution = 1.9;
-
-
#endif /*ANDROID_EFFECTBUNDLE_H_*/
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 602f607..1cb81a6 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -79,7 +79,6 @@
{-400, -200, 1300, 900, 0, 2, 0, 10, 1000, 750},
};
-
// NXP SW auxiliary environmental reverb
const effect_descriptor_t gAuxEnvReverbDescriptor = {
{ 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e } },
@@ -136,11 +135,7 @@
&gInsertPresetReverbDescriptor
};
-#ifdef BUILD_FLOAT
typedef float process_buffer_t; // process in float
-#else
-typedef int32_t process_buffer_t; // process in Q4_27
-#endif // BUILD_FLOAT
struct ReverbContext{
const struct effect_interface_s *itfe;
@@ -154,10 +149,6 @@
int16_t SavedDiffusion;
int16_t SavedDensity;
bool bEnabled;
- #ifdef LVM_PCM
- FILE *PcmInPtr;
- FILE *PcmOutPtr;
- #endif
LVM_Fs_en SampleRate;
process_buffer_t *InFrames;
process_buffer_t *OutFrames;
@@ -183,11 +174,7 @@
#define REVERB_DEFAULT_PRESET REVERB_PRESET_NONE
-#ifdef BUILD_FLOAT
#define REVERB_SEND_LEVEL 0.75f // 0.75 in 4.12 format
-#else
-#define REVERB_SEND_LEVEL (0x0C00) // 0.75 in 4.12 format
-#endif
#define REVERB_UNIT_VOLUME (0x1000) // 1.0 in 4.12 format
//--- local function prototypes
@@ -269,18 +256,6 @@
*pHandle = (effect_handle_t)pContext;
-#ifdef LVM_PCM
- pContext->PcmInPtr = NULL;
- pContext->PcmOutPtr = NULL;
-
- pContext->PcmInPtr = fopen("/data/tmp/reverb_pcm_in.pcm", "w");
- pContext->PcmOutPtr = fopen("/data/tmp/reverb_pcm_out.pcm", "w");
-
- if((pContext->PcmInPtr == NULL)||
- (pContext->PcmOutPtr == NULL)){
- return -EINVAL;
- }
-#endif
int channels = audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
@@ -304,10 +279,6 @@
return -EINVAL;
}
- #ifdef LVM_PCM
- fclose(pContext->PcmInPtr);
- fclose(pContext->PcmOutPtr);
- #endif
free(pContext->InFrames);
free(pContext->OutFrames);
pContext->bufferSizeIn = 0;
@@ -378,7 +349,6 @@
return -EINVAL;
}
-#ifdef BUILD_FLOAT
size_t inSize = frameCount * sizeof(process_buffer_t) * channels;
size_t outSize = frameCount * sizeof(process_buffer_t) * FCC_2;
if (pContext->InFrames == NULL ||
@@ -394,10 +364,6 @@
pContext->OutFrames = (process_buffer_t *)calloc(1, pContext->bufferSizeOut);
}
-#ifndef NATIVE_FLOAT_BUFFER
- effect_buffer_t * const OutFrames16 = (effect_buffer_t *)pContext->OutFrames;
-#endif
-#endif
// Check for NULL pointers
if ((pContext->InFrames == NULL) || (pContext->OutFrames == NULL)) {
@@ -405,47 +371,20 @@
return -EINVAL;
}
-#ifdef LVM_PCM
- fwrite(pIn, frameCount * sizeof(*pIn) * channels, 1 /* nmemb */, pContext->PcmInPtr);
- fflush(pContext->PcmInPtr);
-#endif
if (pContext->preset && pContext->nextPreset != pContext->curPreset) {
Reverb_LoadPreset(pContext);
}
if (pContext->auxiliary) {
-#ifdef BUILD_FLOAT
-#ifdef NATIVE_FLOAT_BUFFER
static_assert(std::is_same<decltype(*pIn), decltype(*pContext->InFrames)>::value,
"pIn and InFrames must be same type");
memcpy(pContext->InFrames, pIn, frameCount * channels * sizeof(*pIn));
-#else
- memcpy_to_float_from_i16(
- pContext->InFrames, pIn, frameCount * channels);
-#endif
-#else //no BUILD_FLOAT
- for (int i = 0; i < frameCount * channels; i++) {
- pContext->InFrames[i] = (process_buffer_t)pIn[i]<<8;
- }
-#endif
} else {
// insert reverb input is always stereo
for (int i = 0; i < frameCount; i++) {
-#ifdef BUILD_FLOAT
-#ifdef NATIVE_FLOAT_BUFFER
pContext->InFrames[2 * i] = (process_buffer_t)pIn[2 * i] * REVERB_SEND_LEVEL;
pContext->InFrames[2 * i + 1] = (process_buffer_t)pIn[2 * i + 1] * REVERB_SEND_LEVEL;
-#else
- pContext->InFrames[2 * i] =
- (process_buffer_t)pIn[2 * i] * REVERB_SEND_LEVEL / 32768.0f;
- pContext->InFrames[2 * i + 1] =
- (process_buffer_t)pIn[2 * i + 1] * REVERB_SEND_LEVEL / 32768.0f;
-#endif
-#else
- pContext->InFrames[2*i] = (pIn[2*i] * REVERB_SEND_LEVEL) >> 4; // <<8 + >>12
- pContext->InFrames[2*i+1] = (pIn[2*i+1] * REVERB_SEND_LEVEL) >> 4; // <<8 + >>12
-#endif
}
}
@@ -471,43 +410,16 @@
// Convert to 16 bits
if (pContext->auxiliary) {
-#ifdef BUILD_FLOAT
// nothing to do here
-#ifndef NATIVE_FLOAT_BUFFER
- // pContext->OutFrames and OutFrames16 point to the same buffer
- // make sure the float to int conversion happens in the right order.
- memcpy_to_i16_from_float(OutFrames16, pContext->OutFrames,
- (size_t)frameCount * FCC_2);
-#endif
-#else
- memcpy_to_i16_from_q4_27(OutFrames16, pContext->OutFrames, (size_t)frameCount * FCC_2);
-#endif
} else {
-#ifdef BUILD_FLOAT
-#ifdef NATIVE_FLOAT_BUFFER
for (int i = 0; i < frameCount * FCC_2; i++) { // always stereo here
// Mix with dry input
pContext->OutFrames[i] += pIn[i];
}
-#else
- for (int i = 0; i < frameCount * FCC_2; i++) { // always stereo here
- // pOutputBuff and OutFrames16 point to the same buffer
- // make sure the float to int conversion happens in the right order.
- pContext->OutFrames[i] += (process_buffer_t)pIn[i] / 32768.0f;
- }
- memcpy_to_i16_from_float(OutFrames16, pContext->OutFrames,
- (size_t)frameCount * FCC_2);
-#endif
-#else
- for (int i=0; i < frameCount * FCC_2; i++) { // always stereo here
- OutFrames16[i] = clamp16((pContext->OutFrames[i]>>8) + (process_buffer_t)pIn[i]);
- }
-#endif
// apply volume with ramp if needed
if ((pContext->leftVolume != pContext->prevLeftVolume ||
pContext->rightVolume != pContext->prevRightVolume) &&
pContext->volumeMode == REVERB_VOLUME_RAMP) {
-#if defined (BUILD_FLOAT) && defined (NATIVE_FLOAT_BUFFER)
// FIXME: still using int16 volumes.
// For reference: REVERB_UNIT_VOLUME (0x1000) // 1.0 in 4.12 format
float vl = (float)pContext->prevLeftVolume / 4096;
@@ -522,37 +434,14 @@
vl += incl;
vr += incr;
}
-#else
- LVM_INT32 vl = (LVM_INT32)pContext->prevLeftVolume << 16;
- LVM_INT32 incl = (((LVM_INT32)pContext->leftVolume << 16) - vl) / frameCount;
- LVM_INT32 vr = (LVM_INT32)pContext->prevRightVolume << 16;
- LVM_INT32 incr = (((LVM_INT32)pContext->rightVolume << 16) - vr) / frameCount;
-
- for (int i = 0; i < frameCount; i++) {
- OutFrames16[FCC_2 * i] =
- clamp16((LVM_INT32)((vl >> 16) * OutFrames16[2*i]) >> 12);
- OutFrames16[FCC_2 * i + 1] =
- clamp16((LVM_INT32)((vr >> 16) * OutFrames16[2*i+1]) >> 12);
-
- vl += incl;
- vr += incr;
- }
-#endif
pContext->prevLeftVolume = pContext->leftVolume;
pContext->prevRightVolume = pContext->rightVolume;
} else if (pContext->volumeMode != REVERB_VOLUME_OFF) {
if (pContext->leftVolume != REVERB_UNIT_VOLUME ||
pContext->rightVolume != REVERB_UNIT_VOLUME) {
for (int i = 0; i < frameCount; i++) {
-#if defined(BUILD_FLOAT) && defined(NATIVE_FLOAT_BUFFER)
pContext->OutFrames[FCC_2 * i] *= ((float)pContext->leftVolume / 4096);
pContext->OutFrames[FCC_2 * i + 1] *= ((float)pContext->rightVolume / 4096);
-#else
- OutFrames16[FCC_2 * i] =
- clamp16((LVM_INT32)(pContext->leftVolume * OutFrames16[2*i]) >> 12);
- OutFrames16[FCC_2 * i + 1] =
- clamp16((LVM_INT32)(pContext->rightVolume * OutFrames16[2*i+1]) >> 12);
-#endif
}
}
pContext->prevLeftVolume = pContext->leftVolume;
@@ -561,21 +450,12 @@
}
}
-#ifdef LVM_PCM
- fwrite(pContext->OutFrames, frameCount * sizeof(*pContext->OutFrames) * FCC_2,
- 1 /* nmemb */, pContext->PcmOutPtr);
- fflush(pContext->PcmOutPtr);
-#endif
// Accumulate if required
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
//ALOGV("\tBuffer access is ACCUMULATE");
for (int i = 0; i < frameCount * FCC_2; i++) { // always stereo here
-#ifndef NATIVE_FLOAT_BUFFER
- pOut[i] = clamp16((int32_t)pOut[i] + (int32_t)OutFrames16[i]);
-#else
pOut[i] += pContext->OutFrames[i];
-#endif
}
}else{
//ALOGV("\tBuffer access is WRITE");
@@ -654,7 +534,6 @@
//ALOGV("\tReverb_setConfig calling memcpy");
pContext->config = *pConfig;
-
switch (pConfig->inputCfg.samplingRate) {
case 8000:
SampleRate = LVM_FS_8000;
@@ -674,7 +553,6 @@
case 48000:
SampleRate = LVM_FS_48000;
break;
-#if defined(BUILD_FLOAT) && defined(HIGHER_FS)
case 88200:
SampleRate = LVM_FS_88200;
break;
@@ -687,7 +565,6 @@
case 192000:
SampleRate = LVM_FS_192000;
break;
-#endif
default:
ALOGV("\rReverb_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
return -EINVAL;
@@ -1509,7 +1386,6 @@
//ALOGV("\tReverbGetDensity Succesfully returned from LVM_GetControlParameters\n");
//ALOGV("\tReverbGetDensity() just Got -> %d\n", ActiveParams.RoomSize);
-
Temp = (LVM_INT16)(((pContext->SavedDensity * 99) / 1000) + 1);
if(Temp != ActiveParams.RoomSize){
@@ -1557,7 +1433,6 @@
return 0;
}
-
//----------------------------------------------------------------------------
// Reverb_getParameter()
//----------------------------------------------------------------------------
@@ -1903,7 +1778,6 @@
return status;
} /* end Reverb_setParameter */
-
/**
* returns the size in bytes of the value of each environmental reverb parameter
*/
@@ -1951,17 +1825,10 @@
}
//ALOGV("\tReverb_process() Calling process with %d frames", outBuffer->frameCount);
/* Process all the available frames, block processing is handled internalLY by the LVM bundle */
-#if defined (BUILD_FLOAT) && defined (NATIVE_FLOAT_BUFFER)
status = process( inBuffer->f32,
outBuffer->f32,
outBuffer->frameCount,
pContext);
-#else
- status = process( inBuffer->s16,
- outBuffer->s16,
- outBuffer->frameCount,
- pContext);
-#endif
if (pContext->bEnabled == LVM_FALSE) {
if (pContext->SamplesToExitCount > 0) {
@@ -1986,7 +1853,6 @@
LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
-
if (pContext == NULL){
ALOGV("\tLVM_ERROR : Reverb_command ERROR pContext == NULL");
return -EINVAL;
@@ -2161,7 +2027,6 @@
return -EINVAL;
}
-
if (pReplyData != NULL) { // we have volume control
pContext->leftVolume = (LVM_INT16)((*(uint32_t *)pCmdData + (1 << 11)) >> 12);
pContext->rightVolume = (LVM_INT16)((*((uint32_t *)pCmdData + 1) + (1 << 11)) >> 12);
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
index b2d47af..96223a8 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
@@ -20,7 +20,6 @@
#include <audio_effects/effect_environmentalreverb.h>
#include <audio_effects/effect_presetreverb.h>
-
#define MAX_NUM_BANDS 5
#define MAX_CALL_SIZE 256
#define LVREV_MAX_T60 7000
@@ -28,7 +27,6 @@
#define LVREV_MAX_FRAME_SIZE 2560
#define LVREV_CUP_LOAD_ARM9E 470 // Expressed in 0.1 MIPS
#define LVREV_MEM_USAGE (71+(LVREV_MAX_FRAME_SIZE>>7)) // Expressed in kB
-//#define LVM_PCM
typedef struct _LPFPair_t
{
@@ -36,5 +34,4 @@
int16_t LPF;
} LPFPair_t;
-
#endif /*ANDROID_EFFECTREVERB_H_*/
diff --git a/media/libmedia/aidl/android/media/IResourceManagerService.aidl b/media/libmedia/aidl/android/media/IResourceManagerService.aidl
index 3e6f8db..3dd0859 100644
--- a/media/libmedia/aidl/android/media/IResourceManagerService.aidl
+++ b/media/libmedia/aidl/android/media/IResourceManagerService.aidl
@@ -84,4 +84,14 @@
* @return true if the reclaim was successful and false otherwise.
*/
boolean reclaimResource(int callingPid, in MediaResourceParcel[] resources);
+
+ /**
+ * Override the pid of original calling process with the pid of the process
+ * who actually use the requested resources.
+ *
+ * @param originalPid pid of the original calling process.
+ * @param newPid pid of the actual process who use the resources.
+ * remove existing override on originalPid if newPid is -1.
+ */
+ void overridePid(int originalPid, int newPid);
}
diff --git a/media/libmediahelper/TypeConverter.cpp b/media/libmediahelper/TypeConverter.cpp
index d300c7a..6382ce4 100644
--- a/media/libmediahelper/TypeConverter.cpp
+++ b/media/libmediahelper/TypeConverter.cpp
@@ -315,6 +315,7 @@
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_ASSISTANT),
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_REROUTING),
MAKE_STRING_FROM_ENUM(AUDIO_STREAM_PATCH),
+ MAKE_STRING_FROM_ENUM(AUDIO_STREAM_CALL_ASSISTANT),
TERMINATOR
};
diff --git a/media/libmediametrics/include/MediaMetricsConstants.h b/media/libmediametrics/include/MediaMetricsConstants.h
index e49917f..eb7ac7d 100644
--- a/media/libmediametrics/include/MediaMetricsConstants.h
+++ b/media/libmediametrics/include/MediaMetricsConstants.h
@@ -70,6 +70,18 @@
// Underscores after the AMEDIAMETRICS_PROP_* prefix indicate
// a "dot" in the property name. For example AMEDIAMETRICS_PROP_VOLUME_LEFT
// corresponds to "volume.left".
+//
+// The property names are camel case, typically a lowercase letter [a-z]
+// followed by one or more characters in the range [a-zA-Z0-9_.].
+// Special symbols such as !@#$%^&*()[]{}<>,:;'"\/?|+-=~ are reserved.
+//
+// Properties within this header should include special suffixes like '#'
+// directly in the string for brevity. Code outside of this header should
+// use the macro constant for the special symbols for searchability.
+
+// Any property that ends with a # will have duplicate values listed instead
+// of suppressed in the Time Machine.
+#define AMEDIAMETRICS_PROP_SUFFIX_CHAR_DUPLICATES_ALLOWED '#'
#define AMEDIAMETRICS_PROP_AUXEFFECTID "auxEffectId" // int32 (AudioTrack)
#define AMEDIAMETRICS_PROP_CHANNELCOUNT "channelCount" // int32
@@ -77,7 +89,7 @@
#define AMEDIAMETRICS_PROP_CONTENTTYPE "contentType" // string attributes (AudioTrack)
#define AMEDIAMETRICS_PROP_DURATIONNS "durationNs" // int64 duration time span
#define AMEDIAMETRICS_PROP_ENCODING "encoding" // string value of format
-#define AMEDIAMETRICS_PROP_EVENT "event" // string value (often func name)
+#define AMEDIAMETRICS_PROP_EVENT "event#" // string value (often func name)
// TODO: fix inconsistency in flags: AudioRecord / AudioTrack int32, AudioThread string
#define AMEDIAMETRICS_PROP_FLAGS "flags"
diff --git a/media/libmediaplayerservice/datasource/PlayerServiceFileSource.cpp b/media/libmediaplayerservice/datasource/PlayerServiceFileSource.cpp
index bb4ba75..4d95de5 100644
--- a/media/libmediaplayerservice/datasource/PlayerServiceFileSource.cpp
+++ b/media/libmediaplayerservice/datasource/PlayerServiceFileSource.cpp
@@ -71,6 +71,9 @@
Mutex::Autolock autoLock(mLock);
if (mLength >= 0) {
+ if (offset < 0) {
+ return UNKNOWN_ERROR;
+ }
if (offset >= mLength) {
return 0; // read beyond EOF.
}
diff --git a/media/libmediatranscoding/include/media/AdjustableMaxPriorityQueue.h b/media/libmediatranscoding/include/media/AdjustableMaxPriorityQueue.h
new file mode 100644
index 0000000..0e8dcfd
--- /dev/null
+++ b/media/libmediatranscoding/include/media/AdjustableMaxPriorityQueue.h
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2020 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 ANDROID_MEDIA_ADJUSTABLE_MAX_PRIORITY_QUEUE_H
+#define ANDROID_MEDIA_ADJUSTABLE_MAX_PRIORITY_QUEUE_H
+
+#include <utils/Log.h>
+
+#include <functional>
+#include <iostream>
+#include <vector>
+
+namespace android {
+
+/*
+ * AdjustableMaxPriorityQueue is a custom max priority queue that helps managing jobs for
+ * MediaTranscodingService.
+ *
+ * AdjustableMaxPriorityQueue is a wrapper template around the STL's *_heap() functions.
+ * - Internally, it uses a std::vector<T> to store elements in a heap order.
+ * - Support adjusting item's priority while maintaining the heap property.
+ * - Support removing any item in the heap while maintaining the heap property. Note that the
+ * removal complexity will be O(n) in worst case.
+ * - AdjustableMaxPriorityQueue needs T::operator<() at instantiation time
+ */
+template <class T, class Comparator = std::less<T>>
+class AdjustableMaxPriorityQueue {
+ public:
+ typedef typename std::vector<T>::iterator iterator;
+ typedef typename std::vector<T>::const_iterator const_iterator;
+
+ AdjustableMaxPriorityQueue();
+
+ /* Whether the queue is empty. */
+ bool empty() const;
+
+ /* Number of items in the queue. */
+ int size() const;
+
+ /* Return the top element in the queue. The queue still owns the element. */
+ const T& top() const;
+
+ /* Discards the element with highest value based on the given comparator. */
+ void pop();
+
+ /* Erases all the elements in the queue. */
+ void clear();
+
+ /*
+ * Returns the element with the highest value based on the given comparator. Queue transfer the
+ * ownership of the item to the caller. Client MUST call empty() to check whether there is
+ * element at the top before calling this.
+ */
+ T consume_top();
+
+ /* Adds an element to the heap. The queue will make a deep copy of the element. */
+ bool push(const T& item) { return pushInternal(item); }
+
+ /* Adds an element to the heap. The queue will take ownership of the element. */
+ bool push(T&& item) { return pushInternal(std::move(item)); }
+
+ /* Adds a new element to the AdjustableMaxPriorityQueue. This new element is constructed in
+ * place passing args as the arguments for its constructor. */
+ template <class... Args>
+ bool emplace(Args&&... args);
+
+ /* Remove an element from a AdjustableMaxPriorityQueue. */
+ void erase(iterator pos);
+
+ /*
+ * Rebuild a heap based on the given comparator. This MUST be called after changing the value
+ * of items.
+ */
+ void rebuild();
+
+ /*
+ * Iterators used for accessing and changing the priority.
+ * If you change the value of items through these access iterators BE SURE to call rebuild() to
+ * ensure the integrity of the heap is maintained.
+ * NOTE: The iterator pos will change after calling rebuild().
+ */
+ const iterator begin();
+ const iterator end();
+
+ /*
+ * Iterators used for accessing the priority.
+ */
+ const const_iterator begin() const;
+ const const_iterator end() const;
+
+ /* Return the backbone storage of this PriorityQueue. Mainly used for debugging. */
+ const std::vector<T>& getStorage() const { return mHeap; };
+
+ private:
+ std::vector<T> mHeap;
+
+ /* Implementation shared by both public push() methods. */
+ template <class Arg>
+ bool pushInternal(Arg&& item);
+};
+
+template <class T, class Comparator>
+AdjustableMaxPriorityQueue<T, Comparator>::AdjustableMaxPriorityQueue() {}
+
+template <class T, class Comparator>
+bool AdjustableMaxPriorityQueue<T, Comparator>::empty() const {
+ return mHeap.empty();
+}
+
+template <class T, class Comparator>
+int AdjustableMaxPriorityQueue<T, Comparator>::size() const {
+ return mHeap.size();
+}
+
+template <class T, class Comparator>
+const T& AdjustableMaxPriorityQueue<T, Comparator>::top() const {
+ DCHECK(!mHeap.empty());
+ return mHeap.front();
+}
+
+// Compares elements and potentially swaps (or moves) them until rearranged as a longer heap.
+// Complexity of this: Up to logarithmic in the distance between first and last.
+template <class T, class Comparator>
+template <class Arg>
+bool AdjustableMaxPriorityQueue<T, Comparator>::pushInternal(Arg&& item) {
+ mHeap.push_back(std::forward<Arg>(item));
+ std::push_heap(mHeap.begin(), mHeap.end(), Comparator());
+ return true;
+}
+
+template <class T, class Comparator>
+template <class... Args>
+bool AdjustableMaxPriorityQueue<T, Comparator>::emplace(Args&&... args) {
+ mHeap.emplace_back(std::forward<Args>(args)...);
+ std::push_heap(mHeap.begin(), mHeap.end(), Comparator());
+ return true;
+}
+
+// Compares elements and potentially swaps (or moves) them until rearranged as a shorter heap.
+// Complexity of this: Up to twice logarithmic in the distance between first and last.
+template <class T, class Comparator>
+void AdjustableMaxPriorityQueue<T, Comparator>::pop() {
+ DCHECK(!mHeap.empty());
+ std::pop_heap(mHeap.begin(), mHeap.end(), Comparator());
+ mHeap.pop_back();
+}
+
+// Compares elements and potentially swaps (or moves) them until rearranged as a shorter heap.
+// Complexity of this: Up to twice logarithmic in the distance between first and last.
+template <class T, class Comparator>
+T AdjustableMaxPriorityQueue<T, Comparator>::consume_top() {
+ DCHECK(!mHeap.empty());
+ std::pop_heap(mHeap.begin(), mHeap.end(), Comparator());
+ T to_return = std::move(mHeap.back());
+ mHeap.pop_back();
+ return to_return;
+}
+
+template <class T, class Comparator>
+const typename AdjustableMaxPriorityQueue<T, Comparator>::iterator
+AdjustableMaxPriorityQueue<T, Comparator>::begin() {
+ return mHeap.begin();
+}
+
+template <class T, class Comparator>
+const typename AdjustableMaxPriorityQueue<T, Comparator>::iterator
+AdjustableMaxPriorityQueue<T, Comparator>::end() {
+ return mHeap.end();
+}
+
+template <class T, class Comparator>
+const typename AdjustableMaxPriorityQueue<T, Comparator>::const_iterator
+AdjustableMaxPriorityQueue<T, Comparator>::begin() const {
+ return mHeap.begin();
+}
+
+template <class T, class Comparator>
+const typename AdjustableMaxPriorityQueue<T, Comparator>::const_iterator
+AdjustableMaxPriorityQueue<T, Comparator>::end() const {
+ return mHeap.end();
+}
+
+template <class T, class Comparator>
+void AdjustableMaxPriorityQueue<T, Comparator>::clear() {
+ mHeap.erase(mHeap.begin(), mHeap.end());
+}
+
+// Complexity of this: At most 3*std::distance(first, last) comparisons.
+template <class T, class Comparator>
+void AdjustableMaxPriorityQueue<T, Comparator>::rebuild() {
+ std::make_heap(mHeap.begin(), mHeap.end(), Comparator());
+}
+
+// Remove a random element from a AdjustableMaxPriorityQueue.
+template <class T, class Comparator>
+void AdjustableMaxPriorityQueue<T, Comparator>::erase(iterator pos) {
+ DCHECK(!mHeap.empty());
+ mHeap.erase(pos);
+ rebuild();
+}
+
+} // namespace android
+#endif // ANDROID_MEDIA_ADJUSTABLE_MAX_PRIORITY_QUEUE_H
\ No newline at end of file
diff --git a/media/libmediatranscoding/tests/AdjustableMaxPriorityQueue_tests.cpp b/media/libmediatranscoding/tests/AdjustableMaxPriorityQueue_tests.cpp
new file mode 100644
index 0000000..d58af4e
--- /dev/null
+++ b/media/libmediatranscoding/tests/AdjustableMaxPriorityQueue_tests.cpp
@@ -0,0 +1,289 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+// Unit Test for AdjustableMaxPriorityQueue
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "AdjustableMaxPriorityQueueTest"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <gtest/gtest.h>
+#include <media/AdjustableMaxPriorityQueue.h>
+#include <utils/Log.h>
+
+#include <algorithm>
+#include <functional>
+#include <iterator>
+#include <list>
+#include <queue>
+#include <unordered_map>
+
+namespace android {
+
+class IntUniquePtrComp {
+ public:
+ bool operator()(const std::unique_ptr<int>& lhs, const std::unique_ptr<int>& rhs) const {
+ return *lhs < *rhs;
+ }
+};
+
+// Test the heap property and make sure it is the same as std::priority_queue.
+TEST(AdjustableMaxPriorityQueueTest, BasicAPIS) {
+ AdjustableMaxPriorityQueue<std::pair<float, char*>> heap;
+ std::priority_queue<std::pair<float, char*>> pq;
+ AdjustableMaxPriorityQueue<std::pair<float, char*>> remove_queue;
+
+ // Push a set of values onto both AdjustableMaxPriorityQueue and priority_queue
+ // Also compute the sum of those values
+ double sum = 0;
+ for (int i = 0; i < 10; ++i) {
+ float value = 2.1 * i;
+ sum += value;
+ heap.push(std::pair<float, char*>(value, nullptr));
+ pq.push(std::pair<float, char*>(value, nullptr));
+ remove_queue.push(std::pair<float, char*>(value, nullptr));
+ }
+
+ // Test the iterator by using it to subtract all values from earlier sum
+ AdjustableMaxPriorityQueue<std::pair<float, char*>>::iterator it;
+ for (it = heap.begin(); it != heap.end(); ++it) {
+ sum -= it->first;
+ }
+ EXPECT_EQ(0, sum);
+
+ // Test the size();
+ EXPECT_EQ(10, heap.size());
+
+ // Testing pop() by popping values from both queues and compare if they are the same.
+ // Also check each pop is smaller than the previous pop max value.
+ float max = 1000;
+ while (!heap.empty()) {
+ float value = heap.top().first;
+ ALOGD("Value is %f ", value);
+ EXPECT_EQ(value, pq.top().first);
+ EXPECT_LE(value, max);
+ max = value;
+ heap.pop();
+ pq.pop();
+ }
+
+ // Test erase() by removing values and ensuring the heap
+ // condition is still met as miscellaneous elements are
+ // removed from the heap.
+ int iteration_mixer = 0;
+ float previous_value = remove_queue.top().first;
+
+ while (!remove_queue.empty()) {
+ int iteration_count = iteration_mixer % remove_queue.size();
+
+ AdjustableMaxPriorityQueue<std::pair<float, char*>>::iterator iterator =
+ remove_queue.begin();
+
+ // Empty loop as we just want to advance the iterator.
+ for (int i = 0; i < iteration_count; ++i, ++iterator) {
+ }
+
+ remove_queue.erase(iterator);
+ float value = remove_queue.top().first;
+ remove_queue.pop();
+
+ EXPECT_GE(previous_value, value);
+
+ ++iteration_mixer;
+ previous_value = value;
+ }
+}
+
+TEST(AdjustableMaxPriorityQueueTest, BasicWithMoveOnly) {
+ AdjustableMaxPriorityQueue<std::unique_ptr<int>, IntUniquePtrComp> heap;
+
+ auto smaller = std::make_unique<int>(1);
+ EXPECT_TRUE(heap.push(std::move(smaller)));
+ EXPECT_EQ(1, *heap.top());
+ EXPECT_EQ(1, heap.size());
+
+ auto bigger = std::make_unique<int>(2);
+ heap.push(std::move(bigger));
+ EXPECT_EQ(2, *heap.top());
+
+ auto biggest = std::make_unique<int>(3);
+ EXPECT_TRUE(heap.push(std::move(biggest)));
+
+ EXPECT_EQ(3, heap.size());
+ // Biggest should be on top.
+ EXPECT_EQ(3, *heap.top());
+
+ biggest = heap.consume_top();
+ EXPECT_EQ(3, *biggest);
+
+ bigger = heap.consume_top();
+ EXPECT_EQ(2, *bigger);
+
+ smaller = heap.consume_top();
+ EXPECT_EQ(1, *smaller);
+
+ EXPECT_TRUE(heap.empty());
+}
+
+TEST(AdjustableMaxPriorityQueueTest, TestChangingItem) {
+ AdjustableMaxPriorityQueue<std::unique_ptr<int>, IntUniquePtrComp> heap;
+ using HeapIterator =
+ AdjustableMaxPriorityQueue<std::unique_ptr<int>, IntUniquePtrComp>::iterator;
+
+ int testValues[] = {1, 2, 3};
+ // Map to save each value's position in the heap.
+ std::unordered_map<int, HeapIterator> itemToIterratorMap;
+
+ // Insert the test values into the heap.
+ for (auto value : testValues) {
+ auto item = std::make_unique<int>(value);
+ EXPECT_TRUE(heap.push(std::move(item)));
+ }
+
+ // Save each value and its pos in the heap into the map.
+ for (HeapIterator iter = heap.begin(); iter != heap.end(); iter++) {
+ itemToIterratorMap[*iter->get()] = iter;
+ }
+
+ // Change the item with value 1 -> 4. And expects the 4 to be the top of the HEAP after that.
+ // After changing, the heap should contain [2,3,4].
+ auto newValue = std::make_unique<int>(4);
+ itemToIterratorMap[1]->swap(newValue);
+ heap.rebuild();
+ EXPECT_EQ(4, *heap.top());
+
+ // Change the item with value 2 -> 5. And expects the 5 to be the top of the HEAP after that.
+ auto newValue2 = std::make_unique<int>(5);
+ itemToIterratorMap[2]->swap(newValue2);
+ heap.rebuild();
+ EXPECT_EQ(5, *heap.top());
+}
+
+TEST(AdjustableMaxPriorityQueueTest, TestErasingItem) {
+ AdjustableMaxPriorityQueue<std::unique_ptr<int>, IntUniquePtrComp> heap;
+ using HeapIterator =
+ AdjustableMaxPriorityQueue<std::unique_ptr<int>, IntUniquePtrComp>::iterator;
+
+ int testValues[] = {1, 2, 3};
+ // Map to save each value's position in the heap.
+ std::unordered_map<int, HeapIterator> itemToIterratorMap;
+
+ // Insert the test values into the heap.
+ for (auto value : testValues) {
+ auto item = std::make_unique<int>(value);
+ EXPECT_TRUE(heap.push(std::move(item)));
+ }
+
+ // Save each value and its pos in the heap into the map.
+ for (HeapIterator iter = heap.begin(); iter != heap.end(); iter++) {
+ itemToIterratorMap[*iter->get()] = iter;
+ }
+
+ // The top of the heap must be 3.
+ EXPECT_EQ(3, *heap.top());
+
+ // Remove 3 and the top of the heap should be 2.
+ heap.erase(itemToIterratorMap[3]);
+ EXPECT_EQ(2, *heap.top());
+
+ // Reset the iter pos in the heap.
+ itemToIterratorMap.clear();
+ for (HeapIterator iter = heap.begin(); iter != heap.end(); iter++) {
+ itemToIterratorMap[*iter->get()] = iter;
+ }
+
+ // Remove 2 and the top of the heap should be 1.
+ heap.erase(itemToIterratorMap[2]);
+ EXPECT_EQ(1, *heap.top());
+
+ // Reset the iter pos in the heap as iterator pos changed after
+ itemToIterratorMap.clear();
+ for (HeapIterator iter = heap.begin(); iter != heap.end(); iter++) {
+ itemToIterratorMap[*iter->get()] = iter;
+ }
+
+ // Remove 1 and the heap should be empty.
+ heap.erase(itemToIterratorMap[1]);
+ EXPECT_TRUE(heap.empty());
+}
+
+// Test the heap property and make sure it is the same as std::priority_queue.
+TEST(AdjustableMaxPriorityQueueTest, TranscodingJobTest) {
+ // Test data structure that mimics the Transcoding job.
+ struct TranscodingJob {
+ int32_t priority;
+ int64_t createTimeUs;
+ };
+
+ // The job is arranging according to priority with highest priority comes first.
+ // For the job with the same priority, the job with early createTime will come first.
+ class TranscodingJobComp {
+ public:
+ bool operator()(const std::unique_ptr<TranscodingJob>& lhs,
+ const std::unique_ptr<TranscodingJob>& rhs) const {
+ if (lhs->priority != rhs->priority) {
+ return lhs->priority < rhs->priority;
+ }
+ return lhs->createTimeUs > rhs->createTimeUs;
+ }
+ };
+
+ // Map to save each value's position in the heap.
+ std::unordered_map<int, TranscodingJob*> jobIdToJobMap;
+
+ TranscodingJob testJobs[] = {
+ {1 /*priority*/, 66 /*createTimeUs*/}, // First job,
+ {2 /*priority*/, 67 /*createTimeUs*/}, // Second job,
+ {2 /*priority*/, 66 /*createTimeUs*/}, // Third job,
+ {3 /*priority*/, 68 /*createTimeUs*/}, // Fourth job.
+ };
+
+ AdjustableMaxPriorityQueue<std::unique_ptr<TranscodingJob>, TranscodingJobComp> jobQueue;
+
+ // Pushes all the jobs into the heap.
+ for (int jobId = 0; jobId < 4; ++jobId) {
+ auto newJob = std::make_unique<TranscodingJob>(testJobs[jobId]);
+ jobIdToJobMap[jobId] = newJob.get();
+ EXPECT_TRUE(jobQueue.push(std::move(newJob)));
+ }
+
+ // Check the job queue size.
+ EXPECT_EQ(4, jobQueue.size());
+
+ // Check the top and it should be Forth job: (3, 68)
+ const std::unique_ptr<TranscodingJob>& topJob = jobQueue.top();
+ EXPECT_EQ(3, topJob->priority);
+ EXPECT_EQ(68, topJob->createTimeUs);
+
+ // Consume the top.
+ std::unique_ptr<TranscodingJob> consumeJob = jobQueue.consume_top();
+
+ // Check the top and it should be Third Job (2, 66)
+ const std::unique_ptr<TranscodingJob>& topJob2 = jobQueue.top();
+ EXPECT_EQ(2, topJob2->priority);
+ EXPECT_EQ(66, topJob2->createTimeUs);
+
+ // Change the Second job's priority to 4 from (2, 67) -> (4, 67). It should becomes top of the
+ // queue.
+ jobIdToJobMap[1]->priority = 4;
+ jobQueue.rebuild();
+ const std::unique_ptr<TranscodingJob>& topJob3 = jobQueue.top();
+ EXPECT_EQ(4, topJob3->priority);
+ EXPECT_EQ(67, topJob3->createTimeUs);
+}
+} // namespace android
\ No newline at end of file
diff --git a/media/libmediatranscoding/tests/Android.bp b/media/libmediatranscoding/tests/Android.bp
index f3cc4c5..8191b00 100644
--- a/media/libmediatranscoding/tests/Android.bp
+++ b/media/libmediatranscoding/tests/Android.bp
@@ -35,4 +35,14 @@
defaults: ["libmediatranscoding_test_defaults"],
srcs: ["TranscodingClientManager_tests.cpp"],
+}
+
+//
+// AdjustableMaxPriorityQueue unit test
+//
+cc_test {
+ name: "AdjustableMaxPriorityQueue_tests",
+ defaults: ["libmediatranscoding_test_defaults"],
+
+ srcs: ["AdjustableMaxPriorityQueue_tests.cpp"],
}
\ No newline at end of file
diff --git a/media/libmediatranscoding/tests/build_and_run_all_unit_tests.sh b/media/libmediatranscoding/tests/build_and_run_all_unit_tests.sh
index 9832696..d8e4830 100644
--- a/media/libmediatranscoding/tests/build_and_run_all_unit_tests.sh
+++ b/media/libmediatranscoding/tests/build_and_run_all_unit_tests.sh
@@ -21,3 +21,6 @@
echo "testing TranscodingClientManager"
adb shell /data/nativetest64/TranscodingClientManager_tests/TranscodingClientManager_tests
+
+echo "testing AdjustableMaxPriorityQueue"
+adb shell /data/nativetest64/AdjustableMaxPriorityQueue_tests/AdjustableMaxPriorityQueue_tests
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 960120f..73d3a0b 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -2181,12 +2181,20 @@
}
if (!msg->findInt32("aac-target-ref-level", &drc.targetRefLevel)) {
// value is unknown
- drc.targetRefLevel = -1;
+ drc.targetRefLevel = -2;
}
if (!msg->findInt32("aac-drc-effect-type", &drc.effectType)) {
// value is unknown
drc.effectType = -2; // valid values are -1 and over
}
+ if (!msg->findInt32("aac-drc-album-mode", &drc.albumMode)) {
+ // value is unknown
+ drc.albumMode = -1; // valid values are 0 and 1
+ }
+ if (!msg->findInt32("aac-drc-output-loudness", &drc.outputLoudness)) {
+ // value is unknown
+ drc.outputLoudness = -1;
+ }
err = setupAACCodec(
encoder, numChannels, sampleRate, bitrate, aacProfile,
@@ -2876,6 +2884,8 @@
presentation.nEncodedTargetLevel = drc.encodedTargetLevel;
presentation.nPCMLimiterEnable = pcmLimiterEnable;
presentation.nDrcEffectType = drc.effectType;
+ presentation.nDrcAlbumMode = drc.albumMode;
+ presentation.nDrcOutputLoudness = drc.outputLoudness;
status_t res = mOMXNode->setParameter(
OMX_IndexParamAudioAac, &profile, sizeof(profile));
diff --git a/media/libstagefright/FrameDecoder.cpp b/media/libstagefright/FrameDecoder.cpp
index d75b317..3c4524b 100644
--- a/media/libstagefright/FrameDecoder.cpp
+++ b/media/libstagefright/FrameDecoder.cpp
@@ -647,7 +647,9 @@
crop_left, crop_top, crop_right, crop_bottom,
mFrame->getFlattenedData(),
mFrame->mWidth, mFrame->mHeight, mFrame->mRowBytes,
- crop_left, crop_top, crop_right, crop_bottom);
+ // since the frame is allocated with top-left adjusted,
+ // the dst rect should start at {0,0} as well.
+ 0, 0, mFrame->mWidth - 1, mFrame->mHeight - 1);
return OK;
}
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index b29d5f8..dbbdd1b 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -625,7 +625,7 @@
CHECK(source.get() != NULL);
- const char *mime;
+ const char *mime = NULL;
sp<MetaData> meta = source->getFormat();
meta->findCString(kKeyMIMEType, &mime);
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index a1b719c..b597583 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -103,6 +103,8 @@
static const char *kCodecLatencyCount = "android.media.mediacodec.latency.n";
static const char *kCodecLatencyHist = "android.media.mediacodec.latency.hist"; /* in us */
static const char *kCodecLatencyUnknown = "android.media.mediacodec.latency.unknown";
+static const char *kCodecQueueSecureInputBufferError = "android.media.mediacodec.queueSecureInputBufferError";
+static const char *kCodecQueueInputBufferError = "android.media.mediacodec.queueInputBufferError";
static const char *kCodecNumLowLatencyModeOn = "android.media.mediacodec.low-latency.on"; /* 0..n */
static const char *kCodecNumLowLatencyModeOff = "android.media.mediacodec.low-latency.off"; /* 0..n */
@@ -3629,8 +3631,16 @@
subSamples,
numSubSamples,
errorDetailMsg);
+ if (err != OK) {
+ mediametrics_setInt32(mMetricsHandle, kCodecQueueSecureInputBufferError, err);
+ ALOGW("Log queueSecureInputBuffer error: %d", err);
+ }
} else {
err = mBufferChannel->queueInputBuffer(buffer);
+ if (err != OK) {
+ mediametrics_setInt32(mMetricsHandle, kCodecQueueInputBufferError, err);
+ ALOGW("Log queueInputBuffer error: %d", err);
+ }
}
if (err == OK) {
diff --git a/media/libstagefright/MediaExtractorFactory.cpp b/media/libstagefright/MediaExtractorFactory.cpp
index 2457561..44dbfe9 100644
--- a/media/libstagefright/MediaExtractorFactory.cpp
+++ b/media/libstagefright/MediaExtractorFactory.cpp
@@ -280,7 +280,7 @@
std::shared_ptr<std::list<sp<ExtractorPlugin>>> newList(new std::list<sp<ExtractorPlugin>>());
- android_namespace_t *mediaNs = android_get_exported_namespace("media");
+ android_namespace_t *mediaNs = android_get_exported_namespace("com.android.media");
if (mediaNs != NULL) {
const android_dlextinfo dlextinfo = {
.flags = ANDROID_DLEXT_USE_NAMESPACE,
diff --git a/media/libstagefright/MediaTrack.cpp b/media/libstagefright/MediaTrack.cpp
index 89c9b25..24ba38a 100644
--- a/media/libstagefright/MediaTrack.cpp
+++ b/media/libstagefright/MediaTrack.cpp
@@ -183,6 +183,11 @@
meta.setData(kKeyAudioPresentationInfo,
MetaDataBase::Type::TYPE_NONE, valbuf->data(), valbuf->size());
}
+ if (format->mFormat->findBuffer("csd-0", &valbuf)) {
+ meta.setData(kKeyOpaqueCSD0,
+ MetaDataBase::Type::TYPE_NONE, valbuf->data(), valbuf->size());
+ }
+
} else {
*buffer = nullptr;
}
diff --git a/media/libstagefright/TEST_MAPPING b/media/libstagefright/TEST_MAPPING
index c1b270c..fac9511 100644
--- a/media/libstagefright/TEST_MAPPING
+++ b/media/libstagefright/TEST_MAPPING
@@ -1,10 +1,18 @@
{
"postsubmit": [
{
+ // TODO: move to presubmit once we verify the tests are not flaky
"name": "CtsMediaTestCases",
"options": [
{
- "include-annotation": "android.platform.test.annotations.RequiresDevice"
+ "include-annotation": "android.platform.test.annotations.Presubmit"
+ },
+ {
+ "exclude-annotation": "android.platform.test.annotations.RequiresDevice"
+ },
+ // TODO: b/149314419
+ {
+ "exclude-filter": "android.media.cts.AudioPlaybackCaptureTest"
}
]
},
diff --git a/media/libstagefright/bqhelper/Android.bp b/media/libstagefright/bqhelper/Android.bp
index 6719bab..f4548ff 100644
--- a/media/libstagefright/bqhelper/Android.bp
+++ b/media/libstagefright/bqhelper/Android.bp
@@ -1,9 +1,5 @@
-cc_library_shared {
- name: "libstagefright_bufferqueue_helper",
- vendor_available: true,
- vndk: {
- enabled: true,
- },
+cc_defaults {
+ name: "libstagefright_bufferqueue-defaults",
double_loadable: true,
srcs: [
"FrameDropper.cpp",
@@ -23,7 +19,7 @@
],
shared_libs: [
- "libbinder",
+ "libbase",
"libcutils",
"libhidlbase",
"libhidlmemory",
@@ -33,24 +29,12 @@
"libutils",
"android.hardware.graphics.bufferqueue@1.0",
- // Following libs are from libgui_bufferqueue_static
- "android.hardware.graphics.bufferqueue@2.0",
- "android.hidl.token@1.0-utils",
- "libbase",
- "libEGL",
- "libnativewindow",
- "libvndksupport",
- ],
-
- static_libs: [
- "libgui_bufferqueue_static"
],
export_shared_lib_headers: [
"libhidlmemory",
"libstagefright_foundation",
"android.hardware.graphics.bufferqueue@1.0",
- "android.hardware.graphics.bufferqueue@2.0",
],
cflags: [
@@ -68,3 +52,38 @@
cfi: true,
},
}
+
+cc_library_shared {
+ name: "libstagefright_bufferqueue_helper",
+ defaults: ["libstagefright_bufferqueue-defaults"],
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
+ static_libs: [
+ "libgui_bufferqueue_static"
+ ],
+ shared_libs: [
+ "android.hardware.graphics.bufferqueue@2.0",
+ "android.hidl.token@1.0-utils",
+ "libEGL",
+ "libnativewindow",
+ "libvndksupport",
+ ],
+ export_shared_lib_headers: [
+ "android.hardware.graphics.bufferqueue@2.0",
+ ],
+ cflags: [
+ "-DNO_BINDER",
+ ],
+}
+
+cc_library_shared {
+ name: "libstagefright_bufferqueue_helper_client",
+ defaults: ["libstagefright_bufferqueue-defaults"],
+ vendor_available: false,
+ shared_libs: [
+ "libgui"
+ ],
+}
+
diff --git a/media/libstagefright/bqhelper/GraphicBufferSource.cpp b/media/libstagefright/bqhelper/GraphicBufferSource.cpp
index de9d12c..986c9ac 100644
--- a/media/libstagefright/bqhelper/GraphicBufferSource.cpp
+++ b/media/libstagefright/bqhelper/GraphicBufferSource.cpp
@@ -412,7 +412,7 @@
B2HGraphicBufferProducer(getIGraphicBufferProducer());
}
-Status GraphicBufferSource::start() {
+status_t GraphicBufferSource::start() {
Mutex::Autolock autoLock(mMutex);
ALOGV("--> start; available=%zu, submittable=%zd",
mAvailableBuffers.size(), mFreeCodecBuffers.size());
@@ -459,10 +459,10 @@
}
}
- return Status::ok();
+ return OK;
}
-Status GraphicBufferSource::stop() {
+status_t GraphicBufferSource::stop() {
ALOGV("stop");
Mutex::Autolock autoLock(mMutex);
@@ -472,10 +472,10 @@
// not loaded->idle.
mExecuting = false;
}
- return Status::ok();
+ return OK;
}
-Status GraphicBufferSource::release(){
+status_t GraphicBufferSource::release(){
sp<ALooper> looper;
{
Mutex::Autolock autoLock(mMutex);
@@ -501,26 +501,26 @@
if (looper != NULL) {
looper->stop();
}
- return Status::ok();
+ return OK;
}
-Status GraphicBufferSource::onInputBufferAdded(codec_buffer_id bufferId) {
+status_t GraphicBufferSource::onInputBufferAdded(codec_buffer_id bufferId) {
Mutex::Autolock autoLock(mMutex);
if (mExecuting) {
// This should never happen -- buffers can only be allocated when
// transitioning from "loaded" to "idle".
ALOGE("addCodecBuffer: buffer added while executing");
- return Status::fromServiceSpecificError(INVALID_OPERATION);
+ return INVALID_OPERATION;
}
ALOGV("addCodecBuffer: bufferId=%u", bufferId);
mFreeCodecBuffers.push_back(bufferId);
- return Status::ok();
+ return OK;
}
-Status GraphicBufferSource::onInputBufferEmptied(codec_buffer_id bufferId, int fenceFd) {
+status_t GraphicBufferSource::onInputBufferEmptied(codec_buffer_id bufferId, int fenceFd) {
Mutex::Autolock autoLock(mMutex);
FileDescriptor::Autoclose fence(fenceFd);
@@ -528,7 +528,7 @@
if (cbi < 0) {
// This should never happen.
ALOGE("onInputBufferEmptied: buffer not recognized (bufferId=%u)", bufferId);
- return Status::fromServiceSpecificError(BAD_VALUE);
+ return BAD_VALUE;
}
std::shared_ptr<AcquiredBuffer> buffer = mSubmittedCodecBuffers.valueAt(cbi);
@@ -548,13 +548,13 @@
ALOGV("onInputBufferEmptied: EOS null buffer (bufferId=%u@%zd)", bufferId, cbi);
}
// No GraphicBuffer to deal with, no additional input or output is expected, so just return.
- return Status::fromServiceSpecificError(BAD_VALUE);
+ return BAD_VALUE;
}
if (!mExecuting) {
// this is fine since this could happen when going from Idle to Loaded
ALOGV("onInputBufferEmptied: no longer executing (bufferId=%u@%zd)", bufferId, cbi);
- return Status::fromServiceSpecificError(OK);
+ return OK;
}
ALOGV("onInputBufferEmptied: bufferId=%d@%zd [slot=%d, useCount=%ld, handle=%p] acquired=%d",
@@ -584,7 +584,7 @@
}
// releaseReleasableBuffers_l();
- return Status::ok();
+ return OK;
}
void GraphicBufferSource::onDataspaceChanged_l(
@@ -1423,7 +1423,7 @@
// stall since no future events are expected.
mEndOfStream = true;
- if (mStopTimeUs == -1 && mExecuting && !haveAvailableBuffers_l()) {
+ if (mExecuting && !haveAvailableBuffers_l()) {
submitEndOfInputStream_l();
}
diff --git a/media/libstagefright/bqhelper/include/media/stagefright/bqhelper/GraphicBufferSource.h b/media/libstagefright/bqhelper/include/media/stagefright/bqhelper/GraphicBufferSource.h
index ed5d7cb..fe6bcce 100644
--- a/media/libstagefright/bqhelper/include/media/stagefright/bqhelper/GraphicBufferSource.h
+++ b/media/libstagefright/bqhelper/include/media/stagefright/bqhelper/GraphicBufferSource.h
@@ -31,8 +31,6 @@
namespace android {
-using ::android::binder::Status;
-
struct FrameDropper;
class BufferItem;
class IGraphicBufferProducer;
@@ -99,26 +97,26 @@
// This is called when component transitions to running state, which means
// we can start handing it buffers. If we already have buffers of data
// sitting in the BufferQueue, this will send them to the codec.
- Status start();
+ status_t start();
// This is called when component transitions to stopped, indicating that
// the codec is meant to return all buffers back to the client for them
// to be freed. Do NOT submit any more buffers to the component.
- Status stop();
+ status_t stop();
// This is called when component transitions to released, indicating that
// we are shutting down.
- Status release();
+ status_t release();
// A "codec buffer", i.e. a buffer that can be used to pass data into
// the encoder, has been allocated. (This call does not call back into
// component.)
- Status onInputBufferAdded(int32_t bufferId);
+ status_t onInputBufferAdded(int32_t bufferId);
// Called when encoder is no longer using the buffer. If we have a BQ
// buffer available, fill it with a new frame of data; otherwise, just mark
// it as available.
- Status onInputBufferEmptied(int32_t bufferId, int fenceFd);
+ status_t onInputBufferEmptied(int32_t bufferId, int fenceFd);
// IGraphicBufferSource interface
// ------------------------------
diff --git a/media/libstagefright/codecs/aacdec/DrcPresModeWrap.cpp b/media/libstagefright/codecs/aacdec/DrcPresModeWrap.cpp
index 95d3724..168d140 100644
--- a/media/libstagefright/codecs/aacdec/DrcPresModeWrap.cpp
+++ b/media/libstagefright/codecs/aacdec/DrcPresModeWrap.cpp
@@ -47,10 +47,9 @@
mEncoderTarget = -1;
/* Values from last time. */
- /* Initialized to the same values as the desired values */
- mLastTarget = -1;
- mLastAttFactor = 0;
- mLastBoostFactor = 0;
+ mLastTarget = -2;
+ mLastAttFactor = -1;
+ mLastBoostFactor = -1;
mLastHeavy = 0;
}
@@ -163,7 +162,7 @@
if (mDataUpdate) {
// sanity check
- if (mDesTarget < MAX_TARGET_LEVEL){
+ if ((mDesTarget < MAX_TARGET_LEVEL) && (mDesTarget != -1)){
mDesTarget = MAX_TARGET_LEVEL; // limit target level to -10 dB or below
newTarget = MAX_TARGET_LEVEL;
}
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index 41bc16c..2aeddd7 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -37,6 +37,7 @@
#define DRC_DEFAULT_MOBILE_DRC_BOOST 127 /* maximum compression of dynamic range for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_HEAVY 1 /* switch for heavy compression for mobile conf */
#define DRC_DEFAULT_MOBILE_DRC_EFFECT 3 /* MPEG-D DRC effect type; 3 => Limited playback range */
+#define DRC_DEFAULT_MOBILE_DRC_ALBUM 0 /* MPEG-D DRC album mode; 0 => album mode is disabled, 1 => album mode is enabled */
#define DRC_DEFAULT_MOBILE_ENC_LEVEL (-1) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
#define MAX_CHANNEL_COUNT 8 /* maximum number of audio channels that can be decoded */
// names of properties that can be used to override the default DRC settings
@@ -219,6 +220,11 @@
ALOGV("AAC decoder using MPEG-D DRC effect type %d (default=%d)",
effectType, DRC_DEFAULT_MOBILE_DRC_EFFECT);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, effectType);
+ // AAC_UNIDRC_ALBUM_MODE
+ int32_t albumMode = DRC_DEFAULT_MOBILE_DRC_ALBUM;
+ ALOGV("AAC decoder using MPEG-D Album mode value %d (default=%d)", albumMode,
+ DRC_DEFAULT_MOBILE_DRC_ALBUM);
+ aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);
// By default, the decoder creates a 5.1 channel downmix signal.
// For seven and eight channel input streams, enable 6.1 and 7.1 channel output
@@ -459,6 +465,11 @@
ALOGV("set nDrcEffectType=%d", aacPresParams->nDrcEffectType);
aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_SET_EFFECT, aacPresParams->nDrcEffectType);
}
+ if (aacPresParams->nDrcAlbumMode >= -1) {
+ ALOGV("set nDrcAlbumMode=%d", aacPresParams->nDrcAlbumMode);
+ aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE,
+ aacPresParams->nDrcAlbumMode);
+ }
bool updateDrcWrapper = false;
if (aacPresParams->nDrcBoost >= 0) {
ALOGV("set nDrcBoost=%d", aacPresParams->nDrcBoost);
@@ -477,7 +488,7 @@
aacPresParams->nHeavyCompression);
updateDrcWrapper = true;
}
- if (aacPresParams->nTargetReferenceLevel >= 0) {
+ if (aacPresParams->nTargetReferenceLevel >= -1) {
ALOGV("set nTargetReferenceLevel=%d", aacPresParams->nTargetReferenceLevel);
mDrcWrap.setParam(DRC_PRES_MODE_WRAP_DESIRED_TARGET,
aacPresParams->nTargetReferenceLevel);
diff --git a/media/libstagefright/codecs/m4v_h263/dec/Android.bp b/media/libstagefright/codecs/m4v_h263/dec/Android.bp
index 6b45ea2..c67dc2b 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/Android.bp
+++ b/media/libstagefright/codecs/m4v_h263/dec/Android.bp
@@ -47,9 +47,6 @@
export_include_dirs: ["include"],
cflags: [
- "-DOSCL_EXPORT_REF=",
- "-DOSCL_IMPORT_REF=",
-
"-Werror",
],
@@ -74,8 +71,6 @@
local_include_dirs: ["src"],
cflags: [
- "-DOSCL_EXPORT_REF=",
- "-DOSCL_IMPORT_REF=",
],
static_libs: ["libstagefright_m4vh263dec"],
diff --git a/media/libstagefright/codecs/m4v_h263/dec/include/mp4dec_api.h b/media/libstagefright/codecs/m4v_h263/dec/include/mp4dec_api.h
index 6d4868c..1f404ce 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/include/mp4dec_api.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/include/mp4dec_api.h
@@ -35,6 +35,13 @@
#define PV_TRUE 1
#define PV_FALSE 0
+#ifndef OSCL_IMPORT_REF
+#define OSCL_IMPORT_REF /* empty */
+#endif
+#ifndef OSCL_EXPORT_REF
+#define OSCL_EXPORT_REF /* empty */
+#endif
+
/* flag for post-processing 4/25/00 */
#ifdef DEC_NOPOSTPROC
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/Android.bp b/media/libstagefright/codecs/m4v_h263/dec/test/Android.bp
index e335c9b..655491a 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/test/Android.bp
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/Android.bp
@@ -32,7 +32,6 @@
],
cflags: [
- "-DOSCL_IMPORT_REF=",
"-Werror",
"-Wall",
],
diff --git a/media/libstagefright/codecs/m4v_h263/enc/Android.bp b/media/libstagefright/codecs/m4v_h263/enc/Android.bp
index 2738187..846f614 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/Android.bp
+++ b/media/libstagefright/codecs/m4v_h263/enc/Android.bp
@@ -23,10 +23,6 @@
cflags: [
"-DBX_RC",
- "-DOSCL_IMPORT_REF=",
- "-DOSCL_UNUSED_ARG(x)=(void)(x)",
- "-DOSCL_EXPORT_REF=",
-
"-Werror",
],
@@ -55,9 +51,6 @@
cflags: [
"-DBX_RC",
- "-DOSCL_IMPORT_REF=",
- "-DOSCL_UNUSED_ARG(x)=(void)(x)",
- "-DOSCL_EXPORT_REF=",
],
static_libs: ["libstagefright_m4vh263enc"],
@@ -81,8 +74,6 @@
local_include_dirs: ["src"],
cflags: [
- "-DOSCL_EXPORT_REF=",
- "-DOSCL_IMPORT_REF=",
"-DBX_RC",
"-Wall",
"-Werror",
diff --git a/media/libstagefright/codecs/m4v_h263/enc/include/mp4enc_api.h b/media/libstagefright/codecs/m4v_h263/enc/include/mp4enc_api.h
index d5a3ff1..9f824b1 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/include/mp4enc_api.h
+++ b/media/libstagefright/codecs/m4v_h263/enc/include/mp4enc_api.h
@@ -39,6 +39,16 @@
#define PV_TRUE 1
#define PV_FALSE 0
+#ifndef OSCL_IMPORT_REF
+#define OSCL_IMPORT_REF /* empty */
+#endif
+#ifndef OSCL_EXPORT_REF
+#define OSCL_EXPORT_REF /* empty */
+#endif
+#ifndef OSCL_UNUSED_ARG
+#define OSCL_UNUSED_ARG(x) ((void)(x))
+#endif
+
typedef enum
{
SHORT_HEADER,
diff --git a/media/libstagefright/include/media/stagefright/ACodec.h b/media/libstagefright/include/media/stagefright/ACodec.h
index d56ec4f..83e92b9 100644
--- a/media/libstagefright/include/media/stagefright/ACodec.h
+++ b/media/libstagefright/include/media/stagefright/ACodec.h
@@ -476,6 +476,8 @@
int32_t targetRefLevel;
int32_t encodedTargetLevel;
int32_t effectType;
+ int32_t albumMode;
+ int32_t outputLoudness;
} drcParams_t;
status_t setupAACCodec(
diff --git a/media/libstagefright/include/media/stagefright/MediaCodecConstants.h b/media/libstagefright/include/media/stagefright/MediaCodecConstants.h
index eb7e5f7..bfdc9e7 100644
--- a/media/libstagefright/include/media/stagefright/MediaCodecConstants.h
+++ b/media/libstagefright/include/media/stagefright/MediaCodecConstants.h
@@ -733,10 +733,12 @@
constexpr int32_t COLOR_TRANSFER_SDR_VIDEO = 3;
constexpr int32_t COLOR_TRANSFER_ST2084 = 6;
+constexpr char KEY_AAC_DRC_ALBUM_MODE[] = "aac-drc-album-mode";
constexpr char KEY_AAC_DRC_ATTENUATION_FACTOR[] = "aac-drc-cut-level";
constexpr char KEY_AAC_DRC_BOOST_FACTOR[] = "aac-drc-boost-level";
constexpr char KEY_AAC_DRC_EFFECT_TYPE[] = "aac-drc-effect-type";
constexpr char KEY_AAC_DRC_HEAVY_COMPRESSION[] = "aac-drc-heavy-compression";
+constexpr char KEY_AAC_DRC_OUTPUT_LOUDNESS[] = "aac-drc-output-loudness";
constexpr char KEY_AAC_DRC_TARGET_REFERENCE_LEVEL[] = "aac-target-ref-level";
constexpr char KEY_AAC_ENCODED_TARGET_LEVEL[] = "aac-encoded-target-level";
constexpr char KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT[] = "aac-max-output-channel_count";
diff --git a/media/libstagefright/omx/OmxGraphicBufferSource.cpp b/media/libstagefright/omx/OmxGraphicBufferSource.cpp
index 7b187f9..9484046 100644
--- a/media/libstagefright/omx/OmxGraphicBufferSource.cpp
+++ b/media/libstagefright/omx/OmxGraphicBufferSource.cpp
@@ -65,15 +65,18 @@
} // namespace
Status OmxGraphicBufferSource::onOmxExecuting() {
- return start();
+ status_t err = start();
+ return (OK == err) ? Status::ok() : Status::fromServiceSpecificError(err);
}
Status OmxGraphicBufferSource::onOmxIdle() {
- return stop();
+ status_t err = stop();
+ return (OK == err) ? Status::ok() : Status::fromServiceSpecificError(err);
}
Status OmxGraphicBufferSource::onOmxLoaded(){
- return release();
+ status_t err = release();
+ return (OK == err) ? Status::ok() : Status::fromServiceSpecificError(err);
}
status_t OmxGraphicBufferSource::configure(
diff --git a/media/libstagefright/tests/writer/AndroidTest.xml b/media/libstagefright/tests/writer/AndroidTest.xml
new file mode 100644
index 0000000..d831555
--- /dev/null
+++ b/media/libstagefright/tests/writer/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<configuration description="Test module config for writer tests">
+ <option name="test-suite-tag" value="writerTest" />
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="writerTest->/data/local/tmp/writerTest" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/tests/writer/Writer.zip?unzip=true"
+ value="/data/local/tmp/writerTestRes/" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="writerTest" />
+ <option name="native-test-flag" value="-P /data/local/tmp/writerTestRes/" />
+ </test>
+</configuration>
diff --git a/media/libstagefright/webm/tests/Android.bp b/media/libstagefright/webm/tests/Android.bp
new file mode 100644
index 0000000..5183a49
--- /dev/null
+++ b/media/libstagefright/webm/tests/Android.bp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+cc_test {
+ name: "WebmFrameThreadUnitTest",
+ gtest: true,
+
+ srcs: [
+ "WebmFrameThreadUnitTest.cpp",
+ ],
+
+ include_dirs: [
+ "frameworks/av/media/libstagefright",
+ ],
+
+ static_libs: [
+ "libdatasource",
+ "libstagefright",
+ "libstagefright_webm",
+ "libstagefright_foundation",
+ ],
+
+ shared_libs: [
+ "libbinder",
+ "liblog",
+ "libutils",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ cfi: true,
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ },
+}
diff --git a/media/libstagefright/webm/tests/README.md b/media/libstagefright/webm/tests/README.md
new file mode 100644
index 0000000..2e74f34
--- /dev/null
+++ b/media/libstagefright/webm/tests/README.md
@@ -0,0 +1,26 @@
+## Media Testing ##
+---
+#### Webm Writer Utility Tests :
+The Webm Writer Utility Test Suite validates the APIs being used by the WebmWriter.
+
+Run the following steps to build the test suite:
+```
+mmm frameworks/av/media/libstagefright/webm/tests/
+```
+
+The 32-bit binaries will be created in the following path : ${OUT}/data/nativetest/
+
+The 64-bit binaries will be created in the following path : ${OUT}/data/nativetest64/
+
+#### WebmFrameThread
+To test 64-bit binary push binaries from nativetest64.
+
+adb push ${OUT}/data/nativetest64/WebmFrameThreadUnitTest/WebmFrameThreadUnitTest /data/local/tmp/
+
+To test 32-bit binary push binaries from nativetest.
+
+adb push ${OUT}/data/nativetest/WebmFrameThreadUnitTest/WebmFrameThreadUnitTest /data/local/tmp/
+
+```
+adb shell /data/local/tmp/WebmFrameThreadUnitTest
+```
diff --git a/media/libstagefright/webm/tests/WebmFrameThreadUnitTest.cpp b/media/libstagefright/webm/tests/WebmFrameThreadUnitTest.cpp
new file mode 100644
index 0000000..89cd2ca
--- /dev/null
+++ b/media/libstagefright/webm/tests/WebmFrameThreadUnitTest.cpp
@@ -0,0 +1,314 @@
+/*
+ * Copyright (C) 2020 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_NDEBUG 0
+#define LOG_TAG "WebmFrameThreadUnitTest"
+#include <utils/Log.h>
+
+#include <gtest/gtest.h>
+
+#include <media/stagefright/MediaAdapter.h>
+#include <media/stagefright/MediaDefs.h>
+#include <media/stagefright/MetaData.h>
+#include <media/stagefright/Utils.h>
+
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/AMessage.h>
+#include <media/stagefright/foundation/OpusHeader.h>
+
+#include "webm/EbmlUtil.h"
+#include "webm/WebmConstants.h"
+#include "webm/WebmFrameThread.h"
+
+using namespace android;
+using namespace webm;
+
+static constexpr int32_t kVideoIdx = 0;
+static constexpr int32_t kAudioIdx = 1;
+static constexpr int32_t kMaxStreamCount = 2;
+
+static constexpr int32_t kCsdSize = 32;
+static constexpr int32_t kFrameSize = 128;
+
+static constexpr int32_t kMaxLoopCount = 20;
+static constexpr int32_t kNumFramesToWrite = 32;
+static constexpr int32_t kSyncFrameInterval = 10;
+static constexpr uint64_t kDefaultTimeCodeScaleUs = 1000000; /* 1sec */
+
+#define OUTPUT_FILE_NAME "/data/local/tmp/webmFrameThreadOutput.webm"
+
+// LookUpTable of clips and metadata for component testing
+static const struct InputData {
+ const char *mime;
+ int32_t firstParam;
+ int32_t secondParam;
+ bool isAudio;
+} kInputData[] = {
+ {MEDIA_MIMETYPE_AUDIO_OPUS, 48000, 6, true},
+ {MEDIA_MIMETYPE_AUDIO_VORBIS, 44100, 1, true},
+ {MEDIA_MIMETYPE_VIDEO_VP9, 176, 144, false},
+ {MEDIA_MIMETYPE_VIDEO_VP8, 1920, 1080, false},
+};
+
+class WebmFrameThreadUnitTest : public ::testing::TestWithParam<std::pair<int32_t, int32_t>> {
+ public:
+ WebmFrameThreadUnitTest()
+ : mSinkThread(nullptr), mAudioThread(nullptr), mVideoThread(nullptr), mSource{} {}
+
+ ~WebmFrameThreadUnitTest() {
+ if (mSinkThread) mSinkThread.clear();
+ if (mAudioThread) mAudioThread.clear();
+ if (mVideoThread) mVideoThread.clear();
+ }
+
+ virtual void SetUp() override {
+ mSegmentDataStart = 0;
+ mFd = open(OUTPUT_FILE_NAME, O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR);
+ ASSERT_GE(mFd, 0) << "Failed to open output file " << OUTPUT_FILE_NAME;
+ }
+
+ virtual void TearDown() override {
+ if (mFd >= 0) close(mFd);
+ for (int32_t idx = 0; idx < kMaxStreamCount; idx++) {
+ if (mSource[idx] != nullptr) {
+ mSource[idx].clear();
+ }
+ }
+ mVSink.clear();
+ mASink.clear();
+ mCuePoints.clear();
+ }
+
+ void addTrack(bool isAudio, int32_t index);
+ void writeFileData(int32_t inputFrameId, int32_t range);
+
+ void createWebmThreads(std::initializer_list<int32_t> indexList);
+ void startWebmFrameThreads();
+ void stopWebmFrameThreads();
+
+ int32_t mFd;
+ uint64_t mSegmentDataStart;
+
+ sp<WebmFrameSinkThread> mSinkThread;
+ sp<WebmFrameSourceThread> mAudioThread;
+ sp<WebmFrameSourceThread> mVideoThread;
+
+ List<sp<WebmElement>> mCuePoints;
+ sp<MediaAdapter> mSource[kMaxStreamCount];
+ LinkedBlockingQueue<const sp<WebmFrame>> mVSink;
+ LinkedBlockingQueue<const sp<WebmFrame>> mASink;
+};
+
+void writeAudioHeaderData(const sp<AMessage> &format, const char *mimeType) {
+ if (strncasecmp(mimeType, MEDIA_MIMETYPE_AUDIO_OPUS, strlen(MEDIA_MIMETYPE_AUDIO_OPUS) + 1) &&
+ strncasecmp(mimeType, MEDIA_MIMETYPE_AUDIO_VORBIS,
+ strlen(MEDIA_MIMETYPE_AUDIO_VORBIS) + 1)) {
+ ASSERT_TRUE(false) << "Unsupported mime type";
+ }
+
+ // Dummy CSD buffers for Opus and Vorbis
+ char csdBuffer[kCsdSize];
+ memset(csdBuffer, 0xFF, sizeof(csdBuffer));
+
+ sp<ABuffer> csdBuffer0 = ABuffer::CreateAsCopy((void *)csdBuffer, kCsdSize);
+ ASSERT_NE(csdBuffer0.get(), nullptr) << "Unable to allocate buffer for CSD0 data";
+ ASSERT_NE(csdBuffer0->base(), nullptr) << "ABuffer base is null for CSD0";
+
+ sp<ABuffer> csdBuffer1 = ABuffer::CreateAsCopy((void *)csdBuffer, kCsdSize);
+ ASSERT_NE(csdBuffer1.get(), nullptr) << "Unable to allocate buffer for CSD1 data";
+ ASSERT_NE(csdBuffer1->base(), nullptr) << "ABuffer base is null for CSD1";
+
+ sp<ABuffer> csdBuffer2 = ABuffer::CreateAsCopy((void *)csdBuffer, kCsdSize);
+ ASSERT_NE(csdBuffer2.get(), nullptr) << "Unable to allocate buffer for CSD2 data";
+ ASSERT_NE(csdBuffer2->base(), nullptr) << "ABuffer base is null for CSD2";
+
+ format->setBuffer("csd-0", csdBuffer0);
+ format->setBuffer("csd-1", csdBuffer1);
+ format->setBuffer("csd-2", csdBuffer2);
+}
+
+void WebmFrameThreadUnitTest::addTrack(bool isAudio, int32_t index) {
+ ASSERT_LT(index, sizeof(kInputData) / sizeof(kInputData[0]))
+ << "Invalid index for loopup table";
+
+ sp<AMessage> format = new AMessage;
+ format->setString("mime", kInputData[index].mime);
+ if (!isAudio) {
+ format->setInt32("width", kInputData[index].firstParam);
+ format->setInt32("height", kInputData[index].secondParam);
+ } else {
+ format->setInt32("sample-rate", kInputData[index].firstParam);
+ format->setInt32("channel-count", kInputData[index].secondParam);
+ ASSERT_NO_FATAL_FAILURE(writeAudioHeaderData(format, kInputData[index].mime));
+ }
+
+ sp<MetaData> trackMeta = new MetaData;
+ convertMessageToMetaData(format, trackMeta);
+
+ if (!isAudio) {
+ mSource[kVideoIdx] = new MediaAdapter(trackMeta);
+ ASSERT_NE(mSource[kVideoIdx], nullptr) << "Unable to create source";
+ } else {
+ mSource[kAudioIdx] = new MediaAdapter(trackMeta);
+ ASSERT_NE(mSource[kAudioIdx], nullptr) << "Unable to create source";
+ }
+}
+
+void WebmFrameThreadUnitTest::createWebmThreads(std::initializer_list<int32_t> indexList) {
+ mSinkThread = new WebmFrameSinkThread(mFd, mSegmentDataStart, mVSink, mASink, mCuePoints);
+ ASSERT_NE(mSinkThread, nullptr) << "Failed to create Sink Thread";
+
+ bool isAudio;
+ // MultiTrack input
+ for (int32_t index : indexList) {
+ isAudio = kInputData[index].isAudio;
+ ASSERT_NO_FATAL_FAILURE(addTrack(isAudio, index));
+ if (!isAudio) {
+ mVideoThread = new WebmFrameMediaSourceThread(mSource[kVideoIdx], kVideoType, mVSink,
+ kDefaultTimeCodeScaleUs, 0, 0, 1, 0);
+ } else {
+ mAudioThread = new WebmFrameMediaSourceThread(mSource[kAudioIdx], kAudioType, mASink,
+ kDefaultTimeCodeScaleUs, 0, 0, 1, 0);
+ }
+ }
+ // To handle single track file
+ if (!mVideoThread) {
+ mVideoThread = new WebmFrameEmptySourceThread(kVideoType, mVSink);
+ } else if (!mAudioThread) {
+ mAudioThread = new WebmFrameEmptySourceThread(kAudioType, mASink);
+ }
+ ASSERT_NE(mVideoThread, nullptr) << "Failed to create Video Thread";
+ ASSERT_NE(mAudioThread, nullptr) << "Failed to create Audio Thread";
+}
+
+void WebmFrameThreadUnitTest::startWebmFrameThreads() {
+ status_t status = mAudioThread->start();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to start Audio Thread";
+ status = mVideoThread->start();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to start Video Thread";
+ status = mSinkThread->start();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to start Sink Thread";
+}
+
+void WebmFrameThreadUnitTest::stopWebmFrameThreads() {
+ status_t status = mAudioThread->stop();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to stop Audio Thread";
+ status = mVideoThread->stop();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to stop Video Thread";
+ status = mSinkThread->stop();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to stop Sink Thread";
+}
+
+// Write dummy data to a file
+void WebmFrameThreadUnitTest::writeFileData(int32_t inputFrameId, int32_t range) {
+ char data[kFrameSize];
+ memset(data, 0xFF, sizeof(data));
+ int32_t status = OK;
+ do {
+ // Queue frames for both A/V tracks
+ for (int32_t idx = kVideoIdx; idx < kMaxStreamCount; idx++) {
+ sp<ABuffer> buffer = new ABuffer((void *)data, kFrameSize);
+ ASSERT_NE(buffer.get(), nullptr) << "ABuffer returned nullptr";
+
+ // Released in MediaAdapter::signalBufferReturned().
+ MediaBuffer *mediaBuffer = new MediaBuffer(buffer);
+ ASSERT_NE(mediaBuffer, nullptr) << "MediaBuffer returned nullptr";
+
+ mediaBuffer->add_ref();
+ mediaBuffer->set_range(buffer->offset(), buffer->size());
+
+ MetaDataBase &sampleMetaData = mediaBuffer->meta_data();
+ sampleMetaData.setInt64(kKeyTime, inputFrameId * kDefaultTimeCodeScaleUs);
+
+ // For audio codecs, treat all frame as sync frame
+ if ((idx == kAudioIdx) || (inputFrameId % kSyncFrameInterval == 0)) {
+ sampleMetaData.setInt32(kKeyIsSyncFrame, true);
+ }
+
+ // This pushBuffer will wait until the mediaBuffer is consumed.
+ if (mSource[idx] != nullptr) {
+ status = mSource[idx]->pushBuffer(mediaBuffer);
+ }
+ ASSERT_EQ(status, OK);
+ }
+ inputFrameId++;
+ } while (inputFrameId < range);
+}
+
+TEST_P(WebmFrameThreadUnitTest, WriteTest) {
+ int32_t index1 = GetParam().first;
+ int32_t index2 = GetParam().second;
+ ASSERT_NO_FATAL_FAILURE(createWebmThreads({index1, index2}));
+
+ ASSERT_NO_FATAL_FAILURE(startWebmFrameThreads());
+
+ ASSERT_NO_FATAL_FAILURE(writeFileData(0, kNumFramesToWrite));
+
+ if (mSource[kAudioIdx]) mSource[kAudioIdx]->stop();
+ if (mSource[kVideoIdx]) mSource[kVideoIdx]->stop();
+
+ ASSERT_NO_FATAL_FAILURE(stopWebmFrameThreads());
+}
+
+TEST_P(WebmFrameThreadUnitTest, PauseTest) {
+ int32_t index1 = GetParam().first;
+ int32_t index2 = GetParam().second;
+ ASSERT_NO_FATAL_FAILURE(createWebmThreads({index1, index2}));
+
+ ASSERT_NO_FATAL_FAILURE(startWebmFrameThreads());
+
+ int32_t offset = 0;
+ ASSERT_NO_FATAL_FAILURE(writeFileData(offset, kNumFramesToWrite));
+ offset += kNumFramesToWrite;
+
+ for (int idx = 0; idx < kMaxLoopCount; idx++) {
+ // pause the threads
+ status_t status = mAudioThread->pause();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to pause Audio Thread";
+ status = mVideoThread->pause();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to pause Video Thread";
+
+ // Under pause state, no write should happen
+ ASSERT_NO_FATAL_FAILURE(writeFileData(offset, kNumFramesToWrite));
+ offset += kNumFramesToWrite;
+
+ status = mAudioThread->resume();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to resume Audio Thread";
+ status = mVideoThread->resume();
+ ASSERT_EQ(status, AMEDIA_OK) << "Failed to resume Video Thread";
+
+ ASSERT_NO_FATAL_FAILURE(writeFileData(offset, kNumFramesToWrite));
+ offset += kNumFramesToWrite;
+ }
+
+ if (mSource[kAudioIdx]) mSource[kAudioIdx]->stop();
+ if (mSource[kVideoIdx]) mSource[kVideoIdx]->stop();
+ ASSERT_NO_FATAL_FAILURE(stopWebmFrameThreads());
+}
+
+INSTANTIATE_TEST_SUITE_P(WebmFrameThreadUnitTestAll, WebmFrameThreadUnitTest,
+ ::testing::Values(std::make_pair(0, 1), std::make_pair(0, 2),
+ std::make_pair(0, 3), std::make_pair(1, 0),
+ std::make_pair(1, 2), std::make_pair(1, 3),
+ std::make_pair(2, 3)));
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGV("Test result = %d\n", status);
+ return status;
+}
diff --git a/media/libwatchdog/Android.bp b/media/libwatchdog/Android.bp
new file mode 100644
index 0000000..849623a
--- /dev/null
+++ b/media/libwatchdog/Android.bp
@@ -0,0 +1,36 @@
+// Copyright 2020 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.
+
+cc_library {
+ name: "libwatchdog",
+ srcs: [
+ "Watchdog.cpp",
+ ],
+ export_include_dirs: ["include"],
+ shared_libs: [
+ "liblog",
+ ],
+ static_libs: [
+ "libbase",
+ ],
+ target: {
+ windows: {
+ enabled: false,
+ },
+ darwin: {
+ enabled: false,
+ },
+ },
+ apex_available: ["com.android.media"],
+}
diff --git a/media/libwatchdog/Watchdog.cpp b/media/libwatchdog/Watchdog.cpp
new file mode 100644
index 0000000..bb012b9
--- /dev/null
+++ b/media/libwatchdog/Watchdog.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2020 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 "Watchdog"
+
+#include <watchdog/Watchdog.h>
+
+#include <android-base/logging.h>
+#include <android-base/threads.h>
+#include <signal.h>
+#include <time.h>
+#include <cstring>
+#include <utils/Log.h>
+
+namespace android {
+
+Watchdog::Watchdog(::std::chrono::steady_clock::duration timeout) {
+ // Create the timer.
+ struct sigevent sev;
+ sev.sigev_notify = SIGEV_THREAD_ID;
+ sev.sigev_notify_thread_id = base::GetThreadId();
+ sev.sigev_signo = SIGABRT;
+ sev.sigev_value.sival_ptr = &mTimerId;
+ int err = timer_create(CLOCK_MONOTONIC, &sev, &mTimerId);
+ if (err != 0) {
+ PLOG(FATAL) << "Failed to create timer";
+ }
+
+ // Start the timer.
+ struct itimerspec spec;
+ memset(&spec, 0, sizeof(spec));
+ auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(timeout);
+ LOG_ALWAYS_FATAL_IF(timeout.count() <= 0, "Duration must be positive");
+ spec.it_value.tv_sec = ns.count() / 1000000000;
+ spec.it_value.tv_nsec = ns.count() % 1000000000;
+ err = timer_settime(mTimerId, 0, &spec, nullptr);
+ if (err != 0) {
+ PLOG(FATAL) << "Failed to start timer";
+ }
+}
+
+Watchdog::~Watchdog() {
+ // Delete the timer.
+ int err = timer_delete(mTimerId);
+ if (err != 0) {
+ PLOG(FATAL) << "Failed to delete timer";
+ }
+}
+
+} // namespace android
diff --git a/media/libwatchdog/include/watchdog/Watchdog.h b/media/libwatchdog/include/watchdog/Watchdog.h
new file mode 100644
index 0000000..2819f8a
--- /dev/null
+++ b/media/libwatchdog/include/watchdog/Watchdog.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2020 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 ANDROID_WATCHDOG_H
+#define ANDROID_WATCHDOG_H
+
+#include <chrono>
+#include <time.h>
+
+namespace android {
+
+/*
+ * An RAII-style object, which would crash the process if a timeout expires
+ * before the object is destroyed.
+ * The calling thread would be sent a SIGABORT, which would typically result in
+ * a stack trace.
+ *
+ * Sample usage:
+ * {
+ * Watchdog watchdog(std::chrono::milliseconds(10));
+ * DoSomething();
+ * }
+ * // If we got here, the function completed in time.
+ */
+class Watchdog final {
+public:
+ Watchdog(std::chrono::steady_clock::duration timeout);
+ ~Watchdog();
+
+private:
+ timer_t mTimerId;
+};
+
+} // namespace android
+
+#endif // ANDROID_WATCHDOG_H
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index fdf51b1..8677b90 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -969,7 +969,7 @@
modifiedTime = 0;
if ((strcmp(name, ".") == 0) || (strcmp(name, "..") == 0) ||
- (strcmp(name, "/") == 0) || (strcmp(basename(name), name) != 0)) {
+ (strchr(name, '/') != NULL)) {
char errMsg[80];
snprintf(errMsg, sizeof(errMsg), "Invalid name: %s", (const char *) name);
@@ -981,7 +981,7 @@
}
if (path[path.size() - 1] != '/')
path.append("/");
- path.append(basename(name));
+ path.append(name);
// check space first
if (mSendObjectFileSize > storage->getFreeSpace())
diff --git a/media/ndk/include/media/NdkMediaFormat.h b/media/ndk/include/media/NdkMediaFormat.h
index ed77aac..49d8b4a 100644
--- a/media/ndk/include/media/NdkMediaFormat.h
+++ b/media/ndk/include/media/NdkMediaFormat.h
@@ -296,6 +296,12 @@
#if __ANDROID_API__ >= 30
/**
+ * An optional key describing the low latency decoding mode. This is an optional parameter
+ * that applies only to decoders. If enabled, the decoder doesn't hold input and output
+ * data more than required by the codec standards.
+ * The associated value is an integer (0 or 1): 1 when low-latency decoding is enabled,
+ * 0 otherwise. The default value is 0.
+ *
* Available since API level 30.
*/
extern const char* AMEDIAFORMAT_KEY_LOW_LATENCY __INTRODUCED_IN(30);
diff --git a/media/tests/benchmark/MediaBenchmarkTest/AndroidTest.xml b/media/tests/benchmark/MediaBenchmarkTest/AndroidTest.xml
index 1179d6c..1890661 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/AndroidTest.xml
+++ b/media/tests/benchmark/MediaBenchmarkTest/AndroidTest.xml
@@ -14,6 +14,12 @@
limitations under the License.
-->
<configuration description="Runs Media Benchmark Tests">
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push-file"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/tests/benchmark/MediaBenchmark.zip?unzip=true"
+ value="/data/local/tmp/MediaBenchmark/res/" />
+ </target_preparer>
<target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
<option name="cleanup-apks" value="false" />
<option name="test-file-name" value="MediaBenchmarkTest.apk" />
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/DecoderTest.java b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/DecoderTest.java
index c41f198..afd70a3 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/DecoderTest.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/DecoderTest.java
@@ -78,7 +78,7 @@
{"bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", false},
{"bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", false},
{"bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", false},
- {"bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", false},
+ {"bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", false},
{"bbb_44100hz_2ch_600kbps_flac_30sec.mp4", false},
{"bbb_48000hz_2ch_100kbps_opus_30sec.webm", false},
// Audio Async Test
@@ -86,7 +86,7 @@
{"bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", true},
{"bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", true},
{"bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", true},
- {"bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", true},
+ {"bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", true},
{"bbb_44100hz_2ch_600kbps_flac_30sec.mp4", true},
{"bbb_48000hz_2ch_100kbps_opus_30sec.webm", true},
// Video Sync Test
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/EncoderTest.java b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/EncoderTest.java
index 831467a..48e1422 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/EncoderTest.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/EncoderTest.java
@@ -19,6 +19,9 @@
import android.content.Context;
import android.media.MediaCodec;
import android.media.MediaFormat;
+
+import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible;
+
import android.util.Log;
import androidx.test.platform.app.InstrumentationRegistry;
@@ -65,6 +68,7 @@
private static final int ENCODE_DEFAULT_FRAME_RATE = 25;
private static final int ENCODE_DEFAULT_BIT_RATE = 8000000 /* 8 Mbps */;
private static final int ENCODE_MIN_BIT_RATE = 600000 /* 600 Kbps */;
+ private static final int ENCODE_DEFAULT_AUDIO_BIT_RATE = 128000 /* 128 Kbps */;
private String mInputFile;
@Parameterized.Parameters
@@ -98,7 +102,7 @@
}
@Test(timeout = PER_TEST_TIMEOUT_MS)
- public void sampleEncoderTest() throws Exception {
+ public void testEncoder() throws Exception {
int status;
int frameSize;
//Parameters for video
@@ -107,6 +111,7 @@
int profile = 0;
int level = 0;
int frameRate = 0;
+
//Parameters for audio
int bitRate = 0;
int sampleRate = 0;
@@ -122,6 +127,7 @@
ArrayList<ByteBuffer> inputBuffer = new ArrayList<>();
ArrayList<MediaCodec.BufferInfo> frameInfo = new ArrayList<>();
for (int currentTrack = 0; currentTrack < trackCount; currentTrack++) {
+ int colorFormat = COLOR_FormatYUV420Flexible;
extractor.selectExtractorTrack(currentTrack);
MediaFormat format = extractor.getFormat(currentTrack);
// Get samples from extractor
@@ -148,6 +154,7 @@
status = decoder.decode(inputBuffer, frameInfo, false, format, "");
assertEquals("Decoder returned error " + status + " for file: " + mInputFile, 0,
status);
+ MediaFormat decoderFormat = decoder.getFormat();
decoder.deInitCodec();
extractor.unselectExtractorTrack(currentTrack);
inputBuffer.clear();
@@ -203,10 +210,17 @@
if (format.containsKey(MediaFormat.KEY_PROFILE)) {
level = format.getInteger(MediaFormat.KEY_LEVEL);
}
+ if (decoderFormat.containsKey(MediaFormat.KEY_COLOR_FORMAT)) {
+ colorFormat = decoderFormat.getInteger(MediaFormat.KEY_COLOR_FORMAT);
+ }
} else {
sampleRate = format.getInteger(MediaFormat.KEY_SAMPLE_RATE);
numChannels = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
- bitRate = sampleRate * numChannels * 16;
+ if (decoderFormat.containsKey(MediaFormat.KEY_BIT_RATE)) {
+ bitRate = decoderFormat.getInteger(MediaFormat.KEY_BIT_RATE);
+ } else {
+ bitRate = ENCODE_DEFAULT_AUDIO_BIT_RATE;
+ }
}
/*Setup Encode Format*/
MediaFormat encodeFormat;
@@ -219,6 +233,7 @@
encodeFormat.setInteger(MediaFormat.KEY_LEVEL, level);
encodeFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1);
encodeFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, frameSize);
+ encodeFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
} else {
encodeFormat = MediaFormat.createAudioFormat(mime, sampleRate, numChannels);
encodeFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);
@@ -255,7 +270,7 @@
fileInput.close();
}
- @Test
+ @Test(timeout = PER_TEST_TIMEOUT_MS)
public void testNativeEncoder() throws Exception {
File inputFile = new File(mInputFilePath + mInputFile);
assertTrue("Cannot find " + mInputFile + " in directory " + mInputFilePath,
@@ -275,8 +290,8 @@
// Encoding the decoder's output
for (String codecName : mediaCodecs) {
Native nativeEncoder = new Native();
- int status = nativeEncoder.Encode(
- mInputFilePath, mInputFile, mDecodedFile, mStatsFile, codecName);
+ int status = nativeEncoder
+ .Encode(mInputFilePath, mInputFile, mDecodedFile, mStatsFile, codecName);
assertEquals(
codecName + " encoder returned error " + status + " for " + "file:" + " " +
mInputFile, 0, status);
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/ExtractorTest.java b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/ExtractorTest.java
index 6b7aad1..4d026c1 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/ExtractorTest.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/ExtractorTest.java
@@ -70,7 +70,7 @@
{"bbb_44100hz_2ch_600kbps_flac_5mins.flac", 0},
{"bbb_8000hz_1ch_8kbps_amrnb_5mins.3gp", 0},
{"bbb_16000hz_1ch_9kbps_amrwb_5mins.3gp", 0},
- {"bbb_44100hz_2ch_80kbps_vorbis_5mins.mp4", 0},
+ {"bbb_44100hz_2ch_80kbps_vorbis_5mins.webm", 0},
{"bbb_48000hz_2ch_100kbps_opus_5mins.webm", 0}});
}
@@ -88,7 +88,7 @@
}
@Test
- public void sampleExtractTest() throws IOException {
+ public void testExtractor() throws IOException {
File inputFile = new File(mInputFilePath + mInputFileName);
assertTrue("Cannot find " + mInputFileName + " in directory " + mInputFilePath,
inputFile.exists());
@@ -107,7 +107,7 @@
}
@Test
- public void sampleExtractNativeTest() throws IOException {
+ public void testNativeExtractor() throws IOException {
Native nativeExtractor = new Native();
File inputFile = new File(mInputFilePath + mInputFileName);
assertTrue("Cannot find " + mInputFileName + " in directory " + mInputFilePath,
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/MuxerTest.java b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/MuxerTest.java
index 2efdba2..21ba957 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/MuxerTest.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/androidTest/java/com/android/media/benchmark/tests/MuxerTest.java
@@ -86,7 +86,7 @@
{"crowd_1920x1080_25fps_6700kbps_h264.ts", "3gpp"},
{"crowd_1920x1080_25fps_4000kbps_h265.mkv", "3gpp"},
{"bbb_48000hz_2ch_100kbps_opus_5mins.webm", "ogg"},
- {"bbb_44100hz_2ch_80kbps_vorbis_5mins.mp4", "webm"},
+ {"bbb_44100hz_2ch_80kbps_vorbis_5mins.webm", "webm"},
{"bbb_48000hz_2ch_100kbps_opus_5mins.webm", "webm"},
{"bbb_44100hz_2ch_128kbps_aac_5mins.mp4", "mp4"},
{"bbb_8000hz_1ch_8kbps_amrnb_5mins.3gp", "mp4"},
@@ -110,7 +110,7 @@
}
@Test
- public void sampleMuxerTest() throws IOException {
+ public void testMuxer() throws IOException {
File inputFile = new File(mInputFilePath + mInputFileName);
assertTrue("Cannot find " + mInputFileName + " in directory " + mInputFilePath,
inputFile.exists());
@@ -159,7 +159,7 @@
}
@Test
- public void sampleMuxerNativeTest() {
+ public void testNativeMuxer() {
Native nativeMuxer = new Native();
File inputFile = new File(mInputFilePath + mInputFileName);
assertTrue("Cannot find " + mInputFileName + " in directory " + mInputFilePath,
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/NativeEncoder.cpp b/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/NativeEncoder.cpp
index 271b852..1277c8b 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/NativeEncoder.cpp
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/main/cpp/NativeEncoder.cpp
@@ -18,9 +18,9 @@
#define LOG_TAG "NativeEncoder"
#include <jni.h>
+#include <sys/stat.h>
#include <fstream>
#include <iostream>
-#include <sys/stat.h>
#include <android/log.h>
@@ -29,6 +29,11 @@
#include <stdio.h>
+constexpr int32_t ENCODE_DEFAULT_FRAME_RATE = 25;
+constexpr int32_t ENCODE_DEFAULT_AUDIO_BIT_RATE = 128000 /* 128 Kbps */;
+constexpr int32_t ENCODE_DEFAULT_BIT_RATE = 8000000 /* 8 Mbps */;
+constexpr int32_t ENCODE_MIN_BIT_RATE = 600000 /* 600 Kbps */;
+
extern "C" JNIEXPORT int JNICALL Java_com_android_media_benchmark_library_Native_Encode(
JNIEnv *env, jobject thiz, jstring jFilePath, jstring jFileName, jstring jOutFilePath,
jstring jStatsFile, jstring jCodecName) {
@@ -72,7 +77,7 @@
ALOGE("Track Format invalid");
return -1;
}
- uint8_t *inputBuffer = (uint8_t *) malloc(fileSize);
+ uint8_t *inputBuffer = (uint8_t *)malloc(fileSize);
if (!inputBuffer) {
ALOGE("Insufficient memory");
return -1;
@@ -110,6 +115,8 @@
free(inputBuffer);
return -1;
}
+
+ AMediaFormat *decoderFormat = decoder->getFormat();
AMediaFormat *format = extractor->getFormat();
if (inputBuffer) {
free(inputBuffer);
@@ -146,29 +153,34 @@
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_FRAME_RATE, &encParams.frameRate);
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_BIT_RATE, &encParams.bitrate);
if (encParams.bitrate <= 0 || encParams.frameRate <= 0) {
- encParams.frameRate = 25;
+ encParams.frameRate = ENCODE_DEFAULT_FRAME_RATE;
if (!strcmp(mime, "video/3gpp") || !strcmp(mime, "video/mp4v-es")) {
- encParams.bitrate = 600000 /* 600 Kbps */;
+ encParams.bitrate = ENCODE_MIN_BIT_RATE /* 600 Kbps */;
} else {
- encParams.bitrate = 8000000 /* 8 Mbps */;
+ encParams.bitrate = ENCODE_DEFAULT_BIT_RATE /* 8 Mbps */;
}
}
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_PROFILE, &encParams.profile);
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_LEVEL, &encParams.level);
+ AMediaFormat_getInt32(decoderFormat, AMEDIAFORMAT_KEY_COLOR_FORMAT,
+ &encParams.colorFormat);
} else {
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_SAMPLE_RATE, &encParams.sampleRate);
AMediaFormat_getInt32(format, AMEDIAFORMAT_KEY_CHANNEL_COUNT,
&encParams.numChannels);
- encParams.bitrate =
- encParams.sampleRate * encParams.numChannels * 16 /* bitsPerSample */;
+ encParams.bitrate = ENCODE_DEFAULT_AUDIO_BIT_RATE;
}
Encoder *encoder = new Encoder();
encoder->setupEncoder();
status = encoder->encode(sCodecName, eleStream, eleSize, asyncMode[i], encParams,
- (char *) mime);
+ (char *)mime);
+ if (status != AMEDIA_OK) {
+ ALOGE("Encoder returned error");
+ return -1;
+ }
+ ALOGV("Encoding complete with codec %s for asyncMode = %d", sCodecName.c_str(),
+ asyncMode[i]);
encoder->deInitCodec();
- cout << "codec : " << codecName << endl;
- ALOGV(" asyncMode = %d \n", asyncMode[i]);
const char *statsFile = env->GetStringUTFChars(jStatsFile, nullptr);
encoder->dumpStatistics(sInputReference, extractor->getClipDuration(), sCodecName,
(asyncMode[i] ? "async" : "sync"), statsFile);
@@ -189,6 +201,10 @@
AMediaFormat_delete(format);
format = nullptr;
}
+ if (decoderFormat) {
+ AMediaFormat_delete(decoderFormat);
+ decoderFormat = nullptr;
+ }
decoder->deInitCodec();
decoder->resetDecoder();
}
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Decoder.java b/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Decoder.java
index 3b1eed4..66fee33 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Decoder.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Decoder.java
@@ -134,7 +134,6 @@
mStats.addOutputTime();
onOutputAvailable(mediaCodec, outputBufferId, bufferInfo);
if (mSawOutputEOS) {
- Log.i(TAG, "Saw output EOS");
synchronized (mLock) { mLock.notify(); }
}
}
@@ -211,9 +210,6 @@
}
onOutputAvailable(mCodec, outputBufferId, outputBufferInfo);
}
- if (outputBufferInfo.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
- Log.i(TAG, "Saw output EOS");
- }
}
}
mInputBuffer.clear();
@@ -256,14 +252,21 @@
*/
public void resetDecoder() { mStats.reset(); }
+ /**
+ * Returns the format of the output buffers
+ */
+ public MediaFormat getFormat() {
+ return mCodec.getOutputFormat();
+ }
+
private void onInputAvailable(int inputBufferId, MediaCodec mediaCodec) {
if ((inputBufferId >= 0) && !mSawInputEOS) {
ByteBuffer inputCodecBuffer = mediaCodec.getInputBuffer(inputBufferId);
BufferInfo bufInfo = mInputBufferInfo.get(mIndex);
inputCodecBuffer.put(mInputBuffer.get(mIndex).array());
mIndex++;
- if (bufInfo.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM) {
- mSawInputEOS = true;
+ mSawInputEOS = (bufInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
+ if (mSawInputEOS) {
Log.i(TAG, "Saw input EOS");
}
mStats.addFrameSize(bufInfo.size);
@@ -301,6 +304,9 @@
}
}
mediaCodec.releaseOutputBuffer(outputBufferId, false);
- mSawOutputEOS = (outputBufferInfo.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM);
+ mSawOutputEOS = (outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
+ if (mSawOutputEOS) {
+ Log.i(TAG, "Saw output EOS");
+ }
}
}
diff --git a/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Encoder.java b/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Encoder.java
index 40cf8bd..45e5574 100644
--- a/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Encoder.java
+++ b/media/tests/benchmark/MediaBenchmarkTest/src/main/java/com/android/media/benchmark/library/Encoder.java
@@ -29,7 +29,9 @@
import java.nio.ByteBuffer;
public class Encoder {
- private static final int ENCODE_DEFAULT_MAX_INPUT_SIZE = 3840;
+ // Change in AUDIO_ENCODE_DEFAULT_MAX_INPUT_SIZE should also be taken to
+ // kDefaultAudioEncodeFrameSize present in BenchmarkCommon.h
+ private static final int AUDIO_ENCODE_DEFAULT_MAX_INPUT_SIZE = 4096;
private static final String TAG = "Encoder";
private static final boolean DEBUG = false;
private static final int kQueueDequeueTimeoutUs = 1000;
@@ -134,7 +136,7 @@
if (mMime.startsWith("video/")) {
mFrameSize = frameSize;
} else {
- int maxInputSize = ENCODE_DEFAULT_MAX_INPUT_SIZE;
+ int maxInputSize = AUDIO_ENCODE_DEFAULT_MAX_INPUT_SIZE;
MediaFormat format = mCodec.getInputFormat();
if (format.containsKey(MediaFormat.KEY_MAX_INPUT_SIZE)) {
maxInputSize = format.getInteger(MediaFormat.KEY_MAX_INPUT_SIZE);
@@ -260,12 +262,12 @@
}
mStats.addFrameSize(outputBuffer.remaining());
mediaCodec.releaseOutputBuffer(outputBufferId, false);
- mSawOutputEOS = (outputBufferInfo.flags == MediaCodec.BUFFER_FLAG_END_OF_STREAM);
+ mSawOutputEOS = (outputBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
}
private void onInputAvailable(MediaCodec mediaCodec, int inputBufferId) throws IOException {
- if (mSawOutputEOS || inputBufferId < 0) {
- if (mSawOutputEOS) {
+ if (mSawInputEOS || inputBufferId < 0) {
+ if (mSawInputEOS) {
Log.i(TAG, "Saw input EOS");
}
return;
@@ -281,19 +283,27 @@
return;
}
int bufSize = inputBuffer.capacity();
- int bytesRead = mFrameSize;
+ int bytesToRead = mFrameSize;
if (mInputBufferSize - mOffset < mFrameSize) {
- bytesRead = (int) (mInputBufferSize - mOffset);
+ bytesToRead = (int) (mInputBufferSize - mOffset);
}
- if (bufSize < bytesRead) {
- mSignalledError = true;
- return;
+ //b/148655275 - Update Frame size, as Format value may not be valid
+ if (bufSize < bytesToRead) {
+ if(mNumInputFrame == 0) {
+ mFrameSize = bufSize;
+ bytesToRead = bufSize;
+ mNumFrames = (int) ((mInputBufferSize + mFrameSize - 1) / mFrameSize);
+ } else {
+ mSignalledError = true;
+ return;
+ }
}
- byte[] inputArray = new byte[bytesRead];
- mInputStream.read(inputArray, 0, bytesRead);
+
+ byte[] inputArray = new byte[bytesToRead];
+ mInputStream.read(inputArray, 0, bytesToRead);
inputBuffer.put(inputArray);
int flag = 0;
- if (mNumInputFrame >= mNumFrames - 1 || bytesRead == 0) {
+ if (mNumInputFrame >= mNumFrames - 1 || bytesToRead == 0) {
Log.i(TAG, "Sending EOS on input last frame");
mSawInputEOS = true;
flag = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
@@ -304,9 +314,9 @@
} else {
presentationTimeUs = mNumInputFrame * mFrameSize * 1000000 / mSampleRate;
}
- mediaCodec.queueInputBuffer(inputBufferId, 0, bytesRead, presentationTimeUs, flag);
+ mediaCodec.queueInputBuffer(inputBufferId, 0, bytesToRead, presentationTimeUs, flag);
mNumInputFrame++;
- mOffset += bytesRead;
+ mOffset += bytesToRead;
}
/**
diff --git a/media/tests/benchmark/src/native/common/BenchmarkCommon.h b/media/tests/benchmark/src/native/common/BenchmarkCommon.h
index c11fe36..40a8c9e 100644
--- a/media/tests/benchmark/src/native/common/BenchmarkCommon.h
+++ b/media/tests/benchmark/src/native/common/BenchmarkCommon.h
@@ -35,6 +35,9 @@
constexpr uint32_t kQueueDequeueTimeoutUs = 1000;
constexpr uint32_t kMaxCSDStrlen = 16;
constexpr uint32_t kMaxBufferSize = 1024 * 1024 * 16;
+// Change in kDefaultAudioEncodeFrameSize should also be taken to
+// AUDIO_ENCODE_DEFAULT_MAX_INPUT_SIZE present in Encoder.java
+constexpr uint32_t kDefaultAudioEncodeFrameSize = 4096;
template <typename T>
class CallBackQueue {
diff --git a/media/tests/benchmark/src/native/decoder/Decoder.cpp b/media/tests/benchmark/src/native/decoder/Decoder.cpp
index 2171589..090f3e1 100644
--- a/media/tests/benchmark/src/native/decoder/Decoder.cpp
+++ b/media/tests/benchmark/src/native/decoder/Decoder.cpp
@@ -63,8 +63,8 @@
ssize_t bytesRead = 0;
uint32_t flag = 0;
int64_t presentationTimeUs = 0;
- tie(bytesRead, flag, presentationTimeUs) = readSampleData(
- mInputBuffer, mOffset, mFrameMetaData, buf, mNumInputFrame, bufSize);
+ tie(bytesRead, flag, presentationTimeUs) =
+ readSampleData(mInputBuffer, mOffset, mFrameMetaData, buf, mNumInputFrame, bufSize);
if (flag == AMEDIA_ERROR_MALFORMED) {
mErrorCode = (media_status_t)flag;
mSignalledError = true;
@@ -144,6 +144,11 @@
if (!mFormat) mFormat = mExtractor->getFormat();
}
+AMediaFormat *Decoder::getFormat() {
+ ALOGV("In %s", __func__);
+ return AMediaCodec_getOutputFormat(mCodec);
+}
+
int32_t Decoder::decode(uint8_t *inputBuffer, vector<AMediaCodecBufferInfo> &frameInfo,
string &codecName, bool asyncMode, FILE *outFp) {
ALOGV("In %s", __func__);
diff --git a/media/tests/benchmark/src/native/decoder/Decoder.h b/media/tests/benchmark/src/native/decoder/Decoder.h
index f3fa6a1..e619cb4 100644
--- a/media/tests/benchmark/src/native/decoder/Decoder.h
+++ b/media/tests/benchmark/src/native/decoder/Decoder.h
@@ -57,6 +57,8 @@
void resetDecoder();
+ AMediaFormat *getFormat();
+
// Async callback APIs
void onInputAvailable(AMediaCodec *codec, int32_t index) override;
diff --git a/media/tests/benchmark/src/native/encoder/Encoder.cpp b/media/tests/benchmark/src/native/encoder/Encoder.cpp
index 2db612c..26fb1b9 100644
--- a/media/tests/benchmark/src/native/encoder/Encoder.cpp
+++ b/media/tests/benchmark/src/native/encoder/Encoder.cpp
@@ -47,29 +47,36 @@
mEncoderDoneCondition.notify_one();
return;
}
- size_t bytesRead = mParams.frameSize;
+ size_t bytesToRead = mParams.frameSize;
if (mInputBufferSize - mOffset < mParams.frameSize) {
- bytesRead = mInputBufferSize - mOffset;
+ bytesToRead = mInputBufferSize - mOffset;
}
- if (bufSize < bytesRead) {
- ALOGE("bytes to read %zu bufSize %zu \n", bytesRead, bufSize);
+ //b/148655275 - Update Frame size, as Format value may not be valid
+ if (bufSize < bytesToRead) {
+ if(mNumInputFrame == 0) {
+ mParams.frameSize = bufSize;
+ bytesToRead = bufSize;
+ mParams.numFrames = (mInputBufferSize + mParams.frameSize - 1) / mParams.frameSize;
+ } else {
+ ALOGE("bytes to read %zu bufSize %zu \n", bytesToRead, bufSize);
+ mErrorCode = AMEDIA_ERROR_MALFORMED;
+ mSignalledError = true;
+ mEncoderDoneCondition.notify_one();
+ return;
+ }
+ }
+ if (bytesToRead < mParams.frameSize && mNumInputFrame < mParams.numFrames - 1) {
+ ALOGE("Partial frame at frameID %d bytesToRead %zu frameSize %d total numFrames %d\n",
+ mNumInputFrame, bytesToRead, mParams.frameSize, mParams.numFrames);
mErrorCode = AMEDIA_ERROR_MALFORMED;
mSignalledError = true;
mEncoderDoneCondition.notify_one();
return;
}
- if (bytesRead < mParams.frameSize && mNumInputFrame < mParams.numFrames - 1) {
- ALOGE("Partial frame at frameID %d bytesRead %zu frameSize %d total numFrames %d\n",
- mNumInputFrame, bytesRead, mParams.frameSize, mParams.numFrames);
- mErrorCode = AMEDIA_ERROR_MALFORMED;
- mSignalledError = true;
- mEncoderDoneCondition.notify_one();
- return;
- }
- mEleStream->read(buf, bytesRead);
+ mEleStream->read(buf, bytesToRead);
size_t bytesgcount = mEleStream->gcount();
- if (bytesgcount != bytesRead) {
- ALOGE("bytes to read %zu actual bytes read %zu \n", bytesRead, bytesgcount);
+ if (bytesgcount != bytesToRead) {
+ ALOGE("bytes to read %zu actual bytes read %zu \n", bytesToRead, bytesgcount);
mErrorCode = AMEDIA_ERROR_MALFORMED;
mSignalledError = true;
mEncoderDoneCondition.notify_one();
@@ -77,7 +84,7 @@
}
uint32_t flag = 0;
- if (mNumInputFrame == mParams.numFrames - 1 || bytesRead == 0) {
+ if (mNumInputFrame == mParams.numFrames - 1 || bytesToRead == 0) {
ALOGD("Sending EOS on input Last frame\n");
flag |= AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM;
}
@@ -92,10 +99,10 @@
if (flag == AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) mSawInputEOS = true;
ALOGV("%s bytesRead : %zd presentationTimeUs : %" PRIu64 " mSawInputEOS : %s", __FUNCTION__,
- bytesRead, presentationTimeUs, mSawInputEOS ? "TRUE" : "FALSE");
+ bytesToRead, presentationTimeUs, mSawInputEOS ? "TRUE" : "FALSE");
media_status_t status = AMediaCodec_queueInputBuffer(mCodec, bufIdx, 0 /* offset */,
- bytesRead, presentationTimeUs, flag);
+ bytesToRead, presentationTimeUs, flag);
if (AMEDIA_OK != status) {
mErrorCode = status;
mSignalledError = true;
@@ -103,7 +110,7 @@
return;
}
mNumInputFrame++;
- mOffset += bytesRead;
+ mOffset += bytesToRead;
}
}
@@ -181,8 +188,8 @@
mStats->dumpStatistics(operation, inputReference, durationUs, componentName, mode, statsFile);
}
-int32_t Encoder::encode(string &codecName, ifstream &eleStream, size_t eleSize,
- bool asyncMode, encParameter encParams, char *mime) {
+int32_t Encoder::encode(string &codecName, ifstream &eleStream, size_t eleSize, bool asyncMode,
+ encParameter encParams, char *mime) {
ALOGV("In %s", __func__);
mEleStream = &eleStream;
mInputBufferSize = eleSize;
@@ -202,6 +209,7 @@
AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_PROFILE, mParams.profile);
AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_LEVEL, mParams.level);
}
+ AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_COLOR_FORMAT, mParams.colorFormat);
} else {
AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_SAMPLE_RATE, mParams.sampleRate);
AMediaFormat_setInt32(mFormat, AMEDIAFORMAT_KEY_CHANNEL_COUNT, mParams.numChannels);
@@ -219,13 +227,12 @@
if (!strncmp(mMime, "video/", 6)) {
mParams.frameSize = mParams.width * mParams.height * 3 / 2;
} else {
- mParams.frameSize = 4096;
+ mParams.frameSize = kDefaultAudioEncodeFrameSize;
// Get mInputMaxBufSize
AMediaFormat *inputFormat = AMediaCodec_getInputFormat(mCodec);
AMediaFormat_getInt32(inputFormat, AMEDIAFORMAT_KEY_MAX_INPUT_SIZE, &mParams.maxFrameSize);
if (mParams.maxFrameSize < 0) {
- ALOGE("Invalid mParams.maxFrameSize %d\n", mParams.maxFrameSize);
- return AMEDIA_ERROR_INVALID_PARAMETER;
+ mParams.maxFrameSize = kDefaultAudioEncodeFrameSize;
}
if (mParams.frameSize > mParams.maxFrameSize) {
mParams.frameSize = mParams.maxFrameSize;
diff --git a/media/tests/benchmark/src/native/encoder/Encoder.h b/media/tests/benchmark/src/native/encoder/Encoder.h
index 3d12600..5ad142b 100644
--- a/media/tests/benchmark/src/native/encoder/Encoder.h
+++ b/media/tests/benchmark/src/native/encoder/Encoder.h
@@ -23,9 +23,11 @@
#include <queue>
#include <thread>
+#include "media/NdkImage.h"
#include "BenchmarkCommon.h"
#include "Stats.h"
+
struct encParameter {
int32_t bitrate = -1;
int32_t numFrames = -1;
@@ -38,6 +40,7 @@
int32_t frameRate = -1;
int32_t profile = 0;
int32_t level = 0;
+ int32_t colorFormat = AIMAGE_FORMAT_YUV_420_888;
};
class Encoder : public CallBackHandle {
diff --git a/media/tests/benchmark/tests/C2DecoderTest.cpp b/media/tests/benchmark/tests/C2DecoderTest.cpp
index ecd9759..dedc743 100644
--- a/media/tests/benchmark/tests/C2DecoderTest.cpp
+++ b/media/tests/benchmark/tests/C2DecoderTest.cpp
@@ -157,7 +157,7 @@
make_pair("bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", "mp3"),
make_pair("bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", "amrnb"),
make_pair("bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", "amrnb"),
- make_pair("bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", "vorbis"),
+ make_pair("bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", "vorbis"),
make_pair("bbb_44100hz_2ch_600kbps_flac_30sec.mp4", "flac"),
make_pair("bbb_48000hz_2ch_100kbps_opus_30sec.webm", "opus")));
diff --git a/media/tests/benchmark/tests/DecoderTest.cpp b/media/tests/benchmark/tests/DecoderTest.cpp
index 5c6aa5b..9f96d3b 100644
--- a/media/tests/benchmark/tests/DecoderTest.cpp
+++ b/media/tests/benchmark/tests/DecoderTest.cpp
@@ -101,7 +101,7 @@
make_tuple("bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", "", false),
make_tuple("bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", "", false),
make_tuple("bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", "", false),
- make_tuple("bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", "", false),
+ make_tuple("bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", "", false),
make_tuple("bbb_44100hz_2ch_600kbps_flac_30sec.mp4", "", false),
make_tuple("bbb_48000hz_2ch_100kbps_opus_30sec.webm", "", false)));
@@ -111,7 +111,7 @@
make_tuple("bbb_44100hz_2ch_128kbps_mp3_30sec.mp3", "", true),
make_tuple("bbb_8000hz_1ch_8kbps_amrnb_30sec.3gp", "", true),
make_tuple("bbb_16000hz_1ch_9kbps_amrwb_30sec.3gp", "", true),
- make_tuple("bbb_44100hz_2ch_80kbps_vorbis_30sec.mp4", "", true),
+ make_tuple("bbb_44100hz_2ch_80kbps_vorbis_30sec.webm", "", true),
make_tuple("bbb_44100hz_2ch_600kbps_flac_30sec.mp4", "", true),
make_tuple("bbb_48000hz_2ch_100kbps_opus_30sec.webm", "", true)));
diff --git a/media/tests/benchmark/tests/ExtractorTest.cpp b/media/tests/benchmark/tests/ExtractorTest.cpp
index c2d72ff..ad8f1e6 100644
--- a/media/tests/benchmark/tests/ExtractorTest.cpp
+++ b/media/tests/benchmark/tests/ExtractorTest.cpp
@@ -69,7 +69,7 @@
make_pair("bbb_44100hz_2ch_600kbps_flac_5mins.flac", 0),
make_pair("bbb_8000hz_1ch_8kbps_amrnb_5mins.3gp", 0),
make_pair("bbb_16000hz_1ch_9kbps_amrwb_5mins.3gp", 0),
- make_pair("bbb_44100hz_2ch_80kbps_vorbis_5mins.mp4", 0),
+ make_pair("bbb_44100hz_2ch_80kbps_vorbis_5mins.webm", 0),
make_pair("bbb_48000hz_2ch_100kbps_opus_5mins.webm",
0)));
diff --git a/media/tests/benchmark/tests/MuxerTest.cpp b/media/tests/benchmark/tests/MuxerTest.cpp
index 7b01732..fa2635d 100644
--- a/media/tests/benchmark/tests/MuxerTest.cpp
+++ b/media/tests/benchmark/tests/MuxerTest.cpp
@@ -136,7 +136,7 @@
make_pair("crowd_1920x1080_25fps_6700kbps_h264.ts", "3gpp"),
make_pair("crowd_1920x1080_25fps_4000kbps_h265.mkv", "3gpp"),
make_pair("bbb_48000hz_2ch_100kbps_opus_5mins.webm", "ogg"),
- make_pair("bbb_44100hz_2ch_80kbps_vorbis_5mins.mp4", "webm"),
+ make_pair("bbb_44100hz_2ch_80kbps_vorbis_5mins.webm", "webm"),
make_pair("bbb_48000hz_2ch_100kbps_opus_5mins.webm", "webm"),
make_pair("bbb_44100hz_2ch_128kbps_aac_5mins.mp4", "mp4"),
make_pair("bbb_8000hz_1ch_8kbps_amrnb_5mins.3gp", "mp4"),
diff --git a/media/utils/ServiceUtilities.cpp b/media/utils/ServiceUtilities.cpp
index 87ea084..7fd4d0a 100644
--- a/media/utils/ServiceUtilities.cpp
+++ b/media/utils/ServiceUtilities.cpp
@@ -223,6 +223,25 @@
return ok;
}
+bool accessCallAudioAllowed(const String16& opPackageName, pid_t pid, uid_t uid) {
+ static const String16 sAccessCallAudio("android.permission.ACCESS_CALL_AUDIO");
+ PermissionController permissionController;
+ const String16 resolvedOpPackageName = resolveCallingPackage(
+ permissionController, opPackageName, uid);
+ if (resolvedOpPackageName.size() == 0) {
+ ALOGE("accessCallAudioAllowed - FAIL - package not found.");
+ return false;
+ }
+ AppOpsManager appOps;
+ const int32_t op = appOps.permissionToOpCode(sAccessCallAudio);
+ const int32_t opResult = appOps.noteOp(op, uid, resolvedOpPackageName);
+ if (opResult == PermissionController::MODE_DEFAULT) {
+ // Only allow in case this is a system app with the proper privilege permission
+ return PermissionCache::checkPermission(sAccessCallAudio, pid, uid);
+ }
+ return opResult == PermissionController::MODE_ALLOWED;
+}
+
// privileged behavior needed by Dialer, Settings, SetupWizard and CellBroadcastReceiver
bool bypassInterruptionPolicyAllowed(pid_t pid, uid_t uid) {
static const String16 sWriteSecureSettings("android.permission.WRITE_SECURE_SETTINGS");
@@ -259,28 +278,29 @@
return NO_ERROR;
}
-sp<content::pm::IPackageManagerNative> MediaPackageManager::retreivePackageManager() {
+void MediaPackageManager::loadPackageManager() {
+ if (mPackageManager != nullptr) {
+ return;
+ }
const sp<IServiceManager> sm = defaultServiceManager();
if (sm == nullptr) {
ALOGW("%s: failed to retrieve defaultServiceManager", __func__);
- return nullptr;
+ return;
}
sp<IBinder> packageManager = sm->checkService(String16(nativePackageManagerName));
if (packageManager == nullptr) {
ALOGW("%s: failed to retrieve native package manager", __func__);
- return nullptr;
+ return;
}
- return interface_cast<content::pm::IPackageManagerNative>(packageManager);
+ mPackageManager = interface_cast<content::pm::IPackageManagerNative>(packageManager);
}
std::optional<bool> MediaPackageManager::doIsAllowed(uid_t uid) {
+ /** Can not fetch package manager at construction it may not yet be registered. */
+ loadPackageManager();
if (mPackageManager == nullptr) {
- /** Can not fetch package manager at construction it may not yet be registered. */
- mPackageManager = retreivePackageManager();
- if (mPackageManager == nullptr) {
- ALOGW("%s: Playback capture is denied as package manager is not reachable", __func__);
- return std::nullopt;
- }
+ ALOGW("%s: Playback capture is denied as package manager is not reachable", __func__);
+ return std::nullopt;
}
std::vector<std::string> packageNames;
diff --git a/media/utils/include/mediautils/ServiceUtilities.h b/media/utils/include/mediautils/ServiceUtilities.h
index 212599a..060e849 100644
--- a/media/utils/include/mediautils/ServiceUtilities.h
+++ b/media/utils/include/mediautils/ServiceUtilities.h
@@ -93,6 +93,7 @@
bool dumpAllowed();
bool modifyPhoneStateAllowed(pid_t pid, uid_t uid);
bool bypassInterruptionPolicyAllowed(pid_t pid, uid_t uid);
+bool accessCallAudioAllowed(const String16& opPackageName, pid_t pid, uid_t uid);
status_t checkIMemory(const sp<IMemory>& iMemory);
@@ -110,7 +111,7 @@
private:
static constexpr const char* nativePackageManagerName = "package_native";
std::optional<bool> doIsAllowed(uid_t uid);
- sp<content::pm::IPackageManagerNative> retreivePackageManager();
+ void loadPackageManager();
sp<content::pm::IPackageManagerNative> mPackageManager; // To check apps manifest
uint_t mPackageManagerErrors = 0;
struct Package {
diff --git a/services/audioflinger/Android.bp b/services/audioflinger/Android.bp
index f06d026..3873600 100644
--- a/services/audioflinger/Android.bp
+++ b/services/audioflinger/Android.bp
@@ -3,8 +3,6 @@
cc_library_shared {
name: "libaudioflinger",
- tidy: false, // b/146435095, segmentation fault with Effects.cpp
-
srcs: [
"AudioFlinger.cpp",
"AudioHwDevice.cpp",
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 5c5c5bb..e5a6e27 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -326,7 +326,7 @@
ret = AudioSystem::getOutputForAttr(&localAttr, &io,
actualSessionId,
&streamType, client.clientPid, client.clientUid,
- &fullConfig,
+ client.packageName, &fullConfig,
(audio_output_flags_t)(AUDIO_OUTPUT_FLAG_MMAP_NOIRQ |
AUDIO_OUTPUT_FLAG_DIRECT),
deviceId, &portId, &secondaryOutputs);
@@ -766,8 +766,9 @@
output.outputId = AUDIO_IO_HANDLE_NONE;
output.selectedDeviceId = input.selectedDeviceId;
lStatus = AudioSystem::getOutputForAttr(&localAttr, &output.outputId, sessionId, &streamType,
- clientPid, clientUid, &input.config, input.flags,
- &output.selectedDeviceId, &portId, &secondaryOutputs);
+ clientPid, clientUid, input.opPackageName,
+ &input.config, input.flags, &output.selectedDeviceId,
+ &portId, &secondaryOutputs);
if (lStatus != NO_ERROR || output.outputId == AUDIO_IO_HANDLE_NONE) {
ALOGE("createTrack() getOutputForAttr() return error %d or invalid output handle", lStatus);
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index ad09680..2833525 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1872,7 +1872,7 @@
// and the mute set to false).
mMasterVolume = audioFlinger->masterVolume_l();
mMasterMute = audioFlinger->masterMute_l();
- if (mOutput && mOutput->audioHwDev) {
+ if (mOutput->audioHwDev) {
if (mOutput->audioHwDev->canSetMasterVolume()) {
mMasterVolume = 1.0;
}
@@ -1902,9 +1902,11 @@
mStreamTypes[stream].volume = 0.0f;
mStreamTypes[stream].mute = mAudioFlinger->streamMute_l(stream);
}
- // Audio patch volume is always max
+ // Audio patch and call assistant volume are always max
mStreamTypes[AUDIO_STREAM_PATCH].volume = 1.0f;
mStreamTypes[AUDIO_STREAM_PATCH].mute = false;
+ mStreamTypes[AUDIO_STREAM_CALL_ASSISTANT].volume = 1.0f;
+ mStreamTypes[AUDIO_STREAM_CALL_ASSISTANT].mute = false;
}
AudioFlinger::PlaybackThread::~PlaybackThread()
@@ -2830,7 +2832,7 @@
this/* srcThread */, this/* dstThread */);
}
- audio_output_flags_t flags = mOutput != nullptr ? mOutput->flags : AUDIO_OUTPUT_FLAG_NONE;
+ audio_output_flags_t flags = mOutput->flags;
mediametrics::LogItem item(mMetricsId);
item.set(AMEDIAMETRICS_PROP_EVENT, AMEDIAMETRICS_PROP_EVENT_VALUE_READPARAMETERS)
.set(AMEDIAMETRICS_PROP_ENCODING, formatToString(mFormat).c_str())
@@ -8729,6 +8731,7 @@
&stream,
client.clientPid,
client.clientUid,
+ client.packageName,
&config,
flags,
&deviceId,
diff --git a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
index 2044863..5f551d5 100644
--- a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
+++ b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
@@ -135,8 +135,10 @@
}
DeviceVector deviceList =
mSupportedDevices.getDevicesFromTypes(deviceTypes);
- if (!deviceList.empty()) {
- return deviceList.itemAt(0)->hasCurrentEncodedFormat();
+ for (const auto& device : deviceList) {
+ if (device->hasCurrentEncodedFormat()) {
+ return true;
+ }
}
return false;
}
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
index 11660f0..ed51389 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioPolicyMix.cpp
@@ -224,6 +224,10 @@
hasFlag(attributes.flags, AUDIO_FLAG_NO_MEDIA_PROJECTION)) {
return MixMatchStatus::NO_MATCH;
}
+ if (attributes.usage == AUDIO_USAGE_VOICE_COMMUNICATION &&
+ !mix->mVoiceCommunicationCaptureAllowed) {
+ return MixMatchStatus::NO_MATCH;
+ }
if (!(attributes.usage == AUDIO_USAGE_UNKNOWN ||
attributes.usage == AUDIO_USAGE_MEDIA ||
attributes.usage == AUDIO_USAGE_GAME ||
@@ -353,11 +357,11 @@
// determine if exiting on success (or implicit failure as desc is 0)
if (hasAddrMatch ||
!((hasUsageExcludeRules && usageExclusionFound) ||
- (hasUserIdExcludeRules && userIdExclusionFound) ||
(hasUsageMatchRules && !usageMatchFound) ||
(hasUidExcludeRules && uidExclusionFound) ||
- (hasUidMatchRules && !uidMatchFound)) ||
- (hasUserIdMatchRules && !userIdMatchFound)) {
+ (hasUidMatchRules && !uidMatchFound) ||
+ (hasUserIdExcludeRules && userIdExclusionFound) ||
+ (hasUserIdMatchRules && !userIdMatchFound))) {
ALOGV("\tgetOutputForAttr will use mix %zu", mixIndex);
return MixMatchStatus::MATCH;
}
diff --git a/services/audiopolicy/engine/common/src/EngineBase.cpp b/services/audiopolicy/engine/common/src/EngineBase.cpp
index 525e965..1bc7fe3 100644
--- a/services/audiopolicy/engine/common/src/EngineBase.cpp
+++ b/services/audiopolicy/engine/common/src/EngineBase.cpp
@@ -107,6 +107,13 @@
engineConfig::ParsingResult EngineBase::loadAudioPolicyEngineConfig()
{
auto loadVolumeConfig = [](auto &volumeGroups, auto &volumeConfig) {
+ // Ensure name unicity to prevent duplicate
+ LOG_ALWAYS_FATAL_IF(std::any_of(std::begin(volumeGroups), std::end(volumeGroups),
+ [&volumeConfig](const auto &volumeGroup) {
+ return volumeConfig.name == volumeGroup.second->getName(); }),
+ "group name %s defined twice, review the configuration",
+ volumeConfig.name.c_str());
+
sp<VolumeGroup> volumeGroup = new VolumeGroup(volumeConfig.name, volumeConfig.indexMin,
volumeConfig.indexMax);
volumeGroups[volumeGroup->getId()] = volumeGroup;
@@ -125,13 +132,21 @@
}
return volumeGroup;
};
- auto addSupportedStreamAttributes = [](auto &group, auto &volumeGroup, auto &strategy) {
- volumeGroup->addSupportedStream(group.stream);
+ auto addSupportedAttributesToGroup = [](auto &group, auto &volumeGroup, auto &strategy) {
for (const auto &attr : group.attributesVect) {
strategy->addAttributes({group.stream, volumeGroup->getId(), attr});
volumeGroup->addSupportedAttributes(attr);
}
};
+ auto checkStreamForGroups = [](auto streamType, const auto &volumeGroups) {
+ const auto &iter = std::find_if(std::begin(volumeGroups), std::end(volumeGroups),
+ [&streamType](const auto &volumeGroup) {
+ const auto& streams = volumeGroup.second->getStreamTypes();
+ return std::find(std::begin(streams), std::end(streams), streamType) !=
+ std::end(streams);
+ });
+ return iter != end(volumeGroups);
+ };
auto result = engineConfig::parse();
if (result.parsedConfig == nullptr) {
@@ -140,24 +155,30 @@
android::status_t ret = engineConfig::parseLegacyVolumes(config.volumeGroups);
result = {std::make_unique<engineConfig::Config>(config),
static_cast<size_t>(ret == NO_ERROR ? 0 : 1)};
+ } else {
+ // Append for internal use only volume groups (e.g. rerouting/patch)
+ result.parsedConfig->volumeGroups.insert(
+ std::end(result.parsedConfig->volumeGroups),
+ std::begin(gSystemVolumeGroups), std::end(gSystemVolumeGroups));
}
- // Append for internal use only strategies/volume groups (e.g. rerouting/patch)
+ // Append for internal use only strategies (e.g. rerouting/patch)
result.parsedConfig->productStrategies.insert(
std::end(result.parsedConfig->productStrategies),
std::begin(gOrderedSystemStrategies), std::end(gOrderedSystemStrategies));
- result.parsedConfig->volumeGroups.insert(
- std::end(result.parsedConfig->volumeGroups),
- std::begin(gSystemVolumeGroups), std::end(gSystemVolumeGroups));
ALOGE_IF(result.nbSkippedElement != 0, "skipped %zu elements", result.nbSkippedElement);
engineConfig::VolumeGroup defaultVolumeConfig;
+ engineConfig::VolumeGroup defaultSystemVolumeConfig;
for (auto &volumeConfig : result.parsedConfig->volumeGroups) {
// save default volume config for streams not defined in configuration
if (volumeConfig.name.compare("AUDIO_STREAM_MUSIC") == 0) {
defaultVolumeConfig = volumeConfig;
}
+ if (volumeConfig.name.compare("AUDIO_STREAM_PATCH") == 0) {
+ defaultSystemVolumeConfig = volumeConfig;
+ }
loadVolumeConfig(mVolumeGroups, volumeConfig);
}
for (auto& strategyConfig : result.parsedConfig->productStrategies) {
@@ -166,18 +187,31 @@
const auto &iter = std::find_if(begin(mVolumeGroups), end(mVolumeGroups),
[&group](const auto &volumeGroup) {
return group.volumeGroup == volumeGroup.second->getName(); });
- if (group.stream != AUDIO_STREAM_DEFAULT) {
- if (iter == end(mVolumeGroups)) {
- ALOGW("%s: No configuration of %s found, using default volume configuration"
- , __FUNCTION__, group.volumeGroup.c_str());
- defaultVolumeConfig.name = group.volumeGroup;
- sp<VolumeGroup> volumeGroup =
- loadVolumeConfig(mVolumeGroups, defaultVolumeConfig);
- addSupportedStreamAttributes(group, volumeGroup, strategy);
+ sp<VolumeGroup> volumeGroup = nullptr;
+ // If no volume group provided for this strategy, creates a new one using
+ // Music Volume Group configuration (considered as the default)
+ if (iter == end(mVolumeGroups)) {
+ engineConfig::VolumeGroup volumeConfig;
+ if (group.stream >= AUDIO_STREAM_PUBLIC_CNT) {
+ volumeConfig = defaultSystemVolumeConfig;
} else {
- addSupportedStreamAttributes(group, iter->second, strategy);
+ volumeConfig = defaultVolumeConfig;
}
+ ALOGW("%s: No configuration of %s found, using default volume configuration"
+ , __FUNCTION__, group.volumeGroup.c_str());
+ volumeConfig.name = group.volumeGroup;
+ volumeGroup = loadVolumeConfig(mVolumeGroups, volumeConfig);
+ } else {
+ volumeGroup = iter->second;
}
+ if (group.stream != AUDIO_STREAM_DEFAULT) {
+ // A legacy stream can be assigned once to a volume group
+ LOG_ALWAYS_FATAL_IF(checkStreamForGroups(group.stream, mVolumeGroups),
+ "stream %s already assigned to a volume group, "
+ "review the configuration", toString(group.stream).c_str());
+ volumeGroup->addSupportedStream(group.stream);
+ }
+ addSupportedAttributesToGroup(group, volumeGroup, strategy);
}
product_strategy_t strategyId = strategy->getId();
mProductStrategies[strategyId] = strategy;
diff --git a/services/audiopolicy/engine/common/src/EngineDefaultConfig.h b/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
index 3366814..981582e 100644
--- a/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
+++ b/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
@@ -113,7 +113,7 @@
},
{"STRATEGY_CALL_ASSISTANT",
{
- {"", AUDIO_STREAM_PATCH, "AUDIO_STREAM_PATCH",
+ {"", AUDIO_STREAM_CALL_ASSISTANT, "AUDIO_STREAM_CALL_ASSISTANT",
{{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_CALL_ASSISTANT, AUDIO_SOURCE_DEFAULT, 0, ""}}
}
},
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 6ce3388..0aa087a 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -2528,15 +2528,29 @@
if (curDevices.erase(AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
curDevices.insert(AUDIO_DEVICE_OUT_SPEAKER);
}
-
+ if (!(desc->isActive(vs) || isInCall())) {
+ continue;
+ }
+ if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME &&
+ curDevices.find(device) == curDevices.end()) {
+ continue;
+ }
+ bool applyVolume = false;
+ if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME) {
+ curSrcDevices.insert(device);
+ applyVolume = (curSrcDevices.find(
+ Volume::getDeviceForVolume(curDevices)) != curSrcDevices.end());
+ } else {
+ applyVolume = !curves.hasVolumeIndexForDevice(curSrcDevice);
+ }
+ if (!applyVolume) {
+ continue; // next output
+ }
// Inter / intra volume group priority management: Loop on strategies arranged by priority
// If a higher priority strategy is active, and the output is routed to a device with a
// HW Gain management, do not change the volume
- bool applyVolume = false;
if (desc->useHwGain()) {
- if (!(desc->isActive(toVolumeSource(group)) || isInCall())) {
- continue;
- }
+ applyVolume = false;
for (const auto &productStrategy : mEngine->getOrderedProductStrategies()) {
auto activeClients = desc->clientsList(true /*activeOnly*/, productStrategy,
false /*preferredDevice*/);
@@ -2570,39 +2584,16 @@
if (!applyVolume) {
continue; // next output
}
- status_t volStatus = checkAndSetVolume(curves, vs, index, desc, curDevices,
- (vs == toVolumeSource(AUDIO_STREAM_SYSTEM)?
- TOUCH_SOUND_FIXED_DELAY_MS : 0));
- if (volStatus != NO_ERROR) {
- status = volStatus;
- }
- continue;
}
- if (!(desc->isActive(vs) || isInCall())) {
- continue;
- }
- if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME &&
- curDevices.find(device) == curDevices.end()) {
- continue;
- }
- if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME) {
- curSrcDevices.insert(device);
- applyVolume = (curSrcDevices.find(
- Volume::getDeviceForVolume(curDevices)) != curSrcDevices.end());
- } else {
- applyVolume = !curves.hasVolumeIndexForDevice(curSrcDevice);
- }
- if (applyVolume) {
- //FIXME: workaround for truncated touch sounds
- // delayed volume change for system stream to be removed when the problem is
- // handled by system UI
- status_t volStatus = checkAndSetVolume(
- curves, vs, index, desc, curDevices,
- ((vs == toVolumeSource(AUDIO_STREAM_SYSTEM))?
- TOUCH_SOUND_FIXED_DELAY_MS : 0));
- if (volStatus != NO_ERROR) {
- status = volStatus;
- }
+ //FIXME: workaround for truncated touch sounds
+ // delayed volume change for system stream to be removed when the problem is
+ // handled by system UI
+ status_t volStatus = checkAndSetVolume(
+ curves, vs, index, desc, curDevices,
+ ((vs == toVolumeSource(AUDIO_STREAM_SYSTEM))?
+ TOUCH_SOUND_FIXED_DELAY_MS : 0));
+ if (volStatus != NO_ERROR) {
+ status = volStatus;
}
}
mpClientInterface->onAudioVolumeGroupChanged(group, 0 /*flags*/);
diff --git a/services/audiopolicy/service/Android.mk b/services/audiopolicy/service/Android.mk
index d34dbe3..80f4eab 100644
--- a/services/audiopolicy/service/Android.mk
+++ b/services/audiopolicy/service/Android.mk
@@ -26,7 +26,6 @@
libaudioutils \
libaudiofoundation \
libhardware_legacy \
- libaudiopolicy \
libaudiopolicymanager \
libmedia_helper \
libmediametrics \
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 8bc2837..38801ec 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -121,7 +121,7 @@
device_name, encodedFormat);
}
-status_t AudioPolicyService::setPhoneState(audio_mode_t state)
+status_t AudioPolicyService::setPhoneState(audio_mode_t state, uid_t uid)
{
if (mAudioPolicyManager == NULL) {
return NO_INIT;
@@ -145,6 +145,7 @@
AutoCallerClear acc;
mAudioPolicyManager->setPhoneState(state);
mPhoneState = state;
+ mPhoneStateOwnerUid = uid;
return NO_ERROR;
}
@@ -210,6 +211,7 @@
audio_stream_type_t *stream,
pid_t pid,
uid_t uid,
+ const String16& opPackageName,
const audio_config_t *config,
audio_output_flags_t flags,
audio_port_handle_t *selectedDeviceId,
@@ -256,7 +258,8 @@
case AudioPolicyInterface::API_OUTPUT_LEGACY:
break;
case AudioPolicyInterface::API_OUTPUT_TELEPHONY_TX:
- if (!modifyPhoneStateAllowed(pid, uid)) {
+ if (!modifyPhoneStateAllowed(pid, uid) &&
+ !accessCallAudioAllowed(opPackageName, pid, uid)) {
ALOGE("%s() permission denied: modify phone state not allowed for uid %d",
__func__, uid);
result = PERMISSION_DENIED;
@@ -453,15 +456,22 @@
}
bool canCaptureOutput = captureAudioOutputAllowed(pid, uid);
- if ((inputSource == AUDIO_SOURCE_VOICE_UPLINK ||
- inputSource == AUDIO_SOURCE_VOICE_DOWNLINK ||
- inputSource == AUDIO_SOURCE_VOICE_CALL ||
- inputSource == AUDIO_SOURCE_ECHO_REFERENCE||
- inputSource == AUDIO_SOURCE_FM_TUNER) &&
+ bool canCaptureTelephonyOutput = canCaptureOutput
+ || accessCallAudioAllowed(opPackageName, pid, uid);
+
+ if ((attr->source == AUDIO_SOURCE_ECHO_REFERENCE ||
+ attr->source == AUDIO_SOURCE_FM_TUNER) &&
!canCaptureOutput) {
return PERMISSION_DENIED;
}
+ if ((attr->source == AUDIO_SOURCE_VOICE_UPLINK ||
+ attr->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
+ attr->source == AUDIO_SOURCE_VOICE_CALL) &&
+ !canCaptureTelephonyOutput) {
+ return PERMISSION_DENIED;
+ }
+
bool canCaptureHotword = captureHotwordAllowed(opPackageName, pid, uid);
if ((inputSource == AUDIO_SOURCE_HOTWORD) && !canCaptureHotword) {
return BAD_VALUE;
@@ -493,6 +503,11 @@
break;
case AudioPolicyInterface::API_INPUT_TELEPHONY_RX:
// FIXME: use the same permission as for remote submix for now.
+ if (!canCaptureTelephonyOutput) {
+ ALOGE("getInputForAttr() permission denied: call capture not allowed");
+ status = PERMISSION_DENIED;
+ }
+ break;
case AudioPolicyInterface::API_INPUT_MIX_CAPTURE:
if (!canCaptureOutput) {
ALOGE("getInputForAttr() permission denied: capture not allowed");
@@ -520,9 +535,13 @@
return status;
}
+ bool allowAudioCapture = canCaptureOutput ||
+ (inputType == AudioPolicyInterface::API_INPUT_TELEPHONY_RX &&
+ canCaptureTelephonyOutput);
+
sp<AudioRecordClient> client = new AudioRecordClient(*attr, *input, uid, pid, session, *portId,
*selectedDeviceId, opPackageName,
- canCaptureOutput, canCaptureHotword);
+ allowAudioCapture, canCaptureHotword);
mAudioRecordClients.add(*portId, client);
}
@@ -1215,26 +1234,14 @@
return PERMISSION_DENIED;
}
- // Require CAPTURE_VOICE_COMMUNICATION_OUTPUT if one of the
- // mixes is a render|loopback mix that aim to capture audio played with
- // USAGE_VOICE_COMMUNICATION.
+ // If one of the mixes has needCaptureVoiceCommunicationOutput set to true, then we
+ // need to verify that the caller still has CAPTURE_VOICE_COMMUNICATION_OUTPUT
bool needCaptureVoiceCommunicationOutput =
std::any_of(mixes.begin(), mixes.end(), [](auto& mix) {
- return is_mix_loopback_render(mix.mRouteFlags) &&
- mix.hasMatchingRuleForUsage([] (auto usage) {
- return usage == AUDIO_USAGE_VOICE_COMMUNICATION;});
- });
+ return mix.mVoiceCommunicationCaptureAllowed; });
- // Require CAPTURE_MEDIA_OUTPUT if there is a mix for priveliged capture
- // which is trying to capture any usage which is not USAGE_VOICE_COMMUNICATION.
- // (If USAGE_VOICE_COMMUNICATION should be captured, then CAPTURE_VOICE_COMMUNICATION_OUTPUT
- // is required, even if it is not privileged capture).
bool needCaptureMediaOutput = std::any_of(mixes.begin(), mixes.end(), [](auto& mix) {
- return mix.mAllowPrivilegedPlaybackCapture &&
- mix.hasMatchingRuleForUsage([] (auto usage) {
- return usage != AUDIO_USAGE_VOICE_COMMUNICATION;
- });
- });
+ return mix.mAllowPrivilegedPlaybackCapture; });
const uid_t callingUid = IPCThreadState::self()->getCallingUid();
const pid_t callingPid = IPCThreadState::self()->getCallingPid();
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index e5c36ea..99cec5a 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -534,8 +534,8 @@
// OR client has CAPTURE_AUDIO_OUTPUT privileged permission
bool allowCapture = !isAssistantOnTop
&& ((isTopOrLatestActive && !isLatestSensitive) || isLatestSensitive)
- && !(isSensitiveActive && !(isLatestSensitive || current->canCaptureOutput))
- && !(isInCall && !current->canCaptureOutput);
+ && !(isSensitiveActive && !(isLatestSensitive || current->canCaptureCallOrOutput))
+ && !(isInCall && !current->canCaptureCallOrOutput);
if (isVirtualSource(source)) {
// Allow capture for virtual (remote submix, call audio TX or RX...) sources
@@ -555,7 +555,7 @@
} else {
if (((isAssistantOnTop && source == AUDIO_SOURCE_VOICE_RECOGNITION) ||
source == AUDIO_SOURCE_HOTWORD) &&
- (!(isSensitiveActive || isInCall) || current->canCaptureOutput)) {
+ (!(isSensitiveActive || isInCall) || current->canCaptureCallOrOutput)) {
allowCapture = true;
}
}
@@ -567,7 +567,7 @@
// OR
// Is on TOP AND the source is VOICE_RECOGNITION or HOTWORD
if (!isAssistantOnTop
- && (!(isSensitiveActive || isInCall) || current->canCaptureOutput)) {
+ && (!(isSensitiveActive || isInCall) || current->canCaptureCallOrOutput)) {
allowCapture = true;
}
if (isA11yOnTop) {
@@ -580,7 +580,7 @@
// All active clients are using HOTWORD source
// AND no call is active
// OR client has CAPTURE_AUDIO_OUTPUT privileged permission
- if (onlyHotwordActive && !(isInCall && !current->canCaptureOutput)) {
+ if (onlyHotwordActive && !(isInCall && !current->canCaptureCallOrOutput)) {
allowCapture = true;
}
}
diff --git a/services/audiopolicy/service/AudioPolicyService.h b/services/audiopolicy/service/AudioPolicyService.h
index e297f34..c3c87f1 100644
--- a/services/audiopolicy/service/AudioPolicyService.h
+++ b/services/audiopolicy/service/AudioPolicyService.h
@@ -72,7 +72,7 @@
const char *device_address,
const char *device_name,
audio_format_t encodedFormat);
- virtual status_t setPhoneState(audio_mode_t state);
+ virtual status_t setPhoneState(audio_mode_t state, uid_t uid);
virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config);
virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage);
virtual audio_io_handle_t getOutput(audio_stream_type_t stream);
@@ -82,6 +82,7 @@
audio_stream_type_t *stream,
pid_t pid,
uid_t uid,
+ const String16& opPackageName,
const audio_config_t *config,
audio_output_flags_t flags,
audio_port_handle_t *selectedDeviceId,
@@ -807,15 +808,16 @@
const audio_io_handle_t io, uid_t uid, pid_t pid,
const audio_session_t session, audio_port_handle_t portId,
const audio_port_handle_t deviceId, const String16& opPackageName,
- bool canCaptureOutput, bool canCaptureHotword) :
+ bool canCaptureCallOrOutput, bool canCaptureHotword) :
AudioClient(attributes, io, uid, pid, session, portId, deviceId),
opPackageName(opPackageName), startTimeNs(0),
- canCaptureOutput(canCaptureOutput), canCaptureHotword(canCaptureHotword) {}
+ canCaptureCallOrOutput(canCaptureCallOrOutput),
+ canCaptureHotword(canCaptureHotword) {}
~AudioRecordClient() override = default;
const String16 opPackageName; // client package name
nsecs_t startTimeNs;
- const bool canCaptureOutput;
+ const bool canCaptureCallOrOutput;
const bool canCaptureHotword;
};
@@ -880,6 +882,7 @@
// those can call back into AudioPolicyService methods and try to acquire the mutex
sp<AudioPolicyEffects> mAudioPolicyEffects;
audio_mode_t mPhoneState;
+ uid_t mPhoneStateOwnerUid;
sp<UidPolicy> mUidPolicy;
sp<SensorPrivacyPolicy> mSensorPrivacyPolicy;
diff --git a/services/camera/libcameraservice/Android.bp b/services/camera/libcameraservice/Android.bp
index 98fee12..501d922 100644
--- a/services/camera/libcameraservice/Android.bp
+++ b/services/camera/libcameraservice/Android.bp
@@ -116,6 +116,7 @@
"libyuv",
"android.frameworks.cameraservice.common@2.0",
"android.frameworks.cameraservice.service@2.0",
+ "android.frameworks.cameraservice.service@2.1",
"android.frameworks.cameraservice.device@2.0",
"android.hardware.camera.common@1.0",
"android.hardware.camera.provider@2.4",
@@ -129,6 +130,10 @@
"android.hardware.camera.device@3.6"
],
+ static_libs: [
+ "libbinderthreadstateutils",
+ ],
+
export_shared_lib_headers: [
"libbinder",
"libcamera_client",
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 5358307..453984e 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -43,6 +43,7 @@
#include <binder/PermissionController.h>
#include <binder/ProcessInfoService.h>
#include <binder/IResultReceiver.h>
+#include <binderthreadstate/CallerUtils.h>
#include <cutils/atomic.h>
#include <cutils/properties.h>
#include <cutils/misc.h>
@@ -456,10 +457,14 @@
}
if (updated) {
- logDeviceRemoved(id, String8::format("Device %s-%s availability changed from %d to %d",
- id.string(), physicalId.string(),
- newStatus != StatusInternal::PRESENT,
- newStatus == StatusInternal::PRESENT));
+ String8 idCombo = id + " : " + physicalId;
+ if (newStatus == StatusInternal::PRESENT) {
+ logDeviceAdded(idCombo,
+ String8::format("Device status changed to %d", newStatus));
+ } else {
+ logDeviceRemoved(idCombo,
+ String8::format("Device status changed to %d", newStatus));
+ }
String16 id16(id), physicalId16(physicalId);
Mutex::Autolock lock(mStatusListenerLock);
@@ -1179,7 +1184,7 @@
// Only allow clients who are being used by the current foreground device user, unless calling
// from our own process OR the caller is using the cameraserver's HIDL interface.
- if (!hardware::IPCThreadState::self()->isServingCall() && callingPid != getpid() &&
+ if (getCurrentServingCall() != BinderCallType::HWBINDER && callingPid != getpid() &&
(mAllowedUsers.find(clientUserId) == mAllowedUsers.end())) {
ALOGE("CameraService::connect X (PID %d) rejected (cannot connect from "
"device user %d, currently allowed device users: %s)", callingPid, clientUserId,
@@ -1534,7 +1539,7 @@
return false;
}
// (2)
- if (!hardware::IPCThreadState::self()->isServingCall() &&
+ if (getCurrentServingCall() != BinderCallType::HWBINDER &&
systemCameraKind == SystemCameraKind::HIDDEN_SECURE_CAMERA) {
ALOGW("Rejecting access to secure hidden camera %s", cameraId.c_str());
return true;
@@ -1543,7 +1548,7 @@
// getCameraCharacteristics() allows for calls to succeed (albeit after hiding some
// characteristics) even if clients don't have android.permission.CAMERA. We do not want the
// same behavior for system camera devices.
- if (!hardware::IPCThreadState::self()->isServingCall() &&
+ if (getCurrentServingCall() != BinderCallType::HWBINDER &&
systemCameraKind == SystemCameraKind::SYSTEM_ONLY_CAMERA &&
!hasPermissionsForSystemCamera(cPid, cUid)) {
ALOGW("Rejecting access to system only camera %s, inadequete permissions",
@@ -1569,7 +1574,7 @@
sp<CameraDeviceClient> client = nullptr;
String16 clientPackageNameAdj = clientPackageName;
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
std::string vendorClient =
StringPrintf("vendor.client.pid<%d>", CameraThreadState::getCallingPid());
clientPackageNameAdj = String16(vendorClient.c_str());
@@ -2778,7 +2783,7 @@
}
mClientPackageName = packages[0];
}
- if (!hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() != BinderCallType::HWBINDER) {
mAppOpsManager = std::make_unique<AppOpsManager>();
}
}
@@ -3450,7 +3455,7 @@
const std::set<String8>& conflictingKeys, int32_t score, int32_t ownerId,
int32_t state) {
- bool isVendorClient = hardware::IPCThreadState::self()->isServingCall();
+ bool isVendorClient = getCurrentServingCall() == BinderCallType::HWBINDER;
int32_t score_adj = isVendorClient ? kVendorClientScore : score;
int32_t state_adj = isVendorClient ? kVendorClientState: state;
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index 90d21a2..f29431c 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -364,100 +364,103 @@
status_t Camera3Device::disconnectImpl() {
ATRACE_CALL();
- Mutex::Autolock il(mInterfaceLock);
-
ALOGI("%s: E", __FUNCTION__);
status_t res = OK;
std::vector<wp<Camera3StreamInterface>> streams;
- nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
{
- Mutex::Autolock l(mLock);
- if (mStatus == STATUS_UNINITIALIZED) return res;
+ Mutex::Autolock il(mInterfaceLock);
+ nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
+ {
+ Mutex::Autolock l(mLock);
+ if (mStatus == STATUS_UNINITIALIZED) return res;
- if (mStatus == STATUS_ACTIVE ||
- (mStatus == STATUS_ERROR && mRequestThread != NULL)) {
- res = mRequestThread->clearRepeatingRequests();
- if (res != OK) {
- SET_ERR_L("Can't stop streaming");
- // Continue to close device even in case of error
- } else {
- res = waitUntilStateThenRelock(/*active*/ false, maxExpectedDuration);
+ if (mStatus == STATUS_ACTIVE ||
+ (mStatus == STATUS_ERROR && mRequestThread != NULL)) {
+ res = mRequestThread->clearRepeatingRequests();
if (res != OK) {
- SET_ERR_L("Timeout waiting for HAL to drain (% " PRIi64 " ns)",
- maxExpectedDuration);
+ SET_ERR_L("Can't stop streaming");
// Continue to close device even in case of error
+ } else {
+ res = waitUntilStateThenRelock(/*active*/ false, maxExpectedDuration);
+ if (res != OK) {
+ SET_ERR_L("Timeout waiting for HAL to drain (% " PRIi64 " ns)",
+ maxExpectedDuration);
+ // Continue to close device even in case of error
+ }
}
}
- }
- if (mStatus == STATUS_ERROR) {
- CLOGE("Shutting down in an error state");
- }
+ if (mStatus == STATUS_ERROR) {
+ CLOGE("Shutting down in an error state");
+ }
- if (mStatusTracker != NULL) {
- mStatusTracker->requestExit();
- }
+ if (mStatusTracker != NULL) {
+ mStatusTracker->requestExit();
+ }
- if (mRequestThread != NULL) {
- mRequestThread->requestExit();
- }
+ if (mRequestThread != NULL) {
+ mRequestThread->requestExit();
+ }
- streams.reserve(mOutputStreams.size() + (mInputStream != nullptr ? 1 : 0));
- for (size_t i = 0; i < mOutputStreams.size(); i++) {
- streams.push_back(mOutputStreams[i]);
- }
- if (mInputStream != nullptr) {
- streams.push_back(mInputStream);
+ streams.reserve(mOutputStreams.size() + (mInputStream != nullptr ? 1 : 0));
+ for (size_t i = 0; i < mOutputStreams.size(); i++) {
+ streams.push_back(mOutputStreams[i]);
+ }
+ if (mInputStream != nullptr) {
+ streams.push_back(mInputStream);
+ }
}
}
-
- // Joining done without holding mLock, otherwise deadlocks may ensue
- // as the threads try to access parent state
+ // Joining done without holding mLock and mInterfaceLock, otherwise deadlocks may ensue
+ // as the threads try to access parent state (b/143513518)
if (mRequestThread != NULL && mStatus != STATUS_ERROR) {
// HAL may be in a bad state, so waiting for request thread
// (which may be stuck in the HAL processCaptureRequest call)
// could be dangerous.
+ // give up mInterfaceLock here and then lock it again. Could this lead
+ // to other deadlocks
mRequestThread->join();
}
-
- if (mStatusTracker != NULL) {
- mStatusTracker->join();
- }
-
- HalInterface* interface;
{
- Mutex::Autolock l(mLock);
- mRequestThread.clear();
- Mutex::Autolock stLock(mTrackerLock);
- mStatusTracker.clear();
- interface = mInterface.get();
- }
+ Mutex::Autolock il(mInterfaceLock);
+ if (mStatusTracker != NULL) {
+ mStatusTracker->join();
+ }
- // Call close without internal mutex held, as the HAL close may need to
- // wait on assorted callbacks,etc, to complete before it can return.
- interface->close();
+ HalInterface* interface;
+ {
+ Mutex::Autolock l(mLock);
+ mRequestThread.clear();
+ Mutex::Autolock stLock(mTrackerLock);
+ mStatusTracker.clear();
+ interface = mInterface.get();
+ }
- flushInflightRequests();
+ // Call close without internal mutex held, as the HAL close may need to
+ // wait on assorted callbacks,etc, to complete before it can return.
+ interface->close();
- {
- Mutex::Autolock l(mLock);
- mInterface->clear();
- mOutputStreams.clear();
- mInputStream.clear();
- mDeletedStreams.clear();
- mBufferManager.clear();
- internalUpdateStatusLocked(STATUS_UNINITIALIZED);
- }
+ flushInflightRequests();
- for (auto& weakStream : streams) {
- sp<Camera3StreamInterface> stream = weakStream.promote();
- if (stream != nullptr) {
- ALOGE("%s: Stream %d leaked! strong reference (%d)!",
- __FUNCTION__, stream->getId(), stream->getStrongCount() - 1);
+ {
+ Mutex::Autolock l(mLock);
+ mInterface->clear();
+ mOutputStreams.clear();
+ mInputStream.clear();
+ mDeletedStreams.clear();
+ mBufferManager.clear();
+ internalUpdateStatusLocked(STATUS_UNINITIALIZED);
+ }
+
+ for (auto& weakStream : streams) {
+ sp<Camera3StreamInterface> stream = weakStream.promote();
+ if (stream != nullptr) {
+ ALOGE("%s: Stream %d leaked! strong reference (%d)!",
+ __FUNCTION__, stream->getId(), stream->getStrongCount() - 1);
+ }
}
}
-
ALOGI("%s: X", __FUNCTION__);
return res;
}
@@ -1768,9 +1771,7 @@
}
void Camera3Device::pauseStateNotify(bool enable) {
- // We must not hold mInterfaceLock here since this function is called from
- // RequestThread::threadLoop and holding mInterfaceLock could lead to
- // deadlocks (http://b/143513518)
+ Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock l(mLock);
mPauseStateNotify = enable;
@@ -2340,9 +2341,7 @@
ATRACE_CALL();
bool ret = false;
- // We must not hold mInterfaceLock here since this function is called from
- // RequestThread::threadLoop and holding mInterfaceLock could lead to
- // deadlocks (http://b/143513518)
+ Mutex::Autolock il(mInterfaceLock);
nsecs_t maxExpectedDuration = getExpectedInFlightDuration();
Mutex::Autolock l(mLock);
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index e13e45f..0069fb3 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -278,7 +278,6 @@
// A lock to enforce serialization on the input/configure side
// of the public interface.
- // Only locked by public methods inherited from CameraDeviceBase.
// Not locked by methods guarded by mOutputLock, since they may act
// concurrently to the input/configure side of the interface.
// Must be locked before mLock if both will be locked by a method
@@ -1102,7 +1101,7 @@
uint32_t mNextReprocessShutterFrameNumber;
// the minimal frame number of the next ZSL still capture shutter
uint32_t mNextZslStillShutterFrameNumber;
- List<CaptureResult> mResultQueue;
+ std::list<CaptureResult> mResultQueue;
std::condition_variable mResultSignal;
wp<NotificationListener> mListener;
diff --git a/services/camera/libcameraservice/device3/Camera3OfflineSession.h b/services/camera/libcameraservice/device3/Camera3OfflineSession.h
index 27043d2..208f70d 100644
--- a/services/camera/libcameraservice/device3/Camera3OfflineSession.h
+++ b/services/camera/libcameraservice/device3/Camera3OfflineSession.h
@@ -212,7 +212,7 @@
const uint32_t mNumPartialResults;
std::mutex mOutputLock;
- List<CaptureResult> mResultQueue;
+ std::list<CaptureResult> mResultQueue;
std::condition_variable mResultSignal;
// the minimal frame number of the next non-reprocess result
uint32_t mNextResultFrameNumber;
diff --git a/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp b/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp
index 39b7db4..238356e 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputUtils.cpp
@@ -153,9 +153,9 @@
}
// Valid result, insert into queue
- List<CaptureResult>::iterator queuedResult =
+ std::list<CaptureResult>::iterator queuedResult =
states.resultQueue.insert(states.resultQueue.end(), CaptureResult(*result));
- ALOGVV("%s: result requestId = %" PRId32 ", frameNumber = %" PRId64
+ ALOGV("%s: result requestId = %" PRId32 ", frameNumber = %" PRId64
", burstId = %" PRId32, __FUNCTION__,
queuedResult->mResultExtras.requestId,
queuedResult->mResultExtras.frameNumber,
diff --git a/services/camera/libcameraservice/device3/Camera3OutputUtils.h b/services/camera/libcameraservice/device3/Camera3OutputUtils.h
index 300df5b..fbb47f8 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputUtils.h
+++ b/services/camera/libcameraservice/device3/Camera3OutputUtils.h
@@ -62,7 +62,7 @@
std::mutex& inflightLock;
InFlightRequestMap& inflightMap; // end of inflightLock scope
std::mutex& outputLock;
- List<CaptureResult>& resultQueue;
+ std::list<CaptureResult>& resultQueue;
std::condition_variable& resultSignal;
uint32_t& nextShutterFrameNum;
uint32_t& nextReprocShutterFrameNum;
diff --git a/services/camera/libcameraservice/hidl/AidlCameraServiceListener.cpp b/services/camera/libcameraservice/hidl/AidlCameraServiceListener.cpp
index 110ef8e..8e619e1 100644
--- a/services/camera/libcameraservice/hidl/AidlCameraServiceListener.cpp
+++ b/services/camera/libcameraservice/hidl/AidlCameraServiceListener.cpp
@@ -25,6 +25,7 @@
namespace implementation {
using hardware::cameraservice::utils::conversion::convertToHidlCameraDeviceStatus;
+typedef frameworks::cameraservice::service::V2_1::ICameraServiceListener HCameraServiceListener2_1;
binder::Status H2BCameraServiceListener::onStatusChanged(
int32_t status, const ::android::String16& cameraId) {
@@ -40,6 +41,29 @@
return binder::Status::ok();
}
+binder::Status H2BCameraServiceListener::onPhysicalCameraStatusChanged(
+ int32_t status, const ::android::String16& cameraId,
+ const ::android::String16& physicalCameraId) {
+ auto cast2_1 = HCameraServiceListener2_1::castFrom(mBase);
+ sp<HCameraServiceListener2_1> interface2_1 = nullptr;
+ if (cast2_1.isOk()) {
+ interface2_1 = cast2_1;
+ if (interface2_1 != nullptr) {
+ HCameraDeviceStatus hCameraDeviceStatus = convertToHidlCameraDeviceStatus(status);
+ V2_1::PhysicalCameraStatusAndId cameraStatusAndId;
+ cameraStatusAndId.deviceStatus = hCameraDeviceStatus;
+ cameraStatusAndId.cameraId = String8(cameraId).string();
+ cameraStatusAndId.physicalCameraId = String8(physicalCameraId).string();
+ auto ret = interface2_1->onPhysicalCameraStatusChanged(cameraStatusAndId);
+ if (!ret.isOk()) {
+ ALOGE("%s OnPhysicalCameraStatusChanged callback failed due to %s",__FUNCTION__,
+ ret.description().c_str());
+ }
+ }
+ }
+ return binder::Status::ok();
+}
+
::android::binder::Status H2BCameraServiceListener::onTorchStatusChanged(
int32_t, const ::android::String16&) {
// We don't implement onTorchStatusChanged
diff --git a/services/camera/libcameraservice/hidl/AidlCameraServiceListener.h b/services/camera/libcameraservice/hidl/AidlCameraServiceListener.h
index 175eb8e..95493a1 100644
--- a/services/camera/libcameraservice/hidl/AidlCameraServiceListener.h
+++ b/services/camera/libcameraservice/hidl/AidlCameraServiceListener.h
@@ -19,6 +19,7 @@
#include <android/frameworks/cameraservice/common/2.0/types.h>
#include <android/frameworks/cameraservice/service/2.0/ICameraServiceListener.h>
+#include <android/frameworks/cameraservice/service/2.1/ICameraServiceListener.h>
#include <android/frameworks/cameraservice/device/2.0/types.h>
#include <android/hardware/BnCameraServiceListener.h>
#include <android/hardware/BpCameraServiceListener.h>
@@ -47,17 +48,14 @@
virtual ::android::binder::Status onStatusChanged(int32_t status,
const ::android::String16& cameraId) override;
- virtual ::android::binder::Status onPhysicalCameraStatusChanged(int32_t /*status*/,
- const ::android::String16& /*cameraId*/,
- const ::android::String16& /*physicalCameraId*/) override {
- // no implementation yet.
- return binder::Status::ok();
- }
+ virtual ::android::binder::Status onPhysicalCameraStatusChanged(int32_t status,
+ const ::android::String16& cameraId,
+ const ::android::String16& physicalCameraId) override;
virtual ::android::binder::Status onTorchStatusChanged(
int32_t status, const ::android::String16& cameraId) override;
virtual binder::Status onCameraAccessPrioritiesChanged() {
- // TODO: no implementation yet. b/148146086
+ // TODO: no implementation yet.
return binder::Status::ok();
}
};
diff --git a/services/camera/libcameraservice/hidl/Convert.cpp b/services/camera/libcameraservice/hidl/Convert.cpp
index 866c3b5..597147b 100644
--- a/services/camera/libcameraservice/hidl/Convert.cpp
+++ b/services/camera/libcameraservice/hidl/Convert.cpp
@@ -197,6 +197,23 @@
return;
}
+void convertToHidl(const std::vector<hardware::CameraStatus> &src,
+ hidl_vec<frameworks::cameraservice::service::V2_1::CameraStatusAndId>* dst) {
+ dst->resize(src.size());
+ size_t i = 0;
+ for (const auto &statusAndId : src) {
+ auto &a = (*dst)[i++];
+ a.v2_0.cameraId = statusAndId.cameraId.c_str();
+ a.v2_0.deviceStatus = convertToHidlCameraDeviceStatus(statusAndId.status);
+ size_t numUnvailPhysicalCameras = statusAndId.unavailablePhysicalIds.size();
+ a.unavailPhysicalCameraIds.resize(numUnvailPhysicalCameras);
+ for (size_t j = 0; j < numUnvailPhysicalCameras; j++) {
+ a.unavailPhysicalCameraIds[j] = statusAndId.unavailablePhysicalIds[j].c_str();
+ }
+ }
+ return;
+}
+
void convertToHidl(
const hardware::camera2::utils::SubmitInfo &submitInfo,
frameworks::cameraservice::device::V2_0::SubmitInfo *hSubmitInfo) {
diff --git a/services/camera/libcameraservice/hidl/Convert.h b/services/camera/libcameraservice/hidl/Convert.h
index 79683f6..82ffc48 100644
--- a/services/camera/libcameraservice/hidl/Convert.h
+++ b/services/camera/libcameraservice/hidl/Convert.h
@@ -23,6 +23,7 @@
#include <android/frameworks/cameraservice/device/2.0/ICameraDeviceUser.h>
#include <android/frameworks/cameraservice/common/2.0/types.h>
#include <android/frameworks/cameraservice/service/2.0/types.h>
+#include <android/frameworks/cameraservice/service/2.1/types.h>
#include <android/frameworks/cameraservice/device/2.0/types.h>
#include <android/hardware/camera/common/1.0/types.h>
#include <android/hardware/camera2/ICameraDeviceUser.h>
@@ -79,6 +80,9 @@
void convertToHidl(const std::vector<hardware::CameraStatus> &src,
hidl_vec<HCameraStatusAndId>* dst);
+void convertToHidl(const std::vector<hardware::CameraStatus> &src,
+ hidl_vec<frameworks::cameraservice::service::V2_1::CameraStatusAndId>* dst);
+
void convertToHidl(const hardware::camera2::utils::SubmitInfo &submitInfo,
HSubmitInfo *hSubmitInfo);
diff --git a/services/camera/libcameraservice/hidl/HidlCameraService.cpp b/services/camera/libcameraservice/hidl/HidlCameraService.cpp
index 97ba9c4..a46133e 100644
--- a/services/camera/libcameraservice/hidl/HidlCameraService.cpp
+++ b/services/camera/libcameraservice/hidl/HidlCameraService.cpp
@@ -154,15 +154,50 @@
Return<void> HidlCameraService::addListener(const sp<HCameraServiceListener>& hCsListener,
addListener_cb _hidl_cb) {
- if (mAidlICameraService == nullptr) {
- _hidl_cb(HStatus::UNKNOWN_ERROR, {});
+ std::vector<hardware::CameraStatus> cameraStatusAndIds{};
+ HStatus status = addListenerInternal<HCameraServiceListener>(
+ hCsListener, &cameraStatusAndIds);
+ if (status != HStatus::NO_ERROR) {
+ _hidl_cb(status, {});
return Void();
}
- if (hCsListener == nullptr) {
- ALOGE("%s listener must not be NULL", __FUNCTION__);
- _hidl_cb(HStatus::ILLEGAL_ARGUMENT, {});
+
+ hidl_vec<HCameraStatusAndId> hCameraStatusAndIds;
+ //Convert cameraStatusAndIds to HIDL and call callback
+ convertToHidl(cameraStatusAndIds, &hCameraStatusAndIds);
+ _hidl_cb(status, hCameraStatusAndIds);
+
+ return Void();
+}
+
+Return<void> HidlCameraService::addListener_2_1(const sp<HCameraServiceListener2_1>& hCsListener,
+ addListener_2_1_cb _hidl_cb) {
+ std::vector<hardware::CameraStatus> cameraStatusAndIds{};
+ HStatus status = addListenerInternal<HCameraServiceListener2_1>(
+ hCsListener, &cameraStatusAndIds);
+ if (status != HStatus::NO_ERROR) {
+ _hidl_cb(status, {});
return Void();
}
+
+ hidl_vec<frameworks::cameraservice::service::V2_1::CameraStatusAndId> hCameraStatusAndIds;
+ //Convert cameraStatusAndIds to HIDL and call callback
+ convertToHidl(cameraStatusAndIds, &hCameraStatusAndIds);
+ _hidl_cb(status, hCameraStatusAndIds);
+
+ return Void();
+}
+
+template<class T>
+HStatus HidlCameraService::addListenerInternal(const sp<T>& hCsListener,
+ std::vector<hardware::CameraStatus>* cameraStatusAndIds) {
+ if (mAidlICameraService == nullptr) {
+ return HStatus::UNKNOWN_ERROR;
+ }
+ if (hCsListener == nullptr || cameraStatusAndIds == nullptr) {
+ ALOGE("%s listener and cameraStatusAndIds must not be NULL", __FUNCTION__);
+ return HStatus::ILLEGAL_ARGUMENT;
+ }
sp<hardware::ICameraServiceListener> csListener = nullptr;
// Check the cache for previously registered callbacks
{
@@ -177,33 +212,27 @@
} else {
ALOGE("%s: Trying to add a listener %p already registered",
__FUNCTION__, hCsListener.get());
- _hidl_cb(HStatus::ILLEGAL_ARGUMENT, {});
- return Void();
+ return HStatus::ILLEGAL_ARGUMENT;
}
}
- std::vector<hardware::CameraStatus> cameraStatusAndIds{};
binder::Status serviceRet =
- mAidlICameraService->addListenerHelper(csListener, &cameraStatusAndIds, true);
+ mAidlICameraService->addListenerHelper(csListener, cameraStatusAndIds, true);
HStatus status = HStatus::NO_ERROR;
if (!serviceRet.isOk()) {
- ALOGE("%s: Unable to add camera device status listener", __FUNCTION__);
- status = B2HStatus(serviceRet);
- _hidl_cb(status, {});
- return Void();
+ ALOGE("%s: Unable to add camera device status listener", __FUNCTION__);
+ status = B2HStatus(serviceRet);
+ return status;
}
- cameraStatusAndIds.erase(std::remove_if(cameraStatusAndIds.begin(), cameraStatusAndIds.end(),
+ cameraStatusAndIds->erase(std::remove_if(cameraStatusAndIds->begin(), cameraStatusAndIds->end(),
[this](const hardware::CameraStatus& s) {
- bool supportsHAL3 = false;
- binder::Status sRet =
+ bool supportsHAL3 = false;
+ binder::Status sRet =
mAidlICameraService->supportsCameraApi(String16(s.cameraId),
hardware::ICameraService::API_VERSION_2, &supportsHAL3);
- return !sRet.isOk() || !supportsHAL3;
- }), cameraStatusAndIds.end());
- hidl_vec<HCameraStatusAndId> hCameraStatusAndIds;
- //Convert cameraStatusAndIds to HIDL and call callback
- convertToHidl(cameraStatusAndIds, &hCameraStatusAndIds);
- _hidl_cb(status, hCameraStatusAndIds);
- return Void();
+ return !sRet.isOk() || !supportsHAL3;
+ }), cameraStatusAndIds->end());
+
+ return HStatus::NO_ERROR;
}
Return<HStatus> HidlCameraService::removeListener(const sp<HCameraServiceListener>& hCsListener) {
diff --git a/services/camera/libcameraservice/hidl/HidlCameraService.h b/services/camera/libcameraservice/hidl/HidlCameraService.h
index eead0bc..097f4c5 100644
--- a/services/camera/libcameraservice/hidl/HidlCameraService.h
+++ b/services/camera/libcameraservice/hidl/HidlCameraService.h
@@ -21,7 +21,7 @@
#include <thread>
#include <android/frameworks/cameraservice/common/2.0/types.h>
-#include <android/frameworks/cameraservice/service/2.0/ICameraService.h>
+#include <android/frameworks/cameraservice/service/2.1/ICameraService.h>
#include <android/frameworks/cameraservice/service/2.0/types.h>
#include <android/frameworks/cameraservice/device/2.0/types.h>
@@ -42,8 +42,9 @@
using HCameraDeviceCallback = frameworks::cameraservice::device::V2_0::ICameraDeviceCallback;
using HCameraMetadata = frameworks::cameraservice::service::V2_0::CameraMetadata;
-using HCameraService = frameworks::cameraservice::service::V2_0::ICameraService;
+using HCameraService = frameworks::cameraservice::service::V2_1::ICameraService;
using HCameraServiceListener = frameworks::cameraservice::service::V2_0::ICameraServiceListener;
+using HCameraServiceListener2_1 = frameworks::cameraservice::service::V2_1::ICameraServiceListener;
using HStatus = frameworks::cameraservice::common::V2_0::Status;
using HCameraStatusAndId = frameworks::cameraservice::service::V2_0::CameraStatusAndId;
@@ -66,6 +67,9 @@
Return<void> getCameraVendorTagSections(getCameraVendorTagSections_cb _hidl_cb) override;
+ Return<void> addListener_2_1(const sp<HCameraServiceListener2_1>& listener,
+ addListener_2_1_cb _hidl_cb) override;
+
// This method should only be called by the cameraservers main thread to
// instantiate the hidl cameraserver.
static sp<HidlCameraService> getInstance(android::CameraService *cs);
@@ -76,6 +80,11 @@
sp<hardware::ICameraServiceListener> searchListenerCacheLocked(
sp<HCameraServiceListener> listener, /*removeIfFound*/ bool shouldRemove = false);
+
+ template<class T>
+ HStatus addListenerInternal(const sp<T>& listener,
+ std::vector<hardware::CameraStatus>* cameraStatusAndIds);
+
void addToListenerCacheLocked(sp<HCameraServiceListener> hListener,
sp<hardware::ICameraServiceListener> csListener);
diff --git a/services/camera/libcameraservice/utils/CameraThreadState.cpp b/services/camera/libcameraservice/utils/CameraThreadState.cpp
index b9e344b..2352b80 100644
--- a/services/camera/libcameraservice/utils/CameraThreadState.cpp
+++ b/services/camera/libcameraservice/utils/CameraThreadState.cpp
@@ -17,33 +17,34 @@
#include "CameraThreadState.h"
#include <binder/IPCThreadState.h>
#include <hwbinder/IPCThreadState.h>
+#include <binderthreadstate/CallerUtils.h>
#include <unistd.h>
namespace android {
int CameraThreadState::getCallingUid() {
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
return hardware::IPCThreadState::self()->getCallingUid();
}
return IPCThreadState::self()->getCallingUid();
}
int CameraThreadState::getCallingPid() {
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
return hardware::IPCThreadState::self()->getCallingPid();
}
return IPCThreadState::self()->getCallingPid();
}
int64_t CameraThreadState::clearCallingIdentity() {
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
return hardware::IPCThreadState::self()->clearCallingIdentity();
}
return IPCThreadState::self()->clearCallingIdentity();
}
void CameraThreadState::restoreCallingIdentity(int64_t token) {
- if (hardware::IPCThreadState::self()->isServingCall()) {
+ if (getCurrentServingCall() == BinderCallType::HWBINDER) {
hardware::IPCThreadState::self()->restoreCallingIdentity(token);
} else {
IPCThreadState::self()->restoreCallingIdentity(token);
diff --git a/services/camera/libcameraservice/utils/ClientManager.h b/services/camera/libcameraservice/utils/ClientManager.h
index ec6f01c..35d25bf 100644
--- a/services/camera/libcameraservice/utils/ClientManager.h
+++ b/services/camera/libcameraservice/utils/ClientManager.h
@@ -35,7 +35,7 @@
public:
/**
* Choosing to set mIsVendorClient through a parameter instead of calling
- * hardware::IPCThreadState::self()->isServingCall() to protect against the
+ * getCurrentServingCall() == BinderCallType::HWBINDER to protect against the
* case where the construction is offloaded to another thread which isn't a
* hwbinder thread.
*/
@@ -237,7 +237,7 @@
// We don't use the usual copy constructor here since we want to remember
// whether a client is a vendor client or not. This could have been wiped
// off in the incoming priority argument since an AIDL thread might have
- // called hardware::IPCThreadState::self()->isServingCall() after refreshing
+ // called getCurrentServingCall() == BinderCallType::HWBINDER after refreshing
// priorities for old clients through ProcessInfoService::getProcessStatesScoresFromPids().
mPriority.setScore(priority.getScore());
mPriority.setState(priority.getState());
diff --git a/services/mediacodec/registrant/Android.bp b/services/mediacodec/registrant/Android.bp
index ad03e68..0441cfa 100644
--- a/services/mediacodec/registrant/Android.bp
+++ b/services/mediacodec/registrant/Android.bp
@@ -14,6 +14,10 @@
],
shared_libs: [
"libbase",
+ "libcodec2_hidl@1.0",
+ "libcodec2_vndk",
+ "libhidlbase",
+ "libutils",
],
// Codecs
diff --git a/services/mediacodec/registrant/CodecServiceRegistrant.cpp b/services/mediacodec/registrant/CodecServiceRegistrant.cpp
index 58db801e..83d233e 100644
--- a/services/mediacodec/registrant/CodecServiceRegistrant.cpp
+++ b/services/mediacodec/registrant/CodecServiceRegistrant.cpp
@@ -18,21 +18,410 @@
#define LOG_TAG "CodecServiceRegistrant"
#include <android-base/logging.h>
+#include <android-base/properties.h>
+#include <C2Component.h>
#include <C2PlatformSupport.h>
#include <codec2/hidl/1.1/ComponentStore.h>
+#include <codec2/hidl/1.1/Configurable.h>
+#include <codec2/hidl/1.1/types.h>
+#include <hidl/HidlSupport.h>
#include <media/CodecServiceRegistrant.h>
+namespace /* unnamed */ {
+
+using ::android::hardware::hidl_vec;
+using ::android::hardware::hidl_string;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+using namespace ::android::hardware::media::c2::V1_1;
+using namespace ::android::hardware::media::c2::V1_1::utils;
+
+constexpr c2_status_t C2_TRANSACTION_FAILED = C2_CORRUPTED;
+
+// Converter from IComponentStore to C2ComponentStore.
+class H2C2ComponentStore : public C2ComponentStore {
+protected:
+ sp<IComponentStore> mStore;
+ sp<IConfigurable> mConfigurable;
+public:
+ explicit H2C2ComponentStore(sp<IComponentStore> const& store)
+ : mStore{store},
+ mConfigurable{[store]() -> sp<IConfigurable>{
+ if (!store) {
+ return nullptr;
+ }
+ Return<sp<IConfigurable>> transResult =
+ store->getConfigurable();
+ return transResult.isOk() ?
+ static_cast<sp<IConfigurable>>(transResult) :
+ nullptr;
+ }()} {
+ if (!mConfigurable) {
+ LOG(ERROR) << "Preferred store is corrupted.";
+ }
+ }
+
+ virtual ~H2C2ComponentStore() override = default;
+
+ virtual c2_status_t config_sm(
+ std::vector<C2Param*> const ¶ms,
+ std::vector<std::unique_ptr<C2SettingResult>>* const failures
+ ) override {
+ Params hidlParams;
+ if (!createParamsBlob(&hidlParams, params)) {
+ LOG(ERROR) << "config -- bad input.";
+ return C2_TRANSACTION_FAILED;
+ }
+ c2_status_t status{};
+ Return<void> transResult = mConfigurable->config(
+ hidlParams,
+ true,
+ [&status, ¶ms, failures](
+ Status s,
+ const hidl_vec<SettingResult> f,
+ const Params& o) {
+ status = static_cast<c2_status_t>(s);
+ if (status != C2_OK && status != C2_BAD_INDEX) {
+ LOG(DEBUG) << "config -- call failed: "
+ << status << ".";
+ }
+ size_t i = failures->size();
+ failures->resize(i + f.size());
+ for (const SettingResult& sf : f) {
+ if (!objcpy(&(*failures)[i++], sf)) {
+ LOG(ERROR) << "config -- "
+ << "invalid SettingResult returned.";
+ return;
+ }
+ }
+ if (!updateParamsFromBlob(params, o)) {
+ LOG(ERROR) << "config -- "
+ << "failed to parse returned params.";
+ status = C2_CORRUPTED;
+ }
+ });
+ if (!transResult.isOk()) {
+ LOG(ERROR) << "config -- transaction failed.";
+ return C2_TRANSACTION_FAILED;
+ }
+ return status;
+ };
+
+ virtual c2_status_t copyBuffer(
+ std::shared_ptr<C2GraphicBuffer>,
+ std::shared_ptr<C2GraphicBuffer>) override {
+ LOG(ERROR) << "copyBuffer -- not supported.";
+ return C2_OMITTED;
+ }
+
+ virtual c2_status_t createComponent(
+ C2String, std::shared_ptr<C2Component> *const component) override {
+ component->reset();
+ LOG(ERROR) << "createComponent -- not supported.";
+ return C2_OMITTED;
+ }
+
+ virtual c2_status_t createInterface(
+ C2String, std::shared_ptr<C2ComponentInterface> *const interface) {
+ interface->reset();
+ LOG(ERROR) << "createInterface -- not supported.";
+ return C2_OMITTED;
+ }
+
+ virtual c2_status_t query_sm(
+ const std::vector<C2Param *> &stackParams,
+ const std::vector<C2Param::Index> &heapParamIndices,
+ std::vector<std::unique_ptr<C2Param>> *const heapParams) const
+ override {
+ hidl_vec<ParamIndex> indices(
+ stackParams.size() + heapParamIndices.size());
+ size_t numIndices = 0;
+ for (C2Param* const& stackParam : stackParams) {
+ if (!stackParam) {
+ LOG(WARNING) << "query -- null stack param encountered.";
+ continue;
+ }
+ indices[numIndices++] = static_cast<ParamIndex>(stackParam->index());
+ }
+ size_t numStackIndices = numIndices;
+ for (const C2Param::Index& index : heapParamIndices) {
+ indices[numIndices++] =
+ static_cast<ParamIndex>(static_cast<uint32_t>(index));
+ }
+ indices.resize(numIndices);
+ if (heapParams) {
+ heapParams->reserve(heapParams->size() + numIndices);
+ }
+ c2_status_t status;
+ Return<void> transResult = mConfigurable->query(
+ indices,
+ true,
+ [&status, &numStackIndices, &stackParams, heapParams](
+ Status s, const Params& p) {
+ status = static_cast<c2_status_t>(s);
+ if (status != C2_OK && status != C2_BAD_INDEX) {
+ LOG(DEBUG) << "query -- call failed: "
+ << status << ".";
+ return;
+ }
+ std::vector<C2Param*> paramPointers;
+ if (!parseParamsBlob(¶mPointers, p)) {
+ LOG(ERROR) << "query -- error while parsing params.";
+ status = C2_CORRUPTED;
+ return;
+ }
+ size_t i = 0;
+ for (auto it = paramPointers.begin();
+ it != paramPointers.end(); ) {
+ C2Param* paramPointer = *it;
+ if (numStackIndices > 0) {
+ --numStackIndices;
+ if (!paramPointer) {
+ LOG(WARNING) << "query -- null stack param.";
+ ++it;
+ continue;
+ }
+ for (; i < stackParams.size() && !stackParams[i]; ) {
+ ++i;
+ }
+ if (i >= stackParams.size()) {
+ LOG(ERROR) << "query -- unexpected error.";
+ status = C2_CORRUPTED;
+ return;
+ }
+ if (stackParams[i]->index() != paramPointer->index()) {
+ LOG(WARNING) << "query -- param skipped: "
+ "index = "
+ << stackParams[i]->index() << ".";
+ stackParams[i++]->invalidate();
+ continue;
+ }
+ if (!stackParams[i++]->updateFrom(*paramPointer)) {
+ LOG(WARNING) << "query -- param update failed: "
+ "index = "
+ << paramPointer->index() << ".";
+ }
+ } else {
+ if (!paramPointer) {
+ LOG(WARNING) << "query -- null heap param.";
+ ++it;
+ continue;
+ }
+ if (!heapParams) {
+ LOG(WARNING) << "query -- "
+ "unexpected extra stack param.";
+ } else {
+ heapParams->emplace_back(
+ C2Param::Copy(*paramPointer));
+ }
+ }
+ ++it;
+ }
+ });
+ if (!transResult.isOk()) {
+ LOG(ERROR) << "query -- transaction failed.";
+ return C2_TRANSACTION_FAILED;
+ }
+ return status;
+ }
+
+ virtual c2_status_t querySupportedParams_nb(
+ std::vector<std::shared_ptr<C2ParamDescriptor>> *const params) const {
+ c2_status_t status;
+ Return<void> transResult = mConfigurable->querySupportedParams(
+ std::numeric_limits<uint32_t>::min(),
+ std::numeric_limits<uint32_t>::max(),
+ [&status, params](
+ Status s,
+ const hidl_vec<ParamDescriptor>& p) {
+ status = static_cast<c2_status_t>(s);
+ if (status != C2_OK) {
+ LOG(DEBUG) << "querySupportedParams -- call failed: "
+ << status << ".";
+ return;
+ }
+ size_t i = params->size();
+ params->resize(i + p.size());
+ for (const ParamDescriptor& sp : p) {
+ if (!objcpy(&(*params)[i++], sp)) {
+ LOG(ERROR) << "querySupportedParams -- "
+ << "invalid returned ParamDescriptor.";
+ return;
+ }
+ }
+ });
+ if (!transResult.isOk()) {
+ LOG(ERROR) << "querySupportedParams -- transaction failed.";
+ return C2_TRANSACTION_FAILED;
+ }
+ return status;
+ }
+
+ virtual c2_status_t querySupportedValues_sm(
+ std::vector<C2FieldSupportedValuesQuery> &fields) const {
+ hidl_vec<FieldSupportedValuesQuery> inFields(fields.size());
+ for (size_t i = 0; i < fields.size(); ++i) {
+ if (!objcpy(&inFields[i], fields[i])) {
+ LOG(ERROR) << "querySupportedValues -- bad input";
+ return C2_TRANSACTION_FAILED;
+ }
+ }
+
+ c2_status_t status;
+ Return<void> transResult = mConfigurable->querySupportedValues(
+ inFields,
+ true,
+ [&status, &inFields, &fields](
+ Status s,
+ const hidl_vec<FieldSupportedValuesQueryResult>& r) {
+ status = static_cast<c2_status_t>(s);
+ if (status != C2_OK) {
+ LOG(DEBUG) << "querySupportedValues -- call failed: "
+ << status << ".";
+ return;
+ }
+ if (r.size() != fields.size()) {
+ LOG(ERROR) << "querySupportedValues -- "
+ "input and output lists "
+ "have different sizes.";
+ status = C2_CORRUPTED;
+ return;
+ }
+ for (size_t i = 0; i < fields.size(); ++i) {
+ if (!objcpy(&fields[i], inFields[i], r[i])) {
+ LOG(ERROR) << "querySupportedValues -- "
+ "invalid returned value.";
+ status = C2_CORRUPTED;
+ return;
+ }
+ }
+ });
+ if (!transResult.isOk()) {
+ LOG(ERROR) << "querySupportedValues -- transaction failed.";
+ return C2_TRANSACTION_FAILED;
+ }
+ return status;
+ }
+
+ virtual C2String getName() const {
+ C2String outName;
+ Return<void> transResult = mConfigurable->getName(
+ [&outName](const hidl_string& name) {
+ outName = name.c_str();
+ });
+ if (!transResult.isOk()) {
+ LOG(ERROR) << "getName -- transaction failed.";
+ }
+ return outName;
+ }
+
+ virtual std::shared_ptr<C2ParamReflector> getParamReflector() const
+ override {
+ struct SimpleParamReflector : public C2ParamReflector {
+ virtual std::unique_ptr<C2StructDescriptor> describe(
+ C2Param::CoreIndex coreIndex) const {
+ hidl_vec<ParamIndex> indices(1);
+ indices[0] = static_cast<ParamIndex>(coreIndex.coreIndex());
+ std::unique_ptr<C2StructDescriptor> descriptor;
+ Return<void> transResult = mBase->getStructDescriptors(
+ indices,
+ [&descriptor](
+ Status s,
+ const hidl_vec<StructDescriptor>& sd) {
+ c2_status_t status = static_cast<c2_status_t>(s);
+ if (status != C2_OK) {
+ LOG(DEBUG) << "SimpleParamReflector -- "
+ "getStructDescriptors() failed: "
+ << status << ".";
+ descriptor.reset();
+ return;
+ }
+ if (sd.size() != 1) {
+ LOG(DEBUG) << "SimpleParamReflector -- "
+ "getStructDescriptors() "
+ "returned vector of size "
+ << sd.size() << ". "
+ "It should be 1.";
+ descriptor.reset();
+ return;
+ }
+ if (!objcpy(&descriptor, sd[0])) {
+ LOG(DEBUG) << "SimpleParamReflector -- "
+ "getStructDescriptors() returned "
+ "corrupted data.";
+ descriptor.reset();
+ return;
+ }
+ });
+ return descriptor;
+ }
+
+ explicit SimpleParamReflector(sp<IComponentStore> base)
+ : mBase(base) { }
+
+ sp<IComponentStore> mBase;
+ };
+
+ return std::make_shared<SimpleParamReflector>(mStore);
+ }
+
+ virtual std::vector<std::shared_ptr<const C2Component::Traits>>
+ listComponents() override {
+ LOG(ERROR) << "listComponents -- not supported.";
+ return {};
+ }
+};
+
+bool ionPropertiesDefined() {
+ using namespace ::android::base;
+ std::string heapMask =
+ GetProperty("ro.com.android.media.swcodec.ion.heapmask", "undefined");
+ std::string flags =
+ GetProperty("ro.com.android.media.swcodec.ion.flags", "undefined");
+ std::string align =
+ GetProperty("ro.com.android.media.swcodec.ion.align", "undefined");
+ if (heapMask != "undefined" ||
+ flags != "undefined" ||
+ align != "undefined") {
+ LOG(INFO)
+ << "Some system properties for mediaswcodec ION usage are set: "
+ << "heapmask = " << heapMask << ", "
+ << "flags = " << flags << ", "
+ << "align = " << align << ". "
+ << "Preferred Codec2 store is defaulted to \"software\".";
+ return true;
+ }
+ return false;
+}
+
+} // unnamed namespace
+
extern "C" void RegisterCodecServices() {
using namespace ::android::hardware::media::c2::V1_1;
LOG(INFO) << "Creating software Codec2 service...";
- android::sp<IComponentStore> store =
- new utils::ComponentStore(
- android::GetCodec2PlatformComponentStore());
+ sp<ComponentStore> store =
+ new ComponentStore(::android::GetCodec2PlatformComponentStore());
if (store == nullptr) {
LOG(ERROR) <<
"Cannot create software Codec2 service.";
} else {
+ if (!ionPropertiesDefined()) {
+ std::string preferredStoreName = "default";
+ sp<IComponentStore> preferredStore =
+ IComponentStore::getService(preferredStoreName.c_str());
+ if (preferredStore) {
+ ::android::SetPreferredCodec2ComponentStore(
+ std::make_shared<H2C2ComponentStore>(preferredStore));
+ LOG(INFO) <<
+ "Preferred Codec2 store is set to \"" <<
+ preferredStoreName << "\".";
+ } else {
+ LOG(INFO) <<
+ "Preferred Codec2 store is defaulted to \"software\".";
+ }
+ }
if (store->registerAsService("software") != android::OK) {
LOG(ERROR) <<
"Cannot register software Codec2 service.";
diff --git a/services/mediaextractor/Android.bp b/services/mediaextractor/Android.bp
index 9d6d169..3f4bab0 100644
--- a/services/mediaextractor/Android.bp
+++ b/services/mediaextractor/Android.bp
@@ -33,6 +33,9 @@
"liblog",
"libavservices_minijail",
],
+ header_libs: [
+ "bionic_libc_platform_headers",
+ ],
target: {
android: {
product_variables: {
diff --git a/services/mediaextractor/main_extractorservice.cpp b/services/mediaextractor/main_extractorservice.cpp
index 3c4125b..afb7692 100644
--- a/services/mediaextractor/main_extractorservice.cpp
+++ b/services/mediaextractor/main_extractorservice.cpp
@@ -28,6 +28,8 @@
#include <android-base/properties.h>
#include <utils/misc.h>
+#include <bionic/reserved_signals.h>
+
// from LOCAL_C_INCLUDES
#include "MediaExtractorService.h"
#include "MediaUtils.h"
@@ -49,6 +51,10 @@
signal(SIGPIPE, SIG_IGN);
+ // Do not assist platform profilers (relevant only on debug builds).
+ // Otherwise, the signal handler can violate the seccomp policy.
+ signal(BIONIC_SIGNAL_PROFILER, SIG_IGN);
+
//b/62255959: this forces libutis.so to dlopen vendor version of libutils.so
//before minijail is on. This is dirty but required since some syscalls such
//as pread64 are used by linker but aren't allowed in the minijail. By
diff --git a/services/mediaextractor/seccomp_policy/mediaextractor-arm.policy b/services/mediaextractor/seccomp_policy/mediaextractor-arm.policy
index 38f9be6..118072e 100644
--- a/services/mediaextractor/seccomp_policy/mediaextractor-arm.policy
+++ b/services/mediaextractor/seccomp_policy/mediaextractor-arm.policy
@@ -41,6 +41,9 @@
getgroups32: 1
nanosleep: 1
getrandom: 1
+timer_create: 1
+timer_settime: 1
+timer_delete: 1
# for dynamically loading extractors
pread64: 1
diff --git a/services/mediaextractor/seccomp_policy/mediaextractor-arm64.policy b/services/mediaextractor/seccomp_policy/mediaextractor-arm64.policy
index 8fd8787..481e29e 100644
--- a/services/mediaextractor/seccomp_policy/mediaextractor-arm64.policy
+++ b/services/mediaextractor/seccomp_policy/mediaextractor-arm64.policy
@@ -30,6 +30,9 @@
getrlimit: 1
nanosleep: 1
getrandom: 1
+timer_create: 1
+timer_settime: 1
+timer_delete: 1
# for FileSource
readlinkat: 1
diff --git a/services/mediaextractor/seccomp_policy/mediaextractor-x86.policy b/services/mediaextractor/seccomp_policy/mediaextractor-x86.policy
index 05915d1..15fb24e 100644
--- a/services/mediaextractor/seccomp_policy/mediaextractor-x86.policy
+++ b/services/mediaextractor/seccomp_policy/mediaextractor-x86.policy
@@ -39,6 +39,9 @@
getgroups32: 1
nanosleep: 1
getrandom: 1
+timer_create: 1
+timer_settime: 1
+timer_delete: 1
# for dynamically loading extractors
getdents64: 1
diff --git a/services/mediaextractor/seccomp_policy/mediaextractor-x86_64.policy b/services/mediaextractor/seccomp_policy/mediaextractor-x86_64.policy
index e6a55d0..4f2646c 100644
--- a/services/mediaextractor/seccomp_policy/mediaextractor-x86_64.policy
+++ b/services/mediaextractor/seccomp_policy/mediaextractor-x86_64.policy
@@ -34,6 +34,9 @@
getrlimit: 1
nanosleep: 1
getrandom: 1
+timer_create: 1
+timer_settime: 1
+timer_delete: 1
# for dynamically loading extractors
getdents64: 1
diff --git a/services/mediametrics/MediaMetricsService.cpp b/services/mediametrics/MediaMetricsService.cpp
index 4f8589c..811e135 100644
--- a/services/mediametrics/MediaMetricsService.cpp
+++ b/services/mediametrics/MediaMetricsService.cpp
@@ -204,13 +204,13 @@
}
// crack any parameters
- const String16 protoOption("-proto");
- const String16 clearOption("-clear");
+ const String16 protoOption("--proto");
+ const String16 clearOption("--clear");
bool clear = false;
- const String16 sinceOption("-since");
+ const String16 sinceOption("--since");
nsecs_t ts_since = 0;
- const String16 helpOption("-help");
- const String16 onlyOption("-only");
+ const String16 helpOption("--help");
+ const String16 onlyOption("--only");
std::string only;
const int n = args.size();
for (int i = 0; i < n; i++) {
@@ -250,11 +250,11 @@
// or dumpsys media.metrics audiotrack codec
result.append("Recognized parameters:\n");
- result.append("-help this help message\n");
- result.append("-proto # dump using protocol #");
- result.append("-clear clears out saved records\n");
- result.append("-only X process records for component X\n");
- result.append("-since X include records since X\n");
+ result.append("--help this help message\n");
+ result.append("--proto # dump using protocol #");
+ result.append("--clear clears out saved records\n");
+ result.append("--only X process records for component X\n");
+ result.append("--since X include records since X\n");
result.append(" (X is milliseconds since the UNIX epoch)\n");
write(fd, result.string(), result.size());
return NO_ERROR;
@@ -436,6 +436,10 @@
// untrusted uids can only send us a limited set of keys
const std::string &key = item->getKey();
if (startsWith(key, "audio.")) return true;
+ if (startsWith(key, "drm.vendor.")) return true;
+ // the list of allowedKey uses statsd_handlers
+ // in iface_statsd.cpp as reference
+ // drmmanager is from a trusted uid, therefore not needed here
for (const char *allowedKey : {
// legacy audio
"audiopolicy",
@@ -445,6 +449,7 @@
// other media
"codec",
"extractor",
+ "mediadrm",
"nuplayer",
}) {
if (key == allowedKey) {
diff --git a/services/mediametrics/TimeMachine.h b/services/mediametrics/TimeMachine.h
index 87de1c4..e048d0e 100644
--- a/services/mediametrics/TimeMachine.h
+++ b/services/mediametrics/TimeMachine.h
@@ -56,7 +56,8 @@
* The TimeMachine is used to record timing changes of MediaAnalyticItem
* properties.
*
- * Any URL that ends with '!' will have a time sequence that keeps duplicates.
+ * Any URL that ends with '#' (AMEDIAMETRICS_PROP_SUFFIX_CHAR_DUPLICATES_ALLOWED)
+ * will have a time sequence that keeps duplicates.
*
* The TimeMachine is NOT thread safe.
*/
@@ -126,7 +127,7 @@
auto& timeSequence = mPropertyMap[property];
Elem el{std::forward<T>(e)};
if (timeSequence.empty() // no elements
- || property.back() == '!' // keep duplicates TODO: remove?
+ || property.back() == AMEDIAMETRICS_PROP_SUFFIX_CHAR_DUPLICATES_ALLOWED
|| timeSequence.rbegin()->second != el) { // value changed
timeSequence.emplace(time, std::move(el));
}
@@ -168,7 +169,6 @@
ss << "(" << (offset == 0 ? "" : "~") << ×tring.time[offset]
<< ") " << eptr->second;
if (++eptr == timeSequence.end()) {
- ss << "}";
break;
}
ss << ", ";
diff --git a/services/mediametrics/statsd_codec.cpp b/services/mediametrics/statsd_codec.cpp
index 214c51a..f5fa57e 100644
--- a/services/mediametrics/statsd_codec.cpp
+++ b/services/mediametrics/statsd_codec.cpp
@@ -154,6 +154,18 @@
if ( item->getInt64("android.media.mediacodec.latency.unknown", &latency_unknown)) {
metrics_proto.set_latency_unknown(latency_unknown);
}
+ // android.media.mediacodec.queueSecureInputBufferError int32
+ if (int32_t queueSecureInputBufferError = -1;
+ item->getInt32("android.media.mediacodec.queueSecureInputBufferError",
+ &queueSecureInputBufferError)) {
+ metrics_proto.set_queue_secure_input_buffer_error(queueSecureInputBufferError);
+ }
+ // android.media.mediacodec.queueInputBufferError int32
+ if (int32_t queueInputBufferError = -1;
+ item->getInt32("android.media.mediacodec.queueInputBufferError",
+ &queueInputBufferError)) {
+ metrics_proto.set_queue_input_buffer_error(queueInputBufferError);
+ }
// android.media.mediacodec.latency.hist NOT EMITTED
std::string serialized;
diff --git a/services/mediametrics/statsd_drm.cpp b/services/mediametrics/statsd_drm.cpp
index b12f4f3..4f2e861 100644
--- a/services/mediametrics/statsd_drm.cpp
+++ b/services/mediametrics/statsd_drm.cpp
@@ -35,6 +35,9 @@
#include <statslog.h>
+#include <array>
+#include <string>
+
namespace android {
// mediadrm
@@ -107,8 +110,14 @@
// drmmanager
bool statsd_drmmanager(const mediametrics::Item *item)
{
+ using namespace std::string_literals;
if (item == NULL) return false;
+ if (!enabled_statsd) {
+ ALOGV("NOT sending: drmmanager data");
+ return true;
+ }
+
const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
@@ -123,16 +132,22 @@
char *mime_types = NULL;
(void) item->getCString("mime_types", &mime_types);
- if (enabled_statsd) {
- android::util::stats_write(android::util::MEDIAMETRICS_DRMMANAGER_REPORTED,
- timestamp, pkgName.c_str(), pkgVersionCode,
- mediaApexVersion,
- plugin_id, description,
- method_id, mime_types);
- } else {
- ALOGV("NOT sending: drmmanager data");
+ // Corresponds to the 13 APIs tracked in the MediametricsDrmManagerReported statsd proto
+ // Please see also DrmManager::kMethodIdMap
+ std::array<int64_t, 13> methodCounts{};
+ for (size_t i = 0; i < methodCounts.size() ; i++) {
+ item->getInt64(("method"s + std::to_string(i)).c_str(), &methodCounts[i]);
}
+ android::util::stats_write(android::util::MEDIAMETRICS_DRMMANAGER_REPORTED,
+ timestamp, pkgName.c_str(), pkgVersionCode, mediaApexVersion,
+ plugin_id, description, method_id, mime_types,
+ methodCounts[0], methodCounts[1], methodCounts[2],
+ methodCounts[3], methodCounts[4], methodCounts[5],
+ methodCounts[6], methodCounts[7], methodCounts[8],
+ methodCounts[9], methodCounts[10], methodCounts[11],
+ methodCounts[12]);
+
free(plugin_id);
free(description);
free(mime_types);
diff --git a/services/mediaresourcemanager/ResourceManagerService.cpp b/services/mediaresourcemanager/ResourceManagerService.cpp
index 877c44d..be5af00 100644
--- a/services/mediaresourcemanager/ResourceManagerService.cpp
+++ b/services/mediaresourcemanager/ResourceManagerService.cpp
@@ -58,6 +58,8 @@
return;
}
service->removeResource(mPid, mClientId, false);
+
+ service->overridePid(mPid, -1);
}
template <typename T>
@@ -150,6 +152,7 @@
PidResourceInfosMap mapCopy;
bool supportsMultipleSecureCodecs;
bool supportsSecureWithNonSecureCodec;
+ std::map<int, int> overridePidMapCopy;
String8 serviceLog;
{
Mutex::Autolock lock(mLock);
@@ -157,6 +160,7 @@
supportsMultipleSecureCodecs = mSupportsMultipleSecureCodecs;
supportsSecureWithNonSecureCodec = mSupportsSecureWithNonSecureCodec;
serviceLog = mServiceLog->toString(" " /* linePrefix */);
+ overridePidMapCopy = mOverridePidMap;
}
const size_t SIZE = 256;
@@ -197,6 +201,12 @@
}
}
}
+ result.append(" Process Pid override:\n");
+ for (auto it = overridePidMapCopy.begin(); it != overridePidMapCopy.end(); ++it) {
+ snprintf(buffer, SIZE, " Original Pid: %d, Override Pid: %d\n",
+ it->first, it->second);
+ result.append(buffer);
+ }
result.append(" Events logs (most recent at top):\n");
result.append(serviceLog);
@@ -608,6 +618,48 @@
return Status::ok();
}
+Status ResourceManagerService::overridePid(
+ int originalPid,
+ int newPid) {
+ String8 log = String8::format("overridePid(originalPid %d, newPid %d)",
+ originalPid, newPid);
+ mServiceLog->add(log);
+
+ // allow if this is called from the same process or the process has
+ // permission.
+ if ((AIBinder_getCallingPid() != getpid()) &&
+ (checkCallingPermission(String16(
+ "android.permission.MEDIA_RESOURCE_OVERRIDE_PID")) == false)) {
+ ALOGE(
+ "Permission Denial: can't access overridePid method from pid=%d, "
+ "self pid=%d\n",
+ AIBinder_getCallingPid(), getpid());
+ return Status::fromServiceSpecificError(PERMISSION_DENIED);
+ }
+
+ {
+ Mutex::Autolock lock(mLock);
+ mOverridePidMap.erase(originalPid);
+ if (newPid != -1) {
+ mOverridePidMap.emplace(originalPid, newPid);
+ }
+ }
+
+ return Status::ok();
+}
+
+bool ResourceManagerService::getPriority_l(int pid, int* priority) {
+ int newPid = pid;
+
+ if (mOverridePidMap.find(pid) != mOverridePidMap.end()) {
+ newPid = mOverridePidMap[pid];
+ ALOGD("getPriority_l: use override pid %d instead original pid %d",
+ newPid, pid);
+ }
+
+ return mProcessInfo->getPriority(newPid, priority);
+}
+
bool ResourceManagerService::getAllClients_l(
int callingPid, MediaResource::Type type,
Vector<std::shared_ptr<IResourceManagerClient>> *clients) {
@@ -641,7 +693,7 @@
int lowestPriorityPid;
int lowestPriority;
int callingPriority;
- if (!mProcessInfo->getPriority(callingPid, &callingPriority)) {
+ if (!getPriority_l(callingPid, &callingPriority)) {
ALOGE("getLowestPriorityBiggestClient_l: can't get process priority for pid %d",
callingPid);
return false;
@@ -676,7 +728,7 @@
}
int tempPid = mMap.keyAt(i);
int tempPriority;
- if (!mProcessInfo->getPriority(tempPid, &tempPriority)) {
+ if (!getPriority_l(tempPid, &tempPriority)) {
ALOGV("getLowestPriorityPid_l: can't get priority of pid %d, skipped", tempPid);
// TODO: remove this pid from mMap?
continue;
@@ -696,12 +748,12 @@
bool ResourceManagerService::isCallingPriorityHigher_l(int callingPid, int pid) {
int callingPidPriority;
- if (!mProcessInfo->getPriority(callingPid, &callingPidPriority)) {
+ if (!getPriority_l(callingPid, &callingPidPriority)) {
return false;
}
int priority;
- if (!mProcessInfo->getPriority(pid, &priority)) {
+ if (!getPriority_l(pid, &priority)) {
return false;
}
diff --git a/services/mediaresourcemanager/ResourceManagerService.h b/services/mediaresourcemanager/ResourceManagerService.h
index ae12d7b..f500c62 100644
--- a/services/mediaresourcemanager/ResourceManagerService.h
+++ b/services/mediaresourcemanager/ResourceManagerService.h
@@ -118,6 +118,10 @@
const std::vector<MediaResourceParcel>& resources,
bool* _aidl_return) override;
+ Status overridePid(
+ int originalPid,
+ int newPid) override;
+
Status removeResource(int pid, int64_t clientId, bool checkValid);
private:
@@ -157,6 +161,9 @@
// Merge r2 into r1
void mergeResources(MediaResourceParcel& r1, const MediaResourceParcel& r2);
+ // Get priority from process's pid
+ bool getPriority_l(int pid, int* priority);
+
mutable Mutex mLock;
sp<ProcessInfoInterface> mProcessInfo;
sp<SystemCallbackInterface> mSystemCB;
@@ -166,6 +173,7 @@
bool mSupportsSecureWithNonSecureCodec;
int32_t mCpuBoostCount;
::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
+ std::map<int, int> mOverridePidMap;
};
// ----------------------------------------------------------------------------
diff --git a/services/mediaresourcemanager/test/ResourceManagerService_test.cpp b/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
index 168fde9..5d839fa 100644
--- a/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
+++ b/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
@@ -446,6 +446,32 @@
expectEqResourceInfo(infos1.valueFor(getId(mTestClient1)), kTestUid1, mTestClient1, expected);
}
+ void testOverridePid() {
+
+ bool result;
+ std::vector<MediaResourceParcel> resources;
+ resources.push_back(MediaResource(MediaResource::Type::kSecureCodec, 1));
+ resources.push_back(MediaResource(MediaResource::Type::kGraphicMemory, 150));
+
+ // ### secure codec can't coexist and secure codec can coexist with non-secure codec ###
+ {
+ addResource();
+ mService->mSupportsMultipleSecureCodecs = false;
+ mService->mSupportsSecureWithNonSecureCodec = true;
+
+ // priority too low to reclaim resource
+ CHECK_STATUS_FALSE(mService->reclaimResource(kLowPriorityPid, resources, &result));
+
+ // override Low Priority Pid with High Priority Pid
+ mService->overridePid(kLowPriorityPid, kHighPriorityPid);
+ CHECK_STATUS_TRUE(mService->reclaimResource(kLowPriorityPid, resources, &result));
+
+ // restore Low Priority Pid
+ mService->overridePid(kLowPriorityPid, -1);
+ CHECK_STATUS_FALSE(mService->reclaimResource(kLowPriorityPid, resources, &result));
+ }
+ }
+
void testRemoveClient() {
addResource();
@@ -870,4 +896,8 @@
testCpusetBoost();
}
+TEST_F(ResourceManagerServiceTest, overridePid) {
+ testOverridePid();
+}
+
} // namespace android