Merge "CCodec: reorganize max dequeue count update"
diff --git a/apex/Android.bp b/apex/Android.bp
index ef296d6..80e751c 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -64,10 +64,9 @@
],
}
-prebuilt_etc {
+linker_config {
name: "media-linker-config",
- src: "linker.config.txt",
- filename: "linker.config.txt",
+ src: "linker.config.json",
installable: false,
}
diff --git a/apex/linker.config.json b/apex/linker.config.json
new file mode 100644
index 0000000..67c076e
--- /dev/null
+++ b/apex/linker.config.json
@@ -0,0 +1,3 @@
+{
+ "visible": true
+}
diff --git a/apex/linker.config.txt b/apex/linker.config.txt
deleted file mode 100644
index d1c815b..0000000
--- a/apex/linker.config.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Extra linker configurations for media APEX
-# See https://android.googlesource.com/platform/system/linkerconfig/+/master/README.md#apex_etc_linker_config_txt
-
-[properties]
-
-# Set media APEX as force visible so media APEX namespace is accessible via android_get_exported_namespace
-visible = true
diff --git a/apex/testing/Android.bp b/apex/testing/Android.bp
index a04ab3f..d86094e 100644
--- a/apex/testing/Android.bp
+++ b/apex/testing/Android.bp
@@ -17,7 +17,10 @@
manifest: "test_manifest.json",
file_contexts: ":com.android.media-file_contexts",
defaults: ["com.android.media-defaults"],
- prebuilts: ["sdkinfo_45"],
+ prebuilts: [
+ "sdkinfo_45",
+ "media-linker-config",
+ ],
installable: false,
}
diff --git a/camera/camera2/CaptureRequest.cpp b/camera/camera2/CaptureRequest.cpp
index 1843ec4..ebc09d7 100644
--- a/camera/camera2/CaptureRequest.cpp
+++ b/camera/camera2/CaptureRequest.cpp
@@ -94,12 +94,12 @@
// Do not distinguish null arrays from 0-sized arrays.
for (int32_t i = 0; i < size; ++i) {
// Parcel.writeParcelableArray
- size_t len;
- const char16_t* className = parcel->readString16Inplace(&len);
+ std::optional<std::string> className;
+ parcel->readUtf8FromUtf16(&className);
ALOGV("%s: Read surface class = %s", __FUNCTION__,
- className != NULL ? String8(className).string() : "<null>");
+ className.value_or("<null>").c_str());
- if (className == NULL) {
+ if (className == std::nullopt) {
continue;
}
diff --git a/drm/libmediadrm/protos/Android.bp b/drm/libmediadrm/protos/Android.bp
new file mode 100644
index 0000000..b26cda4
--- /dev/null
+++ b/drm/libmediadrm/protos/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+// This is the version of the drm metrics configured for protobuf full on host.
+// It is used by the metrics_dump tool.
+
+cc_library_host_shared {
+ name: "libdrm_metrics_protos_full_host",
+ vendor_available: true,
+
+ include_dirs: ["external/protobuf/src"],
+
+ srcs: [
+ "metrics.proto",
+ ],
+
+ proto: {
+ export_proto_headers: true,
+ type: "full",
+ },
+
+ cflags: [
+ // Suppress unused parameter error. This error occurs
+ // when using the map type in a proto definition.
+ "-Wno-unused-parameter",
+ ],
+}
diff --git a/drm/mediadrm/plugins/clearkey/hidl/MemoryFileSystem.cpp b/drm/mediadrm/plugins/clearkey/hidl/MemoryFileSystem.cpp
index 2dcd00f..051a968 100644
--- a/drm/mediadrm/plugins/clearkey/hidl/MemoryFileSystem.cpp
+++ b/drm/mediadrm/plugins/clearkey/hidl/MemoryFileSystem.cpp
@@ -15,7 +15,7 @@
namespace clearkey {
std::string MemoryFileSystem::GetFileName(const std::string& path) {
- size_t index = path.find_last_of("/");
+ size_t index = path.find_last_of('/');
if (index != std::string::npos) {
return path.substr(index+1);
} else {
diff --git a/include/media/MicrophoneInfo.h b/include/media/MicrophoneInfo.h
index 2287aca..0a24b02 100644
--- a/include/media/MicrophoneInfo.h
+++ b/include/media/MicrophoneInfo.h
@@ -205,11 +205,11 @@
private:
status_t readFloatVector(
const Parcel* parcel, Vector<float> *vectorPtr, size_t defaultLength) {
- std::unique_ptr<std::vector<float>> v;
+ std::optional<std::vector<float>> v;
status_t result = parcel->readFloatVector(&v);
if (result != OK) return result;
vectorPtr->clear();
- if (v.get() != nullptr) {
+ if (v) {
for (const auto& iter : *v) {
vectorPtr->push_back(iter);
}
diff --git a/media/OWNERS b/media/OWNERS
index bd83ad9..3e194f0 100644
--- a/media/OWNERS
+++ b/media/OWNERS
@@ -11,9 +11,11 @@
lajos@google.com
marcone@google.com
mnaganov@google.com
+nchalko@google.com
pawin@google.com
philburk@google.com
pmclean@google.com
+quxiangfang@google.com
rachad@google.com
rago@google.com
robertshih@google.com
diff --git a/media/codec2/core/include/C2Buffer.h b/media/codec2/core/include/C2Buffer.h
index 3d3587c..fe37b05 100644
--- a/media/codec2/core/include/C2Buffer.h
+++ b/media/codec2/core/include/C2Buffer.h
@@ -734,6 +734,22 @@
}
virtual ~C2Allocator() = default;
+
+ /**
+ * Returns a true if the handle looks valid for this allocator.
+ *
+ * It does not actually validate that the handle represents a valid allocation (by this
+ * allocator), only that the handle could have been returned by this allocator. As such,
+ * multiple allocators may return true for looksValid for the same handle.
+ *
+ * This method MUST be "non-blocking", MUST not access kernel and/or device drivers, and
+ * return within 1us.
+ *
+ * \param handle the handle for an existing allocation (possibly from another
+ * allocator)
+ */
+ virtual bool checkHandle(const C2Handle *const handle) const = 0;
+
protected:
C2Allocator() = default;
};
@@ -2156,9 +2172,12 @@
};
/**
- * An extension of C2Info objects that can contain arbitrary buffer data.
+ * A const metadata object that can contain arbitrary buffer data.
*
- * \note This object is not describable and contains opaque data.
+ * This object is not an actual C2Info and is not attached to buffers (C2Buffer), but rather to
+ * frames (C2FrameData). It is not describable via C2ParamDescriptor.
+ *
+ * C2InfoBuffer is a const object that can be allocated on stack and is copiable.
*/
class C2InfoBuffer {
public:
@@ -2167,14 +2186,65 @@
*
* \return the parameter index.
*/
- const C2Param::Index index() const;
+ const C2Param::Index index() const { return mIndex; }
/**
* Gets the buffer's data.
*
* \return the buffer's data.
*/
- const C2BufferData data() const;
+ const C2BufferData data() const { return mData; }
+
+ /// Returns a clone of this as a global info buffer.
+ C2InfoBuffer asGlobal() const {
+ C2Param::Index index = mIndex;
+ index.convertToGlobal();
+ return C2InfoBuffer(index, mData);
+ }
+
+ /// Returns a clone of this as a port info buffer.
+ C2InfoBuffer asPort(bool output) const {
+ C2Param::Index index = mIndex;
+ index.convertToPort(output);
+ return C2InfoBuffer(index, mData);
+ }
+
+ /// Returns a clone of this as a stream info buffer.
+ C2InfoBuffer asStream(bool output, unsigned stream) const {
+ C2Param::Index index = mIndex;
+ index.convertToStream(output, stream);
+ return C2InfoBuffer(index, mData);
+ }
+
+ /**
+ * Creates a global info buffer containing a single linear block.
+ *
+ * \param index the core parameter index of this info buffer.
+ * \param block the content of the info buffer.
+ *
+ * \return shared pointer to the created info buffer.
+ */
+ static C2InfoBuffer CreateLinearBuffer(C2Param::CoreIndex index, const C2ConstLinearBlock &block);
+
+ /**
+ * Creates a global info buffer containing a single graphic block.
+ *
+ * \param index the core parameter index of this info buffer.
+ * \param block the content of the info buffer.
+ *
+ * \return shared pointer to the created info buffer.
+ */
+ static C2InfoBuffer CreateGraphicBuffer(C2Param::CoreIndex index, const C2ConstGraphicBlock &block);
+
+protected:
+ // no public constructor
+ explicit C2InfoBuffer(C2Param::Index index, const std::vector<C2ConstLinearBlock> &blocks);
+ explicit C2InfoBuffer(C2Param::Index index, const std::vector<C2ConstGraphicBlock> &blocks);
+
+private:
+ C2Param::Index mIndex;
+ C2BufferData mData;
+ explicit C2InfoBuffer(C2Param::Index index, const C2BufferData &data);
};
/// @}
diff --git a/media/codec2/core/include/C2Config.h b/media/codec2/core/include/C2Config.h
index 29bccd5..38f7389 100644
--- a/media/codec2/core/include/C2Config.h
+++ b/media/codec2/core/include/C2Config.h
@@ -249,6 +249,13 @@
// low latency mode
kParamIndexLowLatencyMode, // bool
+
+ // tunneled codec
+ kParamIndexTunneledMode, // struct
+ kParamIndexTunnelHandle, // int32[]
+ kParamIndexTunnelSystemTime, // int64
+
+ kParamIndexStoreDmaBufUsage, // store, struct
};
}
@@ -2036,6 +2043,33 @@
C2StoreIonUsageInfo;
/**
+ * This structure describes the preferred DMA-Buf allocation parameters for a given memory usage.
+ */
+struct C2StoreDmaBufUsageStruct {
+ inline C2StoreDmaBufUsageStruct() { memset(this, 0, sizeof(*this)); }
+
+ inline C2StoreDmaBufUsageStruct(size_t flexCount, uint64_t usage_, uint32_t capacity_)
+ : usage(usage_), capacity(capacity_), allocFlags(0) {
+ memset(heapName, 0, flexCount);
+ }
+
+ uint64_t usage; ///< C2MemoryUsage
+ uint32_t capacity; ///< capacity
+ int32_t allocFlags; ///< ion allocation flags
+ char heapName[]; ///< dmabuf heap name
+
+ DEFINE_AND_DESCRIBE_FLEX_C2STRUCT(StoreDmaBufUsage, heapName)
+ C2FIELD(usage, "usage")
+ C2FIELD(capacity, "capacity")
+ C2FIELD(allocFlags, "alloc-flags")
+ C2FIELD(heapName, "heap-name")
+};
+
+// store, private
+typedef C2GlobalParam<C2Info, C2StoreDmaBufUsageStruct, kParamIndexStoreDmaBufUsage>
+ C2StoreDmaBufUsageInfo;
+
+/**
* Flexible pixel format descriptors
*/
struct C2FlexiblePixelFormatDescriptorStruct {
@@ -2182,6 +2216,79 @@
typedef C2PortParam<C2Tuning, C2TimestampGapAdjustmentStruct> C2PortTimestampGapTuning;
constexpr char C2_PARAMKEY_INPUT_SURFACE_TIMESTAMP_ADJUSTMENT[] = "input-surface.timestamp-adjustment";
+/* ===================================== TUNNELED CODEC ==================================== */
+
+/**
+ * Tunneled codec control.
+ */
+struct C2TunneledModeStruct {
+ /// mode
+ enum mode_t : uint32_t;
+ /// sync type
+ enum sync_type_t : uint32_t;
+
+ inline C2TunneledModeStruct() = default;
+
+ inline C2TunneledModeStruct(
+ size_t flexCount, mode_t mode_, sync_type_t type, std::vector<int32_t> id)
+ : mode(mode_), syncType(type) {
+ memcpy(&syncId, &id[0], c2_min(id.size(), flexCount) * FLEX_SIZE);
+ }
+
+ inline C2TunneledModeStruct(size_t flexCount, mode_t mode_, sync_type_t type, int32_t id)
+ : mode(mode_), syncType(type) {
+ if (flexCount >= 1) {
+ syncId[0] = id;
+ }
+ }
+
+ mode_t mode; ///< tunneled mode
+ sync_type_t syncType; ///< type of sync used for tunneled mode
+ int32_t syncId[]; ///< sync id
+
+ DEFINE_AND_DESCRIBE_FLEX_C2STRUCT(TunneledMode, syncId)
+ C2FIELD(mode, "mode")
+ C2FIELD(syncType, "sync-type")
+ C2FIELD(syncId, "sync-id")
+
+};
+
+C2ENUM(C2TunneledModeStruct::mode_t, uint32_t,
+ NONE,
+ SIDEBAND,
+);
+
+
+C2ENUM(C2TunneledModeStruct::sync_type_t, uint32_t,
+ REALTIME,
+ AUDIO_HW_SYNC,
+ HW_AV_SYNC,
+);
+
+/**
+ * Configure tunneled mode
+ */
+typedef C2PortParam<C2Tuning, C2TunneledModeStruct, kParamIndexTunneledMode>
+ C2PortTunneledModeTuning;
+constexpr char C2_PARAMKEY_TUNNELED_RENDER[] = "output.tunneled-render";
+
+/**
+ * Tunneled mode handle. The meaning of this is depends on the
+ * tunneled mode. If the tunneled mode is SIDEBAND, this is the
+ * sideband handle.
+ */
+typedef C2PortParam<C2Tuning, C2Int32Array, kParamIndexTunnelHandle> C2PortTunnelHandleTuning;
+constexpr char C2_PARAMKEY_OUTPUT_TUNNEL_HANDLE[] = "output.tunnel-handle";
+
+/**
+ * The system time using CLOCK_MONOTONIC in nanoseconds at the tunnel endpoint.
+ * For decoders this is the render time for the output frame and
+ * this corresponds to the media timestamp of the output frame.
+ */
+typedef C2PortParam<C2Info, C2SimpleValueStruct<int64_t>, kParamIndexTunnelSystemTime>
+ C2PortTunnelSystemTime;
+constexpr char C2_PARAMKEY_OUTPUT_RENDER_TIME[] = "output.render-time";
+
/// @}
#endif // C2CONFIG_H_
diff --git a/media/codec2/core/include/C2Param.h b/media/codec2/core/include/C2Param.h
index 436269a..e938f96 100644
--- a/media/codec2/core/include/C2Param.h
+++ b/media/codec2/core/include/C2Param.h
@@ -317,7 +317,8 @@
DEFINE_FIELD_BASED_COMPARISON_OPERATORS(Index, mIndex)
private:
- friend struct C2Param; // for setStream, MakeStreamId, isValid
+ friend class C2InfoBuffer; // for convertTo*
+ friend struct C2Param; // for setStream, MakeStreamId, isValid, convertTo*
friend struct _C2ParamInspector; // for testing
/**
diff --git a/media/codec2/core/include/C2Work.h b/media/codec2/core/include/C2Work.h
index 6923f3e..67084cc 100644
--- a/media/codec2/core/include/C2Work.h
+++ b/media/codec2/core/include/C2Work.h
@@ -161,7 +161,7 @@
//< for initial work item, these may also come from the parser - if provided
//< for output buffers, these are the responses to requestedInfos
std::vector<std::unique_ptr<C2Param>> configUpdate;
- std::vector<std::shared_ptr<C2InfoBuffer>> infoBuffers;
+ std::vector<C2InfoBuffer> infoBuffers;
};
struct C2Worklet {
diff --git a/media/codec2/hidl/1.0/utils/types.cpp b/media/codec2/hidl/1.0/utils/types.cpp
index c73cb52..1f0c856 100644
--- a/media/codec2/hidl/1.0/utils/types.cpp
+++ b/media/codec2/hidl/1.0/utils/types.cpp
@@ -943,14 +943,9 @@
d->infoBuffers.resize(s.infoBuffers.size());
i = 0;
- for (const std::shared_ptr<C2InfoBuffer>& sInfoBuffer : s.infoBuffers) {
+ for (const C2InfoBuffer& sInfoBuffer : s.infoBuffers) {
InfoBuffer& dInfoBuffer = d->infoBuffers[i++];
- if (!sInfoBuffer) {
- LOG(ERROR) << "Null C2FrameData::infoBuffers["
- << i - 1 << "].";
- return false;
- }
- if (!objcpy(&dInfoBuffer, *sInfoBuffer,
+ if (!objcpy(&dInfoBuffer, sInfoBuffer,
bufferPoolSender, baseBlocks, baseBlockIndices)) {
LOG(ERROR) << "Invalid C2FrameData::infoBuffers["
<< i - 1 << "].";
diff --git a/media/codec2/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoEncTest.cpp b/media/codec2/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoEncTest.cpp
index ecaf3a8..5bcea5b 100644
--- a/media/codec2/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoEncTest.cpp
+++ b/media/codec2/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoEncTest.cpp
@@ -107,6 +107,13 @@
mOutputSize = 0u;
mTimestampDevTest = false;
if (mCompName == unknown_comp) mDisableTest = true;
+
+ C2SecureModeTuning secureModeTuning{};
+ mComponent->query({&secureModeTuning}, {}, C2_MAY_BLOCK, nullptr);
+ if (secureModeTuning.value == C2Config::SM_READ_PROTECTED) {
+ mDisableTest = true;
+ }
+
if (mDisableTest) std::cout << "[ WARN ] Test Disabled \n";
}
diff --git a/media/codec2/hidl/1.1/utils/Android.bp b/media/codec2/hidl/1.1/utils/Android.bp
index 386f6e2..ab8635b 100644
--- a/media/codec2/hidl/1.1/utils/Android.bp
+++ b/media/codec2/hidl/1.1/utils/Android.bp
@@ -44,6 +44,12 @@
"libstagefright_bufferpool@2.0.1",
"libui",
],
+
+ // Device does not boot when global ThinLTO is enabled for this library.
+ // http://b/170595429
+ lto: {
+ never: true,
+ },
}
diff --git a/media/codec2/hidl/services/vendor.cpp b/media/codec2/hidl/services/vendor.cpp
index 81bffeb..3ddb039 100644
--- a/media/codec2/hidl/services/vendor.cpp
+++ b/media/codec2/hidl/services/vendor.cpp
@@ -122,6 +122,18 @@
})
.withSetter(SetIonUsage)
.build());
+
+ addParameter(
+ DefineParam(mDmaBufUsageInfo, "dmabuf-usage")
+ .withDefault(new C2StoreDmaBufUsageInfo())
+ .withFields({
+ C2F(mDmaBufUsageInfo, usage).flags({C2MemoryUsage::CPU_READ | C2MemoryUsage::CPU_WRITE}),
+ C2F(mDmaBufUsageInfo, capacity).inRange(0, UINT32_MAX, 1024),
+ C2F(mDmaBufUsageInfo, heapName).any(),
+ C2F(mDmaBufUsageInfo, allocFlags).flags({}),
+ })
+ .withSetter(SetDmaBufUsage)
+ .build());
}
virtual ~Interface() = default;
@@ -135,7 +147,16 @@
return C2R::Ok();
}
+ static C2R SetDmaBufUsage(bool /* mayBlock */, C2P<C2StoreDmaBufUsageInfo> &me) {
+ // Vendor's TODO: put appropriate mapping logic
+ strncpy(me.set().m.heapName, "system", me.v.flexCount());
+ me.set().m.allocFlags = 0;
+ return C2R::Ok();
+ }
+
+
std::shared_ptr<C2StoreIonUsageInfo> mIonUsageInfo;
+ std::shared_ptr<C2StoreDmaBufUsageInfo> mDmaBufUsageInfo;
};
std::shared_ptr<C2ReflectorHelper> mReflectorHelper;
Interface mInterface;
diff --git a/media/codec2/sfplugin/C2OMXNode.cpp b/media/codec2/sfplugin/C2OMXNode.cpp
index c7588e9..dd1f485 100644
--- a/media/codec2/sfplugin/C2OMXNode.cpp
+++ b/media/codec2/sfplugin/C2OMXNode.cpp
@@ -25,6 +25,7 @@
#include <C2AllocatorGralloc.h>
#include <C2BlockInternal.h>
#include <C2Component.h>
+#include <C2Config.h>
#include <C2PlatformSupport.h>
#include <OMX_Component.h>
@@ -44,6 +45,8 @@
namespace {
+constexpr OMX_U32 kPortIndexInput = 0;
+
class Buffer2D : public C2Buffer {
public:
explicit Buffer2D(C2ConstGraphicBlock block) : C2Buffer({ block }) {}
@@ -200,11 +203,27 @@
return BAD_VALUE;
}
OMX_PARAM_PORTDEFINITIONTYPE *pDef = (OMX_PARAM_PORTDEFINITIONTYPE *)params;
- // TODO: read these from intf()
+ if (pDef->nPortIndex != kPortIndexInput) {
+ break;
+ }
+
pDef->nBufferCountActual = 16;
+
+ std::shared_ptr<Codec2Client::Component> comp = mComp.lock();
+ C2PortActualDelayTuning::input inputDelay(0);
+ C2ActualPipelineDelayTuning pipelineDelay(0);
+ c2_status_t c2err = comp->query(
+ {&inputDelay, &pipelineDelay}, {}, C2_DONT_BLOCK, nullptr);
+ if (c2err == C2_OK || c2err == C2_BAD_INDEX) {
+ pDef->nBufferCountActual = 4;
+ pDef->nBufferCountActual += (inputDelay ? inputDelay.value : 0u);
+ pDef->nBufferCountActual += (pipelineDelay ? pipelineDelay.value : 0u);
+ }
+
pDef->eDomain = OMX_PortDomainVideo;
pDef->format.video.nFrameWidth = mWidth;
pDef->format.video.nFrameHeight = mHeight;
+ pDef->format.video.eColorFormat = OMX_COLOR_FormatAndroidOpaque;
err = OK;
break;
}
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 73b3857..1405b97 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -1331,8 +1331,6 @@
mCallback->onError(err2, ACTION_CODE_FATAL);
return;
}
- // We're not starting after flush.
- (void)mSentConfigAfterResume.test_and_set();
err2 = mChannel->start(inputFormat, outputFormat, buffersBoundToCodec);
if (err2 != OK) {
mCallback->onError(err2, ACTION_CODE_FATAL);
@@ -1580,7 +1578,6 @@
return;
}
- mSentConfigAfterResume.clear();
{
Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig);
const std::unique_ptr<Config> &config = *configLocked;
@@ -1797,7 +1794,7 @@
// handle configuration changes in work done
Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig);
const std::unique_ptr<Config> &config = *configLocked;
- bool changed = !mSentConfigAfterResume.test_and_set();
+ bool changed = false;
Config::Watcher<C2StreamInitDataInfo::output> initData =
config->watch<C2StreamInitDataInfo::output>();
if (!work->worklets.empty()
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index 7c4d892..aa4a004 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -625,21 +625,19 @@
Mutexed<Output>::Locked output(mOutput);
if (!output->buffers ||
output->buffers->hasPending() ||
- output->buffers->numClientBuffers() >= output->numSlots) {
+ output->buffers->numActiveSlots() >= output->numSlots) {
return;
}
}
- size_t numInputSlots = mInput.lock()->numSlots;
- for (size_t i = 0; i < numInputSlots; ++i) {
- if (mPipelineWatcher.lock()->pipelineFull()) {
- return;
- }
+ size_t numActiveSlots = 0;
+ while (!mPipelineWatcher.lock()->pipelineFull()) {
sp<MediaCodecBuffer> inBuffer;
size_t index;
{
Mutexed<Input>::Locked input(mInput);
- if (input->buffers->numClientBuffers() >= input->numSlots) {
- return;
+ numActiveSlots = input->buffers->numActiveSlots();
+ if (numActiveSlots >= input->numSlots) {
+ break;
}
if (!input->buffers->requestNewBuffer(&index, &inBuffer)) {
ALOGV("[%s] no new buffer available", mName);
@@ -649,6 +647,7 @@
ALOGV("[%s] new input index = %zu [%p]", mName, index, inBuffer.get());
mCallback->onInputBufferAvailable(index, inBuffer);
}
+ ALOGV("[%s] # active slots after feedInputBufferIfAvailable = %zu", mName, numActiveSlots);
}
status_t CCodecBufferChannel::renderOutputBuffer(
@@ -817,6 +816,9 @@
status_t result = mComponent->queueToOutputSurface(block, qbi, &qbo);
if (result != OK) {
ALOGI("[%s] queueBuffer failed: %d", mName, result);
+ if (result == NO_INIT) {
+ mCCodecCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL);
+ }
return result;
}
ALOGV("[%s] queue buffer successful", mName);
diff --git a/media/codec2/sfplugin/CCodecBuffers.cpp b/media/codec2/sfplugin/CCodecBuffers.cpp
index 10f7e66..692da58 100644
--- a/media/codec2/sfplugin/CCodecBuffers.cpp
+++ b/media/codec2/sfplugin/CCodecBuffers.cpp
@@ -274,8 +274,6 @@
// The output format can be processed without a registered slot.
if (outputFormat) {
- ALOGD("[%s] popFromStashAndRegister: output format changed to %s",
- mName, outputFormat->debugString().c_str());
updateSkipCutBuffer(outputFormat, entry.notify);
}
@@ -303,6 +301,10 @@
}
if (!entry.notify) {
+ if (outputFormat) {
+ ALOGD("[%s] popFromStashAndRegister: output format changed to %s",
+ mName, outputFormat->debugString().c_str());
+ }
mPending.pop_front();
return DISCARD;
}
@@ -319,6 +321,10 @@
// Append information from the front stash entry to outBuffer.
(*outBuffer)->meta()->setInt64("timeUs", entry.timestamp);
(*outBuffer)->meta()->setInt32("flags", entry.flags);
+ if (outputFormat) {
+ ALOGD("[%s] popFromStashAndRegister: output format changed to %s",
+ mName, outputFormat->debugString().c_str());
+ }
ALOGV("[%s] popFromStashAndRegister: "
"out buffer index = %zu [%p] => %p + %zu (%lld)",
mName, *index, outBuffer->get(),
@@ -489,11 +495,12 @@
mBuffers.clear();
}
-size_t FlexBuffersImpl::numClientBuffers() const {
+size_t FlexBuffersImpl::numActiveSlots() const {
return std::count_if(
mBuffers.begin(), mBuffers.end(),
[](const Entry &entry) {
- return (entry.clientBuffer != nullptr);
+ return (entry.clientBuffer != nullptr
+ || !entry.compBuffer.expired());
});
}
@@ -639,11 +646,11 @@
}
}
-size_t BuffersArrayImpl::numClientBuffers() const {
+size_t BuffersArrayImpl::numActiveSlots() const {
return std::count_if(
mBuffers.begin(), mBuffers.end(),
[](const Entry &entry) {
- return entry.ownedByClient;
+ return entry.ownedByClient || !entry.compBuffer.expired();
});
}
@@ -693,8 +700,8 @@
mImpl.flush();
}
-size_t InputBuffersArray::numClientBuffers() const {
- return mImpl.numClientBuffers();
+size_t InputBuffersArray::numActiveSlots() const {
+ return mImpl.numActiveSlots();
}
sp<Codec2Buffer> InputBuffersArray::createNewBuffer() {
@@ -731,8 +738,8 @@
return nullptr;
}
-size_t SlotInputBuffers::numClientBuffers() const {
- return mImpl.numClientBuffers();
+size_t SlotInputBuffers::numActiveSlots() const {
+ return mImpl.numActiveSlots();
}
sp<Codec2Buffer> SlotInputBuffers::createNewBuffer() {
@@ -783,8 +790,8 @@
return std::move(array);
}
-size_t LinearInputBuffers::numClientBuffers() const {
- return mImpl.numClientBuffers();
+size_t LinearInputBuffers::numActiveSlots() const {
+ return mImpl.numActiveSlots();
}
// static
@@ -960,8 +967,8 @@
return std::move(array);
}
-size_t GraphicMetadataInputBuffers::numClientBuffers() const {
- return mImpl.numClientBuffers();
+size_t GraphicMetadataInputBuffers::numActiveSlots() const {
+ return mImpl.numActiveSlots();
}
sp<Codec2Buffer> GraphicMetadataInputBuffers::createNewBuffer() {
@@ -1025,8 +1032,8 @@
return std::move(array);
}
-size_t GraphicInputBuffers::numClientBuffers() const {
- return mImpl.numClientBuffers();
+size_t GraphicInputBuffers::numActiveSlots() const {
+ return mImpl.numActiveSlots();
}
sp<Codec2Buffer> GraphicInputBuffers::createNewBuffer() {
@@ -1115,8 +1122,8 @@
mImpl.getArray(array);
}
-size_t OutputBuffersArray::numClientBuffers() const {
- return mImpl.numClientBuffers();
+size_t OutputBuffersArray::numActiveSlots() const {
+ return mImpl.numActiveSlots();
}
void OutputBuffersArray::realloc(const std::shared_ptr<C2Buffer> &c2buffer) {
@@ -1226,8 +1233,8 @@
return array;
}
-size_t FlexOutputBuffers::numClientBuffers() const {
- return mImpl.numClientBuffers();
+size_t FlexOutputBuffers::numActiveSlots() const {
+ return mImpl.numActiveSlots();
}
// LinearOutputBuffers
diff --git a/media/codec2/sfplugin/CCodecBuffers.h b/media/codec2/sfplugin/CCodecBuffers.h
index 0d4fa81..c383a7c 100644
--- a/media/codec2/sfplugin/CCodecBuffers.h
+++ b/media/codec2/sfplugin/CCodecBuffers.h
@@ -33,8 +33,8 @@
class SkipCutBuffer;
constexpr size_t kLinearBufferSize = 1048576;
-// This can fit 4K RGBA frame, and most likely client won't need more than this.
-constexpr size_t kMaxLinearBufferSize = 4096 * 2304 * 4;
+// This can fit an 8K frame.
+constexpr size_t kMaxLinearBufferSize = 7680 * 4320 * 2;
/**
* Base class for representation of buffers at one port.
@@ -72,7 +72,7 @@
/**
* Return number of buffers the client owns.
*/
- virtual size_t numClientBuffers() const = 0;
+ virtual size_t numActiveSlots() const = 0;
/**
* Examine image data from the buffer and update the format if necessary.
@@ -584,7 +584,7 @@
* Return the number of buffers that are sent to the client but not released
* yet.
*/
- size_t numClientBuffers() const;
+ size_t numActiveSlots() const;
/**
* Return the number of buffers that are sent to the component but not
@@ -705,7 +705,7 @@
* Return the number of buffers that are sent to the client but not released
* yet.
*/
- size_t numClientBuffers() const;
+ size_t numActiveSlots() const;
/**
* Return the size of the array.
@@ -765,7 +765,7 @@
void flush() override;
- size_t numClientBuffers() const final;
+ size_t numActiveSlots() const final;
protected:
sp<Codec2Buffer> createNewBuffer() override;
@@ -796,7 +796,7 @@
std::unique_ptr<InputBuffers> toArrayMode(size_t size) final;
- size_t numClientBuffers() const final;
+ size_t numActiveSlots() const final;
protected:
sp<Codec2Buffer> createNewBuffer() final;
@@ -826,7 +826,7 @@
std::unique_ptr<InputBuffers> toArrayMode(size_t size) override;
- size_t numClientBuffers() const final;
+ size_t numActiveSlots() const final;
protected:
sp<Codec2Buffer> createNewBuffer() override;
@@ -894,7 +894,7 @@
std::unique_ptr<InputBuffers> toArrayMode(size_t size) final;
- size_t numClientBuffers() const final;
+ size_t numActiveSlots() const final;
protected:
sp<Codec2Buffer> createNewBuffer() override;
@@ -924,7 +924,7 @@
std::unique_ptr<InputBuffers> toArrayMode(
size_t size) final;
- size_t numClientBuffers() const final;
+ size_t numActiveSlots() const final;
protected:
sp<Codec2Buffer> createNewBuffer() override;
@@ -965,7 +965,7 @@
array->clear();
}
- size_t numClientBuffers() const final {
+ size_t numActiveSlots() const final {
return 0u;
}
@@ -1019,7 +1019,7 @@
void getArray(Vector<sp<MediaCodecBuffer>> *array) const final;
- size_t numClientBuffers() const final;
+ size_t numActiveSlots() const final;
/**
* Reallocate the array, filled with buffers with the same size as given
@@ -1073,7 +1073,7 @@
std::unique_ptr<OutputBuffersArray> toArrayMode(size_t size) override;
- size_t numClientBuffers() const final;
+ size_t numActiveSlots() const final;
/**
* Return an appropriate Codec2Buffer object for the type of buffers.
diff --git a/media/codec2/sfplugin/include/media/stagefright/CCodec.h b/media/codec2/sfplugin/include/media/stagefright/CCodec.h
index ecb2506..dbbb5d5 100644
--- a/media/codec2/sfplugin/include/media/stagefright/CCodec.h
+++ b/media/codec2/sfplugin/include/media/stagefright/CCodec.h
@@ -193,7 +193,6 @@
Mutexed<std::unique_ptr<CCodecConfig>> mConfig;
Mutexed<std::list<std::unique_ptr<C2Work>>> mWorkDoneQueue;
- std::atomic_flag mSentConfigAfterResume;
friend class CCodecCallbackImpl;
diff --git a/media/codec2/tests/C2Param_test.cpp b/media/codec2/tests/C2Param_test.cpp
index c39605a..bb8130c 100644
--- a/media/codec2/tests/C2Param_test.cpp
+++ b/media/codec2/tests/C2Param_test.cpp
@@ -96,7 +96,7 @@
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
static const std::vector<C2FieldDescriptor> FieldList(); // <= needed for C2FieldDescriptor
const static FD::type_t TYPE = (FD::type_t)(CORE_INDEX | FD::STRUCT_FLAG);
-};
+} C2_PACK;
DEFINE_NO_NAMED_VALUES_FOR(C2SizeStruct)
@@ -111,11 +111,13 @@
struct C2TestStruct_A {
int32_t signed32;
+ // 4-byte padding
int64_t signed64[2];
uint32_t unsigned32[1];
+ // 4-byte padding
uint64_t unsigned64;
float fp32;
- C2SizeStruct sz[3];
+ C2SizeStruct sz[3]; // 8-byte structure, but 4-byte aligned
uint8_t blob[100];
char string[100];
bool yesNo[100];
@@ -124,21 +126,21 @@
static const std::vector<C2FieldDescriptor> FieldList();
// enum : uint32_t { CORE_INDEX = kParamIndexTest };
// typedef C2TestStruct_A _type;
-} __attribute__((packed));
+} __attribute__((aligned(4)));
const std::vector<C2FieldDescriptor> C2TestStruct_A::FieldList() {
return _FIELD_LIST;
}
const std::vector<C2FieldDescriptor> C2TestStruct_A::_FIELD_LIST =
{ { FD::INT32, 1, "s32", 0, 4 },
- { FD::INT64, 2, "s64", 4, 8 },
- { FD::UINT32, 1, "u32", 20, 4 },
- { FD::UINT64, 1, "u64", 24, 8 },
- { FD::FLOAT, 1, "fp", 32, 4 },
- { C2SizeStruct::TYPE, 3, "size", 36, 8 },
- { FD::BLOB, 100, "blob", 60, 1 },
- { FD::STRING, 100, "str", 160, 1 },
- { FD::BLOB, 100, "y-n", 260, 1 } };
+ { FD::INT64, 2, "s64", 8, 8 },
+ { FD::UINT32, 1, "u32", 24, 4 },
+ { FD::UINT64, 1, "u64", 32, 8 },
+ { FD::FLOAT, 1, "fp", 40, 4 },
+ { C2SizeStruct::TYPE, 3, "size", 44, 8 },
+ { FD::BLOB, 100, "blob", 68, 1 },
+ { FD::STRING, 100, "str", 168, 1 },
+ { FD::BLOB, 100, "y-n", 268, 1 } };
TEST_P(C2ParamTest_ParamFieldList, VerifyStruct) {
std::vector<C2FieldDescriptor> fields = GetParam(), expected = C2TestStruct_A::_FIELD_LIST;
@@ -198,11 +200,13 @@
struct C2TestAStruct {
int32_t signed32;
+ // 4-byte padding
int64_t signed64[2];
uint32_t unsigned32[1];
+ // 4-byte padding
uint64_t unsigned64;
float fp32;
- C2SizeStruct sz[3];
+ C2SizeStruct sz[3]; // 8-byte structure, but 4-byte aligned
uint8_t blob[100];
char string[100];
bool yesNo[100];
@@ -229,11 +233,13 @@
struct C2TestBStruct {
int32_t signed32;
+ // 4-byte padding
int64_t signed64[2];
uint32_t unsigned32[1];
+ // 4-byte padding
uint64_t unsigned64;
float fp32;
- C2SizeStruct sz[3];
+ C2SizeStruct sz[3]; // 8-byte structure, but 4-byte aligned
uint8_t blob[100];
char string[100];
bool yesNo[100];
@@ -286,7 +292,7 @@
if (fields.size() > 1) {
EXPECT_EQ(2u, fields.size());
EXPECT_EQ(C2FieldDescriptor(FD::INT32, 1, "s32", 0, 4), fields[0]);
- EXPECT_EQ(C2FieldDescriptor(this->FlexType, 0, "flex", 4, this->FLEX_SIZE),
+ EXPECT_EQ(C2FieldDescriptor(this->FlexType, 0, "flex", alignof(TypeParam) /* offset */, this->FLEX_SIZE),
fields[1]);
} else {
EXPECT_EQ(1u, fields.size());
@@ -392,6 +398,7 @@
struct C2TestStruct_FlexEndS64 {
int32_t signed32;
+ // 4-byte padding
int64_t mSigned64Flex[];
const static std::vector<C2FieldDescriptor> _FIELD_LIST;
@@ -406,7 +413,7 @@
}
const std::vector<C2FieldDescriptor> C2TestStruct_FlexEndS64::_FIELD_LIST = {
{ FD::INT32, 1, "s32", 0, 4 },
- { FD::INT64, 0, "flex", 4, 8 },
+ { FD::INT64, 0, "flex", 8, 8 },
};
struct C2TestFlexS64Struct {
@@ -419,6 +426,7 @@
struct C2TestFlexEndS64Struct {
int32_t signed32;
+ // 4-byte padding
int64_t mFlexSigned64[];
C2TestFlexEndS64Struct() {}
@@ -468,7 +476,7 @@
// enum : uint32_t { CORE_INDEX = C2TestStruct_FlexEndSize, FLEX_SIZE = 8 };
// typedef C2TestStruct_FlexEndSize _type;
// typedef C2SizeStruct FlexType;
-};
+} __attribute__((aligned(4)));
const std::vector<C2FieldDescriptor> C2TestStruct_FlexEndSize::FieldList() {
return _FIELD_LIST;
@@ -539,14 +547,14 @@
TEST_F(C2ParamTest, FieldId) {
// pointer constructor
EXPECT_EQ(_C2FieldId(0, 4), _C2FieldId(&((C2TestStruct_A*)0)->signed32));
- EXPECT_EQ(_C2FieldId(4, 8), _C2FieldId(&((C2TestStruct_A*)0)->signed64));
- EXPECT_EQ(_C2FieldId(20, 4), _C2FieldId(&((C2TestStruct_A*)0)->unsigned32));
- EXPECT_EQ(_C2FieldId(24, 8), _C2FieldId(&((C2TestStruct_A*)0)->unsigned64));
- EXPECT_EQ(_C2FieldId(32, 4), _C2FieldId(&((C2TestStruct_A*)0)->fp32));
- EXPECT_EQ(_C2FieldId(36, 8), _C2FieldId(&((C2TestStruct_A*)0)->sz));
- EXPECT_EQ(_C2FieldId(60, 1), _C2FieldId(&((C2TestStruct_A*)0)->blob));
- EXPECT_EQ(_C2FieldId(160, 1), _C2FieldId(&((C2TestStruct_A*)0)->string));
- EXPECT_EQ(_C2FieldId(260, 1), _C2FieldId(&((C2TestStruct_A*)0)->yesNo));
+ EXPECT_EQ(_C2FieldId(8, 8), _C2FieldId(&((C2TestStruct_A*)0)->signed64));
+ EXPECT_EQ(_C2FieldId(24, 4), _C2FieldId(&((C2TestStruct_A*)0)->unsigned32));
+ EXPECT_EQ(_C2FieldId(32, 8), _C2FieldId(&((C2TestStruct_A*)0)->unsigned64));
+ EXPECT_EQ(_C2FieldId(40, 4), _C2FieldId(&((C2TestStruct_A*)0)->fp32));
+ EXPECT_EQ(_C2FieldId(44, 8), _C2FieldId(&((C2TestStruct_A*)0)->sz));
+ EXPECT_EQ(_C2FieldId(68, 1), _C2FieldId(&((C2TestStruct_A*)0)->blob));
+ EXPECT_EQ(_C2FieldId(168, 1), _C2FieldId(&((C2TestStruct_A*)0)->string));
+ EXPECT_EQ(_C2FieldId(268, 1), _C2FieldId(&((C2TestStruct_A*)0)->yesNo));
EXPECT_EQ(_C2FieldId(0, 4), _C2FieldId(&((C2TestFlexEndSizeStruct*)0)->signed32));
EXPECT_EQ(_C2FieldId(4, 8), _C2FieldId(&((C2TestFlexEndSizeStruct*)0)->mFlexSize));
@@ -556,14 +564,14 @@
// member pointer constructor
EXPECT_EQ(_C2FieldId(0, 4), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::signed32));
- EXPECT_EQ(_C2FieldId(4, 8), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::signed64));
- EXPECT_EQ(_C2FieldId(20, 4), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::unsigned32));
- EXPECT_EQ(_C2FieldId(24, 8), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::unsigned64));
- EXPECT_EQ(_C2FieldId(32, 4), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::fp32));
- EXPECT_EQ(_C2FieldId(36, 8), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::sz));
- EXPECT_EQ(_C2FieldId(60, 1), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::blob));
- EXPECT_EQ(_C2FieldId(160, 1), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::string));
- EXPECT_EQ(_C2FieldId(260, 1), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::yesNo));
+ EXPECT_EQ(_C2FieldId(8, 8), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::signed64));
+ EXPECT_EQ(_C2FieldId(24, 4), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::unsigned32));
+ EXPECT_EQ(_C2FieldId(32, 8), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::unsigned64));
+ EXPECT_EQ(_C2FieldId(40, 4), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::fp32));
+ EXPECT_EQ(_C2FieldId(44, 8), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::sz));
+ EXPECT_EQ(_C2FieldId(68, 1), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::blob));
+ EXPECT_EQ(_C2FieldId(168, 1), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::string));
+ EXPECT_EQ(_C2FieldId(268, 1), _C2FieldId((C2TestStruct_A*)0, &C2TestStruct_A::yesNo));
EXPECT_EQ(_C2FieldId(0, 4), _C2FieldId((C2TestFlexEndSizeStruct*)0, &C2TestFlexEndSizeStruct::signed32));
EXPECT_EQ(_C2FieldId(4, 8), _C2FieldId((C2TestFlexEndSizeStruct*)0, &C2TestFlexEndSizeStruct::mFlexSize));
@@ -573,14 +581,14 @@
// member pointer sans type pointer
EXPECT_EQ(_C2FieldId(0, 4), _C2FieldId(&C2TestStruct_A::signed32));
- EXPECT_EQ(_C2FieldId(4, 8), _C2FieldId(&C2TestStruct_A::signed64));
- EXPECT_EQ(_C2FieldId(20, 4), _C2FieldId(&C2TestStruct_A::unsigned32));
- EXPECT_EQ(_C2FieldId(24, 8), _C2FieldId(&C2TestStruct_A::unsigned64));
- EXPECT_EQ(_C2FieldId(32, 4), _C2FieldId(&C2TestStruct_A::fp32));
- EXPECT_EQ(_C2FieldId(36, 8), _C2FieldId(&C2TestStruct_A::sz));
- EXPECT_EQ(_C2FieldId(60, 1), _C2FieldId(&C2TestStruct_A::blob));
- EXPECT_EQ(_C2FieldId(160, 1), _C2FieldId(&C2TestStruct_A::string));
- EXPECT_EQ(_C2FieldId(260, 1), _C2FieldId(&C2TestStruct_A::yesNo));
+ EXPECT_EQ(_C2FieldId(8, 8), _C2FieldId(&C2TestStruct_A::signed64));
+ EXPECT_EQ(_C2FieldId(24, 4), _C2FieldId(&C2TestStruct_A::unsigned32));
+ EXPECT_EQ(_C2FieldId(32, 8), _C2FieldId(&C2TestStruct_A::unsigned64));
+ EXPECT_EQ(_C2FieldId(40, 4), _C2FieldId(&C2TestStruct_A::fp32));
+ EXPECT_EQ(_C2FieldId(44, 8), _C2FieldId(&C2TestStruct_A::sz));
+ EXPECT_EQ(_C2FieldId(68, 1), _C2FieldId(&C2TestStruct_A::blob));
+ EXPECT_EQ(_C2FieldId(168, 1), _C2FieldId(&C2TestStruct_A::string));
+ EXPECT_EQ(_C2FieldId(268, 1), _C2FieldId(&C2TestStruct_A::yesNo));
EXPECT_EQ(_C2FieldId(0, 4), _C2FieldId(&C2TestFlexEndSizeStruct::signed32));
EXPECT_EQ(_C2FieldId(4, 8), _C2FieldId(&C2TestFlexEndSizeStruct::mFlexSize));
@@ -594,14 +602,14 @@
// pointer constructor in C2Param
EXPECT_EQ(_C2FieldId(8, 4), _C2FieldId(&((C2TestAInfo*)0)->signed32));
- EXPECT_EQ(_C2FieldId(12, 8), _C2FieldId(&((C2TestAInfo*)0)->signed64));
- EXPECT_EQ(_C2FieldId(28, 4), _C2FieldId(&((C2TestAInfo*)0)->unsigned32));
- EXPECT_EQ(_C2FieldId(32, 8), _C2FieldId(&((C2TestAInfo*)0)->unsigned64));
- EXPECT_EQ(_C2FieldId(40, 4), _C2FieldId(&((C2TestAInfo*)0)->fp32));
- EXPECT_EQ(_C2FieldId(44, 8), _C2FieldId(&((C2TestAInfo*)0)->sz));
- EXPECT_EQ(_C2FieldId(68, 1), _C2FieldId(&((C2TestAInfo*)0)->blob));
- EXPECT_EQ(_C2FieldId(168, 1), _C2FieldId(&((C2TestAInfo*)0)->string));
- EXPECT_EQ(_C2FieldId(268, 1), _C2FieldId(&((C2TestAInfo*)0)->yesNo));
+ EXPECT_EQ(_C2FieldId(16, 8), _C2FieldId(&((C2TestAInfo*)0)->signed64));
+ EXPECT_EQ(_C2FieldId(32, 4), _C2FieldId(&((C2TestAInfo*)0)->unsigned32));
+ EXPECT_EQ(_C2FieldId(40, 8), _C2FieldId(&((C2TestAInfo*)0)->unsigned64));
+ EXPECT_EQ(_C2FieldId(48, 4), _C2FieldId(&((C2TestAInfo*)0)->fp32));
+ EXPECT_EQ(_C2FieldId(52, 8), _C2FieldId(&((C2TestAInfo*)0)->sz));
+ EXPECT_EQ(_C2FieldId(76, 1), _C2FieldId(&((C2TestAInfo*)0)->blob));
+ EXPECT_EQ(_C2FieldId(176, 1), _C2FieldId(&((C2TestAInfo*)0)->string));
+ EXPECT_EQ(_C2FieldId(276, 1), _C2FieldId(&((C2TestAInfo*)0)->yesNo));
EXPECT_EQ(_C2FieldId(8, 4), _C2FieldId(&((C2TestFlexEndSizeInfo*)0)->m.signed32));
EXPECT_EQ(_C2FieldId(12, 8), _C2FieldId(&((C2TestFlexEndSizeInfo*)0)->m.mFlexSize));
@@ -611,14 +619,14 @@
// member pointer in C2Param
EXPECT_EQ(_C2FieldId(8, 4), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::signed32));
- EXPECT_EQ(_C2FieldId(12, 8), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::signed64));
- EXPECT_EQ(_C2FieldId(28, 4), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::unsigned32));
- EXPECT_EQ(_C2FieldId(32, 8), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::unsigned64));
- EXPECT_EQ(_C2FieldId(40, 4), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::fp32));
- EXPECT_EQ(_C2FieldId(44, 8), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::sz));
- EXPECT_EQ(_C2FieldId(68, 1), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::blob));
- EXPECT_EQ(_C2FieldId(168, 1), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::string));
- EXPECT_EQ(_C2FieldId(268, 1), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::yesNo));
+ EXPECT_EQ(_C2FieldId(16, 8), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::signed64));
+ EXPECT_EQ(_C2FieldId(32, 4), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::unsigned32));
+ EXPECT_EQ(_C2FieldId(40, 8), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::unsigned64));
+ EXPECT_EQ(_C2FieldId(48, 4), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::fp32));
+ EXPECT_EQ(_C2FieldId(52, 8), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::sz));
+ EXPECT_EQ(_C2FieldId(76, 1), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::blob));
+ EXPECT_EQ(_C2FieldId(176, 1), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::string));
+ EXPECT_EQ(_C2FieldId(276, 1), _C2FieldId((C2TestAInfo*)0, &C2TestAInfo::yesNo));
// NOTE: cannot use a member pointer for flex params due to introduction of 'm'
// EXPECT_EQ(_C2FieldId(8, 4), _C2FieldId(&C2TestFlexEndSizeInfo::m.signed32));
diff --git a/media/codec2/tests/vndk/C2BufferTest.cpp b/media/codec2/tests/vndk/C2BufferTest.cpp
index 780994a..a9f8e17 100644
--- a/media/codec2/tests/vndk/C2BufferTest.cpp
+++ b/media/codec2/tests/vndk/C2BufferTest.cpp
@@ -765,4 +765,54 @@
}
}
+TEST_F(C2BufferTest, InfoBufferTest) {
+ constexpr size_t kCapacity = 524288u;
+
+ // allocate a linear block
+ std::shared_ptr<C2BlockPool> linearPool(makeLinearBlockPool());
+ std::shared_ptr<C2LinearBlock> linearBlock;
+ ASSERT_EQ(C2_OK, linearPool->fetchLinearBlock(
+ kCapacity,
+ { C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE },
+ &linearBlock));
+
+ C2InfoBuffer info = C2InfoBuffer::CreateLinearBuffer(
+ kParamIndexNumber1, linearBlock->share(1024, kCapacity / 2, C2Fence()));
+ std::shared_ptr<C2InfoBuffer> spInfo(new C2InfoBuffer(info));
+ ASSERT_EQ(kParamIndexNumber1, spInfo->index().coreIndex());
+ ASSERT_TRUE(spInfo->index().isGlobal());
+ ASSERT_EQ(C2Param::INFO, spInfo->index().kind());
+ ASSERT_EQ(C2BufferData::LINEAR, spInfo->data().type());
+ ASSERT_EQ(1024, spInfo->data().linearBlocks()[0].offset());
+ ASSERT_EQ(kCapacity / 2, spInfo->data().linearBlocks()[0].size());
+ // handles must actually be identical after sharing into an info buffer
+ ASSERT_EQ(linearBlock->handle(), spInfo->data().linearBlocks()[0].handle());
+ ASSERT_EQ(linearPool->getAllocatorId(), spInfo->data().linearBlocks()[0].getAllocatorId());
+
+ C2InfoBuffer streamInfo = info.asStream(false /* output */, 1u);
+ ASSERT_EQ(kParamIndexNumber1, streamInfo.index().coreIndex());
+ ASSERT_TRUE(streamInfo.index().forStream());
+ ASSERT_TRUE(streamInfo.index().forInput());
+ ASSERT_EQ(1u, streamInfo.index().stream());
+ ASSERT_EQ(C2Param::INFO, streamInfo.index().kind());
+ ASSERT_EQ(C2BufferData::LINEAR, streamInfo.data().type());
+ ASSERT_EQ(1024, streamInfo.data().linearBlocks()[0].offset());
+ ASSERT_EQ(kCapacity / 2, streamInfo.data().linearBlocks()[0].size());
+ // handles must actually be identical after sharing into an info buffer
+ ASSERT_EQ(linearBlock->handle(), streamInfo.data().linearBlocks()[0].handle());
+ ASSERT_EQ(linearPool->getAllocatorId(), streamInfo.data().linearBlocks()[0].getAllocatorId());
+
+ C2InfoBuffer portInfo = streamInfo.asPort(true /* output */);
+ ASSERT_EQ(kParamIndexNumber1, portInfo.index().coreIndex());
+ ASSERT_TRUE(portInfo.index().forPort());
+ ASSERT_TRUE(portInfo.index().forOutput());
+ ASSERT_EQ(C2Param::INFO, portInfo.index().kind());
+ ASSERT_EQ(C2BufferData::LINEAR, portInfo.data().type());
+ ASSERT_EQ(1024, portInfo.data().linearBlocks()[0].offset());
+ ASSERT_EQ(kCapacity / 2, portInfo.data().linearBlocks()[0].size());
+ // handles must actually be identical after sharing into an info buffer
+ ASSERT_EQ(linearBlock->handle(), portInfo.data().linearBlocks()[0].handle());
+ ASSERT_EQ(linearPool->getAllocatorId(), portInfo.data().linearBlocks()[0].getAllocatorId());
+}
+
} // namespace android
diff --git a/media/codec2/vndk/Android.bp b/media/codec2/vndk/Android.bp
index 6f7acce..60f4736 100644
--- a/media/codec2/vndk/Android.bp
+++ b/media/codec2/vndk/Android.bp
@@ -26,6 +26,7 @@
"C2AllocatorGralloc.cpp",
"C2Buffer.cpp",
"C2Config.cpp",
+ "C2DmaBufAllocator.cpp",
"C2PlatformStorePluginLoader.cpp",
"C2Store.cpp",
"platform/C2BqBuffer.cpp",
@@ -64,6 +65,7 @@
"libhardware",
"libhidlbase",
"libion",
+ "libdmabufheap",
"libfmq",
"liblog",
"libnativewindow",
diff --git a/media/codec2/vndk/C2AllocatorBlob.cpp b/media/codec2/vndk/C2AllocatorBlob.cpp
index 50c9e59..565137c 100644
--- a/media/codec2/vndk/C2AllocatorBlob.cpp
+++ b/media/codec2/vndk/C2AllocatorBlob.cpp
@@ -175,12 +175,12 @@
}
// static
-bool C2AllocatorBlob::isValid(const C2Handle* const o) {
+bool C2AllocatorBlob::CheckHandle(const C2Handle* const o) {
size_t capacity;
// Distinguish C2Handle purely allocated by C2AllocatorGralloc, or one allocated through
// C2AllocatorBlob, by checking the handle's height is 1, and its format is
// PixelFormat::BLOB by GetCapacityFromHandle().
- return C2AllocatorGralloc::isValid(o) && GetCapacityFromHandle(o, &capacity) == C2_OK;
+ return C2AllocatorGralloc::CheckHandle(o) && GetCapacityFromHandle(o, &capacity) == C2_OK;
}
} // namespace android
diff --git a/media/codec2/vndk/C2AllocatorGralloc.cpp b/media/codec2/vndk/C2AllocatorGralloc.cpp
index e1e1377..4d7e619 100644
--- a/media/codec2/vndk/C2AllocatorGralloc.cpp
+++ b/media/codec2/vndk/C2AllocatorGralloc.cpp
@@ -103,7 +103,7 @@
const static uint32_t MAGIC = '\xc2gr\x00';
static
- const ExtraData* getExtraData(const C2Handle *const handle) {
+ const ExtraData* GetExtraData(const C2Handle *const handle) {
if (handle == nullptr
|| native_handle_is_invalid(handle)
|| handle->numInts < NUM_INTS) {
@@ -114,23 +114,23 @@
}
static
- ExtraData *getExtraData(C2Handle *const handle) {
- return const_cast<ExtraData *>(getExtraData(const_cast<const C2Handle *const>(handle)));
+ ExtraData *GetExtraData(C2Handle *const handle) {
+ return const_cast<ExtraData *>(GetExtraData(const_cast<const C2Handle *const>(handle)));
}
public:
void getIgbpData(uint32_t *generation, uint64_t *igbp_id, uint32_t *igbp_slot) const {
- const ExtraData *ed = getExtraData(this);
+ const ExtraData *ed = GetExtraData(this);
*generation = ed->generation;
*igbp_id = unsigned(ed->igbp_id_lo) | uint64_t(unsigned(ed->igbp_id_hi)) << 32;
*igbp_slot = ed->igbp_slot;
}
- static bool isValid(const C2Handle *const o) {
+ static bool IsValid(const C2Handle *const o) {
if (o == nullptr) { // null handle is always valid
return true;
}
- const ExtraData *xd = getExtraData(o);
+ const ExtraData *xd = GetExtraData(o);
// we cannot validate width/height/format/usage without accessing gralloc driver
return xd != nullptr && xd->magic == MAGIC;
}
@@ -152,7 +152,7 @@
native_handle_t *res = native_handle_create(handle->numFds, handle->numInts + NUM_INTS);
if (res != nullptr) {
memcpy(&res->data, &handle->data, sizeof(int) * (handle->numFds + handle->numInts));
- *getExtraData(res) = xd;
+ *GetExtraData(res) = xd;
}
return reinterpret_cast<C2HandleGralloc *>(res);
}
@@ -180,10 +180,10 @@
static bool MigrateNativeHandle(
native_handle_t *handle,
uint32_t generation, uint64_t igbp_id, uint32_t igbp_slot) {
- if (handle == nullptr || !isValid(handle)) {
+ if (handle == nullptr || !IsValid(handle)) {
return false;
}
- ExtraData *ed = getExtraData(handle);
+ ExtraData *ed = GetExtraData(handle);
if (!ed) return false;
ed->generation = generation;
ed->igbp_id_lo = uint32_t(igbp_id & 0xFFFFFFFF);
@@ -195,7 +195,7 @@
static native_handle_t* UnwrapNativeHandle(
const C2Handle *const handle) {
- const ExtraData *xd = getExtraData(handle);
+ const ExtraData *xd = GetExtraData(handle);
if (xd == nullptr || xd->magic != MAGIC) {
return nullptr;
}
@@ -211,7 +211,7 @@
uint32_t *width, uint32_t *height, uint32_t *format,
uint64_t *usage, uint32_t *stride,
uint32_t *generation, uint64_t *igbp_id, uint32_t *igbp_slot) {
- const ExtraData *xd = getExtraData(handle);
+ const ExtraData *xd = GetExtraData(handle);
if (xd == nullptr) {
return nullptr;
}
@@ -784,8 +784,9 @@
return mImpl->status();
}
-bool C2AllocatorGralloc::isValid(const C2Handle* const o) {
- return C2HandleGralloc::isValid(o);
+// static
+bool C2AllocatorGralloc::CheckHandle(const C2Handle* const o) {
+ return C2HandleGralloc::IsValid(o);
}
} // namespace android
diff --git a/media/codec2/vndk/C2AllocatorIon.cpp b/media/codec2/vndk/C2AllocatorIon.cpp
index 6d27a02..85623b8 100644
--- a/media/codec2/vndk/C2AllocatorIon.cpp
+++ b/media/codec2/vndk/C2AllocatorIon.cpp
@@ -73,7 +73,7 @@
};
// static
-bool C2HandleIon::isValid(const C2Handle * const o) {
+bool C2HandleIon::IsValid(const C2Handle * const o) {
if (!o || memcmp(o, &cHeader, sizeof(cHeader))) {
return false;
}
@@ -579,7 +579,7 @@
return mInit;
}
- if (!C2HandleIon::isValid(handle)) {
+ if (!C2HandleIon::IsValid(handle)) {
return C2_BAD_VALUE;
}
@@ -596,9 +596,8 @@
return ret;
}
-bool C2AllocatorIon::isValid(const C2Handle* const o) {
- return C2HandleIon::isValid(o);
+bool C2AllocatorIon::CheckHandle(const C2Handle* const o) {
+ return C2HandleIon::IsValid(o);
}
} // namespace android
-
diff --git a/media/codec2/vndk/C2Buffer.cpp b/media/codec2/vndk/C2Buffer.cpp
index 0b08f31..143355f 100644
--- a/media/codec2/vndk/C2Buffer.cpp
+++ b/media/codec2/vndk/C2Buffer.cpp
@@ -106,6 +106,7 @@
class BufferDataBuddy : public C2BufferData {
using C2BufferData::C2BufferData;
friend class ::C2Buffer;
+ friend class ::C2InfoBuffer;
};
} // namespace
@@ -396,26 +397,18 @@
std::shared_ptr<C2LinearBlock> _C2BlockFactory::CreateLinearBlock(
const C2Handle *handle) {
// TODO: get proper allocator? and mutex?
- static std::unique_ptr<C2Allocator> sAllocator = []{
- std::unique_ptr<C2Allocator> allocator;
- if (android::GetPreferredLinearAllocatorId(android::GetCodec2PoolMask()) ==
- android::C2PlatformAllocatorStore::BLOB) {
- allocator = std::make_unique<C2AllocatorBlob>(android::C2PlatformAllocatorStore::BLOB);
- } else {
- allocator = std::make_unique<C2AllocatorIon>(android::C2PlatformAllocatorStore::ION);
- }
+ static std::shared_ptr<C2Allocator> sAllocator = []{
+ std::shared_ptr<C2Allocator> allocator;
+ std::shared_ptr<C2AllocatorStore> allocatorStore = android::GetCodec2PlatformAllocatorStore();
+ allocatorStore->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &allocator);
+
return allocator;
}();
if (sAllocator == nullptr)
return nullptr;
- bool isValidHandle = false;
- if (sAllocator->getId() == android::C2PlatformAllocatorStore::BLOB) {
- isValidHandle = C2AllocatorBlob::isValid(handle);
- } else {
- isValidHandle = C2AllocatorIon::isValid(handle);
- }
+ bool isValidHandle = sAllocator->checkHandle(handle);
std::shared_ptr<C2LinearAllocation> alloc;
if (isValidHandle) {
@@ -431,26 +424,18 @@
std::shared_ptr<C2LinearBlock> _C2BlockFactory::CreateLinearBlock(
const C2Handle *cHandle, const std::shared_ptr<BufferPoolData> &data) {
// TODO: get proper allocator? and mutex?
- static std::unique_ptr<C2Allocator> sAllocator = []{
- std::unique_ptr<C2Allocator> allocator;
- if (android::GetPreferredLinearAllocatorId(android::GetCodec2PoolMask()) ==
- android::C2PlatformAllocatorStore::BLOB) {
- allocator = std::make_unique<C2AllocatorBlob>(android::C2PlatformAllocatorStore::BLOB);
- } else {
- allocator = std::make_unique<C2AllocatorIon>(android::C2PlatformAllocatorStore::ION);
- }
+ static std::shared_ptr<C2Allocator> sAllocator = []{
+ std::shared_ptr<C2Allocator> allocator;
+ std::shared_ptr<C2AllocatorStore> allocatorStore = android::GetCodec2PlatformAllocatorStore();
+ allocatorStore->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &allocator);
+
return allocator;
}();
if (sAllocator == nullptr)
return nullptr;
- bool isValidHandle = false;
- if (sAllocator->getId() == android::C2PlatformAllocatorStore::BLOB) {
- isValidHandle = C2AllocatorBlob::isValid(cHandle);
- } else {
- isValidHandle = C2AllocatorIon::isValid(cHandle);
- }
+ bool isValidHandle = sAllocator->checkHandle(cHandle);
std::shared_ptr<C2LinearAllocation> alloc;
if (isValidHandle) {
@@ -1148,7 +1133,7 @@
static std::unique_ptr<C2AllocatorGralloc> sAllocator = std::make_unique<C2AllocatorGralloc>(0);
std::shared_ptr<C2GraphicAllocation> alloc;
- if (C2AllocatorGralloc::isValid(cHandle)) {
+ if (sAllocator->isValid(cHandle)) {
c2_status_t err = sAllocator->priorGraphicAllocation(cHandle, &alloc);
const std::shared_ptr<C2PooledBlockPoolData> poolData =
std::make_shared<C2PooledBlockPoolData>(data);
@@ -1185,6 +1170,7 @@
type_t mType;
std::vector<C2ConstLinearBlock> mLinearBlocks;
std::vector<C2ConstGraphicBlock> mGraphicBlocks;
+ friend class C2InfoBuffer;
};
C2BufferData::C2BufferData(const std::vector<C2ConstLinearBlock> &blocks) : mImpl(new Impl(blocks)) {}
@@ -1200,6 +1186,35 @@
return mImpl->graphicBlocks();
}
+C2InfoBuffer::C2InfoBuffer(
+ C2Param::Index index, const std::vector<C2ConstLinearBlock> &blocks)
+ : mIndex(index), mData(BufferDataBuddy(blocks)) {
+}
+
+C2InfoBuffer::C2InfoBuffer(
+ C2Param::Index index, const std::vector<C2ConstGraphicBlock> &blocks)
+ : mIndex(index), mData(BufferDataBuddy(blocks)) {
+}
+
+C2InfoBuffer::C2InfoBuffer(
+ C2Param::Index index, const C2BufferData &data)
+ : mIndex(index), mData(data) {
+}
+
+// static
+C2InfoBuffer C2InfoBuffer::CreateLinearBuffer(
+ C2Param::CoreIndex index, const C2ConstLinearBlock &block) {
+ return C2InfoBuffer(index.coreIndex() | C2Param::Index::KIND_INFO | C2Param::Index::DIR_GLOBAL,
+ { block });
+}
+
+// static
+C2InfoBuffer C2InfoBuffer::CreateGraphicBuffer(
+ C2Param::CoreIndex index, const C2ConstGraphicBlock &block) {
+ return C2InfoBuffer(index.coreIndex() | C2Param::Index::KIND_INFO | C2Param::Index::DIR_GLOBAL,
+ { block });
+}
+
class C2Buffer::Impl {
public:
Impl(C2Buffer *thiz, const std::vector<C2ConstLinearBlock> &blocks)
@@ -1330,4 +1345,3 @@
std::shared_ptr<C2Buffer> C2Buffer::CreateGraphicBuffer(const C2ConstGraphicBlock &block) {
return std::shared_ptr<C2Buffer>(new C2Buffer({ block }));
}
-
diff --git a/media/codec2/vndk/C2DmaBufAllocator.cpp b/media/codec2/vndk/C2DmaBufAllocator.cpp
new file mode 100644
index 0000000..59e82e2
--- /dev/null
+++ b/media/codec2/vndk/C2DmaBufAllocator.cpp
@@ -0,0 +1,401 @@
+/*
+ * 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 "C2DmaBufAllocator"
+#include <BufferAllocator/BufferAllocator.h>
+#include <C2Buffer.h>
+#include <C2Debug.h>
+#include <C2DmaBufAllocator.h>
+#include <C2ErrnoUtils.h>
+#include <linux/ion.h>
+#include <sys/mman.h>
+#include <unistd.h> // getpagesize, size_t, close, dup
+#include <utils/Log.h>
+
+#include <list>
+
+#ifdef __ANDROID_APEX__
+#include <android-base/properties.h>
+#endif
+
+namespace android {
+
+namespace {
+constexpr size_t USAGE_LRU_CACHE_SIZE = 1024;
+}
+
+/* =========================== BUFFER HANDLE =========================== */
+/**
+ * Buffer handle
+ *
+ * Stores dmabuf fd & metadata
+ *
+ * This handle will not capture mapped fd-s as updating that would require a
+ * global mutex.
+ */
+
+struct C2HandleBuf : public C2Handle {
+ C2HandleBuf(int bufferFd, size_t size)
+ : C2Handle(cHeader),
+ mFds{bufferFd},
+ mInts{int(size & 0xFFFFFFFF), int((uint64_t(size) >> 32) & 0xFFFFFFFF), kMagic} {}
+
+ static bool IsValid(const C2Handle* const o);
+
+ int bufferFd() const { return mFds.mBuffer; }
+ size_t size() const {
+ return size_t(unsigned(mInts.mSizeLo)) | size_t(uint64_t(unsigned(mInts.mSizeHi)) << 32);
+ }
+
+ protected:
+ struct {
+ int mBuffer; // dmabuf fd
+ } mFds;
+ struct {
+ int mSizeLo; // low 32-bits of size
+ int mSizeHi; // high 32-bits of size
+ int mMagic;
+ } mInts;
+
+ private:
+ typedef C2HandleBuf _type;
+ enum {
+ kMagic = '\xc2io\x00',
+ numFds = sizeof(mFds) / sizeof(int),
+ numInts = sizeof(mInts) / sizeof(int),
+ version = sizeof(C2Handle)
+ };
+ // constexpr static C2Handle cHeader = { version, numFds, numInts, {} };
+ const static C2Handle cHeader;
+};
+
+const C2Handle C2HandleBuf::cHeader = {
+ C2HandleBuf::version, C2HandleBuf::numFds, C2HandleBuf::numInts, {}};
+
+// static
+bool C2HandleBuf::IsValid(const C2Handle* const o) {
+ if (!o || memcmp(o, &cHeader, sizeof(cHeader))) {
+ return false;
+ }
+ const C2HandleBuf* other = static_cast<const C2HandleBuf*>(o);
+ return other->mInts.mMagic == kMagic;
+}
+
+/* =========================== DMABUF ALLOCATION =========================== */
+class C2DmaBufAllocation : public C2LinearAllocation {
+ public:
+ /* Interface methods */
+ virtual c2_status_t map(size_t offset, size_t size, C2MemoryUsage usage, C2Fence* fence,
+ void** addr /* nonnull */) override;
+ virtual c2_status_t unmap(void* addr, size_t size, C2Fence* fenceFd) override;
+ virtual ~C2DmaBufAllocation() override;
+ virtual const C2Handle* handle() const override;
+ virtual id_t getAllocatorId() const override;
+ virtual bool equals(const std::shared_ptr<C2LinearAllocation>& other) const override;
+
+ // internal methods
+ C2DmaBufAllocation(BufferAllocator& alloc, size_t size, C2String heap_name, unsigned flags,
+ C2Allocator::id_t id);
+ C2DmaBufAllocation(size_t size, int shareFd, C2Allocator::id_t id);
+
+ c2_status_t status() const;
+
+ protected:
+ virtual c2_status_t mapInternal(size_t mapSize, size_t mapOffset, size_t alignmentBytes,
+ int prot, int flags, void** base, void** addr) {
+ c2_status_t err = C2_OK;
+ *base = mmap(nullptr, mapSize, prot, flags, mHandle.bufferFd(), mapOffset);
+ ALOGV("mmap(size = %zu, prot = %d, flags = %d, mapFd = %d, offset = %zu) "
+ "returned (%d)",
+ mapSize, prot, flags, mHandle.bufferFd(), mapOffset, errno);
+ if (*base == MAP_FAILED) {
+ *base = *addr = nullptr;
+ err = c2_map_errno<EINVAL>(errno);
+ } else {
+ *addr = (uint8_t*)*base + alignmentBytes;
+ }
+ return err;
+ }
+
+ C2Allocator::id_t mId;
+ C2HandleBuf mHandle;
+ c2_status_t mInit;
+ struct Mapping {
+ void* addr;
+ size_t alignmentBytes;
+ size_t size;
+ };
+ std::list<Mapping> mMappings;
+
+ // TODO: we could make this encapsulate shared_ptr and copiable
+ C2_DO_NOT_COPY(C2DmaBufAllocation);
+};
+
+c2_status_t C2DmaBufAllocation::map(size_t offset, size_t size, C2MemoryUsage usage, C2Fence* fence,
+ void** addr) {
+ (void)fence; // TODO: wait for fence
+ *addr = nullptr;
+ if (!mMappings.empty()) {
+ ALOGV("multiple map");
+ // TODO: technically we should return DUPLICATE here, but our block views
+ // don't actually unmap, so we end up remapping the buffer multiple times.
+ //
+ // return C2_DUPLICATE;
+ }
+ if (size == 0) {
+ return C2_BAD_VALUE;
+ }
+
+ int prot = PROT_NONE;
+ int flags = MAP_SHARED;
+ if (usage.expected & C2MemoryUsage::CPU_READ) {
+ prot |= PROT_READ;
+ }
+ if (usage.expected & C2MemoryUsage::CPU_WRITE) {
+ prot |= PROT_WRITE;
+ }
+
+ size_t alignmentBytes = offset % PAGE_SIZE;
+ size_t mapOffset = offset - alignmentBytes;
+ size_t mapSize = size + alignmentBytes;
+ Mapping map = {nullptr, alignmentBytes, mapSize};
+
+ c2_status_t err =
+ mapInternal(mapSize, mapOffset, alignmentBytes, prot, flags, &(map.addr), addr);
+ if (map.addr) {
+ mMappings.push_back(map);
+ }
+ return err;
+}
+
+c2_status_t C2DmaBufAllocation::unmap(void* addr, size_t size, C2Fence* fence) {
+ if (mMappings.empty()) {
+ ALOGD("tried to unmap unmapped buffer");
+ return C2_NOT_FOUND;
+ }
+ for (auto it = mMappings.begin(); it != mMappings.end(); ++it) {
+ if (addr != (uint8_t*)it->addr + it->alignmentBytes ||
+ size + it->alignmentBytes != it->size) {
+ continue;
+ }
+ int err = munmap(it->addr, it->size);
+ if (err != 0) {
+ ALOGD("munmap failed");
+ return c2_map_errno<EINVAL>(errno);
+ }
+ if (fence) {
+ *fence = C2Fence(); // not using fences
+ }
+ (void)mMappings.erase(it);
+ ALOGV("successfully unmapped: %d", mHandle.bufferFd());
+ return C2_OK;
+ }
+ ALOGD("unmap failed to find specified map");
+ return C2_BAD_VALUE;
+}
+
+c2_status_t C2DmaBufAllocation::status() const {
+ return mInit;
+}
+
+C2Allocator::id_t C2DmaBufAllocation::getAllocatorId() const {
+ return mId;
+}
+
+bool C2DmaBufAllocation::equals(const std::shared_ptr<C2LinearAllocation>& other) const {
+ if (!other || other->getAllocatorId() != getAllocatorId()) {
+ return false;
+ }
+ // get user handle to compare objects
+ std::shared_ptr<C2DmaBufAllocation> otherAsBuf =
+ std::static_pointer_cast<C2DmaBufAllocation>(other);
+ return mHandle.bufferFd() == otherAsBuf->mHandle.bufferFd();
+}
+
+const C2Handle* C2DmaBufAllocation::handle() const {
+ return &mHandle;
+}
+
+C2DmaBufAllocation::~C2DmaBufAllocation() {
+ if (!mMappings.empty()) {
+ ALOGD("Dangling mappings!");
+ for (const Mapping& map : mMappings) {
+ int err = munmap(map.addr, map.size);
+ if (err) ALOGD("munmap failed");
+ }
+ }
+ if (mInit == C2_OK) {
+ native_handle_close(&mHandle);
+ }
+}
+
+C2DmaBufAllocation::C2DmaBufAllocation(BufferAllocator& alloc, size_t size, C2String heap_name,
+ unsigned flags, C2Allocator::id_t id)
+ : C2LinearAllocation(size), mHandle(-1, 0) {
+ int bufferFd = -1;
+ int ret = 0;
+
+ bufferFd = alloc.Alloc(heap_name, size, flags);
+ if (bufferFd < 0) ret = bufferFd;
+
+ mHandle = C2HandleBuf(bufferFd, size);
+ mId = id;
+ mInit = c2_status_t(c2_map_errno<ENOMEM, EACCES, EINVAL>(ret));
+}
+
+C2DmaBufAllocation::C2DmaBufAllocation(size_t size, int shareFd, C2Allocator::id_t id)
+ : C2LinearAllocation(size), mHandle(-1, 0) {
+ mHandle = C2HandleBuf(shareFd, size);
+ mId = id;
+ mInit = c2_status_t(c2_map_errno<ENOMEM, EACCES, EINVAL>(0));
+}
+
+/* =========================== DMABUF ALLOCATOR =========================== */
+C2DmaBufAllocator::C2DmaBufAllocator(id_t id) : mInit(C2_OK) {
+ C2MemoryUsage minUsage = {0, 0};
+ C2MemoryUsage maxUsage = {C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE};
+ Traits traits = {"android.allocator.dmabuf", id, LINEAR, minUsage, maxUsage};
+ mTraits = std::make_shared<Traits>(traits);
+}
+
+C2Allocator::id_t C2DmaBufAllocator::getId() const {
+ std::lock_guard<std::mutex> lock(mUsageMapperLock);
+ return mTraits->id;
+}
+
+C2String C2DmaBufAllocator::getName() const {
+ std::lock_guard<std::mutex> lock(mUsageMapperLock);
+ return mTraits->name;
+}
+
+std::shared_ptr<const C2Allocator::Traits> C2DmaBufAllocator::getTraits() const {
+ std::lock_guard<std::mutex> lock(mUsageMapperLock);
+ return mTraits;
+}
+
+void C2DmaBufAllocator::setUsageMapper(const UsageMapperFn& mapper __unused, uint64_t minUsage,
+ uint64_t maxUsage, uint64_t blockSize) {
+ std::lock_guard<std::mutex> lock(mUsageMapperLock);
+ mUsageMapperCache.clear();
+ mUsageMapperLru.clear();
+ mUsageMapper = mapper;
+ Traits traits = {mTraits->name, mTraits->id, LINEAR, C2MemoryUsage(minUsage),
+ C2MemoryUsage(maxUsage)};
+ mTraits = std::make_shared<Traits>(traits);
+ mBlockSize = blockSize;
+}
+
+std::size_t C2DmaBufAllocator::MapperKeyHash::operator()(const MapperKey& k) const {
+ return std::hash<uint64_t>{}(k.first) ^ std::hash<size_t>{}(k.second);
+}
+
+c2_status_t C2DmaBufAllocator::mapUsage(C2MemoryUsage usage, size_t capacity, C2String* heap_name,
+ unsigned* flags) {
+ std::lock_guard<std::mutex> lock(mUsageMapperLock);
+ c2_status_t res = C2_OK;
+ // align capacity
+ capacity = (capacity + mBlockSize - 1) & ~(mBlockSize - 1);
+ MapperKey key = std::make_pair(usage.expected, capacity);
+ auto entry = mUsageMapperCache.find(key);
+ if (entry == mUsageMapperCache.end()) {
+ if (mUsageMapper) {
+ res = mUsageMapper(usage, capacity, heap_name, flags);
+ } else {
+ // No system-uncached yet, so disabled for now
+ if (0 && !(usage.expected & (C2MemoryUsage::CPU_READ | C2MemoryUsage::CPU_WRITE)))
+ *heap_name = "system-uncached";
+ else
+ *heap_name = "system";
+ *flags = 0;
+ res = C2_NO_INIT;
+ }
+ // add usage to cache
+ MapperValue value = std::make_tuple(*heap_name, *flags, res);
+ mUsageMapperLru.emplace_front(key, value);
+ mUsageMapperCache.emplace(std::make_pair(key, mUsageMapperLru.begin()));
+ if (mUsageMapperCache.size() > USAGE_LRU_CACHE_SIZE) {
+ // remove LRU entry
+ MapperKey lruKey = mUsageMapperLru.front().first;
+ mUsageMapperCache.erase(lruKey);
+ mUsageMapperLru.pop_back();
+ }
+ } else {
+ // move entry to MRU
+ mUsageMapperLru.splice(mUsageMapperLru.begin(), mUsageMapperLru, entry->second);
+ const MapperValue& value = entry->second->second;
+ std::tie(*heap_name, *flags, res) = value;
+ }
+ return res;
+}
+
+c2_status_t C2DmaBufAllocator::newLinearAllocation(
+ uint32_t capacity, C2MemoryUsage usage, std::shared_ptr<C2LinearAllocation>* allocation) {
+ if (allocation == nullptr) {
+ return C2_BAD_VALUE;
+ }
+
+ allocation->reset();
+ if (mInit != C2_OK) {
+ return mInit;
+ }
+
+ C2String heap_name;
+ unsigned flags = 0;
+ c2_status_t ret = mapUsage(usage, capacity, &heap_name, &flags);
+ if (ret && ret != C2_NO_INIT) {
+ return ret;
+ }
+
+ std::shared_ptr<C2DmaBufAllocation> alloc = std::make_shared<C2DmaBufAllocation>(
+ mBufferAllocator, capacity, heap_name, flags, getId());
+ ret = alloc->status();
+ if (ret == C2_OK) {
+ *allocation = alloc;
+ }
+ return ret;
+}
+
+c2_status_t C2DmaBufAllocator::priorLinearAllocation(
+ const C2Handle* handle, std::shared_ptr<C2LinearAllocation>* allocation) {
+ *allocation = nullptr;
+ if (mInit != C2_OK) {
+ return mInit;
+ }
+
+ if (!C2HandleBuf::IsValid(handle)) {
+ return C2_BAD_VALUE;
+ }
+
+ // TODO: get capacity and validate it
+ const C2HandleBuf* h = static_cast<const C2HandleBuf*>(handle);
+ std::shared_ptr<C2DmaBufAllocation> alloc =
+ std::make_shared<C2DmaBufAllocation>(h->size(), h->bufferFd(), getId());
+ c2_status_t ret = alloc->status();
+ if (ret == C2_OK) {
+ *allocation = alloc;
+ native_handle_delete(
+ const_cast<native_handle_t*>(reinterpret_cast<const native_handle_t*>(handle)));
+ }
+ return ret;
+}
+
+// static
+bool C2DmaBufAllocator::CheckHandle(const C2Handle* const o) {
+ return C2HandleBuf::IsValid(o);
+}
+
+} // namespace android
diff --git a/media/codec2/vndk/C2PlatformStorePluginLoader.cpp b/media/codec2/vndk/C2PlatformStorePluginLoader.cpp
index 4c330e5..bee028a 100644
--- a/media/codec2/vndk/C2PlatformStorePluginLoader.cpp
+++ b/media/codec2/vndk/C2PlatformStorePluginLoader.cpp
@@ -33,7 +33,8 @@
} // unnamed
C2PlatformStorePluginLoader::C2PlatformStorePluginLoader(const char *libPath)
- : mCreateBlockPool(nullptr) {
+ : mCreateBlockPool(nullptr),
+ mCreateAllocator(nullptr) {
mLibHandle = dlopen(libPath, RTLD_NOW | RTLD_NODELETE);
if (mLibHandle == nullptr) {
ALOGD("Failed to load library: %s (%s)", libPath, dlerror());
diff --git a/media/codec2/vndk/C2Store.cpp b/media/codec2/vndk/C2Store.cpp
index d16527e..1e907c1 100644
--- a/media/codec2/vndk/C2Store.cpp
+++ b/media/codec2/vndk/C2Store.cpp
@@ -21,6 +21,7 @@
#include <C2AllocatorBlob.h>
#include <C2AllocatorGralloc.h>
#include <C2AllocatorIon.h>
+#include <C2DmaBufAllocator.h>
#include <C2BufferPriv.h>
#include <C2BqBufferPriv.h>
#include <C2Component.h>
@@ -82,6 +83,7 @@
/// returns a shared-singleton ion allocator
std::shared_ptr<C2Allocator> fetchIonAllocator();
+ std::shared_ptr<C2Allocator> fetchDmaBufAllocator();
/// returns a shared-singleton gralloc allocator
std::shared_ptr<C2Allocator> fetchGrallocAllocator();
@@ -99,6 +101,20 @@
C2PlatformAllocatorStoreImpl::C2PlatformAllocatorStoreImpl() {
}
+static bool using_ion(void) {
+ static int cached_result = -1;
+
+ if (cached_result == -1) {
+ struct stat buffer;
+ cached_result = (stat("/dev/ion", &buffer) == 0);
+ if (cached_result)
+ ALOGD("Using ION\n");
+ else
+ ALOGD("Using DMABUF Heaps\n");
+ }
+ return (cached_result == 1);
+}
+
c2_status_t C2PlatformAllocatorStoreImpl::fetchAllocator(
id_t id, std::shared_ptr<C2Allocator> *const allocator) {
allocator->reset();
@@ -107,8 +123,11 @@
}
switch (id) {
// TODO: should we implement a generic registry for all, and use that?
- case C2PlatformAllocatorStore::ION:
- *allocator = fetchIonAllocator();
+ case C2PlatformAllocatorStore::ION: /* also ::DMABUFHEAP */
+ if (using_ion())
+ *allocator = fetchIonAllocator();
+ else
+ *allocator = fetchDmaBufAllocator();
break;
case C2PlatformAllocatorStore::GRALLOC:
@@ -142,7 +161,9 @@
namespace {
std::mutex gIonAllocatorMutex;
+std::mutex gDmaBufAllocatorMutex;
std::weak_ptr<C2AllocatorIon> gIonAllocator;
+std::weak_ptr<C2DmaBufAllocator> gDmaBufAllocator;
void UseComponentStoreForIonAllocator(
const std::shared_ptr<C2AllocatorIon> allocator,
@@ -197,6 +218,65 @@
allocator->setUsageMapper(mapper, minUsage, maxUsage, blockSize);
}
+void UseComponentStoreForDmaBufAllocator(const std::shared_ptr<C2DmaBufAllocator> allocator,
+ std::shared_ptr<C2ComponentStore> store) {
+ C2DmaBufAllocator::UsageMapperFn mapper;
+ const size_t maxHeapNameLen = 128;
+ uint64_t minUsage = 0;
+ uint64_t maxUsage = C2MemoryUsage(C2MemoryUsage::CPU_READ, C2MemoryUsage::CPU_WRITE).expected;
+ size_t blockSize = getpagesize();
+
+ // query min and max usage as well as block size via supported values
+ std::unique_ptr<C2StoreDmaBufUsageInfo> usageInfo;
+ usageInfo = C2StoreDmaBufUsageInfo::AllocUnique(maxHeapNameLen);
+
+ std::vector<C2FieldSupportedValuesQuery> query = {
+ C2FieldSupportedValuesQuery::Possible(C2ParamField::Make(*usageInfo, usageInfo->m.usage)),
+ C2FieldSupportedValuesQuery::Possible(
+ C2ParamField::Make(*usageInfo, usageInfo->m.capacity)),
+ };
+ c2_status_t res = store->querySupportedValues_sm(query);
+ if (res == C2_OK) {
+ if (query[0].status == C2_OK) {
+ const C2FieldSupportedValues& fsv = query[0].values;
+ if (fsv.type == C2FieldSupportedValues::FLAGS && !fsv.values.empty()) {
+ minUsage = fsv.values[0].u64;
+ maxUsage = 0;
+ for (C2Value::Primitive v : fsv.values) {
+ maxUsage |= v.u64;
+ }
+ }
+ }
+ if (query[1].status == C2_OK) {
+ const C2FieldSupportedValues& fsv = query[1].values;
+ if (fsv.type == C2FieldSupportedValues::RANGE && fsv.range.step.u32 > 0) {
+ blockSize = fsv.range.step.u32;
+ }
+ }
+
+ mapper = [store](C2MemoryUsage usage, size_t capacity, C2String* heapName,
+ unsigned* flags) -> c2_status_t {
+ if (capacity > UINT32_MAX) {
+ return C2_BAD_VALUE;
+ }
+
+ std::unique_ptr<C2StoreDmaBufUsageInfo> usageInfo;
+ usageInfo = C2StoreDmaBufUsageInfo::AllocUnique(maxHeapNameLen, usage.expected, capacity);
+ std::vector<std::unique_ptr<C2SettingResult>> failures; // TODO: remove
+
+ c2_status_t res = store->config_sm({&*usageInfo}, &failures);
+ if (res == C2_OK) {
+ *heapName = C2String(usageInfo->m.heapName);
+ *flags = usageInfo->m.allocFlags;
+ }
+
+ return res;
+ };
+ }
+
+ allocator->setUsageMapper(mapper, minUsage, maxUsage, blockSize);
+}
+
}
void C2PlatformAllocatorStoreImpl::setComponentStore(std::shared_ptr<C2ComponentStore> store) {
@@ -233,6 +313,22 @@
return allocator;
}
+std::shared_ptr<C2Allocator> C2PlatformAllocatorStoreImpl::fetchDmaBufAllocator() {
+ std::lock_guard<std::mutex> lock(gDmaBufAllocatorMutex);
+ std::shared_ptr<C2DmaBufAllocator> allocator = gDmaBufAllocator.lock();
+ if (allocator == nullptr) {
+ std::shared_ptr<C2ComponentStore> componentStore;
+ {
+ std::lock_guard<std::mutex> lock(_mComponentStoreReadLock);
+ componentStore = _mComponentStore;
+ }
+ allocator = std::make_shared<C2DmaBufAllocator>(C2PlatformAllocatorStore::DMABUFHEAP);
+ UseComponentStoreForDmaBufAllocator(allocator, componentStore);
+ gDmaBufAllocator = allocator;
+ }
+ return allocator;
+}
+
std::shared_ptr<C2Allocator> C2PlatformAllocatorStoreImpl::fetchBlobAllocator() {
static std::mutex mutex;
static std::weak_ptr<C2Allocator> blobAllocator;
@@ -347,7 +443,7 @@
allocatorId = GetPreferredLinearAllocatorId(GetCodec2PoolMask());
}
switch(allocatorId) {
- case C2PlatformAllocatorStore::ION:
+ case C2PlatformAllocatorStore::ION: /* also ::DMABUFHEAP */
res = allocatorStore->fetchAllocator(
C2PlatformAllocatorStore::ION, &allocator);
if (res == C2_OK) {
@@ -645,6 +741,7 @@
struct Interface : public C2InterfaceHelper {
std::shared_ptr<C2StoreIonUsageInfo> mIonUsageInfo;
+ std::shared_ptr<C2StoreDmaBufUsageInfo> mDmaBufUsageInfo;
Interface(std::shared_ptr<C2ReflectorHelper> reflector)
: C2InterfaceHelper(reflector) {
@@ -680,7 +777,13 @@
me.set().minAlignment = 0;
#endif
return C2R::Ok();
- }
+ };
+
+ static C2R setDmaBufUsage(bool /* mayBlock */, C2P<C2StoreDmaBufUsageInfo> &me) {
+ strncpy(me.set().m.heapName, "system", me.v.flexCount());
+ me.set().m.allocFlags = 0;
+ return C2R::Ok();
+ };
};
addParameter(
@@ -695,6 +798,18 @@
})
.withSetter(Setter::setIonUsage)
.build());
+
+ addParameter(
+ DefineParam(mDmaBufUsageInfo, "dmabuf-usage")
+ .withDefault(C2StoreDmaBufUsageInfo::AllocShared(0))
+ .withFields({
+ C2F(mDmaBufUsageInfo, m.usage).flags({C2MemoryUsage::CPU_READ | C2MemoryUsage::CPU_WRITE}),
+ C2F(mDmaBufUsageInfo, m.capacity).inRange(0, UINT32_MAX, 1024),
+ C2F(mDmaBufUsageInfo, m.allocFlags).flags({}),
+ C2F(mDmaBufUsageInfo, m.heapName).any(),
+ })
+ .withSetter(Setter::setDmaBufUsage)
+ .build());
}
};
diff --git a/media/codec2/vndk/include/C2AllocatorBlob.h b/media/codec2/vndk/include/C2AllocatorBlob.h
index 89ce949..fc67af7 100644
--- a/media/codec2/vndk/include/C2AllocatorBlob.h
+++ b/media/codec2/vndk/include/C2AllocatorBlob.h
@@ -44,7 +44,12 @@
virtual ~C2AllocatorBlob() override;
- static bool isValid(const C2Handle* const o);
+ virtual bool checkHandle(const C2Handle* const o) const override { return CheckHandle(o); }
+
+ static bool CheckHandle(const C2Handle* const o);
+
+ // deprecated
+ static bool isValid(const C2Handle* const o) { return CheckHandle(o); }
private:
std::shared_ptr<const Traits> mTraits;
diff --git a/media/codec2/vndk/include/C2AllocatorGralloc.h b/media/codec2/vndk/include/C2AllocatorGralloc.h
index ee7524e..578cf76 100644
--- a/media/codec2/vndk/include/C2AllocatorGralloc.h
+++ b/media/codec2/vndk/include/C2AllocatorGralloc.h
@@ -84,7 +84,12 @@
virtual ~C2AllocatorGralloc() override;
- static bool isValid(const C2Handle* const o);
+ virtual bool checkHandle(const C2Handle* const o) const override { return CheckHandle(o); }
+
+ static bool CheckHandle(const C2Handle* const o);
+
+ // deprecated
+ static bool isValid(const C2Handle* const o) { return CheckHandle(o); }
private:
class Impl;
diff --git a/media/codec2/vndk/include/C2AllocatorIon.h b/media/codec2/vndk/include/C2AllocatorIon.h
index 1b2051f..6a49b7d 100644
--- a/media/codec2/vndk/include/C2AllocatorIon.h
+++ b/media/codec2/vndk/include/C2AllocatorIon.h
@@ -57,7 +57,12 @@
virtual ~C2AllocatorIon() override;
- static bool isValid(const C2Handle* const o);
+ virtual bool checkHandle(const C2Handle* const o) const override { return CheckHandle(o); }
+
+ static bool CheckHandle(const C2Handle* const o);
+
+ // deprecated
+ static bool isValid(const C2Handle* const o) { return CheckHandle(o); }
/**
* Updates the usage mapper for subsequent new allocations, as well as the supported
diff --git a/media/codec2/vndk/include/C2DmaBufAllocator.h b/media/codec2/vndk/include/C2DmaBufAllocator.h
new file mode 100644
index 0000000..abb8307
--- /dev/null
+++ b/media/codec2/vndk/include/C2DmaBufAllocator.h
@@ -0,0 +1,112 @@
+/*
+ * 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 STAGEFRIGHT_CODEC2_ALLOCATOR_BUF_H_
+#define STAGEFRIGHT_CODEC2_ALLOCATOR_BUF_H_
+
+#include <BufferAllocator/BufferAllocator.h>
+#include <C2Buffer.h>
+#include <sys/stat.h> // stat
+
+#include <functional>
+#include <list>
+#include <mutex>
+#include <tuple>
+#include <unordered_map>
+
+namespace android {
+
+class C2DmaBufAllocator : public C2Allocator {
+ public:
+ virtual c2_status_t newLinearAllocation(
+ uint32_t capacity, C2MemoryUsage usage,
+ std::shared_ptr<C2LinearAllocation>* allocation) override;
+
+ virtual c2_status_t priorLinearAllocation(
+ const C2Handle* handle, std::shared_ptr<C2LinearAllocation>* allocation) override;
+
+ C2DmaBufAllocator(id_t id);
+
+ virtual c2_status_t status() const { return mInit; }
+
+ virtual bool checkHandle(const C2Handle* const o) const override { return CheckHandle(o); }
+
+ static bool CheckHandle(const C2Handle* const o);
+
+ virtual id_t getId() const override;
+
+ virtual C2String getName() const override;
+
+ virtual std::shared_ptr<const Traits> getTraits() const override;
+
+ // Usage mapper function used by the allocator
+ // (usage, capacity) => (heapName, flags)
+ //
+ // capacity is aligned to the default block-size (defaults to page size) to
+ // reduce caching overhead
+ typedef std::function<c2_status_t(C2MemoryUsage, size_t,
+ /* => */ C2String*, unsigned*)>
+ UsageMapperFn;
+
+ /**
+ * Updates the usage mapper for subsequent new allocations, as well as the
+ * supported minimum and maximum usage masks and default block-size to use
+ * for the mapper.
+ *
+ * \param mapper This method is called to map Codec 2.0 buffer usage
+ * to dmabuf heap name and flags required by the dma
+ * buf heap device
+ *
+ * \param minUsage Minimum buffer usage required for supported
+ * allocations (defaults to 0)
+ *
+ * \param maxUsage Maximum buffer usage supported by the ion allocator
+ * (defaults to SW_READ | SW_WRITE)
+ *
+ * \param blockSize Alignment used prior to calling |mapper| for the
+ * buffer capacity. This also helps reduce the size of
+ * cache required for caching mapper results.
+ * (defaults to the page size)
+ */
+ void setUsageMapper(const UsageMapperFn& mapper, uint64_t minUsage, uint64_t maxUsage,
+ uint64_t blockSize);
+
+ private:
+ c2_status_t mInit;
+ BufferAllocator mBufferAllocator;
+
+ c2_status_t mapUsage(C2MemoryUsage usage, size_t size,
+ /* => */ C2String* heap_name, unsigned* flags);
+
+ // this locks mTraits, mBlockSize, mUsageMapper, mUsageMapperLru and
+ // mUsageMapperCache
+ mutable std::mutex mUsageMapperLock;
+ std::shared_ptr<const Traits> mTraits;
+ size_t mBlockSize;
+ UsageMapperFn mUsageMapper;
+ typedef std::pair<uint64_t, size_t> MapperKey;
+ struct MapperKeyHash {
+ std::size_t operator()(const MapperKey&) const;
+ };
+ typedef std::tuple<C2String, unsigned, c2_status_t> MapperValue;
+ typedef std::pair<MapperKey, MapperValue> MapperKeyValue;
+ typedef std::list<MapperKeyValue>::iterator MapperKeyValuePointer;
+ std::list<MapperKeyValue> mUsageMapperLru;
+ std::unordered_map<MapperKey, MapperKeyValuePointer, MapperKeyHash> mUsageMapperCache;
+};
+} // namespace android
+
+#endif // STAGEFRIGHT_CODEC2_ALLOCATOR_BUF_H_
diff --git a/media/codec2/vndk/include/C2PlatformSupport.h b/media/codec2/vndk/include/C2PlatformSupport.h
index a14e0d3..4814494 100644
--- a/media/codec2/vndk/include/C2PlatformSupport.h
+++ b/media/codec2/vndk/include/C2PlatformSupport.h
@@ -47,6 +47,17 @@
*/
ION = PLATFORM_START,
+ /*
+ * ID of the DMA-Buf Heap (ion replacement) backed platform allocator.
+ *
+ * C2Handle consists of:
+ * fd shared dmabuf buffer handle
+ * int size (lo 32 bits)
+ * int size (hi 32 bits)
+ * int magic '\xc2io\x00'
+ */
+ DMABUFHEAP = ION,
+
/**
* ID of the gralloc backed platform allocator.
*
diff --git a/media/codec2/vndk/internal/C2HandleIonInternal.h b/media/codec2/vndk/internal/C2HandleIonInternal.h
index c0e1d83..c67698c 100644
--- a/media/codec2/vndk/internal/C2HandleIonInternal.h
+++ b/media/codec2/vndk/internal/C2HandleIonInternal.h
@@ -28,7 +28,10 @@
mFds{ bufferFd },
mInts{ int(size & 0xFFFFFFFF), int((uint64_t(size) >> 32) & 0xFFFFFFFF), kMagic } { }
- static bool isValid(const C2Handle * const o);
+ static bool IsValid(const C2Handle * const o);
+
+ // deprecated
+ static bool isValid(const C2Handle * const o) { return IsValid(o); }
int bufferFd() const { return mFds.mBuffer; }
size_t size() const {
diff --git a/media/codec2/vndk/platform/C2BqBuffer.cpp b/media/codec2/vndk/platform/C2BqBuffer.cpp
index 62936f6..fff12c4 100644
--- a/media/codec2/vndk/platform/C2BqBuffer.cpp
+++ b/media/codec2/vndk/platform/C2BqBuffer.cpp
@@ -223,7 +223,7 @@
static std::unique_ptr<C2AllocatorGralloc> sAllocator = std::make_unique<C2AllocatorGralloc>(0);
std::shared_ptr<C2GraphicAllocation> alloc;
- if (C2AllocatorGralloc::isValid(handle)) {
+ if (C2AllocatorGralloc::CheckHandle(handle)) {
uint32_t width;
uint32_t height;
uint32_t format;
diff --git a/media/extractors/mp4/MPEG4Extractor.cpp b/media/extractors/mp4/MPEG4Extractor.cpp
index 65ba382..409fca1 100644
--- a/media/extractors/mp4/MPEG4Extractor.cpp
+++ b/media/extractors/mp4/MPEG4Extractor.cpp
@@ -202,8 +202,8 @@
uint32_t duration;
int32_t compositionOffset;
uint8_t iv[16];
- Vector<size_t> clearsizes;
- Vector<size_t> encryptedsizes;
+ Vector<uint32_t> clearsizes;
+ Vector<uint32_t> encryptedsizes;
};
Vector<Sample> mCurrentSamples;
std::map<off64_t, uint32_t> mDrmOffsets;
@@ -6504,9 +6504,9 @@
if (smpl->encryptedsizes.size()) {
// store clear/encrypted lengths in metadata
AMediaFormat_setBuffer(bufmeta, AMEDIAFORMAT_KEY_CRYPTO_PLAIN_SIZES,
- smpl->clearsizes.array(), smpl->clearsizes.size() * 4);
+ smpl->clearsizes.array(), smpl->clearsizes.size() * sizeof(uint32_t));
AMediaFormat_setBuffer(bufmeta, AMEDIAFORMAT_KEY_CRYPTO_ENCRYPTED_SIZES,
- smpl->encryptedsizes.array(), smpl->encryptedsizes.size() * 4);
+ smpl->encryptedsizes.array(), smpl->encryptedsizes.size() * sizeof(uint32_t));
AMediaFormat_setInt32(bufmeta, AMEDIAFORMAT_KEY_CRYPTO_DEFAULT_IV_SIZE, mDefaultIVSize);
AMediaFormat_setInt32(bufmeta, AMEDIAFORMAT_KEY_CRYPTO_MODE, mCryptoMode);
AMediaFormat_setBuffer(bufmeta, AMEDIAFORMAT_KEY_CRYPTO_KEY, mCryptoKey, 16);
diff --git a/media/libaudiofoundation/DeviceDescriptorBase.cpp b/media/libaudiofoundation/DeviceDescriptorBase.cpp
index 3dbe37d..e9b589d 100644
--- a/media/libaudiofoundation/DeviceDescriptorBase.cpp
+++ b/media/libaudiofoundation/DeviceDescriptorBase.cpp
@@ -22,6 +22,9 @@
#include <media/DeviceDescriptorBase.h>
#include <media/TypeConverter.h>
+#include <arpa/inet.h>
+#include <regex>
+
namespace android {
DeviceDescriptorBase::DeviceDescriptorBase(audio_devices_t type) :
@@ -34,6 +37,31 @@
{
}
+namespace {
+
+static const std::string SUPPRESSED = "SUPPRESSED";
+static const std::regex MAC_ADDRESS_REGEX("([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}");
+
+bool isAddressSensitive(const std::string &address) {
+ if (std::regex_match(address, MAC_ADDRESS_REGEX)) {
+ return true;
+ }
+
+ sockaddr_storage ss4;
+ if (inet_pton(AF_INET, address.c_str(), &ss4) > 0) {
+ return true;
+ }
+
+ sockaddr_storage ss6;
+ if (inet_pton(AF_INET6, address.c_str(), &ss6) > 0) {
+ return true;
+ }
+
+ return false;
+}
+
+} // namespace
+
DeviceDescriptorBase::DeviceDescriptorBase(const AudioDeviceTypeAddr &deviceTypeAddr) :
AudioPort("", AUDIO_PORT_TYPE_DEVICE,
audio_is_output_device(deviceTypeAddr.mType) ? AUDIO_PORT_ROLE_SINK :
@@ -43,6 +71,12 @@
if (mDeviceTypeAddr.mAddress.empty() && audio_is_remote_submix_device(mDeviceTypeAddr.mType)) {
mDeviceTypeAddr.mAddress = "0";
}
+ mIsAddressSensitive = isAddressSensitive(mDeviceTypeAddr.mAddress);
+}
+
+void DeviceDescriptorBase::setAddress(const std::string &address) {
+ mDeviceTypeAddr.mAddress = address;
+ mIsAddressSensitive = isAddressSensitive(address);
}
void DeviceDescriptorBase::toAudioPortConfig(struct audio_port_config *dstConfig,
@@ -130,10 +164,15 @@
AudioPort::dump(dst, spaces, verbose);
}
-std::string DeviceDescriptorBase::toString() const
+std::string DeviceDescriptorBase::toString(bool includeSensitiveInfo) const
{
std::stringstream sstream;
- sstream << "type:0x" << std::hex << type() << ",@:" << mDeviceTypeAddr.mAddress;
+ sstream << "type:0x" << std::hex << type();
+ // IP and MAC address are sensitive information. The sensitive information will be suppressed
+ // is `includeSensitiveInfo` is false.
+ sstream << ",@:"
+ << (!includeSensitiveInfo && mIsAddressSensitive ? SUPPRESSED
+ : mDeviceTypeAddr.mAddress);
return sstream.str();
}
diff --git a/media/libaudiofoundation/include/media/DeviceDescriptorBase.h b/media/libaudiofoundation/include/media/DeviceDescriptorBase.h
index af04721..c143c7e 100644
--- a/media/libaudiofoundation/include/media/DeviceDescriptorBase.h
+++ b/media/libaudiofoundation/include/media/DeviceDescriptorBase.h
@@ -42,7 +42,7 @@
audio_devices_t type() const { return mDeviceTypeAddr.mType; }
std::string address() const { return mDeviceTypeAddr.mAddress; }
- void setAddress(const std::string &address) { mDeviceTypeAddr.mAddress = address; }
+ void setAddress(const std::string &address);
const AudioDeviceTypeAddr& getDeviceTypeAddr() const { return mDeviceTypeAddr; }
// AudioPortConfig
@@ -61,7 +61,14 @@
void dump(std::string *dst, int spaces, int index,
const char* extraInfo = nullptr, bool verbose = true) const;
void log() const;
- std::string toString() const;
+
+ /**
+ * Return a string to describe the DeviceDescriptor.
+ *
+ * @param includeSensitiveInfo sensitive information will be added when it is true.
+ * @return a string that can be used to describe the DeviceDescriptor.
+ */
+ std::string toString(bool includeSensitiveInfo = false) const;
bool equals(const sp<DeviceDescriptorBase>& other) const;
@@ -70,6 +77,7 @@
protected:
AudioDeviceTypeAddr mDeviceTypeAddr;
+ bool mIsAddressSensitive;
uint32_t mEncapsulationModes = 0;
uint32_t mEncapsulationMetadataTypes = 0;
};
diff --git a/media/libaudiohal/Android.bp b/media/libaudiohal/Android.bp
index 1709d1e..fab0fea 100644
--- a/media/libaudiohal/Android.bp
+++ b/media/libaudiohal/Android.bp
@@ -18,6 +18,7 @@
"libaudiohal@4.0",
"libaudiohal@5.0",
"libaudiohal@6.0",
+// "libaudiohal@7.0",
],
shared_libs: [
diff --git a/media/libaudiohal/FactoryHalHidl.cpp b/media/libaudiohal/FactoryHalHidl.cpp
index 5985ef0..7228b22 100644
--- a/media/libaudiohal/FactoryHalHidl.cpp
+++ b/media/libaudiohal/FactoryHalHidl.cpp
@@ -31,6 +31,7 @@
/** Supported HAL versions, in order of preference.
*/
const char* sAudioHALVersions[] = {
+ "7.0",
"6.0",
"5.0",
"4.0",
diff --git a/media/libaudiohal/impl/Android.bp b/media/libaudiohal/impl/Android.bp
index 967fba1..df006b5 100644
--- a/media/libaudiohal/impl/Android.bp
+++ b/media/libaudiohal/impl/Android.bp
@@ -116,3 +116,20 @@
]
}
+cc_library_shared {
+ enabled: false,
+ name: "libaudiohal@7.0",
+ defaults: ["libaudiohal_default"],
+ shared_libs: [
+ "android.hardware.audio.common@7.0",
+ "android.hardware.audio.common@7.0-util",
+ "android.hardware.audio.effect@7.0",
+ "android.hardware.audio@7.0",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=7",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
+
diff --git a/media/libaudioprocessing/AudioMixerOps.h b/media/libaudioprocessing/AudioMixerOps.h
index 80bd093..8d374c9 100644
--- a/media/libaudioprocessing/AudioMixerOps.h
+++ b/media/libaudioprocessing/AudioMixerOps.h
@@ -234,17 +234,20 @@
static_assert(NCHAN > 0 && NCHAN <= 8);
static_assert(MIXTYPE == MIXTYPE_MULTI_STEREOVOL
|| MIXTYPE == MIXTYPE_MULTI_SAVEONLY_STEREOVOL
- || MIXTYPE == MIXTYPE_STEREOEXPAND);
+ || MIXTYPE == MIXTYPE_STEREOEXPAND
+ || MIXTYPE == MIXTYPE_MONOEXPAND);
auto proc = [](auto& a, const auto& b) {
if constexpr (MIXTYPE == MIXTYPE_MULTI_STEREOVOL
- || MIXTYPE == MIXTYPE_STEREOEXPAND) {
+ || MIXTYPE == MIXTYPE_STEREOEXPAND
+ || MIXTYPE == MIXTYPE_MONOEXPAND) {
a += b;
} else {
a = b;
}
};
auto inp = [&in]() -> const TI& {
- if constexpr (MIXTYPE == MIXTYPE_STEREOEXPAND) {
+ if constexpr (MIXTYPE == MIXTYPE_STEREOEXPAND
+ || MIXTYPE == MIXTYPE_MONOEXPAND) {
return *in;
} else {
return *in++;
@@ -312,6 +315,8 @@
* TV/TAV: int32_t (U4.28) or int16_t (U4.12) or float
* Input channel count is 1.
* vol: represents volume array.
+ * This uses stereo balanced volume vol[0] and vol[1].
+ * Before R, this was a full volume array but was called only for channels <= 2.
*
* This accumulates into the out pointer.
*
@@ -356,17 +361,13 @@
do {
TA auxaccum = 0;
if constexpr (MIXTYPE == MIXTYPE_MULTI) {
+ static_assert(NCHAN <= 2);
for (int i = 0; i < NCHAN; ++i) {
*out++ += MixMulAux<TO, TI, TV, TA>(*in++, vol[i], &auxaccum);
vol[i] += volinc[i];
}
- } else if constexpr (MIXTYPE == MIXTYPE_MONOEXPAND) {
- for (int i = 0; i < NCHAN; ++i) {
- *out++ += MixMulAux<TO, TI, TV, TA>(*in, vol[i], &auxaccum);
- vol[i] += volinc[i];
- }
- in++;
} else if constexpr (MIXTYPE == MIXTYPE_MULTI_SAVEONLY) {
+ static_assert(NCHAN <= 2);
for (int i = 0; i < NCHAN; ++i) {
*out++ = MixMulAux<TO, TI, TV, TA>(*in++, vol[i], &auxaccum);
vol[i] += volinc[i];
@@ -383,11 +384,13 @@
vol[0] += volinc[0];
} else if constexpr (MIXTYPE == MIXTYPE_MULTI_STEREOVOL
|| MIXTYPE == MIXTYPE_MULTI_SAVEONLY_STEREOVOL
+ || MIXTYPE == MIXTYPE_MONOEXPAND
|| MIXTYPE == MIXTYPE_STEREOEXPAND) {
stereoVolumeHelper<MIXTYPE, NCHAN>(
out, in, vol, [&auxaccum] (auto &a, const auto &b) {
return MixMulAux<TO, TI, TV, TA>(a, b, &auxaccum);
});
+ if constexpr (MIXTYPE == MIXTYPE_MONOEXPAND) in += 1;
if constexpr (MIXTYPE == MIXTYPE_STEREOEXPAND) in += 2;
vol[0] += volinc[0];
vol[1] += volinc[1];
@@ -401,17 +404,13 @@
} else {
do {
if constexpr (MIXTYPE == MIXTYPE_MULTI) {
+ static_assert(NCHAN <= 2);
for (int i = 0; i < NCHAN; ++i) {
*out++ += MixMul<TO, TI, TV>(*in++, vol[i]);
vol[i] += volinc[i];
}
- } else if constexpr (MIXTYPE == MIXTYPE_MONOEXPAND) {
- for (int i = 0; i < NCHAN; ++i) {
- *out++ += MixMul<TO, TI, TV>(*in, vol[i]);
- vol[i] += volinc[i];
- }
- in++;
} else if constexpr (MIXTYPE == MIXTYPE_MULTI_SAVEONLY) {
+ static_assert(NCHAN <= 2);
for (int i = 0; i < NCHAN; ++i) {
*out++ = MixMul<TO, TI, TV>(*in++, vol[i]);
vol[i] += volinc[i];
@@ -428,10 +427,12 @@
vol[0] += volinc[0];
} else if constexpr (MIXTYPE == MIXTYPE_MULTI_STEREOVOL
|| MIXTYPE == MIXTYPE_MULTI_SAVEONLY_STEREOVOL
+ || MIXTYPE == MIXTYPE_MONOEXPAND
|| MIXTYPE == MIXTYPE_STEREOEXPAND) {
stereoVolumeHelper<MIXTYPE, NCHAN>(out, in, vol, [] (auto &a, const auto &b) {
return MixMul<TO, TI, TV>(a, b);
});
+ if constexpr (MIXTYPE == MIXTYPE_MONOEXPAND) in += 1;
if constexpr (MIXTYPE == MIXTYPE_STEREOEXPAND) in += 2;
vol[0] += volinc[0];
vol[1] += volinc[1];
@@ -454,15 +455,12 @@
do {
TA auxaccum = 0;
if constexpr (MIXTYPE == MIXTYPE_MULTI) {
+ static_assert(NCHAN <= 2);
for (int i = 0; i < NCHAN; ++i) {
*out++ += MixMulAux<TO, TI, TV, TA>(*in++, vol[i], &auxaccum);
}
- } else if constexpr (MIXTYPE == MIXTYPE_MONOEXPAND) {
- for (int i = 0; i < NCHAN; ++i) {
- *out++ += MixMulAux<TO, TI, TV, TA>(*in, vol[i], &auxaccum);
- }
- in++;
} else if constexpr (MIXTYPE == MIXTYPE_MULTI_SAVEONLY) {
+ static_assert(NCHAN <= 2);
for (int i = 0; i < NCHAN; ++i) {
*out++ = MixMulAux<TO, TI, TV, TA>(*in++, vol[i], &auxaccum);
}
@@ -476,11 +474,13 @@
}
} else if constexpr (MIXTYPE == MIXTYPE_MULTI_STEREOVOL
|| MIXTYPE == MIXTYPE_MULTI_SAVEONLY_STEREOVOL
+ || MIXTYPE == MIXTYPE_MONOEXPAND
|| MIXTYPE == MIXTYPE_STEREOEXPAND) {
stereoVolumeHelper<MIXTYPE, NCHAN>(
out, in, vol, [&auxaccum] (auto &a, const auto &b) {
return MixMulAux<TO, TI, TV, TA>(a, b, &auxaccum);
});
+ if constexpr (MIXTYPE == MIXTYPE_MONOEXPAND) in += 1;
if constexpr (MIXTYPE == MIXTYPE_STEREOEXPAND) in += 2;
} else /* constexpr */ {
static_assert(dependent_false<MIXTYPE>, "invalid mixtype");
@@ -490,16 +490,14 @@
} while (--frameCount);
} else {
do {
+ // ALOGD("Mixtype:%d NCHAN:%d", MIXTYPE, NCHAN);
if constexpr (MIXTYPE == MIXTYPE_MULTI) {
+ static_assert(NCHAN <= 2);
for (int i = 0; i < NCHAN; ++i) {
*out++ += MixMul<TO, TI, TV>(*in++, vol[i]);
}
- } else if constexpr (MIXTYPE == MIXTYPE_MONOEXPAND) {
- for (int i = 0; i < NCHAN; ++i) {
- *out++ += MixMul<TO, TI, TV>(*in, vol[i]);
- }
- in++;
} else if constexpr (MIXTYPE == MIXTYPE_MULTI_SAVEONLY) {
+ static_assert(NCHAN <= 2);
for (int i = 0; i < NCHAN; ++i) {
*out++ = MixMul<TO, TI, TV>(*in++, vol[i]);
}
@@ -513,10 +511,12 @@
}
} else if constexpr (MIXTYPE == MIXTYPE_MULTI_STEREOVOL
|| MIXTYPE == MIXTYPE_MULTI_SAVEONLY_STEREOVOL
+ || MIXTYPE == MIXTYPE_MONOEXPAND
|| MIXTYPE == MIXTYPE_STEREOEXPAND) {
stereoVolumeHelper<MIXTYPE, NCHAN>(out, in, vol, [] (auto &a, const auto &b) {
return MixMul<TO, TI, TV>(a, b);
});
+ if constexpr (MIXTYPE == MIXTYPE_MONOEXPAND) in += 1;
if constexpr (MIXTYPE == MIXTYPE_STEREOEXPAND) in += 2;
} else /* constexpr */ {
static_assert(dependent_false<MIXTYPE>, "invalid mixtype");
diff --git a/media/libaudioprocessing/tests/fuzzer/Android.bp b/media/libaudioprocessing/tests/fuzzer/Android.bp
index 1df47b7..2a0dec4 100644
--- a/media/libaudioprocessing/tests/fuzzer/Android.bp
+++ b/media/libaudioprocessing/tests/fuzzer/Android.bp
@@ -8,3 +8,14 @@
"libsndfile",
],
}
+
+cc_fuzz {
+ name: "libaudioprocessing_record_buffer_converter_fuzzer",
+ srcs: [
+ "libaudioprocessing_record_buffer_converter_fuzzer.cpp",
+ ],
+ defaults: ["libaudioprocessing_test_defaults"],
+ static_libs: [
+ "libsndfile",
+ ],
+}
diff --git a/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_fuzz_utils.h b/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_fuzz_utils.h
new file mode 100644
index 0000000..5165925
--- /dev/null
+++ b/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_fuzz_utils.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_LIBAUDIOPROCESSING_FUZZ_UTILS_H
+#define ANDROID_LIBAUDIOPROCESSING_FUZZ_UTILS_H
+
+#include <media/AudioBufferProvider.h>
+#include <system/audio.h>
+
+namespace android {
+
+class Provider : public AudioBufferProvider {
+ const void* mAddr; // base address
+ const size_t mNumFrames; // total frames
+ const size_t mFrameSize; // size of each frame in bytes
+ size_t mNextFrame; // index of next frame to provide
+ size_t mUnrel; // number of frames not yet released
+ public:
+ Provider(const void* addr, size_t frames, size_t frameSize)
+ : mAddr(addr),
+ mNumFrames(frames),
+ mFrameSize(frameSize),
+ mNextFrame(0),
+ mUnrel(0) {}
+ status_t getNextBuffer(Buffer* buffer) override {
+ if (buffer->frameCount > mNumFrames - mNextFrame) {
+ buffer->frameCount = mNumFrames - mNextFrame;
+ }
+ mUnrel = buffer->frameCount;
+ if (buffer->frameCount > 0) {
+ buffer->raw = (char*)mAddr + mFrameSize * mNextFrame;
+ return NO_ERROR;
+ } else {
+ buffer->raw = nullptr;
+ return NOT_ENOUGH_DATA;
+ }
+ }
+ void releaseBuffer(Buffer* buffer) override {
+ if (buffer->frameCount > mUnrel) {
+ mNextFrame += mUnrel;
+ mUnrel = 0;
+ } else {
+ mNextFrame += buffer->frameCount;
+ mUnrel -= buffer->frameCount;
+ }
+ buffer->frameCount = 0;
+ buffer->raw = nullptr;
+ }
+ void reset() { mNextFrame = 0; }
+};
+
+} // namespace android
+
+#endif // ANDROID_LIBAUDIOPROCESSING_FUZZ_UTILS_H
diff --git a/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_record_buffer_converter_fuzzer.cpp b/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_record_buffer_converter_fuzzer.cpp
new file mode 100644
index 0000000..017598c
--- /dev/null
+++ b/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_record_buffer_converter_fuzzer.cpp
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ */
+
+#include "libaudioprocessing_fuzz_utils.h"
+#include "fuzzer/FuzzedDataProvider.h"
+#include <media/AudioResampler.h>
+#include <media/RecordBufferConverter.h>
+#include <stddef.h>
+#include <stdint.h>
+
+using namespace android;
+
+constexpr int MAX_FRAMES = 1024;
+
+#define AUDIO_FORMAT_PCM_MAIN 0
+
+// Copied and simplified from audio-hal-enums.h?l=571
+constexpr uint32_t FUZZ_AUDIO_FORMATS[] = {
+ AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_16_BIT,
+ AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_8_BIT,
+ AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_32_BIT,
+ AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_8_24_BIT,
+ AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_FLOAT,
+ AUDIO_FORMAT_PCM_MAIN | AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED,
+ 0x01000000u,
+ 0x02000000u,
+ 0x03000000u,
+ 0x04000000u,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_MAIN,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_LC,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_SSR,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_LTP,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_HE_V1,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_SCALABLE,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_ERLC,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_LD,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_HE_V2,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_ELD,
+ AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_SUB_XHE,
+ 0x05000000u,
+ 0x06000000u,
+ 0x07000000u,
+ 0x08000000u,
+ 0x09000000u,
+ 0x0A000000u,
+ AUDIO_FORMAT_E_AC3 | AUDIO_FORMAT_E_AC3_SUB_JOC,
+ 0x0B000000u,
+ 0x0C000000u,
+ 0x0D000000u,
+ 0x0E000000u,
+ 0x10000000u,
+ 0x11000000u,
+ 0x12000000u,
+ 0x13000000u,
+ 0x14000000u,
+ 0x15000000u,
+ 0x16000000u,
+ 0x17000000u,
+ 0x18000000u,
+ 0x19000000u,
+ 0x1A000000u,
+ 0x1B000000u,
+ 0x1C000000u,
+ 0x1D000000u,
+ 0x1E000000u,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_MAIN,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_LC,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_SSR,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_LTP,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_HE_V1,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_SCALABLE,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_ERLC,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_LD,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_HE_V2,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_ELD,
+ AUDIO_FORMAT_AAC_ADTS | AUDIO_FORMAT_AAC_SUB_XHE,
+ 0x1F000000u,
+ 0x20000000u,
+ 0x21000000u,
+ 0x22000000u,
+ 0x23000000u,
+ 0x24000000u,
+ AUDIO_FORMAT_MAT | AUDIO_FORMAT_MAT_SUB_1_0,
+ AUDIO_FORMAT_MAT | AUDIO_FORMAT_MAT_SUB_2_0,
+ AUDIO_FORMAT_MAT | AUDIO_FORMAT_MAT_SUB_2_1,
+ 0x25000000u,
+ AUDIO_FORMAT_AAC_LATM | AUDIO_FORMAT_AAC_SUB_LC,
+ AUDIO_FORMAT_AAC_LATM | AUDIO_FORMAT_AAC_SUB_HE_V1,
+ AUDIO_FORMAT_AAC_LATM | AUDIO_FORMAT_AAC_SUB_HE_V2,
+ 0x26000000u,
+ 0x27000000u,
+ 0x28000000u,
+ 0x29000000u,
+ 0x2A000000u,
+ 0x2B000000u,
+ 0xFFFFFFFFu,
+ AUDIO_FORMAT_PCM_MAIN,
+ AUDIO_FORMAT_PCM,
+};
+constexpr size_t NUM_AUDIO_FORMATS = std::size(FUZZ_AUDIO_FORMATS);
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ FuzzedDataProvider fdp(data, size);
+ fdp.ConsumeIntegral<int>();
+
+ const audio_channel_mask_t srcChannelMask = (audio_channel_mask_t)fdp.ConsumeIntegral<int>();
+ const audio_format_t srcFormat =
+ (audio_format_t)FUZZ_AUDIO_FORMATS[fdp.ConsumeIntegralInRange<int>(0, NUM_AUDIO_FORMATS - 1)];
+ const uint32_t srcSampleRate = fdp.ConsumeIntegralInRange<int>(1, 0x7fffffff);
+ const audio_channel_mask_t dstChannelMask = (audio_channel_mask_t)fdp.ConsumeIntegral<int>();
+ const audio_format_t dstFormat =
+ (audio_format_t)FUZZ_AUDIO_FORMATS[fdp.ConsumeIntegralInRange<int>(0, NUM_AUDIO_FORMATS - 1)];
+ const uint32_t dstSampleRate = fdp.ConsumeIntegralInRange<int>(1, 0x7fffffff);
+
+ // Certain formats will result in LOG_ALWAYS_FATAL errors that aren't interesting crashes
+ // for fuzzing. Don't use those ones.
+ const uint32_t dstChannelCount = audio_channel_count_from_in_mask(dstChannelMask);
+ constexpr android::AudioResampler::src_quality quality =
+ android::AudioResampler::DEFAULT_QUALITY;
+ const int maxChannels =
+ quality < android::AudioResampler::DYN_LOW_QUALITY ? 2 : 8;
+ if (dstChannelCount < 1 || dstChannelCount > maxChannels) {
+ return 0;
+ }
+
+ const uint32_t srcChannelCount = audio_channel_count_from_in_mask(srcChannelMask);
+ if (srcChannelCount < 1 || srcChannelCount > maxChannels) {
+ return 0;
+ }
+
+ RecordBufferConverter converter(srcChannelMask, srcFormat, srcSampleRate,
+ dstChannelMask, dstFormat, dstSampleRate);
+ if (converter.initCheck() != NO_ERROR) {
+ return 0;
+ }
+
+ const uint32_t srcFrameSize = srcChannelCount * audio_bytes_per_sample(srcFormat);
+ const int srcNumFrames = fdp.ConsumeIntegralInRange<int>(0, MAX_FRAMES);
+ constexpr size_t metadataSize = 2 + 3 * sizeof(int) + 2 * sizeof(float);
+ std::vector<uint8_t> inputData = fdp.ConsumeBytes<uint8_t>(
+ metadataSize + (srcFrameSize * srcNumFrames));
+ Provider provider(inputData.data(), srcNumFrames, srcFrameSize);
+
+ const uint32_t dstFrameSize = dstChannelCount * audio_bytes_per_sample(dstFormat);
+ const size_t frames = fdp.ConsumeIntegralInRange<size_t>(0, MAX_FRAMES + 1);
+ int8_t dst[dstFrameSize * frames];
+ memset(dst, 0, sizeof(int8_t) * dstFrameSize * frames);
+
+ // Add a small number of loops to see if repeated calls to convert cause
+ // any change in behavior.
+ const int numLoops = fdp.ConsumeIntegralInRange<int>(1, 3);
+ for (int loop = 0; loop < numLoops; ++loop) {
+ switch (fdp.ConsumeIntegralInRange<int>(0, 1)) {
+ case 0:
+ converter.reset();
+ FALLTHROUGH_INTENDED;
+ case 1:
+ converter.convert(dst, &provider, frames);
+ break;
+ }
+ }
+
+ return 0;
+}
diff --git a/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_resampler_fuzzer.cpp b/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_resampler_fuzzer.cpp
index 938c610..65c9a3c 100644
--- a/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_resampler_fuzzer.cpp
+++ b/media/libaudioprocessing/tests/fuzzer/libaudioprocessing_resampler_fuzzer.cpp
@@ -34,6 +34,8 @@
#include <unistd.h>
#include <utils/Vector.h>
+#include "libaudioprocessing_fuzz_utils.h"
+
#include <memory>
using namespace android;
@@ -53,46 +55,6 @@
AudioResampler::DYN_HIGH_QUALITY,
};
-class Provider : public AudioBufferProvider {
- const void* mAddr; // base address
- const size_t mNumFrames; // total frames
- const size_t mFrameSize; // size of each frame in bytes
- size_t mNextFrame; // index of next frame to provide
- size_t mUnrel; // number of frames not yet released
- public:
- Provider(const void* addr, size_t frames, size_t frameSize)
- : mAddr(addr),
- mNumFrames(frames),
- mFrameSize(frameSize),
- mNextFrame(0),
- mUnrel(0) {}
- status_t getNextBuffer(Buffer* buffer) override {
- if (buffer->frameCount > mNumFrames - mNextFrame) {
- buffer->frameCount = mNumFrames - mNextFrame;
- }
- mUnrel = buffer->frameCount;
- if (buffer->frameCount > 0) {
- buffer->raw = (char*)mAddr + mFrameSize * mNextFrame;
- return NO_ERROR;
- } else {
- buffer->raw = nullptr;
- return NOT_ENOUGH_DATA;
- }
- }
- virtual void releaseBuffer(Buffer* buffer) {
- if (buffer->frameCount > mUnrel) {
- mNextFrame += mUnrel;
- mUnrel = 0;
- } else {
- mNextFrame += buffer->frameCount;
- mUnrel -= buffer->frameCount;
- }
- buffer->frameCount = 0;
- buffer->raw = nullptr;
- }
- void reset() { mNextFrame = 0; }
-};
-
audio_format_t chooseFormat(AudioResampler::src_quality quality,
uint8_t input_byte) {
switch (quality) {
diff --git a/media/libaudioprocessing/tests/mixerops_benchmark.cpp b/media/libaudioprocessing/tests/mixerops_benchmark.cpp
index 86f5429..7a4c5c7 100644
--- a/media/libaudioprocessing/tests/mixerops_benchmark.cpp
+++ b/media/libaudioprocessing/tests/mixerops_benchmark.cpp
@@ -74,28 +74,32 @@
}
}
-BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI, 2);
-BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY, 2);
+// MULTI mode and MULTI_SAVEONLY mode are not used by AudioMixer for channels > 2,
+// which is ensured by a static_assert (won't compile for those configurations).
+// So we benchmark MIXTYPE_MULTI_MONOVOL and MIXTYPE_MULTI_SAVEONLY_MONOVOL compared
+// with MIXTYPE_MULTI_STEREOVOL and MIXTYPE_MULTI_SAVEONLY_STEREOVOL.
+BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_MONOVOL, 2);
+BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY_MONOVOL, 2);
BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_STEREOVOL, 2);
BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY_STEREOVOL, 2);
-BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI, 4);
-BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY, 4);
+BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_MONOVOL, 4);
+BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY_MONOVOL, 4);
BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_STEREOVOL, 4);
BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY_STEREOVOL, 4);
-BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI, 5);
-BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY, 5);
+BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_MONOVOL, 5);
+BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY_MONOVOL, 5);
BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_STEREOVOL, 5);
BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY_STEREOVOL, 5);
-BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI, 8);
-BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY, 8);
+BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_MONOVOL, 8);
+BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY_MONOVOL, 8);
BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_STEREOVOL, 8);
BENCHMARK_TEMPLATE(BM_VolumeRampMulti, MIXTYPE_MULTI_SAVEONLY_STEREOVOL, 8);
-BENCHMARK_TEMPLATE(BM_VolumeMulti, MIXTYPE_MULTI, 8);
-BENCHMARK_TEMPLATE(BM_VolumeMulti, MIXTYPE_MULTI_SAVEONLY, 8);
+BENCHMARK_TEMPLATE(BM_VolumeMulti, MIXTYPE_MULTI_MONOVOL, 8);
+BENCHMARK_TEMPLATE(BM_VolumeMulti, MIXTYPE_MULTI_SAVEONLY_MONOVOL, 8);
BENCHMARK_TEMPLATE(BM_VolumeMulti, MIXTYPE_MULTI_STEREOVOL, 8);
BENCHMARK_TEMPLATE(BM_VolumeMulti, MIXTYPE_MULTI_SAVEONLY_STEREOVOL, 8);
diff --git a/media/libeffects/lvm/.clang-format b/media/libeffects/lvm/.clang-format
new file mode 100644
index 0000000..6f4b13e
--- /dev/null
+++ b/media/libeffects/lvm/.clang-format
@@ -0,0 +1,15 @@
+BasedOnStyle: Google
+Standard: Cpp11
+AccessModifierOffset: -2
+AllowShortFunctionsOnASingleLine: Inline
+ColumnLimit: 100
+CommentPragmas: NOLINT:.*
+DerivePointerAlignment: false
+IncludeBlocks: Preserve
+IndentWidth: 4
+ContinuationIndentWidth: 8
+PointerAlignment: Left
+TabWidth: 4
+UseTab: Never
+# Following are specific to libeffects/lvm
+SortIncludes: false
diff --git a/media/libeffects/lvm/benchmarks/Android.bp b/media/libeffects/lvm/benchmarks/Android.bp
new file mode 100644
index 0000000..420e172
--- /dev/null
+++ b/media/libeffects/lvm/benchmarks/Android.bp
@@ -0,0 +1,16 @@
+cc_benchmark {
+ name: "lvm_benchmark",
+ vendor: true,
+ srcs: ["lvm_benchmark.cpp"],
+ static_libs: [
+ "libbundlewrapper",
+ "libmusicbundle",
+ ],
+ shared_libs: [
+ "libaudioutils",
+ "liblog",
+ ],
+ header_libs: [
+ "libhardware_headers",
+ ],
+}
diff --git a/media/libeffects/lvm/benchmarks/lvm_benchmark.cpp b/media/libeffects/lvm/benchmarks/lvm_benchmark.cpp
new file mode 100644
index 0000000..ee9da3f
--- /dev/null
+++ b/media/libeffects/lvm/benchmarks/lvm_benchmark.cpp
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ */
+
+#include <array>
+#include <climits>
+#include <cstdlib>
+#include <random>
+#include <vector>
+#include <log/log.h>
+#include <benchmark/benchmark.h>
+#include <hardware/audio_effect.h>
+#include <system/audio.h>
+
+extern audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM;
+constexpr effect_uuid_t kEffectUuids[] = {
+ // NXP SW BassBoost
+ {0x8631f300, 0x72e2, 0x11df, 0xb57e, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
+ // NXP SW Virtualizer
+ {0x1d4033c0, 0x8557, 0x11df, 0x9f2d, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
+ // NXP SW Equalizer
+ {0xce772f20, 0x847d, 0x11df, 0xbb17, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
+ // NXP SW Volume
+ {0x119341a0, 0x8469, 0x11df, 0x81f9, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
+};
+
+constexpr size_t kNumEffectUuids = std::size(kEffectUuids);
+
+constexpr size_t kFrameCount = 2048;
+
+constexpr audio_channel_mask_t kChMasks[] = {
+ AUDIO_CHANNEL_OUT_MONO, AUDIO_CHANNEL_OUT_STEREO, AUDIO_CHANNEL_OUT_2POINT1,
+ AUDIO_CHANNEL_OUT_QUAD, AUDIO_CHANNEL_OUT_PENTA, AUDIO_CHANNEL_OUT_5POINT1,
+ AUDIO_CHANNEL_OUT_6POINT1, AUDIO_CHANNEL_OUT_7POINT1,
+};
+
+constexpr size_t kNumChMasks = std::size(kChMasks);
+constexpr int kSampleRate = 44100;
+// TODO(b/131240940) Remove once effects are updated to produce mono output
+constexpr size_t kMinOutputChannelCount = 2;
+
+/*******************************************************************
+ * A test result running on Pixel 3 for comparison.
+ * The first parameter indicates the number of channels.
+ * The second parameter indicates the effect.
+ * 0: Bass Boost, 1: Virtualizer, 2: Equalizer, 3: Volume
+ * -----------------------------------------------------
+ * Benchmark Time CPU Iterations
+ * -----------------------------------------------------
+ * BM_LVM/2/0 131279 ns 130855 ns 5195
+ * BM_LVM/2/1 184814 ns 184219 ns 3799
+ * BM_LVM/2/2 91935 ns 91649 ns 7647
+ * BM_LVM/2/3 26707 ns 26623 ns 26281
+ * BM_LVM/3/0 172130 ns 171562 ns 4085
+ * BM_LVM/3/1 192443 ns 191923 ns 3644
+ * BM_LVM/3/2 127444 ns 127107 ns 5483
+ * BM_LVM/3/3 26811 ns 26730 ns 26163
+ * BM_LVM/4/0 223688 ns 223076 ns 3133
+ * BM_LVM/4/1 204961 ns 204408 ns 3425
+ * BM_LVM/4/2 169162 ns 168708 ns 4143
+ * BM_LVM/4/3 37330 ns 37225 ns 18795
+ * BM_LVM/5/0 272628 ns 271668 ns 2568
+ * BM_LVM/5/1 218487 ns 217883 ns 3212
+ * BM_LVM/5/2 211049 ns 210479 ns 3324
+ * BM_LVM/5/3 46962 ns 46835 ns 15051
+ * BM_LVM/6/0 318881 ns 317734 ns 2216
+ * BM_LVM/6/1 231899 ns 231244 ns 3028
+ * BM_LVM/6/2 252655 ns 251963 ns 2771
+ * BM_LVM/6/3 54944 ns 54794 ns 12799
+ * BM_LVM/7/0 366622 ns 365262 ns 1916
+ * BM_LVM/7/1 245076 ns 244388 ns 2866
+ * BM_LVM/7/2 295105 ns 294304 ns 2379
+ * BM_LVM/7/3 63595 ns 63420 ns 11070
+ * BM_LVM/8/0 410957 ns 409387 ns 1706
+ * BM_LVM/8/1 257824 ns 257098 ns 2723
+ * BM_LVM/8/2 342546 ns 341530 ns 2059
+ * BM_LVM/8/3 72896 ns 72700 ns 9685
+ *******************************************************************/
+
+static void BM_LVM(benchmark::State& state) {
+ const size_t chMask = kChMasks[state.range(0) - 1];
+ const effect_uuid_t uuid = kEffectUuids[state.range(1)];
+ const size_t channelCount = audio_channel_count_from_out_mask(chMask);
+
+ // Initialize input buffer with deterministic pseudo-random values
+ std::minstd_rand gen(chMask);
+ std::uniform_real_distribution<> dis(-1.0f, 1.0f);
+ std::vector<float> input(kFrameCount * channelCount);
+ for (auto& in : input) {
+ in = dis(gen);
+ }
+
+ effect_handle_t effectHandle = nullptr;
+ if (int status = AUDIO_EFFECT_LIBRARY_INFO_SYM.create_effect(&uuid, 1, 1, &effectHandle);
+ status != 0) {
+ ALOGE("create_effect returned an error = %d\n", status);
+ return;
+ }
+
+ effect_config_t config{};
+ config.inputCfg.samplingRate = config.outputCfg.samplingRate = kSampleRate;
+ config.inputCfg.channels = config.outputCfg.channels = chMask;
+ config.inputCfg.format = config.outputCfg.format = AUDIO_FORMAT_PCM_FLOAT;
+
+ int reply = 0;
+ uint32_t replySize = sizeof(reply);
+ if (int status = (*effectHandle)
+ ->command(effectHandle, EFFECT_CMD_SET_CONFIG, sizeof(effect_config_t),
+ &config, &replySize, &reply);
+ status != 0) {
+ ALOGE("command returned an error = %d\n", status);
+ return;
+ }
+
+ if (int status =
+ (*effectHandle)
+ ->command(effectHandle, EFFECT_CMD_ENABLE, 0, nullptr, &replySize, &reply);
+ status != 0) {
+ ALOGE("Command enable call returned error %d\n", reply);
+ return;
+ }
+
+ // Run the test
+ for (auto _ : state) {
+ std::vector<float> output(kFrameCount * std::max(channelCount, kMinOutputChannelCount));
+
+ benchmark::DoNotOptimize(input.data());
+ benchmark::DoNotOptimize(output.data());
+
+ audio_buffer_t inBuffer = {.frameCount = kFrameCount, .f32 = input.data()};
+ audio_buffer_t outBuffer = {.frameCount = kFrameCount, .f32 = output.data()};
+ (*effectHandle)->process(effectHandle, &inBuffer, &outBuffer);
+
+ benchmark::ClobberMemory();
+ }
+
+ state.SetComplexityN(state.range(0));
+
+ if (int status = AUDIO_EFFECT_LIBRARY_INFO_SYM.release_effect(effectHandle); status != 0) {
+ ALOGE("release_effect returned an error = %d\n", status);
+ return;
+ }
+}
+
+static void LVMArgs(benchmark::internal::Benchmark* b) {
+ // TODO(b/131240940) Test single channel once effects are updated to process mono data
+ for (int i = 2; i <= kNumChMasks; i++) {
+ for (int j = 0; j < kNumEffectUuids; ++j) {
+ b->Args({i, j});
+ }
+ }
+}
+
+BENCHMARK(BM_LVM)->Apply(LVMArgs);
+
+BENCHMARK_MAIN();
diff --git a/media/libeffects/lvm/lib/Android.bp b/media/libeffects/lvm/lib/Android.bp
index ee69cfb..8f2f016 100644
--- a/media/libeffects/lvm/lib/Android.bp
+++ b/media/libeffects/lvm/lib/Android.bp
@@ -132,7 +132,7 @@
"liblog",
],
header_libs: [
- "libhardware_headers"
+ "libhardware_headers",
],
cppflags: [
"-fvisibility=hidden",
diff --git a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
index cb69c88..e60ad07 100644
--- a/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
+++ b/media/libeffects/lvm/lib/Bass/lib/LVDBE.h
@@ -70,11 +70,11 @@
/****************************************************************************************/
/* Bass Enhancement effect level */
-#define LVDBE_EFFECT_03DB 3 /* Effect defines for backwards compatibility */
-#define LVDBE_EFFECT_06DB 6
-#define LVDBE_EFFECT_09DB 9
-#define LVDBE_EFFECT_12DB 12
-#define LVDBE_EFFECT_15DB 15
+#define LVDBE_EFFECT_03DB 3 /* Effect defines for backwards compatibility */
+#define LVDBE_EFFECT_06DB 6
+#define LVDBE_EFFECT_09DB 9
+#define LVDBE_EFFECT_12DB 12
+#define LVDBE_EFFECT_15DB 15
/****************************************************************************************/
/* */
@@ -83,39 +83,31 @@
/****************************************************************************************/
/* Instance handle */
-typedef void *LVDBE_Handle_t;
+typedef void* LVDBE_Handle_t;
/* Operating modes */
-typedef enum
-{
- LVDBE_OFF = 0,
- LVDBE_ON = 1,
- LVDBE_MODE_MAX = LVM_MAXINT_32
-} LVDBE_Mode_en;
+typedef enum { LVDBE_OFF = 0, LVDBE_ON = 1, LVDBE_MODE_MAX = LVM_MAXINT_32 } LVDBE_Mode_en;
/* High pass filter */
-typedef enum
-{
+typedef enum {
LVDBE_HPF_OFF = 0,
- LVDBE_HPF_ON = 1,
+ LVDBE_HPF_ON = 1,
LVDBE_HPF_MAX = LVM_MAXINT_32
} LVDBE_FilterSelect_en;
/* Volume control */
-typedef enum
-{
+typedef enum {
LVDBE_VOLUME_OFF = 0,
- LVDBE_VOLUME_ON = 1,
+ LVDBE_VOLUME_ON = 1,
LVDBE_VOLUME_MAX = LVM_MAXINT_32
} LVDBE_Volume_en;
/* Function return status */
-typedef enum
-{
- LVDBE_SUCCESS = 0, /* Successful return from a routine */
- LVDBE_NULLADDRESS = 1, /* NULL allocation address */
- LVDBE_TOOMANYSAMPLES = 2, /* Maximum block size exceeded */
- LVDBE_STATUS_MAX = LVM_MAXINT_32
+typedef enum {
+ LVDBE_SUCCESS = 0, /* Successful return from a routine */
+ LVDBE_NULLADDRESS = 1, /* NULL allocation address */
+ LVDBE_TOOMANYSAMPLES = 2, /* Maximum block size exceeded */
+ LVDBE_STATUS_MAX = LVM_MAXINT_32
} LVDBE_ReturnStatus_en;
/****************************************************************************************/
@@ -142,40 +134,38 @@
/*
* Bass Enhancement centre frequency
*/
-#define LVDBE_CAP_CENTRE_55Hz 1
-#define LVDBE_CAP_CENTRE_66Hz 2
-#define LVDBE_CAP_CENTRE_78Hz 4
-#define LVDBE_CAP_CENTRE_90Hz 8
+#define LVDBE_CAP_CENTRE_55Hz 1
+#define LVDBE_CAP_CENTRE_66Hz 2
+#define LVDBE_CAP_CENTRE_78Hz 4
+#define LVDBE_CAP_CENTRE_90Hz 8
-typedef enum
-{
+typedef enum {
LVDBE_CENTRE_55HZ = 0,
LVDBE_CENTRE_66HZ = 1,
LVDBE_CENTRE_78HZ = 2,
LVDBE_CENTRE_90HZ = 3,
- LVDBE_CENTRE_MAX = LVM_MAXINT_32
+ LVDBE_CENTRE_MAX = LVM_MAXINT_32
} LVDBE_CentreFreq_en;
/*
* Supported sample rates in samples per second
*/
-#define LVDBE_CAP_FS_8000 1
-#define LVDBE_CAP_FS_11025 2
-#define LVDBE_CAP_FS_12000 4
-#define LVDBE_CAP_FS_16000 8
-#define LVDBE_CAP_FS_22050 16
-#define LVDBE_CAP_FS_24000 32
-#define LVDBE_CAP_FS_32000 64
-#define LVDBE_CAP_FS_44100 128
-#define LVDBE_CAP_FS_48000 256
-#define LVDBE_CAP_FS_88200 512
-#define LVDBE_CAP_FS_96000 1024
-#define LVDBE_CAP_FS_176400 2048
-#define LVDBE_CAP_FS_192000 4096
+#define LVDBE_CAP_FS_8000 1
+#define LVDBE_CAP_FS_11025 2
+#define LVDBE_CAP_FS_12000 4
+#define LVDBE_CAP_FS_16000 8
+#define LVDBE_CAP_FS_22050 16
+#define LVDBE_CAP_FS_24000 32
+#define LVDBE_CAP_FS_32000 64
+#define LVDBE_CAP_FS_44100 128
+#define LVDBE_CAP_FS_48000 256
+#define LVDBE_CAP_FS_88200 512
+#define LVDBE_CAP_FS_96000 1024
+#define LVDBE_CAP_FS_176400 2048
+#define LVDBE_CAP_FS_192000 4096
-typedef enum
-{
- LVDBE_FS_8000 = 0,
+typedef enum {
+ LVDBE_FS_8000 = 0,
LVDBE_FS_11025 = 1,
LVDBE_FS_12000 = 2,
LVDBE_FS_16000 = 3,
@@ -188,7 +178,7 @@
LVDBE_FS_96000 = 10,
LVDBE_FS_176400 = 11,
LVDBE_FS_192000 = 12,
- LVDBE_FS_MAX = LVM_MAXINT_32
+ LVDBE_FS_MAX = LVM_MAXINT_32
} LVDBE_Fs_en;
/****************************************************************************************/
@@ -198,26 +188,24 @@
/****************************************************************************************/
/* Parameter structure */
-typedef struct
-{
- LVDBE_Mode_en OperatingMode;
- LVDBE_Fs_en SampleRate;
- LVM_INT16 EffectLevel;
- LVDBE_CentreFreq_en CentreFrequency;
- LVDBE_FilterSelect_en HPFSelect;
- LVDBE_Volume_en VolumeControl;
- LVM_INT16 VolumedB;
- LVM_INT16 HeadroomdB;
- LVM_INT16 NrChannels;
+typedef struct {
+ LVDBE_Mode_en OperatingMode;
+ LVDBE_Fs_en SampleRate;
+ LVM_INT16 EffectLevel;
+ LVDBE_CentreFreq_en CentreFrequency;
+ LVDBE_FilterSelect_en HPFSelect;
+ LVDBE_Volume_en VolumeControl;
+ LVM_INT16 VolumedB;
+ LVM_INT16 HeadroomdB;
+ LVM_INT16 NrChannels;
} LVDBE_Params_t;
/* Capability structure */
-typedef struct
-{
- LVM_UINT16 SampleRate; /* Sampling rate capabilities */
- LVM_UINT16 CentreFrequency; /* Centre frequency capabilities */
- LVM_UINT16 MaxBlockSize; /* Maximum block size in sample pairs */
+typedef struct {
+ LVM_UINT16 SampleRate; /* Sampling rate capabilities */
+ LVM_UINT16 CentreFrequency; /* Centre frequency capabilities */
+ LVM_UINT16 MaxBlockSize; /* Maximum block size in sample pairs */
} LVDBE_Capabilities_t;
/****************************************************************************************/
@@ -246,9 +234,8 @@
/* 1. This function must not be interrupted by the LVDBE_Process function */
/* */
/****************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
- LVDBE_Capabilities_t *pCapabilities,
- void *pScratch);
+LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t* phInstance, LVDBE_Capabilities_t* pCapabilities,
+ void* pScratch);
/****************************************************************************************/
/* */
@@ -261,7 +248,7 @@
/* phInstance Pointer to instance handle */
/* */
/****************************************************************************************/
-void LVDBE_DeInit(LVDBE_Handle_t *phInstance);
+void LVDBE_DeInit(LVDBE_Handle_t* phInstance);
/****************************************************************************************/
/* */
@@ -283,8 +270,7 @@
/* */
/****************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_GetParameters(LVDBE_Handle_t hInstance,
- LVDBE_Params_t *pParams);
+LVDBE_ReturnStatus_en LVDBE_GetParameters(LVDBE_Handle_t hInstance, LVDBE_Params_t* pParams);
/****************************************************************************************/
/* */
@@ -306,8 +292,8 @@
/* */
/****************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_GetCapabilities(LVDBE_Handle_t hInstance,
- LVDBE_Capabilities_t *pCapabilities);
+LVDBE_ReturnStatus_en LVDBE_GetCapabilities(LVDBE_Handle_t hInstance,
+ LVDBE_Capabilities_t* pCapabilities);
/****************************************************************************************/
/* */
@@ -346,8 +332,7 @@
/* */
/****************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
- LVDBE_Params_t *pParams);
+LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance, LVDBE_Params_t* pParams);
/****************************************************************************************/
/* */
@@ -369,9 +354,7 @@
/* NOTES: */
/* */
/****************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples);
+LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, LVM_UINT16 NumSamples);
#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 b364dae..30e1692 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
@@ -24,7 +24,7 @@
/* */
/************************************************************************************/
-#define LVDBE_SCALESHIFT 10 /* As a power of 2 */
+#define LVDBE_SCALESHIFT 10 /* As a power of 2 */
/************************************************************************************/
/* */
@@ -32,289 +32,289 @@
/* */
/************************************************************************************/
- /* Coefficients for centre frequency 55Hz */
-#define HPF_Fs8000_Fc55_A0 0.958849f
-#define HPF_Fs8000_Fc55_A1 (-1.917698f)
-#define HPF_Fs8000_Fc55_A2 0.958849f
-#define HPF_Fs8000_Fc55_B1 (-1.939001f)
-#define HPF_Fs8000_Fc55_B2 0.940807f
-#define HPF_Fs11025_Fc55_A0 0.966909f
-#define HPF_Fs11025_Fc55_A1 (-1.933818f)
-#define HPF_Fs11025_Fc55_A2 0.966909f
-#define HPF_Fs11025_Fc55_B1 (-1.955732f)
-#define HPF_Fs11025_Fc55_B2 0.956690f
-#define HPF_Fs12000_Fc55_A0 0.968650f
-#define HPF_Fs12000_Fc55_A1 (-1.937300f)
-#define HPF_Fs12000_Fc55_A2 0.968650f
-#define HPF_Fs12000_Fc55_B1 (-1.959327f)
-#define HPF_Fs12000_Fc55_B2 0.960138f
-#define HPF_Fs16000_Fc55_A0 0.973588f
-#define HPF_Fs16000_Fc55_A1 (-1.947176f)
-#define HPF_Fs16000_Fc55_A2 0.973588f
-#define HPF_Fs16000_Fc55_B1 (-1.969494f)
-#define HPF_Fs16000_Fc55_B2 0.969952f
-#define HPF_Fs22050_Fc55_A0 0.977671f
-#define HPF_Fs22050_Fc55_A1 (-1.955343f)
-#define HPF_Fs22050_Fc55_A2 0.977671f
-#define HPF_Fs22050_Fc55_B1 (-1.977863f)
-#define HPF_Fs22050_Fc55_B2 0.978105f
-#define HPF_Fs24000_Fc55_A0 0.978551f
-#define HPF_Fs24000_Fc55_A1 (-1.957102f)
-#define HPF_Fs24000_Fc55_A2 0.978551f
-#define HPF_Fs24000_Fc55_B1 (-1.979662f)
-#define HPF_Fs24000_Fc55_B2 0.979866f
-#define HPF_Fs32000_Fc55_A0 0.981042f
-#define HPF_Fs32000_Fc55_A1 (-1.962084f)
-#define HPF_Fs32000_Fc55_A2 0.981042f
-#define HPF_Fs32000_Fc55_B1 (-1.984746f)
-#define HPF_Fs32000_Fc55_B2 0.984861f
-#define HPF_Fs44100_Fc55_A0 0.983097f
-#define HPF_Fs44100_Fc55_A1 (-1.966194f)
-#define HPF_Fs44100_Fc55_A2 0.983097f
-#define HPF_Fs44100_Fc55_B1 (-1.988931f)
-#define HPF_Fs44100_Fc55_B2 0.988992f
-#define HPF_Fs48000_Fc55_A0 0.983539f
-#define HPF_Fs48000_Fc55_A1 (-1.967079f)
-#define HPF_Fs48000_Fc55_A2 0.983539f
-#define HPF_Fs48000_Fc55_B1 (-1.989831f)
-#define HPF_Fs48000_Fc55_B2 0.989882f
+/* Coefficients for centre frequency 55Hz */
+#define HPF_Fs8000_Fc55_A0 0.958849f
+#define HPF_Fs8000_Fc55_A1 (-1.917698f)
+#define HPF_Fs8000_Fc55_A2 0.958849f
+#define HPF_Fs8000_Fc55_B1 (-1.939001f)
+#define HPF_Fs8000_Fc55_B2 0.940807f
+#define HPF_Fs11025_Fc55_A0 0.966909f
+#define HPF_Fs11025_Fc55_A1 (-1.933818f)
+#define HPF_Fs11025_Fc55_A2 0.966909f
+#define HPF_Fs11025_Fc55_B1 (-1.955732f)
+#define HPF_Fs11025_Fc55_B2 0.956690f
+#define HPF_Fs12000_Fc55_A0 0.968650f
+#define HPF_Fs12000_Fc55_A1 (-1.937300f)
+#define HPF_Fs12000_Fc55_A2 0.968650f
+#define HPF_Fs12000_Fc55_B1 (-1.959327f)
+#define HPF_Fs12000_Fc55_B2 0.960138f
+#define HPF_Fs16000_Fc55_A0 0.973588f
+#define HPF_Fs16000_Fc55_A1 (-1.947176f)
+#define HPF_Fs16000_Fc55_A2 0.973588f
+#define HPF_Fs16000_Fc55_B1 (-1.969494f)
+#define HPF_Fs16000_Fc55_B2 0.969952f
+#define HPF_Fs22050_Fc55_A0 0.977671f
+#define HPF_Fs22050_Fc55_A1 (-1.955343f)
+#define HPF_Fs22050_Fc55_A2 0.977671f
+#define HPF_Fs22050_Fc55_B1 (-1.977863f)
+#define HPF_Fs22050_Fc55_B2 0.978105f
+#define HPF_Fs24000_Fc55_A0 0.978551f
+#define HPF_Fs24000_Fc55_A1 (-1.957102f)
+#define HPF_Fs24000_Fc55_A2 0.978551f
+#define HPF_Fs24000_Fc55_B1 (-1.979662f)
+#define HPF_Fs24000_Fc55_B2 0.979866f
+#define HPF_Fs32000_Fc55_A0 0.981042f
+#define HPF_Fs32000_Fc55_A1 (-1.962084f)
+#define HPF_Fs32000_Fc55_A2 0.981042f
+#define HPF_Fs32000_Fc55_B1 (-1.984746f)
+#define HPF_Fs32000_Fc55_B2 0.984861f
+#define HPF_Fs44100_Fc55_A0 0.983097f
+#define HPF_Fs44100_Fc55_A1 (-1.966194f)
+#define HPF_Fs44100_Fc55_A2 0.983097f
+#define HPF_Fs44100_Fc55_B1 (-1.988931f)
+#define HPF_Fs44100_Fc55_B2 0.988992f
+#define HPF_Fs48000_Fc55_A0 0.983539f
+#define HPF_Fs48000_Fc55_A1 (-1.967079f)
+#define HPF_Fs48000_Fc55_A2 0.983539f
+#define HPF_Fs48000_Fc55_B1 (-1.989831f)
+#define HPF_Fs48000_Fc55_B2 0.989882f
-#define HPF_Fs88200_Fc55_A0 0.985818f
-#define HPF_Fs88200_Fc55_A1 (-1.971636f)
-#define HPF_Fs88200_Fc55_A2 0.985818f
-#define HPF_Fs88200_Fc55_B1 (-1.994466f)
-#define HPF_Fs88200_Fc55_B2 0.994481f
+#define HPF_Fs88200_Fc55_A0 0.985818f
+#define HPF_Fs88200_Fc55_A1 (-1.971636f)
+#define HPF_Fs88200_Fc55_A2 0.985818f
+#define HPF_Fs88200_Fc55_B1 (-1.994466f)
+#define HPF_Fs88200_Fc55_B2 0.994481f
-#define HPF_Fs96000_Fc55_A0 0.986040f
-#define HPF_Fs96000_Fc55_A1 (-1.972080f)
-#define HPF_Fs96000_Fc55_A2 0.986040f
-#define HPF_Fs96000_Fc55_B1 (-1.994915f)
-#define HPF_Fs96000_Fc55_B2 0.994928f
+#define HPF_Fs96000_Fc55_A0 0.986040f
+#define HPF_Fs96000_Fc55_A1 (-1.972080f)
+#define HPF_Fs96000_Fc55_A2 0.986040f
+#define HPF_Fs96000_Fc55_B1 (-1.994915f)
+#define HPF_Fs96000_Fc55_B2 0.994928f
-#define HPF_Fs176400_Fc55_A0 0.987183f
-#define HPF_Fs176400_Fc55_A1 (-1.974366f)
-#define HPF_Fs176400_Fc55_A2 0.987183f
-#define HPF_Fs176400_Fc55_B1 (-1.997233f)
-#define HPF_Fs176400_Fc55_B2 0.997237f
+#define HPF_Fs176400_Fc55_A0 0.987183f
+#define HPF_Fs176400_Fc55_A1 (-1.974366f)
+#define HPF_Fs176400_Fc55_A2 0.987183f
+#define HPF_Fs176400_Fc55_B1 (-1.997233f)
+#define HPF_Fs176400_Fc55_B2 0.997237f
-#define HPF_Fs192000_Fc55_A0 0.987294f
-#define HPF_Fs192000_Fc55_A1 (-1.974588f)
-#define HPF_Fs192000_Fc55_A2 0.987294f
-#define HPF_Fs192000_Fc55_B1 (-1.997458f)
-#define HPF_Fs192000_Fc55_B2 0.997461f
+#define HPF_Fs192000_Fc55_A0 0.987294f
+#define HPF_Fs192000_Fc55_A1 (-1.974588f)
+#define HPF_Fs192000_Fc55_A2 0.987294f
+#define HPF_Fs192000_Fc55_B1 (-1.997458f)
+#define HPF_Fs192000_Fc55_B2 0.997461f
- /* Coefficients for centre frequency 66Hz */
-#define HPF_Fs8000_Fc66_A0 0.953016f
-#define HPF_Fs8000_Fc66_A1 (-1.906032f)
-#define HPF_Fs8000_Fc66_A2 0.953016f
-#define HPF_Fs8000_Fc66_B1 (-1.926810f)
-#define HPF_Fs8000_Fc66_B2 0.929396f
-#define HPF_Fs11025_Fc66_A0 0.962638f
-#define HPF_Fs11025_Fc66_A1 (-1.925275f)
-#define HPF_Fs11025_Fc66_A2 0.962638f
-#define HPF_Fs11025_Fc66_B1 (-1.946881f)
-#define HPF_Fs11025_Fc66_B2 0.948256f
-#define HPF_Fs12000_Fc66_A0 0.964718f
-#define HPF_Fs12000_Fc66_A1 (-1.929435f)
-#define HPF_Fs12000_Fc66_A2 0.964718f
-#define HPF_Fs12000_Fc66_B1 (-1.951196f)
-#define HPF_Fs12000_Fc66_B2 0.952359f
-#define HPF_Fs16000_Fc66_A0 0.970622f
-#define HPF_Fs16000_Fc66_A1 (-1.941244f)
-#define HPF_Fs16000_Fc66_A2 0.970622f
-#define HPF_Fs16000_Fc66_B1 (-1.963394f)
-#define HPF_Fs16000_Fc66_B2 0.964052f
-#define HPF_Fs22050_Fc66_A0 0.975509f
-#define HPF_Fs22050_Fc66_A1 (-1.951019f)
-#define HPF_Fs22050_Fc66_A2 0.975509f
-#define HPF_Fs22050_Fc66_B1 (-1.973436f)
-#define HPF_Fs22050_Fc66_B2 0.973784f
-#define HPF_Fs24000_Fc66_A0 0.976563f
-#define HPF_Fs24000_Fc66_A1 (-1.953125f)
-#define HPF_Fs24000_Fc66_A2 0.976563f
-#define HPF_Fs24000_Fc66_B1 (-1.975594f)
-#define HPF_Fs24000_Fc66_B2 0.975889f
-#define HPF_Fs32000_Fc66_A0 0.979547f
-#define HPF_Fs32000_Fc66_A1 (-1.959093f)
-#define HPF_Fs32000_Fc66_A2 0.979547f
-#define HPF_Fs32000_Fc66_B1 (-1.981695f)
-#define HPF_Fs32000_Fc66_B2 0.981861f
-#define HPF_Fs44100_Fc66_A0 0.982010f
-#define HPF_Fs44100_Fc66_A1 (-1.964019f)
-#define HPF_Fs44100_Fc66_A2 0.982010f
-#define HPF_Fs44100_Fc66_B1 (-1.986718f)
-#define HPF_Fs44100_Fc66_B2 0.986805f
-#define HPF_Fs48000_Fc66_A0 0.982540f
-#define HPF_Fs48000_Fc66_A1 (-1.965079f)
-#define HPF_Fs48000_Fc66_A2 0.982540f
-#define HPF_Fs48000_Fc66_B1 (-1.987797f)
-#define HPF_Fs48000_Fc66_B2 0.987871f
+/* Coefficients for centre frequency 66Hz */
+#define HPF_Fs8000_Fc66_A0 0.953016f
+#define HPF_Fs8000_Fc66_A1 (-1.906032f)
+#define HPF_Fs8000_Fc66_A2 0.953016f
+#define HPF_Fs8000_Fc66_B1 (-1.926810f)
+#define HPF_Fs8000_Fc66_B2 0.929396f
+#define HPF_Fs11025_Fc66_A0 0.962638f
+#define HPF_Fs11025_Fc66_A1 (-1.925275f)
+#define HPF_Fs11025_Fc66_A2 0.962638f
+#define HPF_Fs11025_Fc66_B1 (-1.946881f)
+#define HPF_Fs11025_Fc66_B2 0.948256f
+#define HPF_Fs12000_Fc66_A0 0.964718f
+#define HPF_Fs12000_Fc66_A1 (-1.929435f)
+#define HPF_Fs12000_Fc66_A2 0.964718f
+#define HPF_Fs12000_Fc66_B1 (-1.951196f)
+#define HPF_Fs12000_Fc66_B2 0.952359f
+#define HPF_Fs16000_Fc66_A0 0.970622f
+#define HPF_Fs16000_Fc66_A1 (-1.941244f)
+#define HPF_Fs16000_Fc66_A2 0.970622f
+#define HPF_Fs16000_Fc66_B1 (-1.963394f)
+#define HPF_Fs16000_Fc66_B2 0.964052f
+#define HPF_Fs22050_Fc66_A0 0.975509f
+#define HPF_Fs22050_Fc66_A1 (-1.951019f)
+#define HPF_Fs22050_Fc66_A2 0.975509f
+#define HPF_Fs22050_Fc66_B1 (-1.973436f)
+#define HPF_Fs22050_Fc66_B2 0.973784f
+#define HPF_Fs24000_Fc66_A0 0.976563f
+#define HPF_Fs24000_Fc66_A1 (-1.953125f)
+#define HPF_Fs24000_Fc66_A2 0.976563f
+#define HPF_Fs24000_Fc66_B1 (-1.975594f)
+#define HPF_Fs24000_Fc66_B2 0.975889f
+#define HPF_Fs32000_Fc66_A0 0.979547f
+#define HPF_Fs32000_Fc66_A1 (-1.959093f)
+#define HPF_Fs32000_Fc66_A2 0.979547f
+#define HPF_Fs32000_Fc66_B1 (-1.981695f)
+#define HPF_Fs32000_Fc66_B2 0.981861f
+#define HPF_Fs44100_Fc66_A0 0.982010f
+#define HPF_Fs44100_Fc66_A1 (-1.964019f)
+#define HPF_Fs44100_Fc66_A2 0.982010f
+#define HPF_Fs44100_Fc66_B1 (-1.986718f)
+#define HPF_Fs44100_Fc66_B2 0.986805f
+#define HPF_Fs48000_Fc66_A0 0.982540f
+#define HPF_Fs48000_Fc66_A1 (-1.965079f)
+#define HPF_Fs48000_Fc66_A2 0.982540f
+#define HPF_Fs48000_Fc66_B1 (-1.987797f)
+#define HPF_Fs48000_Fc66_B2 0.987871f
-#define HPF_Fs88200_Fc66_A0 0.985273f
-#define HPF_Fs88200_Fc66_A1 (-1.970546f)
-#define HPF_Fs88200_Fc66_A2 0.985273f
-#define HPF_Fs88200_Fc66_B1 (-1.993359f)
-#define HPF_Fs88200_Fc66_B2 0.993381f
+#define HPF_Fs88200_Fc66_A0 0.985273f
+#define HPF_Fs88200_Fc66_A1 (-1.970546f)
+#define HPF_Fs88200_Fc66_A2 0.985273f
+#define HPF_Fs88200_Fc66_B1 (-1.993359f)
+#define HPF_Fs88200_Fc66_B2 0.993381f
-#define HPF_Fs96000_Fc66_A0 0.985539f
-#define HPF_Fs96000_Fc66_A1 (-1.971077f)
-#define HPF_Fs96000_Fc66_A2 0.985539f
-#define HPF_Fs96000_Fc66_B1 (-1.993898f)
-#define HPF_Fs96000_Fc66_B2 0.993917f
+#define HPF_Fs96000_Fc66_A0 0.985539f
+#define HPF_Fs96000_Fc66_A1 (-1.971077f)
+#define HPF_Fs96000_Fc66_A2 0.985539f
+#define HPF_Fs96000_Fc66_B1 (-1.993898f)
+#define HPF_Fs96000_Fc66_B2 0.993917f
-#define HPF_Fs176400_Fc66_A0 0.986910f
-#define HPF_Fs176400_Fc66_A1 (-1.973820f)
-#define HPF_Fs176400_Fc66_A2 0.986910f
-#define HPF_Fs176400_Fc66_B1 (-1.996679f)
-#define HPF_Fs176400_Fc66_B2 0.996685f
+#define HPF_Fs176400_Fc66_A0 0.986910f
+#define HPF_Fs176400_Fc66_A1 (-1.973820f)
+#define HPF_Fs176400_Fc66_A2 0.986910f
+#define HPF_Fs176400_Fc66_B1 (-1.996679f)
+#define HPF_Fs176400_Fc66_B2 0.996685f
-#define HPF_Fs192000_Fc66_A0 0.987043f
-#define HPF_Fs192000_Fc66_A1 (-1.974086f)
-#define HPF_Fs192000_Fc66_A2 0.987043f
-#define HPF_Fs192000_Fc66_B1 (-1.996949f)
-#define HPF_Fs192000_Fc66_B2 0.996954f
+#define HPF_Fs192000_Fc66_A0 0.987043f
+#define HPF_Fs192000_Fc66_A1 (-1.974086f)
+#define HPF_Fs192000_Fc66_A2 0.987043f
+#define HPF_Fs192000_Fc66_B1 (-1.996949f)
+#define HPF_Fs192000_Fc66_B2 0.996954f
/* Coefficients for centre frequency 78Hz */
-#define HPF_Fs8000_Fc78_A0 0.946693f
-#define HPF_Fs8000_Fc78_A1 (-1.893387f)
-#define HPF_Fs8000_Fc78_A2 0.946693f
-#define HPF_Fs8000_Fc78_B1 (-1.913517f)
-#define HPF_Fs8000_Fc78_B2 0.917105f
-#define HPF_Fs11025_Fc78_A0 0.957999f
-#define HPF_Fs11025_Fc78_A1 (-1.915998f)
-#define HPF_Fs11025_Fc78_A2 0.957999f
-#define HPF_Fs11025_Fc78_B1 (-1.937229f)
-#define HPF_Fs11025_Fc78_B2 0.939140f
-#define HPF_Fs12000_Fc78_A0 0.960446f
-#define HPF_Fs12000_Fc78_A1 (-1.920892f)
-#define HPF_Fs12000_Fc78_A2 0.960446f
-#define HPF_Fs12000_Fc78_B1 (-1.942326f)
-#define HPF_Fs12000_Fc78_B2 0.943944f
-#define HPF_Fs16000_Fc78_A0 0.967397f
-#define HPF_Fs16000_Fc78_A1 (-1.934794f)
-#define HPF_Fs16000_Fc78_A2 0.967397f
-#define HPF_Fs16000_Fc78_B1 (-1.956740f)
-#define HPF_Fs16000_Fc78_B2 0.957656f
-#define HPF_Fs22050_Fc78_A0 0.973156f
-#define HPF_Fs22050_Fc78_A1 (-1.946313f)
-#define HPF_Fs22050_Fc78_A2 0.973156f
-#define HPF_Fs22050_Fc78_B1 (-1.968607f)
-#define HPF_Fs22050_Fc78_B2 0.969092f
-#define HPF_Fs24000_Fc78_A0 0.974398f
-#define HPF_Fs24000_Fc78_A1 (-1.948797f)
-#define HPF_Fs24000_Fc78_A2 0.974398f
-#define HPF_Fs24000_Fc78_B1 (-1.971157f)
-#define HPF_Fs24000_Fc78_B2 0.971568f
-#define HPF_Fs32000_Fc78_A0 0.977918f
-#define HPF_Fs32000_Fc78_A1 (-1.955836f)
-#define HPF_Fs32000_Fc78_A2 0.977918f
-#define HPF_Fs32000_Fc78_B1 (-1.978367f)
-#define HPF_Fs32000_Fc78_B2 0.978599f
-#define HPF_Fs44100_Fc78_A0 0.980824f
-#define HPF_Fs44100_Fc78_A1 (-1.961649f)
-#define HPF_Fs44100_Fc78_A2 0.980824f
-#define HPF_Fs44100_Fc78_B1 (-1.984303f)
-#define HPF_Fs44100_Fc78_B2 0.984425f
-#define HPF_Fs48000_Fc78_A0 0.981450f
-#define HPF_Fs48000_Fc78_A1 (-1.962900f)
-#define HPF_Fs48000_Fc78_A2 0.981450f
-#define HPF_Fs48000_Fc78_B1 (-1.985578f)
-#define HPF_Fs48000_Fc78_B2 0.985681f
+#define HPF_Fs8000_Fc78_A0 0.946693f
+#define HPF_Fs8000_Fc78_A1 (-1.893387f)
+#define HPF_Fs8000_Fc78_A2 0.946693f
+#define HPF_Fs8000_Fc78_B1 (-1.913517f)
+#define HPF_Fs8000_Fc78_B2 0.917105f
+#define HPF_Fs11025_Fc78_A0 0.957999f
+#define HPF_Fs11025_Fc78_A1 (-1.915998f)
+#define HPF_Fs11025_Fc78_A2 0.957999f
+#define HPF_Fs11025_Fc78_B1 (-1.937229f)
+#define HPF_Fs11025_Fc78_B2 0.939140f
+#define HPF_Fs12000_Fc78_A0 0.960446f
+#define HPF_Fs12000_Fc78_A1 (-1.920892f)
+#define HPF_Fs12000_Fc78_A2 0.960446f
+#define HPF_Fs12000_Fc78_B1 (-1.942326f)
+#define HPF_Fs12000_Fc78_B2 0.943944f
+#define HPF_Fs16000_Fc78_A0 0.967397f
+#define HPF_Fs16000_Fc78_A1 (-1.934794f)
+#define HPF_Fs16000_Fc78_A2 0.967397f
+#define HPF_Fs16000_Fc78_B1 (-1.956740f)
+#define HPF_Fs16000_Fc78_B2 0.957656f
+#define HPF_Fs22050_Fc78_A0 0.973156f
+#define HPF_Fs22050_Fc78_A1 (-1.946313f)
+#define HPF_Fs22050_Fc78_A2 0.973156f
+#define HPF_Fs22050_Fc78_B1 (-1.968607f)
+#define HPF_Fs22050_Fc78_B2 0.969092f
+#define HPF_Fs24000_Fc78_A0 0.974398f
+#define HPF_Fs24000_Fc78_A1 (-1.948797f)
+#define HPF_Fs24000_Fc78_A2 0.974398f
+#define HPF_Fs24000_Fc78_B1 (-1.971157f)
+#define HPF_Fs24000_Fc78_B2 0.971568f
+#define HPF_Fs32000_Fc78_A0 0.977918f
+#define HPF_Fs32000_Fc78_A1 (-1.955836f)
+#define HPF_Fs32000_Fc78_A2 0.977918f
+#define HPF_Fs32000_Fc78_B1 (-1.978367f)
+#define HPF_Fs32000_Fc78_B2 0.978599f
+#define HPF_Fs44100_Fc78_A0 0.980824f
+#define HPF_Fs44100_Fc78_A1 (-1.961649f)
+#define HPF_Fs44100_Fc78_A2 0.980824f
+#define HPF_Fs44100_Fc78_B1 (-1.984303f)
+#define HPF_Fs44100_Fc78_B2 0.984425f
+#define HPF_Fs48000_Fc78_A0 0.981450f
+#define HPF_Fs48000_Fc78_A1 (-1.962900f)
+#define HPF_Fs48000_Fc78_A2 0.981450f
+#define HPF_Fs48000_Fc78_B1 (-1.985578f)
+#define HPF_Fs48000_Fc78_B2 0.985681f
-#define HPF_Fs88200_Fc78_A0 0.984678f
-#define HPF_Fs88200_Fc78_A1 (-1.969356f)
-#define HPF_Fs88200_Fc78_A2 0.984678f
-#define HPF_Fs88200_Fc78_B1 (-1.992151f)
-#define HPF_Fs88200_Fc78_B2 0.992182f
+#define HPF_Fs88200_Fc78_A0 0.984678f
+#define HPF_Fs88200_Fc78_A1 (-1.969356f)
+#define HPF_Fs88200_Fc78_A2 0.984678f
+#define HPF_Fs88200_Fc78_B1 (-1.992151f)
+#define HPF_Fs88200_Fc78_B2 0.992182f
-#define HPF_Fs96000_Fc78_A0 0.984992f
-#define HPF_Fs96000_Fc78_A1 (-1.969984f)
-#define HPF_Fs96000_Fc78_A2 0.984992f
-#define HPF_Fs96000_Fc78_B1 (-1.992789f)
-#define HPF_Fs96000_Fc78_B2 0.992815f
+#define HPF_Fs96000_Fc78_A0 0.984992f
+#define HPF_Fs96000_Fc78_A1 (-1.969984f)
+#define HPF_Fs96000_Fc78_A2 0.984992f
+#define HPF_Fs96000_Fc78_B1 (-1.992789f)
+#define HPF_Fs96000_Fc78_B2 0.992815f
-#define HPF_Fs176400_Fc78_A0 0.986612f
-#define HPF_Fs176400_Fc78_A1 (-1.973224f)
-#define HPF_Fs176400_Fc78_A2 0.986612f
-#define HPF_Fs176400_Fc78_B1 (-1.996076f)
-#define HPF_Fs176400_Fc78_B2 0.996083f
+#define HPF_Fs176400_Fc78_A0 0.986612f
+#define HPF_Fs176400_Fc78_A1 (-1.973224f)
+#define HPF_Fs176400_Fc78_A2 0.986612f
+#define HPF_Fs176400_Fc78_B1 (-1.996076f)
+#define HPF_Fs176400_Fc78_B2 0.996083f
-#define HPF_Fs192000_Fc78_A0 0.986769f
-#define HPF_Fs192000_Fc78_A1 (-1.973539f)
-#define HPF_Fs192000_Fc78_A2 0.986769f
-#define HPF_Fs192000_Fc78_B1 (-1.996394f)
-#define HPF_Fs192000_Fc78_B2 0.996401f
+#define HPF_Fs192000_Fc78_A0 0.986769f
+#define HPF_Fs192000_Fc78_A1 (-1.973539f)
+#define HPF_Fs192000_Fc78_A2 0.986769f
+#define HPF_Fs192000_Fc78_B1 (-1.996394f)
+#define HPF_Fs192000_Fc78_B2 0.996401f
/* Coefficients for centre frequency 90Hz */
-#define HPF_Fs8000_Fc90_A0 0.940412f
-#define HPF_Fs8000_Fc90_A1 (-1.880825f)
-#define HPF_Fs8000_Fc90_A2 0.940412f
-#define HPF_Fs8000_Fc90_B1 (-1.900231f)
-#define HPF_Fs8000_Fc90_B2 0.904977f
-#define HPF_Fs11025_Fc90_A0 0.953383f
-#define HPF_Fs11025_Fc90_A1 (-1.906766f)
-#define HPF_Fs11025_Fc90_A2 0.953383f
-#define HPF_Fs11025_Fc90_B1 (-1.927579f)
-#define HPF_Fs11025_Fc90_B2 0.930111f
-#define HPF_Fs12000_Fc90_A0 0.956193f
-#define HPF_Fs12000_Fc90_A1 (-1.912387f)
-#define HPF_Fs12000_Fc90_A2 0.956193f
-#define HPF_Fs12000_Fc90_B1 (-1.933459f)
-#define HPF_Fs12000_Fc90_B2 0.935603f
-#define HPF_Fs16000_Fc90_A0 0.964183f
-#define HPF_Fs16000_Fc90_A1 (-1.928365f)
-#define HPF_Fs16000_Fc90_A2 0.964183f
-#define HPF_Fs16000_Fc90_B1 (-1.950087f)
-#define HPF_Fs16000_Fc90_B2 0.951303f
-#define HPF_Fs22050_Fc90_A0 0.970809f
-#define HPF_Fs22050_Fc90_A1 (-1.941618f)
-#define HPF_Fs22050_Fc90_A2 0.970809f
-#define HPF_Fs22050_Fc90_B1 (-1.963778f)
-#define HPF_Fs22050_Fc90_B2 0.964423f
-#define HPF_Fs24000_Fc90_A0 0.972239f
-#define HPF_Fs24000_Fc90_A1 (-1.944477f)
-#define HPF_Fs24000_Fc90_A2 0.972239f
-#define HPF_Fs24000_Fc90_B1 (-1.966721f)
-#define HPF_Fs24000_Fc90_B2 0.967266f
-#define HPF_Fs32000_Fc90_A0 0.976292f
-#define HPF_Fs32000_Fc90_A1 (-1.952584f)
-#define HPF_Fs32000_Fc90_A2 0.976292f
-#define HPF_Fs32000_Fc90_B1 (-1.975040f)
-#define HPF_Fs32000_Fc90_B2 0.975347f
-#define HPF_Fs44100_Fc90_A0 0.979641f
-#define HPF_Fs44100_Fc90_A1 (-1.959282f)
-#define HPF_Fs44100_Fc90_A2 0.979641f
-#define HPF_Fs44100_Fc90_B1 (-1.981888f)
-#define HPF_Fs44100_Fc90_B2 0.982050f
-#define HPF_Fs48000_Fc90_A0 0.980362f
-#define HPF_Fs48000_Fc90_A1 (-1.960724f)
-#define HPF_Fs48000_Fc90_A2 0.980362f
-#define HPF_Fs48000_Fc90_B1 (-1.983359f)
-#define HPF_Fs48000_Fc90_B2 0.983497f
+#define HPF_Fs8000_Fc90_A0 0.940412f
+#define HPF_Fs8000_Fc90_A1 (-1.880825f)
+#define HPF_Fs8000_Fc90_A2 0.940412f
+#define HPF_Fs8000_Fc90_B1 (-1.900231f)
+#define HPF_Fs8000_Fc90_B2 0.904977f
+#define HPF_Fs11025_Fc90_A0 0.953383f
+#define HPF_Fs11025_Fc90_A1 (-1.906766f)
+#define HPF_Fs11025_Fc90_A2 0.953383f
+#define HPF_Fs11025_Fc90_B1 (-1.927579f)
+#define HPF_Fs11025_Fc90_B2 0.930111f
+#define HPF_Fs12000_Fc90_A0 0.956193f
+#define HPF_Fs12000_Fc90_A1 (-1.912387f)
+#define HPF_Fs12000_Fc90_A2 0.956193f
+#define HPF_Fs12000_Fc90_B1 (-1.933459f)
+#define HPF_Fs12000_Fc90_B2 0.935603f
+#define HPF_Fs16000_Fc90_A0 0.964183f
+#define HPF_Fs16000_Fc90_A1 (-1.928365f)
+#define HPF_Fs16000_Fc90_A2 0.964183f
+#define HPF_Fs16000_Fc90_B1 (-1.950087f)
+#define HPF_Fs16000_Fc90_B2 0.951303f
+#define HPF_Fs22050_Fc90_A0 0.970809f
+#define HPF_Fs22050_Fc90_A1 (-1.941618f)
+#define HPF_Fs22050_Fc90_A2 0.970809f
+#define HPF_Fs22050_Fc90_B1 (-1.963778f)
+#define HPF_Fs22050_Fc90_B2 0.964423f
+#define HPF_Fs24000_Fc90_A0 0.972239f
+#define HPF_Fs24000_Fc90_A1 (-1.944477f)
+#define HPF_Fs24000_Fc90_A2 0.972239f
+#define HPF_Fs24000_Fc90_B1 (-1.966721f)
+#define HPF_Fs24000_Fc90_B2 0.967266f
+#define HPF_Fs32000_Fc90_A0 0.976292f
+#define HPF_Fs32000_Fc90_A1 (-1.952584f)
+#define HPF_Fs32000_Fc90_A2 0.976292f
+#define HPF_Fs32000_Fc90_B1 (-1.975040f)
+#define HPF_Fs32000_Fc90_B2 0.975347f
+#define HPF_Fs44100_Fc90_A0 0.979641f
+#define HPF_Fs44100_Fc90_A1 (-1.959282f)
+#define HPF_Fs44100_Fc90_A2 0.979641f
+#define HPF_Fs44100_Fc90_B1 (-1.981888f)
+#define HPF_Fs44100_Fc90_B2 0.982050f
+#define HPF_Fs48000_Fc90_A0 0.980362f
+#define HPF_Fs48000_Fc90_A1 (-1.960724f)
+#define HPF_Fs48000_Fc90_A2 0.980362f
+#define HPF_Fs48000_Fc90_B1 (-1.983359f)
+#define HPF_Fs48000_Fc90_B2 0.983497f
-#define HPF_Fs88200_Fc90_A0 0.984084f
-#define HPF_Fs88200_Fc90_A1 (-1.968168f)
-#define HPF_Fs88200_Fc90_A2 0.984084f
-#define HPF_Fs88200_Fc90_B1 (-1.990944f)
-#define HPF_Fs88200_Fc90_B2 0.990985f
+#define HPF_Fs88200_Fc90_A0 0.984084f
+#define HPF_Fs88200_Fc90_A1 (-1.968168f)
+#define HPF_Fs88200_Fc90_A2 0.984084f
+#define HPF_Fs88200_Fc90_B1 (-1.990944f)
+#define HPF_Fs88200_Fc90_B2 0.990985f
-#define HPF_Fs96000_Fc90_A0 0.984446f
-#define HPF_Fs96000_Fc90_A1 (-1.968892f)
-#define HPF_Fs96000_Fc90_A2 0.984446f
-#define HPF_Fs96000_Fc90_B1 (-1.991680f)
-#define HPF_Fs96000_Fc90_B2 0.991714f
+#define HPF_Fs96000_Fc90_A0 0.984446f
+#define HPF_Fs96000_Fc90_A1 (-1.968892f)
+#define HPF_Fs96000_Fc90_A2 0.984446f
+#define HPF_Fs96000_Fc90_B1 (-1.991680f)
+#define HPF_Fs96000_Fc90_B2 0.991714f
-#define HPF_Fs176400_Fc90_A0 0.986314f
-#define HPF_Fs176400_Fc90_A1 (-1.972629f)
-#define HPF_Fs176400_Fc90_A2 0.986314f
-#define HPF_Fs176400_Fc90_B1 (-1.995472f)
-#define HPF_Fs176400_Fc90_B2 0.995482f
+#define HPF_Fs176400_Fc90_A0 0.986314f
+#define HPF_Fs176400_Fc90_A1 (-1.972629f)
+#define HPF_Fs176400_Fc90_A2 0.986314f
+#define HPF_Fs176400_Fc90_B1 (-1.995472f)
+#define HPF_Fs176400_Fc90_B2 0.995482f
-#define HPF_Fs192000_Fc90_A0 0.986496f
-#define HPF_Fs192000_Fc90_A1 (-1.972992f)
-#define HPF_Fs192000_Fc90_A2 0.986496f
-#define HPF_Fs192000_Fc90_B1 (-1.995840f)
-#define HPF_Fs192000_Fc90_B2 0.995848f
+#define HPF_Fs192000_Fc90_A0 0.986496f
+#define HPF_Fs192000_Fc90_A1 (-1.972992f)
+#define HPF_Fs192000_Fc90_A2 0.986496f
+#define HPF_Fs192000_Fc90_B1 (-1.995840f)
+#define HPF_Fs192000_Fc90_B2 0.995848f
/************************************************************************************/
/* */
@@ -323,288 +323,288 @@
/************************************************************************************/
/* Coefficients for centre frequency 55Hz */
-#define BPF_Fs8000_Fc55_A0 0.009197f
-#define BPF_Fs8000_Fc55_A1 0.000000f
-#define BPF_Fs8000_Fc55_A2 (-0.009197f)
-#define BPF_Fs8000_Fc55_B1 (-1.979545f)
-#define BPF_Fs8000_Fc55_B2 0.981393f
-#define BPF_Fs11025_Fc55_A0 0.006691f
-#define BPF_Fs11025_Fc55_A1 0.000000f
-#define BPF_Fs11025_Fc55_A2 (-0.006691f)
-#define BPF_Fs11025_Fc55_B1 (-1.985488f)
-#define BPF_Fs11025_Fc55_B2 0.986464f
-#define BPF_Fs12000_Fc55_A0 0.006150f
-#define BPF_Fs12000_Fc55_A1 0.000000f
-#define BPF_Fs12000_Fc55_A2 (-0.006150f)
-#define BPF_Fs12000_Fc55_B1 (-1.986733f)
-#define BPF_Fs12000_Fc55_B2 0.987557f
-#define BPF_Fs16000_Fc55_A0 0.004620f
-#define BPF_Fs16000_Fc55_A1 0.000000f
-#define BPF_Fs16000_Fc55_A2 (-0.004620f)
-#define BPF_Fs16000_Fc55_B1 (-1.990189f)
-#define BPF_Fs16000_Fc55_B2 0.990653f
-#define BPF_Fs22050_Fc55_A0 0.003357f
-#define BPF_Fs22050_Fc55_A1 0.000000f
-#define BPF_Fs22050_Fc55_A2 (-0.003357f)
-#define BPF_Fs22050_Fc55_B1 (-1.992964f)
-#define BPF_Fs22050_Fc55_B2 0.993209f
-#define BPF_Fs24000_Fc55_A0 0.003085f
-#define BPF_Fs24000_Fc55_A1 0.000000f
-#define BPF_Fs24000_Fc55_A2 (-0.003085f)
-#define BPF_Fs24000_Fc55_B1 (-1.993552f)
-#define BPF_Fs24000_Fc55_B2 0.993759f
-#define BPF_Fs32000_Fc55_A0 0.002315f
-#define BPF_Fs32000_Fc55_A1 0.000000f
-#define BPF_Fs32000_Fc55_A2 (-0.002315f)
-#define BPF_Fs32000_Fc55_B1 (-1.995199f)
-#define BPF_Fs32000_Fc55_B2 0.995316f
-#define BPF_Fs44100_Fc55_A0 0.001681f
-#define BPF_Fs44100_Fc55_A1 0.000000f
-#define BPF_Fs44100_Fc55_A2 (-0.001681f)
-#define BPF_Fs44100_Fc55_B1 (-1.996537f)
-#define BPF_Fs44100_Fc55_B2 0.996599f
-#define BPF_Fs48000_Fc55_A0 0.001545f
-#define BPF_Fs48000_Fc55_A1 0.000000f
-#define BPF_Fs48000_Fc55_A2 (-0.001545f)
-#define BPF_Fs48000_Fc55_B1 (-1.996823f)
-#define BPF_Fs48000_Fc55_B2 0.996875f
+#define BPF_Fs8000_Fc55_A0 0.009197f
+#define BPF_Fs8000_Fc55_A1 0.000000f
+#define BPF_Fs8000_Fc55_A2 (-0.009197f)
+#define BPF_Fs8000_Fc55_B1 (-1.979545f)
+#define BPF_Fs8000_Fc55_B2 0.981393f
+#define BPF_Fs11025_Fc55_A0 0.006691f
+#define BPF_Fs11025_Fc55_A1 0.000000f
+#define BPF_Fs11025_Fc55_A2 (-0.006691f)
+#define BPF_Fs11025_Fc55_B1 (-1.985488f)
+#define BPF_Fs11025_Fc55_B2 0.986464f
+#define BPF_Fs12000_Fc55_A0 0.006150f
+#define BPF_Fs12000_Fc55_A1 0.000000f
+#define BPF_Fs12000_Fc55_A2 (-0.006150f)
+#define BPF_Fs12000_Fc55_B1 (-1.986733f)
+#define BPF_Fs12000_Fc55_B2 0.987557f
+#define BPF_Fs16000_Fc55_A0 0.004620f
+#define BPF_Fs16000_Fc55_A1 0.000000f
+#define BPF_Fs16000_Fc55_A2 (-0.004620f)
+#define BPF_Fs16000_Fc55_B1 (-1.990189f)
+#define BPF_Fs16000_Fc55_B2 0.990653f
+#define BPF_Fs22050_Fc55_A0 0.003357f
+#define BPF_Fs22050_Fc55_A1 0.000000f
+#define BPF_Fs22050_Fc55_A2 (-0.003357f)
+#define BPF_Fs22050_Fc55_B1 (-1.992964f)
+#define BPF_Fs22050_Fc55_B2 0.993209f
+#define BPF_Fs24000_Fc55_A0 0.003085f
+#define BPF_Fs24000_Fc55_A1 0.000000f
+#define BPF_Fs24000_Fc55_A2 (-0.003085f)
+#define BPF_Fs24000_Fc55_B1 (-1.993552f)
+#define BPF_Fs24000_Fc55_B2 0.993759f
+#define BPF_Fs32000_Fc55_A0 0.002315f
+#define BPF_Fs32000_Fc55_A1 0.000000f
+#define BPF_Fs32000_Fc55_A2 (-0.002315f)
+#define BPF_Fs32000_Fc55_B1 (-1.995199f)
+#define BPF_Fs32000_Fc55_B2 0.995316f
+#define BPF_Fs44100_Fc55_A0 0.001681f
+#define BPF_Fs44100_Fc55_A1 0.000000f
+#define BPF_Fs44100_Fc55_A2 (-0.001681f)
+#define BPF_Fs44100_Fc55_B1 (-1.996537f)
+#define BPF_Fs44100_Fc55_B2 0.996599f
+#define BPF_Fs48000_Fc55_A0 0.001545f
+#define BPF_Fs48000_Fc55_A1 0.000000f
+#define BPF_Fs48000_Fc55_A2 (-0.001545f)
+#define BPF_Fs48000_Fc55_B1 (-1.996823f)
+#define BPF_Fs48000_Fc55_B2 0.996875f
-#define BPF_Fs88200_Fc55_A0 0.000831f
-#define BPF_Fs88200_Fc55_A1 0.000000f
-#define BPF_Fs88200_Fc55_A2 (-0.000831f)
-#define BPF_Fs88200_Fc55_B1 (-1.998321f)
-#define BPF_Fs88200_Fc55_B2 0.998338f
+#define BPF_Fs88200_Fc55_A0 0.000831f
+#define BPF_Fs88200_Fc55_A1 0.000000f
+#define BPF_Fs88200_Fc55_A2 (-0.000831f)
+#define BPF_Fs88200_Fc55_B1 (-1.998321f)
+#define BPF_Fs88200_Fc55_B2 0.998338f
-#define BPF_Fs96000_Fc55_A0 0.000762f
-#define BPF_Fs96000_Fc55_A1 0.000000f
-#define BPF_Fs96000_Fc55_A2 (-0.000762f)
-#define BPF_Fs96000_Fc55_B1 (-1.998461f)
-#define BPF_Fs96000_Fc55_B2 0.998477f
+#define BPF_Fs96000_Fc55_A0 0.000762f
+#define BPF_Fs96000_Fc55_A1 0.000000f
+#define BPF_Fs96000_Fc55_A2 (-0.000762f)
+#define BPF_Fs96000_Fc55_B1 (-1.998461f)
+#define BPF_Fs96000_Fc55_B2 0.998477f
-#define BPF_Fs176400_Fc55_A0 0.000416f
-#define BPF_Fs176400_Fc55_A1 0.000000f
-#define BPF_Fs176400_Fc55_A2 (-0.000416f)
-#define BPF_Fs176400_Fc55_B1 (-1.999164f)
-#define BPF_Fs176400_Fc55_B2 0.999169f
+#define BPF_Fs176400_Fc55_A0 0.000416f
+#define BPF_Fs176400_Fc55_A1 0.000000f
+#define BPF_Fs176400_Fc55_A2 (-0.000416f)
+#define BPF_Fs176400_Fc55_B1 (-1.999164f)
+#define BPF_Fs176400_Fc55_B2 0.999169f
-#define BPF_Fs192000_Fc55_A0 0.000381f
-#define BPF_Fs192000_Fc55_A1 0.000000f
-#define BPF_Fs192000_Fc55_A2 (-0.000381f)
-#define BPF_Fs192000_Fc55_B1 (-1.999234f)
-#define BPF_Fs192000_Fc55_B2 0.999238f
+#define BPF_Fs192000_Fc55_A0 0.000381f
+#define BPF_Fs192000_Fc55_A1 0.000000f
+#define BPF_Fs192000_Fc55_A2 (-0.000381f)
+#define BPF_Fs192000_Fc55_B1 (-1.999234f)
+#define BPF_Fs192000_Fc55_B2 0.999238f
/* Coefficients for centre frequency 66Hz */
-#define BPF_Fs8000_Fc66_A0 0.012648f
-#define BPF_Fs8000_Fc66_A1 0.000000f
-#define BPF_Fs8000_Fc66_A2 (-0.012648f)
-#define BPF_Fs8000_Fc66_B1 (-1.971760f)
-#define BPF_Fs8000_Fc66_B2 0.974412f
-#define BPF_Fs11025_Fc66_A0 0.009209f
-#define BPF_Fs11025_Fc66_A1 0.000000f
-#define BPF_Fs11025_Fc66_A2 (-0.009209f)
-#define BPF_Fs11025_Fc66_B1 (-1.979966f)
-#define BPF_Fs11025_Fc66_B2 0.981368f
-#define BPF_Fs12000_Fc66_A0 0.008468f
-#define BPF_Fs12000_Fc66_A1 0.000000f
-#define BPF_Fs12000_Fc66_A2 (-0.008468f)
-#define BPF_Fs12000_Fc66_B1 (-1.981685f)
-#define BPF_Fs12000_Fc66_B2 0.982869f
-#define BPF_Fs16000_Fc66_A0 0.006364f
-#define BPF_Fs16000_Fc66_A1 0.000000f
-#define BPF_Fs16000_Fc66_A2 (-0.006364f)
-#define BPF_Fs16000_Fc66_B1 (-1.986457f)
-#define BPF_Fs16000_Fc66_B2 0.987124f
-#define BPF_Fs22050_Fc66_A0 0.004626f
-#define BPF_Fs22050_Fc66_A1 0.000000f
-#define BPF_Fs22050_Fc66_A2 (-0.004626f)
-#define BPF_Fs22050_Fc66_B1 (-1.990288f)
-#define BPF_Fs22050_Fc66_B2 0.990641f
-#define BPF_Fs24000_Fc66_A0 0.004252f
-#define BPF_Fs24000_Fc66_A1 0.000000f
-#define BPF_Fs24000_Fc66_A2 (-0.004252f)
-#define BPF_Fs24000_Fc66_B1 (-1.991100f)
-#define BPF_Fs24000_Fc66_B2 0.991398f
-#define BPF_Fs32000_Fc66_A0 0.003192f
-#define BPF_Fs32000_Fc66_A1 0.000000f
-#define BPF_Fs32000_Fc66_A2 (-0.003192f)
-#define BPF_Fs32000_Fc66_B1 (-1.993374f)
-#define BPF_Fs32000_Fc66_B2 0.993541f
-#define BPF_Fs44100_Fc66_A0 0.002318f
-#define BPF_Fs44100_Fc66_A1 0.000000f
-#define BPF_Fs44100_Fc66_A2 (-0.002318f)
-#define BPF_Fs44100_Fc66_B1 (-1.995221f)
-#define BPF_Fs44100_Fc66_B2 0.995309f
-#define BPF_Fs48000_Fc66_A0 0.002131f
-#define BPF_Fs48000_Fc66_A1 0.000000f
-#define BPF_Fs48000_Fc66_A2 (-0.002131f)
-#define BPF_Fs48000_Fc66_B1 (-1.995615f)
-#define BPF_Fs48000_Fc66_B2 0.995690f
+#define BPF_Fs8000_Fc66_A0 0.012648f
+#define BPF_Fs8000_Fc66_A1 0.000000f
+#define BPF_Fs8000_Fc66_A2 (-0.012648f)
+#define BPF_Fs8000_Fc66_B1 (-1.971760f)
+#define BPF_Fs8000_Fc66_B2 0.974412f
+#define BPF_Fs11025_Fc66_A0 0.009209f
+#define BPF_Fs11025_Fc66_A1 0.000000f
+#define BPF_Fs11025_Fc66_A2 (-0.009209f)
+#define BPF_Fs11025_Fc66_B1 (-1.979966f)
+#define BPF_Fs11025_Fc66_B2 0.981368f
+#define BPF_Fs12000_Fc66_A0 0.008468f
+#define BPF_Fs12000_Fc66_A1 0.000000f
+#define BPF_Fs12000_Fc66_A2 (-0.008468f)
+#define BPF_Fs12000_Fc66_B1 (-1.981685f)
+#define BPF_Fs12000_Fc66_B2 0.982869f
+#define BPF_Fs16000_Fc66_A0 0.006364f
+#define BPF_Fs16000_Fc66_A1 0.000000f
+#define BPF_Fs16000_Fc66_A2 (-0.006364f)
+#define BPF_Fs16000_Fc66_B1 (-1.986457f)
+#define BPF_Fs16000_Fc66_B2 0.987124f
+#define BPF_Fs22050_Fc66_A0 0.004626f
+#define BPF_Fs22050_Fc66_A1 0.000000f
+#define BPF_Fs22050_Fc66_A2 (-0.004626f)
+#define BPF_Fs22050_Fc66_B1 (-1.990288f)
+#define BPF_Fs22050_Fc66_B2 0.990641f
+#define BPF_Fs24000_Fc66_A0 0.004252f
+#define BPF_Fs24000_Fc66_A1 0.000000f
+#define BPF_Fs24000_Fc66_A2 (-0.004252f)
+#define BPF_Fs24000_Fc66_B1 (-1.991100f)
+#define BPF_Fs24000_Fc66_B2 0.991398f
+#define BPF_Fs32000_Fc66_A0 0.003192f
+#define BPF_Fs32000_Fc66_A1 0.000000f
+#define BPF_Fs32000_Fc66_A2 (-0.003192f)
+#define BPF_Fs32000_Fc66_B1 (-1.993374f)
+#define BPF_Fs32000_Fc66_B2 0.993541f
+#define BPF_Fs44100_Fc66_A0 0.002318f
+#define BPF_Fs44100_Fc66_A1 0.000000f
+#define BPF_Fs44100_Fc66_A2 (-0.002318f)
+#define BPF_Fs44100_Fc66_B1 (-1.995221f)
+#define BPF_Fs44100_Fc66_B2 0.995309f
+#define BPF_Fs48000_Fc66_A0 0.002131f
+#define BPF_Fs48000_Fc66_A1 0.000000f
+#define BPF_Fs48000_Fc66_A2 (-0.002131f)
+#define BPF_Fs48000_Fc66_B1 (-1.995615f)
+#define BPF_Fs48000_Fc66_B2 0.995690f
-#define BPF_Fs88200_Fc66_A0 0.001146f
-#define BPF_Fs88200_Fc66_A1 0.000000f
-#define BPF_Fs88200_Fc66_A2 (-0.001146f)
-#define BPF_Fs88200_Fc66_B1 (-1.997684f)
-#define BPF_Fs88200_Fc66_B2 0.997708f
+#define BPF_Fs88200_Fc66_A0 0.001146f
+#define BPF_Fs88200_Fc66_A1 0.000000f
+#define BPF_Fs88200_Fc66_A2 (-0.001146f)
+#define BPF_Fs88200_Fc66_B1 (-1.997684f)
+#define BPF_Fs88200_Fc66_B2 0.997708f
-#define BPF_Fs96000_Fc66_A0 0.001055f
-#define BPF_Fs96000_Fc66_A1 0.000000f
-#define BPF_Fs96000_Fc66_A2 (-0.001055f)
-#define BPF_Fs96000_Fc66_B1 (-1.997868f)
-#define BPF_Fs96000_Fc66_B2 0.997891f
+#define BPF_Fs96000_Fc66_A0 0.001055f
+#define BPF_Fs96000_Fc66_A1 0.000000f
+#define BPF_Fs96000_Fc66_A2 (-0.001055f)
+#define BPF_Fs96000_Fc66_B1 (-1.997868f)
+#define BPF_Fs96000_Fc66_B2 0.997891f
-#define BPF_Fs176400_Fc66_A0 0.000573f
-#define BPF_Fs176400_Fc66_A1 0.000000f
-#define BPF_Fs176400_Fc66_A2 (-0.000573f)
-#define BPF_Fs176400_Fc66_B1 (-1.998847f)
-#define BPF_Fs176400_Fc66_B2 0.998853f
+#define BPF_Fs176400_Fc66_A0 0.000573f
+#define BPF_Fs176400_Fc66_A1 0.000000f
+#define BPF_Fs176400_Fc66_A2 (-0.000573f)
+#define BPF_Fs176400_Fc66_B1 (-1.998847f)
+#define BPF_Fs176400_Fc66_B2 0.998853f
-#define BPF_Fs192000_Fc66_A0 0.000528f
-#define BPF_Fs192000_Fc66_A1 0.000000f
-#define BPF_Fs192000_Fc66_A2 (-0.000528f)
-#define BPF_Fs192000_Fc66_B1 (-1.998939f)
-#define BPF_Fs192000_Fc66_B2 0.998945f
+#define BPF_Fs192000_Fc66_A0 0.000528f
+#define BPF_Fs192000_Fc66_A1 0.000000f
+#define BPF_Fs192000_Fc66_A2 (-0.000528f)
+#define BPF_Fs192000_Fc66_B1 (-1.998939f)
+#define BPF_Fs192000_Fc66_B2 0.998945f
/* Coefficients for centre frequency 78Hz */
-#define BPF_Fs8000_Fc78_A0 0.018572f
-#define BPF_Fs8000_Fc78_A1 0.000000f
-#define BPF_Fs8000_Fc78_A2 (-0.018572f)
-#define BPF_Fs8000_Fc78_B1 (-1.958745f)
-#define BPF_Fs8000_Fc78_B2 0.962427f
-#define BPF_Fs11025_Fc78_A0 0.013545f
-#define BPF_Fs11025_Fc78_A1 0.000000f
-#define BPF_Fs11025_Fc78_A2 (-0.013545f)
-#define BPF_Fs11025_Fc78_B1 (-1.970647f)
-#define BPF_Fs11025_Fc78_B2 0.972596f
-#define BPF_Fs12000_Fc78_A0 0.012458f
-#define BPF_Fs12000_Fc78_A1 0.000000f
-#define BPF_Fs12000_Fc78_A2 (-0.012458f)
-#define BPF_Fs12000_Fc78_B1 (-1.973148f)
-#define BPF_Fs12000_Fc78_B2 0.974795f
-#define BPF_Fs16000_Fc78_A0 0.009373f
-#define BPF_Fs16000_Fc78_A1 0.000000f
-#define BPF_Fs16000_Fc78_A2 (-0.009373f)
-#define BPF_Fs16000_Fc78_B1 (-1.980108f)
-#define BPF_Fs16000_Fc78_B2 0.981037f
-#define BPF_Fs22050_Fc78_A0 0.006819f
-#define BPF_Fs22050_Fc78_A1 0.000000f
-#define BPF_Fs22050_Fc78_A2 (-0.006819f)
-#define BPF_Fs22050_Fc78_B1 (-1.985714f)
-#define BPF_Fs22050_Fc78_B2 0.986204f
-#define BPF_Fs24000_Fc78_A0 0.006268f
-#define BPF_Fs24000_Fc78_A1 0.000000f
-#define BPF_Fs24000_Fc78_A2 (-0.006268f)
-#define BPF_Fs24000_Fc78_B1 (-1.986904f)
-#define BPF_Fs24000_Fc78_B2 0.987318f
-#define BPF_Fs32000_Fc78_A0 0.004709f
-#define BPF_Fs32000_Fc78_A1 0.000000f
-#define BPF_Fs32000_Fc78_A2 (-0.004709f)
-#define BPF_Fs32000_Fc78_B1 (-1.990240f)
-#define BPF_Fs32000_Fc78_B2 0.990473f
-#define BPF_Fs44100_Fc78_A0 0.003421f
-#define BPF_Fs44100_Fc78_A1 0.000000f
-#define BPF_Fs44100_Fc78_A2 (-0.003421f)
-#define BPF_Fs44100_Fc78_B1 (-1.992955f)
-#define BPF_Fs44100_Fc78_B2 0.993078f
-#define BPF_Fs48000_Fc78_A0 0.003144f
-#define BPF_Fs48000_Fc78_A1 0.000000f
-#define BPF_Fs48000_Fc78_A2 (-0.003144f)
-#define BPF_Fs48000_Fc78_B1 (-1.993535f)
-#define BPF_Fs48000_Fc78_B2 0.993639f
+#define BPF_Fs8000_Fc78_A0 0.018572f
+#define BPF_Fs8000_Fc78_A1 0.000000f
+#define BPF_Fs8000_Fc78_A2 (-0.018572f)
+#define BPF_Fs8000_Fc78_B1 (-1.958745f)
+#define BPF_Fs8000_Fc78_B2 0.962427f
+#define BPF_Fs11025_Fc78_A0 0.013545f
+#define BPF_Fs11025_Fc78_A1 0.000000f
+#define BPF_Fs11025_Fc78_A2 (-0.013545f)
+#define BPF_Fs11025_Fc78_B1 (-1.970647f)
+#define BPF_Fs11025_Fc78_B2 0.972596f
+#define BPF_Fs12000_Fc78_A0 0.012458f
+#define BPF_Fs12000_Fc78_A1 0.000000f
+#define BPF_Fs12000_Fc78_A2 (-0.012458f)
+#define BPF_Fs12000_Fc78_B1 (-1.973148f)
+#define BPF_Fs12000_Fc78_B2 0.974795f
+#define BPF_Fs16000_Fc78_A0 0.009373f
+#define BPF_Fs16000_Fc78_A1 0.000000f
+#define BPF_Fs16000_Fc78_A2 (-0.009373f)
+#define BPF_Fs16000_Fc78_B1 (-1.980108f)
+#define BPF_Fs16000_Fc78_B2 0.981037f
+#define BPF_Fs22050_Fc78_A0 0.006819f
+#define BPF_Fs22050_Fc78_A1 0.000000f
+#define BPF_Fs22050_Fc78_A2 (-0.006819f)
+#define BPF_Fs22050_Fc78_B1 (-1.985714f)
+#define BPF_Fs22050_Fc78_B2 0.986204f
+#define BPF_Fs24000_Fc78_A0 0.006268f
+#define BPF_Fs24000_Fc78_A1 0.000000f
+#define BPF_Fs24000_Fc78_A2 (-0.006268f)
+#define BPF_Fs24000_Fc78_B1 (-1.986904f)
+#define BPF_Fs24000_Fc78_B2 0.987318f
+#define BPF_Fs32000_Fc78_A0 0.004709f
+#define BPF_Fs32000_Fc78_A1 0.000000f
+#define BPF_Fs32000_Fc78_A2 (-0.004709f)
+#define BPF_Fs32000_Fc78_B1 (-1.990240f)
+#define BPF_Fs32000_Fc78_B2 0.990473f
+#define BPF_Fs44100_Fc78_A0 0.003421f
+#define BPF_Fs44100_Fc78_A1 0.000000f
+#define BPF_Fs44100_Fc78_A2 (-0.003421f)
+#define BPF_Fs44100_Fc78_B1 (-1.992955f)
+#define BPF_Fs44100_Fc78_B2 0.993078f
+#define BPF_Fs48000_Fc78_A0 0.003144f
+#define BPF_Fs48000_Fc78_A1 0.000000f
+#define BPF_Fs48000_Fc78_A2 (-0.003144f)
+#define BPF_Fs48000_Fc78_B1 (-1.993535f)
+#define BPF_Fs48000_Fc78_B2 0.993639f
-#define BPF_Fs88200_Fc78_A0 0.001693f
-#define BPF_Fs88200_Fc78_A1 0.000000f
-#define BPF_Fs88200_Fc78_A2 (-0.001693f)
-#define BPF_Fs88200_Fc78_B1 (-1.996582f)
-#define BPF_Fs88200_Fc78_B2 0.996615f
+#define BPF_Fs88200_Fc78_A0 0.001693f
+#define BPF_Fs88200_Fc78_A1 0.000000f
+#define BPF_Fs88200_Fc78_A2 (-0.001693f)
+#define BPF_Fs88200_Fc78_B1 (-1.996582f)
+#define BPF_Fs88200_Fc78_B2 0.996615f
-#define BPF_Fs96000_Fc78_A0 0.001555f
-#define BPF_Fs96000_Fc78_A1 0.000000f
-#define BPF_Fs96000_Fc78_A2 (-0.0015555f)
-#define BPF_Fs96000_Fc78_B1 (-1.996860f)
-#define BPF_Fs96000_Fc78_B2 0.996891f
+#define BPF_Fs96000_Fc78_A0 0.001555f
+#define BPF_Fs96000_Fc78_A1 0.000000f
+#define BPF_Fs96000_Fc78_A2 (-0.0015555f)
+#define BPF_Fs96000_Fc78_B1 (-1.996860f)
+#define BPF_Fs96000_Fc78_B2 0.996891f
-#define BPF_Fs176400_Fc78_A0 0.000847f
-#define BPF_Fs176400_Fc78_A1 0.000000f
-#define BPF_Fs176400_Fc78_A2 (-0.000847f)
-#define BPF_Fs176400_Fc78_B1 (-1.998298f)
-#define BPF_Fs176400_Fc78_B2 0.998306f
+#define BPF_Fs176400_Fc78_A0 0.000847f
+#define BPF_Fs176400_Fc78_A1 0.000000f
+#define BPF_Fs176400_Fc78_A2 (-0.000847f)
+#define BPF_Fs176400_Fc78_B1 (-1.998298f)
+#define BPF_Fs176400_Fc78_B2 0.998306f
-#define BPF_Fs192000_Fc78_A0 0.000778f
-#define BPF_Fs192000_Fc78_A1 0.000000f
-#define BPF_Fs192000_Fc78_A2 (-0.000778f)
-#define BPF_Fs192000_Fc78_B1 (-1.998437f)
-#define BPF_Fs192000_Fc78_B2 0.998444f
+#define BPF_Fs192000_Fc78_A0 0.000778f
+#define BPF_Fs192000_Fc78_A1 0.000000f
+#define BPF_Fs192000_Fc78_A2 (-0.000778f)
+#define BPF_Fs192000_Fc78_B1 (-1.998437f)
+#define BPF_Fs192000_Fc78_B2 0.998444f
/* Coefficients for centre frequency 90Hz */
-#define BPF_Fs8000_Fc90_A0 0.022760f
-#define BPF_Fs8000_Fc90_A1 0.000000f
-#define BPF_Fs8000_Fc90_A2 (-0.022760f)
-#define BPF_Fs8000_Fc90_B1 (-1.949073f)
-#define BPF_Fs8000_Fc90_B2 0.953953f
-#define BPF_Fs11025_Fc90_A0 0.016619f
-#define BPF_Fs11025_Fc90_A1 0.000000f
-#define BPF_Fs11025_Fc90_A2 (-0.016619f)
-#define BPF_Fs11025_Fc90_B1 (-1.963791f)
-#define BPF_Fs11025_Fc90_B2 0.966377f
-#define BPF_Fs12000_Fc90_A0 0.015289f
-#define BPF_Fs12000_Fc90_A1 0.000000f
-#define BPF_Fs12000_Fc90_A2 (-0.015289f)
-#define BPF_Fs12000_Fc90_B1 (-1.966882f)
-#define BPF_Fs12000_Fc90_B2 0.969067f
-#define BPF_Fs16000_Fc90_A0 0.011511f
-#define BPF_Fs16000_Fc90_A1 0.000000f
-#define BPF_Fs16000_Fc90_A2 (-0.011511f)
-#define BPF_Fs16000_Fc90_B1 (-1.975477f)
-#define BPF_Fs16000_Fc90_B2 0.976711f
-#define BPF_Fs22050_Fc90_A0 0.008379f
-#define BPF_Fs22050_Fc90_A1 0.000000f
-#define BPF_Fs22050_Fc90_A2 (-0.008379f)
-#define BPF_Fs22050_Fc90_B1 (-1.982395f)
-#define BPF_Fs22050_Fc90_B2 0.983047f
-#define BPF_Fs24000_Fc90_A0 0.007704f
-#define BPF_Fs24000_Fc90_A1 0.000000f
-#define BPF_Fs24000_Fc90_A2 (-0.007704f)
-#define BPF_Fs24000_Fc90_B1 (-1.983863f)
-#define BPF_Fs24000_Fc90_B2 0.984414f
-#define BPF_Fs32000_Fc90_A0 0.005789f
-#define BPF_Fs32000_Fc90_A1 0.000000f
-#define BPF_Fs32000_Fc90_A2 (-0.005789f)
-#define BPF_Fs32000_Fc90_B1 (-1.987977f)
-#define BPF_Fs32000_Fc90_B2 0.988288f
-#define BPF_Fs44100_Fc90_A0 0.004207f
-#define BPF_Fs44100_Fc90_A1 0.000000f
-#define BPF_Fs44100_Fc90_A2 (-0.004207f)
-#define BPF_Fs44100_Fc90_B1 (-1.991324f)
-#define BPF_Fs44100_Fc90_B2 0.991488f
-#define BPF_Fs48000_Fc90_A0 0.003867f
-#define BPF_Fs48000_Fc90_A1 0.000000f
-#define BPF_Fs48000_Fc90_A2 (-0.003867f)
-#define BPF_Fs48000_Fc90_B1 (-1.992038f)
-#define BPF_Fs48000_Fc90_B2 0.992177f
+#define BPF_Fs8000_Fc90_A0 0.022760f
+#define BPF_Fs8000_Fc90_A1 0.000000f
+#define BPF_Fs8000_Fc90_A2 (-0.022760f)
+#define BPF_Fs8000_Fc90_B1 (-1.949073f)
+#define BPF_Fs8000_Fc90_B2 0.953953f
+#define BPF_Fs11025_Fc90_A0 0.016619f
+#define BPF_Fs11025_Fc90_A1 0.000000f
+#define BPF_Fs11025_Fc90_A2 (-0.016619f)
+#define BPF_Fs11025_Fc90_B1 (-1.963791f)
+#define BPF_Fs11025_Fc90_B2 0.966377f
+#define BPF_Fs12000_Fc90_A0 0.015289f
+#define BPF_Fs12000_Fc90_A1 0.000000f
+#define BPF_Fs12000_Fc90_A2 (-0.015289f)
+#define BPF_Fs12000_Fc90_B1 (-1.966882f)
+#define BPF_Fs12000_Fc90_B2 0.969067f
+#define BPF_Fs16000_Fc90_A0 0.011511f
+#define BPF_Fs16000_Fc90_A1 0.000000f
+#define BPF_Fs16000_Fc90_A2 (-0.011511f)
+#define BPF_Fs16000_Fc90_B1 (-1.975477f)
+#define BPF_Fs16000_Fc90_B2 0.976711f
+#define BPF_Fs22050_Fc90_A0 0.008379f
+#define BPF_Fs22050_Fc90_A1 0.000000f
+#define BPF_Fs22050_Fc90_A2 (-0.008379f)
+#define BPF_Fs22050_Fc90_B1 (-1.982395f)
+#define BPF_Fs22050_Fc90_B2 0.983047f
+#define BPF_Fs24000_Fc90_A0 0.007704f
+#define BPF_Fs24000_Fc90_A1 0.000000f
+#define BPF_Fs24000_Fc90_A2 (-0.007704f)
+#define BPF_Fs24000_Fc90_B1 (-1.983863f)
+#define BPF_Fs24000_Fc90_B2 0.984414f
+#define BPF_Fs32000_Fc90_A0 0.005789f
+#define BPF_Fs32000_Fc90_A1 0.000000f
+#define BPF_Fs32000_Fc90_A2 (-0.005789f)
+#define BPF_Fs32000_Fc90_B1 (-1.987977f)
+#define BPF_Fs32000_Fc90_B2 0.988288f
+#define BPF_Fs44100_Fc90_A0 0.004207f
+#define BPF_Fs44100_Fc90_A1 0.000000f
+#define BPF_Fs44100_Fc90_A2 (-0.004207f)
+#define BPF_Fs44100_Fc90_B1 (-1.991324f)
+#define BPF_Fs44100_Fc90_B2 0.991488f
+#define BPF_Fs48000_Fc90_A0 0.003867f
+#define BPF_Fs48000_Fc90_A1 0.000000f
+#define BPF_Fs48000_Fc90_A2 (-0.003867f)
+#define BPF_Fs48000_Fc90_B1 (-1.992038f)
+#define BPF_Fs48000_Fc90_B2 0.992177f
-#define BPF_Fs88200_Fc90_A0 0.002083f
-#define BPF_Fs88200_Fc90_A1 0.000000f
-#define BPF_Fs88200_Fc90_A2 (-0.002083f)
-#define BPF_Fs88200_Fc90_B1 (-1.995791f)
-#define BPF_Fs88200_Fc90_B2 0.995835f
+#define BPF_Fs88200_Fc90_A0 0.002083f
+#define BPF_Fs88200_Fc90_A1 0.000000f
+#define BPF_Fs88200_Fc90_A2 (-0.002083f)
+#define BPF_Fs88200_Fc90_B1 (-1.995791f)
+#define BPF_Fs88200_Fc90_B2 0.995835f
-#define BPF_Fs96000_Fc90_A0 0.001913f
-#define BPF_Fs96000_Fc90_A1 0.000000f
-#define BPF_Fs96000_Fc90_A2 (-0.001913f)
-#define BPF_Fs96000_Fc90_B1 (-1.996134f)
-#define BPF_Fs96000_Fc90_B2 0.996174f
+#define BPF_Fs96000_Fc90_A0 0.001913f
+#define BPF_Fs96000_Fc90_A1 0.000000f
+#define BPF_Fs96000_Fc90_A2 (-0.001913f)
+#define BPF_Fs96000_Fc90_B1 (-1.996134f)
+#define BPF_Fs96000_Fc90_B2 0.996174f
-#define BPF_Fs176400_Fc90_A0 0.001042f
-#define BPF_Fs176400_Fc90_A1 0.000000f
-#define BPF_Fs176400_Fc90_A2 (-0.001042f)
-#define BPF_Fs176400_Fc90_B1 (-1.997904f)
-#define BPF_Fs176400_Fc90_B2 0.997915f
+#define BPF_Fs176400_Fc90_A0 0.001042f
+#define BPF_Fs176400_Fc90_A1 0.000000f
+#define BPF_Fs176400_Fc90_A2 (-0.001042f)
+#define BPF_Fs176400_Fc90_B1 (-1.997904f)
+#define BPF_Fs176400_Fc90_B2 0.997915f
-#define BPF_Fs192000_Fc90_A0 0.000958f
-#define BPF_Fs192000_Fc90_A1 0.000000f
-#define BPF_Fs192000_Fc90_A2 (-0.000958f)
-#define BPF_Fs192000_Fc90_B1 (-1.998075f)
-#define BPF_Fs192000_Fc90_B2 0.998085f
+#define BPF_Fs192000_Fc90_A0 0.000958f
+#define BPF_Fs192000_Fc90_A1 0.000000f
+#define BPF_Fs192000_Fc90_A2 (-0.000958f)
+#define BPF_Fs192000_Fc90_B1 (-1.998075f)
+#define BPF_Fs192000_Fc90_B2 0.998085f
/************************************************************************************/
/* */
@@ -613,74 +613,74 @@
/************************************************************************************/
/* AGC Time constants */
-#define AGC_ATTACK_Fs8000 0.841395f
-#define AGC_ATTACK_Fs11025 0.882223f
-#define AGC_ATTACK_Fs12000 0.891251f
-#define AGC_ATTACK_Fs16000 0.917276f
-#define AGC_ATTACK_Fs22050 0.939267f
-#define AGC_ATTACK_Fs24000 0.944061f
-#define AGC_ATTACK_Fs32000 0.957745f
-#define AGC_ATTACK_Fs44100 0.969158f
-#define AGC_ATTACK_Fs48000 0.971628f
+#define AGC_ATTACK_Fs8000 0.841395f
+#define AGC_ATTACK_Fs11025 0.882223f
+#define AGC_ATTACK_Fs12000 0.891251f
+#define AGC_ATTACK_Fs16000 0.917276f
+#define AGC_ATTACK_Fs22050 0.939267f
+#define AGC_ATTACK_Fs24000 0.944061f
+#define AGC_ATTACK_Fs32000 0.957745f
+#define AGC_ATTACK_Fs44100 0.969158f
+#define AGC_ATTACK_Fs48000 0.971628f
-#define AGC_ATTACK_Fs88200 0.984458f
-#define AGC_ATTACK_Fs96000 0.985712f
-#define AGC_ATTACK_Fs176400 0.992199f
-#define AGC_ATTACK_Fs192000 0.992830f
+#define AGC_ATTACK_Fs88200 0.984458f
+#define AGC_ATTACK_Fs96000 0.985712f
+#define AGC_ATTACK_Fs176400 0.992199f
+#define AGC_ATTACK_Fs192000 0.992830f
-#define DECAY_SHIFT 10
+#define DECAY_SHIFT 10
-#define AGC_DECAY_Fs8000 0.000042f
-#define AGC_DECAY_Fs11025 0.000030f
-#define AGC_DECAY_Fs12000 0.000028f
-#define AGC_DECAY_Fs16000 0.000021f
-#define AGC_DECAY_Fs22050 0.000015f
-#define AGC_DECAY_Fs24000 0.000014f
-#define AGC_DECAY_Fs32000 0.000010f
-#define AGC_DECAY_Fs44100 0.000008f
-#define AGC_DECAY_Fs48000 0.000007f
+#define AGC_DECAY_Fs8000 0.000042f
+#define AGC_DECAY_Fs11025 0.000030f
+#define AGC_DECAY_Fs12000 0.000028f
+#define AGC_DECAY_Fs16000 0.000021f
+#define AGC_DECAY_Fs22050 0.000015f
+#define AGC_DECAY_Fs24000 0.000014f
+#define AGC_DECAY_Fs32000 0.000010f
+#define AGC_DECAY_Fs44100 0.000008f
+#define AGC_DECAY_Fs48000 0.000007f
-#define AGC_DECAY_Fs88200 0.0000038f
-#define AGC_DECAY_FS96000 0.0000035f
-#define AGC_DECAY_Fs176400 0.00000188f
-#define AGC_DECAY_FS192000 0.00000175f
+#define AGC_DECAY_Fs88200 0.0000038f
+#define AGC_DECAY_FS96000 0.0000035f
+#define AGC_DECAY_Fs176400 0.00000188f
+#define AGC_DECAY_FS192000 0.00000175f
/* 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 0.988553f
-#define AGC_HPFGAIN_0dB 0.412538f
-#define AGC_GAIN_0dB 0.000000f
-#define AGC_HPFGAIN_1dB 0.584893f
-#define AGC_GAIN_1dB 0.122018f
-#define AGC_HPFGAIN_2dB 0.778279f
-#define AGC_GAIN_2dB 0.258925f
-#define AGC_HPFGAIN_3dB 0.995262f
-#define AGC_GAIN_3dB 0.412538f
-#define AGC_HPFGAIN_4dB 1.238721f
-#define AGC_GAIN_4dB 0.584893f
-#define AGC_HPFGAIN_5dB 1.511886f
-#define AGC_GAIN_5dB 0.778279f
-#define AGC_HPFGAIN_6dB 1.818383f
-#define AGC_GAIN_6dB 0.995262f
-#define AGC_HPFGAIN_7dB 2.162278f
-#define AGC_GAIN_7dB 1.238721f
-#define AGC_HPFGAIN_8dB 2.548134f
-#define AGC_GAIN_8dB 1.511886f
-#define AGC_HPFGAIN_9dB 2.981072f
-#define AGC_GAIN_9dB 1.818383f
-#define AGC_HPFGAIN_10dB 3.466836f
-#define AGC_GAIN_10dB 2.162278f
-#define AGC_HPFGAIN_11dB 4.011872f
-#define AGC_GAIN_11dB 2.548134f
-#define AGC_HPFGAIN_12dB 4.623413f
-#define AGC_GAIN_12dB 2.981072f
-#define AGC_HPFGAIN_13dB 5.309573f
-#define AGC_GAIN_13dB 3.466836f
-#define AGC_HPFGAIN_14dB 6.079458f
-#define AGC_GAIN_14dB 4.011872f
-#define AGC_HPFGAIN_15dB 6.943282f
-#define AGC_GAIN_15dB 4.623413f
+#define AGC_GAIN_SCALE 31 /* As a power of 2 */
+#define AGC_GAIN_SHIFT 4 /* As a power of 2 */
+#define AGC_TARGETLEVEL 0.988553f
+#define AGC_HPFGAIN_0dB 0.412538f
+#define AGC_GAIN_0dB 0.000000f
+#define AGC_HPFGAIN_1dB 0.584893f
+#define AGC_GAIN_1dB 0.122018f
+#define AGC_HPFGAIN_2dB 0.778279f
+#define AGC_GAIN_2dB 0.258925f
+#define AGC_HPFGAIN_3dB 0.995262f
+#define AGC_GAIN_3dB 0.412538f
+#define AGC_HPFGAIN_4dB 1.238721f
+#define AGC_GAIN_4dB 0.584893f
+#define AGC_HPFGAIN_5dB 1.511886f
+#define AGC_GAIN_5dB 0.778279f
+#define AGC_HPFGAIN_6dB 1.818383f
+#define AGC_GAIN_6dB 0.995262f
+#define AGC_HPFGAIN_7dB 2.162278f
+#define AGC_GAIN_7dB 1.238721f
+#define AGC_HPFGAIN_8dB 2.548134f
+#define AGC_GAIN_8dB 1.511886f
+#define AGC_HPFGAIN_9dB 2.981072f
+#define AGC_GAIN_9dB 1.818383f
+#define AGC_HPFGAIN_10dB 3.466836f
+#define AGC_GAIN_10dB 2.162278f
+#define AGC_HPFGAIN_11dB 4.011872f
+#define AGC_GAIN_11dB 2.548134f
+#define AGC_HPFGAIN_12dB 4.623413f
+#define AGC_GAIN_12dB 2.981072f
+#define AGC_HPFGAIN_13dB 5.309573f
+#define AGC_GAIN_13dB 3.466836f
+#define AGC_HPFGAIN_14dB 6.079458f
+#define AGC_GAIN_14dB 4.011872f
+#define AGC_HPFGAIN_15dB 6.943282f
+#define AGC_GAIN_15dB 4.623413f
/************************************************************************************/
/* */
@@ -689,38 +689,38 @@
/************************************************************************************/
/* Volume control gain */
-#define VOLUME_MAX 0 /* In dBs */
-#define VOLUME_SHIFT 0 /* In dBs */
+#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 0.024690f
-#define VOL_TC_Fs11025 0.017977f
-#define VOL_TC_Fs12000 0.016529f
-#define VOL_TC_Fs16000 0.012422f
-#define VOL_TC_Fs22050 0.009029f
-#define VOL_TC_Fs24000 0.008299f
-#define VOL_TC_Fs32000 0.006231f
-#define VOL_TC_Fs44100 0.004525f
-#define VOL_TC_Fs48000 0.004158f
-#define VOL_TC_Fs88200 0.002263f
-#define VOL_TC_Fs96000 0.002079f
-#define VOL_TC_Fs176400 0.001131f
-#define VOL_TC_Fs192000 0.001039f
-#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 */
+#define VOL_TC_SHIFT 21 /* As a power of 2 */
+#define VOL_TC_Fs8000 0.024690f
+#define VOL_TC_Fs11025 0.017977f
+#define VOL_TC_Fs12000 0.016529f
+#define VOL_TC_Fs16000 0.012422f
+#define VOL_TC_Fs22050 0.009029f
+#define VOL_TC_Fs24000 0.008299f
+#define VOL_TC_Fs32000 0.006231f
+#define VOL_TC_Fs44100 0.004525f
+#define VOL_TC_Fs48000 0.004158f
+#define VOL_TC_Fs88200 0.002263f
+#define VOL_TC_Fs96000 0.002079f
+#define VOL_TC_Fs176400 0.001131f
+#define VOL_TC_Fs192000 0.001039f
+#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 */
/* Floating point value 0.989704 */
-#define MIX_TC_Fs88200 32430
-#define MIX_TC_Fs96000 32456 /* Floating point value 0.990530 */
+#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 */
+#define MIX_TC_Fs176400 32598
+#define MIX_TC_Fs192000 32611 /* Floating point value 0.992524 */
#endif
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
index 53feae8..5b47aa6 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.cpp
@@ -47,15 +47,12 @@
/* */
/****************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_GetParameters(LVDBE_Handle_t hInstance,
- LVDBE_Params_t *pParams)
-{
-
- LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
+LVDBE_ReturnStatus_en LVDBE_GetParameters(LVDBE_Handle_t hInstance, LVDBE_Params_t* pParams) {
+ LVDBE_Instance_t* pInstance = (LVDBE_Instance_t*)hInstance;
*pParams = pInstance->Params;
- return(LVDBE_SUCCESS);
+ return (LVDBE_SUCCESS);
}
/************************************************************************************/
@@ -77,15 +74,13 @@
/* */
/************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_GetCapabilities(LVDBE_Handle_t hInstance,
- LVDBE_Capabilities_t *pCapabilities)
-{
-
- LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
+LVDBE_ReturnStatus_en LVDBE_GetCapabilities(LVDBE_Handle_t hInstance,
+ LVDBE_Capabilities_t* pCapabilities) {
+ LVDBE_Instance_t* pInstance = (LVDBE_Instance_t*)hInstance;
*pCapabilities = pInstance->Capabilities;
- return(LVDBE_SUCCESS);
+ return (LVDBE_SUCCESS);
}
/************************************************************************************/
@@ -101,35 +96,33 @@
/* */
/************************************************************************************/
-void LVDBE_SetFilters(LVDBE_Instance_t *pInstance,
- LVDBE_Params_t *pParams)
-{
-
+void LVDBE_SetFilters(LVDBE_Instance_t* pInstance, LVDBE_Params_t* pParams) {
/*
* Calculate the table offsets
*/
- LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + \
- (LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_192000)));
+ LVM_UINT16 Offset =
+ (LVM_UINT16)((LVM_UINT16)pParams->SampleRate +
+ (LVM_UINT16)(pParams->CentreFrequency * (1 + LVDBE_FS_192000)));
/*
* Setup the high pass filter
*/
- LoadConst_Float(0, /* Clear the history, value 0 */
- (LVM_FLOAT *)&pInstance->pData->HPFTaps, /* Destination */
+ LoadConst_Float(0, /* Clear the history, value 0 */
+ (LVM_FLOAT*)&pInstance->pData->HPFTaps, /* Destination */
sizeof(pInstance->pData->HPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
- BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
+ BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
&pInstance->pData->HPFTaps,
- (BQ_FLOAT_Coefs_t *)&LVDBE_HPF_Table[Offset]);
+ (BQ_FLOAT_Coefs_t*)&LVDBE_HPF_Table[Offset]);
/*
* Setup the band pass filter
*/
- LoadConst_Float(0, /* Clear the history, value 0 */
- (LVM_FLOAT *)&pInstance->pData->BPFTaps, /* Destination */
- sizeof(pInstance->pData->BPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
- BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
+ LoadConst_Float(0, /* Clear the history, value 0 */
+ (LVM_FLOAT*)&pInstance->pData->BPFTaps, /* Destination */
+ sizeof(pInstance->pData->BPFTaps) / sizeof(LVM_FLOAT)); /* Number of words */
+ BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
&pInstance->pData->BPFTaps,
- (BP_FLOAT_Coefs_t *)&LVDBE_BPF_Table[Offset]);
+ (BP_FLOAT_Coefs_t*)&LVDBE_BPF_Table[Offset]);
}
/************************************************************************************/
@@ -145,29 +138,26 @@
/* */
/************************************************************************************/
-void LVDBE_SetAGC(LVDBE_Instance_t *pInstance,
- LVDBE_Params_t *pParams)
-{
-
+void LVDBE_SetAGC(LVDBE_Instance_t* pInstance, LVDBE_Params_t* pParams) {
/*
* Get the attack and decay time constants
*/
- 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 */
+ 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
*/
- if (pParams->HPFSelect == LVDBE_HPF_ON)
- {
- pInstance->pData->AGCInstance.AGC_MaxGain = LVDBE_AGC_HPFGAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter on */
- }
- else
- {
- pInstance->pData->AGCInstance.AGC_MaxGain = LVDBE_AGC_GAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter off */
+ if (pParams->HPFSelect == LVDBE_HPF_ON) {
+ pInstance->pData->AGCInstance.AGC_MaxGain =
+ LVDBE_AGC_HPFGAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter on */
+ } else {
+ pInstance->pData->AGCInstance.AGC_MaxGain =
+ LVDBE_AGC_GAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter off */
}
pInstance->pData->AGCInstance.AGC_Target = AGC_TARGETLEVEL;
-
}
/************************************************************************************/
@@ -193,29 +183,22 @@
/* */
/************************************************************************************/
-void LVDBE_SetVolume(LVDBE_Instance_t *pInstance,
- LVDBE_Params_t *pParams)
-{
+void LVDBE_SetVolume(LVDBE_Instance_t* pInstance, LVDBE_Params_t* pParams) {
+ LVM_UINT16 dBShifts; /* 6dB shifts */
+ LVM_UINT16 dBOffset; /* Table offset */
+ LVM_INT16 Volume = 0; /* Required volume in dBs */
- LVM_UINT16 dBShifts; /* 6dB shifts */
- LVM_UINT16 dBOffset; /* Table offset */
- LVM_INT16 Volume = 0; /* Required volume in dBs */
-
- LVM_FLOAT dBShifts_fac;
+ LVM_FLOAT dBShifts_fac;
/*
* Apply the volume if enabled
*/
- if (pParams->VolumeControl == LVDBE_VOLUME_ON)
- {
+ if (pParams->VolumeControl == LVDBE_VOLUME_ON) {
/*
* Limit the gain to the maximum allowed
*/
- if (pParams->VolumedB > VOLUME_MAX)
- {
+ if (pParams->VolumedB > VOLUME_MAX) {
Volume = VOLUME_MAX;
- }
- else
- {
+ } else {
Volume = pParams->VolumedB;
}
}
@@ -223,8 +206,8 @@
/*
* 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 */
+ dBOffset = (LVM_UINT16)(6 + Volume % 6); /* Get the dBs 0-5 */
+ dBShifts = (LVM_UINT16)(Volume / -6); /* Get the 6dB shifts */
dBShifts_fac = (LVM_FLOAT)(1 << dBShifts);
/*
@@ -232,27 +215,23 @@
*/
pInstance->pData->AGCInstance.Target = (LVDBE_VolumeTable[dBOffset]);
pInstance->pData->AGCInstance.Target = pInstance->pData->AGCInstance.Target / dBShifts_fac;
- pInstance->pData->AGCInstance.VolumeTC = LVDBE_VolumeTCTable[(LVM_UINT16)pParams->SampleRate]; /* Volume update time constant */
+ pInstance->pData->AGCInstance.VolumeTC =
+ LVDBE_VolumeTCTable[(LVM_UINT16)pParams->SampleRate]; /* Volume update time constant */
/*
* When DBE is disabled use the bypass volume control
*/
- if(dBShifts > 0)
- {
+ if (dBShifts > 0) {
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_VolumeTable[dBOffset] / dBShifts_fac);
- }
- else
- {
+ } else {
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],
LVDBE_VolumeTable[dBOffset]);
}
pInstance->pData->BypassVolume.MixerStream[0].CallbackSet = 1;
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->pData->BypassVolume.MixerStream[0],
- LVDBE_MIXER_TC,
- (LVM_Fs_en)pInstance->Params.SampleRate,
- 2);
+ LVDBE_MIXER_TC, (LVM_Fs_en)pInstance->Params.SampleRate, 2);
}
/****************************************************************************************/
@@ -292,21 +271,17 @@
/* */
/****************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
- LVDBE_Params_t *pParams)
-{
-
- LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
- LVMixer3_2St_FLOAT_st *pBypassMixer_Instance = &pInstance->pData->BypassMixer;
+LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance, LVDBE_Params_t* pParams) {
+ LVDBE_Instance_t* pInstance = (LVDBE_Instance_t*)hInstance;
+ LVMixer3_2St_FLOAT_st* pBypassMixer_Instance = &pInstance->pData->BypassMixer;
/*
* Update the filters
*/
if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
- (pInstance->Params.CentreFrequency != pParams->CentreFrequency))
- {
- LVDBE_SetFilters(pInstance, /* Instance pointer */
- pParams); /* New parameters */
+ (pInstance->Params.CentreFrequency != pParams->CentreFrequency)) {
+ LVDBE_SetFilters(pInstance, /* Instance pointer */
+ pParams); /* New parameters */
}
/*
@@ -314,16 +289,14 @@
*/
if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
(pInstance->Params.EffectLevel != pParams->EffectLevel) ||
- (pInstance->Params.HPFSelect != pParams->HPFSelect))
- {
- LVDBE_SetAGC(pInstance, /* Instance pointer */
- pParams); /* New parameters */
- LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
- LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate, 2);
+ (pInstance->Params.HPFSelect != pParams->HPFSelect)) {
+ LVDBE_SetAGC(pInstance, /* Instance pointer */
+ pParams); /* New parameters */
+ 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);
-
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1], LVDBE_BYPASS_MIXER_TC,
+ (LVM_Fs_en)pParams->SampleRate, 2);
}
/*
@@ -332,19 +305,16 @@
if ((pInstance->Params.VolumedB != pParams->VolumedB) ||
(pInstance->Params.SampleRate != pParams->SampleRate) ||
(pInstance->Params.HeadroomdB != pParams->HeadroomdB) ||
- (pInstance->Params.VolumeControl != pParams->VolumeControl))
- {
- LVDBE_SetVolume(pInstance, /* Instance pointer */
- pParams); /* New parameters */
+ (pInstance->Params.VolumeControl != pParams->VolumeControl)) {
+ LVDBE_SetVolume(pInstance, /* Instance pointer */
+ pParams); /* New parameters */
}
- if (pInstance->Params.OperatingMode==LVDBE_ON && pParams->OperatingMode==LVDBE_OFF)
- {
+ if (pInstance->Params.OperatingMode == LVDBE_ON && pParams->OperatingMode == LVDBE_OFF) {
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0], 0);
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1], 1.0f);
}
- if (pInstance->Params.OperatingMode==LVDBE_OFF && pParams->OperatingMode==LVDBE_ON)
- {
+ if (pInstance->Params.OperatingMode == LVDBE_OFF && pParams->OperatingMode == LVDBE_ON) {
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0], 1.0f);
LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1], 0);
}
@@ -354,5 +324,5 @@
*/
pInstance->Params = *pParams;
- return(LVDBE_SUCCESS);
+ 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 bd03dd3..12af162 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.cpp
@@ -45,28 +45,23 @@
/* 1. This function must not be interrupted by the LVDBE_Process function */
/* */
/****************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
- LVDBE_Capabilities_t *pCapabilities,
- void *pScratch)
-{
-
- LVDBE_Instance_t *pInstance;
- LVMixer3_1St_FLOAT_st *pMixer_Instance;
- LVMixer3_2St_FLOAT_st *pBypassMixer_Instance;
- LVM_FLOAT MixGain;
+LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t* phInstance, LVDBE_Capabilities_t* pCapabilities,
+ void* pScratch) {
+ LVDBE_Instance_t* pInstance;
+ LVMixer3_1St_FLOAT_st* pMixer_Instance;
+ LVMixer3_2St_FLOAT_st* pBypassMixer_Instance;
+ LVM_FLOAT MixGain;
/*
* Create the instance handle if not already initialised
*/
- if (*phInstance == LVM_NULL)
- {
+ if (*phInstance == LVM_NULL) {
*phInstance = calloc(1, sizeof(*pInstance));
}
- if (*phInstance == LVM_NULL)
- {
+ if (*phInstance == LVM_NULL) {
return LVDBE_NULLADDRESS;
}
- pInstance =(LVDBE_Instance_t *)*phInstance;
+ pInstance = (LVDBE_Instance_t*)*phInstance;
/*
* Save the memory table in the instance structure
@@ -78,42 +73,40 @@
/*
* Set the default instance parameters
*/
- pInstance->Params.CentreFrequency = LVDBE_CENTRE_55HZ;
- pInstance->Params.EffectLevel = 0;
- pInstance->Params.HeadroomdB = 0;
- pInstance->Params.HPFSelect = LVDBE_HPF_OFF;
- pInstance->Params.OperatingMode = LVDBE_OFF;
- pInstance->Params.SampleRate = LVDBE_FS_8000;
- pInstance->Params.VolumeControl = LVDBE_VOLUME_OFF;
- pInstance->Params.VolumedB = 0;
+ pInstance->Params.CentreFrequency = LVDBE_CENTRE_55HZ;
+ pInstance->Params.EffectLevel = 0;
+ pInstance->Params.HeadroomdB = 0;
+ pInstance->Params.HPFSelect = LVDBE_HPF_OFF;
+ pInstance->Params.OperatingMode = LVDBE_OFF;
+ pInstance->Params.SampleRate = LVDBE_FS_8000;
+ pInstance->Params.VolumeControl = LVDBE_VOLUME_OFF;
+ pInstance->Params.VolumedB = 0;
/*
* Create pointer to data and coef memory
*/
- pInstance->pData = (LVDBE_Data_FLOAT_t *)calloc(1, sizeof(*(pInstance->pData)));
- if (pInstance->pData == NULL)
- {
+ pInstance->pData = (LVDBE_Data_FLOAT_t*)calloc(1, sizeof(*(pInstance->pData)));
+ if (pInstance->pData == NULL) {
return LVDBE_NULLADDRESS;
}
- pInstance->pCoef = (LVDBE_Coef_FLOAT_t *)calloc(1, sizeof(*(pInstance->pCoef)));
- if (pInstance->pCoef == NULL)
- {
+ pInstance->pCoef = (LVDBE_Coef_FLOAT_t*)calloc(1, sizeof(*(pInstance->pCoef)));
+ if (pInstance->pCoef == NULL) {
return LVDBE_NULLADDRESS;
}
/*
* Initialise the filters
*/
- LVDBE_SetFilters(pInstance, /* Set the filter taps and coefficients */
+ LVDBE_SetFilters(pInstance, /* Set the filter taps and coefficients */
&pInstance->Params);
/*
* Initialise the AGC
*/
- LVDBE_SetAGC(pInstance, /* Set the AGC gain */
+ LVDBE_SetAGC(pInstance, /* Set the AGC gain */
&pInstance->Params);
pInstance->pData->AGCInstance.AGC_Gain = pInstance->pData->AGCInstance.AGC_MaxGain;
- /* Default to the bass boost setting */
+ /* Default to the bass boost setting */
// initialize the mixer with some fixes values since otherwise LVDBE_SetVolume ends up
// reading uninitialized data
@@ -123,11 +116,11 @@
/*
* Initialise the volume
*/
- LVDBE_SetVolume(pInstance, /* Set the Volume */
+ LVDBE_SetVolume(pInstance, /* Set the Volume */
&pInstance->Params);
pInstance->pData->AGCInstance.Volume = pInstance->pData->AGCInstance.Target;
- /* Initialise as the target */
+ /* Initialise as the target */
MixGain = LVC_Mixer_GetTarget(&pMixer_Instance->MixerStream[0]);
LVC_Mixer_Init(&pMixer_Instance->MixerStream[0], MixGain, MixGain);
@@ -149,11 +142,11 @@
pBypassMixer_Instance->MixerStream[0].CallbackParam = 0;
pBypassMixer_Instance->MixerStream[0].pCallbackHandle = LVM_NULL;
pBypassMixer_Instance->MixerStream[0].pCallBack = LVM_NULL;
- pBypassMixer_Instance->MixerStream[0].CallbackSet=0;
+ pBypassMixer_Instance->MixerStream[0].CallbackSet = 0;
- LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[0],0,0);
- LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
- LVDBE_BYPASS_MIXER_TC,(LVM_Fs_en)pInstance->Params.SampleRate,2);
+ LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[0], 0, 0);
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0], LVDBE_BYPASS_MIXER_TC,
+ (LVM_Fs_en)pInstance->Params.SampleRate, 2);
/*
* Setup the mixer gain for the unprocessed path
@@ -161,12 +154,12 @@
pBypassMixer_Instance->MixerStream[1].CallbackParam = 0;
pBypassMixer_Instance->MixerStream[1].pCallbackHandle = LVM_NULL;
pBypassMixer_Instance->MixerStream[1].pCallBack = LVM_NULL;
- pBypassMixer_Instance->MixerStream[1].CallbackSet=0;
+ pBypassMixer_Instance->MixerStream[1].CallbackSet = 0;
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);
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1], LVDBE_BYPASS_MIXER_TC,
+ (LVM_Fs_en)pInstance->Params.SampleRate, 2);
- return(LVDBE_SUCCESS);
+ return (LVDBE_SUCCESS);
}
/****************************************************************************************/
@@ -180,9 +173,8 @@
/* phInstance Pointer to instance handle */
/* */
/****************************************************************************************/
-void LVDBE_DeInit(LVDBE_Handle_t *phInstance)
-{
- LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *)*phInstance;
+void LVDBE_DeInit(LVDBE_Handle_t* phInstance) {
+ LVDBE_Instance_t* pInstance = (LVDBE_Instance_t*)*phInstance;
if (pInstance == LVM_NULL) {
return;
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
index 377d20e..4fef1ef 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
@@ -33,7 +33,7 @@
/* */
/****************************************************************************************/
-#include "LVDBE.h" /* Calling or Application layer definitions */
+#include "LVDBE.h" /* Calling or Application layer definitions */
#include "BIQUAD.h"
#include "LVC_Mixer.h"
#include "AGC.h"
@@ -45,10 +45,10 @@
/****************************************************************************************/
/* General */
-#define LVDBE_INVALID 0xFFFF /* Invalid init parameter */
+#define LVDBE_INVALID 0xFFFF /* Invalid init parameter */
-#define LVDBE_MIXER_TC 5 /* Mixer time */
-#define LVDBE_BYPASS_MIXER_TC 100 /* Bypass mixer time */
+#define LVDBE_MIXER_TC 5 /* Mixer time */
+#define LVDBE_BYPASS_MIXER_TC 100 /* Bypass mixer time */
/****************************************************************************************/
/* */
@@ -58,37 +58,34 @@
/* Data structure */
/* Data structure */
-typedef struct
-{
+typedef struct {
/* AGC parameters */
- AGC_MIX_VOL_2St1Mon_FLOAT_t AGCInstance; /* AGC instance parameters */
+ AGC_MIX_VOL_2St1Mon_FLOAT_t AGCInstance; /* AGC instance parameters */
/* Process variables */
- Biquad_2I_Order2_FLOAT_Taps_t HPFTaps; /* High pass filter taps */
- Biquad_1I_Order2_FLOAT_Taps_t BPFTaps; /* Band pass filter taps */
- LVMixer3_1St_FLOAT_st BypassVolume; /* Bypass volume scaler */
- LVMixer3_2St_FLOAT_st BypassMixer; /* Bypass Mixer for Click Removal */
+ Biquad_2I_Order2_FLOAT_Taps_t HPFTaps; /* High pass filter taps */
+ Biquad_1I_Order2_FLOAT_Taps_t BPFTaps; /* Band pass filter taps */
+ LVMixer3_1St_FLOAT_st BypassVolume; /* Bypass volume scaler */
+ LVMixer3_2St_FLOAT_st BypassMixer; /* Bypass Mixer for Click Removal */
} LVDBE_Data_FLOAT_t;
/* Coefs structure */
-typedef struct
-{
+typedef struct {
/* Process variables */
- Biquad_FLOAT_Instance_t HPFInstance; /* High pass filter instance */
- Biquad_FLOAT_Instance_t BPFInstance; /* Band pass filter instance */
+ Biquad_FLOAT_Instance_t HPFInstance; /* High pass filter instance */
+ Biquad_FLOAT_Instance_t BPFInstance; /* Band pass filter instance */
} LVDBE_Coef_FLOAT_t;
/* Instance structure */
-typedef struct
-{
+typedef struct {
/* Public parameters */
- LVDBE_Params_t Params; /* Instance parameters */
- LVDBE_Capabilities_t Capabilities; /* Instance capabilities */
+ LVDBE_Params_t Params; /* Instance parameters */
+ LVDBE_Capabilities_t Capabilities; /* Instance capabilities */
/* Data and coefficient pointers */
- LVDBE_Data_FLOAT_t *pData; /* Instance data */
- LVDBE_Coef_FLOAT_t *pCoef; /* Instance coefficients */
- void *pScratch; /* scratch pointer */
+ LVDBE_Data_FLOAT_t* pData; /* Instance data */
+ LVDBE_Coef_FLOAT_t* pCoef; /* Instance coefficients */
+ void* pScratch; /* scratch pointer */
} LVDBE_Instance_t;
/****************************************************************************************/
@@ -97,13 +94,10 @@
/* */
/****************************************************************************************/
-void LVDBE_SetAGC(LVDBE_Instance_t *pInstance,
- LVDBE_Params_t *pParams);
+void LVDBE_SetAGC(LVDBE_Instance_t* pInstance, LVDBE_Params_t* pParams);
-void LVDBE_SetVolume(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);
+void LVDBE_SetFilters(LVDBE_Instance_t* pInstance, LVDBE_Params_t* pParams);
-#endif /* __LVDBE_PRIVATE_H__ */
+#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 088de9f..f4a4d6f 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.cpp
@@ -21,12 +21,12 @@
/* */
/****************************************************************************************/
-#include <string.h> // memset
+#include <string.h> // memset
#include "LVDBE.h"
#include "LVDBE_Private.h"
#include "VectorArithmetic.h"
#include "AGC.h"
-#include "LVDBE_Coeffs.h" /* Filter coefficients */
+#include "LVDBE_Coeffs.h" /* Filter coefficients */
#include <log/log.h>
/********************************************************************************************/
@@ -73,138 +73,122 @@
/* overall end to end gain is odB. */
/* */
/********************************************************************************************/
-LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- const LVM_UINT16 NrFrames) // updated to use samples = frames * channels.
+LVDBE_ReturnStatus_en LVDBE_Process(
+ LVDBE_Handle_t hInstance, const LVM_FLOAT* pInData, LVM_FLOAT* pOutData,
+ const LVM_UINT16 NrFrames) // updated to use samples = frames * channels.
{
- LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
+ LVDBE_Instance_t* pInstance = (LVDBE_Instance_t*)hInstance;
- /*Extract number of Channels info*/
- // Mono passed in as stereo
- const LVM_INT32 NrChannels = pInstance->Params.NrChannels == 1
- ? 2 : pInstance->Params.NrChannels;
- const LVM_INT32 NrSamples = NrChannels * NrFrames;
+ /*Extract number of Channels info*/
+ // Mono passed in as stereo
+ const LVM_INT32 NrChannels =
+ pInstance->Params.NrChannels == 1 ? 2 : pInstance->Params.NrChannels;
+ const LVM_INT32 NrSamples = NrChannels * NrFrames;
- /* Space to store DBE path computation */
- LVM_FLOAT * const pScratch = (LVM_FLOAT *)pInstance->pScratch;
-
- /*
- * Scratch for Mono path starts at offset of
- * NrSamples float values from pScratch.
- */
- LVM_FLOAT * const pMono = pScratch + NrSamples;
-
- /*
- * TRICKY: pMono is used and discarded by the DBE path.
- * so it is available for use for the pScratchVol
- * path which is computed afterwards.
- *
- * Space to store Volume Control path computation.
- * This is identical to pMono (see TRICKY comment).
- */
- LVM_FLOAT * const pScratchVol = pMono;
-
- /*
- * Check the number of frames is not too large
- */
- if (NrFrames > 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])))
- {
- // make copy of input data
- Copy_Float(pInData,
- pScratch,
- (LVM_INT16)NrSamples);
+ /* Space to store DBE path computation */
+ LVM_FLOAT* const pScratch = (LVM_FLOAT*)pInstance->pScratch;
/*
- * Apply the high pass filter if selected
+ * Scratch for Mono path starts at offset of
+ * NrSamples float values from pScratch.
*/
- if (pInstance->Params.HPFSelect == LVDBE_HPF_ON)
- {
- BQ_MC_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance, /* Filter instance */
- pScratch, /* Source */
- pScratch, /* Destination */
- (LVM_INT16)NrFrames,
- (LVM_INT16)NrChannels);
+ LVM_FLOAT* const pMono = pScratch + NrSamples;
+
+ /*
+ * TRICKY: pMono is used and discarded by the DBE path.
+ * so it is available for use for the pScratchVol
+ * path which is computed afterwards.
+ *
+ * Space to store Volume Control path computation.
+ * This is identical to pMono (see TRICKY comment).
+ */
+ LVM_FLOAT* const pScratchVol = pMono;
+
+ /*
+ * Check the number of frames is not too large
+ */
+ if (NrFrames > pInstance->Capabilities.MaxBlockSize) {
+ return LVDBE_TOOMANYSAMPLES;
}
/*
- * Create the mono stream
+ * Check if the algorithm is enabled
*/
- FromMcToMono_Float(pScratch, /* Source */
- pMono, /* Mono destination */
- (LVM_INT16)NrFrames, /* Number of frames */
- (LVM_INT16)NrChannels);
+ /* 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]))) {
+ // make copy of input data
+ Copy_Float(pInData, pScratch, (LVM_INT16)NrSamples);
- /*
- * Apply the band pass filter
- */
- BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
- pMono, /* Source */
- pMono, /* Destination */
- (LVM_INT16)NrFrames);
+ /*
+ * Apply the high pass filter if selected
+ */
+ if (pInstance->Params.HPFSelect == LVDBE_HPF_ON) {
+ BQ_MC_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance, /* Filter instance */
+ pScratch, /* Source */
+ pScratch, /* Destination */
+ (LVM_INT16)NrFrames, (LVM_INT16)NrChannels);
+ }
- /*
- * Apply the AGC and mix
- */
- AGC_MIX_VOL_Mc1Mon_D32_WRA(&pInstance->pData->AGCInstance, /* Instance pointer */
- pScratch, /* Source */
- pMono, /* Mono band pass source */
- pScratch, /* Destination */
- NrFrames, /* Number of frames */
- NrChannels); /* Number of channels */
+ /*
+ * Create the mono stream
+ */
+ FromMcToMono_Float(pScratch, /* Source */
+ pMono, /* Mono destination */
+ (LVM_INT16)NrFrames, /* Number of frames */
+ (LVM_INT16)NrChannels);
- for (LVM_INT32 ii = 0; ii < NrSamples; ++ii) {
- //TODO: replace with existing clamping function
- if (pScratch[ii] < -1.0) {
- pScratch[ii] = -1.0;
- } else if (pScratch[ii] > 1.0) {
- pScratch[ii] = 1.0;
- }
+ /*
+ * Apply the band pass filter
+ */
+ BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
+ pMono, /* Source */
+ pMono, /* Destination */
+ (LVM_INT16)NrFrames);
+
+ /*
+ * Apply the AGC and mix
+ */
+ AGC_MIX_VOL_Mc1Mon_D32_WRA(&pInstance->pData->AGCInstance, /* Instance pointer */
+ pScratch, /* Source */
+ pMono, /* Mono band pass source */
+ pScratch, /* Destination */
+ NrFrames, /* Number of frames */
+ NrChannels); /* Number of channels */
+
+ for (LVM_INT32 ii = 0; ii < NrSamples; ++ii) {
+ // TODO: replace with existing clamping function
+ if (pScratch[ii] < -1.0) {
+ pScratch[ii] = -1.0;
+ } else if (pScratch[ii] > 1.0) {
+ pScratch[ii] = 1.0;
+ }
+ }
+ } else {
+ // clear DBE processed path
+ memset(pScratch, 0, sizeof(*pScratch) * NrSamples);
}
- } else {
- // clear DBE processed path
- memset(pScratch, 0, sizeof(*pScratch) * NrSamples);
- }
- /* 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])))
- {
+ /* 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_Mc_D16C31_SAT(&pInstance->pData->BypassVolume, pInData, pScratchVol,
+ (LVM_INT16)NrFrames, (LVM_INT16)NrChannels);
+ } else {
+ // clear bypass volume path
+ memset(pScratchVol, 0, sizeof(*pScratchVol) * NrSamples);
+ }
/*
- * The algorithm is disabled but volume management is required to compensate for
- * headroom and volume (if enabled)
+ * Mix DBE processed path and bypass volume path
*/
- LVC_MixSoft_Mc_D16C31_SAT(&pInstance->pData->BypassVolume,
- pInData,
- pScratchVol,
- (LVM_INT16)NrFrames,
- (LVM_INT16)NrChannels);
- } else {
- // clear bypass volume path
- memset(pScratchVol, 0, sizeof(*pScratchVol) * NrSamples);
- }
-
- /*
- * Mix DBE processed path and bypass volume path
- */
- LVC_MixSoft_2Mc_D16C31_SAT(&pInstance->pData->BypassMixer,
- pScratch,
- pScratchVol,
- pOutData,
- (LVM_INT16)NrFrames,
- (LVM_INT16)NrChannels);
- return LVDBE_SUCCESS;
+ LVC_MixSoft_2Mc_D16C31_SAT(&pInstance->pData->BypassMixer, pScratch, pScratchVol, pOutData,
+ (LVM_INT16)NrFrames, (LVM_INT16)NrChannels);
+ return LVDBE_SUCCESS;
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
index 728575c..1b95812 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.cpp
@@ -22,7 +22,7 @@
/************************************************************************************/
#include "LVDBE.h"
-#include "LVDBE_Coeffs.h" /* Filter coefficients */
+#include "LVDBE_Coeffs.h" /* Filter coefficients */
#include "LVDBE_Tables.h"
#include "BIQUAD.h"
@@ -36,275 +36,119 @@
* High Pass Filter Coefficient table
*/
const BQ_FLOAT_Coefs_t LVDBE_HPF_Table[] = {
- /* Coefficients for 55Hz centre frequency */
- {HPF_Fs8000_Fc55_A2, /* 8kS/s coefficients */
- HPF_Fs8000_Fc55_A1,
- HPF_Fs8000_Fc55_A0,
- -HPF_Fs8000_Fc55_B2,
- -HPF_Fs8000_Fc55_B1},
- {HPF_Fs11025_Fc55_A2, /* 11kS/s coefficients */
- HPF_Fs11025_Fc55_A1,
- HPF_Fs11025_Fc55_A0,
- -HPF_Fs11025_Fc55_B2,
- -HPF_Fs11025_Fc55_B1},
- {HPF_Fs12000_Fc55_A2, /* 12kS/s coefficients */
- HPF_Fs12000_Fc55_A1,
- HPF_Fs12000_Fc55_A0,
- -HPF_Fs12000_Fc55_B2,
- -HPF_Fs12000_Fc55_B1},
- {HPF_Fs16000_Fc55_A2, /* 16kS/s coefficients */
- HPF_Fs16000_Fc55_A1,
- HPF_Fs16000_Fc55_A0,
- -HPF_Fs16000_Fc55_B2,
- -HPF_Fs16000_Fc55_B1},
- {HPF_Fs22050_Fc55_A2, /* 22kS/s coefficients */
- HPF_Fs22050_Fc55_A1,
- HPF_Fs22050_Fc55_A0,
- -HPF_Fs22050_Fc55_B2,
- -HPF_Fs22050_Fc55_B1},
- {HPF_Fs24000_Fc55_A2, /* 24kS/s coefficients */
- HPF_Fs24000_Fc55_A1,
- HPF_Fs24000_Fc55_A0,
- -HPF_Fs24000_Fc55_B2,
- -HPF_Fs24000_Fc55_B1},
- {HPF_Fs32000_Fc55_A2, /* 32kS/s coefficients */
- HPF_Fs32000_Fc55_A1,
- HPF_Fs32000_Fc55_A0,
- -HPF_Fs32000_Fc55_B2,
- -HPF_Fs32000_Fc55_B1},
- {HPF_Fs44100_Fc55_A2, /* 44kS/s coefficients */
- HPF_Fs44100_Fc55_A1,
- HPF_Fs44100_Fc55_A0,
- -HPF_Fs44100_Fc55_B2,
- -HPF_Fs44100_Fc55_B1},
- {HPF_Fs48000_Fc55_A2, /* 48kS/s coefficients */
- HPF_Fs48000_Fc55_A1,
- HPF_Fs48000_Fc55_A0,
- -HPF_Fs48000_Fc55_B2,
- -HPF_Fs48000_Fc55_B1},
- {HPF_Fs88200_Fc55_A2, /* 88kS/s coefficients */
- HPF_Fs88200_Fc55_A1,
- HPF_Fs88200_Fc55_A0,
- -HPF_Fs88200_Fc55_B2,
- -HPF_Fs88200_Fc55_B1},
- {HPF_Fs96000_Fc55_A2, /* 96kS/s coefficients */
- HPF_Fs96000_Fc55_A1,
- HPF_Fs96000_Fc55_A0,
- -HPF_Fs96000_Fc55_B2,
- -HPF_Fs96000_Fc55_B1},
- {HPF_Fs176400_Fc55_A2, /* 176kS/s coefficients */
- HPF_Fs176400_Fc55_A1,
- HPF_Fs176400_Fc55_A0,
- -HPF_Fs176400_Fc55_B2,
- -HPF_Fs176400_Fc55_B1},
- {HPF_Fs192000_Fc55_A2, /* 192kS/s coefficients */
- HPF_Fs192000_Fc55_A1,
- HPF_Fs192000_Fc55_A0,
- -HPF_Fs192000_Fc55_B2,
- -HPF_Fs192000_Fc55_B1},
+ /* Coefficients for 55Hz centre frequency */
+ {HPF_Fs8000_Fc55_A2, /* 8kS/s coefficients */
+ HPF_Fs8000_Fc55_A1, HPF_Fs8000_Fc55_A0, -HPF_Fs8000_Fc55_B2, -HPF_Fs8000_Fc55_B1},
+ {HPF_Fs11025_Fc55_A2, /* 11kS/s coefficients */
+ HPF_Fs11025_Fc55_A1, HPF_Fs11025_Fc55_A0, -HPF_Fs11025_Fc55_B2, -HPF_Fs11025_Fc55_B1},
+ {HPF_Fs12000_Fc55_A2, /* 12kS/s coefficients */
+ HPF_Fs12000_Fc55_A1, HPF_Fs12000_Fc55_A0, -HPF_Fs12000_Fc55_B2, -HPF_Fs12000_Fc55_B1},
+ {HPF_Fs16000_Fc55_A2, /* 16kS/s coefficients */
+ HPF_Fs16000_Fc55_A1, HPF_Fs16000_Fc55_A0, -HPF_Fs16000_Fc55_B2, -HPF_Fs16000_Fc55_B1},
+ {HPF_Fs22050_Fc55_A2, /* 22kS/s coefficients */
+ HPF_Fs22050_Fc55_A1, HPF_Fs22050_Fc55_A0, -HPF_Fs22050_Fc55_B2, -HPF_Fs22050_Fc55_B1},
+ {HPF_Fs24000_Fc55_A2, /* 24kS/s coefficients */
+ HPF_Fs24000_Fc55_A1, HPF_Fs24000_Fc55_A0, -HPF_Fs24000_Fc55_B2, -HPF_Fs24000_Fc55_B1},
+ {HPF_Fs32000_Fc55_A2, /* 32kS/s coefficients */
+ HPF_Fs32000_Fc55_A1, HPF_Fs32000_Fc55_A0, -HPF_Fs32000_Fc55_B2, -HPF_Fs32000_Fc55_B1},
+ {HPF_Fs44100_Fc55_A2, /* 44kS/s coefficients */
+ HPF_Fs44100_Fc55_A1, HPF_Fs44100_Fc55_A0, -HPF_Fs44100_Fc55_B2, -HPF_Fs44100_Fc55_B1},
+ {HPF_Fs48000_Fc55_A2, /* 48kS/s coefficients */
+ HPF_Fs48000_Fc55_A1, HPF_Fs48000_Fc55_A0, -HPF_Fs48000_Fc55_B2, -HPF_Fs48000_Fc55_B1},
+ {HPF_Fs88200_Fc55_A2, /* 88kS/s coefficients */
+ HPF_Fs88200_Fc55_A1, HPF_Fs88200_Fc55_A0, -HPF_Fs88200_Fc55_B2, -HPF_Fs88200_Fc55_B1},
+ {HPF_Fs96000_Fc55_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc55_A1, HPF_Fs96000_Fc55_A0, -HPF_Fs96000_Fc55_B2, -HPF_Fs96000_Fc55_B1},
+ {HPF_Fs176400_Fc55_A2, /* 176kS/s coefficients */
+ HPF_Fs176400_Fc55_A1, HPF_Fs176400_Fc55_A0, -HPF_Fs176400_Fc55_B2, -HPF_Fs176400_Fc55_B1},
+ {HPF_Fs192000_Fc55_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc55_A1, HPF_Fs192000_Fc55_A0, -HPF_Fs192000_Fc55_B2, -HPF_Fs192000_Fc55_B1},
- /* Coefficients for 66Hz centre frequency */
- {HPF_Fs8000_Fc66_A2, /* 8kS/s coefficients */
- HPF_Fs8000_Fc66_A1,
- HPF_Fs8000_Fc66_A0,
- -HPF_Fs8000_Fc66_B2,
- -HPF_Fs8000_Fc66_B1},
- {HPF_Fs11025_Fc66_A2, /* 11kS/s coefficients */
- HPF_Fs11025_Fc66_A1,
- HPF_Fs11025_Fc66_A0,
- -HPF_Fs11025_Fc66_B2,
- -HPF_Fs11025_Fc66_B1},
- {HPF_Fs12000_Fc66_A2, /* 12kS/s coefficients */
- HPF_Fs12000_Fc66_A1,
- HPF_Fs12000_Fc66_A0,
- -HPF_Fs12000_Fc66_B2,
- -HPF_Fs12000_Fc66_B1},
- {HPF_Fs16000_Fc66_A2, /* 16kS/s coefficients */
- HPF_Fs16000_Fc66_A1,
- HPF_Fs16000_Fc66_A0,
- -HPF_Fs16000_Fc66_B2,
- -HPF_Fs16000_Fc66_B1},
- {HPF_Fs22050_Fc66_A2, /* 22kS/s coefficients */
- HPF_Fs22050_Fc66_A1,
- HPF_Fs22050_Fc66_A0,
- -HPF_Fs22050_Fc66_B2,
- -HPF_Fs22050_Fc66_B1},
- {HPF_Fs24000_Fc66_A2, /* 24kS/s coefficients */
- HPF_Fs24000_Fc66_A1,
- HPF_Fs24000_Fc66_A0,
- -HPF_Fs24000_Fc66_B2,
- -HPF_Fs24000_Fc66_B1},
- {HPF_Fs32000_Fc66_A2, /* 32kS/s coefficients */
- HPF_Fs32000_Fc66_A1,
- HPF_Fs32000_Fc66_A0,
- -HPF_Fs32000_Fc66_B2,
- -HPF_Fs32000_Fc66_B1},
- {HPF_Fs44100_Fc66_A2, /* 44kS/s coefficients */
- HPF_Fs44100_Fc66_A1,
- HPF_Fs44100_Fc66_A0,
- -HPF_Fs44100_Fc66_B2,
- -HPF_Fs44100_Fc66_B1},
- {HPF_Fs48000_Fc66_A2, /* 48kS/s coefficients */
- HPF_Fs48000_Fc66_A1,
- HPF_Fs48000_Fc66_A0,
- -HPF_Fs48000_Fc66_B2,
- -HPF_Fs48000_Fc66_B1},
- {HPF_Fs88200_Fc66_A2, /* 88kS/s coefficients */
- HPF_Fs88200_Fc66_A1,
- HPF_Fs88200_Fc66_A0,
- -HPF_Fs88200_Fc66_B2,
- -HPF_Fs88200_Fc66_B1},
- {HPF_Fs96000_Fc66_A2, /* 96kS/s coefficients */
- HPF_Fs96000_Fc66_A1,
- HPF_Fs96000_Fc66_A0,
- -HPF_Fs96000_Fc66_B2,
- -HPF_Fs96000_Fc66_B1},
- {HPF_Fs176400_Fc66_A2, /* 176kS/s coefficients */
- HPF_Fs176400_Fc66_A1,
- HPF_Fs176400_Fc66_A0,
- -HPF_Fs176400_Fc66_B2,
- -HPF_Fs176400_Fc66_B1},
- {HPF_Fs192000_Fc66_A2, /* 192kS/s coefficients */
- HPF_Fs192000_Fc66_A1,
- HPF_Fs192000_Fc66_A0,
- -HPF_Fs192000_Fc66_B2,
- -HPF_Fs192000_Fc66_B1},
+ /* Coefficients for 66Hz centre frequency */
+ {HPF_Fs8000_Fc66_A2, /* 8kS/s coefficients */
+ HPF_Fs8000_Fc66_A1, HPF_Fs8000_Fc66_A0, -HPF_Fs8000_Fc66_B2, -HPF_Fs8000_Fc66_B1},
+ {HPF_Fs11025_Fc66_A2, /* 11kS/s coefficients */
+ HPF_Fs11025_Fc66_A1, HPF_Fs11025_Fc66_A0, -HPF_Fs11025_Fc66_B2, -HPF_Fs11025_Fc66_B1},
+ {HPF_Fs12000_Fc66_A2, /* 12kS/s coefficients */
+ HPF_Fs12000_Fc66_A1, HPF_Fs12000_Fc66_A0, -HPF_Fs12000_Fc66_B2, -HPF_Fs12000_Fc66_B1},
+ {HPF_Fs16000_Fc66_A2, /* 16kS/s coefficients */
+ HPF_Fs16000_Fc66_A1, HPF_Fs16000_Fc66_A0, -HPF_Fs16000_Fc66_B2, -HPF_Fs16000_Fc66_B1},
+ {HPF_Fs22050_Fc66_A2, /* 22kS/s coefficients */
+ HPF_Fs22050_Fc66_A1, HPF_Fs22050_Fc66_A0, -HPF_Fs22050_Fc66_B2, -HPF_Fs22050_Fc66_B1},
+ {HPF_Fs24000_Fc66_A2, /* 24kS/s coefficients */
+ HPF_Fs24000_Fc66_A1, HPF_Fs24000_Fc66_A0, -HPF_Fs24000_Fc66_B2, -HPF_Fs24000_Fc66_B1},
+ {HPF_Fs32000_Fc66_A2, /* 32kS/s coefficients */
+ HPF_Fs32000_Fc66_A1, HPF_Fs32000_Fc66_A0, -HPF_Fs32000_Fc66_B2, -HPF_Fs32000_Fc66_B1},
+ {HPF_Fs44100_Fc66_A2, /* 44kS/s coefficients */
+ HPF_Fs44100_Fc66_A1, HPF_Fs44100_Fc66_A0, -HPF_Fs44100_Fc66_B2, -HPF_Fs44100_Fc66_B1},
+ {HPF_Fs48000_Fc66_A2, /* 48kS/s coefficients */
+ HPF_Fs48000_Fc66_A1, HPF_Fs48000_Fc66_A0, -HPF_Fs48000_Fc66_B2, -HPF_Fs48000_Fc66_B1},
+ {HPF_Fs88200_Fc66_A2, /* 88kS/s coefficients */
+ HPF_Fs88200_Fc66_A1, HPF_Fs88200_Fc66_A0, -HPF_Fs88200_Fc66_B2, -HPF_Fs88200_Fc66_B1},
+ {HPF_Fs96000_Fc66_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc66_A1, HPF_Fs96000_Fc66_A0, -HPF_Fs96000_Fc66_B2, -HPF_Fs96000_Fc66_B1},
+ {HPF_Fs176400_Fc66_A2, /* 176kS/s coefficients */
+ HPF_Fs176400_Fc66_A1, HPF_Fs176400_Fc66_A0, -HPF_Fs176400_Fc66_B2, -HPF_Fs176400_Fc66_B1},
+ {HPF_Fs192000_Fc66_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc66_A1, HPF_Fs192000_Fc66_A0, -HPF_Fs192000_Fc66_B2, -HPF_Fs192000_Fc66_B1},
- /* Coefficients for 78Hz centre frequency */
- {HPF_Fs8000_Fc78_A2, /* 8kS/s coefficients */
- HPF_Fs8000_Fc78_A1,
- HPF_Fs8000_Fc78_A0,
- -HPF_Fs8000_Fc78_B2,
- -HPF_Fs8000_Fc78_B1},
- {HPF_Fs11025_Fc78_A2, /* 11kS/s coefficients */
- HPF_Fs11025_Fc78_A1,
- HPF_Fs11025_Fc78_A0,
- -HPF_Fs11025_Fc78_B2,
- -HPF_Fs11025_Fc78_B1},
- {HPF_Fs12000_Fc78_A2, /* 12kS/s coefficients */
- HPF_Fs12000_Fc78_A1,
- HPF_Fs12000_Fc78_A0,
- -HPF_Fs12000_Fc78_B2,
- -HPF_Fs12000_Fc78_B1},
- {HPF_Fs16000_Fc78_A2, /* 16kS/s coefficients */
- HPF_Fs16000_Fc78_A1,
- HPF_Fs16000_Fc78_A0,
- -HPF_Fs16000_Fc78_B2,
- -HPF_Fs16000_Fc78_B1},
- {HPF_Fs22050_Fc78_A2, /* 22kS/s coefficients */
- HPF_Fs22050_Fc78_A1,
- HPF_Fs22050_Fc78_A0,
- -HPF_Fs22050_Fc78_B2,
- -HPF_Fs22050_Fc78_B1},
- {HPF_Fs24000_Fc78_A2, /* 24kS/s coefficients */
- HPF_Fs24000_Fc78_A1,
- HPF_Fs24000_Fc78_A0,
- -HPF_Fs24000_Fc78_B2,
- -HPF_Fs24000_Fc78_B1},
- {HPF_Fs32000_Fc78_A2, /* 32kS/s coefficients */
- HPF_Fs32000_Fc78_A1,
- HPF_Fs32000_Fc78_A0,
- -HPF_Fs32000_Fc78_B2,
- -HPF_Fs32000_Fc78_B1},
- {HPF_Fs44100_Fc78_A2, /* 44kS/s coefficients */
- HPF_Fs44100_Fc78_A1,
- HPF_Fs44100_Fc78_A0,
- -HPF_Fs44100_Fc78_B2,
- -HPF_Fs44100_Fc78_B1},
- {HPF_Fs48000_Fc78_A2, /* 48kS/s coefficients */
- HPF_Fs48000_Fc78_A1,
- HPF_Fs48000_Fc78_A0,
- -HPF_Fs48000_Fc78_B2,
- -HPF_Fs48000_Fc78_B1},
- {HPF_Fs88200_Fc78_A2, /* 88kS/s coefficients */
- HPF_Fs88200_Fc78_A1,
- HPF_Fs88200_Fc78_A0,
- -HPF_Fs88200_Fc78_B2,
- -HPF_Fs88200_Fc78_B1},
- {HPF_Fs96000_Fc78_A2, /* 96kS/s coefficients */
- HPF_Fs96000_Fc78_A1,
- HPF_Fs96000_Fc78_A0,
- -HPF_Fs96000_Fc78_B2,
- -HPF_Fs96000_Fc78_B1},
- {HPF_Fs176400_Fc78_A2, /* 176kS/s coefficients */
- HPF_Fs176400_Fc78_A1,
- HPF_Fs176400_Fc78_A0,
- -HPF_Fs176400_Fc78_B2,
- -HPF_Fs176400_Fc78_B1},
- {HPF_Fs192000_Fc78_A2, /* 192kS/s coefficients */
- HPF_Fs192000_Fc78_A1,
- HPF_Fs192000_Fc78_A0,
- -HPF_Fs192000_Fc78_B2,
- -HPF_Fs192000_Fc78_B1},
+ /* Coefficients for 78Hz centre frequency */
+ {HPF_Fs8000_Fc78_A2, /* 8kS/s coefficients */
+ HPF_Fs8000_Fc78_A1, HPF_Fs8000_Fc78_A0, -HPF_Fs8000_Fc78_B2, -HPF_Fs8000_Fc78_B1},
+ {HPF_Fs11025_Fc78_A2, /* 11kS/s coefficients */
+ HPF_Fs11025_Fc78_A1, HPF_Fs11025_Fc78_A0, -HPF_Fs11025_Fc78_B2, -HPF_Fs11025_Fc78_B1},
+ {HPF_Fs12000_Fc78_A2, /* 12kS/s coefficients */
+ HPF_Fs12000_Fc78_A1, HPF_Fs12000_Fc78_A0, -HPF_Fs12000_Fc78_B2, -HPF_Fs12000_Fc78_B1},
+ {HPF_Fs16000_Fc78_A2, /* 16kS/s coefficients */
+ HPF_Fs16000_Fc78_A1, HPF_Fs16000_Fc78_A0, -HPF_Fs16000_Fc78_B2, -HPF_Fs16000_Fc78_B1},
+ {HPF_Fs22050_Fc78_A2, /* 22kS/s coefficients */
+ HPF_Fs22050_Fc78_A1, HPF_Fs22050_Fc78_A0, -HPF_Fs22050_Fc78_B2, -HPF_Fs22050_Fc78_B1},
+ {HPF_Fs24000_Fc78_A2, /* 24kS/s coefficients */
+ HPF_Fs24000_Fc78_A1, HPF_Fs24000_Fc78_A0, -HPF_Fs24000_Fc78_B2, -HPF_Fs24000_Fc78_B1},
+ {HPF_Fs32000_Fc78_A2, /* 32kS/s coefficients */
+ HPF_Fs32000_Fc78_A1, HPF_Fs32000_Fc78_A0, -HPF_Fs32000_Fc78_B2, -HPF_Fs32000_Fc78_B1},
+ {HPF_Fs44100_Fc78_A2, /* 44kS/s coefficients */
+ HPF_Fs44100_Fc78_A1, HPF_Fs44100_Fc78_A0, -HPF_Fs44100_Fc78_B2, -HPF_Fs44100_Fc78_B1},
+ {HPF_Fs48000_Fc78_A2, /* 48kS/s coefficients */
+ HPF_Fs48000_Fc78_A1, HPF_Fs48000_Fc78_A0, -HPF_Fs48000_Fc78_B2, -HPF_Fs48000_Fc78_B1},
+ {HPF_Fs88200_Fc78_A2, /* 88kS/s coefficients */
+ HPF_Fs88200_Fc78_A1, HPF_Fs88200_Fc78_A0, -HPF_Fs88200_Fc78_B2, -HPF_Fs88200_Fc78_B1},
+ {HPF_Fs96000_Fc78_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc78_A1, HPF_Fs96000_Fc78_A0, -HPF_Fs96000_Fc78_B2, -HPF_Fs96000_Fc78_B1},
+ {HPF_Fs176400_Fc78_A2, /* 176kS/s coefficients */
+ HPF_Fs176400_Fc78_A1, HPF_Fs176400_Fc78_A0, -HPF_Fs176400_Fc78_B2, -HPF_Fs176400_Fc78_B1},
+ {HPF_Fs192000_Fc78_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc78_A1, HPF_Fs192000_Fc78_A0, -HPF_Fs192000_Fc78_B2, -HPF_Fs192000_Fc78_B1},
- /* Coefficients for 90Hz centre frequency */
- {HPF_Fs8000_Fc90_A2, /* 8kS/s coefficients */
- HPF_Fs8000_Fc90_A1,
- HPF_Fs8000_Fc90_A0,
- -HPF_Fs8000_Fc90_B2,
- -HPF_Fs8000_Fc90_B1},
- {HPF_Fs11025_Fc90_A2, /* 11kS/s coefficients */
- HPF_Fs11025_Fc90_A1,
- HPF_Fs11025_Fc90_A0,
- -HPF_Fs11025_Fc90_B2,
- -HPF_Fs11025_Fc90_B1},
- {HPF_Fs12000_Fc90_A2, /* 12kS/s coefficients */
- HPF_Fs12000_Fc90_A1,
- HPF_Fs12000_Fc90_A0,
- -HPF_Fs12000_Fc90_B2,
- -HPF_Fs12000_Fc90_B1},
- {HPF_Fs16000_Fc90_A2, /* 16kS/s coefficients */
- HPF_Fs16000_Fc90_A1,
- HPF_Fs16000_Fc90_A0,
- -HPF_Fs16000_Fc90_B2,
- -HPF_Fs16000_Fc90_B1},
- {HPF_Fs22050_Fc90_A2, /* 22kS/s coefficients */
- HPF_Fs22050_Fc90_A1,
- HPF_Fs22050_Fc90_A0,
- -HPF_Fs22050_Fc90_B2,
- -HPF_Fs22050_Fc90_B1},
- {HPF_Fs24000_Fc90_A2, /* 24kS/s coefficients */
- HPF_Fs24000_Fc90_A1,
- HPF_Fs24000_Fc90_A0,
- -HPF_Fs24000_Fc90_B2,
- -HPF_Fs24000_Fc90_B1},
- {HPF_Fs32000_Fc90_A2, /* 32kS/s coefficients */
- HPF_Fs32000_Fc90_A1,
- HPF_Fs32000_Fc90_A0,
- -HPF_Fs32000_Fc90_B2,
- -HPF_Fs32000_Fc90_B1},
- {HPF_Fs44100_Fc90_A2, /* 44kS/s coefficients */
- HPF_Fs44100_Fc90_A1,
- HPF_Fs44100_Fc90_A0,
- -HPF_Fs44100_Fc90_B2,
- -HPF_Fs44100_Fc90_B1},
- {HPF_Fs48000_Fc90_A2, /* 48kS/s coefficients */
- HPF_Fs48000_Fc90_A1,
- HPF_Fs48000_Fc90_A0,
- -HPF_Fs48000_Fc90_B2,
- -HPF_Fs48000_Fc90_B1}
+ /* Coefficients for 90Hz centre frequency */
+ {HPF_Fs8000_Fc90_A2, /* 8kS/s coefficients */
+ HPF_Fs8000_Fc90_A1, HPF_Fs8000_Fc90_A0, -HPF_Fs8000_Fc90_B2, -HPF_Fs8000_Fc90_B1},
+ {HPF_Fs11025_Fc90_A2, /* 11kS/s coefficients */
+ HPF_Fs11025_Fc90_A1, HPF_Fs11025_Fc90_A0, -HPF_Fs11025_Fc90_B2, -HPF_Fs11025_Fc90_B1},
+ {HPF_Fs12000_Fc90_A2, /* 12kS/s coefficients */
+ HPF_Fs12000_Fc90_A1, HPF_Fs12000_Fc90_A0, -HPF_Fs12000_Fc90_B2, -HPF_Fs12000_Fc90_B1},
+ {HPF_Fs16000_Fc90_A2, /* 16kS/s coefficients */
+ HPF_Fs16000_Fc90_A1, HPF_Fs16000_Fc90_A0, -HPF_Fs16000_Fc90_B2, -HPF_Fs16000_Fc90_B1},
+ {HPF_Fs22050_Fc90_A2, /* 22kS/s coefficients */
+ HPF_Fs22050_Fc90_A1, HPF_Fs22050_Fc90_A0, -HPF_Fs22050_Fc90_B2, -HPF_Fs22050_Fc90_B1},
+ {HPF_Fs24000_Fc90_A2, /* 24kS/s coefficients */
+ HPF_Fs24000_Fc90_A1, HPF_Fs24000_Fc90_A0, -HPF_Fs24000_Fc90_B2, -HPF_Fs24000_Fc90_B1},
+ {HPF_Fs32000_Fc90_A2, /* 32kS/s coefficients */
+ HPF_Fs32000_Fc90_A1, HPF_Fs32000_Fc90_A0, -HPF_Fs32000_Fc90_B2, -HPF_Fs32000_Fc90_B1},
+ {HPF_Fs44100_Fc90_A2, /* 44kS/s coefficients */
+ HPF_Fs44100_Fc90_A1, HPF_Fs44100_Fc90_A0, -HPF_Fs44100_Fc90_B2, -HPF_Fs44100_Fc90_B1},
+ {HPF_Fs48000_Fc90_A2, /* 48kS/s coefficients */
+ HPF_Fs48000_Fc90_A1, HPF_Fs48000_Fc90_A0, -HPF_Fs48000_Fc90_B2, -HPF_Fs48000_Fc90_B1}
- ,
- {HPF_Fs88200_Fc90_A2, /* 88kS/s coefficients */
- HPF_Fs88200_Fc90_A1,
- HPF_Fs88200_Fc90_A0,
- -HPF_Fs88200_Fc90_B2,
- -HPF_Fs88200_Fc90_B1},
- {HPF_Fs96000_Fc90_A2, /* 96kS/s coefficients */
- HPF_Fs96000_Fc90_A1,
- HPF_Fs96000_Fc90_A0,
- -HPF_Fs96000_Fc90_B2,
- -HPF_Fs96000_Fc90_B1},
- {HPF_Fs176400_Fc90_A2, /* 176kS/s coefficients */
- HPF_Fs176400_Fc90_A1,
- HPF_Fs176400_Fc90_A0,
- -HPF_Fs176400_Fc90_B2,
- -HPF_Fs176400_Fc90_B1},
- {HPF_Fs192000_Fc90_A2, /* 192kS/s coefficients */
- HPF_Fs192000_Fc90_A1,
- HPF_Fs192000_Fc90_A0,
- -HPF_Fs192000_Fc90_B2,
- -HPF_Fs192000_Fc90_B1}
+ ,
+ {HPF_Fs88200_Fc90_A2, /* 88kS/s coefficients */
+ HPF_Fs88200_Fc90_A1, HPF_Fs88200_Fc90_A0, -HPF_Fs88200_Fc90_B2, -HPF_Fs88200_Fc90_B1},
+ {HPF_Fs96000_Fc90_A2, /* 96kS/s coefficients */
+ HPF_Fs96000_Fc90_A1, HPF_Fs96000_Fc90_A0, -HPF_Fs96000_Fc90_B2, -HPF_Fs96000_Fc90_B1},
+ {HPF_Fs176400_Fc90_A2, /* 176kS/s coefficients */
+ HPF_Fs176400_Fc90_A1, HPF_Fs176400_Fc90_A0, -HPF_Fs176400_Fc90_B2, -HPF_Fs176400_Fc90_B1},
+ {HPF_Fs192000_Fc90_A2, /* 192kS/s coefficients */
+ HPF_Fs192000_Fc90_A1, HPF_Fs192000_Fc90_A0, -HPF_Fs192000_Fc90_B2, -HPF_Fs192000_Fc90_B1}
};
@@ -312,170 +156,117 @@
* Band Pass Filter coefficient table
*/
const BP_FLOAT_Coefs_t LVDBE_BPF_Table[] = {
- /* Coefficients for 55Hz centre frequency */
- {BPF_Fs8000_Fc55_A0, /* 8kS/s coefficients */
- -BPF_Fs8000_Fc55_B2,
- -BPF_Fs8000_Fc55_B1},
- {BPF_Fs11025_Fc55_A0, /* 11kS/s coefficients */
- -BPF_Fs11025_Fc55_B2,
- -BPF_Fs11025_Fc55_B1},
- {BPF_Fs12000_Fc55_A0, /* 12kS/s coefficients */
- -BPF_Fs12000_Fc55_B2,
- -BPF_Fs12000_Fc55_B1},
- {BPF_Fs16000_Fc55_A0, /* 16kS/s coefficients */
- -BPF_Fs16000_Fc55_B2,
- -BPF_Fs16000_Fc55_B1},
- {BPF_Fs22050_Fc55_A0, /* 22kS/s coefficients */
- -BPF_Fs22050_Fc55_B2,
- -BPF_Fs22050_Fc55_B1},
- {BPF_Fs24000_Fc55_A0, /* 24kS/s coefficients */
- -BPF_Fs24000_Fc55_B2,
- -BPF_Fs24000_Fc55_B1},
- {BPF_Fs32000_Fc55_A0, /* 32kS/s coefficients */
- -BPF_Fs32000_Fc55_B2,
- -BPF_Fs32000_Fc55_B1},
- {BPF_Fs44100_Fc55_A0, /* 44kS/s coefficients */
- -BPF_Fs44100_Fc55_B2,
- -BPF_Fs44100_Fc55_B1},
- {BPF_Fs48000_Fc55_A0, /* 48kS/s coefficients */
- -BPF_Fs48000_Fc55_B2,
- -BPF_Fs48000_Fc55_B1},
- {BPF_Fs88200_Fc55_A0, /* 88kS/s coefficients */
- -BPF_Fs88200_Fc55_B2,
- -BPF_Fs88200_Fc55_B1},
- {BPF_Fs96000_Fc55_A0, /* 96kS/s coefficients */
- -BPF_Fs96000_Fc55_B2,
- -BPF_Fs96000_Fc55_B1},
- {BPF_Fs176400_Fc55_A0, /* 176kS/s coefficients */
- -BPF_Fs176400_Fc55_B2,
- -BPF_Fs176400_Fc55_B1},
- {BPF_Fs192000_Fc55_A0, /* 192kS/s coefficients */
- -BPF_Fs192000_Fc55_B2,
- -BPF_Fs192000_Fc55_B1},
+ /* Coefficients for 55Hz centre frequency */
+ {BPF_Fs8000_Fc55_A0, /* 8kS/s coefficients */
+ -BPF_Fs8000_Fc55_B2, -BPF_Fs8000_Fc55_B1},
+ {BPF_Fs11025_Fc55_A0, /* 11kS/s coefficients */
+ -BPF_Fs11025_Fc55_B2, -BPF_Fs11025_Fc55_B1},
+ {BPF_Fs12000_Fc55_A0, /* 12kS/s coefficients */
+ -BPF_Fs12000_Fc55_B2, -BPF_Fs12000_Fc55_B1},
+ {BPF_Fs16000_Fc55_A0, /* 16kS/s coefficients */
+ -BPF_Fs16000_Fc55_B2, -BPF_Fs16000_Fc55_B1},
+ {BPF_Fs22050_Fc55_A0, /* 22kS/s coefficients */
+ -BPF_Fs22050_Fc55_B2, -BPF_Fs22050_Fc55_B1},
+ {BPF_Fs24000_Fc55_A0, /* 24kS/s coefficients */
+ -BPF_Fs24000_Fc55_B2, -BPF_Fs24000_Fc55_B1},
+ {BPF_Fs32000_Fc55_A0, /* 32kS/s coefficients */
+ -BPF_Fs32000_Fc55_B2, -BPF_Fs32000_Fc55_B1},
+ {BPF_Fs44100_Fc55_A0, /* 44kS/s coefficients */
+ -BPF_Fs44100_Fc55_B2, -BPF_Fs44100_Fc55_B1},
+ {BPF_Fs48000_Fc55_A0, /* 48kS/s coefficients */
+ -BPF_Fs48000_Fc55_B2, -BPF_Fs48000_Fc55_B1},
+ {BPF_Fs88200_Fc55_A0, /* 88kS/s coefficients */
+ -BPF_Fs88200_Fc55_B2, -BPF_Fs88200_Fc55_B1},
+ {BPF_Fs96000_Fc55_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc55_B2, -BPF_Fs96000_Fc55_B1},
+ {BPF_Fs176400_Fc55_A0, /* 176kS/s coefficients */
+ -BPF_Fs176400_Fc55_B2, -BPF_Fs176400_Fc55_B1},
+ {BPF_Fs192000_Fc55_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc55_B2, -BPF_Fs192000_Fc55_B1},
- /* Coefficients for 66Hz centre frequency */
- {BPF_Fs8000_Fc66_A0, /* 8kS/s coefficients */
- -BPF_Fs8000_Fc66_B2,
- -BPF_Fs8000_Fc66_B1},
- {BPF_Fs11025_Fc66_A0, /* 11kS/s coefficients */
- -BPF_Fs11025_Fc66_B2,
- -BPF_Fs11025_Fc66_B1},
- {BPF_Fs12000_Fc66_A0, /* 12kS/s coefficients */
- -BPF_Fs12000_Fc66_B2,
- -BPF_Fs12000_Fc66_B1},
- {BPF_Fs16000_Fc66_A0, /* 16kS/s coefficients */
- -BPF_Fs16000_Fc66_B2,
- -BPF_Fs16000_Fc66_B1},
- {BPF_Fs22050_Fc66_A0, /* 22kS/s coefficients */
- -BPF_Fs22050_Fc66_B2,
- -BPF_Fs22050_Fc66_B1},
- {BPF_Fs24000_Fc66_A0, /* 24kS/s coefficients */
- -BPF_Fs24000_Fc66_B2,
- -BPF_Fs24000_Fc66_B1},
- {BPF_Fs32000_Fc66_A0, /* 32kS/s coefficients */
- -BPF_Fs32000_Fc66_B2,
- -BPF_Fs32000_Fc66_B1},
- {BPF_Fs44100_Fc66_A0, /* 44kS/s coefficients */
- -BPF_Fs44100_Fc66_B2,
- -BPF_Fs44100_Fc66_B1},
- {BPF_Fs48000_Fc66_A0, /* 48kS/s coefficients */
- -BPF_Fs48000_Fc66_B2,
- -BPF_Fs48000_Fc66_B1},
- {BPF_Fs88200_Fc66_A0, /* 88kS/s coefficients */
- -BPF_Fs88200_Fc66_B2,
- -BPF_Fs88200_Fc66_B1},
- {BPF_Fs96000_Fc66_A0, /* 96kS/s coefficients */
- -BPF_Fs96000_Fc66_B2,
- -BPF_Fs96000_Fc66_B1},
- {BPF_Fs176400_Fc66_A0, /* 176kS/s coefficients */
- -BPF_Fs176400_Fc66_B2,
- -BPF_Fs176400_Fc66_B1},
- {BPF_Fs192000_Fc66_A0, /* 192kS/s coefficients */
- -BPF_Fs192000_Fc66_B2,
- -BPF_Fs192000_Fc66_B1},
+ /* Coefficients for 66Hz centre frequency */
+ {BPF_Fs8000_Fc66_A0, /* 8kS/s coefficients */
+ -BPF_Fs8000_Fc66_B2, -BPF_Fs8000_Fc66_B1},
+ {BPF_Fs11025_Fc66_A0, /* 11kS/s coefficients */
+ -BPF_Fs11025_Fc66_B2, -BPF_Fs11025_Fc66_B1},
+ {BPF_Fs12000_Fc66_A0, /* 12kS/s coefficients */
+ -BPF_Fs12000_Fc66_B2, -BPF_Fs12000_Fc66_B1},
+ {BPF_Fs16000_Fc66_A0, /* 16kS/s coefficients */
+ -BPF_Fs16000_Fc66_B2, -BPF_Fs16000_Fc66_B1},
+ {BPF_Fs22050_Fc66_A0, /* 22kS/s coefficients */
+ -BPF_Fs22050_Fc66_B2, -BPF_Fs22050_Fc66_B1},
+ {BPF_Fs24000_Fc66_A0, /* 24kS/s coefficients */
+ -BPF_Fs24000_Fc66_B2, -BPF_Fs24000_Fc66_B1},
+ {BPF_Fs32000_Fc66_A0, /* 32kS/s coefficients */
+ -BPF_Fs32000_Fc66_B2, -BPF_Fs32000_Fc66_B1},
+ {BPF_Fs44100_Fc66_A0, /* 44kS/s coefficients */
+ -BPF_Fs44100_Fc66_B2, -BPF_Fs44100_Fc66_B1},
+ {BPF_Fs48000_Fc66_A0, /* 48kS/s coefficients */
+ -BPF_Fs48000_Fc66_B2, -BPF_Fs48000_Fc66_B1},
+ {BPF_Fs88200_Fc66_A0, /* 88kS/s coefficients */
+ -BPF_Fs88200_Fc66_B2, -BPF_Fs88200_Fc66_B1},
+ {BPF_Fs96000_Fc66_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc66_B2, -BPF_Fs96000_Fc66_B1},
+ {BPF_Fs176400_Fc66_A0, /* 176kS/s coefficients */
+ -BPF_Fs176400_Fc66_B2, -BPF_Fs176400_Fc66_B1},
+ {BPF_Fs192000_Fc66_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc66_B2, -BPF_Fs192000_Fc66_B1},
- /* Coefficients for 78Hz centre frequency */
- {BPF_Fs8000_Fc78_A0, /* 8kS/s coefficients */
- -BPF_Fs8000_Fc78_B2,
- -BPF_Fs8000_Fc78_B1},
- {BPF_Fs11025_Fc78_A0, /* 11kS/s coefficients */
- -BPF_Fs11025_Fc78_B2,
- -BPF_Fs11025_Fc78_B1},
- {BPF_Fs12000_Fc78_A0, /* 12kS/s coefficients */
- -BPF_Fs12000_Fc78_B2,
- -BPF_Fs12000_Fc78_B1},
- {BPF_Fs16000_Fc78_A0, /* 16kS/s coefficients */
- -BPF_Fs16000_Fc78_B2,
- -BPF_Fs16000_Fc78_B1},
- {BPF_Fs22050_Fc78_A0, /* 22kS/s coefficients */
- -BPF_Fs22050_Fc78_B2,
- -BPF_Fs22050_Fc78_B1},
- {BPF_Fs24000_Fc78_A0, /* 24kS/s coefficients */
- -BPF_Fs24000_Fc78_B2,
- -BPF_Fs24000_Fc78_B1},
- {BPF_Fs32000_Fc78_A0, /* 32kS/s coefficients */
- -BPF_Fs32000_Fc78_B2,
- -BPF_Fs32000_Fc78_B1},
- {BPF_Fs44100_Fc78_A0, /* 44kS/s coefficients */
- -BPF_Fs44100_Fc78_B2,
- -BPF_Fs44100_Fc78_B1},
- {BPF_Fs48000_Fc78_A0, /* 48kS/s coefficients */
- -BPF_Fs48000_Fc78_B2,
- -BPF_Fs48000_Fc78_B1},
- {BPF_Fs88200_Fc66_A0, /* 88kS/s coefficients */
- -BPF_Fs88200_Fc66_B2,
- -BPF_Fs88200_Fc66_B1},
- {BPF_Fs96000_Fc78_A0, /* 96kS/s coefficients */
- -BPF_Fs96000_Fc78_B2,
- -BPF_Fs96000_Fc78_B1},
- {BPF_Fs176400_Fc66_A0, /* 176kS/s coefficients */
- -BPF_Fs176400_Fc66_B2,
- -BPF_Fs176400_Fc66_B1},
- {BPF_Fs192000_Fc78_A0, /* 192kS/s coefficients */
- -BPF_Fs192000_Fc78_B2,
- -BPF_Fs192000_Fc78_B1},
+ /* Coefficients for 78Hz centre frequency */
+ {BPF_Fs8000_Fc78_A0, /* 8kS/s coefficients */
+ -BPF_Fs8000_Fc78_B2, -BPF_Fs8000_Fc78_B1},
+ {BPF_Fs11025_Fc78_A0, /* 11kS/s coefficients */
+ -BPF_Fs11025_Fc78_B2, -BPF_Fs11025_Fc78_B1},
+ {BPF_Fs12000_Fc78_A0, /* 12kS/s coefficients */
+ -BPF_Fs12000_Fc78_B2, -BPF_Fs12000_Fc78_B1},
+ {BPF_Fs16000_Fc78_A0, /* 16kS/s coefficients */
+ -BPF_Fs16000_Fc78_B2, -BPF_Fs16000_Fc78_B1},
+ {BPF_Fs22050_Fc78_A0, /* 22kS/s coefficients */
+ -BPF_Fs22050_Fc78_B2, -BPF_Fs22050_Fc78_B1},
+ {BPF_Fs24000_Fc78_A0, /* 24kS/s coefficients */
+ -BPF_Fs24000_Fc78_B2, -BPF_Fs24000_Fc78_B1},
+ {BPF_Fs32000_Fc78_A0, /* 32kS/s coefficients */
+ -BPF_Fs32000_Fc78_B2, -BPF_Fs32000_Fc78_B1},
+ {BPF_Fs44100_Fc78_A0, /* 44kS/s coefficients */
+ -BPF_Fs44100_Fc78_B2, -BPF_Fs44100_Fc78_B1},
+ {BPF_Fs48000_Fc78_A0, /* 48kS/s coefficients */
+ -BPF_Fs48000_Fc78_B2, -BPF_Fs48000_Fc78_B1},
+ {BPF_Fs88200_Fc66_A0, /* 88kS/s coefficients */
+ -BPF_Fs88200_Fc66_B2, -BPF_Fs88200_Fc66_B1},
+ {BPF_Fs96000_Fc78_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc78_B2, -BPF_Fs96000_Fc78_B1},
+ {BPF_Fs176400_Fc66_A0, /* 176kS/s coefficients */
+ -BPF_Fs176400_Fc66_B2, -BPF_Fs176400_Fc66_B1},
+ {BPF_Fs192000_Fc78_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc78_B2, -BPF_Fs192000_Fc78_B1},
- /* Coefficients for 90Hz centre frequency */
- {BPF_Fs8000_Fc90_A0, /* 8kS/s coefficients */
- -BPF_Fs8000_Fc90_B2,
- -BPF_Fs8000_Fc90_B1},
- {BPF_Fs11025_Fc90_A0, /* 11kS/s coefficients */
- -BPF_Fs11025_Fc90_B2,
- -BPF_Fs11025_Fc90_B1},
- {BPF_Fs12000_Fc90_A0, /* 12kS/s coefficients */
- -BPF_Fs12000_Fc90_B2,
- -BPF_Fs12000_Fc90_B1},
- {BPF_Fs16000_Fc90_A0, /* 16kS/s coefficients */
- -BPF_Fs16000_Fc90_B2,
- -BPF_Fs16000_Fc90_B1},
- {BPF_Fs22050_Fc90_A0, /* 22kS/s coefficients */
- -BPF_Fs22050_Fc90_B2,
- -BPF_Fs22050_Fc90_B1},
- {BPF_Fs24000_Fc90_A0, /* 24kS/s coefficients */
- -BPF_Fs24000_Fc90_B2,
- -BPF_Fs24000_Fc90_B1},
- {BPF_Fs32000_Fc90_A0, /* 32kS/s coefficients */
- -BPF_Fs32000_Fc90_B2,
- -BPF_Fs32000_Fc90_B1},
- {BPF_Fs44100_Fc90_A0, /* 44kS/s coefficients */
- -BPF_Fs44100_Fc90_B2,
- -BPF_Fs44100_Fc90_B1},
- {BPF_Fs48000_Fc90_A0, /* 48kS/s coefficients */
- -BPF_Fs48000_Fc90_B2,
- -BPF_Fs48000_Fc90_B1}
- ,
- {BPF_Fs88200_Fc90_A0, /* 88kS/s coefficients */
- -BPF_Fs88200_Fc90_B2,
- -BPF_Fs88200_Fc90_B1},
- {BPF_Fs96000_Fc90_A0, /* 96kS/s coefficients */
- -BPF_Fs96000_Fc90_B2,
- -BPF_Fs96000_Fc90_B1},
- {BPF_Fs176400_Fc90_A0, /* 176kS/s coefficients */
- -BPF_Fs176400_Fc90_B2,
- -BPF_Fs176400_Fc90_B1},
- {BPF_Fs192000_Fc90_A0, /* 192kS/s coefficients */
- -BPF_Fs192000_Fc90_B2,
- -BPF_Fs192000_Fc90_B1}
+ /* Coefficients for 90Hz centre frequency */
+ {BPF_Fs8000_Fc90_A0, /* 8kS/s coefficients */
+ -BPF_Fs8000_Fc90_B2, -BPF_Fs8000_Fc90_B1},
+ {BPF_Fs11025_Fc90_A0, /* 11kS/s coefficients */
+ -BPF_Fs11025_Fc90_B2, -BPF_Fs11025_Fc90_B1},
+ {BPF_Fs12000_Fc90_A0, /* 12kS/s coefficients */
+ -BPF_Fs12000_Fc90_B2, -BPF_Fs12000_Fc90_B1},
+ {BPF_Fs16000_Fc90_A0, /* 16kS/s coefficients */
+ -BPF_Fs16000_Fc90_B2, -BPF_Fs16000_Fc90_B1},
+ {BPF_Fs22050_Fc90_A0, /* 22kS/s coefficients */
+ -BPF_Fs22050_Fc90_B2, -BPF_Fs22050_Fc90_B1},
+ {BPF_Fs24000_Fc90_A0, /* 24kS/s coefficients */
+ -BPF_Fs24000_Fc90_B2, -BPF_Fs24000_Fc90_B1},
+ {BPF_Fs32000_Fc90_A0, /* 32kS/s coefficients */
+ -BPF_Fs32000_Fc90_B2, -BPF_Fs32000_Fc90_B1},
+ {BPF_Fs44100_Fc90_A0, /* 44kS/s coefficients */
+ -BPF_Fs44100_Fc90_B2, -BPF_Fs44100_Fc90_B1},
+ {BPF_Fs48000_Fc90_A0, /* 48kS/s coefficients */
+ -BPF_Fs48000_Fc90_B2, -BPF_Fs48000_Fc90_B1},
+ {BPF_Fs88200_Fc90_A0, /* 88kS/s coefficients */
+ -BPF_Fs88200_Fc90_B2, -BPF_Fs88200_Fc90_B1},
+ {BPF_Fs96000_Fc90_A0, /* 96kS/s coefficients */
+ -BPF_Fs96000_Fc90_B2, -BPF_Fs96000_Fc90_B1},
+ {BPF_Fs176400_Fc90_A0, /* 176kS/s coefficients */
+ -BPF_Fs176400_Fc90_B2, -BPF_Fs176400_Fc90_B1},
+ {BPF_Fs192000_Fc90_A0, /* 192kS/s coefficients */
+ -BPF_Fs192000_Fc90_B2, -BPF_Fs192000_Fc90_B1}
};
@@ -487,77 +278,34 @@
/* Attack time (signal too large) */
const LVM_FLOAT LVDBE_AGC_ATTACK_Table[] = {
- AGC_ATTACK_Fs8000,
- AGC_ATTACK_Fs11025,
- AGC_ATTACK_Fs12000,
- AGC_ATTACK_Fs16000,
- AGC_ATTACK_Fs22050,
- AGC_ATTACK_Fs24000,
- AGC_ATTACK_Fs32000,
- AGC_ATTACK_Fs44100,
- AGC_ATTACK_Fs48000
- ,AGC_ATTACK_Fs88200
- ,AGC_ATTACK_Fs96000
- ,AGC_ATTACK_Fs176400
- ,AGC_ATTACK_Fs192000
+ AGC_ATTACK_Fs8000, AGC_ATTACK_Fs11025, AGC_ATTACK_Fs12000, AGC_ATTACK_Fs16000,
+ AGC_ATTACK_Fs22050, AGC_ATTACK_Fs24000, AGC_ATTACK_Fs32000, AGC_ATTACK_Fs44100,
+ AGC_ATTACK_Fs48000, AGC_ATTACK_Fs88200, AGC_ATTACK_Fs96000, AGC_ATTACK_Fs176400,
+ AGC_ATTACK_Fs192000
};
/* Decay time (signal too small) */
-const LVM_FLOAT LVDBE_AGC_DECAY_Table[] = {
- AGC_DECAY_Fs8000,
- AGC_DECAY_Fs11025,
- AGC_DECAY_Fs12000,
- AGC_DECAY_Fs16000,
- AGC_DECAY_Fs22050,
- AGC_DECAY_Fs24000,
- AGC_DECAY_Fs32000,
- AGC_DECAY_Fs44100,
- AGC_DECAY_Fs48000
- ,AGC_DECAY_Fs88200
- ,AGC_DECAY_FS96000
- ,AGC_DECAY_Fs176400
- ,AGC_DECAY_FS192000
+const LVM_FLOAT LVDBE_AGC_DECAY_Table[] = {AGC_DECAY_Fs8000, AGC_DECAY_Fs11025, AGC_DECAY_Fs12000,
+ AGC_DECAY_Fs16000, AGC_DECAY_Fs22050, AGC_DECAY_Fs24000,
+ AGC_DECAY_Fs32000, AGC_DECAY_Fs44100, AGC_DECAY_Fs48000,
+ AGC_DECAY_Fs88200, AGC_DECAY_FS96000, AGC_DECAY_Fs176400,
+ AGC_DECAY_FS192000
};
/* Gain for use without the high pass filter */
const LVM_FLOAT LVDBE_AGC_GAIN_Table[] = {
- AGC_GAIN_0dB,
- AGC_GAIN_1dB,
- AGC_GAIN_2dB,
- AGC_GAIN_3dB,
- AGC_GAIN_4dB,
- AGC_GAIN_5dB,
- AGC_GAIN_6dB,
- AGC_GAIN_7dB,
- AGC_GAIN_8dB,
- AGC_GAIN_9dB,
- AGC_GAIN_10dB,
- AGC_GAIN_11dB,
- AGC_GAIN_12dB,
- AGC_GAIN_13dB,
- AGC_GAIN_14dB,
- AGC_GAIN_15dB};
+ AGC_GAIN_0dB, AGC_GAIN_1dB, AGC_GAIN_2dB, AGC_GAIN_3dB, AGC_GAIN_4dB, AGC_GAIN_5dB,
+ AGC_GAIN_6dB, AGC_GAIN_7dB, AGC_GAIN_8dB, AGC_GAIN_9dB, AGC_GAIN_10dB, AGC_GAIN_11dB,
+ AGC_GAIN_12dB, AGC_GAIN_13dB, AGC_GAIN_14dB, AGC_GAIN_15dB};
/* Gain for use with the high pass filter */
const LVM_FLOAT LVDBE_AGC_HPFGAIN_Table[] = {
- AGC_HPFGAIN_0dB,
- AGC_HPFGAIN_1dB,
- AGC_HPFGAIN_2dB,
- AGC_HPFGAIN_3dB,
- AGC_HPFGAIN_4dB,
- AGC_HPFGAIN_5dB,
- AGC_HPFGAIN_6dB,
- AGC_HPFGAIN_7dB,
- AGC_HPFGAIN_8dB,
- AGC_HPFGAIN_9dB,
- AGC_HPFGAIN_10dB,
- AGC_HPFGAIN_11dB,
- AGC_HPFGAIN_12dB,
- AGC_HPFGAIN_13dB,
- AGC_HPFGAIN_14dB,
- AGC_HPFGAIN_15dB};
+ AGC_HPFGAIN_0dB, AGC_HPFGAIN_1dB, AGC_HPFGAIN_2dB, AGC_HPFGAIN_3dB,
+ AGC_HPFGAIN_4dB, AGC_HPFGAIN_5dB, AGC_HPFGAIN_6dB, AGC_HPFGAIN_7dB,
+ AGC_HPFGAIN_8dB, AGC_HPFGAIN_9dB, AGC_HPFGAIN_10dB, AGC_HPFGAIN_11dB,
+ AGC_HPFGAIN_12dB, AGC_HPFGAIN_13dB, AGC_HPFGAIN_14dB, AGC_HPFGAIN_15dB};
/************************************************************************************/
/* */
@@ -566,45 +314,23 @@
/************************************************************************************/
/* dB to linear conversion table */
-const LVM_FLOAT LVDBE_VolumeTable[] = {
- 0.500000f, /* -6dB */
- 0.562341f, /* -5dB */
- 0.630957f, /* -4dB */
- 0.707946f, /* -3dB */
- 0.794328f, /* -2dB */
- 0.891251f, /* -1dB */
- 1.000000f}; /* 0dB */
+const LVM_FLOAT LVDBE_VolumeTable[] = {0.500000f, /* -6dB */
+ 0.562341f, /* -5dB */
+ 0.630957f, /* -4dB */
+ 0.707946f, /* -3dB */
+ 0.794328f, /* -2dB */
+ 0.891251f, /* -1dB */
+ 1.000000f}; /* 0dB */
const LVM_FLOAT LVDBE_VolumeTCTable[] = {
- VOL_TC_Fs8000,
- VOL_TC_Fs11025,
- VOL_TC_Fs12000,
- VOL_TC_Fs16000,
- VOL_TC_Fs22050,
- VOL_TC_Fs24000,
- VOL_TC_Fs32000,
- VOL_TC_Fs44100,
- VOL_TC_Fs48000
- ,VOL_TC_Fs88200
- ,VOL_TC_Fs96000
- ,VOL_TC_Fs176400
- ,VOL_TC_Fs192000
-};
+ VOL_TC_Fs8000, VOL_TC_Fs11025, VOL_TC_Fs12000, VOL_TC_Fs16000, VOL_TC_Fs22050,
+ VOL_TC_Fs24000, VOL_TC_Fs32000, VOL_TC_Fs44100, VOL_TC_Fs48000, VOL_TC_Fs88200,
+ VOL_TC_Fs96000, VOL_TC_Fs176400, VOL_TC_Fs192000};
const LVM_INT16 LVDBE_MixerTCTable[] = {
- MIX_TC_Fs8000,
- MIX_TC_Fs11025,
- MIX_TC_Fs12000,
- MIX_TC_Fs16000,
- MIX_TC_Fs22050,
- MIX_TC_Fs24000,
- MIX_TC_Fs32000,
- MIX_TC_Fs44100,
- MIX_TC_Fs48000
- ,MIX_TC_Fs88200
- ,MIX_TC_Fs96000
- ,MIX_TC_Fs176400
- ,MIX_TC_Fs192000
+ MIX_TC_Fs8000, MIX_TC_Fs11025, MIX_TC_Fs12000, MIX_TC_Fs16000, MIX_TC_Fs22050,
+ MIX_TC_Fs24000, MIX_TC_Fs32000, MIX_TC_Fs44100, MIX_TC_Fs48000, MIX_TC_Fs88200,
+ MIX_TC_Fs96000, MIX_TC_Fs176400, MIX_TC_Fs192000
};
diff --git a/media/libeffects/lvm/lib/Bundle/lib/LVM.h b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
index 783c3a0..c90c5cc 100644
--- a/media/libeffects/lvm/lib/Bundle/lib/LVM.h
+++ b/media/libeffects/lvm/lib/Bundle/lib/LVM.h
@@ -68,27 +68,27 @@
/****************************************************************************************/
/* Concert Sound effect level presets */
-#define LVM_CS_EFFECT_NONE 0 /* 0% effect, minimum value */
-#define LVM_CS_EFFECT_LOW 16384 /* 50% effect */
-#define LVM_CS_EFFECT_MED 24576 /* 75% effect */
-#define LVM_CS_EFFECT_HIGH 32767 /* 100% effect, maximum value */
+#define LVM_CS_EFFECT_NONE 0 /* 0% effect, minimum value */
+#define LVM_CS_EFFECT_LOW 16384 /* 50% effect */
+#define LVM_CS_EFFECT_MED 24576 /* 75% effect */
+#define LVM_CS_EFFECT_HIGH 32767 /* 100% effect, maximum value */
/* Treble enhancement */
-#define LVM_TE_LOW_MIPS 32767
+#define LVM_TE_LOW_MIPS 32767
/* Bass enhancement effect level presets */
-#define LVM_BE_0DB 0 /* 0dB boost, no effect */
-#define LVM_BE_3DB 3 /* +3dB boost */
-#define LVM_BE_6DB 6 /* +6dB boost */
-#define LVM_BE_9DB 9 /* +9dB boost */
-#define LVM_BE_12DB 12 /* +12dB boost */
-#define LVM_BE_15DB 15 /* +15dB boost */
+#define LVM_BE_0DB 0 /* 0dB boost, no effect */
+#define LVM_BE_3DB 3 /* +3dB boost */
+#define LVM_BE_6DB 6 /* +6dB boost */
+#define LVM_BE_9DB 9 /* +9dB boost */
+#define LVM_BE_12DB 12 /* +12dB boost */
+#define LVM_BE_15DB 15 /* +15dB boost */
/* N-Band Equalizer */
-#define LVM_EQ_NBANDS 5 /* Number of bands for equalizer */
+#define LVM_EQ_NBANDS 5 /* Number of bands for equalizer */
/* Headroom management */
-#define LVM_HEADROOM_MAX_NBANDS 5
+#define LVM_HEADROOM_MAX_NBANDS 5
/****************************************************************************************/
/* */
@@ -97,123 +97,89 @@
/****************************************************************************************/
/* Instance handle */
-typedef void *LVM_Handle_t;
+typedef void* LVM_Handle_t;
/* Status return values */
-typedef enum
-{
- LVM_SUCCESS = 0, /* Successful return from a routine */
- LVM_ALIGNMENTERROR = 1, /* Memory alignment error */
- LVM_NULLADDRESS = 2, /* NULL allocation address */
- LVM_OUTOFRANGE = 3, /* Out of range control parameter */
- LVM_INVALIDNUMSAMPLES = 4, /* Invalid number of samples */
- LVM_WRONGAUDIOTIME = 5, /* Wrong time value for audio time*/
- LVM_ALGORITHMDISABLED = 6, /* Algorithm is disabled*/
- LVM_ALGORITHMPSA = 7, /* Algorithm PSA returns an error */
+typedef enum {
+ LVM_SUCCESS = 0, /* Successful return from a routine */
+ LVM_ALIGNMENTERROR = 1, /* Memory alignment error */
+ LVM_NULLADDRESS = 2, /* NULL allocation address */
+ LVM_OUTOFRANGE = 3, /* Out of range control parameter */
+ LVM_INVALIDNUMSAMPLES = 4, /* Invalid number of samples */
+ LVM_WRONGAUDIOTIME = 5, /* Wrong time value for audio time*/
+ LVM_ALGORITHMDISABLED = 6, /* Algorithm is disabled*/
+ LVM_ALGORITHMPSA = 7, /* Algorithm PSA returns an error */
LVM_RETURNSTATUS_DUMMY = LVM_MAXENUM
} LVM_ReturnStatus_en;
/* Buffer Management mode */
-typedef enum
-{
- LVM_MANAGED_BUFFERS = 0,
+typedef enum {
+ LVM_MANAGED_BUFFERS = 0,
LVM_UNMANAGED_BUFFERS = 1,
- LVM_BUFFERS_DUMMY = LVM_MAXENUM
+ LVM_BUFFERS_DUMMY = LVM_MAXENUM
} LVM_BufferMode_en;
/* Output device type */
-typedef enum
-{
- LVM_HEADPHONES = 0,
- LVM_EX_HEADPHONES = 1,
- LVM_SPEAKERTYPE_MAX = LVM_MAXENUM
+typedef enum {
+ LVM_HEADPHONES = 0,
+ LVM_EX_HEADPHONES = 1,
+ LVM_SPEAKERTYPE_MAX = LVM_MAXENUM
} LVM_OutputDeviceType_en;
/* Virtualizer mode selection*/
-typedef enum
-{
- LVM_CONCERTSOUND = 0,
- LVM_VIRTUALIZERTYPE_DUMMY = LVM_MAXENUM
+typedef enum {
+ LVM_CONCERTSOUND = 0,
+ LVM_VIRTUALIZERTYPE_DUMMY = LVM_MAXENUM
} LVM_VirtualizerType_en;
/* N-Band Equaliser operating mode */
-typedef enum
-{
- LVM_EQNB_OFF = 0,
- LVM_EQNB_ON = 1,
- LVM_EQNB_DUMMY = LVM_MAXENUM
-} LVM_EQNB_Mode_en;
+typedef enum { LVM_EQNB_OFF = 0, LVM_EQNB_ON = 1, LVM_EQNB_DUMMY = LVM_MAXENUM } LVM_EQNB_Mode_en;
/* Bass Enhancement operating mode */
-typedef enum
-{
- LVM_BE_OFF = 0,
- LVM_BE_ON = 1,
- LVM_BE_DUMMY = LVM_MAXENUM
-} LVM_BE_Mode_en;
+typedef enum { LVM_BE_OFF = 0, LVM_BE_ON = 1, LVM_BE_DUMMY = LVM_MAXENUM } LVM_BE_Mode_en;
/* Bass Enhancement centre frequency selection control */
-typedef enum
-{
- LVM_BE_CENTRE_55Hz = 0,
- LVM_BE_CENTRE_66Hz = 1,
- LVM_BE_CENTRE_78Hz = 2,
- LVM_BE_CENTRE_90Hz = 3,
+typedef enum {
+ LVM_BE_CENTRE_55Hz = 0,
+ LVM_BE_CENTRE_66Hz = 1,
+ LVM_BE_CENTRE_78Hz = 2,
+ LVM_BE_CENTRE_90Hz = 3,
LVM_BE_CENTRE_DUMMY = LVM_MAXENUM
} LVM_BE_CentreFreq_en;
/* Bass Enhancement HPF selection control */
-typedef enum
-{
- LVM_BE_HPF_OFF = 0,
- LVM_BE_HPF_ON = 1,
+typedef enum {
+ LVM_BE_HPF_OFF = 0,
+ LVM_BE_HPF_ON = 1,
LVM_BE_HPF_DUMMY = LVM_MAXENUM
} LVM_BE_FilterSelect_en;
/* Volume Control operating mode */
-typedef enum
-{
- LVM_VC_OFF = 0,
- LVM_VC_ON = 1,
- LVM_VC_DUMMY = LVM_MAXENUM
-} LVM_VC_Mode_en;
+typedef enum { LVM_VC_OFF = 0, LVM_VC_ON = 1, LVM_VC_DUMMY = LVM_MAXENUM } LVM_VC_Mode_en;
/* Treble Enhancement operating mode */
-typedef enum
-{
- LVM_TE_OFF = 0,
- LVM_TE_ON = 1,
- LVM_TE_DUMMY = LVM_MAXENUM
-} LVM_TE_Mode_en;
+typedef enum { LVM_TE_OFF = 0, LVM_TE_ON = 1, LVM_TE_DUMMY = LVM_MAXENUM } LVM_TE_Mode_en;
/* Headroom management operating mode */
-typedef enum
-{
- LVM_HEADROOM_OFF = 0,
- LVM_HEADROOM_ON = 1,
+typedef enum {
+ LVM_HEADROOM_OFF = 0,
+ LVM_HEADROOM_ON = 1,
LVM_Headroom_DUMMY = LVM_MAXENUM
} LVM_Headroom_Mode_en;
-typedef enum
-{
- LVM_PSA_SPEED_SLOW, /* Peak decaying at slow speed */
- LVM_PSA_SPEED_MEDIUM, /* Peak decaying at medium speed */
- LVM_PSA_SPEED_FAST, /* Peak decaying at fast speed */
+typedef enum {
+ LVM_PSA_SPEED_SLOW, /* Peak decaying at slow speed */
+ LVM_PSA_SPEED_MEDIUM, /* Peak decaying at medium speed */
+ LVM_PSA_SPEED_FAST, /* Peak decaying at fast speed */
LVM_PSA_SPEED_DUMMY = LVM_MAXENUM
} LVM_PSA_DecaySpeed_en;
-typedef enum
-{
- LVM_PSA_OFF = 0,
- LVM_PSA_ON = 1,
- LVM_PSA_DUMMY = LVM_MAXENUM
-} LVM_PSA_Mode_en;
+typedef enum { LVM_PSA_OFF = 0, LVM_PSA_ON = 1, LVM_PSA_DUMMY = LVM_MAXENUM } LVM_PSA_Mode_en;
/* Version information */
-typedef struct
-{
- LVM_CHAR *pVersionNumber; /* Pointer to the version number in the format X.YY.ZZ */
- LVM_CHAR *pPlatform; /* Pointer to the library platform type */
+typedef struct {
+ LVM_CHAR* pVersionNumber; /* Pointer to the version number in the format X.YY.ZZ */
+ LVM_CHAR* pPlatform; /* Pointer to the library platform type */
} LVM_VersionInfo_st;
/****************************************************************************************/
@@ -223,84 +189,79 @@
/****************************************************************************************/
/* N-Band equaliser band definition */
-typedef struct
-{
- LVM_INT16 Gain; /* Band gain in dB */
- LVM_UINT16 Frequency; /* Band centre frequency in Hz */
- LVM_UINT16 QFactor; /* Band quality factor (x100) */
+typedef struct {
+ LVM_INT16 Gain; /* Band gain in dB */
+ LVM_UINT16 Frequency; /* Band centre frequency in Hz */
+ LVM_UINT16 QFactor; /* Band quality factor (x100) */
} LVM_EQNB_BandDef_t;
/* Headroom band definition */
-typedef struct
-{
- LVM_UINT16 Limit_Low; /* Low frequency limit of the band in Hertz */
- LVM_UINT16 Limit_High; /* High frequency limit of the band in Hertz */
- LVM_INT16 Headroom_Offset; /* Headroom = biggest band gain - Headroom_Offset */
+typedef struct {
+ LVM_UINT16 Limit_Low; /* Low frequency limit of the band in Hertz */
+ LVM_UINT16 Limit_High; /* High frequency limit of the band in Hertz */
+ LVM_INT16 Headroom_Offset; /* Headroom = biggest band gain - Headroom_Offset */
} LVM_HeadroomBandDef_t;
/* Control Parameter structure */
-typedef struct
-{
+typedef struct {
/* General parameters */
- LVM_Mode_en OperatingMode; /* Bundle operating mode On/Bypass */
- LVM_Fs_en SampleRate; /* Sample rate */
- LVM_Format_en SourceFormat; /* Input data format */
- LVM_OutputDeviceType_en SpeakerType; /* Output device type */
+ LVM_Mode_en OperatingMode; /* Bundle operating mode On/Bypass */
+ LVM_Fs_en SampleRate; /* Sample rate */
+ LVM_Format_en SourceFormat; /* Input data format */
+ LVM_OutputDeviceType_en SpeakerType; /* Output device type */
/* Concert Sound Virtualizer parameters*/
- LVM_Mode_en VirtualizerOperatingMode; /* Virtualizer operating mode On/Off */
- LVM_VirtualizerType_en VirtualizerType; /* Virtualizer type: ConcertSound */
- LVM_UINT16 VirtualizerReverbLevel; /* Virtualizer reverb level in % */
- LVM_INT16 CS_EffectLevel; /* Concert Sound effect level */
+ LVM_Mode_en VirtualizerOperatingMode; /* Virtualizer operating mode On/Off */
+ LVM_VirtualizerType_en VirtualizerType; /* Virtualizer type: ConcertSound */
+ LVM_UINT16 VirtualizerReverbLevel; /* Virtualizer reverb level in % */
+ LVM_INT16 CS_EffectLevel; /* Concert Sound effect level */
/* N-Band Equaliser parameters */
- LVM_EQNB_Mode_en EQNB_OperatingMode; /* N-Band Equaliser operating mode */
- LVM_UINT16 EQNB_NBands; /* Number of bands */
- LVM_EQNB_BandDef_t *pEQNB_BandDefinition; /* Pointer to equaliser definitions */
+ LVM_EQNB_Mode_en EQNB_OperatingMode; /* N-Band Equaliser operating mode */
+ LVM_UINT16 EQNB_NBands; /* Number of bands */
+ LVM_EQNB_BandDef_t* pEQNB_BandDefinition; /* Pointer to equaliser definitions */
/* Bass Enhancement parameters */
- LVM_BE_Mode_en BE_OperatingMode; /* Bass Enhancement operating mode */
- LVM_INT16 BE_EffectLevel; /* Bass Enhancement effect level */
- LVM_BE_CentreFreq_en BE_CentreFreq; /* Bass Enhancement centre frequency */
- LVM_BE_FilterSelect_en BE_HPF; /* Bass Enhancement high pass filter selector */
+ LVM_BE_Mode_en BE_OperatingMode; /* Bass Enhancement operating mode */
+ LVM_INT16 BE_EffectLevel; /* Bass Enhancement effect level */
+ LVM_BE_CentreFreq_en BE_CentreFreq; /* Bass Enhancement centre frequency */
+ LVM_BE_FilterSelect_en BE_HPF; /* Bass Enhancement high pass filter selector */
/* Volume Control parameters */
- LVM_INT16 VC_EffectLevel; /* Volume Control setting in dBs */
- LVM_INT16 VC_Balance; /* Left Right Balance control in dB (-96 to 96 dB), -ve values reduce
- Right channel while +ve value reduces Left channel*/
+ LVM_INT16 VC_EffectLevel; /* Volume Control setting in dBs */
+ LVM_INT16 VC_Balance; /* Left Right Balance control in dB (-96 to 96 dB), -ve values reduce
+ Right channel while +ve value reduces Left channel*/
/* Treble Enhancement parameters */
- LVM_TE_Mode_en TE_OperatingMode; /* Treble Enhancement On/Off */
- LVM_INT16 TE_EffectLevel; /* Treble Enhancement gain dBs */
+ LVM_TE_Mode_en TE_OperatingMode; /* Treble Enhancement On/Off */
+ LVM_INT16 TE_EffectLevel; /* Treble Enhancement gain dBs */
/* Spectrum Analyzer parameters Control */
- LVM_PSA_Mode_en PSA_Enable;
- LVM_PSA_DecaySpeed_en PSA_PeakDecayRate; /* Peak value decay rate*/
- LVM_INT32 NrChannels;
- LVM_INT32 ChMask;
+ LVM_PSA_Mode_en PSA_Enable;
+ LVM_PSA_DecaySpeed_en PSA_PeakDecayRate; /* Peak value decay rate*/
+ LVM_INT32 NrChannels;
+ LVM_INT32 ChMask;
} LVM_ControlParams_t;
/* Instance Parameter structure */
-typedef struct
-{
+typedef struct {
/* General */
- LVM_BufferMode_en BufferMode; /* Buffer management mode */
- LVM_UINT16 MaxBlockSize; /* Maximum processing block size */
+ LVM_BufferMode_en BufferMode; /* Buffer management mode */
+ LVM_UINT16 MaxBlockSize; /* Maximum processing block size */
/* N-Band Equaliser */
- LVM_UINT16 EQNB_NumBands; /* Maximum number of equaliser bands */
+ LVM_UINT16 EQNB_NumBands; /* Maximum number of equaliser bands */
/* PSA */
- LVM_PSA_Mode_en PSA_Included; /* Controls the instance memory allocation for PSA: ON/OFF */
+ LVM_PSA_Mode_en PSA_Included; /* Controls the instance memory allocation for PSA: ON/OFF */
} LVM_InstParams_t;
/* Headroom management parameter structure */
-typedef struct
-{
- LVM_Headroom_Mode_en Headroom_OperatingMode; /* Headroom Control On/Off */
- LVM_HeadroomBandDef_t *pHeadroomDefinition; /* Pointer to headroom bands definition */
- LVM_UINT16 NHeadroomBands; /* Number of headroom bands */
+typedef struct {
+ LVM_Headroom_Mode_en Headroom_OperatingMode; /* Headroom Control On/Off */
+ LVM_HeadroomBandDef_t* pHeadroomDefinition; /* Pointer to headroom bands definition */
+ LVM_UINT16 NHeadroomBands; /* Number of headroom bands */
} LVM_HeadroomParams_t;
@@ -328,7 +289,7 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetVersionInfo(LVM_VersionInfo_st *pVersion);
+LVM_ReturnStatus_en LVM_GetVersionInfo(LVM_VersionInfo_st* pVersion);
/****************************************************************************************/
/* */
@@ -351,8 +312,7 @@
/* 1. This function must not be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetInstanceHandle(LVM_Handle_t *phInstance,
- LVM_InstParams_t *pInstParams);
+LVM_ReturnStatus_en LVM_GetInstanceHandle(LVM_Handle_t* phInstance, LVM_InstParams_t* pInstParams);
/****************************************************************************************/
/* */
@@ -369,7 +329,7 @@
/* 1. This function must not be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-void LVM_DelInstanceHandle(LVM_Handle_t *phInstance);
+void LVM_DelInstanceHandle(LVM_Handle_t* phInstance);
/****************************************************************************************/
/* */
@@ -389,7 +349,7 @@
/* 1. This function must not be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_ClearAudioBuffers(LVM_Handle_t hInstance);
+LVM_ReturnStatus_en LVM_ClearAudioBuffers(LVM_Handle_t hInstance);
/****************************************************************************************/
/* */
@@ -411,8 +371,7 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetControlParameters(LVM_Handle_t hInstance,
- LVM_ControlParams_t *pParams);
+LVM_ReturnStatus_en LVM_GetControlParameters(LVM_Handle_t hInstance, LVM_ControlParams_t* pParams);
/****************************************************************************************/
/* */
@@ -434,8 +393,7 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_SetControlParameters(LVM_Handle_t hInstance,
- LVM_ControlParams_t *pParams);
+LVM_ReturnStatus_en LVM_SetControlParameters(LVM_Handle_t hInstance, LVM_ControlParams_t* pParams);
/****************************************************************************************/
/* */
@@ -467,11 +425,8 @@
/* STEREO the number of sample pairs in the block */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples,
- LVM_UINT32 AudioTime);
+LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, LVM_UINT16 NumSamples, LVM_UINT32 AudioTime);
/****************************************************************************************/
/* */
@@ -492,8 +447,8 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_SetHeadroomParams( LVM_Handle_t hInstance,
- LVM_HeadroomParams_t *pHeadroomParams);
+LVM_ReturnStatus_en LVM_SetHeadroomParams(LVM_Handle_t hInstance,
+ LVM_HeadroomParams_t* pHeadroomParams);
/****************************************************************************************/
/* */
@@ -514,8 +469,8 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetHeadroomParams( LVM_Handle_t hInstance,
- LVM_HeadroomParams_t *pHeadroomParams);
+LVM_ReturnStatus_en LVM_GetHeadroomParams(LVM_Handle_t hInstance,
+ LVM_HeadroomParams_t* pHeadroomParams);
/****************************************************************************************/
/* */
@@ -542,10 +497,8 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetSpectrum( LVM_Handle_t hInstance,
- LVM_UINT8 *pCurrentPeaks,
- LVM_UINT8 *pPastPeaks,
- LVM_INT32 AudioTime);
+LVM_ReturnStatus_en LVM_GetSpectrum(LVM_Handle_t hInstance, LVM_UINT8* pCurrentPeaks,
+ LVM_UINT8* pPastPeaks, LVM_INT32 AudioTime);
/****************************************************************************************/
/* */
@@ -567,8 +520,6 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_SetVolumeNoSmoothing( LVM_Handle_t hInstance,
- LVM_ControlParams_t *pParams);
+LVM_ReturnStatus_en LVM_SetVolumeNoSmoothing(LVM_Handle_t hInstance, LVM_ControlParams_t* pParams);
-#endif /* __LVM_H__ */
-
+#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 e241cdd..cea964c 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.cpp
@@ -47,69 +47,52 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetSpectrum(
- LVM_Handle_t hInstance,
- LVM_UINT8 *pCurrentPeaks,
- LVM_UINT8 *pPastPeaks,
- LVM_INT32 AudioTime
- )
-{
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+LVM_ReturnStatus_en LVM_GetSpectrum(LVM_Handle_t hInstance, LVM_UINT8* pCurrentPeaks,
+ LVM_UINT8* pPastPeaks, LVM_INT32 AudioTime) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
- pLVPSA_Handle_t *hPSAInstance;
- LVPSA_RETURN LVPSA_Status;
+ pLVPSA_Handle_t* hPSAInstance;
+ LVPSA_RETURN LVPSA_Status;
- if(pInstance == LVM_NULL)
- {
+ if (pInstance == LVM_NULL) {
return LVM_NULLADDRESS;
}
/*If PSA is not included at the time of instance creation, return without any processing*/
- if(pInstance->InstParams.PSA_Included!=LVM_PSA_ON)
- {
+ if (pInstance->InstParams.PSA_Included != LVM_PSA_ON) {
return LVM_SUCCESS;
}
- hPSAInstance = (pLVPSA_Handle_t *)pInstance->hPSAInstance;
+ hPSAInstance = (pLVPSA_Handle_t*)pInstance->hPSAInstance;
- if((pCurrentPeaks == LVM_NULL) ||
- (pPastPeaks == LVM_NULL))
- {
+ if ((pCurrentPeaks == LVM_NULL) || (pPastPeaks == LVM_NULL)) {
return LVM_NULLADDRESS;
}
/*
* Update new parameters if necessary
*/
- if (pInstance->ControlPending == LVM_TRUE)
- {
+ if (pInstance->ControlPending == LVM_TRUE) {
LVM_ApplyNewSettings(hInstance);
}
/* If PSA module is disabled, do nothing */
- if(pInstance->Params.PSA_Enable==LVM_PSA_OFF)
- {
+ if (pInstance->Params.PSA_Enable == LVM_PSA_OFF) {
return LVM_ALGORITHMDISABLED;
}
- LVPSA_Status = LVPSA_GetSpectrum(hPSAInstance,
- (LVPSA_Time) (AudioTime),
- (LVM_UINT8*) pCurrentPeaks,
- (LVM_UINT8*) pPastPeaks );
+ LVPSA_Status = LVPSA_GetSpectrum(hPSAInstance, (LVPSA_Time)(AudioTime),
+ (LVM_UINT8*)pCurrentPeaks, (LVM_UINT8*)pPastPeaks);
- if(LVPSA_Status != LVPSA_OK)
- {
- if(LVPSA_Status == LVPSA_ERROR_WRONGTIME)
- {
- return (LVM_ReturnStatus_en) LVM_WRONGAUDIOTIME;
- }
- else
- {
- return (LVM_ReturnStatus_en) LVM_NULLADDRESS;
+ if (LVPSA_Status != LVPSA_OK) {
+ if (LVPSA_Status == LVPSA_ERROR_WRONGTIME) {
+ return (LVM_ReturnStatus_en)LVM_WRONGAUDIOTIME;
+ } else {
+ return (LVM_ReturnStatus_en)LVM_NULLADDRESS;
}
}
- return(LVM_SUCCESS);
+ return (LVM_SUCCESS);
}
/****************************************************************************************/
@@ -132,15 +115,12 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_SetVolumeNoSmoothing( LVM_Handle_t hInstance,
- LVM_ControlParams_t *pParams)
-{
- LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
+LVM_ReturnStatus_en LVM_SetVolumeNoSmoothing(LVM_Handle_t hInstance, LVM_ControlParams_t* pParams) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
LVM_ReturnStatus_en Error;
/*Apply new controls*/
- Error = LVM_SetControlParameters(hInstance,pParams);
+ Error = LVM_SetControlParameters(hInstance, pParams);
pInstance->NoSmoothVolume = LVM_TRUE;
return Error;
}
-
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
index 4c25ce0..fbb0fe1 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.cpp
@@ -49,105 +49,90 @@
/* NOTES: */
/* */
/****************************************************************************************/
-void LVM_BufferManagedIn(LVM_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT **pToProcess,
- LVM_FLOAT **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_FLOAT *pStart;
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_Buffer_t *pBuffer;
- LVM_FLOAT *pDest;
- LVM_INT16 NumChannels = pInstance->NrChannels;
+void LVM_BufferManagedIn(LVM_Handle_t hInstance, const LVM_FLOAT* pInData, LVM_FLOAT** pToProcess,
+ LVM_FLOAT** 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_FLOAT* pStart;
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
+ LVM_Buffer_t* pBuffer;
+ LVM_FLOAT* pDest;
+ LVM_INT16 NumChannels = pInstance->NrChannels;
/*
* Set the processing address pointers
*/
- pBuffer = pInstance->pBufferManagement;
- pDest = pBuffer->pScratch;
+ 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)
- {
+ if (pInstance->SamplesToProcess == 0) {
/*
* First call for a new block of samples
*/
pInstance->SamplesToProcess = (LVM_INT16)(*pNumSamples + pBuffer->InDelaySamples);
- pInstance->pInputSamples = (LVM_FLOAT *)pInData;
- pBuffer->BufferState = LVM_FIRSTCALL;
+ pInstance->pInputSamples = (LVM_FLOAT*)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 */
+ 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)
- {
+ if (pInstance->SamplesToProcess > pInstance->InternalBlockSize) {
/*
* Process the maximum bock size of samples.
*/
SampleCount = pInstance->InternalBlockSize;
- NumSamples = pInstance->InternalBlockSize;
- }
- else
- {
+ NumSamples = pInstance->InternalBlockSize;
+ } else {
/*
* Last call for the block, so calculate how many frames and samples to process
- */
- LVM_INT16 NumFrames;
+ */
+ LVM_INT16 NumFrames;
- NumSamples = pInstance->SamplesToProcess;
- NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
+ 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)
- {
+ if (pBuffer->BufferState == LVM_FIRSTCALL) {
pBuffer->BufferState = LVM_FIRSTLASTCALL;
- }
- else
- {
+ } else {
pBuffer->BufferState = LVM_LASTCALL;
}
}
- *pNumSamples = (LVM_UINT16)SampleCount; /* Set the number of samples to process this call */
+ *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_Float(&pBuffer->InDelayBuffer[0], /* Source */
- pDest, /* Destination */
- (LVM_INT16)(NumChannels * pBuffer->InDelaySamples)); /* Number of delay \
- samples, left and right */
+ if (((pBuffer->BufferState == LVM_FIRSTCALL) || (pBuffer->BufferState == LVM_FIRSTLASTCALL)) &&
+ (pBuffer->InDelaySamples != 0)) {
+ Copy_Float(&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 */
+ 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_Float(pStart, /* Source */
- pDest, /* Destination */
- (LVM_INT16)(NumChannels * NumSamples)); /* Number of input samples */
- pStart += NumChannels * NumSamples; /* Update the input pointer */
+ if (NumSamples > 0) {
+ Copy_Float(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
@@ -157,33 +142,30 @@
}
/*
- * Update the sample count and input pointer
+ * Update the sample count and input pointer
*/
/* Update the count of samples */
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount);
- pInstance->pInputSamples = pStart; /* Update input sample pointer */
+ pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount);
+ 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))
- {
+ 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_Float(pStart, /* Source */
- &pBuffer->InDelayBuffer[0], /* Destination */
- (LVM_INT16)(NumChannels * NumSamples)); /* Number of input samples */
+ pStart = pBuffer->pScratch; /* Start of the buffer */
+ pStart += NumChannels * SampleCount; /* Offset by the number of processed samples */
+ if (NumSamples != 0) {
+ Copy_Float(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 */
+ pBuffer->InDelaySamples = NumSamples; /* Number of delay sample pairs */
+ pInstance->SamplesToProcess = 0; /* All Samples used */
}
}
@@ -209,33 +191,25 @@
/* NOTES: */
/* */
/****************************************************************************************/
-void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
- LVM_FLOAT **pToProcess,
- LVM_FLOAT **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance, LVM_FLOAT** pToProcess, LVM_FLOAT** 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;
+ 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)
- {
+ if (pInstance->SamplesToProcess > pInstance->InternalBlockSize) {
*pNumSamples = (LVM_UINT16)pInstance->InternalBlockSize;
- }
- else
- {
+ } else {
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
}
}
@@ -325,32 +299,17 @@
/* NOTES: */
/* */
/****************************************************************************************/
-void LVM_BufferIn(LVM_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT **pToProcess,
- LVM_FLOAT **pProcessed,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+void LVM_BufferIn(LVM_Handle_t hInstance, const LVM_FLOAT* pInData, LVM_FLOAT** pToProcess,
+ LVM_FLOAT** 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);
+ if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS) {
+ LVM_BufferManagedIn(hInstance, pInData, pToProcess, pProcessed, pNumSamples);
+ } else {
+ LVM_BufferUnmanagedIn(hInstance, pToProcess, pProcessed, pNumSamples);
}
}
/****************************************************************************************/
@@ -373,18 +332,14 @@
/* NOTES: */
/* */
/****************************************************************************************/
-void LVM_BufferManagedOut(LVM_Handle_t hInstance,
- LVM_FLOAT *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_FLOAT *pStart;
- LVM_FLOAT *pDest;
- LVM_INT32 NrChannels = pInstance->NrChannels;
+void LVM_BufferManagedOut(LVM_Handle_t hInstance, LVM_FLOAT* 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_FLOAT* pStart;
+ LVM_FLOAT* pDest;
+ LVM_INT32 NrChannels = pInstance->NrChannels;
#define NrFrames NumSamples // alias for clarity
#define FrameCount SampleCount
@@ -392,36 +347,31 @@
* Set the pointers
*/
NumSamples = pBuffer->SamplesToOutput;
- pStart = pBuffer->pScratch;
+ pStart = pBuffer->pScratch;
/*
* check if it is the first call of a block
- */
- if ((pBuffer->BufferState == LVM_FIRSTCALL) ||
- (pBuffer->BufferState == LVM_FIRSTLASTCALL))
- {
+ */
+ if ((pBuffer->BufferState == LVM_FIRSTCALL) || (pBuffer->BufferState == LVM_FIRSTLASTCALL)) {
/* First call for a new block */
- pInstance->pOutputSamples = pOutData; /* Initialise the destination */
+ pInstance->pOutputSamples = pOutData; /* Initialise the destination */
}
- pDest = pInstance->pOutputSamples; /* Set the output address */
+ 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))
- {
+ if ((NumSamples != 0) && (pBuffer->OutDelaySamples != 0)) {
/*
* Copy the delayed output buffer samples to the output
*/
- if (pBuffer->OutDelaySamples <= NumSamples)
- {
+ if (pBuffer->OutDelaySamples <= NumSamples) {
/*
* Copy all output delay samples to the output
*/
- Copy_Float(&pBuffer->OutDelayBuffer[0], /* Source */
- pDest, /* Destination */
+ Copy_Float(&pBuffer->OutDelayBuffer[0], /* Source */
+ pDest, /* Destination */
/* Number of delay samples */
(LVM_INT16)(NrChannels * pBuffer->OutDelaySamples));
@@ -432,15 +382,13 @@
NumSamples = (LVM_INT16)(NumSamples - pBuffer->OutDelaySamples); /* Samples left \
to send */
pBuffer->OutDelaySamples = 0; /* No samples left in the buffer */
- }
- else
- {
+ } else {
/*
- * Copy only some of the ouput delay samples to the output
+ * Copy only some of the output delay samples to the output
*/
- Copy_Float(&pBuffer->OutDelayBuffer[0], /* Source */
- pDest, /* Destination */
- (LVM_INT16)(NrChannels * NrFrames)); /* Number of delay samples */
+ Copy_Float(&pBuffer->OutDelayBuffer[0], /* Source */
+ pDest, /* Destination */
+ (LVM_INT16)(NrChannels * NrFrames)); /* Number of delay samples */
/*
* Update the pointer and sample counts
@@ -452,62 +400,56 @@
/*
* Realign the delay buffer data to avoid using circular buffer management
*/
- Copy_Float(&pBuffer->OutDelayBuffer[NrChannels * NrFrames], /* Source */
- &pBuffer->OutDelayBuffer[0], /* Destination */
+ Copy_Float(&pBuffer->OutDelayBuffer[NrChannels * NrFrames], /* Source */
+ &pBuffer->OutDelayBuffer[0], /* Destination */
/* Number of samples to move */
(LVM_INT16)(NrChannels * pBuffer->OutDelaySamples));
- NumSamples = 0; /* Samples left to send */
+ NumSamples = 0; /* Samples left to send */
}
}
/*
* Copy the processed results to the output
*/
- if ((NumSamples != 0) &&
- (SampleCount != 0))
- {
- if (SampleCount <= NumSamples)
- {
+ if ((NumSamples != 0) && (SampleCount != 0)) {
+ if (SampleCount <= NumSamples) {
/*
* Copy all processed samples to the output
*/
- Copy_Float(pStart, /* Source */
- pDest, /* Destination */
+ Copy_Float(pStart, /* Source */
+ pDest, /* Destination */
(LVM_INT16)(NrChannels * FrameCount)); /* Number of processed samples */
/*
* Update the pointer and sample counts
*/
- pDest += NrChannels * FrameCount; /* Output sample pointer */
- NumSamples = (LVM_INT16)(NumSamples - SampleCount); /* Samples left to send */
- SampleCount = 0; /* No samples left in the buffer */
- }
- else
- {
+ pDest += NrChannels * FrameCount; /* 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_Float(pStart, /* Source */
- pDest, /* Destination */
- (LVM_INT16)(NrChannels * NrFrames)); /* Number of processed samples */
+ Copy_Float(pStart, /* Source */
+ pDest, /* Destination */
+ (LVM_INT16)(NrChannels * NrFrames)); /* Number of processed samples */
/*
* Update the pointers and sample counts
- */
- pStart += NrChannels * NrFrames; /* Processed sample pointer */
- pDest += NrChannels * NrFrames; /* Output sample pointer */
- SampleCount = (LVM_INT16)(SampleCount - NumSamples); /* Processed samples left */
- NumSamples = 0; /* Clear the sample count */
+ */
+ pStart += NrChannels * NrFrames; /* Processed sample pointer */
+ pDest += NrChannels * NrFrames; /* 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_Float(pStart, /* Source */
+ if (SampleCount != 0) {
+ Copy_Float(pStart, /* Source */
/* Destination */
&pBuffer->OutDelayBuffer[NrChannels * pBuffer->OutDelaySamples],
- (LVM_INT16)(NrChannels * FrameCount)); /* Number of processed samples */
+ (LVM_INT16)(NrChannels * FrameCount)); /* Number of processed samples */
/* Update the buffer count */
pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples + SampleCount);
}
@@ -515,10 +457,10 @@
/*
* 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 */
+ pBuffer->SamplesToOutput = NumSamples; /* Samples left to send */
+ pInstance->pOutputSamples = pDest; /* Output sample pointer */
+ pBuffer->BufferState = LVM_MAXBLOCKCALL; /* Set for the default call \
+ block size */
/* This will terminate the loop when all samples processed */
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
}
@@ -542,36 +484,31 @@
/* */
/****************************************************************************************/
-void LVM_BufferUnmanagedOut(LVM_Handle_t hInstance,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_INT16 NumChannels = pInstance->NrChannels;
- if (NumChannels == 1)
- {
+void LVM_BufferUnmanagedOut(LVM_Handle_t hInstance, LVM_UINT16* pNumSamples) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
+ LVM_INT16 NumChannels = pInstance->NrChannels;
+ if (NumChannels == 1) {
/* Mono input is processed as stereo by LVM module */
NumChannels = 2;
}
#undef NrFrames
-#define NrFrames (*pNumSamples) // alias for clarity
+#define NrFrames (*pNumSamples) // alias for clarity
/*
* Update sample counts
*/
- pInstance->pInputSamples += (LVM_INT16)(*pNumSamples * NumChannels); /* Update the I/O pointers */
- pInstance->pOutputSamples += (LVM_INT16)(NrFrames * NumChannels);
- pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - *pNumSamples); /* Update the sample count */
+ pInstance->pInputSamples +=
+ (LVM_INT16)(*pNumSamples * NumChannels); /* Update the I/O pointers */
+ pInstance->pOutputSamples += (LVM_INT16)(NrFrames * NumChannels);
+ pInstance->SamplesToProcess =
+ (LVM_INT16)(pInstance->SamplesToProcess - *pNumSamples); /* Update the sample count */
/*
* Set te block size to process
*/
- if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
- {
+ if (pInstance->SamplesToProcess > pInstance->InternalBlockSize) {
*pNumSamples = (LVM_UINT16)pInstance->InternalBlockSize;
- }
- else
- {
+ } else {
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
}
}
@@ -631,25 +568,15 @@
/* NOTES: */
/* */
/****************************************************************************************/
-void LVM_BufferOut(LVM_Handle_t hInstance,
- LVM_FLOAT *pOutData,
- LVM_UINT16 *pNumSamples)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
+void LVM_BufferOut(LVM_Handle_t hInstance, LVM_FLOAT* 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);
+ if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS) {
+ LVM_BufferManagedOut(hInstance, pOutData, pNumSamples);
+ } else {
+ LVM_BufferUnmanagedOut(hInstance, pNumSamples);
}
}
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
index 812f8e5..c02caa1 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
@@ -24,832 +24,832 @@
/* */
/************************************************************************************/
-#define TrebleBoostCorner 8000
-#define TrebleBoostMinRate 4
-#define TrebleBoostSteps 15
+#define TrebleBoostCorner 8000
+#define TrebleBoostMinRate 4
+#define TrebleBoostSteps 15
/* Coefficients for sample rate 22050Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs22050_Gain1_A0 1.038434
-#define HPF_Fs22050_Gain1_A1 0.331599
-#define HPF_Fs22050_Gain1_A2 0.000000
-#define HPF_Fs22050_Gain1_B1 0.370033
-#define HPF_Fs22050_Gain1_B2 0.000000
- /* Gain = 2.000000 dB */
-#define HPF_Fs22050_Gain2_A0 1.081557
-#define HPF_Fs22050_Gain2_A1 0.288475
-#define HPF_Fs22050_Gain2_A2 0.000000
-#define HPF_Fs22050_Gain2_B1 0.370033
-#define HPF_Fs22050_Gain2_B2 0.000000
- /* Gain = 3.000000 dB */
-#define HPF_Fs22050_Gain3_A0 1.129943
-#define HPF_Fs22050_Gain3_A1 0.240090
-#define HPF_Fs22050_Gain3_A2 0.000000
-#define HPF_Fs22050_Gain3_B1 0.370033
-#define HPF_Fs22050_Gain3_B2 0.000000
- /* Gain = 4.000000 dB */
-#define HPF_Fs22050_Gain4_A0 1.184232
-#define HPF_Fs22050_Gain4_A1 0.185801
-#define HPF_Fs22050_Gain4_A2 0.000000
-#define HPF_Fs22050_Gain4_B1 0.370033
-#define HPF_Fs22050_Gain4_B2 0.000000
- /* Gain = 5.000000 dB */
-#define HPF_Fs22050_Gain5_A0 1.245145
-#define HPF_Fs22050_Gain5_A1 0.124887
-#define HPF_Fs22050_Gain5_A2 0.000000
-#define HPF_Fs22050_Gain5_B1 0.370033
-#define HPF_Fs22050_Gain5_B2 0.000000
- /* Gain = 6.000000 dB */
-#define HPF_Fs22050_Gain6_A0 1.313491
-#define HPF_Fs22050_Gain6_A1 0.056541
-#define HPF_Fs22050_Gain6_A2 0.000000
-#define HPF_Fs22050_Gain6_B1 0.370033
-#define HPF_Fs22050_Gain6_B2 0.000000
- /* Gain = 7.000000 dB */
-#define HPF_Fs22050_Gain7_A0 1.390177
-#define HPF_Fs22050_Gain7_A1 (-0.020144)
-#define HPF_Fs22050_Gain7_A2 0.000000
-#define HPF_Fs22050_Gain7_B1 0.370033
-#define HPF_Fs22050_Gain7_B2 0.000000
- /* Gain = 8.000000 dB */
-#define HPF_Fs22050_Gain8_A0 1.476219
-#define HPF_Fs22050_Gain8_A1 (-0.106187)
-#define HPF_Fs22050_Gain8_A2 0.000000
-#define HPF_Fs22050_Gain8_B1 0.370033
-#define HPF_Fs22050_Gain8_B2 0.000000
- /* Gain = 9.000000 dB */
-#define HPF_Fs22050_Gain9_A0 1.572761
-#define HPF_Fs22050_Gain9_A1 (-0.202728)
-#define HPF_Fs22050_Gain9_A2 0.000000
-#define HPF_Fs22050_Gain9_B1 0.370033
-#define HPF_Fs22050_Gain9_B2 0.000000
- /* Gain = 10.000000 dB */
-#define HPF_Fs22050_Gain10_A0 1.681082
-#define HPF_Fs22050_Gain10_A1 (-0.311049)
-#define HPF_Fs22050_Gain10_A2 0.000000
-#define HPF_Fs22050_Gain10_B1 0.370033
-#define HPF_Fs22050_Gain10_B2 0.000000
- /* Gain = 11.000000 dB */
-#define HPF_Fs22050_Gain11_A0 1.802620
-#define HPF_Fs22050_Gain11_A1 (-0.432588)
-#define HPF_Fs22050_Gain11_A2 0.000000
-#define HPF_Fs22050_Gain11_B1 0.370033
-#define HPF_Fs22050_Gain11_B2 0.000000
- /* Gain = 12.000000 dB */
-#define HPF_Fs22050_Gain12_A0 1.938989
-#define HPF_Fs22050_Gain12_A1 (-0.568956)
-#define HPF_Fs22050_Gain12_A2 0.000000
-#define HPF_Fs22050_Gain12_B1 0.370033
-#define HPF_Fs22050_Gain12_B2 0.000000
- /* Gain = 13.000000 dB */
-#define HPF_Fs22050_Gain13_A0 2.091997
-#define HPF_Fs22050_Gain13_A1 (-0.721964)
-#define HPF_Fs22050_Gain13_A2 0.000000
-#define HPF_Fs22050_Gain13_B1 0.370033
-#define HPF_Fs22050_Gain13_B2 0.000000
- /* Gain = 14.000000 dB */
-#define HPF_Fs22050_Gain14_A0 2.263674
-#define HPF_Fs22050_Gain14_A1 (-0.893641)
-#define HPF_Fs22050_Gain14_A2 0.000000
-#define HPF_Fs22050_Gain14_B1 0.370033
-#define HPF_Fs22050_Gain14_B2 0.000000
- /* Gain = 15.000000 dB */
-#define HPF_Fs22050_Gain15_A0 2.456300
-#define HPF_Fs22050_Gain15_A1 (-1.086267)
-#define HPF_Fs22050_Gain15_A2 0.000000
-#define HPF_Fs22050_Gain15_B1 0.370033
-#define HPF_Fs22050_Gain15_B2 0.000000
+/* Gain = 1.000000 dB */
+#define HPF_Fs22050_Gain1_A0 1.038434
+#define HPF_Fs22050_Gain1_A1 0.331599
+#define HPF_Fs22050_Gain1_A2 0.000000
+#define HPF_Fs22050_Gain1_B1 0.370033
+#define HPF_Fs22050_Gain1_B2 0.000000
+/* Gain = 2.000000 dB */
+#define HPF_Fs22050_Gain2_A0 1.081557
+#define HPF_Fs22050_Gain2_A1 0.288475
+#define HPF_Fs22050_Gain2_A2 0.000000
+#define HPF_Fs22050_Gain2_B1 0.370033
+#define HPF_Fs22050_Gain2_B2 0.000000
+/* Gain = 3.000000 dB */
+#define HPF_Fs22050_Gain3_A0 1.129943
+#define HPF_Fs22050_Gain3_A1 0.240090
+#define HPF_Fs22050_Gain3_A2 0.000000
+#define HPF_Fs22050_Gain3_B1 0.370033
+#define HPF_Fs22050_Gain3_B2 0.000000
+/* Gain = 4.000000 dB */
+#define HPF_Fs22050_Gain4_A0 1.184232
+#define HPF_Fs22050_Gain4_A1 0.185801
+#define HPF_Fs22050_Gain4_A2 0.000000
+#define HPF_Fs22050_Gain4_B1 0.370033
+#define HPF_Fs22050_Gain4_B2 0.000000
+/* Gain = 5.000000 dB */
+#define HPF_Fs22050_Gain5_A0 1.245145
+#define HPF_Fs22050_Gain5_A1 0.124887
+#define HPF_Fs22050_Gain5_A2 0.000000
+#define HPF_Fs22050_Gain5_B1 0.370033
+#define HPF_Fs22050_Gain5_B2 0.000000
+/* Gain = 6.000000 dB */
+#define HPF_Fs22050_Gain6_A0 1.313491
+#define HPF_Fs22050_Gain6_A1 0.056541
+#define HPF_Fs22050_Gain6_A2 0.000000
+#define HPF_Fs22050_Gain6_B1 0.370033
+#define HPF_Fs22050_Gain6_B2 0.000000
+/* Gain = 7.000000 dB */
+#define HPF_Fs22050_Gain7_A0 1.390177
+#define HPF_Fs22050_Gain7_A1 (-0.020144)
+#define HPF_Fs22050_Gain7_A2 0.000000
+#define HPF_Fs22050_Gain7_B1 0.370033
+#define HPF_Fs22050_Gain7_B2 0.000000
+/* Gain = 8.000000 dB */
+#define HPF_Fs22050_Gain8_A0 1.476219
+#define HPF_Fs22050_Gain8_A1 (-0.106187)
+#define HPF_Fs22050_Gain8_A2 0.000000
+#define HPF_Fs22050_Gain8_B1 0.370033
+#define HPF_Fs22050_Gain8_B2 0.000000
+/* Gain = 9.000000 dB */
+#define HPF_Fs22050_Gain9_A0 1.572761
+#define HPF_Fs22050_Gain9_A1 (-0.202728)
+#define HPF_Fs22050_Gain9_A2 0.000000
+#define HPF_Fs22050_Gain9_B1 0.370033
+#define HPF_Fs22050_Gain9_B2 0.000000
+/* Gain = 10.000000 dB */
+#define HPF_Fs22050_Gain10_A0 1.681082
+#define HPF_Fs22050_Gain10_A1 (-0.311049)
+#define HPF_Fs22050_Gain10_A2 0.000000
+#define HPF_Fs22050_Gain10_B1 0.370033
+#define HPF_Fs22050_Gain10_B2 0.000000
+/* Gain = 11.000000 dB */
+#define HPF_Fs22050_Gain11_A0 1.802620
+#define HPF_Fs22050_Gain11_A1 (-0.432588)
+#define HPF_Fs22050_Gain11_A2 0.000000
+#define HPF_Fs22050_Gain11_B1 0.370033
+#define HPF_Fs22050_Gain11_B2 0.000000
+/* Gain = 12.000000 dB */
+#define HPF_Fs22050_Gain12_A0 1.938989
+#define HPF_Fs22050_Gain12_A1 (-0.568956)
+#define HPF_Fs22050_Gain12_A2 0.000000
+#define HPF_Fs22050_Gain12_B1 0.370033
+#define HPF_Fs22050_Gain12_B2 0.000000
+/* Gain = 13.000000 dB */
+#define HPF_Fs22050_Gain13_A0 2.091997
+#define HPF_Fs22050_Gain13_A1 (-0.721964)
+#define HPF_Fs22050_Gain13_A2 0.000000
+#define HPF_Fs22050_Gain13_B1 0.370033
+#define HPF_Fs22050_Gain13_B2 0.000000
+/* Gain = 14.000000 dB */
+#define HPF_Fs22050_Gain14_A0 2.263674
+#define HPF_Fs22050_Gain14_A1 (-0.893641)
+#define HPF_Fs22050_Gain14_A2 0.000000
+#define HPF_Fs22050_Gain14_B1 0.370033
+#define HPF_Fs22050_Gain14_B2 0.000000
+/* Gain = 15.000000 dB */
+#define HPF_Fs22050_Gain15_A0 2.456300
+#define HPF_Fs22050_Gain15_A1 (-1.086267)
+#define HPF_Fs22050_Gain15_A2 0.000000
+#define HPF_Fs22050_Gain15_B1 0.370033
+#define HPF_Fs22050_Gain15_B2 0.000000
/* Coefficients for sample rate 24000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs24000_Gain1_A0 1.044662
-#define HPF_Fs24000_Gain1_A1 0.223287
-#define HPF_Fs24000_Gain1_A2 0.000000
-#define HPF_Fs24000_Gain1_B1 0.267949
-#define HPF_Fs24000_Gain1_B2 0.000000
- /* Gain = 2.000000 dB */
-#define HPF_Fs24000_Gain2_A0 1.094773
-#define HPF_Fs24000_Gain2_A1 0.173176
-#define HPF_Fs24000_Gain2_A2 0.000000
-#define HPF_Fs24000_Gain2_B1 0.267949
-#define HPF_Fs24000_Gain2_B2 0.000000
- /* Gain = 3.000000 dB */
-#define HPF_Fs24000_Gain3_A0 1.150999
-#define HPF_Fs24000_Gain3_A1 0.116950
-#define HPF_Fs24000_Gain3_A2 0.000000
-#define HPF_Fs24000_Gain3_B1 0.267949
-#define HPF_Fs24000_Gain3_B2 0.000000
- /* Gain = 4.000000 dB */
-#define HPF_Fs24000_Gain4_A0 1.214086
-#define HPF_Fs24000_Gain4_A1 0.053863
-#define HPF_Fs24000_Gain4_A2 0.000000
-#define HPF_Fs24000_Gain4_B1 0.267949
-#define HPF_Fs24000_Gain4_B2 0.000000
- /* Gain = 5.000000 dB */
-#define HPF_Fs24000_Gain5_A0 1.284870
-#define HPF_Fs24000_Gain5_A1 (-0.016921)
-#define HPF_Fs24000_Gain5_A2 0.000000
-#define HPF_Fs24000_Gain5_B1 0.267949
-#define HPF_Fs24000_Gain5_B2 0.000000
- /* Gain = 6.000000 dB */
-#define HPF_Fs24000_Gain6_A0 1.364291
-#define HPF_Fs24000_Gain6_A1 (-0.096342)
-#define HPF_Fs24000_Gain6_A2 0.000000
-#define HPF_Fs24000_Gain6_B1 0.267949
-#define HPF_Fs24000_Gain6_B2 0.000000
- /* Gain = 7.000000 dB */
-#define HPF_Fs24000_Gain7_A0 1.453403
-#define HPF_Fs24000_Gain7_A1 (-0.185454)
-#define HPF_Fs24000_Gain7_A2 0.000000
-#define HPF_Fs24000_Gain7_B1 0.267949
-#define HPF_Fs24000_Gain7_B2 0.000000
- /* Gain = 8.000000 dB */
-#define HPF_Fs24000_Gain8_A0 1.553389
-#define HPF_Fs24000_Gain8_A1 (-0.285440)
-#define HPF_Fs24000_Gain8_A2 0.000000
-#define HPF_Fs24000_Gain8_B1 0.267949
-#define HPF_Fs24000_Gain8_B2 0.000000
- /* Gain = 9.000000 dB */
-#define HPF_Fs24000_Gain9_A0 1.665574
-#define HPF_Fs24000_Gain9_A1 (-0.397625)
-#define HPF_Fs24000_Gain9_A2 0.000000
-#define HPF_Fs24000_Gain9_B1 0.267949
-#define HPF_Fs24000_Gain9_B2 0.000000
- /* Gain = 10.000000 dB */
-#define HPF_Fs24000_Gain10_A0 1.791449
-#define HPF_Fs24000_Gain10_A1 (-0.523499)
-#define HPF_Fs24000_Gain10_A2 0.000000
-#define HPF_Fs24000_Gain10_B1 0.267949
-#define HPF_Fs24000_Gain10_B2 0.000000
- /* Gain = 11.000000 dB */
-#define HPF_Fs24000_Gain11_A0 1.932682
-#define HPF_Fs24000_Gain11_A1 (-0.664733)
-#define HPF_Fs24000_Gain11_A2 0.000000
-#define HPF_Fs24000_Gain11_B1 0.267949
-#define HPF_Fs24000_Gain11_B2 0.000000
- /* Gain = 12.000000 dB */
-#define HPF_Fs24000_Gain12_A0 2.091148
-#define HPF_Fs24000_Gain12_A1 (-0.823199)
-#define HPF_Fs24000_Gain12_A2 0.000000
-#define HPF_Fs24000_Gain12_B1 0.267949
-#define HPF_Fs24000_Gain12_B2 0.000000
- /* Gain = 13.000000 dB */
-#define HPF_Fs24000_Gain13_A0 2.268950
-#define HPF_Fs24000_Gain13_A1 (-1.001001)
-#define HPF_Fs24000_Gain13_A2 0.000000
-#define HPF_Fs24000_Gain13_B1 0.267949
-#define HPF_Fs24000_Gain13_B2 0.000000
- /* Gain = 14.000000 dB */
-#define HPF_Fs24000_Gain14_A0 2.468447
-#define HPF_Fs24000_Gain14_A1 (-1.200498)
-#define HPF_Fs24000_Gain14_A2 0.000000
-#define HPF_Fs24000_Gain14_B1 0.267949
-#define HPF_Fs24000_Gain14_B2 0.000000
- /* Gain = 15.000000 dB */
-#define HPF_Fs24000_Gain15_A0 2.692287
-#define HPF_Fs24000_Gain15_A1 (-1.424338)
-#define HPF_Fs24000_Gain15_A2 0.000000
-#define HPF_Fs24000_Gain15_B1 0.267949
-#define HPF_Fs24000_Gain15_B2 0.000000
+/* Gain = 1.000000 dB */
+#define HPF_Fs24000_Gain1_A0 1.044662
+#define HPF_Fs24000_Gain1_A1 0.223287
+#define HPF_Fs24000_Gain1_A2 0.000000
+#define HPF_Fs24000_Gain1_B1 0.267949
+#define HPF_Fs24000_Gain1_B2 0.000000
+/* Gain = 2.000000 dB */
+#define HPF_Fs24000_Gain2_A0 1.094773
+#define HPF_Fs24000_Gain2_A1 0.173176
+#define HPF_Fs24000_Gain2_A2 0.000000
+#define HPF_Fs24000_Gain2_B1 0.267949
+#define HPF_Fs24000_Gain2_B2 0.000000
+/* Gain = 3.000000 dB */
+#define HPF_Fs24000_Gain3_A0 1.150999
+#define HPF_Fs24000_Gain3_A1 0.116950
+#define HPF_Fs24000_Gain3_A2 0.000000
+#define HPF_Fs24000_Gain3_B1 0.267949
+#define HPF_Fs24000_Gain3_B2 0.000000
+/* Gain = 4.000000 dB */
+#define HPF_Fs24000_Gain4_A0 1.214086
+#define HPF_Fs24000_Gain4_A1 0.053863
+#define HPF_Fs24000_Gain4_A2 0.000000
+#define HPF_Fs24000_Gain4_B1 0.267949
+#define HPF_Fs24000_Gain4_B2 0.000000
+/* Gain = 5.000000 dB */
+#define HPF_Fs24000_Gain5_A0 1.284870
+#define HPF_Fs24000_Gain5_A1 (-0.016921)
+#define HPF_Fs24000_Gain5_A2 0.000000
+#define HPF_Fs24000_Gain5_B1 0.267949
+#define HPF_Fs24000_Gain5_B2 0.000000
+/* Gain = 6.000000 dB */
+#define HPF_Fs24000_Gain6_A0 1.364291
+#define HPF_Fs24000_Gain6_A1 (-0.096342)
+#define HPF_Fs24000_Gain6_A2 0.000000
+#define HPF_Fs24000_Gain6_B1 0.267949
+#define HPF_Fs24000_Gain6_B2 0.000000
+/* Gain = 7.000000 dB */
+#define HPF_Fs24000_Gain7_A0 1.453403
+#define HPF_Fs24000_Gain7_A1 (-0.185454)
+#define HPF_Fs24000_Gain7_A2 0.000000
+#define HPF_Fs24000_Gain7_B1 0.267949
+#define HPF_Fs24000_Gain7_B2 0.000000
+/* Gain = 8.000000 dB */
+#define HPF_Fs24000_Gain8_A0 1.553389
+#define HPF_Fs24000_Gain8_A1 (-0.285440)
+#define HPF_Fs24000_Gain8_A2 0.000000
+#define HPF_Fs24000_Gain8_B1 0.267949
+#define HPF_Fs24000_Gain8_B2 0.000000
+/* Gain = 9.000000 dB */
+#define HPF_Fs24000_Gain9_A0 1.665574
+#define HPF_Fs24000_Gain9_A1 (-0.397625)
+#define HPF_Fs24000_Gain9_A2 0.000000
+#define HPF_Fs24000_Gain9_B1 0.267949
+#define HPF_Fs24000_Gain9_B2 0.000000
+/* Gain = 10.000000 dB */
+#define HPF_Fs24000_Gain10_A0 1.791449
+#define HPF_Fs24000_Gain10_A1 (-0.523499)
+#define HPF_Fs24000_Gain10_A2 0.000000
+#define HPF_Fs24000_Gain10_B1 0.267949
+#define HPF_Fs24000_Gain10_B2 0.000000
+/* Gain = 11.000000 dB */
+#define HPF_Fs24000_Gain11_A0 1.932682
+#define HPF_Fs24000_Gain11_A1 (-0.664733)
+#define HPF_Fs24000_Gain11_A2 0.000000
+#define HPF_Fs24000_Gain11_B1 0.267949
+#define HPF_Fs24000_Gain11_B2 0.000000
+/* Gain = 12.000000 dB */
+#define HPF_Fs24000_Gain12_A0 2.091148
+#define HPF_Fs24000_Gain12_A1 (-0.823199)
+#define HPF_Fs24000_Gain12_A2 0.000000
+#define HPF_Fs24000_Gain12_B1 0.267949
+#define HPF_Fs24000_Gain12_B2 0.000000
+/* Gain = 13.000000 dB */
+#define HPF_Fs24000_Gain13_A0 2.268950
+#define HPF_Fs24000_Gain13_A1 (-1.001001)
+#define HPF_Fs24000_Gain13_A2 0.000000
+#define HPF_Fs24000_Gain13_B1 0.267949
+#define HPF_Fs24000_Gain13_B2 0.000000
+/* Gain = 14.000000 dB */
+#define HPF_Fs24000_Gain14_A0 2.468447
+#define HPF_Fs24000_Gain14_A1 (-1.200498)
+#define HPF_Fs24000_Gain14_A2 0.000000
+#define HPF_Fs24000_Gain14_B1 0.267949
+#define HPF_Fs24000_Gain14_B2 0.000000
+/* Gain = 15.000000 dB */
+#define HPF_Fs24000_Gain15_A0 2.692287
+#define HPF_Fs24000_Gain15_A1 (-1.424338)
+#define HPF_Fs24000_Gain15_A2 0.000000
+#define HPF_Fs24000_Gain15_B1 0.267949
+#define HPF_Fs24000_Gain15_B2 0.000000
/* Coefficients for sample rate 32000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs32000_Gain1_A0 1.061009
-#define HPF_Fs32000_Gain1_A1 (-0.061009)
-#define HPF_Fs32000_Gain1_A2 0.000000
-#define HPF_Fs32000_Gain1_B1 (-0.000000)
-#define HPF_Fs32000_Gain1_B2 0.000000
- /* Gain = 2.000000 dB */
-#define HPF_Fs32000_Gain2_A0 1.129463
-#define HPF_Fs32000_Gain2_A1 (-0.129463)
-#define HPF_Fs32000_Gain2_A2 0.000000
-#define HPF_Fs32000_Gain2_B1 (-0.000000)
-#define HPF_Fs32000_Gain2_B2 0.000000
- /* Gain = 3.000000 dB */
-#define HPF_Fs32000_Gain3_A0 1.206267
-#define HPF_Fs32000_Gain3_A1 (-0.206267)
-#define HPF_Fs32000_Gain3_A2 0.000000
-#define HPF_Fs32000_Gain3_B1 (-0.000000)
-#define HPF_Fs32000_Gain3_B2 0.000000
- /* Gain = 4.000000 dB */
-#define HPF_Fs32000_Gain4_A0 1.292447
-#define HPF_Fs32000_Gain4_A1 (-0.292447)
-#define HPF_Fs32000_Gain4_A2 0.000000
-#define HPF_Fs32000_Gain4_B1 (-0.000000)
-#define HPF_Fs32000_Gain4_B2 0.000000
- /* Gain = 5.000000 dB */
-#define HPF_Fs32000_Gain5_A0 1.389140
-#define HPF_Fs32000_Gain5_A1 (-0.389140)
-#define HPF_Fs32000_Gain5_A2 0.000000
-#define HPF_Fs32000_Gain5_B1 (-0.000000)
-#define HPF_Fs32000_Gain5_B2 0.000000
- /* Gain = 6.000000 dB */
-#define HPF_Fs32000_Gain6_A0 1.497631
-#define HPF_Fs32000_Gain6_A1 (-0.497631)
-#define HPF_Fs32000_Gain6_A2 0.000000
-#define HPF_Fs32000_Gain6_B1 (-0.000000)
-#define HPF_Fs32000_Gain6_B2 0.000000
- /* Gain = 7.000000 dB */
-#define HPF_Fs32000_Gain7_A0 1.619361
-#define HPF_Fs32000_Gain7_A1 (-0.619361)
-#define HPF_Fs32000_Gain7_A2 0.000000
-#define HPF_Fs32000_Gain7_B1 (-0.000000)
-#define HPF_Fs32000_Gain7_B2 0.000000
- /* Gain = 8.000000 dB */
-#define HPF_Fs32000_Gain8_A0 1.755943
-#define HPF_Fs32000_Gain8_A1 (-0.755943)
-#define HPF_Fs32000_Gain8_A2 0.000000
-#define HPF_Fs32000_Gain8_B1 (-0.000000)
-#define HPF_Fs32000_Gain8_B2 0.000000
- /* Gain = 9.000000 dB */
-#define HPF_Fs32000_Gain9_A0 1.909191
-#define HPF_Fs32000_Gain9_A1 (-0.909191)
-#define HPF_Fs32000_Gain9_A2 0.000000
-#define HPF_Fs32000_Gain9_B1 (-0.000000)
-#define HPF_Fs32000_Gain9_B2 0.000000
- /* Gain = 10.000000 dB */
-#define HPF_Fs32000_Gain10_A0 2.081139
-#define HPF_Fs32000_Gain10_A1 (-1.081139)
-#define HPF_Fs32000_Gain10_A2 0.000000
-#define HPF_Fs32000_Gain10_B1 (-0.000000)
-#define HPF_Fs32000_Gain10_B2 0.000000
- /* Gain = 11.000000 dB */
-#define HPF_Fs32000_Gain11_A0 2.274067
-#define HPF_Fs32000_Gain11_A1 (-1.274067)
-#define HPF_Fs32000_Gain11_A2 0.000000
-#define HPF_Fs32000_Gain11_B1 (-0.000000)
-#define HPF_Fs32000_Gain11_B2 0.000000
- /* Gain = 12.000000 dB */
-#define HPF_Fs32000_Gain12_A0 2.490536
-#define HPF_Fs32000_Gain12_A1 (-1.490536)
-#define HPF_Fs32000_Gain12_A2 0.000000
-#define HPF_Fs32000_Gain12_B1 (-0.000000)
-#define HPF_Fs32000_Gain12_B2 0.000000
- /* Gain = 13.000000 dB */
-#define HPF_Fs32000_Gain13_A0 2.733418
-#define HPF_Fs32000_Gain13_A1 (-1.733418)
-#define HPF_Fs32000_Gain13_A2 0.000000
-#define HPF_Fs32000_Gain13_B1 (-0.000000)
-#define HPF_Fs32000_Gain13_B2 0.000000
- /* Gain = 14.000000 dB */
-#define HPF_Fs32000_Gain14_A0 3.005936
-#define HPF_Fs32000_Gain14_A1 (-2.005936)
-#define HPF_Fs32000_Gain14_A2 0.000000
-#define HPF_Fs32000_Gain14_B1 (-0.000000)
-#define HPF_Fs32000_Gain14_B2 0.000000
- /* Gain = 15.000000 dB */
-#define HPF_Fs32000_Gain15_A0 3.311707
-#define HPF_Fs32000_Gain15_A1 (-2.311707)
-#define HPF_Fs32000_Gain15_A2 0.000000
-#define HPF_Fs32000_Gain15_B1 (-0.000000)
-#define HPF_Fs32000_Gain15_B2 0.000000
+/* Gain = 1.000000 dB */
+#define HPF_Fs32000_Gain1_A0 1.061009
+#define HPF_Fs32000_Gain1_A1 (-0.061009)
+#define HPF_Fs32000_Gain1_A2 0.000000
+#define HPF_Fs32000_Gain1_B1 (-0.000000)
+#define HPF_Fs32000_Gain1_B2 0.000000
+/* Gain = 2.000000 dB */
+#define HPF_Fs32000_Gain2_A0 1.129463
+#define HPF_Fs32000_Gain2_A1 (-0.129463)
+#define HPF_Fs32000_Gain2_A2 0.000000
+#define HPF_Fs32000_Gain2_B1 (-0.000000)
+#define HPF_Fs32000_Gain2_B2 0.000000
+/* Gain = 3.000000 dB */
+#define HPF_Fs32000_Gain3_A0 1.206267
+#define HPF_Fs32000_Gain3_A1 (-0.206267)
+#define HPF_Fs32000_Gain3_A2 0.000000
+#define HPF_Fs32000_Gain3_B1 (-0.000000)
+#define HPF_Fs32000_Gain3_B2 0.000000
+/* Gain = 4.000000 dB */
+#define HPF_Fs32000_Gain4_A0 1.292447
+#define HPF_Fs32000_Gain4_A1 (-0.292447)
+#define HPF_Fs32000_Gain4_A2 0.000000
+#define HPF_Fs32000_Gain4_B1 (-0.000000)
+#define HPF_Fs32000_Gain4_B2 0.000000
+/* Gain = 5.000000 dB */
+#define HPF_Fs32000_Gain5_A0 1.389140
+#define HPF_Fs32000_Gain5_A1 (-0.389140)
+#define HPF_Fs32000_Gain5_A2 0.000000
+#define HPF_Fs32000_Gain5_B1 (-0.000000)
+#define HPF_Fs32000_Gain5_B2 0.000000
+/* Gain = 6.000000 dB */
+#define HPF_Fs32000_Gain6_A0 1.497631
+#define HPF_Fs32000_Gain6_A1 (-0.497631)
+#define HPF_Fs32000_Gain6_A2 0.000000
+#define HPF_Fs32000_Gain6_B1 (-0.000000)
+#define HPF_Fs32000_Gain6_B2 0.000000
+/* Gain = 7.000000 dB */
+#define HPF_Fs32000_Gain7_A0 1.619361
+#define HPF_Fs32000_Gain7_A1 (-0.619361)
+#define HPF_Fs32000_Gain7_A2 0.000000
+#define HPF_Fs32000_Gain7_B1 (-0.000000)
+#define HPF_Fs32000_Gain7_B2 0.000000
+/* Gain = 8.000000 dB */
+#define HPF_Fs32000_Gain8_A0 1.755943
+#define HPF_Fs32000_Gain8_A1 (-0.755943)
+#define HPF_Fs32000_Gain8_A2 0.000000
+#define HPF_Fs32000_Gain8_B1 (-0.000000)
+#define HPF_Fs32000_Gain8_B2 0.000000
+/* Gain = 9.000000 dB */
+#define HPF_Fs32000_Gain9_A0 1.909191
+#define HPF_Fs32000_Gain9_A1 (-0.909191)
+#define HPF_Fs32000_Gain9_A2 0.000000
+#define HPF_Fs32000_Gain9_B1 (-0.000000)
+#define HPF_Fs32000_Gain9_B2 0.000000
+/* Gain = 10.000000 dB */
+#define HPF_Fs32000_Gain10_A0 2.081139
+#define HPF_Fs32000_Gain10_A1 (-1.081139)
+#define HPF_Fs32000_Gain10_A2 0.000000
+#define HPF_Fs32000_Gain10_B1 (-0.000000)
+#define HPF_Fs32000_Gain10_B2 0.000000
+/* Gain = 11.000000 dB */
+#define HPF_Fs32000_Gain11_A0 2.274067
+#define HPF_Fs32000_Gain11_A1 (-1.274067)
+#define HPF_Fs32000_Gain11_A2 0.000000
+#define HPF_Fs32000_Gain11_B1 (-0.000000)
+#define HPF_Fs32000_Gain11_B2 0.000000
+/* Gain = 12.000000 dB */
+#define HPF_Fs32000_Gain12_A0 2.490536
+#define HPF_Fs32000_Gain12_A1 (-1.490536)
+#define HPF_Fs32000_Gain12_A2 0.000000
+#define HPF_Fs32000_Gain12_B1 (-0.000000)
+#define HPF_Fs32000_Gain12_B2 0.000000
+/* Gain = 13.000000 dB */
+#define HPF_Fs32000_Gain13_A0 2.733418
+#define HPF_Fs32000_Gain13_A1 (-1.733418)
+#define HPF_Fs32000_Gain13_A2 0.000000
+#define HPF_Fs32000_Gain13_B1 (-0.000000)
+#define HPF_Fs32000_Gain13_B2 0.000000
+/* Gain = 14.000000 dB */
+#define HPF_Fs32000_Gain14_A0 3.005936
+#define HPF_Fs32000_Gain14_A1 (-2.005936)
+#define HPF_Fs32000_Gain14_A2 0.000000
+#define HPF_Fs32000_Gain14_B1 (-0.000000)
+#define HPF_Fs32000_Gain14_B2 0.000000
+/* Gain = 15.000000 dB */
+#define HPF_Fs32000_Gain15_A0 3.311707
+#define HPF_Fs32000_Gain15_A1 (-2.311707)
+#define HPF_Fs32000_Gain15_A2 0.000000
+#define HPF_Fs32000_Gain15_B1 (-0.000000)
+#define HPF_Fs32000_Gain15_B2 0.000000
/* Coefficients for sample rate 44100Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs44100_Gain1_A0 1.074364
-#define HPF_Fs44100_Gain1_A1 (-0.293257)
-#define HPF_Fs44100_Gain1_A2 0.000000
-#define HPF_Fs44100_Gain1_B1 (-0.218894)
-#define HPF_Fs44100_Gain1_B2 0.000000
- /* Gain = 2.000000 dB */
-#define HPF_Fs44100_Gain2_A0 1.157801
-#define HPF_Fs44100_Gain2_A1 (-0.376695)
-#define HPF_Fs44100_Gain2_A2 0.000000
-#define HPF_Fs44100_Gain2_B1 (-0.218894)
-#define HPF_Fs44100_Gain2_B2 0.000000
- /* Gain = 3.000000 dB */
-#define HPF_Fs44100_Gain3_A0 1.251420
-#define HPF_Fs44100_Gain3_A1 (-0.470313)
-#define HPF_Fs44100_Gain3_A2 0.000000
-#define HPF_Fs44100_Gain3_B1 (-0.218894)
-#define HPF_Fs44100_Gain3_B2 0.000000
- /* Gain = 4.000000 dB */
-#define HPF_Fs44100_Gain4_A0 1.356461
-#define HPF_Fs44100_Gain4_A1 (-0.575355)
-#define HPF_Fs44100_Gain4_A2 0.000000
-#define HPF_Fs44100_Gain4_B1 (-0.218894)
-#define HPF_Fs44100_Gain4_B2 0.000000
- /* Gain = 5.000000 dB */
-#define HPF_Fs44100_Gain5_A0 1.474320
-#define HPF_Fs44100_Gain5_A1 (-0.693213)
-#define HPF_Fs44100_Gain5_A2 0.000000
-#define HPF_Fs44100_Gain5_B1 (-0.218894)
-#define HPF_Fs44100_Gain5_B2 0.000000
- /* Gain = 6.000000 dB */
-#define HPF_Fs44100_Gain6_A0 1.606559
-#define HPF_Fs44100_Gain6_A1 (-0.825453)
-#define HPF_Fs44100_Gain6_A2 0.000000
-#define HPF_Fs44100_Gain6_B1 (-0.218894)
-#define HPF_Fs44100_Gain6_B2 0.000000
- /* Gain = 7.000000 dB */
-#define HPF_Fs44100_Gain7_A0 1.754935
-#define HPF_Fs44100_Gain7_A1 (-0.973828)
-#define HPF_Fs44100_Gain7_A2 0.000000
-#define HPF_Fs44100_Gain7_B1 (-0.218894)
-#define HPF_Fs44100_Gain7_B2 0.000000
- /* Gain = 8.000000 dB */
-#define HPF_Fs44100_Gain8_A0 1.921414
-#define HPF_Fs44100_Gain8_A1 (-1.140308)
-#define HPF_Fs44100_Gain8_A2 0.000000
-#define HPF_Fs44100_Gain8_B1 (-0.218894)
-#define HPF_Fs44100_Gain8_B2 0.000000
- /* Gain = 9.000000 dB */
-#define HPF_Fs44100_Gain9_A0 2.108208
-#define HPF_Fs44100_Gain9_A1 (-1.327101)
-#define HPF_Fs44100_Gain9_A2 0.000000
-#define HPF_Fs44100_Gain9_B1 (-0.218894)
-#define HPF_Fs44100_Gain9_B2 0.000000
- /* Gain = 10.000000 dB */
-#define HPF_Fs44100_Gain10_A0 2.317793
-#define HPF_Fs44100_Gain10_A1 (-1.536687)
-#define HPF_Fs44100_Gain10_A2 0.000000
-#define HPF_Fs44100_Gain10_B1 (-0.218894)
-#define HPF_Fs44100_Gain10_B2 0.000000
- /* Gain = 11.000000 dB */
-#define HPF_Fs44100_Gain11_A0 2.552952
-#define HPF_Fs44100_Gain11_A1 (-1.771846)
-#define HPF_Fs44100_Gain11_A2 0.000000
-#define HPF_Fs44100_Gain11_B1 (-0.218894)
-#define HPF_Fs44100_Gain11_B2 0.000000
- /* Gain = 12.000000 dB */
-#define HPF_Fs44100_Gain12_A0 2.816805
-#define HPF_Fs44100_Gain12_A1 (-2.035698)
-#define HPF_Fs44100_Gain12_A2 0.000000
-#define HPF_Fs44100_Gain12_B1 (-0.218894)
-#define HPF_Fs44100_Gain12_B2 0.000000
- /* Gain = 13.000000 dB */
-#define HPF_Fs44100_Gain13_A0 3.112852
-#define HPF_Fs44100_Gain13_A1 (-2.331746)
-#define HPF_Fs44100_Gain13_A2 0.000000
-#define HPF_Fs44100_Gain13_B1 (-0.218894)
-#define HPF_Fs44100_Gain13_B2 0.000000
- /* Gain = 14.000000 dB */
-#define HPF_Fs44100_Gain14_A0 3.445023
-#define HPF_Fs44100_Gain14_A1 (-2.663916)
-#define HPF_Fs44100_Gain14_A2 0.000000
-#define HPF_Fs44100_Gain14_B1 (-0.218894)
-#define HPF_Fs44100_Gain14_B2 0.000000
- /* Gain = 15.000000 dB */
-#define HPF_Fs44100_Gain15_A0 3.817724
-#define HPF_Fs44100_Gain15_A1 (-3.036618)
-#define HPF_Fs44100_Gain15_A2 0.000000
-#define HPF_Fs44100_Gain15_B1 (-0.218894)
-#define HPF_Fs44100_Gain15_B2 0.000000
+/* Gain = 1.000000 dB */
+#define HPF_Fs44100_Gain1_A0 1.074364
+#define HPF_Fs44100_Gain1_A1 (-0.293257)
+#define HPF_Fs44100_Gain1_A2 0.000000
+#define HPF_Fs44100_Gain1_B1 (-0.218894)
+#define HPF_Fs44100_Gain1_B2 0.000000
+/* Gain = 2.000000 dB */
+#define HPF_Fs44100_Gain2_A0 1.157801
+#define HPF_Fs44100_Gain2_A1 (-0.376695)
+#define HPF_Fs44100_Gain2_A2 0.000000
+#define HPF_Fs44100_Gain2_B1 (-0.218894)
+#define HPF_Fs44100_Gain2_B2 0.000000
+/* Gain = 3.000000 dB */
+#define HPF_Fs44100_Gain3_A0 1.251420
+#define HPF_Fs44100_Gain3_A1 (-0.470313)
+#define HPF_Fs44100_Gain3_A2 0.000000
+#define HPF_Fs44100_Gain3_B1 (-0.218894)
+#define HPF_Fs44100_Gain3_B2 0.000000
+/* Gain = 4.000000 dB */
+#define HPF_Fs44100_Gain4_A0 1.356461
+#define HPF_Fs44100_Gain4_A1 (-0.575355)
+#define HPF_Fs44100_Gain4_A2 0.000000
+#define HPF_Fs44100_Gain4_B1 (-0.218894)
+#define HPF_Fs44100_Gain4_B2 0.000000
+/* Gain = 5.000000 dB */
+#define HPF_Fs44100_Gain5_A0 1.474320
+#define HPF_Fs44100_Gain5_A1 (-0.693213)
+#define HPF_Fs44100_Gain5_A2 0.000000
+#define HPF_Fs44100_Gain5_B1 (-0.218894)
+#define HPF_Fs44100_Gain5_B2 0.000000
+/* Gain = 6.000000 dB */
+#define HPF_Fs44100_Gain6_A0 1.606559
+#define HPF_Fs44100_Gain6_A1 (-0.825453)
+#define HPF_Fs44100_Gain6_A2 0.000000
+#define HPF_Fs44100_Gain6_B1 (-0.218894)
+#define HPF_Fs44100_Gain6_B2 0.000000
+/* Gain = 7.000000 dB */
+#define HPF_Fs44100_Gain7_A0 1.754935
+#define HPF_Fs44100_Gain7_A1 (-0.973828)
+#define HPF_Fs44100_Gain7_A2 0.000000
+#define HPF_Fs44100_Gain7_B1 (-0.218894)
+#define HPF_Fs44100_Gain7_B2 0.000000
+/* Gain = 8.000000 dB */
+#define HPF_Fs44100_Gain8_A0 1.921414
+#define HPF_Fs44100_Gain8_A1 (-1.140308)
+#define HPF_Fs44100_Gain8_A2 0.000000
+#define HPF_Fs44100_Gain8_B1 (-0.218894)
+#define HPF_Fs44100_Gain8_B2 0.000000
+/* Gain = 9.000000 dB */
+#define HPF_Fs44100_Gain9_A0 2.108208
+#define HPF_Fs44100_Gain9_A1 (-1.327101)
+#define HPF_Fs44100_Gain9_A2 0.000000
+#define HPF_Fs44100_Gain9_B1 (-0.218894)
+#define HPF_Fs44100_Gain9_B2 0.000000
+/* Gain = 10.000000 dB */
+#define HPF_Fs44100_Gain10_A0 2.317793
+#define HPF_Fs44100_Gain10_A1 (-1.536687)
+#define HPF_Fs44100_Gain10_A2 0.000000
+#define HPF_Fs44100_Gain10_B1 (-0.218894)
+#define HPF_Fs44100_Gain10_B2 0.000000
+/* Gain = 11.000000 dB */
+#define HPF_Fs44100_Gain11_A0 2.552952
+#define HPF_Fs44100_Gain11_A1 (-1.771846)
+#define HPF_Fs44100_Gain11_A2 0.000000
+#define HPF_Fs44100_Gain11_B1 (-0.218894)
+#define HPF_Fs44100_Gain11_B2 0.000000
+/* Gain = 12.000000 dB */
+#define HPF_Fs44100_Gain12_A0 2.816805
+#define HPF_Fs44100_Gain12_A1 (-2.035698)
+#define HPF_Fs44100_Gain12_A2 0.000000
+#define HPF_Fs44100_Gain12_B1 (-0.218894)
+#define HPF_Fs44100_Gain12_B2 0.000000
+/* Gain = 13.000000 dB */
+#define HPF_Fs44100_Gain13_A0 3.112852
+#define HPF_Fs44100_Gain13_A1 (-2.331746)
+#define HPF_Fs44100_Gain13_A2 0.000000
+#define HPF_Fs44100_Gain13_B1 (-0.218894)
+#define HPF_Fs44100_Gain13_B2 0.000000
+/* Gain = 14.000000 dB */
+#define HPF_Fs44100_Gain14_A0 3.445023
+#define HPF_Fs44100_Gain14_A1 (-2.663916)
+#define HPF_Fs44100_Gain14_A2 0.000000
+#define HPF_Fs44100_Gain14_B1 (-0.218894)
+#define HPF_Fs44100_Gain14_B2 0.000000
+/* Gain = 15.000000 dB */
+#define HPF_Fs44100_Gain15_A0 3.817724
+#define HPF_Fs44100_Gain15_A1 (-3.036618)
+#define HPF_Fs44100_Gain15_A2 0.000000
+#define HPF_Fs44100_Gain15_B1 (-0.218894)
+#define HPF_Fs44100_Gain15_B2 0.000000
/* Coefficients for sample rate 48000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs48000_Gain1_A0 1.077357
-#define HPF_Fs48000_Gain1_A1 (-0.345306)
-#define HPF_Fs48000_Gain1_A2 0.000000
-#define HPF_Fs48000_Gain1_B1 (-0.267949)
-#define HPF_Fs48000_Gain1_B2 0.000000
- /* Gain = 2.000000 dB */
-#define HPF_Fs48000_Gain2_A0 1.164152
-#define HPF_Fs48000_Gain2_A1 (-0.432101)
-#define HPF_Fs48000_Gain2_A2 0.000000
-#define HPF_Fs48000_Gain2_B1 (-0.267949)
-#define HPF_Fs48000_Gain2_B2 0.000000
- /* Gain = 3.000000 dB */
-#define HPF_Fs48000_Gain3_A0 1.261538
-#define HPF_Fs48000_Gain3_A1 (-0.529488)
-#define HPF_Fs48000_Gain3_A2 0.000000
-#define HPF_Fs48000_Gain3_B1 (-0.267949)
-#define HPF_Fs48000_Gain3_B2 0.000000
- /* Gain = 4.000000 dB */
-#define HPF_Fs48000_Gain4_A0 1.370807
-#define HPF_Fs48000_Gain4_A1 (-0.638757)
-#define HPF_Fs48000_Gain4_A2 0.000000
-#define HPF_Fs48000_Gain4_B1 (-0.267949)
-#define HPF_Fs48000_Gain4_B2 0.000000
- /* Gain = 5.000000 dB */
-#define HPF_Fs48000_Gain5_A0 1.493409
-#define HPF_Fs48000_Gain5_A1 (-0.761359)
-#define HPF_Fs48000_Gain5_A2 0.000000
-#define HPF_Fs48000_Gain5_B1 (-0.267949)
-#define HPF_Fs48000_Gain5_B2 0.000000
- /* Gain = 6.000000 dB */
-#define HPF_Fs48000_Gain6_A0 1.630971
-#define HPF_Fs48000_Gain6_A1 (-0.898920)
-#define HPF_Fs48000_Gain6_A2 0.000000
-#define HPF_Fs48000_Gain6_B1 (-0.267949)
-#define HPF_Fs48000_Gain6_B2 0.000000
- /* Gain = 7.000000 dB */
-#define HPF_Fs48000_Gain7_A0 1.785318
-#define HPF_Fs48000_Gain7_A1 (-1.053267)
-#define HPF_Fs48000_Gain7_A2 0.000000
-#define HPF_Fs48000_Gain7_B1 (-0.267949)
-#define HPF_Fs48000_Gain7_B2 0.000000
- /* Gain = 8.000000 dB */
-#define HPF_Fs48000_Gain8_A0 1.958498
-#define HPF_Fs48000_Gain8_A1 (-1.226447)
-#define HPF_Fs48000_Gain8_A2 0.000000
-#define HPF_Fs48000_Gain8_B1 (-0.267949)
-#define HPF_Fs48000_Gain8_B2 0.000000
- /* Gain = 9.000000 dB */
-#define HPF_Fs48000_Gain9_A0 2.152809
-#define HPF_Fs48000_Gain9_A1 (-1.420758)
-#define HPF_Fs48000_Gain9_A2 0.000000
-#define HPF_Fs48000_Gain9_B1 (-0.267949)
-#define HPF_Fs48000_Gain9_B2 0.000000
- /* Gain = 10.000000 dB */
-#define HPF_Fs48000_Gain10_A0 2.370829
-#define HPF_Fs48000_Gain10_A1 (-1.638778)
-#define HPF_Fs48000_Gain10_A2 0.000000
-#define HPF_Fs48000_Gain10_B1 (-0.267949)
-#define HPF_Fs48000_Gain10_B2 0.000000
- /* Gain = 11.000000 dB */
-#define HPF_Fs48000_Gain11_A0 2.615452
-#define HPF_Fs48000_Gain11_A1 (-1.883401)
-#define HPF_Fs48000_Gain11_A2 0.000000
-#define HPF_Fs48000_Gain11_B1 (-0.267949)
-#define HPF_Fs48000_Gain11_B2 0.000000
- /* Gain = 12.000000 dB */
-#define HPF_Fs48000_Gain12_A0 2.889924
-#define HPF_Fs48000_Gain12_A1 (-2.157873)
-#define HPF_Fs48000_Gain12_A2 0.000000
-#define HPF_Fs48000_Gain12_B1 (-0.267949)
-#define HPF_Fs48000_Gain12_B2 0.000000
- /* Gain = 13.000000 dB */
-#define HPF_Fs48000_Gain13_A0 3.197886
-#define HPF_Fs48000_Gain13_A1 (-2.465835)
-#define HPF_Fs48000_Gain13_A2 0.000000
-#define HPF_Fs48000_Gain13_B1 (-0.267949)
-#define HPF_Fs48000_Gain13_B2 0.000000
- /* Gain = 14.000000 dB */
-#define HPF_Fs48000_Gain14_A0 3.543425
-#define HPF_Fs48000_Gain14_A1 (-2.811374)
-#define HPF_Fs48000_Gain14_A2 0.000000
-#define HPF_Fs48000_Gain14_B1 (-0.267949)
-#define HPF_Fs48000_Gain14_B2 0.000000
- /* Gain = 15.000000 dB */
-#define HPF_Fs48000_Gain15_A0 3.931127
-#define HPF_Fs48000_Gain15_A1 (-3.199076)
-#define HPF_Fs48000_Gain15_A2 0.000000
-#define HPF_Fs48000_Gain15_B1 (-0.267949)
-#define HPF_Fs48000_Gain15_B2 0.000000
+/* Gain = 1.000000 dB */
+#define HPF_Fs48000_Gain1_A0 1.077357
+#define HPF_Fs48000_Gain1_A1 (-0.345306)
+#define HPF_Fs48000_Gain1_A2 0.000000
+#define HPF_Fs48000_Gain1_B1 (-0.267949)
+#define HPF_Fs48000_Gain1_B2 0.000000
+/* Gain = 2.000000 dB */
+#define HPF_Fs48000_Gain2_A0 1.164152
+#define HPF_Fs48000_Gain2_A1 (-0.432101)
+#define HPF_Fs48000_Gain2_A2 0.000000
+#define HPF_Fs48000_Gain2_B1 (-0.267949)
+#define HPF_Fs48000_Gain2_B2 0.000000
+/* Gain = 3.000000 dB */
+#define HPF_Fs48000_Gain3_A0 1.261538
+#define HPF_Fs48000_Gain3_A1 (-0.529488)
+#define HPF_Fs48000_Gain3_A2 0.000000
+#define HPF_Fs48000_Gain3_B1 (-0.267949)
+#define HPF_Fs48000_Gain3_B2 0.000000
+/* Gain = 4.000000 dB */
+#define HPF_Fs48000_Gain4_A0 1.370807
+#define HPF_Fs48000_Gain4_A1 (-0.638757)
+#define HPF_Fs48000_Gain4_A2 0.000000
+#define HPF_Fs48000_Gain4_B1 (-0.267949)
+#define HPF_Fs48000_Gain4_B2 0.000000
+/* Gain = 5.000000 dB */
+#define HPF_Fs48000_Gain5_A0 1.493409
+#define HPF_Fs48000_Gain5_A1 (-0.761359)
+#define HPF_Fs48000_Gain5_A2 0.000000
+#define HPF_Fs48000_Gain5_B1 (-0.267949)
+#define HPF_Fs48000_Gain5_B2 0.000000
+/* Gain = 6.000000 dB */
+#define HPF_Fs48000_Gain6_A0 1.630971
+#define HPF_Fs48000_Gain6_A1 (-0.898920)
+#define HPF_Fs48000_Gain6_A2 0.000000
+#define HPF_Fs48000_Gain6_B1 (-0.267949)
+#define HPF_Fs48000_Gain6_B2 0.000000
+/* Gain = 7.000000 dB */
+#define HPF_Fs48000_Gain7_A0 1.785318
+#define HPF_Fs48000_Gain7_A1 (-1.053267)
+#define HPF_Fs48000_Gain7_A2 0.000000
+#define HPF_Fs48000_Gain7_B1 (-0.267949)
+#define HPF_Fs48000_Gain7_B2 0.000000
+/* Gain = 8.000000 dB */
+#define HPF_Fs48000_Gain8_A0 1.958498
+#define HPF_Fs48000_Gain8_A1 (-1.226447)
+#define HPF_Fs48000_Gain8_A2 0.000000
+#define HPF_Fs48000_Gain8_B1 (-0.267949)
+#define HPF_Fs48000_Gain8_B2 0.000000
+/* Gain = 9.000000 dB */
+#define HPF_Fs48000_Gain9_A0 2.152809
+#define HPF_Fs48000_Gain9_A1 (-1.420758)
+#define HPF_Fs48000_Gain9_A2 0.000000
+#define HPF_Fs48000_Gain9_B1 (-0.267949)
+#define HPF_Fs48000_Gain9_B2 0.000000
+/* Gain = 10.000000 dB */
+#define HPF_Fs48000_Gain10_A0 2.370829
+#define HPF_Fs48000_Gain10_A1 (-1.638778)
+#define HPF_Fs48000_Gain10_A2 0.000000
+#define HPF_Fs48000_Gain10_B1 (-0.267949)
+#define HPF_Fs48000_Gain10_B2 0.000000
+/* Gain = 11.000000 dB */
+#define HPF_Fs48000_Gain11_A0 2.615452
+#define HPF_Fs48000_Gain11_A1 (-1.883401)
+#define HPF_Fs48000_Gain11_A2 0.000000
+#define HPF_Fs48000_Gain11_B1 (-0.267949)
+#define HPF_Fs48000_Gain11_B2 0.000000
+/* Gain = 12.000000 dB */
+#define HPF_Fs48000_Gain12_A0 2.889924
+#define HPF_Fs48000_Gain12_A1 (-2.157873)
+#define HPF_Fs48000_Gain12_A2 0.000000
+#define HPF_Fs48000_Gain12_B1 (-0.267949)
+#define HPF_Fs48000_Gain12_B2 0.000000
+/* Gain = 13.000000 dB */
+#define HPF_Fs48000_Gain13_A0 3.197886
+#define HPF_Fs48000_Gain13_A1 (-2.465835)
+#define HPF_Fs48000_Gain13_A2 0.000000
+#define HPF_Fs48000_Gain13_B1 (-0.267949)
+#define HPF_Fs48000_Gain13_B2 0.000000
+/* Gain = 14.000000 dB */
+#define HPF_Fs48000_Gain14_A0 3.543425
+#define HPF_Fs48000_Gain14_A1 (-2.811374)
+#define HPF_Fs48000_Gain14_A2 0.000000
+#define HPF_Fs48000_Gain14_B1 (-0.267949)
+#define HPF_Fs48000_Gain14_B2 0.000000
+/* Gain = 15.000000 dB */
+#define HPF_Fs48000_Gain15_A0 3.931127
+#define HPF_Fs48000_Gain15_A1 (-3.199076)
+#define HPF_Fs48000_Gain15_A2 0.000000
+#define HPF_Fs48000_Gain15_B1 (-0.267949)
+#define HPF_Fs48000_Gain15_B2 0.000000
/* Coefficients for sample rate 88200 */
/* Gain = 1.000000 dB */
-#define HPF_Fs88200_Gain1_A0 1.094374f
-#define HPF_Fs88200_Gain1_A1 (-0.641256f)
-#define HPF_Fs88200_Gain1_A2 0.000000f
-#define HPF_Fs88200_Gain1_B1 (-0.546882f)
-#define HPF_Fs88200_Gain1_B2 0.000000f
+#define HPF_Fs88200_Gain1_A0 1.094374f
+#define HPF_Fs88200_Gain1_A1 (-0.641256f)
+#define HPF_Fs88200_Gain1_A2 0.000000f
+#define HPF_Fs88200_Gain1_B1 (-0.546882f)
+#define HPF_Fs88200_Gain1_B2 0.000000f
/* Gain = 2.000000 dB */
-#define HPF_Fs88200_Gain2_A0 1.200264f
-#define HPF_Fs88200_Gain2_A1 (-0.747146f)
-#define HPF_Fs88200_Gain2_A2 0.000000f
-#define HPF_Fs88200_Gain2_B1 (-0.546882f)
-#define HPF_Fs88200_Gain2_B2 0.000000f
+#define HPF_Fs88200_Gain2_A0 1.200264f
+#define HPF_Fs88200_Gain2_A1 (-0.747146f)
+#define HPF_Fs88200_Gain2_A2 0.000000f
+#define HPF_Fs88200_Gain2_B1 (-0.546882f)
+#define HPF_Fs88200_Gain2_B2 0.000000f
/* Gain = 3.000000 dB */
-#define HPF_Fs88200_Gain3_A0 1.319074f
-#define HPF_Fs88200_Gain3_A1 (-0.865956f)
-#define HPF_Fs88200_Gain3_A2 0.000000f
-#define HPF_Fs88200_Gain3_B1 (-0.546882f)
-#define HPF_Fs88200_Gain3_B2 0.000000f
+#define HPF_Fs88200_Gain3_A0 1.319074f
+#define HPF_Fs88200_Gain3_A1 (-0.865956f)
+#define HPF_Fs88200_Gain3_A2 0.000000f
+#define HPF_Fs88200_Gain3_B1 (-0.546882f)
+#define HPF_Fs88200_Gain3_B2 0.000000f
/* Gain = 4.000000 dB */
-#define HPF_Fs88200_Gain4_A0 1.452380f
-#define HPF_Fs88200_Gain4_A1 (-0.999263f)
-#define HPF_Fs88200_Gain4_A2 0.000000f
-#define HPF_Fs88200_Gain4_B1 (-0.546882f)
-#define HPF_Fs88200_Gain4_B2 0.000000f
+#define HPF_Fs88200_Gain4_A0 1.452380f
+#define HPF_Fs88200_Gain4_A1 (-0.999263f)
+#define HPF_Fs88200_Gain4_A2 0.000000f
+#define HPF_Fs88200_Gain4_B1 (-0.546882f)
+#define HPF_Fs88200_Gain4_B2 0.000000f
/* Gain = 5.000000 dB */
-#define HPF_Fs88200_Gain5_A0 1.601953f
-#define HPF_Fs88200_Gain5_A1 (-1.148836f)
-#define HPF_Fs88200_Gain5_A2 0.000000f
-#define HPF_Fs88200_Gain5_B1 (-0.546882f)
-#define HPF_Fs88200_Gain5_B2 0.000000f
+#define HPF_Fs88200_Gain5_A0 1.601953f
+#define HPF_Fs88200_Gain5_A1 (-1.148836f)
+#define HPF_Fs88200_Gain5_A2 0.000000f
+#define HPF_Fs88200_Gain5_B1 (-0.546882f)
+#define HPF_Fs88200_Gain5_B2 0.000000f
/* Gain = 6.000000 dB */
-#define HPF_Fs88200_Gain6_A0 1.769777f
-#define HPF_Fs88200_Gain6_A1 (-1.316659f)
-#define HPF_Fs88200_Gain6_A2 0.000000f
-#define HPF_Fs88200_Gain6_B1 (-0.546882f)
-#define HPF_Fs88200_Gain6_B2 0.000000f
+#define HPF_Fs88200_Gain6_A0 1.769777f
+#define HPF_Fs88200_Gain6_A1 (-1.316659f)
+#define HPF_Fs88200_Gain6_A2 0.000000f
+#define HPF_Fs88200_Gain6_B1 (-0.546882f)
+#define HPF_Fs88200_Gain6_B2 0.000000f
/* Gain = 7.000000 dB */
-#define HPF_Fs88200_Gain7_A0 1.958078f
-#define HPF_Fs88200_Gain7_A1 (-1.504960f)
-#define HPF_Fs88200_Gain7_A2 0.000000f
-#define HPF_Fs88200_Gain7_B1 (-0.546882f)
-#define HPF_Fs88200_Gain7_B2 0.000000f
+#define HPF_Fs88200_Gain7_A0 1.958078f
+#define HPF_Fs88200_Gain7_A1 (-1.504960f)
+#define HPF_Fs88200_Gain7_A2 0.000000f
+#define HPF_Fs88200_Gain7_B1 (-0.546882f)
+#define HPF_Fs88200_Gain7_B2 0.000000f
/* Gain = 8.000000 dB */
-#define HPF_Fs88200_Gain8_A0 2.169355f
-#define HPF_Fs88200_Gain8_A1 (-1.716238f)
-#define HPF_Fs88200_Gain8_A2 0.000000f
-#define HPF_Fs88200_Gain8_B1 (-0.546882f)
-#define HPF_Fs88200_Gain8_B2 0.000000f
+#define HPF_Fs88200_Gain8_A0 2.169355f
+#define HPF_Fs88200_Gain8_A1 (-1.716238f)
+#define HPF_Fs88200_Gain8_A2 0.000000f
+#define HPF_Fs88200_Gain8_B1 (-0.546882f)
+#define HPF_Fs88200_Gain8_B2 0.000000f
/* Gain = 9.000000 dB */
-#define HPF_Fs88200_Gain9_A0 2.406412f
-#define HPF_Fs88200_Gain9_A1 (-1.953295f)
-#define HPF_Fs88200_Gain9_A2 0.000000f
-#define HPF_Fs88200_Gain9_B1 (-0.546882f)
-#define HPF_Fs88200_Gain9_B2 0.000000f
+#define HPF_Fs88200_Gain9_A0 2.406412f
+#define HPF_Fs88200_Gain9_A1 (-1.953295f)
+#define HPF_Fs88200_Gain9_A2 0.000000f
+#define HPF_Fs88200_Gain9_B1 (-0.546882f)
+#define HPF_Fs88200_Gain9_B2 0.000000f
/* Gain = 10.000000 dB */
-#define HPF_Fs88200_Gain10_A0 2.672395f
-#define HPF_Fs88200_Gain10_A1 (-2.219277f)
-#define HPF_Fs88200_Gain10_A2 0.000000f
-#define HPF_Fs88200_Gain10_B1 (-0.546882f)
-#define HPF_Fs88200_Gain10_B2 0.000000f
+#define HPF_Fs88200_Gain10_A0 2.672395f
+#define HPF_Fs88200_Gain10_A1 (-2.219277f)
+#define HPF_Fs88200_Gain10_A2 0.000000f
+#define HPF_Fs88200_Gain10_B1 (-0.546882f)
+#define HPF_Fs88200_Gain10_B2 0.000000f
/* Gain = 11.000000 dB */
-#define HPF_Fs88200_Gain11_A0 2.970832f
-#define HPF_Fs88200_Gain11_A1 (-2.517714f)
-#define HPF_Fs88200_Gain11_A2 0.000000f
-#define HPF_Fs88200_Gain11_B1 (-0.546882f)
-#define HPF_Fs88200_Gain11_B2 0.000000f
+#define HPF_Fs88200_Gain11_A0 2.970832f
+#define HPF_Fs88200_Gain11_A1 (-2.517714f)
+#define HPF_Fs88200_Gain11_A2 0.000000f
+#define HPF_Fs88200_Gain11_B1 (-0.546882f)
+#define HPF_Fs88200_Gain11_B2 0.000000f
/* Gain = 12.000000 dB */
-#define HPF_Fs88200_Gain12_A0 3.305684f
-#define HPF_Fs88200_Gain12_A1 (-2.852566f)
-#define HPF_Fs88200_Gain12_A2 0.000000f
-#define HPF_Fs88200_Gain12_B1 (-0.546882f)
-#define HPF_Fs88200_Gain12_B2 0.000000f
+#define HPF_Fs88200_Gain12_A0 3.305684f
+#define HPF_Fs88200_Gain12_A1 (-2.852566f)
+#define HPF_Fs88200_Gain12_A2 0.000000f
+#define HPF_Fs88200_Gain12_B1 (-0.546882f)
+#define HPF_Fs88200_Gain12_B2 0.000000f
/* Gain = 13.000000 dB */
-#define HPF_Fs88200_Gain13_A0 3.681394f
-#define HPF_Fs88200_Gain13_A1 (-3.228276f)
-#define HPF_Fs88200_Gain13_A2 0.000000f
-#define HPF_Fs88200_Gain13_B1 (-0.546882f)
-#define HPF_Fs88200_Gain13_B2 0.000000f
+#define HPF_Fs88200_Gain13_A0 3.681394f
+#define HPF_Fs88200_Gain13_A1 (-3.228276f)
+#define HPF_Fs88200_Gain13_A2 0.000000f
+#define HPF_Fs88200_Gain13_B1 (-0.546882f)
+#define HPF_Fs88200_Gain13_B2 0.000000f
/* Gain = 14.000000 dB */
-#define HPF_Fs88200_Gain14_A0 4.102947f
-#define HPF_Fs88200_Gain14_A1 (-3.649830f)
-#define HPF_Fs88200_Gain14_A2 0.000000f
-#define HPF_Fs88200_Gain14_B1 (-0.546882f)
-#define HPF_Fs88200_Gain14_B2 0.000000f
+#define HPF_Fs88200_Gain14_A0 4.102947f
+#define HPF_Fs88200_Gain14_A1 (-3.649830f)
+#define HPF_Fs88200_Gain14_A2 0.000000f
+#define HPF_Fs88200_Gain14_B1 (-0.546882f)
+#define HPF_Fs88200_Gain14_B2 0.000000f
/* Gain = 15.000000 dB */
-#define HPF_Fs88200_Gain15_A0 4.575938f
-#define HPF_Fs88200_Gain15_A1 (-4.122820f)
-#define HPF_Fs88200_Gain15_A2 0.000000f
-#define HPF_Fs88200_Gain15_B1 (-0.546882f)
-#define HPF_Fs88200_Gain15_B2 0.000000f
+#define HPF_Fs88200_Gain15_A0 4.575938f
+#define HPF_Fs88200_Gain15_A1 (-4.122820f)
+#define HPF_Fs88200_Gain15_A2 0.000000f
+#define HPF_Fs88200_Gain15_B1 (-0.546882f)
+#define HPF_Fs88200_Gain15_B2 0.000000f
/* Coefficients for sample rate 96000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs96000_Gain1_A0 1.096233
-#define HPF_Fs96000_Gain1_A1 (-0.673583)
-#define HPF_Fs96000_Gain1_A2 0.000000
-#define HPF_Fs96000_Gain1_B1 (-0.577350)
-#define HPF_Fs96000_Gain1_B2 0.000000
- /* Gain = 2.000000 dB */
-#define HPF_Fs96000_Gain2_A0 1.204208
-#define HPF_Fs96000_Gain2_A1 (-0.781558)
-#define HPF_Fs96000_Gain2_A2 0.000000
-#define HPF_Fs96000_Gain2_B1 (-0.577350)
-#define HPF_Fs96000_Gain2_B2 0.000000
- /* Gain = 3.000000 dB */
-#define HPF_Fs96000_Gain3_A0 1.325358
-#define HPF_Fs96000_Gain3_A1 (-0.902708)
-#define HPF_Fs96000_Gain3_A2 0.000000
-#define HPF_Fs96000_Gain3_B1 (-0.577350)
-#define HPF_Fs96000_Gain3_B2 0.000000
- /* Gain = 4.000000 dB */
-#define HPF_Fs96000_Gain4_A0 1.461291
-#define HPF_Fs96000_Gain4_A1 (-1.038641)
-#define HPF_Fs96000_Gain4_A2 0.000000
-#define HPF_Fs96000_Gain4_B1 (-0.577350)
-#define HPF_Fs96000_Gain4_B2 0.000000
- /* Gain = 5.000000 dB */
-#define HPF_Fs96000_Gain5_A0 1.613810
-#define HPF_Fs96000_Gain5_A1 (-1.191160)
-#define HPF_Fs96000_Gain5_A2 0.000000
-#define HPF_Fs96000_Gain5_B1 (-0.577350)
-#define HPF_Fs96000_Gain5_B2 0.000000
- /* Gain = 6.000000 dB */
-#define HPF_Fs96000_Gain6_A0 1.784939
-#define HPF_Fs96000_Gain6_A1 (-1.362289)
-#define HPF_Fs96000_Gain6_A2 0.000000
-#define HPF_Fs96000_Gain6_B1 (-0.577350)
-#define HPF_Fs96000_Gain6_B2 0.000000
- /* Gain = 7.000000 dB */
-#define HPF_Fs96000_Gain7_A0 1.976949
-#define HPF_Fs96000_Gain7_A1 (-1.554299)
-#define HPF_Fs96000_Gain7_A2 0.000000
-#define HPF_Fs96000_Gain7_B1 (-0.577350)
-#define HPF_Fs96000_Gain7_B2 0.000000
- /* Gain = 8.000000 dB */
-#define HPF_Fs96000_Gain8_A0 2.192387
-#define HPF_Fs96000_Gain8_A1 (-1.769738)
-#define HPF_Fs96000_Gain8_A2 0.000000
-#define HPF_Fs96000_Gain8_B1 (-0.577350)
-#define HPF_Fs96000_Gain8_B2 0.000000
- /* Gain = 9.000000 dB */
-#define HPF_Fs96000_Gain9_A0 2.434113
-#define HPF_Fs96000_Gain9_A1 (-2.011464)
-#define HPF_Fs96000_Gain9_A2 0.000000
-#define HPF_Fs96000_Gain9_B1 (-0.577350)
-#define HPF_Fs96000_Gain9_B2 0.000000
- /* Gain = 10.000000 dB */
-#define HPF_Fs96000_Gain10_A0 2.705335
-#define HPF_Fs96000_Gain10_A1 (-2.282685)
-#define HPF_Fs96000_Gain10_A2 0.000000
-#define HPF_Fs96000_Gain10_B1 (-0.577350)
-#define HPF_Fs96000_Gain10_B2 0.000000
- /* Gain = 11.000000 dB */
-#define HPF_Fs96000_Gain11_A0 3.009650
-#define HPF_Fs96000_Gain11_A1 (-2.587000)
-#define HPF_Fs96000_Gain11_A2 0.000000
-#define HPF_Fs96000_Gain11_B1 (-0.577350)
-#define HPF_Fs96000_Gain11_B2 0.000000
- /* Gain = 12.000000 dB */
-#define HPF_Fs96000_Gain12_A0 3.351097
-#define HPF_Fs96000_Gain12_A1 (-2.928447)
-#define HPF_Fs96000_Gain12_A2 0.000000
-#define HPF_Fs96000_Gain12_B1 (-0.577350)
-#define HPF_Fs96000_Gain12_B2 0.000000
- /* Gain = 13.000000 dB */
-#define HPF_Fs96000_Gain13_A0 3.734207
-#define HPF_Fs96000_Gain13_A1 (-3.311558)
-#define HPF_Fs96000_Gain13_A2 0.000000
-#define HPF_Fs96000_Gain13_B1 (-0.577350)
-#define HPF_Fs96000_Gain13_B2 0.000000
- /* Gain = 14.000000 dB */
-#define HPF_Fs96000_Gain14_A0 4.164064
-#define HPF_Fs96000_Gain14_A1 (-3.741414)
-#define HPF_Fs96000_Gain14_A2 0.000000
-#define HPF_Fs96000_Gain14_B1 (-0.577350)
-#define HPF_Fs96000_Gain14_B2 0.000000
- /* Gain = 15.000000 dB */
-#define HPF_Fs96000_Gain15_A0 4.646371
-#define HPF_Fs96000_Gain15_A1 (-4.223721)
-#define HPF_Fs96000_Gain15_A2 0.000000
-#define HPF_Fs96000_Gain15_B1 (-0.577350)
-#define HPF_Fs96000_Gain15_B2 0.000000
+/* Gain = 1.000000 dB */
+#define HPF_Fs96000_Gain1_A0 1.096233
+#define HPF_Fs96000_Gain1_A1 (-0.673583)
+#define HPF_Fs96000_Gain1_A2 0.000000
+#define HPF_Fs96000_Gain1_B1 (-0.577350)
+#define HPF_Fs96000_Gain1_B2 0.000000
+/* Gain = 2.000000 dB */
+#define HPF_Fs96000_Gain2_A0 1.204208
+#define HPF_Fs96000_Gain2_A1 (-0.781558)
+#define HPF_Fs96000_Gain2_A2 0.000000
+#define HPF_Fs96000_Gain2_B1 (-0.577350)
+#define HPF_Fs96000_Gain2_B2 0.000000
+/* Gain = 3.000000 dB */
+#define HPF_Fs96000_Gain3_A0 1.325358
+#define HPF_Fs96000_Gain3_A1 (-0.902708)
+#define HPF_Fs96000_Gain3_A2 0.000000
+#define HPF_Fs96000_Gain3_B1 (-0.577350)
+#define HPF_Fs96000_Gain3_B2 0.000000
+/* Gain = 4.000000 dB */
+#define HPF_Fs96000_Gain4_A0 1.461291
+#define HPF_Fs96000_Gain4_A1 (-1.038641)
+#define HPF_Fs96000_Gain4_A2 0.000000
+#define HPF_Fs96000_Gain4_B1 (-0.577350)
+#define HPF_Fs96000_Gain4_B2 0.000000
+/* Gain = 5.000000 dB */
+#define HPF_Fs96000_Gain5_A0 1.613810
+#define HPF_Fs96000_Gain5_A1 (-1.191160)
+#define HPF_Fs96000_Gain5_A2 0.000000
+#define HPF_Fs96000_Gain5_B1 (-0.577350)
+#define HPF_Fs96000_Gain5_B2 0.000000
+/* Gain = 6.000000 dB */
+#define HPF_Fs96000_Gain6_A0 1.784939
+#define HPF_Fs96000_Gain6_A1 (-1.362289)
+#define HPF_Fs96000_Gain6_A2 0.000000
+#define HPF_Fs96000_Gain6_B1 (-0.577350)
+#define HPF_Fs96000_Gain6_B2 0.000000
+/* Gain = 7.000000 dB */
+#define HPF_Fs96000_Gain7_A0 1.976949
+#define HPF_Fs96000_Gain7_A1 (-1.554299)
+#define HPF_Fs96000_Gain7_A2 0.000000
+#define HPF_Fs96000_Gain7_B1 (-0.577350)
+#define HPF_Fs96000_Gain7_B2 0.000000
+/* Gain = 8.000000 dB */
+#define HPF_Fs96000_Gain8_A0 2.192387
+#define HPF_Fs96000_Gain8_A1 (-1.769738)
+#define HPF_Fs96000_Gain8_A2 0.000000
+#define HPF_Fs96000_Gain8_B1 (-0.577350)
+#define HPF_Fs96000_Gain8_B2 0.000000
+/* Gain = 9.000000 dB */
+#define HPF_Fs96000_Gain9_A0 2.434113
+#define HPF_Fs96000_Gain9_A1 (-2.011464)
+#define HPF_Fs96000_Gain9_A2 0.000000
+#define HPF_Fs96000_Gain9_B1 (-0.577350)
+#define HPF_Fs96000_Gain9_B2 0.000000
+/* Gain = 10.000000 dB */
+#define HPF_Fs96000_Gain10_A0 2.705335
+#define HPF_Fs96000_Gain10_A1 (-2.282685)
+#define HPF_Fs96000_Gain10_A2 0.000000
+#define HPF_Fs96000_Gain10_B1 (-0.577350)
+#define HPF_Fs96000_Gain10_B2 0.000000
+/* Gain = 11.000000 dB */
+#define HPF_Fs96000_Gain11_A0 3.009650
+#define HPF_Fs96000_Gain11_A1 (-2.587000)
+#define HPF_Fs96000_Gain11_A2 0.000000
+#define HPF_Fs96000_Gain11_B1 (-0.577350)
+#define HPF_Fs96000_Gain11_B2 0.000000
+/* Gain = 12.000000 dB */
+#define HPF_Fs96000_Gain12_A0 3.351097
+#define HPF_Fs96000_Gain12_A1 (-2.928447)
+#define HPF_Fs96000_Gain12_A2 0.000000
+#define HPF_Fs96000_Gain12_B1 (-0.577350)
+#define HPF_Fs96000_Gain12_B2 0.000000
+/* Gain = 13.000000 dB */
+#define HPF_Fs96000_Gain13_A0 3.734207
+#define HPF_Fs96000_Gain13_A1 (-3.311558)
+#define HPF_Fs96000_Gain13_A2 0.000000
+#define HPF_Fs96000_Gain13_B1 (-0.577350)
+#define HPF_Fs96000_Gain13_B2 0.000000
+/* Gain = 14.000000 dB */
+#define HPF_Fs96000_Gain14_A0 4.164064
+#define HPF_Fs96000_Gain14_A1 (-3.741414)
+#define HPF_Fs96000_Gain14_A2 0.000000
+#define HPF_Fs96000_Gain14_B1 (-0.577350)
+#define HPF_Fs96000_Gain14_B2 0.000000
+/* Gain = 15.000000 dB */
+#define HPF_Fs96000_Gain15_A0 4.646371
+#define HPF_Fs96000_Gain15_A1 (-4.223721)
+#define HPF_Fs96000_Gain15_A2 0.000000
+#define HPF_Fs96000_Gain15_B1 (-0.577350)
+#define HPF_Fs96000_Gain15_B2 0.000000
/* Coefficients for sample rate 176400 */
/* Gain = 1.000000 dB */
-#define HPF_Fs176400_Gain1_A0 1.106711f
-#define HPF_Fs176400_Gain1_A1 (-0.855807f)
-#define HPF_Fs176400_Gain1_A2 0.000000f
-#define HPF_Fs176400_Gain1_B1 (-0.749096f)
-#define HPF_Fs176400_Gain1_B2 0.000000f
+#define HPF_Fs176400_Gain1_A0 1.106711f
+#define HPF_Fs176400_Gain1_A1 (-0.855807f)
+#define HPF_Fs176400_Gain1_A2 0.000000f
+#define HPF_Fs176400_Gain1_B1 (-0.749096f)
+#define HPF_Fs176400_Gain1_B2 0.000000f
/* Gain = 2.000000 dB */
-#define HPF_Fs176400_Gain2_A0 1.226443f
-#define HPF_Fs176400_Gain2_A1 (-0.975539f)
-#define HPF_Fs176400_Gain2_A2 0.000000f
-#define HPF_Fs176400_Gain2_B1 (-0.749096f)
-#define HPF_Fs176400_Gain2_B2 0.000000f
+#define HPF_Fs176400_Gain2_A0 1.226443f
+#define HPF_Fs176400_Gain2_A1 (-0.975539f)
+#define HPF_Fs176400_Gain2_A2 0.000000f
+#define HPF_Fs176400_Gain2_B1 (-0.749096f)
+#define HPF_Fs176400_Gain2_B2 0.000000f
/* Gain = 3.000000 dB */
-#define HPF_Fs176400_Gain3_A0 1.360784f
-#define HPF_Fs176400_Gain3_A1 (-1.109880f)
-#define HPF_Fs176400_Gain3_A2 0.000000f
-#define HPF_Fs176400_Gain3_B1 (-0.749096f)
-#define HPF_Fs176400_Gain3_B2 0.000000f
+#define HPF_Fs176400_Gain3_A0 1.360784f
+#define HPF_Fs176400_Gain3_A1 (-1.109880f)
+#define HPF_Fs176400_Gain3_A2 0.000000f
+#define HPF_Fs176400_Gain3_B1 (-0.749096f)
+#define HPF_Fs176400_Gain3_B2 0.000000f
/* Gain = 4.000000 dB */
-#define HPF_Fs176400_Gain4_A0 1.511517f
-#define HPF_Fs176400_Gain4_A1 (-1.260613f)
-#define HPF_Fs176400_Gain4_A2 0.000000f
-#define HPF_Fs176400_Gain4_B1 (-0.749096f)
-#define HPF_Fs176400_Gain4_B2 0.000000f
+#define HPF_Fs176400_Gain4_A0 1.511517f
+#define HPF_Fs176400_Gain4_A1 (-1.260613f)
+#define HPF_Fs176400_Gain4_A2 0.000000f
+#define HPF_Fs176400_Gain4_B1 (-0.749096f)
+#define HPF_Fs176400_Gain4_B2 0.000000f
/* Gain = 5.000000 dB */
-#define HPF_Fs176400_Gain5_A0 1.680643f
-#define HPF_Fs176400_Gain5_A1 (-1.429739f)
-#define HPF_Fs176400_Gain5_A2 0.000000f
-#define HPF_Fs176400_Gain5_B1 (-0.749096f)
-#define HPF_Fs176400_Gain5_B2 0.000000f
+#define HPF_Fs176400_Gain5_A0 1.680643f
+#define HPF_Fs176400_Gain5_A1 (-1.429739f)
+#define HPF_Fs176400_Gain5_A2 0.000000f
+#define HPF_Fs176400_Gain5_B1 (-0.749096f)
+#define HPF_Fs176400_Gain5_B2 0.000000f
/* Gain = 6.000000 dB */
-#define HPF_Fs176400_Gain6_A0 1.870405f
-#define HPF_Fs176400_Gain6_A1 (-1.619501f)
-#define HPF_Fs176400_Gain6_A2 0.000000f
-#define HPF_Fs176400_Gain6_B1 (-0.749096f)
-#define HPF_Fs176400_Gain6_B2 0.000000f
+#define HPF_Fs176400_Gain6_A0 1.870405f
+#define HPF_Fs176400_Gain6_A1 (-1.619501f)
+#define HPF_Fs176400_Gain6_A2 0.000000f
+#define HPF_Fs176400_Gain6_B1 (-0.749096f)
+#define HPF_Fs176400_Gain6_B2 0.000000f
/* Gain = 7.000000 dB */
-#define HPF_Fs176400_Gain7_A0 2.083321f
-#define HPF_Fs176400_Gain7_A1 (-1.832417f)
-#define HPF_Fs176400_Gain7_A2 0.000000f
-#define HPF_Fs176400_Gain7_B1 (-0.749096f)
-#define HPF_Fs176400_Gain7_B2 0.000000f
+#define HPF_Fs176400_Gain7_A0 2.083321f
+#define HPF_Fs176400_Gain7_A1 (-1.832417f)
+#define HPF_Fs176400_Gain7_A2 0.000000f
+#define HPF_Fs176400_Gain7_B1 (-0.749096f)
+#define HPF_Fs176400_Gain7_B2 0.000000f
/* Gain = 8.000000 dB */
-#define HPF_Fs176400_Gain8_A0 2.322217f
-#define HPF_Fs176400_Gain8_A1 (-2.071313f)
-#define HPF_Fs176400_Gain8_A2 0.000000f
-#define HPF_Fs176400_Gain8_B1 (-0.749096f)
-#define HPF_Fs176400_Gain8_B2 0.000000f
+#define HPF_Fs176400_Gain8_A0 2.322217f
+#define HPF_Fs176400_Gain8_A1 (-2.071313f)
+#define HPF_Fs176400_Gain8_A2 0.000000f
+#define HPF_Fs176400_Gain8_B1 (-0.749096f)
+#define HPF_Fs176400_Gain8_B2 0.000000f
/* Gain = 9.000000 dB */
-#define HPF_Fs176400_Gain9_A0 2.590263f
-#define HPF_Fs176400_Gain9_A1 (-2.339359f)
-#define HPF_Fs176400_Gain9_A2 0.000000f
-#define HPF_Fs176400_Gain9_B1 (-0.749096f)
-#define HPF_Fs176400_Gain9_B2 0.000000f
+#define HPF_Fs176400_Gain9_A0 2.590263f
+#define HPF_Fs176400_Gain9_A1 (-2.339359f)
+#define HPF_Fs176400_Gain9_A2 0.000000f
+#define HPF_Fs176400_Gain9_B1 (-0.749096f)
+#define HPF_Fs176400_Gain9_B2 0.000000f
/* Gain = 10.000000 dB */
-#define HPF_Fs176400_Gain10_A0 2.891016f
-#define HPF_Fs176400_Gain10_A1 (-2.640112f)
-#define HPF_Fs176400_Gain10_A2 0.000000f
-#define HPF_Fs176400_Gain10_B1 (-0.749096f)
-#define HPF_Fs176400_Gain10_B2 0.000000f
+#define HPF_Fs176400_Gain10_A0 2.891016f
+#define HPF_Fs176400_Gain10_A1 (-2.640112f)
+#define HPF_Fs176400_Gain10_A2 0.000000f
+#define HPF_Fs176400_Gain10_B1 (-0.749096f)
+#define HPF_Fs176400_Gain10_B2 0.000000f
/* Gain = 11.000000 dB */
-#define HPF_Fs176400_Gain11_A0 3.228465f
-#define HPF_Fs176400_Gain11_A1 (-2.977561f)
-#define HPF_Fs176400_Gain11_A2 0.000000f
-#define HPF_Fs176400_Gain11_B1 (-0.749096f)
-#define HPF_Fs176400_Gain11_B2 0.000000f
+#define HPF_Fs176400_Gain11_A0 3.228465f
+#define HPF_Fs176400_Gain11_A1 (-2.977561f)
+#define HPF_Fs176400_Gain11_A2 0.000000f
+#define HPF_Fs176400_Gain11_B1 (-0.749096f)
+#define HPF_Fs176400_Gain11_B2 0.000000f
/* Gain = 12.000000 dB */
-#define HPF_Fs176400_Gain12_A0 3.607090f
-#define HPF_Fs176400_Gain12_A1 (-3.356186f)
-#define HPF_Fs176400_Gain12_A2 0.000000f
-#define HPF_Fs176400_Gain12_B1 (-0.749096f)
-#define HPF_Fs176400_Gain12_B2 0.000000f
+#define HPF_Fs176400_Gain12_A0 3.607090f
+#define HPF_Fs176400_Gain12_A1 (-3.356186f)
+#define HPF_Fs176400_Gain12_A2 0.000000f
+#define HPF_Fs176400_Gain12_B1 (-0.749096f)
+#define HPF_Fs176400_Gain12_B2 0.000000f
/* Gain = 13.000000 dB */
-#define HPF_Fs176400_Gain13_A0 4.031914f
-#define HPF_Fs176400_Gain13_A1 (-3.781010f)
-#define HPF_Fs176400_Gain13_A2 0.000000f
-#define HPF_Fs176400_Gain13_B1 (-0.749096f)
-#define HPF_Fs176400_Gain13_B2 0.000000f
+#define HPF_Fs176400_Gain13_A0 4.031914f
+#define HPF_Fs176400_Gain13_A1 (-3.781010f)
+#define HPF_Fs176400_Gain13_A2 0.000000f
+#define HPF_Fs176400_Gain13_B1 (-0.749096f)
+#define HPF_Fs176400_Gain13_B2 0.000000f
/* Gain = 14.000000 dB */
-#define HPF_Fs176400_Gain14_A0 4.508575f
-#define HPF_Fs176400_Gain14_A1 (-4.257671f)
-#define HPF_Fs176400_Gain14_A2 0.000000f
-#define HPF_Fs176400_Gain14_B1 (-0.749096f)
-#define HPF_Fs176400_Gain14_B2 0.000000f
+#define HPF_Fs176400_Gain14_A0 4.508575f
+#define HPF_Fs176400_Gain14_A1 (-4.257671f)
+#define HPF_Fs176400_Gain14_A2 0.000000f
+#define HPF_Fs176400_Gain14_B1 (-0.749096f)
+#define HPF_Fs176400_Gain14_B2 0.000000f
/* Gain = 15.000000 dB */
-#define HPF_Fs176400_Gain15_A0 5.043397f
-#define HPF_Fs176400_Gain15_A1 (-4.792493f)
-#define HPF_Fs176400_Gain15_A2 0.000000f
-#define HPF_Fs176400_Gain15_B1 (-0.749096f)
-#define HPF_Fs176400_Gain15_B2 0.000000f
+#define HPF_Fs176400_Gain15_A0 5.043397f
+#define HPF_Fs176400_Gain15_A1 (-4.792493f)
+#define HPF_Fs176400_Gain15_A2 0.000000f
+#define HPF_Fs176400_Gain15_B1 (-0.749096f)
+#define HPF_Fs176400_Gain15_B2 0.000000f
/* Coefficients for sample rate 192000Hz */
- /* Gain = 1.000000 dB */
-#define HPF_Fs192000_Gain1_A0 1.107823
-#define HPF_Fs192000_Gain1_A1 (-0.875150)
-#define HPF_Fs192000_Gain1_A2 0.000000
-#define HPF_Fs192000_Gain1_B1 (-0.767327)
-#define HPF_Fs192000_Gain1_B2 0.000000
- /* Gain = 2.000000 dB */
-#define HPF_Fs192000_Gain2_A0 1.228803
-#define HPF_Fs192000_Gain2_A1 (-0.996130)
-#define HPF_Fs192000_Gain2_A2 0.000000
-#define HPF_Fs192000_Gain2_B1 (-0.767327)
-#define HPF_Fs192000_Gain2_B2 0.000000
- /* Gain = 3.000000 dB */
-#define HPF_Fs192000_Gain3_A0 1.364544
-#define HPF_Fs192000_Gain3_A1 (-1.131871)
-#define HPF_Fs192000_Gain3_A2 0.000000
-#define HPF_Fs192000_Gain3_B1 (-0.767327)
-#define HPF_Fs192000_Gain3_B2 0.000000
- /* Gain = 4.000000 dB */
-#define HPF_Fs192000_Gain4_A0 1.516849
-#define HPF_Fs192000_Gain4_A1 (-1.284176)
-#define HPF_Fs192000_Gain4_A2 0.000000
-#define HPF_Fs192000_Gain4_B1 (-0.767327)
-#define HPF_Fs192000_Gain4_B2 0.000000
- /* Gain = 5.000000 dB */
-#define HPF_Fs192000_Gain5_A0 1.687737
-#define HPF_Fs192000_Gain5_A1 (-1.455064)
-#define HPF_Fs192000_Gain5_A2 0.000000
-#define HPF_Fs192000_Gain5_B1 (-0.767327)
-#define HPF_Fs192000_Gain5_B2 0.000000
- /* Gain = 6.000000 dB */
-#define HPF_Fs192000_Gain6_A0 1.879477
-#define HPF_Fs192000_Gain6_A1 (-1.646804)
-#define HPF_Fs192000_Gain6_A2 0.000000
-#define HPF_Fs192000_Gain6_B1 (-0.767327)
-#define HPF_Fs192000_Gain6_B2 0.000000
- /* Gain = 7.000000 dB */
-#define HPF_Fs192000_Gain7_A0 2.094613
-#define HPF_Fs192000_Gain7_A1 (-1.861940)
-#define HPF_Fs192000_Gain7_A2 0.000000
-#define HPF_Fs192000_Gain7_B1 (-0.767327)
-#define HPF_Fs192000_Gain7_B2 0.000000
- /* Gain = 8.000000 dB */
-#define HPF_Fs192000_Gain8_A0 2.335999
-#define HPF_Fs192000_Gain8_A1 (-2.103326)
-#define HPF_Fs192000_Gain8_A2 0.000000
-#define HPF_Fs192000_Gain8_B1 (-0.767327)
-#define HPF_Fs192000_Gain8_B2 0.000000
- /* Gain = 9.000000 dB */
-#define HPF_Fs192000_Gain9_A0 2.606839
-#define HPF_Fs192000_Gain9_A1 (-2.374166)
-#define HPF_Fs192000_Gain9_A2 0.000000
-#define HPF_Fs192000_Gain9_B1 (-0.767327)
-#define HPF_Fs192000_Gain9_B2 0.000000
- /* Gain = 10.000000 dB */
-#define HPF_Fs192000_Gain10_A0 2.910726
-#define HPF_Fs192000_Gain10_A1 (-2.678053)
-#define HPF_Fs192000_Gain10_A2 0.000000
-#define HPF_Fs192000_Gain10_B1 (-0.767327)
-#define HPF_Fs192000_Gain10_B2 0.000000
- /* Gain = 11.000000 dB */
-#define HPF_Fs192000_Gain11_A0 3.251693
-#define HPF_Fs192000_Gain11_A1 (-3.019020)
-#define HPF_Fs192000_Gain11_A2 0.000000
-#define HPF_Fs192000_Gain11_B1 (-0.767327)
-#define HPF_Fs192000_Gain11_B2 0.000000
- /* Gain = 12.000000 dB */
-#define HPF_Fs192000_Gain12_A0 3.634264
-#define HPF_Fs192000_Gain12_A1 (-3.401591)
-#define HPF_Fs192000_Gain12_A2 0.000000
-#define HPF_Fs192000_Gain12_B1 (-0.767327)
-#define HPF_Fs192000_Gain12_B2 0.000000
- /* Gain = 13.000000 dB */
-#define HPF_Fs192000_Gain13_A0 4.063516
-#define HPF_Fs192000_Gain13_A1 (-3.830843)
-#define HPF_Fs192000_Gain13_A2 0.000000
-#define HPF_Fs192000_Gain13_B1 (-0.767327)
-#define HPF_Fs192000_Gain13_B2 0.000000
- /* Gain = 14.000000 dB */
-#define HPF_Fs192000_Gain14_A0 4.545145
-#define HPF_Fs192000_Gain14_A1 (-4.312472)
-#define HPF_Fs192000_Gain14_A2 0.000000
-#define HPF_Fs192000_Gain14_B1 (-0.767327)
-#define HPF_Fs192000_Gain14_B2 0.000000
- /* Gain = 15.000000 dB */
-#define HPF_Fs192000_Gain15_A0 5.085542
-#define HPF_Fs192000_Gain15_A1 (-4.852868)
-#define HPF_Fs192000_Gain15_A2 0.000000
-#define HPF_Fs192000_Gain15_B1 (-0.767327)
-#define HPF_Fs192000_Gain15_B2 0.000000
+/* Gain = 1.000000 dB */
+#define HPF_Fs192000_Gain1_A0 1.107823
+#define HPF_Fs192000_Gain1_A1 (-0.875150)
+#define HPF_Fs192000_Gain1_A2 0.000000
+#define HPF_Fs192000_Gain1_B1 (-0.767327)
+#define HPF_Fs192000_Gain1_B2 0.000000
+/* Gain = 2.000000 dB */
+#define HPF_Fs192000_Gain2_A0 1.228803
+#define HPF_Fs192000_Gain2_A1 (-0.996130)
+#define HPF_Fs192000_Gain2_A2 0.000000
+#define HPF_Fs192000_Gain2_B1 (-0.767327)
+#define HPF_Fs192000_Gain2_B2 0.000000
+/* Gain = 3.000000 dB */
+#define HPF_Fs192000_Gain3_A0 1.364544
+#define HPF_Fs192000_Gain3_A1 (-1.131871)
+#define HPF_Fs192000_Gain3_A2 0.000000
+#define HPF_Fs192000_Gain3_B1 (-0.767327)
+#define HPF_Fs192000_Gain3_B2 0.000000
+/* Gain = 4.000000 dB */
+#define HPF_Fs192000_Gain4_A0 1.516849
+#define HPF_Fs192000_Gain4_A1 (-1.284176)
+#define HPF_Fs192000_Gain4_A2 0.000000
+#define HPF_Fs192000_Gain4_B1 (-0.767327)
+#define HPF_Fs192000_Gain4_B2 0.000000
+/* Gain = 5.000000 dB */
+#define HPF_Fs192000_Gain5_A0 1.687737
+#define HPF_Fs192000_Gain5_A1 (-1.455064)
+#define HPF_Fs192000_Gain5_A2 0.000000
+#define HPF_Fs192000_Gain5_B1 (-0.767327)
+#define HPF_Fs192000_Gain5_B2 0.000000
+/* Gain = 6.000000 dB */
+#define HPF_Fs192000_Gain6_A0 1.879477
+#define HPF_Fs192000_Gain6_A1 (-1.646804)
+#define HPF_Fs192000_Gain6_A2 0.000000
+#define HPF_Fs192000_Gain6_B1 (-0.767327)
+#define HPF_Fs192000_Gain6_B2 0.000000
+/* Gain = 7.000000 dB */
+#define HPF_Fs192000_Gain7_A0 2.094613
+#define HPF_Fs192000_Gain7_A1 (-1.861940)
+#define HPF_Fs192000_Gain7_A2 0.000000
+#define HPF_Fs192000_Gain7_B1 (-0.767327)
+#define HPF_Fs192000_Gain7_B2 0.000000
+/* Gain = 8.000000 dB */
+#define HPF_Fs192000_Gain8_A0 2.335999
+#define HPF_Fs192000_Gain8_A1 (-2.103326)
+#define HPF_Fs192000_Gain8_A2 0.000000
+#define HPF_Fs192000_Gain8_B1 (-0.767327)
+#define HPF_Fs192000_Gain8_B2 0.000000
+/* Gain = 9.000000 dB */
+#define HPF_Fs192000_Gain9_A0 2.606839
+#define HPF_Fs192000_Gain9_A1 (-2.374166)
+#define HPF_Fs192000_Gain9_A2 0.000000
+#define HPF_Fs192000_Gain9_B1 (-0.767327)
+#define HPF_Fs192000_Gain9_B2 0.000000
+/* Gain = 10.000000 dB */
+#define HPF_Fs192000_Gain10_A0 2.910726
+#define HPF_Fs192000_Gain10_A1 (-2.678053)
+#define HPF_Fs192000_Gain10_A2 0.000000
+#define HPF_Fs192000_Gain10_B1 (-0.767327)
+#define HPF_Fs192000_Gain10_B2 0.000000
+/* Gain = 11.000000 dB */
+#define HPF_Fs192000_Gain11_A0 3.251693
+#define HPF_Fs192000_Gain11_A1 (-3.019020)
+#define HPF_Fs192000_Gain11_A2 0.000000
+#define HPF_Fs192000_Gain11_B1 (-0.767327)
+#define HPF_Fs192000_Gain11_B2 0.000000
+/* Gain = 12.000000 dB */
+#define HPF_Fs192000_Gain12_A0 3.634264
+#define HPF_Fs192000_Gain12_A1 (-3.401591)
+#define HPF_Fs192000_Gain12_A2 0.000000
+#define HPF_Fs192000_Gain12_B1 (-0.767327)
+#define HPF_Fs192000_Gain12_B2 0.000000
+/* Gain = 13.000000 dB */
+#define HPF_Fs192000_Gain13_A0 4.063516
+#define HPF_Fs192000_Gain13_A1 (-3.830843)
+#define HPF_Fs192000_Gain13_A2 0.000000
+#define HPF_Fs192000_Gain13_B1 (-0.767327)
+#define HPF_Fs192000_Gain13_B2 0.000000
+/* Gain = 14.000000 dB */
+#define HPF_Fs192000_Gain14_A0 4.545145
+#define HPF_Fs192000_Gain14_A1 (-4.312472)
+#define HPF_Fs192000_Gain14_A2 0.000000
+#define HPF_Fs192000_Gain14_B1 (-0.767327)
+#define HPF_Fs192000_Gain14_B2 0.000000
+/* Gain = 15.000000 dB */
+#define HPF_Fs192000_Gain15_A0 5.085542
+#define HPF_Fs192000_Gain15_A1 (-4.852868)
+#define HPF_Fs192000_Gain15_A2 0.000000
+#define HPF_Fs192000_Gain15_B1 (-0.767327)
+#define HPF_Fs192000_Gain15_B2 0.000000
#endif
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
index bb3652e..3118e77 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.cpp
@@ -50,72 +50,62 @@
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_SetControlParameters(LVM_Handle_t hInstance,
- LVM_ControlParams_t *pParams)
-{
- LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
+LVM_ReturnStatus_en LVM_SetControlParameters(LVM_Handle_t hInstance, LVM_ControlParams_t* pParams) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
- if ((pParams == LVM_NULL) || (hInstance == LVM_NULL))
- {
+ if ((pParams == LVM_NULL) || (hInstance == LVM_NULL)) {
return (LVM_NULLADDRESS);
}
pInstance->NewParams = *pParams;
- if(
- /* General parameters */
- ((pParams->OperatingMode != LVM_MODE_OFF) && (pParams->OperatingMode != LVM_MODE_ON)) ||
- ((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)) ||
- ((pParams->SourceFormat != LVM_STEREO) &&
- (pParams->SourceFormat != LVM_MONOINSTEREO) &&
- (pParams->SourceFormat != LVM_MONO) &&
- (pParams->SourceFormat != LVM_MULTICHANNEL)) ||
- (pParams->SpeakerType > LVM_EX_HEADPHONES))
- {
+ if (
+ /* General parameters */
+ ((pParams->OperatingMode != LVM_MODE_OFF) && (pParams->OperatingMode != LVM_MODE_ON)) ||
+ ((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)) ||
+ ((pParams->SourceFormat != LVM_STEREO) && (pParams->SourceFormat != LVM_MONOINSTEREO) &&
+ (pParams->SourceFormat != LVM_MONO) && (pParams->SourceFormat != LVM_MULTICHANNEL)) ||
+ (pParams->SpeakerType > LVM_EX_HEADPHONES)) {
return (LVM_OUTOFRANGE);
}
pInstance->Params.NrChannels = pParams->NrChannels;
- pInstance->Params.ChMask = pParams->ChMask;
+ pInstance->Params.ChMask = pParams->ChMask;
/*
* Cinema Sound parameters
*/
- if((pParams->VirtualizerOperatingMode != LVM_MODE_OFF) && (pParams->VirtualizerOperatingMode != LVM_MODE_ON))
- {
+ if ((pParams->VirtualizerOperatingMode != LVM_MODE_OFF) &&
+ (pParams->VirtualizerOperatingMode != LVM_MODE_ON)) {
return (LVM_OUTOFRANGE);
}
- if(pParams->VirtualizerType != LVM_CONCERTSOUND)
- {
+ if (pParams->VirtualizerType != LVM_CONCERTSOUND) {
return (LVM_OUTOFRANGE);
}
- if(pParams->VirtualizerReverbLevel > LVM_VIRTUALIZER_MAX_REVERB_LEVEL)
- {
+ if (pParams->VirtualizerReverbLevel > LVM_VIRTUALIZER_MAX_REVERB_LEVEL) {
return (LVM_OUTOFRANGE);
}
- if(pParams->CS_EffectLevel < LVM_CS_MIN_EFFECT_LEVEL)
- {
+ if (pParams->CS_EffectLevel < LVM_CS_MIN_EFFECT_LEVEL) {
return (LVM_OUTOFRANGE);
}
/*
* N-Band Equalizer
*/
- if(pParams->EQNB_NBands > pInstance->InstParams.EQNB_NumBands)
- {
+ if (pParams->EQNB_NBands > pInstance->InstParams.EQNB_NumBands) {
return (LVM_OUTOFRANGE);
}
/* Definition pointer */
- if ((pParams->pEQNB_BandDefinition == LVM_NULL) &&
- (pParams->EQNB_NBands != 0))
- {
+ if ((pParams->pEQNB_BandDefinition == LVM_NULL) && (pParams->EQNB_NBands != 0)) {
return (LVM_NULLADDRESS);
}
@@ -123,35 +113,31 @@
* Copy the filter definitions for the Equaliser
*/
{
- LVM_INT16 i;
+ LVM_INT16 i;
- if (pParams->EQNB_NBands != 0)
- {
- for (i=0; i<pParams->EQNB_NBands; i++)
- {
+ if (pParams->EQNB_NBands != 0) {
+ for (i = 0; i < pParams->EQNB_NBands; i++) {
pInstance->pEQNB_BandDefs[i] = pParams->pEQNB_BandDefinition[i];
}
pInstance->NewParams.pEQNB_BandDefinition = pInstance->pEQNB_BandDefs;
}
}
- if( /* N-Band Equaliser parameters */
- ((pParams->EQNB_OperatingMode != LVM_EQNB_OFF) && (pParams->EQNB_OperatingMode != LVM_EQNB_ON)) ||
- (pParams->EQNB_NBands > pInstance->InstParams.EQNB_NumBands))
- {
+ if (/* N-Band Equaliser parameters */
+ ((pParams->EQNB_OperatingMode != LVM_EQNB_OFF) &&
+ (pParams->EQNB_OperatingMode != LVM_EQNB_ON)) ||
+ (pParams->EQNB_NBands > pInstance->InstParams.EQNB_NumBands)) {
return (LVM_OUTOFRANGE);
}
/* Band parameters*/
{
LVM_INT16 i;
- for(i = 0; i < pParams->EQNB_NBands; i++)
- {
- if(((pParams->pEQNB_BandDefinition[i].Frequency < LVM_EQNB_MIN_BAND_FREQ) ||
- (pParams->pEQNB_BandDefinition[i].Frequency > LVM_EQNB_MAX_BAND_FREQ)) ||
- ((pParams->pEQNB_BandDefinition[i].Gain < LVM_EQNB_MIN_BAND_GAIN) ||
- (pParams->pEQNB_BandDefinition[i].Gain > LVM_EQNB_MAX_BAND_GAIN)) ||
- ((pParams->pEQNB_BandDefinition[i].QFactor < LVM_EQNB_MIN_QFACTOR) ||
- (pParams->pEQNB_BandDefinition[i].QFactor > LVM_EQNB_MAX_QFACTOR)))
- {
+ for (i = 0; i < pParams->EQNB_NBands; i++) {
+ if (((pParams->pEQNB_BandDefinition[i].Frequency < LVM_EQNB_MIN_BAND_FREQ) ||
+ (pParams->pEQNB_BandDefinition[i].Frequency > LVM_EQNB_MAX_BAND_FREQ)) ||
+ ((pParams->pEQNB_BandDefinition[i].Gain < LVM_EQNB_MIN_BAND_GAIN) ||
+ (pParams->pEQNB_BandDefinition[i].Gain > LVM_EQNB_MAX_BAND_GAIN)) ||
+ ((pParams->pEQNB_BandDefinition[i].QFactor < LVM_EQNB_MIN_QFACTOR) ||
+ (pParams->pEQNB_BandDefinition[i].QFactor > LVM_EQNB_MAX_QFACTOR))) {
return (LVM_OUTOFRANGE);
}
}
@@ -160,24 +146,25 @@
/*
* Bass Enhancement parameters
*/
- if(((pParams->BE_OperatingMode != LVM_BE_OFF) && (pParams->BE_OperatingMode != LVM_BE_ON)) ||
- ((pParams->BE_EffectLevel < LVM_BE_MIN_EFFECTLEVEL ) || (pParams->BE_EffectLevel > LVM_BE_MAX_EFFECTLEVEL ))||
- ((pParams->BE_CentreFreq != LVM_BE_CENTRE_55Hz) && (pParams->BE_CentreFreq != LVM_BE_CENTRE_66Hz) &&
- (pParams->BE_CentreFreq != LVM_BE_CENTRE_78Hz) && (pParams->BE_CentreFreq != LVM_BE_CENTRE_90Hz)) ||
- ((pParams->BE_HPF != LVM_BE_HPF_OFF) && (pParams->BE_HPF != LVM_BE_HPF_ON)))
- {
+ if (((pParams->BE_OperatingMode != LVM_BE_OFF) && (pParams->BE_OperatingMode != LVM_BE_ON)) ||
+ ((pParams->BE_EffectLevel < LVM_BE_MIN_EFFECTLEVEL) ||
+ (pParams->BE_EffectLevel > LVM_BE_MAX_EFFECTLEVEL)) ||
+ ((pParams->BE_CentreFreq != LVM_BE_CENTRE_55Hz) &&
+ (pParams->BE_CentreFreq != LVM_BE_CENTRE_66Hz) &&
+ (pParams->BE_CentreFreq != LVM_BE_CENTRE_78Hz) &&
+ (pParams->BE_CentreFreq != LVM_BE_CENTRE_90Hz)) ||
+ ((pParams->BE_HPF != LVM_BE_HPF_OFF) && (pParams->BE_HPF != LVM_BE_HPF_ON))) {
return (LVM_OUTOFRANGE);
}
/*
* Volume Control parameters
*/
- if((pParams->VC_EffectLevel < LVM_VC_MIN_EFFECTLEVEL ) || (pParams->VC_EffectLevel > LVM_VC_MAX_EFFECTLEVEL ))
- {
+ if ((pParams->VC_EffectLevel < LVM_VC_MIN_EFFECTLEVEL) ||
+ (pParams->VC_EffectLevel > LVM_VC_MAX_EFFECTLEVEL)) {
return (LVM_OUTOFRANGE);
}
- if((pParams->VC_Balance < LVM_VC_BALANCE_MIN ) || (pParams->VC_Balance > LVM_VC_BALANCE_MAX ))
- {
+ if ((pParams->VC_Balance < LVM_VC_BALANCE_MIN) || (pParams->VC_Balance > LVM_VC_BALANCE_MAX)) {
return (LVM_OUTOFRANGE);
}
@@ -185,22 +172,21 @@
* PSA parameters
*/
if (((LVPSA_LevelDetectSpeed_en)pParams->PSA_PeakDecayRate > LVPSA_SPEED_HIGH) ||
- (pParams->PSA_Enable > LVM_PSA_ON))
- {
+ (pParams->PSA_Enable > LVM_PSA_ON)) {
return (LVM_OUTOFRANGE);
}
/*
- * Set the flag to indicate there are new parameters to use
- *
- * Protect the copy of the new parameters from interrupts to avoid possible problems
- * with loss control parameters. This problem can occur if this control function is called more
- * than once before a call to the process function. If the process function interrupts
- * the copy to NewParams then one frame may have mixed parameters, some old and some new.
- */
+ * Set the flag to indicate there are new parameters to use
+ *
+ * Protect the copy of the new parameters from interrupts to avoid possible problems
+ * with loss control parameters. This problem can occur if this control function is called more
+ * than once before a call to the process function. If the process function interrupts
+ * the copy to NewParams then one frame may have mixed parameters, some old and some new.
+ */
pInstance->ControlPending = LVM_TRUE;
- return(LVM_SUCCESS);
+ return (LVM_SUCCESS);
}
/****************************************************************************************/
@@ -224,16 +210,13 @@
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetControlParameters(LVM_Handle_t hInstance,
- LVM_ControlParams_t *pParams)
-{
- LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
+LVM_ReturnStatus_en LVM_GetControlParameters(LVM_Handle_t hInstance, LVM_ControlParams_t* pParams) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
/*
* Check pointer
*/
- if ((pParams == LVM_NULL) || (hInstance == LVM_NULL))
- {
+ if ((pParams == LVM_NULL) || (hInstance == LVM_NULL)) {
return (LVM_NULLADDRESS);
}
*pParams = pInstance->NewParams;
@@ -242,17 +225,16 @@
* Copy the filter definitions for the Equaliser
*/
{
- LVM_INT16 i;
+ LVM_INT16 i;
if (pInstance->NewParams.EQNB_NBands != 0)
- for (i=0; i<pInstance->NewParams.EQNB_NBands; i++)
- {
- pInstance->pEQNB_UserDefs[i] = pInstance->pEQNB_BandDefs[i];
- }
+ for (i = 0; i < pInstance->NewParams.EQNB_NBands; i++) {
+ pInstance->pEQNB_UserDefs[i] = pInstance->pEQNB_BandDefs[i];
+ }
pParams->pEQNB_BandDefinition = pInstance->pEQNB_UserDefs;
}
- return(LVM_SUCCESS);
+ return (LVM_SUCCESS);
}
/****************************************************************************************/
@@ -268,56 +250,46 @@
/* pParams Pointer to the parameters to use */
/* */
/****************************************************************************************/
-void LVM_SetTrebleBoost(LVM_Instance_t *pInstance,
- LVM_ControlParams_t *pParams)
-{
- extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
+void LVM_SetTrebleBoost(LVM_Instance_t* pInstance, LVM_ControlParams_t* pParams) {
+ extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
- LVM_INT16 Offset;
- LVM_INT16 EffectLevel = 0;
+ LVM_INT16 Offset;
+ LVM_INT16 EffectLevel = 0;
/*
* Load the coefficients
*/
- if ((pParams->TE_OperatingMode == LVM_TE_ON) &&
- (pParams->SampleRate >= TrebleBoostMinRate) &&
- (pParams->OperatingMode == LVM_MODE_ON) &&
- (pParams->TE_EffectLevel > 0))
- {
- if((pParams->TE_EffectLevel == LVM_TE_LOW_MIPS) &&
- ((pParams->SpeakerType == LVM_HEADPHONES)||
- (pParams->SpeakerType == LVM_EX_HEADPHONES)))
- {
+ if ((pParams->TE_OperatingMode == LVM_TE_ON) && (pParams->SampleRate >= TrebleBoostMinRate) &&
+ (pParams->OperatingMode == LVM_MODE_ON) && (pParams->TE_EffectLevel > 0)) {
+ if ((pParams->TE_EffectLevel == LVM_TE_LOW_MIPS) &&
+ ((pParams->SpeakerType == LVM_HEADPHONES) ||
+ (pParams->SpeakerType == LVM_EX_HEADPHONES))) {
pInstance->TE_Active = LVM_FALSE;
- }
- else
- {
+ } else {
EffectLevel = pParams->TE_EffectLevel;
pInstance->TE_Active = LVM_TRUE;
}
- if(pInstance->TE_Active == LVM_TRUE)
- {
+ if (pInstance->TE_Active == LVM_TRUE) {
/*
* Load the coefficients and enabled the treble boost
*/
- Offset = (LVM_INT16)(EffectLevel - 1 + TrebleBoostSteps * (pParams->SampleRate - TrebleBoostMinRate));
+ Offset = (LVM_INT16)(EffectLevel - 1 +
+ TrebleBoostSteps * (pParams->SampleRate - TrebleBoostMinRate));
FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(&pInstance->pTE_State->TrebleBoost_State,
- &pInstance->pTE_Taps->TrebleBoost_Taps,
- &LVM_TrebleBoostCoefs[Offset]);
+ &pInstance->pTE_Taps->TrebleBoost_Taps,
+ &LVM_TrebleBoostCoefs[Offset]);
/*
* Clear the taps
*/
- LoadConst_Float((LVM_FLOAT)0, /* Value */
- (LVM_FLOAT *)&pInstance->pTE_Taps->TrebleBoost_Taps, /* Destination.\
- Cast to void: no dereferencing in function */
- (LVM_UINT16)(sizeof(pInstance->pTE_Taps->TrebleBoost_Taps) / \
- sizeof(LVM_FLOAT))); /* Number of words */
+ LoadConst_Float((LVM_FLOAT)0, /* Value */
+ (LVM_FLOAT*)&pInstance->pTE_Taps->TrebleBoost_Taps, /* Destination.\
+ Cast to void: no dereferencing in function */
+ (LVM_UINT16)(sizeof(pInstance->pTE_Taps->TrebleBoost_Taps) /
+ sizeof(LVM_FLOAT))); /* Number of words */
}
- }
- else
- {
+ } else {
/*
* Disable the treble boost
*/
@@ -339,94 +311,76 @@
/* pParams Initialisation parameters */
/* */
/************************************************************************************/
-void LVM_SetVolume(LVM_Instance_t *pInstance,
- LVM_ControlParams_t *pParams)
-{
-
- LVM_UINT16 dBShifts; /* 6dB shifts */
- LVM_UINT16 dBOffset; /* Table offset */
- LVM_INT16 Volume = 0; /* Required volume in dBs */
- LVM_FLOAT Temp;
+void LVM_SetVolume(LVM_Instance_t* pInstance, LVM_ControlParams_t* pParams) {
+ LVM_UINT16 dBShifts; /* 6dB shifts */
+ LVM_UINT16 dBOffset; /* Table offset */
+ LVM_INT16 Volume = 0; /* Required volume in dBs */
+ LVM_FLOAT Temp;
/*
* Limit the gain to the maximum allowed
*/
- if (pParams->VC_EffectLevel > 0)
- {
- Volume = 0;
- }
- else
- {
- Volume = pParams->VC_EffectLevel;
- }
+ if (pParams->VC_EffectLevel > 0) {
+ Volume = 0;
+ } else {
+ Volume = pParams->VC_EffectLevel;
+ }
- /* Compensate this volume in PSA plot */
- if(Volume > -60) /* Limit volume loss to PSA Limits*/
- pInstance->PSA_GainOffset=(LVM_INT16)(-Volume);/* Loss is compensated by Gain*/
- else
- pInstance->PSA_GainOffset=(LVM_INT16)60;/* Loss is compensated by Gain*/
+ /* Compensate this volume in PSA plot */
+ if (Volume > -60) /* Limit volume loss to PSA Limits*/
+ pInstance->PSA_GainOffset = (LVM_INT16)(-Volume); /* Loss is compensated by Gain*/
+ else
+ pInstance->PSA_GainOffset = (LVM_INT16)60; /* Loss is compensated by Gain*/
pInstance->VC_AVLFixedVolume = 0;
/*
* Set volume control and AVL volumes according to headroom and volume user setting
*/
- if(pParams->OperatingMode == LVM_MODE_ON)
- {
+ if (pParams->OperatingMode == LVM_MODE_ON) {
/* Default Situation with no AVL and no RS */
- if(pParams->EQNB_OperatingMode == LVM_EQNB_ON)
- {
- if(Volume > -pInstance->Headroom)
- Volume = (LVM_INT16)-pInstance->Headroom;
+ if (pParams->EQNB_OperatingMode == LVM_EQNB_ON) {
+ if (Volume > -pInstance->Headroom) Volume = (LVM_INT16)-pInstance->Headroom;
}
}
/*
* Activate volume control if necessary
*/
- pInstance->VC_Active = LVM_TRUE;
- if (Volume != 0)
- {
+ pInstance->VC_Active = LVM_TRUE;
+ if (Volume != 0) {
pInstance->VC_VolumedB = Volume;
- }
- else
- {
+ } else {
pInstance->VC_VolumedB = 0;
}
/*
* Calculate the required gain and shifts
*/
- dBOffset = (LVM_UINT16)((-Volume) % 6); /* Get the dBs 0-5 */
- dBShifts = (LVM_UINT16)(Volume / -6); /* Get the 6dB shifts */
+ 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)
- {
+ if (dBShifts == 0) {
LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0],
- (LVM_FLOAT)LVM_VolumeTable[dBOffset]);
- }
- else
- {
+ (LVM_FLOAT)LVM_VolumeTable[dBOffset]);
+ } else {
Temp = LVM_VolumeTable[dBOffset];
- while(dBShifts) {
+ while (dBShifts) {
Temp = Temp / 2.0f;
dBShifts--;
}
LVC_Mixer_SetTarget(&pInstance->VC_Volume.MixerStream[0], Temp);
}
pInstance->VC_Volume.MixerStream[0].CallbackSet = 1;
- if(pInstance->NoSmoothVolume == LVM_TRUE)
- {
+ if (pInstance->NoSmoothVolume == LVM_TRUE) {
LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0], 0,
pInstance->Params.SampleRate, 2);
- }
- else
- {
- 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);
}
}
@@ -447,43 +401,39 @@
/* NOTES: */
/* */
/************************************************************************************/
-void LVM_SetHeadroom(LVM_Instance_t *pInstance,
- LVM_ControlParams_t *pParams)
-{
- LVM_INT16 ii, jj;
- LVM_INT16 Headroom = 0;
- LVM_INT16 MaxGain = 0;
+void LVM_SetHeadroom(LVM_Instance_t* pInstance, LVM_ControlParams_t* pParams) {
+ LVM_INT16 ii, jj;
+ LVM_INT16 Headroom = 0;
+ LVM_INT16 MaxGain = 0;
- if (((LVEQNB_Mode_en)pParams->EQNB_OperatingMode == LVEQNB_ON)
- && (pInstance->HeadroomParams.Headroom_OperatingMode == LVM_HEADROOM_ON))
- {
+ if (((LVEQNB_Mode_en)pParams->EQNB_OperatingMode == LVEQNB_ON) &&
+ (pInstance->HeadroomParams.Headroom_OperatingMode == LVM_HEADROOM_ON)) {
/* Find typical headroom value */
- for(jj = 0; jj < pInstance->HeadroomParams.NHeadroomBands; jj++)
- {
+ for (jj = 0; jj < pInstance->HeadroomParams.NHeadroomBands; jj++) {
MaxGain = 0;
- for( ii = 0; ii < pParams->EQNB_NBands; ii++)
- {
- if((pParams->pEQNB_BandDefinition[ii].Frequency >= pInstance->HeadroomParams.pHeadroomDefinition[jj].Limit_Low) &&
- (pParams->pEQNB_BandDefinition[ii].Frequency <= pInstance->HeadroomParams.pHeadroomDefinition[jj].Limit_High))
- {
- if(pParams->pEQNB_BandDefinition[ii].Gain > MaxGain)
- {
+ for (ii = 0; ii < pParams->EQNB_NBands; ii++) {
+ if ((pParams->pEQNB_BandDefinition[ii].Frequency >=
+ pInstance->HeadroomParams.pHeadroomDefinition[jj].Limit_Low) &&
+ (pParams->pEQNB_BandDefinition[ii].Frequency <=
+ pInstance->HeadroomParams.pHeadroomDefinition[jj].Limit_High)) {
+ if (pParams->pEQNB_BandDefinition[ii].Gain > MaxGain) {
MaxGain = pParams->pEQNB_BandDefinition[ii].Gain;
}
}
}
- if((MaxGain - pInstance->HeadroomParams.pHeadroomDefinition[jj].Headroom_Offset) > Headroom){
- Headroom = (LVM_INT16)(MaxGain - pInstance->HeadroomParams.pHeadroomDefinition[jj].Headroom_Offset);
+ if ((MaxGain - pInstance->HeadroomParams.pHeadroomDefinition[jj].Headroom_Offset) >
+ Headroom) {
+ Headroom = (LVM_INT16)(
+ MaxGain -
+ pInstance->HeadroomParams.pHeadroomDefinition[jj].Headroom_Offset);
}
}
/* Saturate */
- if(Headroom < 0)
- Headroom = 0;
+ if (Headroom < 0) Headroom = 0;
}
- pInstance->Headroom = (LVM_UINT16)Headroom ;
-
+ pInstance->Headroom = (LVM_UINT16)Headroom;
}
/****************************************************************************************/
@@ -504,30 +454,26 @@
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_ApplyNewSettings(LVM_Handle_t hInstance)
-{
- LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
- LVM_ControlParams_t LocalParams;
- LVM_INT16 Count = 5;
+LVM_ReturnStatus_en LVM_ApplyNewSettings(LVM_Handle_t hInstance) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
+ LVM_ControlParams_t LocalParams;
+ LVM_INT16 Count = 5;
/*
* Copy the new parameters but make sure they didn't change while copying
*/
- do
- {
+ do {
pInstance->ControlPending = LVM_FALSE;
LocalParams = pInstance->NewParams;
pInstance->HeadroomParams = pInstance->NewHeadroomParams;
Count--;
- } while ((pInstance->ControlPending != LVM_FALSE) &&
- (Count > 0));
+ } while ((pInstance->ControlPending != LVM_FALSE) && (Count > 0));
pInstance->NrChannels = LocalParams.NrChannels;
pInstance->ChMask = LocalParams.ChMask;
/* Clear all internal data if format change*/
- if(LocalParams.SourceFormat != pInstance->Params.SourceFormat)
- {
+ if (LocalParams.SourceFormat != pInstance->Params.SourceFormat) {
LVM_ClearAudioBuffers(pInstance);
pInstance->ControlPending = LVM_FALSE;
}
@@ -539,31 +485,27 @@
(pInstance->Params.TE_EffectLevel != LocalParams.TE_EffectLevel) ||
(pInstance->Params.TE_OperatingMode != LocalParams.TE_OperatingMode) ||
(pInstance->Params.OperatingMode != LocalParams.OperatingMode) ||
- (pInstance->Params.SpeakerType != LocalParams.SpeakerType))
- {
- LVM_SetTrebleBoost(pInstance,
- &LocalParams);
+ (pInstance->Params.SpeakerType != LocalParams.SpeakerType)) {
+ LVM_SetTrebleBoost(pInstance, &LocalParams);
}
/*
* Update the headroom if required
*/
- LVM_SetHeadroom(pInstance, /* Instance pointer */
- &LocalParams); /* New parameters */
+ LVM_SetHeadroom(pInstance, /* Instance pointer */
+ &LocalParams); /* New parameters */
/*
* Update the volume if required
*/
{
- LVM_SetVolume(pInstance, /* Instance pointer */
- &LocalParams); /* New parameters */
+ LVM_SetVolume(pInstance, /* Instance pointer */
+ &LocalParams); /* New parameters */
}
/* Apply balance changes*/
- if(pInstance->Params.VC_Balance != LocalParams.VC_Balance)
- {
+ if (pInstance->Params.VC_Balance != LocalParams.VC_Balance) {
/* Configure Mixer module for gradual changes to volume*/
- if(LocalParams.VC_Balance < 0)
- {
+ if (LocalParams.VC_Balance < 0) {
LVM_FLOAT Target_Float;
/* Drop in right channel volume*/
Target_Float = LVM_MAXFLOAT;
@@ -575,9 +517,7 @@
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 if(LocalParams.VC_Balance >0)
- {
+ } else if (LocalParams.VC_Balance > 0) {
LVM_FLOAT Target_Float;
/* Drop in left channel volume*/
Target_Float = dB_to_LinFloat((LVM_INT16)((-LocalParams.VC_Balance) << 4));
@@ -589,61 +529,54 @@
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
- {
+ } else {
LVM_FLOAT Target_Float;
/* No drop*/
Target_Float = LVM_MAXFLOAT;
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[0],Target_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);
+ LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
- LVC_Mixer_SetTarget(&pInstance->VC_BalanceMix.MixerStream[1],Target_Float);
+ 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);
+ LVM_VC_MIXER_TIME, LocalParams.SampleRate, 1);
}
}
/*
* Update the bass enhancement
*/
{
- LVDBE_ReturnStatus_en DBE_Status;
- LVDBE_Params_t DBE_Params;
- LVDBE_Handle_t *hDBEInstance = (LVDBE_Handle_t *)pInstance->hDBEInstance;
+ LVDBE_ReturnStatus_en DBE_Status;
+ LVDBE_Params_t DBE_Params;
+ LVDBE_Handle_t* hDBEInstance = (LVDBE_Handle_t*)pInstance->hDBEInstance;
/*
* Set the new parameters
*/
- if(LocalParams.OperatingMode == LVM_MODE_OFF)
- {
+ if (LocalParams.OperatingMode == LVM_MODE_OFF) {
DBE_Params.OperatingMode = LVDBE_OFF;
+ } else {
+ DBE_Params.OperatingMode = (LVDBE_Mode_en)LocalParams.BE_OperatingMode;
}
- else
- {
- DBE_Params.OperatingMode = (LVDBE_Mode_en)LocalParams.BE_OperatingMode;
- }
- DBE_Params.SampleRate = (LVDBE_Fs_en)LocalParams.SampleRate;
- DBE_Params.EffectLevel = LocalParams.BE_EffectLevel;
- DBE_Params.CentreFrequency = (LVDBE_CentreFreq_en)LocalParams.BE_CentreFreq;
- DBE_Params.HPFSelect = (LVDBE_FilterSelect_en)LocalParams.BE_HPF;
- DBE_Params.HeadroomdB = 0;
- DBE_Params.VolumeControl = LVDBE_VOLUME_OFF;
- DBE_Params.VolumedB = 0;
- DBE_Params.NrChannels = LocalParams.NrChannels;
+ DBE_Params.SampleRate = (LVDBE_Fs_en)LocalParams.SampleRate;
+ DBE_Params.EffectLevel = LocalParams.BE_EffectLevel;
+ DBE_Params.CentreFrequency = (LVDBE_CentreFreq_en)LocalParams.BE_CentreFreq;
+ DBE_Params.HPFSelect = (LVDBE_FilterSelect_en)LocalParams.BE_HPF;
+ DBE_Params.HeadroomdB = 0;
+ DBE_Params.VolumeControl = LVDBE_VOLUME_OFF;
+ DBE_Params.VolumedB = 0;
+ DBE_Params.NrChannels = LocalParams.NrChannels;
/*
* Make the changes
*/
- DBE_Status = LVDBE_Control(hDBEInstance,
- &DBE_Params);
+ DBE_Status = LVDBE_Control(hDBEInstance, &DBE_Params);
/*
* Quit if the changes were not accepted
*/
- if (DBE_Status != LVDBE_SUCCESS)
- {
- return((LVM_ReturnStatus_en)DBE_Status);
+ if (DBE_Status != LVDBE_SUCCESS) {
+ return ((LVM_ReturnStatus_en)DBE_Status);
}
/*
@@ -656,100 +589,83 @@
* Update the N-Band Equaliser
*/
{
- LVEQNB_ReturnStatus_en EQNB_Status;
- LVEQNB_Params_t EQNB_Params;
- LVEQNB_Handle_t *hEQNBInstance = (LVEQNB_Handle_t *)pInstance->hEQNBInstance;
+ LVEQNB_ReturnStatus_en EQNB_Status;
+ LVEQNB_Params_t EQNB_Params;
+ LVEQNB_Handle_t* hEQNBInstance = (LVEQNB_Handle_t*)pInstance->hEQNBInstance;
/*
* Set the new parameters
*/
- if(LocalParams.OperatingMode == LVM_MODE_OFF)
- {
- EQNB_Params.OperatingMode = LVEQNB_BYPASS;
- }
- else
- {
- EQNB_Params.OperatingMode = (LVEQNB_Mode_en)LocalParams.EQNB_OperatingMode;
+ if (LocalParams.OperatingMode == LVM_MODE_OFF) {
+ EQNB_Params.OperatingMode = LVEQNB_BYPASS;
+ } else {
+ EQNB_Params.OperatingMode = (LVEQNB_Mode_en)LocalParams.EQNB_OperatingMode;
}
- EQNB_Params.SampleRate = (LVEQNB_Fs_en)LocalParams.SampleRate;
- EQNB_Params.NBands = LocalParams.EQNB_NBands;
- EQNB_Params.pBandDefinition = (LVEQNB_BandDef_t *)LocalParams.pEQNB_BandDefinition;
- if (LocalParams.SourceFormat == LVM_STEREO) /* Mono format not supported */
+ EQNB_Params.SampleRate = (LVEQNB_Fs_en)LocalParams.SampleRate;
+ EQNB_Params.NBands = LocalParams.EQNB_NBands;
+ EQNB_Params.pBandDefinition = (LVEQNB_BandDef_t*)LocalParams.pEQNB_BandDefinition;
+ if (LocalParams.SourceFormat == LVM_STEREO) /* Mono format not supported */
{
EQNB_Params.SourceFormat = LVEQNB_STEREO;
}
/* Note: Currently SourceFormat field of EQNB is not been
* used by the module.
*/
- else if (LocalParams.SourceFormat == LVM_MULTICHANNEL)
- {
+ else if (LocalParams.SourceFormat == LVM_MULTICHANNEL) {
EQNB_Params.SourceFormat = LVEQNB_MULTICHANNEL;
+ } else {
+ EQNB_Params.SourceFormat = LVEQNB_MONOINSTEREO; /* Force to Mono-in-Stereo mode */
}
- else
- {
- EQNB_Params.SourceFormat = LVEQNB_MONOINSTEREO; /* Force to Mono-in-Stereo mode */
- }
- EQNB_Params.NrChannels = LocalParams.NrChannels;
+ EQNB_Params.NrChannels = LocalParams.NrChannels;
/*
* Set the control flag
*/
if ((LocalParams.OperatingMode == LVM_MODE_ON) &&
- (LocalParams.EQNB_OperatingMode == LVM_EQNB_ON))
- {
+ (LocalParams.EQNB_OperatingMode == LVM_EQNB_ON)) {
pInstance->EQNB_Active = LVM_TRUE;
- }
- else
- {
+ } else {
EQNB_Params.OperatingMode = LVEQNB_BYPASS;
}
/*
* Make the changes
*/
- EQNB_Status = LVEQNB_Control(hEQNBInstance,
- &EQNB_Params);
+ EQNB_Status = LVEQNB_Control(hEQNBInstance, &EQNB_Params);
/*
* Quit if the changes were not accepted
*/
- if (EQNB_Status != LVEQNB_SUCCESS)
- {
- return((LVM_ReturnStatus_en)EQNB_Status);
+ if (EQNB_Status != LVEQNB_SUCCESS) {
+ return ((LVM_ReturnStatus_en)EQNB_Status);
}
-
}
/*
* Update concert sound
*/
{
- LVCS_ReturnStatus_en CS_Status;
- LVCS_Params_t CS_Params;
- LVCS_Handle_t *hCSInstance = (LVCS_Handle_t *)pInstance->hCSInstance;
- LVM_Mode_en CompressorMode=LVM_MODE_ON;
+ LVCS_ReturnStatus_en CS_Status;
+ LVCS_Params_t CS_Params;
+ LVCS_Handle_t* hCSInstance = (LVCS_Handle_t*)pInstance->hCSInstance;
+ LVM_Mode_en CompressorMode = LVM_MODE_ON;
/*
* Set the new parameters
*/
- if(LocalParams.VirtualizerOperatingMode == LVM_MODE_ON)
- {
- CS_Params.OperatingMode = LVCS_ON;
- }
- else
- {
- CS_Params.OperatingMode = LVCS_OFF;
+ if (LocalParams.VirtualizerOperatingMode == LVM_MODE_ON) {
+ CS_Params.OperatingMode = LVCS_ON;
+ } else {
+ CS_Params.OperatingMode = LVCS_OFF;
}
- if((LocalParams.TE_OperatingMode == LVM_TE_ON) && (LocalParams.TE_EffectLevel == LVM_TE_LOW_MIPS))
- {
- CS_Params.SpeakerType = LVCS_EX_HEADPHONES;
- }
- else
- {
- CS_Params.SpeakerType = LVCS_HEADPHONES;
+ if ((LocalParams.TE_OperatingMode == LVM_TE_ON) &&
+ (LocalParams.TE_EffectLevel == LVM_TE_LOW_MIPS)) {
+ CS_Params.SpeakerType = LVCS_EX_HEADPHONES;
+ } else {
+ CS_Params.SpeakerType = LVCS_HEADPHONES;
}
/* Concert sound module processes only the left and right channels
@@ -757,57 +673,48 @@
* input also.
*/
if (LocalParams.SourceFormat == LVM_STEREO ||
- LocalParams.SourceFormat == LVM_MULTICHANNEL)
- {
+ LocalParams.SourceFormat == LVM_MULTICHANNEL) {
CS_Params.SourceFormat = LVCS_STEREO;
+ } else {
+ CS_Params.SourceFormat = LVCS_MONOINSTEREO; /* Force to Mono-in-Stereo mode */
}
- else
- {
- CS_Params.SourceFormat = LVCS_MONOINSTEREO; /* Force to Mono-in-Stereo mode */
- }
- CS_Params.SampleRate = LocalParams.SampleRate;
+ CS_Params.SampleRate = LocalParams.SampleRate;
CS_Params.ReverbLevel = LocalParams.VirtualizerReverbLevel;
CS_Params.EffectLevel = LocalParams.CS_EffectLevel;
- CS_Params.NrChannels = LocalParams.NrChannels;
+ CS_Params.NrChannels = LocalParams.NrChannels;
/*
* Set the control flag
*/
if (((LVM_Mode_en)LocalParams.OperatingMode == LVM_MODE_ON) &&
- ((LVCS_Modes_en)LocalParams.VirtualizerOperatingMode != LVCS_OFF))
- {
+ ((LVCS_Modes_en)LocalParams.VirtualizerOperatingMode != LVCS_OFF)) {
pInstance->CS_Active = LVM_TRUE;
- }
- else
- {
+ } else {
CS_Params.OperatingMode = LVCS_OFF;
}
- CS_Params.CompressorMode=CompressorMode;
+ CS_Params.CompressorMode = CompressorMode;
/*
* Make the changes
*/
- CS_Status = LVCS_Control(hCSInstance,
- &CS_Params);
+ CS_Status = LVCS_Control(hCSInstance, &CS_Params);
/*
* Quit if the changes were not accepted
*/
- if (CS_Status != LVCS_SUCCESS)
- {
- return((LVM_ReturnStatus_en)CS_Status);
+ if (CS_Status != LVCS_SUCCESS) {
+ return ((LVM_ReturnStatus_en)CS_Status);
}
-
}
/*
* Update the Power Spectrum Analyser
*/
{
- LVPSA_RETURN PSA_Status;
- LVPSA_ControlParams_t PSA_Params;
- pLVPSA_Handle_t *hPSAInstance = (pLVPSA_Handle_t *)pInstance->hPSAInstance;
+ LVPSA_RETURN PSA_Status;
+ LVPSA_ControlParams_t PSA_Params;
+ pLVPSA_Handle_t* hPSAInstance = (pLVPSA_Handle_t*)pInstance->hPSAInstance;
/*
* Set the new parameters
@@ -818,23 +725,19 @@
/*
* Make the changes
*/
- if(pInstance->InstParams.PSA_Included==LVM_PSA_ON)
- {
- PSA_Status = LVPSA_Control(hPSAInstance,
- &PSA_Params);
+ if (pInstance->InstParams.PSA_Included == LVM_PSA_ON) {
+ PSA_Status = LVPSA_Control(hPSAInstance, &PSA_Params);
- if (PSA_Status != LVPSA_OK)
- {
- return((LVM_ReturnStatus_en)PSA_Status);
+ if (PSA_Status != LVPSA_OK) {
+ return ((LVM_ReturnStatus_en)PSA_Status);
}
/*
* Apply new settings
*/
- PSA_Status = LVPSA_ApplyNewSettings ((LVPSA_InstancePr_t*)hPSAInstance);
- if(PSA_Status != LVPSA_OK)
- {
- return((LVM_ReturnStatus_en)PSA_Status);
+ PSA_Status = LVPSA_ApplyNewSettings((LVPSA_InstancePr_t*)hPSAInstance);
+ if (PSA_Status != LVPSA_OK) {
+ return ((LVM_ReturnStatus_en)PSA_Status);
}
}
}
@@ -843,9 +746,9 @@
* Update the parameters and clear the flag
*/
pInstance->NoSmoothVolume = LVM_FALSE;
- pInstance->Params = LocalParams;
+ pInstance->Params = LocalParams;
- return(LVM_SUCCESS);
+ return (LVM_SUCCESS);
}
/****************************************************************************************/
@@ -867,36 +770,30 @@
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_SetHeadroomParams(LVM_Handle_t hInstance,
- LVM_HeadroomParams_t *pHeadroomParams)
-{
- LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
- LVM_UINT16 ii, NBands;
+LVM_ReturnStatus_en LVM_SetHeadroomParams(LVM_Handle_t hInstance,
+ LVM_HeadroomParams_t* pHeadroomParams) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
+ LVM_UINT16 ii, NBands;
/* Check for NULL pointers */
- if ((hInstance == LVM_NULL) || (pHeadroomParams == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pHeadroomParams == LVM_NULL)) {
return (LVM_NULLADDRESS);
}
- if ((pHeadroomParams->NHeadroomBands != 0) && (pHeadroomParams->pHeadroomDefinition == LVM_NULL))
- {
+ if ((pHeadroomParams->NHeadroomBands != 0) &&
+ (pHeadroomParams->pHeadroomDefinition == LVM_NULL)) {
return (LVM_NULLADDRESS);
}
/* Consider only the LVM_HEADROOM_MAX_NBANDS first bands*/
- if (pHeadroomParams->NHeadroomBands > LVM_HEADROOM_MAX_NBANDS)
- {
+ if (pHeadroomParams->NHeadroomBands > LVM_HEADROOM_MAX_NBANDS) {
NBands = LVM_HEADROOM_MAX_NBANDS;
- }
- else
- {
+ } else {
NBands = pHeadroomParams->NHeadroomBands;
}
pInstance->NewHeadroomParams.NHeadroomBands = NBands;
/* Copy settings in memory */
- for(ii = 0; ii < NBands; ii++)
- {
+ for (ii = 0; ii < NBands; ii++) {
pInstance->pHeadroom_BandDefs[ii] = pHeadroomParams->pHeadroomDefinition[ii];
}
@@ -904,7 +801,7 @@
pInstance->NewHeadroomParams.Headroom_OperatingMode = pHeadroomParams->Headroom_OperatingMode;
pInstance->ControlPending = LVM_TRUE;
- return(LVM_SUCCESS);
+ return (LVM_SUCCESS);
}
/****************************************************************************************/
@@ -927,29 +824,26 @@
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetHeadroomParams(LVM_Handle_t hInstance,
- LVM_HeadroomParams_t *pHeadroomParams)
-{
- LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
- LVM_UINT16 ii;
+LVM_ReturnStatus_en LVM_GetHeadroomParams(LVM_Handle_t hInstance,
+ LVM_HeadroomParams_t* pHeadroomParams) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
+ LVM_UINT16 ii;
/* Check for NULL pointers */
- if ((hInstance == LVM_NULL) || (pHeadroomParams == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pHeadroomParams == LVM_NULL)) {
return (LVM_NULLADDRESS);
}
pHeadroomParams->NHeadroomBands = pInstance->NewHeadroomParams.NHeadroomBands;
/* Copy settings in memory */
- for(ii = 0; ii < pInstance->NewHeadroomParams.NHeadroomBands; ii++)
- {
+ 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);
+ return (LVM_SUCCESS);
}
/****************************************************************************************/
@@ -968,18 +862,14 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_INT32 LVM_AlgoCallBack( void *pBundleHandle,
- void *pData,
- LVM_INT16 callbackId)
-{
- LVM_Instance_t *pInstance =(LVM_Instance_t *)pBundleHandle;
+LVM_INT32 LVM_AlgoCallBack(void* pBundleHandle, void* pData, LVM_INT16 callbackId) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)pBundleHandle;
- (void) pData;
+ (void)pData;
- switch(callbackId & 0xFF00){
+ switch (callbackId & 0xFF00) {
case ALGORITHM_CS_ID:
- switch(callbackId & 0x00FF)
- {
+ switch (callbackId & 0x00FF) {
case LVCS_EVENT_ALGOFF:
pInstance->CS_Active = LVM_FALSE;
break;
@@ -988,8 +878,7 @@
}
break;
case ALGORITHM_EQNB_ID:
- switch(callbackId & 0x00FF)
- {
+ switch (callbackId & 0x00FF) {
case LVEQNB_EVENT_ALGOFF:
pInstance->EQNB_Active = LVM_FALSE;
break;
@@ -1020,21 +909,17 @@
/* 1. This function may be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_INT32 LVM_VCCallBack(void* pBundleHandle,
- void* pGeneralPurpose,
- short CallBackParam)
-{
- LVM_Instance_t *pInstance =(LVM_Instance_t *)pBundleHandle;
- LVM_FLOAT Target;
+LVM_INT32 LVM_VCCallBack(void* pBundleHandle, void* pGeneralPurpose, short CallBackParam) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)pBundleHandle;
+ LVM_FLOAT Target;
- (void) pGeneralPurpose;
- (void) CallBackParam;
+ (void)pGeneralPurpose;
+ (void)CallBackParam;
/* When volume mixer has reached 0 dB target then stop it to avoid
unnecessary processing. */
Target = LVC_Mixer_GetTarget(&pInstance->VC_Volume.MixerStream[0]);
- if(Target == 1.0f)
- {
+ if (Target == 1.0f) {
pInstance->VC_Active = LVM_FALSE;
}
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 58c18dd..bb962df 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Init.cpp
@@ -48,81 +48,71 @@
/* 1. This function must not be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_GetInstanceHandle(LVM_Handle_t *phInstance,
- LVM_InstParams_t *pInstParams)
-{
-
- LVM_ReturnStatus_en Status = LVM_SUCCESS;
- LVM_Instance_t *pInstance;
- LVM_INT16 i;
- LVM_UINT16 InternalBlockSize;
- LVM_INT32 BundleScratchSize;
+LVM_ReturnStatus_en LVM_GetInstanceHandle(LVM_Handle_t* phInstance, LVM_InstParams_t* pInstParams) {
+ LVM_ReturnStatus_en Status = LVM_SUCCESS;
+ LVM_Instance_t* pInstance;
+ LVM_INT16 i;
+ LVM_UINT16 InternalBlockSize;
+ LVM_INT32 BundleScratchSize;
/*
* Check valid points have been given
*/
- if ((phInstance == LVM_NULL) || (pInstParams == LVM_NULL))
- {
+ if ((phInstance == LVM_NULL) || (pInstParams == LVM_NULL)) {
return (LVM_NULLADDRESS);
}
/*
* Check the instance parameters
*/
- if( (pInstParams->BufferMode != LVM_MANAGED_BUFFERS) && (pInstParams->BufferMode != LVM_UNMANAGED_BUFFERS) )
- {
+ if ((pInstParams->BufferMode != LVM_MANAGED_BUFFERS) &&
+ (pInstParams->BufferMode != LVM_UNMANAGED_BUFFERS)) {
return (LVM_OUTOFRANGE);
}
- if( pInstParams->EQNB_NumBands > 32 )
- {
+ if (pInstParams->EQNB_NumBands > 32) {
return (LVM_OUTOFRANGE);
}
- if(pInstParams->BufferMode == LVM_MANAGED_BUFFERS)
- {
- if( (pInstParams->MaxBlockSize < LVM_MIN_MAXBLOCKSIZE ) || (pInstParams->MaxBlockSize > LVM_MANAGED_MAX_MAXBLOCKSIZE ) )
- {
+ if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS) {
+ if ((pInstParams->MaxBlockSize < LVM_MIN_MAXBLOCKSIZE) ||
+ (pInstParams->MaxBlockSize > LVM_MANAGED_MAX_MAXBLOCKSIZE)) {
return (LVM_OUTOFRANGE);
}
- }
- else
- {
- if( (pInstParams->MaxBlockSize < LVM_MIN_MAXBLOCKSIZE ) || (pInstParams->MaxBlockSize > LVM_UNMANAGED_MAX_MAXBLOCKSIZE) )
- {
+ } else {
+ if ((pInstParams->MaxBlockSize < LVM_MIN_MAXBLOCKSIZE) ||
+ (pInstParams->MaxBlockSize > LVM_UNMANAGED_MAX_MAXBLOCKSIZE)) {
return (LVM_OUTOFRANGE);
}
}
- if(pInstParams->PSA_Included > LVM_PSA_ON)
- {
+ if (pInstParams->PSA_Included > LVM_PSA_ON) {
return (LVM_OUTOFRANGE);
}
/*
* Create the instance handle
*/
- *phInstance = (LVM_Handle_t)calloc(1, sizeof(*pInstance));
- if (*phInstance == LVM_NULL)
- {
+ *phInstance = (LVM_Handle_t)calloc(1, sizeof(*pInstance));
+ if (*phInstance == LVM_NULL) {
return LVM_NULLADDRESS;
}
- pInstance = (LVM_Instance_t *)*phInstance;
+ pInstance = (LVM_Instance_t*)*phInstance;
pInstance->InstParams = *pInstParams;
/*
* Create the bundle scratch memory and initialse the buffer management
*/
- InternalBlockSize = (LVM_UINT16)((pInstParams->MaxBlockSize) & MIN_INTERNAL_BLOCKMASK); /* Force to a multiple of MIN_INTERNAL_BLOCKSIZE */
- if (InternalBlockSize < MIN_INTERNAL_BLOCKSIZE)
- {
+ InternalBlockSize = (LVM_UINT16)(
+ (pInstParams->MaxBlockSize) &
+ MIN_INTERNAL_BLOCKMASK); /* Force to a multiple of MIN_INTERNAL_BLOCKSIZE */
+ if (InternalBlockSize < MIN_INTERNAL_BLOCKSIZE) {
InternalBlockSize = MIN_INTERNAL_BLOCKSIZE;
}
/* Maximum Internal Black Size should not be more than MAX_INTERNAL_BLOCKSIZE*/
- if(InternalBlockSize > MAX_INTERNAL_BLOCKSIZE)
- {
+ if (InternalBlockSize > MAX_INTERNAL_BLOCKSIZE) {
InternalBlockSize = MAX_INTERNAL_BLOCKSIZE;
}
pInstance->InternalBlockSize = (LVM_INT16)InternalBlockSize;
@@ -130,48 +120,46 @@
/*
* Common settings for managed and unmanaged buffers
*/
- pInstance->SamplesToProcess = 0; /* No samples left to process */
- BundleScratchSize = (LVM_INT32)
- (3 * LVM_MAX_CHANNELS \
- * (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) \
- * sizeof(LVM_FLOAT));
+ pInstance->SamplesToProcess = 0; /* No samples left to process */
+ BundleScratchSize =
+ (LVM_INT32)(3 * LVM_MAX_CHANNELS * (MIN_INTERNAL_BLOCKSIZE + InternalBlockSize) *
+ sizeof(LVM_FLOAT));
pInstance->pScratch = calloc(1, BundleScratchSize);
- if (pInstance->pScratch == LVM_NULL)
- {
+ if (pInstance->pScratch == LVM_NULL) {
return LVM_NULLADDRESS;
}
- if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS)
- {
+ if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS) {
/*
* Managed buffers required
*/
- pInstance->pBufferManagement = (LVM_Buffer_t *)
- calloc(1, sizeof(*(pInstance->pBufferManagement)));
- if (pInstance->pBufferManagement == LVM_NULL)
- {
+ pInstance->pBufferManagement =
+ (LVM_Buffer_t*)calloc(1, sizeof(*(pInstance->pBufferManagement)));
+ if (pInstance->pBufferManagement == LVM_NULL) {
return LVM_NULLADDRESS;
}
- pInstance->pBufferManagement->pScratch = (LVM_FLOAT *)pInstance->pScratch;
+ pInstance->pBufferManagement->pScratch = (LVM_FLOAT*)pInstance->pScratch;
LoadConst_Float(0, /* Clear the input delay buffer */
- (LVM_FLOAT *)&pInstance->pBufferManagement->InDelayBuffer,
+ (LVM_FLOAT*)&pInstance->pBufferManagement->InDelayBuffer,
(LVM_INT16)(LVM_MAX_CHANNELS * MIN_INTERNAL_BLOCKSIZE));
- 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 */
+ 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
*/
- pInstance->Params.OperatingMode = LVM_MODE_OFF;
- pInstance->Params.SampleRate = LVM_FS_8000;
- pInstance->Params.SourceFormat = LVM_MONO;
- pInstance->Params.SpeakerType = LVM_HEADPHONES;
- pInstance->Params.VC_EffectLevel = 0;
- pInstance->Params.VC_Balance = 0;
+ pInstance->Params.OperatingMode = LVM_MODE_OFF;
+ pInstance->Params.SampleRate = LVM_FS_8000;
+ pInstance->Params.SourceFormat = LVM_MONO;
+ pInstance->Params.SpeakerType = LVM_HEADPHONES;
+ pInstance->Params.VC_EffectLevel = 0;
+ pInstance->Params.VC_Balance = 0;
/*
* Set callback
@@ -186,71 +174,67 @@
/*
* Treble Enhancement
*/
- pInstance->pTE_Taps = (LVM_TE_Data_t *)calloc(1, sizeof(*(pInstance->pTE_Taps)));
- if (pInstance->pTE_Taps == LVM_NULL)
- {
+ pInstance->pTE_Taps = (LVM_TE_Data_t*)calloc(1, sizeof(*(pInstance->pTE_Taps)));
+ if (pInstance->pTE_Taps == LVM_NULL) {
return LVM_NULLADDRESS;
}
- pInstance->pTE_State = (LVM_TE_Coefs_t *)calloc(1, sizeof(*(pInstance->pTE_State)));
- if (pInstance->pTE_State == LVM_NULL)
- {
+ pInstance->pTE_State = (LVM_TE_Coefs_t*)calloc(1, sizeof(*(pInstance->pTE_State)));
+ if (pInstance->pTE_State == LVM_NULL) {
return LVM_NULLADDRESS;
}
pInstance->Params.TE_OperatingMode = LVM_TE_OFF;
- pInstance->Params.TE_EffectLevel = 0;
- pInstance->TE_Active = LVM_FALSE;
+ pInstance->Params.TE_EffectLevel = 0;
+ pInstance->TE_Active = LVM_FALSE;
/*
* Set the volume control and initialise Current to Target
*/
- pInstance->VC_Volume.MixerStream[0].CallbackParam = 0;
- pInstance->VC_Volume.MixerStream[0].CallbackSet = 0;
- pInstance->VC_Volume.MixerStream[0].pCallbackHandle = pInstance;
- pInstance->VC_Volume.MixerStream[0].pCallBack = LVM_VCCallBack;
+ pInstance->VC_Volume.MixerStream[0].CallbackParam = 0;
+ pInstance->VC_Volume.MixerStream[0].CallbackSet = 0;
+ pInstance->VC_Volume.MixerStream[0].pCallbackHandle = pInstance;
+ pInstance->VC_Volume.MixerStream[0].pCallBack = LVM_VCCallBack;
- /* In managed buffering, start with low signal level as delay in buffer management causes a click*/
- if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS)
- {
+ /* In managed buffering, start with low signal level as delay in buffer management causes a
+ * click*/
+ if (pInstParams->BufferMode == LVM_MANAGED_BUFFERS) {
LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0], 0, 0);
- }
- else
- {
+ } else {
LVC_Mixer_Init(&pInstance->VC_Volume.MixerStream[0], LVM_MAXFLOAT, LVM_MAXFLOAT);
}
- LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0],0,LVM_FS_8000,2);
+ LVC_Mixer_SetTimeConstant(&pInstance->VC_Volume.MixerStream[0], 0, LVM_FS_8000, 2);
- pInstance->VC_VolumedB = 0;
- pInstance->VC_AVLFixedVolume = 0;
- pInstance->VC_Active = LVM_FALSE;
+ pInstance->VC_VolumedB = 0;
+ pInstance->VC_AVLFixedVolume = 0;
+ pInstance->VC_Active = LVM_FALSE;
- pInstance->VC_BalanceMix.MixerStream[0].CallbackParam = 0;
- pInstance->VC_BalanceMix.MixerStream[0].CallbackSet = 0;
- pInstance->VC_BalanceMix.MixerStream[0].pCallbackHandle = pInstance;
- pInstance->VC_BalanceMix.MixerStream[0].pCallBack = LVM_VCCallBack;
+ pInstance->VC_BalanceMix.MixerStream[0].CallbackParam = 0;
+ pInstance->VC_BalanceMix.MixerStream[0].CallbackSet = 0;
+ pInstance->VC_BalanceMix.MixerStream[0].pCallbackHandle = pInstance;
+ pInstance->VC_BalanceMix.MixerStream[0].pCallBack = LVM_VCCallBack;
LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[0], LVM_MAXFLOAT, LVM_MAXFLOAT);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[0],LVM_VC_MIXER_TIME,LVM_FS_8000,2);
+ 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;
+ 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;
LVC_Mixer_Init(&pInstance->VC_BalanceMix.MixerStream[1], LVM_MAXFLOAT, LVM_MAXFLOAT);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1],LVM_VC_MIXER_TIME,LVM_FS_8000,2);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->VC_BalanceMix.MixerStream[1], LVM_VC_MIXER_TIME,
+ LVM_FS_8000, 2);
/*
* Create the default EQNB pre-gain and pointer to the band definitions
*/
- pInstance->pEQNB_BandDefs = (LVM_EQNB_BandDef_t *)
- calloc(pInstParams->EQNB_NumBands, sizeof(*(pInstance->pEQNB_BandDefs)));
- if (pInstance->pEQNB_BandDefs == LVM_NULL)
- {
+ pInstance->pEQNB_BandDefs = (LVM_EQNB_BandDef_t*)calloc(pInstParams->EQNB_NumBands,
+ sizeof(*(pInstance->pEQNB_BandDefs)));
+ if (pInstance->pEQNB_BandDefs == LVM_NULL) {
return LVM_NULLADDRESS;
}
- pInstance->pEQNB_UserDefs = (LVM_EQNB_BandDef_t *)
- calloc(pInstParams->EQNB_NumBands, sizeof(*(pInstance->pEQNB_UserDefs)));
- if (pInstance->pEQNB_UserDefs == LVM_NULL)
- {
+ pInstance->pEQNB_UserDefs = (LVM_EQNB_BandDef_t*)calloc(pInstParams->EQNB_NumBands,
+ sizeof(*(pInstance->pEQNB_UserDefs)));
+ if (pInstance->pEQNB_UserDefs == LVM_NULL) {
return LVM_NULLADDRESS;
}
@@ -258,209 +242,192 @@
* Initialise the Concert Sound module
*/
{
- LVCS_Handle_t hCSInstance; /* Instance handle */
- LVCS_Capabilities_t CS_Capabilities; /* Initial capabilities */
- LVCS_ReturnStatus_en LVCS_Status; /* Function call status */
+ LVCS_Handle_t hCSInstance; /* Instance handle */
+ LVCS_Capabilities_t CS_Capabilities; /* Initial capabilities */
+ LVCS_ReturnStatus_en LVCS_Status; /* Function call status */
/*
* Set default parameters
*/
- pInstance->Params.VirtualizerReverbLevel = 100;
- pInstance->Params.VirtualizerType = LVM_CONCERTSOUND;
- pInstance->Params.VirtualizerOperatingMode = LVM_MODE_OFF;
- pInstance->CS_Active = LVM_FALSE;
+ pInstance->Params.VirtualizerReverbLevel = 100;
+ pInstance->Params.VirtualizerType = LVM_CONCERTSOUND;
+ pInstance->Params.VirtualizerOperatingMode = LVM_MODE_OFF;
+ pInstance->CS_Active = LVM_FALSE;
/*
* Set the initialisation capabilities
*/
- CS_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
+ CS_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
CS_Capabilities.CallBack = pInstance->CallBack;
CS_Capabilities.pBundleInstance = (void*)pInstance;
/*
* Initialise the Concert Sound instance and save the instance handle
*/
- hCSInstance = LVM_NULL; /* Set to NULL to return handle */
- LVCS_Status = LVCS_Init(&hCSInstance, /* Create and initiailse */
- &CS_Capabilities,
- pInstance->pScratch);
- if (LVCS_Status != LVCS_SUCCESS) return((LVM_ReturnStatus_en)LVCS_Status);
- pInstance->hCSInstance = hCSInstance; /* Save the instance handle */
-
+ hCSInstance = LVM_NULL; /* Set to NULL to return handle */
+ LVCS_Status = LVCS_Init(&hCSInstance, /* Create and initiailse */
+ &CS_Capabilities, pInstance->pScratch);
+ if (LVCS_Status != LVCS_SUCCESS) return ((LVM_ReturnStatus_en)LVCS_Status);
+ pInstance->hCSInstance = hCSInstance; /* Save the instance handle */
}
/*
* Initialise the Bass Enhancement module
*/
{
- LVDBE_Handle_t hDBEInstance; /* Instance handle */
- LVDBE_Capabilities_t DBE_Capabilities; /* Initial capabilities */
- LVDBE_ReturnStatus_en LVDBE_Status; /* Function call status */
+ LVDBE_Handle_t hDBEInstance; /* Instance handle */
+ LVDBE_Capabilities_t DBE_Capabilities; /* Initial capabilities */
+ LVDBE_ReturnStatus_en LVDBE_Status; /* Function call status */
/*
* Set the initialisation parameters
*/
pInstance->Params.BE_OperatingMode = LVM_BE_OFF;
- pInstance->Params.BE_CentreFreq = LVM_BE_CENTRE_55Hz;
- pInstance->Params.BE_EffectLevel = 0;
- pInstance->Params.BE_HPF = LVM_BE_HPF_OFF;
+ pInstance->Params.BE_CentreFreq = LVM_BE_CENTRE_55Hz;
+ pInstance->Params.BE_EffectLevel = 0;
+ pInstance->Params.BE_HPF = LVM_BE_HPF_OFF;
- pInstance->DBE_Active = LVM_FALSE;
+ pInstance->DBE_Active = LVM_FALSE;
/*
* Set the initialisation capabilities
*/
- 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 | LVDBE_CAP_FS_88200 |
- LVDBE_CAP_FS_96000 | LVDBE_CAP_FS_176400 |
- LVDBE_CAP_FS_192000;
+ 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 |
+ LVDBE_CAP_FS_88200 | LVDBE_CAP_FS_96000 |
+ LVDBE_CAP_FS_176400 | LVDBE_CAP_FS_192000;
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;
+ LVDBE_CAP_CENTRE_66Hz | LVDBE_CAP_CENTRE_78Hz |
+ LVDBE_CAP_CENTRE_90Hz;
+ DBE_Capabilities.MaxBlockSize = (LVM_UINT16)InternalBlockSize;
/*
* Initialise the Dynamic Bass Enhancement instance and save the instance handle
*/
- hDBEInstance = LVM_NULL; /* Set to NULL to return handle */
- LVDBE_Status = LVDBE_Init(&hDBEInstance, /* Create and initiailse */
- &DBE_Capabilities,
- pInstance->pScratch);
- if (LVDBE_Status != LVDBE_SUCCESS) return((LVM_ReturnStatus_en)LVDBE_Status);
- pInstance->hDBEInstance = hDBEInstance; /* Save the instance handle */
+ hDBEInstance = LVM_NULL; /* Set to NULL to return handle */
+ LVDBE_Status = LVDBE_Init(&hDBEInstance, /* Create and initiailse */
+ &DBE_Capabilities, pInstance->pScratch);
+ if (LVDBE_Status != LVDBE_SUCCESS) return ((LVM_ReturnStatus_en)LVDBE_Status);
+ pInstance->hDBEInstance = hDBEInstance; /* Save the instance handle */
}
/*
* Initialise the N-Band Equaliser module
*/
{
- LVEQNB_Handle_t hEQNBInstance; /* Instance handle */
- LVEQNB_Capabilities_t EQNB_Capabilities; /* Initial capabilities */
- LVEQNB_ReturnStatus_en LVEQNB_Status; /* Function call status */
+ LVEQNB_Handle_t hEQNBInstance; /* Instance handle */
+ LVEQNB_Capabilities_t EQNB_Capabilities; /* Initial capabilities */
+ LVEQNB_ReturnStatus_en LVEQNB_Status; /* Function call status */
/*
* Set the initialisation parameters
*/
- pInstance->Params.EQNB_OperatingMode = LVM_EQNB_OFF;
- pInstance->Params.EQNB_NBands = 0;
+ pInstance->Params.EQNB_OperatingMode = LVM_EQNB_OFF;
+ pInstance->Params.EQNB_NBands = 0;
pInstance->Params.pEQNB_BandDefinition = LVM_NULL;
- pInstance->EQNB_Active = LVM_FALSE;
+ pInstance->EQNB_Active = LVM_FALSE;
/*
* Set the initialisation capabilities
*/
- 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 | LVEQNB_CAP_FS_88200 |
- LVEQNB_CAP_FS_96000 | LVEQNB_CAP_FS_176400 |
- LVEQNB_CAP_FS_192000;
+ 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 |
+ LVEQNB_CAP_FS_88200 | LVEQNB_CAP_FS_96000 | LVEQNB_CAP_FS_176400 |
+ LVEQNB_CAP_FS_192000;
- 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;
+ 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;
/*
* Initialise the Dynamic Bass Enhancement instance and save the instance handle
*/
- hEQNBInstance = LVM_NULL; /* Set to NULL to return handle */
- LVEQNB_Status = LVEQNB_Init(&hEQNBInstance, /* Create and initiailse */
- &EQNB_Capabilities,
- pInstance->pScratch);
- if (LVEQNB_Status != LVEQNB_SUCCESS) return((LVM_ReturnStatus_en)LVEQNB_Status);
- pInstance->hEQNBInstance = hEQNBInstance; /* Save the instance handle */
+ hEQNBInstance = LVM_NULL; /* Set to NULL to return handle */
+ LVEQNB_Status = LVEQNB_Init(&hEQNBInstance, /* Create and initiailse */
+ &EQNB_Capabilities, pInstance->pScratch);
+ if (LVEQNB_Status != LVEQNB_SUCCESS) return ((LVM_ReturnStatus_en)LVEQNB_Status);
+ pInstance->hEQNBInstance = hEQNBInstance; /* Save the instance handle */
}
/*
* Headroom management memory allocation
*/
{
- pInstance->pHeadroom_BandDefs = (LVM_HeadroomBandDef_t *)
- calloc(LVM_HEADROOM_MAX_NBANDS, sizeof(*(pInstance->pHeadroom_BandDefs)));
- if (pInstance->pHeadroom_BandDefs == LVM_NULL)
- {
+ pInstance->pHeadroom_BandDefs = (LVM_HeadroomBandDef_t*)calloc(
+ LVM_HEADROOM_MAX_NBANDS, sizeof(*(pInstance->pHeadroom_BandDefs)));
+ if (pInstance->pHeadroom_BandDefs == LVM_NULL) {
return LVM_NULLADDRESS;
}
- pInstance->pHeadroom_UserDefs = (LVM_HeadroomBandDef_t *)
- calloc(LVM_HEADROOM_MAX_NBANDS, sizeof(*(pInstance->pHeadroom_UserDefs)));
- if (pInstance->pHeadroom_UserDefs == LVM_NULL)
- {
+ pInstance->pHeadroom_UserDefs = (LVM_HeadroomBandDef_t*)calloc(
+ LVM_HEADROOM_MAX_NBANDS, sizeof(*(pInstance->pHeadroom_UserDefs)));
+ if (pInstance->pHeadroom_UserDefs == LVM_NULL) {
return LVM_NULLADDRESS;
}
/* Headroom management parameters initialisation */
pInstance->NewHeadroomParams.NHeadroomBands = 2;
pInstance->NewHeadroomParams.pHeadroomDefinition = pInstance->pHeadroom_BandDefs;
- pInstance->NewHeadroomParams.pHeadroomDefinition[0].Limit_Low = 20;
- pInstance->NewHeadroomParams.pHeadroomDefinition[0].Limit_High = 4999;
- pInstance->NewHeadroomParams.pHeadroomDefinition[0].Headroom_Offset = 3;
- pInstance->NewHeadroomParams.pHeadroomDefinition[1].Limit_Low = 5000;
- pInstance->NewHeadroomParams.pHeadroomDefinition[1].Limit_High = 24000;
- pInstance->NewHeadroomParams.pHeadroomDefinition[1].Headroom_Offset = 4;
+ pInstance->NewHeadroomParams.pHeadroomDefinition[0].Limit_Low = 20;
+ pInstance->NewHeadroomParams.pHeadroomDefinition[0].Limit_High = 4999;
+ pInstance->NewHeadroomParams.pHeadroomDefinition[0].Headroom_Offset = 3;
+ pInstance->NewHeadroomParams.pHeadroomDefinition[1].Limit_Low = 5000;
+ pInstance->NewHeadroomParams.pHeadroomDefinition[1].Limit_High = 24000;
+ pInstance->NewHeadroomParams.pHeadroomDefinition[1].Headroom_Offset = 4;
pInstance->NewHeadroomParams.Headroom_OperatingMode = LVM_HEADROOM_ON;
- pInstance->Headroom =0;
+ pInstance->Headroom = 0;
}
/*
* Initialise the PSA module
*/
{
- pLVPSA_Handle_t hPSAInstance = LVM_NULL; /* Instance handle */
- LVPSA_RETURN PSA_Status; /* Function call status */
+ pLVPSA_Handle_t hPSAInstance = LVM_NULL; /* Instance handle */
+ LVPSA_RETURN PSA_Status; /* Function call status */
LVPSA_FilterParam_t FiltersParams[9];
- if(pInstParams->PSA_Included==LVM_PSA_ON)
- {
- pInstance->PSA_InitParams.SpectralDataBufferDuration = (LVM_UINT16) 500;
- pInstance->PSA_InitParams.MaxInputBlockSize = (LVM_UINT16) 2048;
- pInstance->PSA_InitParams.nBands = (LVM_UINT16) 9;
- pInstance->PSA_InitParams.pFiltersParams = &FiltersParams[0];
- for(i = 0; i < pInstance->PSA_InitParams.nBands; i++)
- {
- FiltersParams[i].CenterFrequency = (LVM_UINT16) 1000;
- FiltersParams[i].QFactor = (LVM_UINT16) 100;
- FiltersParams[i].PostGain = (LVM_INT16) 0;
+ if (pInstParams->PSA_Included == LVM_PSA_ON) {
+ pInstance->PSA_InitParams.SpectralDataBufferDuration = (LVM_UINT16)500;
+ pInstance->PSA_InitParams.MaxInputBlockSize = (LVM_UINT16)2048;
+ pInstance->PSA_InitParams.nBands = (LVM_UINT16)9;
+ pInstance->PSA_InitParams.pFiltersParams = &FiltersParams[0];
+ for (i = 0; i < pInstance->PSA_InitParams.nBands; i++) {
+ FiltersParams[i].CenterFrequency = (LVM_UINT16)1000;
+ FiltersParams[i].QFactor = (LVM_UINT16)100;
+ FiltersParams[i].PostGain = (LVM_INT16)0;
}
/*Initialise PSA instance and save the instance handle*/
pInstance->PSA_ControlParams.Fs = LVM_FS_48000;
- pInstance->PSA_ControlParams.LevelDetectionSpeed = LVPSA_SPEED_MEDIUM;
- pInstance->pPSAInput = (LVM_FLOAT *)calloc(MAX_INTERNAL_BLOCKSIZE, sizeof(LVM_FLOAT));
- if (pInstance->pPSAInput == LVM_NULL)
- {
+ pInstance->PSA_ControlParams.LevelDetectionSpeed = LVPSA_SPEED_MEDIUM;
+ pInstance->pPSAInput = (LVM_FLOAT*)calloc(MAX_INTERNAL_BLOCKSIZE, sizeof(LVM_FLOAT));
+ if (pInstance->pPSAInput == LVM_NULL) {
return LVM_NULLADDRESS;
}
- PSA_Status = LVPSA_Init (&hPSAInstance,
- &pInstance->PSA_InitParams,
- &pInstance->PSA_ControlParams,
- pInstance->pScratch);
+ PSA_Status = LVPSA_Init(&hPSAInstance, &pInstance->PSA_InitParams,
+ &pInstance->PSA_ControlParams, pInstance->pScratch);
- if (PSA_Status != LVPSA_OK)
- {
- return((LVM_ReturnStatus_en) LVM_ALGORITHMPSA);
+ if (PSA_Status != LVPSA_OK) {
+ return ((LVM_ReturnStatus_en)LVM_ALGORITHMPSA);
}
- pInstance->hPSAInstance = hPSAInstance; /* Save the instance handle */
+ pInstance->hPSAInstance = hPSAInstance; /* Save the instance handle */
pInstance->PSA_GainOffset = 0;
- }
- else
- {
+ } else {
pInstance->hPSAInstance = LVM_NULL;
}
/*
* Set the initialisation parameters.
*/
- pInstance->Params.PSA_PeakDecayRate = LVM_PSA_SPEED_MEDIUM;
- pInstance->Params.PSA_Enable = LVM_PSA_OFF;
+ pInstance->Params.PSA_PeakDecayRate = LVM_PSA_SPEED_MEDIUM;
+ pInstance->Params.PSA_Enable = LVM_PSA_OFF;
}
/*
@@ -479,20 +446,17 @@
pInstance->ConfigurationNumber += LVM_VC_MASK;
pInstance->ConfigurationNumber += LVM_PSA_MASK;
- if(((pInstance->ConfigurationNumber & LVM_CS_MASK)!=0) ||
- ((pInstance->ConfigurationNumber & LVM_DBE_MASK)!=0) ||
- ((pInstance->ConfigurationNumber & LVM_EQNB_MASK)!=0)||
- ((pInstance->ConfigurationNumber & LVM_TE_MASK)!=0) ||
- ((pInstance->ConfigurationNumber & LVM_VC_MASK)!=0))
- {
- pInstance->BlickSizeMultiple = 4;
- }
- else
- {
- pInstance->BlickSizeMultiple = 1;
+ if (((pInstance->ConfigurationNumber & LVM_CS_MASK) != 0) ||
+ ((pInstance->ConfigurationNumber & LVM_DBE_MASK) != 0) ||
+ ((pInstance->ConfigurationNumber & LVM_EQNB_MASK) != 0) ||
+ ((pInstance->ConfigurationNumber & LVM_TE_MASK) != 0) ||
+ ((pInstance->ConfigurationNumber & LVM_VC_MASK) != 0)) {
+ pInstance->BlickSizeMultiple = 4;
+ } else {
+ pInstance->BlickSizeMultiple = 1;
}
- return(Status);
+ return (Status);
}
/****************************************************************************************/
/* */
@@ -509,9 +473,8 @@
/* 1. This function must not be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-void LVM_DelInstanceHandle(LVM_Handle_t *phInstance)
-{
- LVM_Instance_t *pInstance = (LVM_Instance_t *)*phInstance;
+void LVM_DelInstanceHandle(LVM_Handle_t* phInstance) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)*phInstance;
if (pInstance->pScratch != LVM_NULL) {
free(pInstance->pScratch);
@@ -619,29 +582,29 @@
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_ClearAudioBuffers(LVM_Handle_t hInstance)
-{
- LVM_InstParams_t InstParams; /* Instance parameters */
- LVM_ControlParams_t Params; /* Control Parameters */
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance; /* Pointer to Instance */
- LVM_HeadroomParams_t HeadroomParams;
+LVM_ReturnStatus_en LVM_ClearAudioBuffers(LVM_Handle_t hInstance) {
+ LVM_InstParams_t InstParams; /* Instance parameters */
+ LVM_ControlParams_t Params; /* Control Parameters */
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance; /* Pointer to Instance */
+ LVM_HeadroomParams_t HeadroomParams;
- if(hInstance == LVM_NULL){
+ if (hInstance == LVM_NULL) {
return LVM_NULLADDRESS;
}
- /* Save the control parameters */ /* coverity[unchecked_value] */ /* Do not check return value internal function calls */
+ /* Save the control parameters */ /* coverity[unchecked_value] */ /* Do not check return value
+ internal function calls */
LVM_GetControlParameters(hInstance, &Params);
/*Save the headroom parameters*/
LVM_GetHeadroomParams(hInstance, &HeadroomParams);
-
/* Save the instance parameters */
InstParams = pInstance->InstParams;
/* Call LVM_GetInstanceHandle to re-initialise the bundle */
- /* Restore control parameters */ /* coverity[unchecked_value] */ /* Do not check return value internal function calls */
+ /* Restore control parameters */ /* coverity[unchecked_value] */ /* Do not check return value
+ internal function calls */
LVM_SetControlParameters(hInstance, &Params);
/*Restore the headroom parameters*/
@@ -652,4 +615,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 a9492a1..90a1f19 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
@@ -33,14 +33,14 @@
/* */
/************************************************************************************/
-#include "LVM.h" /* LifeVibes */
-#include "LVM_Common.h" /* LifeVibes common */
-#include "BIQUAD.h" /* Biquad library */
-#include "LVC_Mixer.h" /* Mixer library */
-#include "LVCS_Private.h" /* Concert Sound */
-#include "LVDBE_Private.h" /* Dynamic Bass Enhancement */
-#include "LVEQNB_Private.h" /* N-Band equaliser */
-#include "LVPSA_Private.h" /* Parametric Spectrum Analyzer */
+#include "LVM.h" /* LifeVibes */
+#include "LVM_Common.h" /* LifeVibes common */
+#include "BIQUAD.h" /* Biquad library */
+#include "LVC_Mixer.h" /* Mixer library */
+#include "LVCS_Private.h" /* Concert Sound */
+#include "LVDBE_Private.h" /* Dynamic Bass Enhancement */
+#include "LVEQNB_Private.h" /* N-Band equaliser */
+#include "LVPSA_Private.h" /* Parametric Spectrum Analyzer */
/************************************************************************************/
/* */
@@ -49,63 +49,64 @@
/************************************************************************************/
/* General */
-#define LVM_INVALID 0xFFFF /* Invalid init parameter */
+#define LVM_INVALID 0xFFFF /* Invalid init parameter */
/* Memory */
-#define LVM_INSTANCE_ALIGN 4 /* 32-bit for structures */
-#define LVM_FIRSTCALL 0 /* First call to the buffer */
-#define LVM_MAXBLOCKCALL 1 /* Maximum block size calls to the buffer */
-#define LVM_LASTCALL 2 /* Last call to the buffer */
-#define LVM_FIRSTLASTCALL 3 /* Single call for small number of samples */
+#define LVM_INSTANCE_ALIGN 4 /* 32-bit for structures */
+#define LVM_FIRSTCALL 0 /* First call to the buffer */
+#define LVM_MAXBLOCKCALL 1 /* Maximum block size calls to the buffer */
+#define LVM_LASTCALL 2 /* Last call to the buffer */
+#define LVM_FIRSTLASTCALL 3 /* Single call for small number of samples */
/* Block Size */
-#define LVM_MIN_MAXBLOCKSIZE 16 /* Minimum MaxBlockSize Limit*/
-#define LVM_MANAGED_MAX_MAXBLOCKSIZE 8191 /* Maximum MaxBlockSzie Limit for Managed Buffer Mode*/
-#define LVM_UNMANAGED_MAX_MAXBLOCKSIZE 4096 /* Maximum MaxBlockSzie Limit for Unmanaged Buffer Mode */
+#define LVM_MIN_MAXBLOCKSIZE 16 /* Minimum MaxBlockSize Limit*/
+#define LVM_MANAGED_MAX_MAXBLOCKSIZE 8191 /* Maximum MaxBlockSzie Limit for Managed Buffer Mode*/
+#define LVM_UNMANAGED_MAX_MAXBLOCKSIZE \
+ 4096 /* Maximum MaxBlockSzie Limit for Unmanaged Buffer Mode */
-#define MAX_INTERNAL_BLOCKSIZE 8128 /* Maximum multiple of 64 below 8191*/
+#define MAX_INTERNAL_BLOCKSIZE 8128 /* Maximum multiple of 64 below 8191*/
-#define MIN_INTERNAL_BLOCKSIZE 16 /* Minimum internal block size */
-#define MIN_INTERNAL_BLOCKSHIFT 4 /* Minimum internal block size as a power of 2 */
-#define MIN_INTERNAL_BLOCKMASK 0xFFF0 /* Minimum internal block size mask */
+#define MIN_INTERNAL_BLOCKSIZE 16 /* Minimum internal block size */
+#define MIN_INTERNAL_BLOCKSHIFT 4 /* Minimum internal block size as a power of 2 */
+#define MIN_INTERNAL_BLOCKMASK 0xFFF0 /* Minimum internal block size mask */
-#define LVM_PSA_DYNAMICRANGE 60 /* Spectral Dynamic range: used for offseting output*/
-#define LVM_PSA_BARHEIGHT 127 /* Spectral Bar Height*/
+#define LVM_PSA_DYNAMICRANGE 60 /* Spectral Dynamic range: used for offseting output*/
+#define LVM_PSA_BARHEIGHT 127 /* Spectral Bar Height*/
-#define LVM_TE_MIN_EFFECTLEVEL 0 /*TE Minimum EffectLevel*/
-#define LVM_TE_MAX_EFFECTLEVEL 15 /*TE Maximum Effect level*/
+#define LVM_TE_MIN_EFFECTLEVEL 0 /*TE Minimum EffectLevel*/
+#define LVM_TE_MAX_EFFECTLEVEL 15 /*TE Maximum Effect level*/
-#define LVM_VC_MIN_EFFECTLEVEL (-96) /*VC Minimum EffectLevel*/
-#define LVM_VC_MAX_EFFECTLEVEL 0 /*VC Maximum Effect level*/
+#define LVM_VC_MIN_EFFECTLEVEL (-96) /*VC Minimum EffectLevel*/
+#define LVM_VC_MAX_EFFECTLEVEL 0 /*VC Maximum Effect level*/
-#define LVM_BE_MIN_EFFECTLEVEL 0 /*BE Minimum EffectLevel*/
-#define LVM_BE_MAX_EFFECTLEVEL 15 /*BE Maximum Effect level*/
+#define LVM_BE_MIN_EFFECTLEVEL 0 /*BE Minimum EffectLevel*/
+#define LVM_BE_MAX_EFFECTLEVEL 15 /*BE Maximum Effect level*/
-#define LVM_EQNB_MIN_BAND_FREQ 20 /*EQNB Minimum Band Frequency*/
-#define LVM_EQNB_MAX_BAND_FREQ 24000 /*EQNB Maximum Band Frequency*/
-#define LVM_EQNB_MIN_BAND_GAIN (-15) /*EQNB Minimum Band Frequency*/
-#define LVM_EQNB_MAX_BAND_GAIN 15 /*EQNB Maximum Band Frequency*/
-#define LVM_EQNB_MIN_QFACTOR 25 /*EQNB Minimum Q Factor*/
-#define LVM_EQNB_MAX_QFACTOR 1200 /*EQNB Maximum Q Factor*/
-#define LVM_EQNB_MIN_LPF_FREQ 1000 /*EQNB Minimum Low Pass Corner frequency*/
-#define LVM_EQNB_MIN_HPF_FREQ 20 /*EQNB Minimum High Pass Corner frequency*/
-#define LVM_EQNB_MAX_HPF_FREQ 1000 /*EQNB Maximum High Pass Corner frequency*/
+#define LVM_EQNB_MIN_BAND_FREQ 20 /*EQNB Minimum Band Frequency*/
+#define LVM_EQNB_MAX_BAND_FREQ 24000 /*EQNB Maximum Band Frequency*/
+#define LVM_EQNB_MIN_BAND_GAIN (-15) /*EQNB Minimum Band Frequency*/
+#define LVM_EQNB_MAX_BAND_GAIN 15 /*EQNB Maximum Band Frequency*/
+#define LVM_EQNB_MIN_QFACTOR 25 /*EQNB Minimum Q Factor*/
+#define LVM_EQNB_MAX_QFACTOR 1200 /*EQNB Maximum Q Factor*/
+#define LVM_EQNB_MIN_LPF_FREQ 1000 /*EQNB Minimum Low Pass Corner frequency*/
+#define LVM_EQNB_MIN_HPF_FREQ 20 /*EQNB Minimum High Pass Corner frequency*/
+#define LVM_EQNB_MAX_HPF_FREQ 1000 /*EQNB Maximum High Pass Corner frequency*/
-#define LVM_CS_MIN_EFFECT_LEVEL 0 /*CS Minimum Effect Level*/
-#define LVM_CS_MAX_REVERB_LEVEL 100 /*CS Maximum Reverb Level*/
-#define LVM_VIRTUALIZER_MAX_REVERB_LEVEL 100 /*Vitrualizer Maximum Reverb Level*/
+#define LVM_CS_MIN_EFFECT_LEVEL 0 /*CS Minimum Effect Level*/
+#define LVM_CS_MAX_REVERB_LEVEL 100 /*CS Maximum Reverb Level*/
+#define LVM_VIRTUALIZER_MAX_REVERB_LEVEL 100 /*Vitrualizer Maximum Reverb Level*/
-#define LVM_VC_MIXER_TIME 100 /*VC mixer time*/
-#define LVM_VC_BALANCE_MAX 96 /*VC balance max value*/
-#define LVM_VC_BALANCE_MIN (-96) /*VC balance min value*/
+#define LVM_VC_MIXER_TIME 100 /*VC mixer time*/
+#define LVM_VC_BALANCE_MAX 96 /*VC balance max value*/
+#define LVM_VC_BALANCE_MIN (-96) /*VC balance min value*/
/* Algorithm masks */
-#define LVM_CS_MASK 1
-#define LVM_EQNB_MASK 2
-#define LVM_DBE_MASK 4
-#define LVM_VC_MASK 16
-#define LVM_TE_MASK 32
-#define LVM_PSA_MASK 2048
+#define LVM_CS_MASK 1
+#define LVM_EQNB_MASK 2
+#define LVM_DBE_MASK 4
+#define LVM_VC_MASK 16
+#define LVM_TE_MASK 32
+#define LVM_PSA_MASK 2048
/************************************************************************************/
/* */
@@ -114,105 +115,101 @@
/************************************************************************************/
/* Buffer Management */
-typedef struct
-{
- LVM_FLOAT *pScratch; /* Bundle scratch buffer */
+typedef struct {
+ LVM_FLOAT* pScratch; /* Bundle scratch buffer */
- LVM_INT16 BufferState; /* Buffer status */
- LVM_FLOAT InDelayBuffer[3 * LVM_MAX_CHANNELS * MIN_INTERNAL_BLOCKSIZE];
- LVM_INT16 InDelaySamples; /* Number of samples in the input delay buffer */
- LVM_FLOAT OutDelayBuffer[LVM_MAX_CHANNELS * MIN_INTERNAL_BLOCKSIZE];
- LVM_INT16 OutDelaySamples; /* Number of samples in the output delay buffer, \
- left and right */
- LVM_INT16 SamplesToOutput; /* Samples to write to the output */
+ LVM_INT16 BufferState; /* Buffer status */
+ LVM_FLOAT InDelayBuffer[3 * LVM_MAX_CHANNELS * MIN_INTERNAL_BLOCKSIZE];
+ LVM_INT16 InDelaySamples; /* Number of samples in the input delay buffer */
+ LVM_FLOAT OutDelayBuffer[LVM_MAX_CHANNELS * MIN_INTERNAL_BLOCKSIZE];
+ 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;
/* Filter taps */
-typedef struct
-{
- Biquad_2I_Order1_FLOAT_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
+typedef struct {
+ Biquad_2I_Order1_FLOAT_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
} LVM_TE_Data_t;
/* Coefficients */
-typedef struct
-{
- Biquad_FLOAT_Instance_t TrebleBoost_State; /* State for the treble boost filter */
+typedef struct {
+ Biquad_FLOAT_Instance_t TrebleBoost_State; /* State for the treble boost filter */
} LVM_TE_Coefs_t;
-typedef struct
-{
+typedef struct {
/* Public parameters */
- LVM_ControlParams_t Params; /* Control parameters */
- LVM_InstParams_t InstParams; /* Instance parameters */
+ LVM_ControlParams_t Params; /* Control parameters */
+ LVM_InstParams_t InstParams; /* Instance parameters */
/* Private parameters */
- LVM_UINT16 ControlPending; /* Control flag to indicate update pending */
- LVM_ControlParams_t NewParams; /* New control parameters pending update */
+ LVM_UINT16 ControlPending; /* Control flag to indicate update pending */
+ LVM_ControlParams_t NewParams; /* New control parameters pending update */
/* Buffer control */
- LVM_INT16 InternalBlockSize; /* Maximum internal block size */
- LVM_Buffer_t *pBufferManagement; /* Buffer management variables */
- LVM_INT16 SamplesToProcess; /* Input samples left to process */
- LVM_FLOAT *pInputSamples; /* External input sample pointer */
- LVM_FLOAT *pOutputSamples; /* External output sample pointer */
+ LVM_INT16 InternalBlockSize; /* Maximum internal block size */
+ LVM_Buffer_t* pBufferManagement; /* Buffer management variables */
+ LVM_INT16 SamplesToProcess; /* Input samples left to process */
+ LVM_FLOAT* pInputSamples; /* External input sample pointer */
+ LVM_FLOAT* pOutputSamples; /* External output sample pointer */
/* Configuration number */
- LVM_INT32 ConfigurationNumber;
- LVM_INT32 BlickSizeMultiple;
+ LVM_INT32 ConfigurationNumber;
+ LVM_INT32 BlickSizeMultiple;
/* DC removal */
- Biquad_FLOAT_Instance_t DC_RemovalInstance; /* DC removal filter instance */
+ Biquad_FLOAT_Instance_t DC_RemovalInstance; /* DC removal filter instance */
/* Concert Sound */
- LVCS_Handle_t hCSInstance; /* Concert Sound instance handle */
- LVCS_Instance_t CS_Instance; /* Concert Sound instance */
- LVM_INT16 CS_Active; /* Control flag */
+ LVCS_Handle_t hCSInstance; /* Concert Sound instance handle */
+ LVCS_Instance_t CS_Instance; /* Concert Sound instance */
+ LVM_INT16 CS_Active; /* Control flag */
/* Equalizer */
- LVEQNB_Handle_t hEQNBInstance; /* N-Band Equaliser instance handle */
- LVEQNB_Instance_t EQNB_Instance; /* N-Band Equaliser instance */
- LVM_EQNB_BandDef_t *pEQNB_BandDefs; /* Local storage for new definitions */
- LVM_EQNB_BandDef_t *pEQNB_UserDefs; /* Local storage for the user's definitions */
- LVM_INT16 EQNB_Active; /* Control flag */
+ LVEQNB_Handle_t hEQNBInstance; /* N-Band Equaliser instance handle */
+ LVEQNB_Instance_t EQNB_Instance; /* N-Band Equaliser instance */
+ LVM_EQNB_BandDef_t* pEQNB_BandDefs; /* Local storage for new definitions */
+ LVM_EQNB_BandDef_t* pEQNB_UserDefs; /* Local storage for the user's definitions */
+ LVM_INT16 EQNB_Active; /* Control flag */
/* Dynamic Bass Enhancement */
- LVDBE_Handle_t hDBEInstance; /* Dynamic Bass Enhancement instance handle */
- LVDBE_Instance_t DBE_Instance; /* Dynamic Bass Enhancement instance */
- LVM_INT16 DBE_Active; /* Control flag */
+ LVDBE_Handle_t hDBEInstance; /* Dynamic Bass Enhancement instance handle */
+ LVDBE_Instance_t DBE_Instance; /* Dynamic Bass Enhancement instance */
+ LVM_INT16 DBE_Active; /* Control flag */
/* Volume Control */
- LVMixer3_1St_FLOAT_st VC_Volume; /* Volume scaler */
- LVMixer3_2St_FLOAT_st VC_BalanceMix; /* VC balance mixer */
- LVM_INT16 VC_VolumedB; /* Gain in dB */
- LVM_INT16 VC_Active; /* Control flag */
- LVM_INT16 VC_AVLFixedVolume; /* AVL fixed volume */
+ LVMixer3_1St_FLOAT_st VC_Volume; /* Volume scaler */
+ LVMixer3_2St_FLOAT_st VC_BalanceMix; /* VC balance mixer */
+ LVM_INT16 VC_VolumedB; /* Gain in dB */
+ LVM_INT16 VC_Active; /* Control flag */
+ LVM_INT16 VC_AVLFixedVolume; /* AVL fixed volume */
/* Treble Enhancement */
- LVM_TE_Data_t *pTE_Taps; /* Treble boost Taps */
- LVM_TE_Coefs_t *pTE_State; /* State for the treble boost filter */
- LVM_INT16 TE_Active; /* Control flag */
+ LVM_TE_Data_t* pTE_Taps; /* Treble boost Taps */
+ LVM_TE_Coefs_t* pTE_State; /* State for the treble boost filter */
+ LVM_INT16 TE_Active; /* Control flag */
/* Headroom */
- LVM_HeadroomParams_t NewHeadroomParams; /* New headroom parameters pending update */
- LVM_HeadroomParams_t HeadroomParams; /* Headroom parameters */
- LVM_HeadroomBandDef_t *pHeadroom_BandDefs; /* Local storage for new definitions */
- LVM_HeadroomBandDef_t *pHeadroom_UserDefs; /* Local storage for the user's definitions */
- LVM_UINT16 Headroom; /* Value of the current headroom */
+ LVM_HeadroomParams_t NewHeadroomParams; /* New headroom parameters pending update */
+ LVM_HeadroomParams_t HeadroomParams; /* Headroom parameters */
+ LVM_HeadroomBandDef_t* pHeadroom_BandDefs; /* Local storage for new definitions */
+ LVM_HeadroomBandDef_t* pHeadroom_UserDefs; /* Local storage for the user's definitions */
+ LVM_UINT16 Headroom; /* Value of the current headroom */
/* Spectrum Analyzer */
- pLVPSA_Handle_t hPSAInstance; /* Spectrum Analyzer instance handle */
- LVPSA_InstancePr_t PSA_Instance; /* Spectrum Analyzer instance */
- LVPSA_InitParams_t PSA_InitParams; /* Spectrum Analyzer initialization parameters */
- LVPSA_ControlParams_t PSA_ControlParams; /* Spectrum Analyzer control parameters */
- LVM_INT16 PSA_GainOffset; /* Tone control flag */
- LVM_Callback CallBack;
- LVM_FLOAT *pPSAInput; /* PSA input pointer */
+ pLVPSA_Handle_t hPSAInstance; /* Spectrum Analyzer instance handle */
+ LVPSA_InstancePr_t PSA_Instance; /* Spectrum Analyzer instance */
+ LVPSA_InitParams_t PSA_InitParams; /* Spectrum Analyzer initialization parameters */
+ LVPSA_ControlParams_t PSA_ControlParams; /* Spectrum Analyzer control parameters */
+ LVM_INT16 PSA_GainOffset; /* Tone control flag */
+ LVM_Callback CallBack;
+ LVM_FLOAT* pPSAInput; /* PSA input pointer */
- LVM_INT16 NoSmoothVolume; /* Enable or disable smooth volume changes*/
+ LVM_INT16 NoSmoothVolume; /* Enable or disable smooth volume changes*/
- LVM_INT16 NrChannels;
- LVM_INT32 ChMask;
- void *pScratch; /* Pointer to bundle scratch buffer*/
+ LVM_INT16 NrChannels;
+ LVM_INT32 ChMask;
+ void* pScratch; /* Pointer to bundle scratch buffer*/
} LVM_Instance_t;
@@ -222,32 +219,19 @@
/* */
/************************************************************************************/
-LVM_ReturnStatus_en LVM_ApplyNewSettings(LVM_Handle_t hInstance);
+LVM_ReturnStatus_en LVM_ApplyNewSettings(LVM_Handle_t hInstance);
-void LVM_SetTrebleBoost( LVM_Instance_t *pInstance,
- LVM_ControlParams_t *pParams);
+void LVM_SetTrebleBoost(LVM_Instance_t* pInstance, LVM_ControlParams_t* pParams);
-void LVM_SetVolume( LVM_Instance_t *pInstance,
- LVM_ControlParams_t *pParams);
+void LVM_SetVolume(LVM_Instance_t* pInstance, LVM_ControlParams_t* pParams);
-LVM_INT32 LVM_VCCallBack(void* pBundleHandle,
- void* pGeneralPurpose,
- short CallBackParam);
+LVM_INT32 LVM_VCCallBack(void* pBundleHandle, void* pGeneralPurpose, short CallBackParam);
-void LVM_SetHeadroom( LVM_Instance_t *pInstance,
- LVM_ControlParams_t *pParams);
-void LVM_BufferIn( LVM_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT **pToProcess,
- LVM_FLOAT **pProcessed,
- LVM_UINT16 *pNumSamples);
-void LVM_BufferOut( LVM_Handle_t hInstance,
- LVM_FLOAT *pOutData,
- LVM_UINT16 *pNumSamples);
+void LVM_SetHeadroom(LVM_Instance_t* pInstance, LVM_ControlParams_t* pParams);
+void LVM_BufferIn(LVM_Handle_t hInstance, const LVM_FLOAT* pInData, LVM_FLOAT** pToProcess,
+ LVM_FLOAT** pProcessed, LVM_UINT16* pNumSamples);
+void LVM_BufferOut(LVM_Handle_t hInstance, LVM_FLOAT* pOutData, LVM_UINT16* pNumSamples);
-LVM_INT32 LVM_AlgoCallBack( void *pBundleHandle,
- void *pData,
- LVM_INT16 callbackId);
+LVM_INT32 LVM_AlgoCallBack(void* pBundleHandle, void* pData, LVM_INT16 callbackId);
-#endif /* __LVM_PRIVATE_H__ */
-
+#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 3af2327..c94c469 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.cpp
@@ -51,73 +51,61 @@
/* NOTES: */
/* */
/****************************************************************************************/
-LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples,
- LVM_UINT32 AudioTime)
-{
-
- LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
- LVM_UINT16 SampleCount = NumSamples;
- LVM_FLOAT *pInput = (LVM_FLOAT *)pInData;
- LVM_FLOAT *pToProcess = (LVM_FLOAT *)pInData;
- LVM_FLOAT *pProcessed = pOutData;
- LVM_ReturnStatus_en Status;
- LVM_INT32 NrChannels = pInstance->NrChannels;
- LVM_INT32 ChMask = pInstance->ChMask;
+LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, LVM_UINT16 NumSamples, LVM_UINT32 AudioTime) {
+ LVM_Instance_t* pInstance = (LVM_Instance_t*)hInstance;
+ LVM_UINT16 SampleCount = NumSamples;
+ LVM_FLOAT* pInput = (LVM_FLOAT*)pInData;
+ LVM_FLOAT* pToProcess = (LVM_FLOAT*)pInData;
+ LVM_FLOAT* pProcessed = pOutData;
+ LVM_ReturnStatus_en Status;
+ LVM_INT32 NrChannels = pInstance->NrChannels;
+ LVM_INT32 ChMask = pInstance->ChMask;
#define NrFrames SampleCount // alias for clarity
/*
* Check if the number of samples is zero
*/
- if (NumSamples == 0)
- {
- return(LVM_SUCCESS);
+ if (NumSamples == 0) {
+ return (LVM_SUCCESS);
}
/*
* Check valid points have been given
*/
- if ((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL)) {
return (LVM_NULLADDRESS);
}
/*
* For unmanaged mode only
*/
- if(pInstance->InstParams.BufferMode == LVM_UNMANAGED_BUFFERS)
- {
- /*
+ 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);
+ 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);
+ if ((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0)) {
+ return (LVM_ALIGNMENTERROR);
}
}
/*
* Update new parameters if necessary
*/
- if (pInstance->ControlPending == LVM_TRUE)
- {
+ if (pInstance->ControlPending == LVM_TRUE) {
Status = LVM_ApplyNewSettings(hInstance);
/* Update the local variable NrChannels from pInstance->NrChannels value */
NrChannels = pInstance->NrChannels;
- ChMask = pInstance->ChMask;
+ ChMask = pInstance->ChMask;
- if(Status != LVM_SUCCESS)
- {
+ if (Status != LVM_SUCCESS) {
return Status;
}
}
@@ -125,156 +113,116 @@
/*
* Convert from Mono if necessary
*/
- if (pInstance->Params.SourceFormat == LVM_MONO)
- {
- MonoTo2I_Float(pInData, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)NumSamples); /* Number of input samples */
- pInput = pOutData;
+ if (pInstance->Params.SourceFormat == LVM_MONO) {
+ MonoTo2I_Float(pInData, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16)NumSamples); /* Number of input samples */
+ pInput = pOutData;
pToProcess = pOutData;
NrChannels = 2;
- ChMask = AUDIO_CHANNEL_OUT_STEREO;
+ ChMask = AUDIO_CHANNEL_OUT_STEREO;
}
/*
* Process the data with managed buffers
*/
- while (SampleCount != 0)
- {
+ while (SampleCount != 0) {
/*
* Manage the input buffer and frame processing
*/
- LVM_BufferIn(hInstance,
- pInput,
- &pToProcess,
- &pProcessed,
- &SampleCount);
+ 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)
- {
+ 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);
+ 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_Mc_D16C31_SAT(&pInstance->VC_Volume,
- pToProcess,
- pProcessed,
- (LVM_INT16)(NrFrames),
- NrChannels);
+ if (pInstance->VC_Active != 0) {
+ LVC_MixSoft_Mc_D16C31_SAT(&pInstance->VC_Volume, pToProcess, pProcessed,
+ (LVM_INT16)(NrFrames), NrChannels);
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);
+ 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);
+ 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_Float(pToProcess, /* Source */
- pProcessed, /* Destination */
- (LVM_INT16)(NrChannels * NrFrames)); /* Copy all samples */
+ if (pToProcess != pProcessed) {
+ Copy_Float(pToProcess, /* Source */
+ pProcessed, /* Destination */
+ (LVM_INT16)(NrChannels * NrFrames)); /* Copy all samples */
}
/*
* Apply treble boost if required
*/
- if (pInstance->TE_Active == LVM_TRUE)
- {
+ if (pInstance->TE_Active == LVM_TRUE) {
/*
* Apply the filter
*/
FO_Mc_D16F32C15_LShx_TRC_WRA_01(&pInstance->pTE_State->TrebleBoost_State,
- pProcessed,
- pProcessed,
- (LVM_INT16)NrFrames,
- (LVM_INT16)NrChannels);
-
+ pProcessed, pProcessed, (LVM_INT16)NrFrames,
+ (LVM_INT16)NrChannels);
}
/*
* Volume balance
*/
- LVC_MixSoft_1St_MC_float_SAT(&pInstance->VC_BalanceMix,
- pProcessed,
- pProcessed,
- NrFrames,
- NrChannels,
- ChMask);
+ LVC_MixSoft_1St_MC_float_SAT(&pInstance->VC_BalanceMix, pProcessed, pProcessed,
+ NrFrames, NrChannels, ChMask);
/*
* Perform Parametric Spectum Analysis
*/
if ((pInstance->Params.PSA_Enable == LVM_PSA_ON) &&
- (pInstance->InstParams.PSA_Included == LVM_PSA_ON))
- {
- FromMcToMono_Float(pProcessed,
- pInstance->pPSAInput,
- (LVM_INT16)(NrFrames),
+ (pInstance->InstParams.PSA_Included == LVM_PSA_ON)) {
+ FromMcToMono_Float(pProcessed, pInstance->pPSAInput, (LVM_INT16)(NrFrames),
NrChannels);
- LVPSA_Process(pInstance->hPSAInstance,
- pInstance->pPSAInput,
- (LVM_UINT16)(SampleCount),
- AudioTime);
+ LVPSA_Process(pInstance->hPSAInstance, pInstance->pPSAInput,
+ (LVM_UINT16)(SampleCount), AudioTime);
}
/*
* DC removal
*/
- DC_Mc_D16_TRC_WRA_01(&pInstance->DC_RemovalInstance,
- pProcessed,
- pProcessed,
- (LVM_INT16)NrFrames,
- NrChannels);
+ DC_Mc_D16_TRC_WRA_01(&pInstance->DC_RemovalInstance, pProcessed, pProcessed,
+ (LVM_INT16)NrFrames, NrChannels);
}
/*
* Manage the output buffer
*/
- LVM_BufferOut(hInstance,
- pOutData,
- &SampleCount);
-
+ LVM_BufferOut(hInstance, pOutData, &SampleCount);
}
- return(LVM_SUCCESS);
+ return (LVM_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
index 66392e2..860196b 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.cpp
@@ -30,431 +30,297 @@
/* */
/************************************************************************************/
-FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
+FO_FLOAT_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_Gain2_A1, /* Gain setting 2 */
- HPF_Fs22050_Gain2_A0,
- -HPF_Fs22050_Gain2_B1},
- {HPF_Fs22050_Gain3_A1, /* Gain setting 3 */
- HPF_Fs22050_Gain3_A0,
- -HPF_Fs22050_Gain3_B1},
- {HPF_Fs22050_Gain4_A1, /* Gain setting 4 */
- HPF_Fs22050_Gain4_A0,
- -HPF_Fs22050_Gain4_B1},
- {HPF_Fs22050_Gain5_A1, /* Gain setting 5 */
- HPF_Fs22050_Gain5_A0,
- -HPF_Fs22050_Gain5_B1},
- {HPF_Fs22050_Gain6_A1, /* Gain setting 6 */
- HPF_Fs22050_Gain6_A0,
- -HPF_Fs22050_Gain6_B1},
- {HPF_Fs22050_Gain7_A1, /* Gain setting 7 */
- HPF_Fs22050_Gain7_A0,
- -HPF_Fs22050_Gain7_B1},
- {HPF_Fs22050_Gain8_A1, /* Gain setting 8 */
- HPF_Fs22050_Gain8_A0,
- -HPF_Fs22050_Gain8_B1},
- {HPF_Fs22050_Gain9_A1, /* Gain setting 9 */
- HPF_Fs22050_Gain9_A0,
- -HPF_Fs22050_Gain9_B1},
- {HPF_Fs22050_Gain10_A1, /* Gain setting 10 */
- HPF_Fs22050_Gain10_A0,
- -HPF_Fs22050_Gain10_B1},
- {HPF_Fs22050_Gain11_A1, /* Gain setting 11 */
- HPF_Fs22050_Gain11_A0,
- -HPF_Fs22050_Gain11_B1},
- {HPF_Fs22050_Gain12_A1, /* Gain setting 12 */
- HPF_Fs22050_Gain12_A0,
- -HPF_Fs22050_Gain12_B1},
- {HPF_Fs22050_Gain13_A1, /* Gain setting 13 */
- HPF_Fs22050_Gain13_A0,
- -HPF_Fs22050_Gain13_B1},
- {HPF_Fs22050_Gain14_A1, /* Gain setting 14 */
- HPF_Fs22050_Gain14_A0,
- -HPF_Fs22050_Gain14_B1},
- {HPF_Fs22050_Gain15_A1, /* Gain setting 15 */
- HPF_Fs22050_Gain15_A0,
- -HPF_Fs22050_Gain15_B1},
+ /* 22kHz sampling rate */
+ {HPF_Fs22050_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs22050_Gain1_A0, -HPF_Fs22050_Gain1_B1},
+ {HPF_Fs22050_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs22050_Gain2_A0, -HPF_Fs22050_Gain2_B1},
+ {HPF_Fs22050_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs22050_Gain3_A0, -HPF_Fs22050_Gain3_B1},
+ {HPF_Fs22050_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs22050_Gain4_A0, -HPF_Fs22050_Gain4_B1},
+ {HPF_Fs22050_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs22050_Gain5_A0, -HPF_Fs22050_Gain5_B1},
+ {HPF_Fs22050_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs22050_Gain6_A0, -HPF_Fs22050_Gain6_B1},
+ {HPF_Fs22050_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs22050_Gain7_A0, -HPF_Fs22050_Gain7_B1},
+ {HPF_Fs22050_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs22050_Gain8_A0, -HPF_Fs22050_Gain8_B1},
+ {HPF_Fs22050_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs22050_Gain9_A0, -HPF_Fs22050_Gain9_B1},
+ {HPF_Fs22050_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs22050_Gain10_A0, -HPF_Fs22050_Gain10_B1},
+ {HPF_Fs22050_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs22050_Gain11_A0, -HPF_Fs22050_Gain11_B1},
+ {HPF_Fs22050_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs22050_Gain12_A0, -HPF_Fs22050_Gain12_B1},
+ {HPF_Fs22050_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs22050_Gain13_A0, -HPF_Fs22050_Gain13_B1},
+ {HPF_Fs22050_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs22050_Gain14_A0, -HPF_Fs22050_Gain14_B1},
+ {HPF_Fs22050_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs22050_Gain15_A0, -HPF_Fs22050_Gain15_B1},
- /* 24kHz sampling rate */
- {HPF_Fs24000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs24000_Gain1_A0,
- -HPF_Fs24000_Gain1_B1},
- {HPF_Fs24000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs24000_Gain2_A0,
- -HPF_Fs24000_Gain2_B1},
- {HPF_Fs24000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs24000_Gain3_A0,
- -HPF_Fs24000_Gain3_B1},
- {HPF_Fs24000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs24000_Gain4_A0,
- -HPF_Fs24000_Gain4_B1},
- {HPF_Fs24000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs24000_Gain5_A0,
- -HPF_Fs24000_Gain5_B1},
- {HPF_Fs24000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs24000_Gain6_A0,
- -HPF_Fs24000_Gain6_B1},
- {HPF_Fs24000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs24000_Gain7_A0,
- -HPF_Fs24000_Gain7_B1},
- {HPF_Fs24000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs24000_Gain8_A0,
- -HPF_Fs24000_Gain8_B1},
- {HPF_Fs24000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs24000_Gain9_A0,
- -HPF_Fs24000_Gain9_B1},
- {HPF_Fs24000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs24000_Gain10_A0,
- -HPF_Fs24000_Gain10_B1},
- {HPF_Fs24000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs24000_Gain11_A0,
- -HPF_Fs24000_Gain11_B1},
- {HPF_Fs24000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs24000_Gain12_A0,
- -HPF_Fs24000_Gain12_B1},
- {HPF_Fs24000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs24000_Gain13_A0,
- -HPF_Fs24000_Gain13_B1},
- {HPF_Fs24000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs24000_Gain14_A0,
- -HPF_Fs24000_Gain14_B1},
- {HPF_Fs24000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs24000_Gain15_A0,
- -HPF_Fs24000_Gain15_B1},
+ /* 24kHz sampling rate */
+ {HPF_Fs24000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs24000_Gain1_A0, -HPF_Fs24000_Gain1_B1},
+ {HPF_Fs24000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs24000_Gain2_A0, -HPF_Fs24000_Gain2_B1},
+ {HPF_Fs24000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs24000_Gain3_A0, -HPF_Fs24000_Gain3_B1},
+ {HPF_Fs24000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs24000_Gain4_A0, -HPF_Fs24000_Gain4_B1},
+ {HPF_Fs24000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs24000_Gain5_A0, -HPF_Fs24000_Gain5_B1},
+ {HPF_Fs24000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs24000_Gain6_A0, -HPF_Fs24000_Gain6_B1},
+ {HPF_Fs24000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs24000_Gain7_A0, -HPF_Fs24000_Gain7_B1},
+ {HPF_Fs24000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs24000_Gain8_A0, -HPF_Fs24000_Gain8_B1},
+ {HPF_Fs24000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs24000_Gain9_A0, -HPF_Fs24000_Gain9_B1},
+ {HPF_Fs24000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs24000_Gain10_A0, -HPF_Fs24000_Gain10_B1},
+ {HPF_Fs24000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs24000_Gain11_A0, -HPF_Fs24000_Gain11_B1},
+ {HPF_Fs24000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs24000_Gain12_A0, -HPF_Fs24000_Gain12_B1},
+ {HPF_Fs24000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs24000_Gain13_A0, -HPF_Fs24000_Gain13_B1},
+ {HPF_Fs24000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs24000_Gain14_A0, -HPF_Fs24000_Gain14_B1},
+ {HPF_Fs24000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs24000_Gain15_A0, -HPF_Fs24000_Gain15_B1},
- /* 32kHz sampling rate */
- {HPF_Fs32000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs32000_Gain1_A0,
- -HPF_Fs32000_Gain1_B1},
- {HPF_Fs32000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs32000_Gain2_A0,
- -HPF_Fs32000_Gain2_B1},
- {HPF_Fs32000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs32000_Gain3_A0,
- -HPF_Fs32000_Gain3_B1},
- {HPF_Fs32000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs32000_Gain4_A0,
- -HPF_Fs32000_Gain4_B1},
- {HPF_Fs32000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs32000_Gain5_A0,
- -HPF_Fs32000_Gain5_B1},
- {HPF_Fs32000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs32000_Gain6_A0,
- -HPF_Fs32000_Gain6_B1},
- {HPF_Fs32000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs32000_Gain7_A0,
- -HPF_Fs32000_Gain7_B1},
- {HPF_Fs32000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs32000_Gain8_A0,
- -HPF_Fs32000_Gain8_B1},
- {HPF_Fs32000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs32000_Gain9_A0,
- -HPF_Fs32000_Gain9_B1},
- {HPF_Fs32000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs32000_Gain10_A0,
- -HPF_Fs32000_Gain10_B1},
- {HPF_Fs32000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs32000_Gain11_A0,
- -HPF_Fs32000_Gain11_B1},
- {HPF_Fs32000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs32000_Gain12_A0,
- -HPF_Fs32000_Gain12_B1},
- {HPF_Fs32000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs32000_Gain13_A0,
- -HPF_Fs32000_Gain13_B1},
- {HPF_Fs32000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs32000_Gain14_A0,
- -HPF_Fs32000_Gain14_B1},
- {HPF_Fs32000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs32000_Gain15_A0,
- -HPF_Fs32000_Gain15_B1},
+ /* 32kHz sampling rate */
+ {HPF_Fs32000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs32000_Gain1_A0, -HPF_Fs32000_Gain1_B1},
+ {HPF_Fs32000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs32000_Gain2_A0, -HPF_Fs32000_Gain2_B1},
+ {HPF_Fs32000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs32000_Gain3_A0, -HPF_Fs32000_Gain3_B1},
+ {HPF_Fs32000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs32000_Gain4_A0, -HPF_Fs32000_Gain4_B1},
+ {HPF_Fs32000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs32000_Gain5_A0, -HPF_Fs32000_Gain5_B1},
+ {HPF_Fs32000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs32000_Gain6_A0, -HPF_Fs32000_Gain6_B1},
+ {HPF_Fs32000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs32000_Gain7_A0, -HPF_Fs32000_Gain7_B1},
+ {HPF_Fs32000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs32000_Gain8_A0, -HPF_Fs32000_Gain8_B1},
+ {HPF_Fs32000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs32000_Gain9_A0, -HPF_Fs32000_Gain9_B1},
+ {HPF_Fs32000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs32000_Gain10_A0, -HPF_Fs32000_Gain10_B1},
+ {HPF_Fs32000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs32000_Gain11_A0, -HPF_Fs32000_Gain11_B1},
+ {HPF_Fs32000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs32000_Gain12_A0, -HPF_Fs32000_Gain12_B1},
+ {HPF_Fs32000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs32000_Gain13_A0, -HPF_Fs32000_Gain13_B1},
+ {HPF_Fs32000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs32000_Gain14_A0, -HPF_Fs32000_Gain14_B1},
+ {HPF_Fs32000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs32000_Gain15_A0, -HPF_Fs32000_Gain15_B1},
- /* 44kHz sampling rate */
- {HPF_Fs44100_Gain1_A1, /* Gain setting 1 */
- HPF_Fs44100_Gain1_A0,
- -HPF_Fs44100_Gain1_B1,},
- {HPF_Fs44100_Gain2_A1, /* Gain setting 2 */
- HPF_Fs44100_Gain2_A0,
- -HPF_Fs44100_Gain2_B1},
- {HPF_Fs44100_Gain3_A1, /* Gain setting 3 */
- HPF_Fs44100_Gain3_A0,
- -HPF_Fs44100_Gain3_B1},
- {HPF_Fs44100_Gain4_A1, /* Gain setting 4 */
- HPF_Fs44100_Gain4_A0,
- -HPF_Fs44100_Gain4_B1},
- {HPF_Fs44100_Gain5_A1, /* Gain setting 5 */
- HPF_Fs44100_Gain5_A0,
- -HPF_Fs44100_Gain5_B1},
- {HPF_Fs44100_Gain6_A1, /* Gain setting 6 */
- HPF_Fs44100_Gain6_A0,
- -HPF_Fs44100_Gain6_B1},
- {HPF_Fs44100_Gain7_A1, /* Gain setting 7 */
- HPF_Fs44100_Gain7_A0,
- -HPF_Fs44100_Gain7_B1},
- {HPF_Fs44100_Gain8_A1, /* Gain setting 8 */
- HPF_Fs44100_Gain8_A0,
- -HPF_Fs44100_Gain8_B1},
- {HPF_Fs44100_Gain9_A1, /* Gain setting 9 */
- HPF_Fs44100_Gain9_A0,
- -HPF_Fs44100_Gain9_B1},
- {HPF_Fs44100_Gain10_A1, /* Gain setting 10 */
- HPF_Fs44100_Gain10_A0,
- -HPF_Fs44100_Gain10_B1},
- {HPF_Fs44100_Gain11_A1, /* Gain setting 11 */
- HPF_Fs44100_Gain11_A0,
- -HPF_Fs44100_Gain11_B1},
- {HPF_Fs44100_Gain12_A1, /* Gain setting 12 */
- HPF_Fs44100_Gain12_A0,
- -HPF_Fs44100_Gain12_B1},
- {HPF_Fs44100_Gain13_A1, /* Gain setting 13 */
- HPF_Fs44100_Gain13_A0,
- -HPF_Fs44100_Gain13_B1},
- {HPF_Fs44100_Gain14_A1, /* Gain setting 14 */
- HPF_Fs44100_Gain14_A0,
- -HPF_Fs44100_Gain14_B1},
- {HPF_Fs44100_Gain15_A1, /* Gain setting 15 */
- HPF_Fs44100_Gain15_A0,
- -HPF_Fs44100_Gain15_B1},
+ /* 44kHz sampling rate */
+ {
+ HPF_Fs44100_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs44100_Gain1_A0,
+ -HPF_Fs44100_Gain1_B1,
+ },
+ {HPF_Fs44100_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs44100_Gain2_A0, -HPF_Fs44100_Gain2_B1},
+ {HPF_Fs44100_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs44100_Gain3_A0, -HPF_Fs44100_Gain3_B1},
+ {HPF_Fs44100_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs44100_Gain4_A0, -HPF_Fs44100_Gain4_B1},
+ {HPF_Fs44100_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs44100_Gain5_A0, -HPF_Fs44100_Gain5_B1},
+ {HPF_Fs44100_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs44100_Gain6_A0, -HPF_Fs44100_Gain6_B1},
+ {HPF_Fs44100_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs44100_Gain7_A0, -HPF_Fs44100_Gain7_B1},
+ {HPF_Fs44100_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs44100_Gain8_A0, -HPF_Fs44100_Gain8_B1},
+ {HPF_Fs44100_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs44100_Gain9_A0, -HPF_Fs44100_Gain9_B1},
+ {HPF_Fs44100_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs44100_Gain10_A0, -HPF_Fs44100_Gain10_B1},
+ {HPF_Fs44100_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs44100_Gain11_A0, -HPF_Fs44100_Gain11_B1},
+ {HPF_Fs44100_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs44100_Gain12_A0, -HPF_Fs44100_Gain12_B1},
+ {HPF_Fs44100_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs44100_Gain13_A0, -HPF_Fs44100_Gain13_B1},
+ {HPF_Fs44100_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs44100_Gain14_A0, -HPF_Fs44100_Gain14_B1},
+ {HPF_Fs44100_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs44100_Gain15_A0, -HPF_Fs44100_Gain15_B1},
- /* 48kHz sampling rate */
- {HPF_Fs48000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs48000_Gain1_A0,
- -HPF_Fs48000_Gain1_B1},
- {HPF_Fs48000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs48000_Gain2_A0,
- -HPF_Fs48000_Gain2_B1},
- {HPF_Fs48000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs48000_Gain3_A0,
- -HPF_Fs48000_Gain3_B1},
- {HPF_Fs48000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs48000_Gain4_A0,
- -HPF_Fs48000_Gain4_B1},
- {HPF_Fs48000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs48000_Gain5_A0,
- -HPF_Fs48000_Gain5_B1},
- {HPF_Fs48000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs48000_Gain6_A0,
- -HPF_Fs48000_Gain6_B1},
- {HPF_Fs48000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs48000_Gain7_A0,
- -HPF_Fs48000_Gain7_B1},
- {HPF_Fs48000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs48000_Gain8_A0,
- -HPF_Fs48000_Gain8_B1},
- {HPF_Fs48000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs48000_Gain9_A0,
- -HPF_Fs48000_Gain9_B1},
- {HPF_Fs48000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs48000_Gain10_A0,
- -HPF_Fs48000_Gain10_B1},
- {HPF_Fs48000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs48000_Gain11_A0,
- -HPF_Fs48000_Gain11_B1},
- {HPF_Fs48000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs48000_Gain12_A0,
- -HPF_Fs48000_Gain12_B1},
- {HPF_Fs48000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs48000_Gain13_A0,
- -HPF_Fs48000_Gain13_B1},
- {HPF_Fs48000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs48000_Gain14_A0,
- -HPF_Fs48000_Gain14_B1},
- {HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs48000_Gain15_A0,
- -HPF_Fs48000_Gain15_B1}
- ,
- /* 88kHz Sampling rate */
- {HPF_Fs88200_Gain1_A1, /* Gain Setting 1 */
- HPF_Fs88200_Gain1_A0,
- -HPF_Fs88200_Gain1_B1},
- {HPF_Fs88200_Gain2_A1, /* Gain Setting 2 */
- HPF_Fs88200_Gain2_A0,
- -HPF_Fs88200_Gain2_B1},
- {HPF_Fs88200_Gain3_A1, /* Gain Setting 3 */
- HPF_Fs88200_Gain3_A0,
- -HPF_Fs88200_Gain3_B1},
- {HPF_Fs88200_Gain4_A1, /* Gain Setting 4 */
- HPF_Fs88200_Gain4_A0,
- -HPF_Fs88200_Gain4_B1},
- {HPF_Fs88200_Gain5_A1, /* Gain Setting 5 */
- HPF_Fs88200_Gain5_A0,
- -HPF_Fs88200_Gain5_B1},
- {HPF_Fs88200_Gain6_A1, /* Gain Setting 6 */
- HPF_Fs88200_Gain6_A0,
- -HPF_Fs88200_Gain6_B1},
- {HPF_Fs88200_Gain7_A1, /* Gain Setting 7 */
- HPF_Fs88200_Gain7_A0,
- -HPF_Fs88200_Gain7_B1},
- {HPF_Fs88200_Gain8_A1, /* Gain Setting 8 */
- HPF_Fs88200_Gain8_A0,
- -HPF_Fs88200_Gain8_B1},
- {HPF_Fs88200_Gain9_A1, /* Gain Setting 9 */
- HPF_Fs88200_Gain9_A0,
- -HPF_Fs88200_Gain9_B1},
- {HPF_Fs88200_Gain10_A1, /* Gain Setting 10 */
- HPF_Fs88200_Gain10_A0,
- -HPF_Fs88200_Gain10_B1},
- {HPF_Fs88200_Gain11_A1, /* Gain Setting 11 */
- HPF_Fs88200_Gain11_A0,
- -HPF_Fs88200_Gain11_B1},
- {HPF_Fs88200_Gain12_A1, /* Gain Setting 12 */
- HPF_Fs88200_Gain12_A0,
- -HPF_Fs88200_Gain12_B1},
- {HPF_Fs88200_Gain13_A1, /* Gain Setting 13 */
- HPF_Fs88200_Gain13_A0,
- -HPF_Fs88200_Gain13_B1},
- {HPF_Fs88200_Gain14_A1, /* Gain Setting 14 */
- HPF_Fs88200_Gain14_A0,
- -HPF_Fs88200_Gain14_B1},
- {HPF_Fs88200_Gain15_A1, /* Gain Setting 15 */
- HPF_Fs88200_Gain15_A0,
- -HPF_Fs88200_Gain15_B1},
+ /* 48kHz sampling rate */
+ {HPF_Fs48000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs48000_Gain1_A0, -HPF_Fs48000_Gain1_B1},
+ {HPF_Fs48000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs48000_Gain2_A0, -HPF_Fs48000_Gain2_B1},
+ {HPF_Fs48000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs48000_Gain3_A0, -HPF_Fs48000_Gain3_B1},
+ {HPF_Fs48000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs48000_Gain4_A0, -HPF_Fs48000_Gain4_B1},
+ {HPF_Fs48000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs48000_Gain5_A0, -HPF_Fs48000_Gain5_B1},
+ {HPF_Fs48000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs48000_Gain6_A0, -HPF_Fs48000_Gain6_B1},
+ {HPF_Fs48000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs48000_Gain7_A0, -HPF_Fs48000_Gain7_B1},
+ {HPF_Fs48000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs48000_Gain8_A0, -HPF_Fs48000_Gain8_B1},
+ {HPF_Fs48000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs48000_Gain9_A0, -HPF_Fs48000_Gain9_B1},
+ {HPF_Fs48000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs48000_Gain10_A0, -HPF_Fs48000_Gain10_B1},
+ {HPF_Fs48000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs48000_Gain11_A0, -HPF_Fs48000_Gain11_B1},
+ {HPF_Fs48000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs48000_Gain12_A0, -HPF_Fs48000_Gain12_B1},
+ {HPF_Fs48000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs48000_Gain13_A0, -HPF_Fs48000_Gain13_B1},
+ {HPF_Fs48000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs48000_Gain14_A0, -HPF_Fs48000_Gain14_B1},
+ {HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs48000_Gain15_A0, -HPF_Fs48000_Gain15_B1},
+ /* 88kHz Sampling rate */
+ {HPF_Fs88200_Gain1_A1, /* Gain Setting 1 */
+ HPF_Fs88200_Gain1_A0, -HPF_Fs88200_Gain1_B1},
+ {HPF_Fs88200_Gain2_A1, /* Gain Setting 2 */
+ HPF_Fs88200_Gain2_A0, -HPF_Fs88200_Gain2_B1},
+ {HPF_Fs88200_Gain3_A1, /* Gain Setting 3 */
+ HPF_Fs88200_Gain3_A0, -HPF_Fs88200_Gain3_B1},
+ {HPF_Fs88200_Gain4_A1, /* Gain Setting 4 */
+ HPF_Fs88200_Gain4_A0, -HPF_Fs88200_Gain4_B1},
+ {HPF_Fs88200_Gain5_A1, /* Gain Setting 5 */
+ HPF_Fs88200_Gain5_A0, -HPF_Fs88200_Gain5_B1},
+ {HPF_Fs88200_Gain6_A1, /* Gain Setting 6 */
+ HPF_Fs88200_Gain6_A0, -HPF_Fs88200_Gain6_B1},
+ {HPF_Fs88200_Gain7_A1, /* Gain Setting 7 */
+ HPF_Fs88200_Gain7_A0, -HPF_Fs88200_Gain7_B1},
+ {HPF_Fs88200_Gain8_A1, /* Gain Setting 8 */
+ HPF_Fs88200_Gain8_A0, -HPF_Fs88200_Gain8_B1},
+ {HPF_Fs88200_Gain9_A1, /* Gain Setting 9 */
+ HPF_Fs88200_Gain9_A0, -HPF_Fs88200_Gain9_B1},
+ {HPF_Fs88200_Gain10_A1, /* Gain Setting 10 */
+ HPF_Fs88200_Gain10_A0, -HPF_Fs88200_Gain10_B1},
+ {HPF_Fs88200_Gain11_A1, /* Gain Setting 11 */
+ HPF_Fs88200_Gain11_A0, -HPF_Fs88200_Gain11_B1},
+ {HPF_Fs88200_Gain12_A1, /* Gain Setting 12 */
+ HPF_Fs88200_Gain12_A0, -HPF_Fs88200_Gain12_B1},
+ {HPF_Fs88200_Gain13_A1, /* Gain Setting 13 */
+ HPF_Fs88200_Gain13_A0, -HPF_Fs88200_Gain13_B1},
+ {HPF_Fs88200_Gain14_A1, /* Gain Setting 14 */
+ HPF_Fs88200_Gain14_A0, -HPF_Fs88200_Gain14_B1},
+ {HPF_Fs88200_Gain15_A1, /* Gain Setting 15 */
+ HPF_Fs88200_Gain15_A0, -HPF_Fs88200_Gain15_B1},
- /* 96kHz sampling rate */
- {HPF_Fs96000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs96000_Gain1_A0,
- -HPF_Fs96000_Gain1_B1},
- {HPF_Fs96000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs96000_Gain2_A0,
- -HPF_Fs96000_Gain2_B1},
- {HPF_Fs96000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs96000_Gain3_A0,
- -HPF_Fs96000_Gain3_B1},
- {HPF_Fs96000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs96000_Gain4_A0,
- -HPF_Fs96000_Gain4_B1},
- {HPF_Fs96000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs96000_Gain5_A0,
- -HPF_Fs96000_Gain5_B1},
- {HPF_Fs96000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs96000_Gain6_A0,
- -HPF_Fs96000_Gain6_B1},
- {HPF_Fs96000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs96000_Gain7_A0,
- -HPF_Fs96000_Gain7_B1},
- {HPF_Fs96000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs96000_Gain8_A0,
- -HPF_Fs96000_Gain8_B1},
- {HPF_Fs96000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs96000_Gain9_A0,
- -HPF_Fs96000_Gain9_B1},
- {HPF_Fs96000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs96000_Gain10_A0,
- -HPF_Fs96000_Gain10_B1},
- {HPF_Fs96000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs96000_Gain11_A0,
- -HPF_Fs96000_Gain11_B1},
- {HPF_Fs96000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs96000_Gain12_A0,
- -HPF_Fs96000_Gain12_B1},
- {HPF_Fs96000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs96000_Gain13_A0,
- -HPF_Fs96000_Gain13_B1},
- {HPF_Fs96000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs96000_Gain14_A0,
- -HPF_Fs96000_Gain14_B1},
- {HPF_Fs96000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs96000_Gain15_A0,
- -HPF_Fs96000_Gain15_B1},
+ /* 96kHz sampling rate */
+ {HPF_Fs96000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs96000_Gain1_A0, -HPF_Fs96000_Gain1_B1},
+ {HPF_Fs96000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs96000_Gain2_A0, -HPF_Fs96000_Gain2_B1},
+ {HPF_Fs96000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs96000_Gain3_A0, -HPF_Fs96000_Gain3_B1},
+ {HPF_Fs96000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs96000_Gain4_A0, -HPF_Fs96000_Gain4_B1},
+ {HPF_Fs96000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs96000_Gain5_A0, -HPF_Fs96000_Gain5_B1},
+ {HPF_Fs96000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs96000_Gain6_A0, -HPF_Fs96000_Gain6_B1},
+ {HPF_Fs96000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs96000_Gain7_A0, -HPF_Fs96000_Gain7_B1},
+ {HPF_Fs96000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs96000_Gain8_A0, -HPF_Fs96000_Gain8_B1},
+ {HPF_Fs96000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs96000_Gain9_A0, -HPF_Fs96000_Gain9_B1},
+ {HPF_Fs96000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs96000_Gain10_A0, -HPF_Fs96000_Gain10_B1},
+ {HPF_Fs96000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs96000_Gain11_A0, -HPF_Fs96000_Gain11_B1},
+ {HPF_Fs96000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs96000_Gain12_A0, -HPF_Fs96000_Gain12_B1},
+ {HPF_Fs96000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs96000_Gain13_A0, -HPF_Fs96000_Gain13_B1},
+ {HPF_Fs96000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs96000_Gain14_A0, -HPF_Fs96000_Gain14_B1},
+ {HPF_Fs96000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs96000_Gain15_A0, -HPF_Fs96000_Gain15_B1},
- /* 176kHz Sampling rate */
- {HPF_Fs176400_Gain1_A1, /* Gain Setting 1 */
- HPF_Fs176400_Gain1_A0,
- -HPF_Fs176400_Gain1_B1},
- {HPF_Fs176400_Gain2_A1, /* Gain Setting 2 */
- HPF_Fs176400_Gain2_A0,
- -HPF_Fs176400_Gain2_B1},
- {HPF_Fs176400_Gain3_A1, /* Gain Setting 3 */
- HPF_Fs176400_Gain3_A0,
- -HPF_Fs176400_Gain3_B1},
- {HPF_Fs176400_Gain4_A1, /* Gain Setting 4 */
- HPF_Fs176400_Gain4_A0,
- -HPF_Fs176400_Gain4_B1},
- {HPF_Fs176400_Gain5_A1, /* Gain Setting 5 */
- HPF_Fs176400_Gain5_A0,
- -HPF_Fs176400_Gain5_B1},
- {HPF_Fs176400_Gain6_A1, /* Gain Setting 6 */
- HPF_Fs176400_Gain6_A0,
- -HPF_Fs176400_Gain6_B1},
- {HPF_Fs176400_Gain7_A1, /* Gain Setting 7 */
- HPF_Fs176400_Gain7_A0,
- -HPF_Fs176400_Gain7_B1},
- {HPF_Fs176400_Gain8_A1, /* Gain Setting 8 */
- HPF_Fs176400_Gain8_A0,
- -HPF_Fs176400_Gain8_B1},
- {HPF_Fs176400_Gain9_A1, /* Gain Setting 9 */
- HPF_Fs176400_Gain9_A0,
- -HPF_Fs176400_Gain9_B1},
- {HPF_Fs176400_Gain10_A1, /* Gain Setting 10 */
- HPF_Fs176400_Gain10_A0,
- -HPF_Fs176400_Gain10_B1},
- {HPF_Fs176400_Gain11_A1, /* Gain Setting 11 */
- HPF_Fs176400_Gain11_A0,
- -HPF_Fs176400_Gain11_B1},
- {HPF_Fs176400_Gain12_A1, /* Gain Setting 12 */
- HPF_Fs176400_Gain12_A0,
- -HPF_Fs176400_Gain12_B1},
- {HPF_Fs176400_Gain13_A1, /* Gain Setting 13 */
- HPF_Fs176400_Gain13_A0,
- -HPF_Fs176400_Gain13_B1},
- {HPF_Fs176400_Gain14_A1, /* Gain Setting 14 */
- HPF_Fs176400_Gain14_A0,
- -HPF_Fs176400_Gain14_B1},
- {HPF_Fs176400_Gain15_A1, /* Gain Setting 15 */
- HPF_Fs176400_Gain15_A0,
- -HPF_Fs176400_Gain15_B1},
+ /* 176kHz Sampling rate */
+ {HPF_Fs176400_Gain1_A1, /* Gain Setting 1 */
+ HPF_Fs176400_Gain1_A0, -HPF_Fs176400_Gain1_B1},
+ {HPF_Fs176400_Gain2_A1, /* Gain Setting 2 */
+ HPF_Fs176400_Gain2_A0, -HPF_Fs176400_Gain2_B1},
+ {HPF_Fs176400_Gain3_A1, /* Gain Setting 3 */
+ HPF_Fs176400_Gain3_A0, -HPF_Fs176400_Gain3_B1},
+ {HPF_Fs176400_Gain4_A1, /* Gain Setting 4 */
+ HPF_Fs176400_Gain4_A0, -HPF_Fs176400_Gain4_B1},
+ {HPF_Fs176400_Gain5_A1, /* Gain Setting 5 */
+ HPF_Fs176400_Gain5_A0, -HPF_Fs176400_Gain5_B1},
+ {HPF_Fs176400_Gain6_A1, /* Gain Setting 6 */
+ HPF_Fs176400_Gain6_A0, -HPF_Fs176400_Gain6_B1},
+ {HPF_Fs176400_Gain7_A1, /* Gain Setting 7 */
+ HPF_Fs176400_Gain7_A0, -HPF_Fs176400_Gain7_B1},
+ {HPF_Fs176400_Gain8_A1, /* Gain Setting 8 */
+ HPF_Fs176400_Gain8_A0, -HPF_Fs176400_Gain8_B1},
+ {HPF_Fs176400_Gain9_A1, /* Gain Setting 9 */
+ HPF_Fs176400_Gain9_A0, -HPF_Fs176400_Gain9_B1},
+ {HPF_Fs176400_Gain10_A1, /* Gain Setting 10 */
+ HPF_Fs176400_Gain10_A0, -HPF_Fs176400_Gain10_B1},
+ {HPF_Fs176400_Gain11_A1, /* Gain Setting 11 */
+ HPF_Fs176400_Gain11_A0, -HPF_Fs176400_Gain11_B1},
+ {HPF_Fs176400_Gain12_A1, /* Gain Setting 12 */
+ HPF_Fs176400_Gain12_A0, -HPF_Fs176400_Gain12_B1},
+ {HPF_Fs176400_Gain13_A1, /* Gain Setting 13 */
+ HPF_Fs176400_Gain13_A0, -HPF_Fs176400_Gain13_B1},
+ {HPF_Fs176400_Gain14_A1, /* Gain Setting 14 */
+ HPF_Fs176400_Gain14_A0, -HPF_Fs176400_Gain14_B1},
+ {HPF_Fs176400_Gain15_A1, /* Gain Setting 15 */
+ HPF_Fs176400_Gain15_A0, -HPF_Fs176400_Gain15_B1},
- /* 192kHz sampling rate */
- {HPF_Fs192000_Gain1_A1, /* Gain setting 1 */
- HPF_Fs192000_Gain1_A0,
- -HPF_Fs192000_Gain1_B1},
- {HPF_Fs192000_Gain2_A1, /* Gain setting 2 */
- HPF_Fs192000_Gain2_A0,
- -HPF_Fs192000_Gain2_B1},
- {HPF_Fs192000_Gain3_A1, /* Gain setting 3 */
- HPF_Fs192000_Gain3_A0,
- -HPF_Fs192000_Gain3_B1},
- {HPF_Fs192000_Gain4_A1, /* Gain setting 4 */
- HPF_Fs192000_Gain4_A0,
- -HPF_Fs192000_Gain4_B1},
- {HPF_Fs192000_Gain5_A1, /* Gain setting 5 */
- HPF_Fs192000_Gain5_A0,
- -HPF_Fs192000_Gain5_B1},
- {HPF_Fs192000_Gain6_A1, /* Gain setting 6 */
- HPF_Fs192000_Gain6_A0,
- -HPF_Fs192000_Gain6_B1},
- {HPF_Fs192000_Gain7_A1, /* Gain setting 7 */
- HPF_Fs192000_Gain7_A0,
- -HPF_Fs192000_Gain7_B1},
- {HPF_Fs192000_Gain8_A1, /* Gain setting 8 */
- HPF_Fs192000_Gain8_A0,
- -HPF_Fs192000_Gain8_B1},
- {HPF_Fs192000_Gain9_A1, /* Gain setting 9 */
- HPF_Fs192000_Gain9_A0,
- -HPF_Fs192000_Gain9_B1},
- {HPF_Fs192000_Gain10_A1, /* Gain setting 10 */
- HPF_Fs192000_Gain10_A0,
- -HPF_Fs192000_Gain10_B1},
- {HPF_Fs192000_Gain11_A1, /* Gain setting 11 */
- HPF_Fs192000_Gain11_A0,
- -HPF_Fs192000_Gain11_B1},
- {HPF_Fs192000_Gain12_A1, /* Gain setting 12 */
- HPF_Fs192000_Gain12_A0,
- -HPF_Fs192000_Gain12_B1},
- {HPF_Fs192000_Gain13_A1, /* Gain setting 13 */
- HPF_Fs192000_Gain13_A0,
- -HPF_Fs192000_Gain13_B1},
- {HPF_Fs192000_Gain14_A1, /* Gain setting 14 */
- HPF_Fs192000_Gain14_A0,
- -HPF_Fs192000_Gain14_B1},
- {HPF_Fs192000_Gain15_A1, /* Gain setting 15 */
- HPF_Fs192000_Gain15_A0,
- -HPF_Fs192000_Gain15_B1}
- };
+ /* 192kHz sampling rate */
+ {HPF_Fs192000_Gain1_A1, /* Gain setting 1 */
+ HPF_Fs192000_Gain1_A0, -HPF_Fs192000_Gain1_B1},
+ {HPF_Fs192000_Gain2_A1, /* Gain setting 2 */
+ HPF_Fs192000_Gain2_A0, -HPF_Fs192000_Gain2_B1},
+ {HPF_Fs192000_Gain3_A1, /* Gain setting 3 */
+ HPF_Fs192000_Gain3_A0, -HPF_Fs192000_Gain3_B1},
+ {HPF_Fs192000_Gain4_A1, /* Gain setting 4 */
+ HPF_Fs192000_Gain4_A0, -HPF_Fs192000_Gain4_B1},
+ {HPF_Fs192000_Gain5_A1, /* Gain setting 5 */
+ HPF_Fs192000_Gain5_A0, -HPF_Fs192000_Gain5_B1},
+ {HPF_Fs192000_Gain6_A1, /* Gain setting 6 */
+ HPF_Fs192000_Gain6_A0, -HPF_Fs192000_Gain6_B1},
+ {HPF_Fs192000_Gain7_A1, /* Gain setting 7 */
+ HPF_Fs192000_Gain7_A0, -HPF_Fs192000_Gain7_B1},
+ {HPF_Fs192000_Gain8_A1, /* Gain setting 8 */
+ HPF_Fs192000_Gain8_A0, -HPF_Fs192000_Gain8_B1},
+ {HPF_Fs192000_Gain9_A1, /* Gain setting 9 */
+ HPF_Fs192000_Gain9_A0, -HPF_Fs192000_Gain9_B1},
+ {HPF_Fs192000_Gain10_A1, /* Gain setting 10 */
+ HPF_Fs192000_Gain10_A0, -HPF_Fs192000_Gain10_B1},
+ {HPF_Fs192000_Gain11_A1, /* Gain setting 11 */
+ HPF_Fs192000_Gain11_A0, -HPF_Fs192000_Gain11_B1},
+ {HPF_Fs192000_Gain12_A1, /* Gain setting 12 */
+ HPF_Fs192000_Gain12_A0, -HPF_Fs192000_Gain12_B1},
+ {HPF_Fs192000_Gain13_A1, /* Gain setting 13 */
+ HPF_Fs192000_Gain13_A0, -HPF_Fs192000_Gain13_B1},
+ {HPF_Fs192000_Gain14_A1, /* Gain setting 14 */
+ HPF_Fs192000_Gain14_A0, -HPF_Fs192000_Gain14_B1},
+ {HPF_Fs192000_Gain15_A1, /* Gain setting 15 */
+ HPF_Fs192000_Gain15_A0, -HPF_Fs192000_Gain15_B1}};
/************************************************************************************/
/* */
@@ -463,14 +329,13 @@
/************************************************************************************/
/* dB to linear conversion table */
-const LVM_FLOAT LVM_VolumeTable[] = {
- 1.000f, /* 0dB */
- 0.891f, /* -1dB */
- 0.794f, /* -2dB */
- 0.708f, /* -3dB */
- 0.631f, /* -4dB */
- 0.562f, /* -5dB */
- 0.501f}; /* -6dB */
+const LVM_FLOAT LVM_VolumeTable[] = {1.000f, /* 0dB */
+ 0.891f, /* -1dB */
+ 0.794f, /* -2dB */
+ 0.708f, /* -3dB */
+ 0.631f, /* -4dB */
+ 0.562f, /* -5dB */
+ 0.501f}; /* -6dB */
/************************************************************************************/
/* */
@@ -478,24 +343,16 @@
/* */
/************************************************************************************/
-#define LVM_MIX_TC_Fs8000 32580 /* Floating point value 0.994262695 */
-#define LVM_MIX_TC_Fs11025 32632 /* Floating point value 0.995849609 */
-#define LVM_MIX_TC_Fs12000 32643 /* Floating point value 0.996185303 */
-#define LVM_MIX_TC_Fs16000 32674 /* Floating point value 0.997131348 */
-#define LVM_MIX_TC_Fs22050 32700 /* Floating point value 0.997924805 */
-#define LVM_MIX_TC_Fs24000 32705 /* Floating point value 0.998077393 */
-#define LVM_MIX_TC_Fs32000 32721 /* Floating point value 0.998565674 */
-#define LVM_MIX_TC_Fs44100 32734 /* Floating point value 0.998962402 */
-#define LVM_MIX_TC_Fs48000 32737 /* Floating point value 0.999053955 */
+#define LVM_MIX_TC_Fs8000 32580 /* Floating point value 0.994262695 */
+#define LVM_MIX_TC_Fs11025 32632 /* Floating point value 0.995849609 */
+#define LVM_MIX_TC_Fs12000 32643 /* Floating point value 0.996185303 */
+#define LVM_MIX_TC_Fs16000 32674 /* Floating point value 0.997131348 */
+#define LVM_MIX_TC_Fs22050 32700 /* Floating point value 0.997924805 */
+#define LVM_MIX_TC_Fs24000 32705 /* Floating point value 0.998077393 */
+#define LVM_MIX_TC_Fs32000 32721 /* Floating point value 0.998565674 */
+#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,
- LVM_MIX_TC_Fs12000,
- LVM_MIX_TC_Fs16000,
- LVM_MIX_TC_Fs22050,
- LVM_MIX_TC_Fs24000,
- LVM_MIX_TC_Fs32000,
- LVM_MIX_TC_Fs44100,
- LVM_MIX_TC_Fs48000};
-
+const LVM_INT16 LVM_MixerTCTable[] = {LVM_MIX_TC_Fs8000, LVM_MIX_TC_Fs11025, LVM_MIX_TC_Fs12000,
+ LVM_MIX_TC_Fs16000, LVM_MIX_TC_Fs22050, LVM_MIX_TC_Fs24000,
+ LVM_MIX_TC_Fs32000, LVM_MIX_TC_Fs44100, LVM_MIX_TC_Fs48000};
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
index fc82194..cf2fb5d 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
@@ -33,7 +33,7 @@
/* */
/************************************************************************************/
-extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
+extern FO_FLOAT_LShx_Coefs_t LVM_TrebleBoostCoefs[];
/************************************************************************************/
/* */
@@ -45,4 +45,3 @@
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 6160452..c20b49a 100644
--- a/media/libeffects/lvm/lib/Common/lib/AGC.h
+++ b/media/libeffects/lvm/lib/Common/lib/AGC.h
@@ -31,16 +31,15 @@
/* Types */
/* */
/**********************************************************************************/
-typedef struct
-{
- LVM_FLOAT AGC_Gain; /* The current AGC gain */
- LVM_FLOAT AGC_MaxGain; /* The maximum AGC gain */
- LVM_FLOAT Volume; /* The current volume setting */
- LVM_FLOAT Target; /* The target volume setting */
- LVM_FLOAT AGC_Target; /* AGC target level */
- LVM_FLOAT AGC_Attack; /* AGC attack scaler */
- LVM_FLOAT AGC_Decay; /* AGC decay scaler */
- LVM_FLOAT VolumeTC; /* Volume update time constant */
+typedef struct {
+ LVM_FLOAT AGC_Gain; /* The current AGC gain */
+ LVM_FLOAT AGC_MaxGain; /* The maximum AGC gain */
+ LVM_FLOAT Volume; /* The current volume setting */
+ LVM_FLOAT Target; /* The target volume setting */
+ LVM_FLOAT AGC_Target; /* AGC target level */
+ LVM_FLOAT AGC_Attack; /* AGC attack scaler */
+ LVM_FLOAT AGC_Decay; /* AGC decay scaler */
+ LVM_FLOAT VolumeTC; /* Volume update time constant */
} AGC_MIX_VOL_2St1Mon_FLOAT_t;
@@ -49,17 +48,16 @@
/* Function Prototypes */
/* */
/**********************************************************************************/
-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 */
- LVM_FLOAT *pDst, /* Stereo destination */
- LVM_UINT16 n); /* Number of samples */
-void AGC_MIX_VOL_Mc1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t *pInstance, /* Instance pointer */
- const LVM_FLOAT *pStSrc, /* Source */
- const LVM_FLOAT *pMonoSrc, /* Mono source */
- LVM_FLOAT *pDst, /* Destination */
- LVM_UINT16 NrFrames, /* Number of frames */
- LVM_UINT16 NrChannels); /* Number of channels */
+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 */
+ LVM_FLOAT* pDst, /* Stereo destination */
+ LVM_UINT16 n); /* Number of samples */
+void AGC_MIX_VOL_Mc1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t* pInstance, /* Instance pointer */
+ const LVM_FLOAT* pStSrc, /* Source */
+ const LVM_FLOAT* pMonoSrc, /* Mono source */
+ LVM_FLOAT* pDst, /* Destination */
+ LVM_UINT16 NrFrames, /* Number of frames */
+ LVM_UINT16 NrChannels); /* Number of channels */
-#endif /* __AGC_H__ */
-
+#endif /* __AGC_H__ */
diff --git a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
index b1eefb1..b38e9fb 100644
--- a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
+++ b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h
@@ -22,14 +22,13 @@
/**********************************************************************************
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
-typedef struct
-{
+typedef struct {
/* The memory region created by this structure instance is typecast
* into another structure containing a pointer and an array of filter
* coefficients. In one case this memory region is used for storing
* DC component of channels
*/
- LVM_FLOAT *pStorage;
+ LVM_FLOAT* pStorage;
LVM_FLOAT Storage[LVM_MAX_CHANNELS];
} Biquad_FLOAT_Instance_t;
/**********************************************************************************
@@ -37,45 +36,40 @@
***********************************************************************************/
/*** Biquad coefficients **********************************************************/
-typedef struct
-{
- LVM_FLOAT A2; /* a2 */
- LVM_FLOAT A1; /* a1 */
- LVM_FLOAT A0; /* a0 */
- LVM_FLOAT B2; /* -b2! */
- LVM_FLOAT B1; /* -b1! */
+typedef struct {
+ LVM_FLOAT A2; /* a2 */
+ LVM_FLOAT A1; /* a1 */
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B2; /* -b2! */
+ LVM_FLOAT B1; /* -b1! */
} BQ_FLOAT_Coefs_t;
/*** First order coefficients *****************************************************/
-typedef struct
-{
- LVM_FLOAT A1; /* a1 */
- LVM_FLOAT A0; /* a0 */
- LVM_FLOAT B1; /* -b1! */
+typedef struct {
+ LVM_FLOAT A1; /* a1 */
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B1; /* -b1! */
} FO_FLOAT_Coefs_t;
/*** First order coefficients with Shift*****************************************************/
-typedef struct
-{
- LVM_FLOAT A1; /* a1 */
- LVM_FLOAT A0; /* a0 */
- LVM_FLOAT B1; /* -b1! */
+typedef struct {
+ LVM_FLOAT A1; /* a1 */
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B1; /* -b1! */
} FO_FLOAT_LShx_Coefs_t;
/*** Band pass coefficients *******************************************************/
-typedef struct
-{
- LVM_FLOAT A0; /* a0 */
- LVM_FLOAT B2; /* -b2! */
- LVM_FLOAT B1; /* -b1! */
+typedef struct {
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B2; /* -b2! */
+ LVM_FLOAT B1; /* -b1! */
} BP_FLOAT_Coefs_t;
/*** Peaking coefficients *********************************************************/
-typedef struct
-{
- LVM_FLOAT A0; /* a0 */
- LVM_FLOAT B2; /* -b2! */
- LVM_FLOAT B1; /* -b1! */
- LVM_FLOAT G; /* Gain */
+typedef struct {
+ LVM_FLOAT A0; /* a0 */
+ LVM_FLOAT B2; /* -b2! */
+ LVM_FLOAT B1; /* -b1! */
+ LVM_FLOAT G; /* Gain */
} PK_FLOAT_Coefs_t;
/**********************************************************************************
@@ -83,31 +77,28 @@
***********************************************************************************/
/*** Types used for first order and shelving filter *******************************/
-typedef struct
-{
- LVM_FLOAT Storage[ (1 * 2) ]; /* One channel, two taps of size LVM_INT32 */
+typedef struct {
+ LVM_FLOAT Storage[(1 * 2)]; /* One channel, two taps of size LVM_INT32 */
} Biquad_1I_Order1_FLOAT_Taps_t;
-typedef struct
-{
+typedef struct {
/* LVM_MAX_CHANNELS channels, two taps of size LVM_FLOAT */
- LVM_FLOAT Storage[ (LVM_MAX_CHANNELS * 2) ];
+ LVM_FLOAT Storage[(LVM_MAX_CHANNELS * 2)];
} Biquad_2I_Order1_FLOAT_Taps_t;
/*** Types used for biquad, band pass and peaking filter **************************/
-typedef struct
-{
- LVM_FLOAT Storage[ (1 * 4) ]; /* One channel, four taps of size LVM_FLOAT */
+typedef struct {
+ LVM_FLOAT Storage[(1 * 4)]; /* One channel, four taps of size LVM_FLOAT */
} Biquad_1I_Order2_FLOAT_Taps_t;
-typedef struct
-{
+typedef struct {
/* LVM_MAX_CHANNELS, four taps of size LVM_FLOAT */
- LVM_FLOAT Storage[ (LVM_MAX_CHANNELS * 4) ];
+ LVM_FLOAT Storage[(LVM_MAX_CHANNELS * 4)];
} Biquad_2I_Order2_FLOAT_Taps_t;
-/* 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
+/* The names of the functions are changed to satisfy QAC rules: Name should be Unique within 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
/**********************************************************************************
FUNCTION PROTOTYPES: BIQUAD FILTERS
@@ -115,161 +106,108 @@
/*** 16 bit data path *************************************************************/
-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);
+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);
-void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void BQ_2I_D16F32C15_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
-void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void BQ_2I_D16F32C14_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
-void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void BQ_2I_D16F32C13_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
-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);
+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);
-void BQ_2I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void BQ_2I_D16F16C15_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
-void BQ_2I_D16F16C14_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void BQ_2I_D16F16C14_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
-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);
+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);
-void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void BQ_1I_D16F16C15_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
-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);
+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);
-void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void BQ_1I_D16F32C14_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
/*** 32 bit data path *************************************************************/
-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);
-void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
-void BQ_MC_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
+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);
+void BQ_2I_D32F32C30_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
+void BQ_MC_D32F32C30_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
/**********************************************************************************
FUNCTION PROTOTYPES: FIRST ORDER FILTERS
***********************************************************************************/
/*** 16 bit data path *************************************************************/
-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);
+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);
-void FO_1I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void FO_1I_D16F16C15_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
-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);
+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);
-void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
/*** 32 bit data path *************************************************************/
-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);
-void FO_1I_D32F32C31_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
-void FO_Mc_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
+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);
+void FO_1I_D32F32C31_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
+void FO_Mc_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
/**********************************************************************************
FUNCTION PROTOTYPES: BAND PASS FILTERS
***********************************************************************************/
/*** 16 bit data path *************************************************************/
-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);
-void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
-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);
-void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+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);
+void BP_1I_D16F16C14_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
+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);
+void BP_1I_D16F32C30_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
/*** 32 bit data path *************************************************************/
-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);
-void BP_1I_D32F32C30_TRC_WRA_02( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
+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);
+void BP_1I_D32F32C30_TRC_WRA_02(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
/*** 32 bit data path STEREO ******************************************************/
-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);
-void PK_2I_D32F32C14G11_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples);
-void PK_Mc_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
+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);
+void PK_2I_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples);
+void PK_Mc_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
/**********************************************************************************
FUNCTION PROTOTYPES: DC REMOVAL FILTERS
***********************************************************************************/
/*** 16 bit data path STEREO ******************************************************/
-void DC_Mc_D16_TRC_WRA_01_Init ( Biquad_FLOAT_Instance_t *pInstance);
+void DC_Mc_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance);
-void DC_Mc_D16_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
+void DC_Mc_D16_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
/**********************************************************************************/
-#endif /** _BIQUAD_H_ **/
-
+#endif /** _BIQUAD_H_ **/
diff --git a/media/libeffects/lvm/lib/Common/lib/CompLim.h b/media/libeffects/lvm/lib/Common/lib/CompLim.h
index 5b7cb1b..2fc78b4 100644
--- a/media/libeffects/lvm/lib/Common/lib/CompLim.h
+++ b/media/libeffects/lvm/lib/Common/lib/CompLim.h
@@ -35,21 +35,21 @@
typedef struct /* Compressor state */
{
/* Normaliser */
- LVM_INT16 Norm_Attack; /* Attack time constant of the Normaliser integrator */
- LVM_INT16 Norm_Decay; /* Decay time constant of the Normaliser integrator */
- LVM_INT32 NormInt; /* Normaliser integrator current value */
- LVM_INT16 Shift; /* Shift gain */
- LVM_INT16 Threshold; /* Target threshold */
+ LVM_INT16 Norm_Attack; /* Attack time constant of the Normaliser integrator */
+ LVM_INT16 Norm_Decay; /* Decay time constant of the Normaliser integrator */
+ LVM_INT32 NormInt; /* Normaliser integrator current value */
+ LVM_INT16 Shift; /* Shift gain */
+ LVM_INT16 Threshold; /* Target threshold */
/* Compressor */
- LVM_INT16 Comp_Atten; /* Attenuation applied before soft knee compressor */
- LVM_INT16 Comp_Attack_S; /* Attack time constant of the slow integrator */
- LVM_INT16 Comp_Decay_S; /* Decay time constant of slow the integrator */
- LVM_INT16 Comp_Attack_F; /* Attack time constant of fast the integrator */
- LVM_INT16 Comp_Decay_F; /* Decay time constant of fast the integrator */
- LVM_INT16 SoftClipGain; /* Soft clip gain control */
- LVM_INT32 CompIntSlow; /* Compressor slow integrator current value */
- LVM_INT32 CompIntFast; /* Compressor fast integrator current value */
+ LVM_INT16 Comp_Atten; /* Attenuation applied before soft knee compressor */
+ LVM_INT16 Comp_Attack_S; /* Attack time constant of the slow integrator */
+ LVM_INT16 Comp_Decay_S; /* Decay time constant of slow the integrator */
+ LVM_INT16 Comp_Attack_F; /* Attack time constant of fast the integrator */
+ LVM_INT16 Comp_Decay_F; /* Decay time constant of fast the integrator */
+ LVM_INT16 SoftClipGain; /* Soft clip gain control */
+ LVM_INT32 CompIntSlow; /* Compressor slow integrator current value */
+ LVM_INT32 CompIntFast; /* Compressor fast integrator current value */
} CompLim_Instance_t;
@@ -58,10 +58,7 @@
/* Function Prototypes */
/* */
/************************************************************************************/
-void NonLinComp_Float(LVM_FLOAT Gain,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT32 BlockLength);
+void NonLinComp_Float(LVM_FLOAT Gain, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut,
+ LVM_INT32 BlockLength);
#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 1eeb321..0ba5223 100644
--- a/media/libeffects/lvm/lib/Common/lib/Filter.h
+++ b/media/libeffects/lvm/lib/Common/lib/Filter.h
@@ -27,26 +27,20 @@
/**********************************************************************************
DEFINES
***********************************************************************************/
-#define FILTER_LOSS 32730 /* -0.01dB loss to avoid wrapping due to band ripple */
-#define FILTER_LOSS_FLOAT 0.998849f
+#define FILTER_LOSS 32730 /* -0.01dB loss to avoid wrapping due to band ripple */
+#define FILTER_LOSS_FLOAT 0.998849f
/**********************************************************************************
FUNCTION PROTOTYPES
***********************************************************************************/
-LVM_FLOAT LVM_Power10( LVM_FLOAT X);
+LVM_FLOAT LVM_Power10(LVM_FLOAT X);
-LVM_FLOAT LVM_Polynomial(LVM_UINT16 N,
- LVM_FLOAT *pCoefficients,
- LVM_FLOAT X);
-LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc,
- LVM_Fs_en SampleRate);
+LVM_FLOAT LVM_Polynomial(LVM_UINT16 N, LVM_FLOAT* pCoefficients, LVM_FLOAT X);
+LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc, LVM_Fs_en SampleRate);
-LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
- FO_FLOAT_Coefs_t *pCoeffs);
+LVM_FLOAT LVM_FO_LPF(LVM_FLOAT w, FO_FLOAT_Coefs_t* pCoeffs);
-LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
- FO_FLOAT_Coefs_t *pCoeffs);
+LVM_FLOAT LVM_FO_HPF(LVM_FLOAT w, FO_FLOAT_Coefs_t* pCoeffs);
/**********************************************************************************/
-#endif /** _FILTER_H_ **/
-
+#endif /** _FILTER_H_ **/
diff --git a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
index bae84e7..17699ef 100644
--- a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
+++ b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
@@ -22,11 +22,10 @@
/*######################################################################################*/
/* Type declarations */
/*######################################################################################*/
-typedef struct
-{
- LVM_UINT32 TotalSize; /* Accumulative total memory size */
- uintptr_t pNextMember; /* Pointer to the next instance member to be allocated */
-} INST_ALLOC;
+typedef struct {
+ LVM_UINT32 TotalSize; /* Accumulative total memory size */
+ uintptr_t pNextMember; /* Pointer to the next instance member to be allocated */
+} INST_ALLOC;
/*######################################################################################*/
/* Function prototypes */
@@ -41,7 +40,7 @@
* Remarks :
****************************************************************************************/
-void InstAlloc_Init( INST_ALLOC *pms, void *StartAddr );
+void InstAlloc_Init(INST_ALLOC* pms, void* StartAddr);
/****************************************************************************************
* Name : InstAlloc_AddMember()
@@ -54,7 +53,7 @@
* Remarks :
****************************************************************************************/
-void* InstAlloc_AddMember( INST_ALLOC *pms, LVM_UINT32 Size );
+void* InstAlloc_AddMember(INST_ALLOC* pms, LVM_UINT32 Size);
/****************************************************************************************
* Name : InstAlloc_GetTotal()
@@ -64,19 +63,14 @@
* Remarks :
****************************************************************************************/
-LVM_UINT32 InstAlloc_GetTotal( INST_ALLOC *pms);
+LVM_UINT32 InstAlloc_GetTotal(INST_ALLOC* pms);
-void* InstAlloc_AddMemberAllRet( INST_ALLOC *pms,
- LVM_UINT32 Size[],
- void **ptr);
+void* InstAlloc_AddMemberAllRet(INST_ALLOC* pms, LVM_UINT32 Size[], void** ptr);
-void* InstAlloc_AddMemberAll( INST_ALLOC *pms,
- LVM_UINT32 Size[],
- LVM_MemoryTable_st *pMemoryTable);
+void* InstAlloc_AddMemberAll(INST_ALLOC* pms, LVM_UINT32 Size[], LVM_MemoryTable_st* pMemoryTable);
-void InstAlloc_InitAll( INST_ALLOC *pms,
- LVM_MemoryTable_st *pMemoryTable);
+void InstAlloc_InitAll(INST_ALLOC* pms, LVM_MemoryTable_st* pMemoryTable);
-void InstAlloc_InitAll_NULL( INST_ALLOC *pms);
+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 49f16ad..d3d128a 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Common.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Common.h
@@ -39,12 +39,11 @@
/* */
/****************************************************************************************/
/* Algorithm identification */
-#define ALGORITHM_NONE_ID 0x0000
-#define ALGORITHM_CS_ID 0x0100
-#define ALGORITHM_EQNB_ID 0x0200
-#define ALGORITHM_DBE_ID 0x0300
-#define ALGORITHM_VC_ID 0x0500
-#define ALGORITHM_TE_ID 0x0600
+#define ALGORITHM_NONE_ID 0x0000
+#define ALGORITHM_CS_ID 0x0100
+#define ALGORITHM_EQNB_ID 0x0200
+#define ALGORITHM_DBE_ID 0x0300
+#define ALGORITHM_VC_ID 0x0500
+#define ALGORITHM_TE_ID 0x0600
-#endif /* __LVM_COMMON_H__ */
-
+#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 1a15125..b984745 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
@@ -28,31 +28,36 @@
of overflow is undefined.
***********************************************************************************/
-#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;\
- shiftValue = (ShiftR);\
- MUL32x32INTO32_mask=0x0000FFFF;\
- MUL32x32INTO32_HH= ((LVM_INT32)((LVM_INT16)((A)>>16))*((LVM_INT16)((B)>>16)) );\
- MUL32x32INTO32_HL= ((LVM_INT32)((B)&MUL32x32INTO32_mask)*((LVM_INT16)((A)>>16))) ;\
- MUL32x32INTO32_LH= ((LVM_INT32)((A)&MUL32x32INTO32_mask)*((LVM_INT16)((B)>>16)));\
- MUL32x32INTO32_LL= (LVM_INT32)((A)&MUL32x32INTO32_mask)*(LVM_INT32)((B)&MUL32x32INTO32_mask);\
- MUL32x32INTO32_temp= (LVM_INT32)(MUL32x32INTO32_HL&MUL32x32INTO32_mask)+(LVM_INT32)(MUL32x32INTO32_LH&MUL32x32INTO32_mask)+(LVM_INT32)((MUL32x32INTO32_LL>>16)&MUL32x32INTO32_mask);\
- MUL32x32INTO32_HH= MUL32x32INTO32_HH+(LVM_INT32)(MUL32x32INTO32_HL>>16)+(LVM_INT32)(MUL32x32INTO32_LH>>16)+(LVM_INT32)(MUL32x32INTO32_temp>>16);\
- MUL32x32INTO32_LL=MUL32x32INTO32_LL+(LVM_INT32)(MUL32x32INTO32_HL<<16)+(LVM_INT32)(MUL32x32INTO32_LH<<16);\
- if(shiftValue<32)\
- {\
- MUL32x32INTO32_HH=MUL32x32INTO32_HH<<(32-shiftValue);\
- MUL32x32INTO32_mask=((LVM_INT32)1<<(32-shiftValue))-1;\
- MUL32x32INTO32_LL=(MUL32x32INTO32_LL>>shiftValue)&MUL32x32INTO32_mask;\
- MUL32x32INTO32_temp2=MUL32x32INTO32_HH|MUL32x32INTO32_LL;\
- }\
- else\
- {\
- MUL32x32INTO32_temp2=(LVM_INT32)MUL32x32INTO32_HH>>(shiftValue-32);\
- }\
- (C) = MUL32x32INTO32_temp2;\
- }
+#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; \
+ shiftValue = (ShiftR); \
+ MUL32x32INTO32_mask = 0x0000FFFF; \
+ MUL32x32INTO32_HH = ((LVM_INT32)((LVM_INT16)((A) >> 16)) * ((LVM_INT16)((B) >> 16))); \
+ MUL32x32INTO32_HL = ((LVM_INT32)((B)&MUL32x32INTO32_mask) * ((LVM_INT16)((A) >> 16))); \
+ MUL32x32INTO32_LH = ((LVM_INT32)((A)&MUL32x32INTO32_mask) * ((LVM_INT16)((B) >> 16))); \
+ MUL32x32INTO32_LL = \
+ (LVM_INT32)((A)&MUL32x32INTO32_mask) * (LVM_INT32)((B)&MUL32x32INTO32_mask); \
+ MUL32x32INTO32_temp = (LVM_INT32)(MUL32x32INTO32_HL & MUL32x32INTO32_mask) + \
+ (LVM_INT32)(MUL32x32INTO32_LH & MUL32x32INTO32_mask) + \
+ (LVM_INT32)((MUL32x32INTO32_LL >> 16) & MUL32x32INTO32_mask); \
+ MUL32x32INTO32_HH = MUL32x32INTO32_HH + (LVM_INT32)(MUL32x32INTO32_HL >> 16) + \
+ (LVM_INT32)(MUL32x32INTO32_LH >> 16) + \
+ (LVM_INT32)(MUL32x32INTO32_temp >> 16); \
+ MUL32x32INTO32_LL = MUL32x32INTO32_LL + (LVM_INT32)(MUL32x32INTO32_HL << 16) + \
+ (LVM_INT32)(MUL32x32INTO32_LH << 16); \
+ if (shiftValue < 32) { \
+ MUL32x32INTO32_HH = MUL32x32INTO32_HH << (32 - shiftValue); \
+ MUL32x32INTO32_mask = ((LVM_INT32)1 << (32 - shiftValue)) - 1; \
+ MUL32x32INTO32_LL = (MUL32x32INTO32_LL >> shiftValue) & MUL32x32INTO32_mask; \
+ MUL32x32INTO32_temp2 = MUL32x32INTO32_HH | MUL32x32INTO32_LL; \
+ } else { \
+ MUL32x32INTO32_temp2 = (LVM_INT32)MUL32x32INTO32_HH >> (shiftValue - 32); \
+ } \
+ (C) = MUL32x32INTO32_temp2; \
+ }
/**********************************************************************************
MUL32x16INTO32(A,B,C,ShiftR)
@@ -65,25 +70,24 @@
of overflow is undefined.
***********************************************************************************/
-#define MUL32x16INTO32(A,B,C,ShiftR) \
- {LVM_INT32 MUL32x16INTO32_mask,MUL32x16INTO32_HH,MUL32x16INTO32_LL;\
- LVM_INT32 shiftValue;\
- shiftValue = (ShiftR);\
- MUL32x16INTO32_mask=0x0000FFFF;\
- MUL32x16INTO32_HH= ((LVM_INT32)(B)*((LVM_INT16)((A)>>16)));\
- MUL32x16INTO32_LL= ((LVM_INT32)((A)&MUL32x16INTO32_mask)*(B));\
- if(shiftValue<16)\
- {\
- MUL32x16INTO32_HH=(LVM_INT32)((LVM_UINT32)MUL32x16INTO32_HH<<(16-shiftValue));\
- (C)=MUL32x16INTO32_HH+(LVM_INT32)(MUL32x16INTO32_LL>>shiftValue);\
- }\
- else if(shiftValue<32) {\
- MUL32x16INTO32_HH=(LVM_INT32)(MUL32x16INTO32_HH>>(shiftValue-16));\
- (C)=MUL32x16INTO32_HH+(LVM_INT32)(MUL32x16INTO32_LL>>shiftValue);\
- }\
- else {\
- (C)=MUL32x16INTO32_HH>>(shiftValue-16);}\
- }
+#define MUL32x16INTO32(A, B, C, ShiftR) \
+ { \
+ LVM_INT32 MUL32x16INTO32_mask, MUL32x16INTO32_HH, MUL32x16INTO32_LL; \
+ LVM_INT32 shiftValue; \
+ shiftValue = (ShiftR); \
+ MUL32x16INTO32_mask = 0x0000FFFF; \
+ MUL32x16INTO32_HH = ((LVM_INT32)(B) * ((LVM_INT16)((A) >> 16))); \
+ MUL32x16INTO32_LL = ((LVM_INT32)((A)&MUL32x16INTO32_mask) * (B)); \
+ if (shiftValue < 16) { \
+ MUL32x16INTO32_HH = (LVM_INT32)((LVM_UINT32)MUL32x16INTO32_HH << (16 - shiftValue)); \
+ (C) = MUL32x16INTO32_HH + (LVM_INT32)(MUL32x16INTO32_LL >> shiftValue); \
+ } else if (shiftValue < 32) { \
+ MUL32x16INTO32_HH = (LVM_INT32)(MUL32x16INTO32_HH >> (shiftValue - 16)); \
+ (C) = MUL32x16INTO32_HH + (LVM_INT32)(MUL32x16INTO32_LL >> shiftValue); \
+ } else { \
+ (C) = MUL32x16INTO32_HH >> (shiftValue - 16); \
+ } \
+ }
/**********************************************************************************
ADD2_SAT_32x32(A,B,C)
@@ -91,16 +95,16 @@
A,B and C are 32 bit SIGNED numbers.
***********************************************************************************/
-#define ADD2_SAT_32x32(A,B,C) \
- {(C)=(A)+(B);\
- if ((((C) ^ (A)) & ((C) ^ (B))) >> 31)\
- {\
- if((A)<0)\
- (C)=0x80000000l;\
- else\
- (C)=0x7FFFFFFFl;\
- }\
- }
+#define ADD2_SAT_32x32(A, B, C) \
+ { \
+ (C) = (A) + (B); \
+ if ((((C) ^ (A)) & ((C) ^ (B))) >> 31) { \
+ if ((A) < 0) \
+ (C) = 0x80000000l; \
+ else \
+ (C) = 0x7FFFFFFFl; \
+ } \
+ }
#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 dbf9e6a..75f4785 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
@@ -37,8 +37,7 @@
/* TYPE DEFINITIONS */
/****************************************************************************************/
-typedef struct
-{
+typedef struct {
/*
* The memory area created using this structure is internally
* typecast to LVM_Timer_Instance_Private_t and used.
@@ -51,14 +50,13 @@
} LVM_Timer_Instance_t;
-typedef struct
-{
- LVM_INT32 SamplingRate;
- LVM_INT16 TimeInMs;
- LVM_INT32 CallBackParam;
- void *pCallBackParams;
- void *pCallbackInstance;
- void (*pCallBack)(void*,void*,LVM_INT32);
+typedef struct {
+ LVM_INT32 SamplingRate;
+ LVM_INT16 TimeInMs;
+ LVM_INT32 CallBackParam;
+ void* pCallBackParams;
+ void* pCallbackInstance;
+ void (*pCallBack)(void*, void*, LVM_INT32);
} LVM_Timer_Params_t;
@@ -66,14 +64,12 @@
/* FUNCTION PROTOTYPES */
/****************************************************************************************/
-void LVM_Timer_Init ( LVM_Timer_Instance_t *pInstance,
- LVM_Timer_Params_t *pParams );
+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 );
+void LVM_Timer(LVM_Timer_Instance_t* pInstance, LVM_INT16 BlockSize);
/****************************************************************************************/
/* END OF HEADER */
/****************************************************************************************/
-#endif /* __LVM_TIMER_H__ */
+#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 008d192..fb797be 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
@@ -33,26 +33,27 @@
/* */
/****************************************************************************************/
-#define LVM_NULL 0 /* NULL pointer */
+#define LVM_NULL 0 /* NULL pointer */
-#define LVM_TRUE 1 /* Booleans */
-#define LVM_FALSE 0
+#define LVM_TRUE 1 /* Booleans */
+#define LVM_FALSE 0
-#define LVM_MAXINT_8 127 /* Maximum positive integer size */
-#define LVM_MAXINT_16 32767
-#define LVM_MAXINT_32 2147483647
-#define LVM_MAXENUM 2147483647
+#define LVM_MAXINT_8 127 /* Maximum positive integer size */
+#define LVM_MAXINT_16 32767
+#define LVM_MAXINT_32 2147483647
+#define LVM_MAXENUM 2147483647
-#define LVM_MODULEID_MASK 0xFF00 /* Mask to extract the calling module ID from callbackId */
-#define LVM_EVENTID_MASK 0x00FF /* Mask to extract the callback event from callbackId */
+#define LVM_MODULEID_MASK 0xFF00 /* Mask to extract the calling module ID from callbackId */
+#define LVM_EVENTID_MASK 0x00FF /* Mask to extract the callback event from callbackId */
/* Memory table*/
-#define LVM_MEMREGION_PERSISTENT_SLOW_DATA 0 /* Offset to the instance memory region */
-#define LVM_MEMREGION_PERSISTENT_FAST_DATA 1 /* Offset to the persistent data memory region */
-#define LVM_MEMREGION_PERSISTENT_FAST_COEF 2 /* Offset to the persistent coefficient memory region */
-#define LVM_MEMREGION_TEMPORARY_FAST 3 /* Offset to temporary memory region */
+#define LVM_MEMREGION_PERSISTENT_SLOW_DATA 0 /* Offset to the instance memory region */
+#define LVM_MEMREGION_PERSISTENT_FAST_DATA 1 /* Offset to the persistent data memory region */
+#define LVM_MEMREGION_PERSISTENT_FAST_COEF \
+ 2 /* Offset to the persistent coefficient memory region */
+#define LVM_MEMREGION_TEMPORARY_FAST 3 /* Offset to temporary memory region */
-#define LVM_NR_MEMORY_REGIONS 4 /* Number of memory regions */
+#define LVM_NR_MEMORY_REGIONS 4 /* Number of memory regions */
/****************************************************************************************/
/* */
@@ -60,29 +61,28 @@
/* */
/****************************************************************************************/
-typedef char LVM_CHAR; /* ASCII character */
+typedef char LVM_CHAR; /* ASCII character */
-typedef int8_t LVM_INT8; /* Signed 8-bit word */
-typedef uint8_t LVM_UINT8; /* Unsigned 8-bit word */
+typedef int8_t LVM_INT8; /* Signed 8-bit word */
+typedef uint8_t LVM_UINT8; /* Unsigned 8-bit word */
-typedef int16_t LVM_INT16; /* Signed 16-bit word */
-typedef uint16_t LVM_UINT16; /* Unsigned 16-bit word */
+typedef int16_t LVM_INT16; /* Signed 16-bit word */
+typedef uint16_t LVM_UINT16; /* Unsigned 16-bit word */
-typedef int32_t LVM_INT32; /* Signed 32-bit word */
-typedef uint32_t LVM_UINT32; /* Unsigned 32-bit word */
-typedef int64_t LVM_INT64; /* Signed 64-bit word */
+typedef int32_t LVM_INT32; /* Signed 32-bit word */
+typedef uint32_t LVM_UINT32; /* Unsigned 32-bit word */
+typedef int64_t LVM_INT64; /* Signed 64-bit word */
-#define LVM_MAXFLOAT 1.f
+#define LVM_MAXFLOAT 1.f
-typedef float LVM_FLOAT; /* single precision floating point */
+typedef float LVM_FLOAT; /* single precision floating point */
// Select whether we expose int16_t or float buffers.
-#define EFFECT_BUFFER_FORMAT AUDIO_FORMAT_PCM_FLOAT
-typedef float effect_buffer_t;
+#define EFFECT_BUFFER_FORMAT AUDIO_FORMAT_PCM_FLOAT
+typedef float effect_buffer_t;
-
-#define LVM_MAX_CHANNELS 8 // FCC_8
+#define LVM_MAX_CHANNELS 8 // FCC_8
/****************************************************************************************/
/* */
@@ -91,27 +91,20 @@
/****************************************************************************************/
/* Operating mode */
-typedef enum
-{
- LVM_MODE_OFF = 0,
- LVM_MODE_ON = 1,
- LVM_MODE_DUMMY = LVM_MAXENUM
-} LVM_Mode_en;
+typedef enum { LVM_MODE_OFF = 0, LVM_MODE_ON = 1, LVM_MODE_DUMMY = LVM_MAXENUM } LVM_Mode_en;
/* Format */
-typedef enum
-{
- LVM_STEREO = 0,
- LVM_MONOINSTEREO = 1,
- LVM_MONO = 2,
- LVM_MULTICHANNEL = 3,
- LVM_SOURCE_DUMMY = LVM_MAXENUM
+typedef enum {
+ LVM_STEREO = 0,
+ LVM_MONOINSTEREO = 1,
+ LVM_MONO = 2,
+ LVM_MULTICHANNEL = 3,
+ LVM_SOURCE_DUMMY = LVM_MAXENUM
} LVM_Format_en;
/* LVM sampling rates */
-typedef enum
-{
- LVM_FS_8000 = 0,
+typedef enum {
+ LVM_FS_8000 = 0,
LVM_FS_11025 = 1,
LVM_FS_12000 = 2,
LVM_FS_16000 = 3,
@@ -124,32 +117,29 @@
LVM_FS_96000 = 10,
LVM_FS_176400 = 11,
LVM_FS_192000 = 12,
- LVM_FS_INVALID = LVM_MAXENUM-1,
+ LVM_FS_INVALID = LVM_MAXENUM - 1,
LVM_FS_DUMMY = LVM_MAXENUM
} LVM_Fs_en;
/* Memory Types */
-typedef enum
-{
- LVM_PERSISTENT_SLOW_DATA = LVM_MEMREGION_PERSISTENT_SLOW_DATA,
- LVM_PERSISTENT_FAST_DATA = LVM_MEMREGION_PERSISTENT_FAST_DATA,
- LVM_PERSISTENT_FAST_COEF = LVM_MEMREGION_PERSISTENT_FAST_COEF,
- LVM_TEMPORARY_FAST = LVM_MEMREGION_TEMPORARY_FAST,
- LVM_MEMORYTYPE_DUMMY = LVM_MAXENUM
+typedef enum {
+ LVM_PERSISTENT_SLOW_DATA = LVM_MEMREGION_PERSISTENT_SLOW_DATA,
+ LVM_PERSISTENT_FAST_DATA = LVM_MEMREGION_PERSISTENT_FAST_DATA,
+ LVM_PERSISTENT_FAST_COEF = LVM_MEMREGION_PERSISTENT_FAST_COEF,
+ LVM_TEMPORARY_FAST = LVM_MEMREGION_TEMPORARY_FAST,
+ LVM_MEMORYTYPE_DUMMY = LVM_MAXENUM
} LVM_MemoryTypes_en;
/* Memory region definition */
-typedef struct
-{
- LVM_UINT32 Size; /* Region size in bytes */
- LVM_MemoryTypes_en Type; /* Region type */
- void *pBaseAddress; /* Pointer to the region base address */
+typedef struct {
+ LVM_UINT32 Size; /* Region size in bytes */
+ LVM_MemoryTypes_en Type; /* Region type */
+ 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 */
+typedef struct {
+ LVM_MemoryRegion_st Region[LVM_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVM_MemoryTable_st;
/****************************************************************************************/
@@ -157,9 +147,11 @@
/* Standard Function Prototypes */
/* */
/****************************************************************************************/
-typedef LVM_INT32 (*LVM_Callback)(void *pCallbackData, /* Pointer to the callback data structure */
- 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) */
+typedef LVM_INT32 (*LVM_Callback)(
+ void* pCallbackData, /* Pointer to the callback data structure */
+ 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) */
/****************************************************************************************/
/* */
@@ -167,4 +159,4 @@
/* */
/****************************************************************************************/
-#endif /* LVM_TYPES_H */
+#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 b2e0195..ba605e5 100644
--- a/media/libeffects/lvm/lib/Common/lib/Mixer.h
+++ b/media/libeffects/lvm/lib/Common/lib/Mixer.h
@@ -24,80 +24,62 @@
INSTANCE MEMORY TYPE DEFINITION
***********************************************************************************/
-typedef struct
-{
- LVM_FLOAT Alpha; /* Time constant. Set by calling application. \
- Can be changed at any time */
- LVM_FLOAT Target; /* Target value. Set by calling application. \
- Can be changed at any time */
- LVM_FLOAT 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 */
+typedef struct {
+ LVM_FLOAT Alpha; /* Time constant. Set by calling application. \
+ Can be changed at any time */
+ LVM_FLOAT Target; /* Target value. Set by calling application. \
+ Can be changed at any time */
+ LVM_FLOAT 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_FLOAT_t;
-typedef struct
-{
- LVM_FLOAT Alpha1;
- LVM_FLOAT Target1;
- LVM_FLOAT Current1;
- LVM_INT16 CallbackSet1;
- LVM_INT16 CallbackParam1;
- void *pCallbackHandle1;
- void *pGeneralPurpose1;
+typedef struct {
+ LVM_FLOAT Alpha1;
+ LVM_FLOAT Target1;
+ LVM_FLOAT Current1;
+ LVM_INT16 CallbackSet1;
+ LVM_INT16 CallbackParam1;
+ void* pCallbackHandle1;
+ void* pGeneralPurpose1;
LVM_Callback pCallBack1;
- LVM_FLOAT Alpha2; /* Warning the address of this location is passed as a \
- pointer to Mix_1St_Cll_t in some functions */
- LVM_FLOAT Target2;
- LVM_FLOAT Current2;
- LVM_INT16 CallbackSet2;
- LVM_INT16 CallbackParam2;
- void *pCallbackHandle2;
- void *pGeneralPurpose2;
+ LVM_FLOAT Alpha2; /* Warning the address of this location is passed as a \
+ pointer to Mix_1St_Cll_t in some functions */
+ LVM_FLOAT Target2;
+ LVM_FLOAT Current2;
+ LVM_INT16 CallbackSet2;
+ LVM_INT16 CallbackParam2;
+ void* pCallbackHandle2;
+ void* pGeneralPurpose2;
LVM_Callback pCallBack2;
} Mix_2St_Cll_FLOAT_t;
/*** General functions ************************************************************/
-LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc,
- LVM_UINT32 Fs,
- LVM_UINT16 NumChannels);
+LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc, LVM_UINT32 Fs, LVM_UINT16 NumChannels);
-void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
+void MixSoft_1St_D32C31_WRA(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst,
+ LVM_INT16 n);
-void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst,
- LVM_INT16 n);
+void MixSoft_2St_D32C31_SAT(Mix_2St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 n);
-void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
+void MixInSoft_D32C31_SAT(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst,
+ LVM_INT16 n);
/**********************************************************************************
FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS)
***********************************************************************************/
-void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
+void Core_MixSoft_1St_D32C31_WRA(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n);
+void Core_MixHard_2St_D32C31_SAT(Mix_2St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 n);
+void Core_MixInSoft_D32C31_SAT(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst,
+ LVM_INT16 n);
/**********************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
index ae54419..04b180c 100644
--- a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
@@ -30,7 +30,7 @@
/* Absolute value including the corner case for the extreme negative value */
-LVM_FLOAT Abs_Float(LVM_FLOAT input);
+LVM_FLOAT Abs_Float(LVM_FLOAT input);
/****************************************************************************************
* Name : dB_to_Lin32()
@@ -44,7 +44,6 @@
* (15->01) = decimal part
* Returns : Lin value format 1.16.15
****************************************************************************************/
-LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix);
+LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix);
-#endif /* __SCALARARITHMETIC_H__ */
-
+#endif /* __SCALARARITHMETIC_H__ */
diff --git a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
index cbde91d..66e3e79 100644
--- a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
+++ b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
@@ -24,22 +24,13 @@
VARIOUS FUNCTIONS
***********************************************************************************/
-void LoadConst_Float( const LVM_FLOAT val,
- LVM_FLOAT *dst,
- LVM_INT16 n );
+void LoadConst_Float(const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n);
-void Copy_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n );
-void Copy_Float_Mc_Stereo( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT32 NrChannels);
-void Copy_Float_Stereo_Mc( const LVM_FLOAT *src,
- LVM_FLOAT *StereoOut,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT32 NrChannels);
+void Copy_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n);
+void Copy_Float_Mc_Stereo(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 NrFrames,
+ LVM_INT32 NrChannels);
+void Copy_Float_Stereo_Mc(const LVM_FLOAT* src, LVM_FLOAT* StereoOut, LVM_FLOAT* dst,
+ LVM_INT16 NrFrames, LVM_INT32 NrChannels);
/*********************************************************************************
* note: In Mult3s_16x16() saturation of result is not taken care when *
@@ -49,10 +40,7 @@
* This is the only case which will give wrong result. *
* For more information refer to Vector_Arithmetic.doc in /doc folder *
*********************************************************************************/
-void Mult3s_Float( const LVM_FLOAT *src,
- const LVM_FLOAT val,
- LVM_FLOAT *dst,
- LVM_INT16 n);
+void Mult3s_Float(const LVM_FLOAT* src, const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n);
/*********************************************************************************
* note: In Mult3s_32x16() saturation of result is not taken care when *
@@ -62,85 +50,54 @@
* This is the only extreme condition which is giving unexpected result *
* For more information refer to Vector_Arithmetic.doc in /doc folder *
*********************************************************************************/
-void Mult3s_32x16( const LVM_INT32 *src,
- const LVM_INT16 val,
- LVM_INT32 *dst,
- LVM_INT16 n);
-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 */
-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);
-void Add2_Sat_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n );
-void Mac3s_Sat_Float( const LVM_FLOAT *src,
- const LVM_FLOAT val,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void DelayAllPass_Sat_32x16To32( LVM_INT32 *delay, /* Delay buffer */
- LVM_UINT16 size, /* Delay size */
- LVM_INT16 coeff, /* All pass filter coefficient */
- LVM_UINT16 DelayOffset, /* Simple delay offset */
- LVM_UINT16 *pAllPassOffset, /* All pass filter delay offset */
- LVM_INT32 *dst, /* Source/destination */
- LVM_INT16 n);
+void Mult3s_32x16(const LVM_INT32* src, const LVM_INT16 val, LVM_INT32* dst, LVM_INT16 n);
+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 */
+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);
+void Add2_Sat_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n);
+void Mac3s_Sat_Float(const LVM_FLOAT* src, const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n);
+void DelayAllPass_Sat_32x16To32(LVM_INT32* delay, /* Delay buffer */
+ LVM_UINT16 size, /* Delay size */
+ LVM_INT16 coeff, /* All pass filter coefficient */
+ LVM_UINT16 DelayOffset, /* Simple delay offset */
+ LVM_UINT16* pAllPassOffset, /* All pass filter delay offset */
+ LVM_INT32* dst, /* Source/destination */
+ LVM_INT16 n);
/**********************************************************************************
SHIFT FUNCTIONS
***********************************************************************************/
-void Shift_Sat_Float (const LVM_INT16 val,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
+void Shift_Sat_Float(const LVM_INT16 val, const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n);
/**********************************************************************************
AUDIO FORMAT CONVERSION FUNCTIONS
***********************************************************************************/
-void MonoTo2I_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void From2iToMono_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void FromMcToMono_Float(const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
+void MonoTo2I_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n);
+void From2iToMono_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n);
+void FromMcToMono_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 NrFrames,
LVM_INT16 NrChannels);
-void MSTo2i_Sat_Float( const LVM_FLOAT *srcM,
- const LVM_FLOAT *srcS,
- LVM_FLOAT *dst,
- LVM_INT16 n );
-void From2iToMS_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dstM,
- LVM_FLOAT *dstS,
- LVM_INT16 n );
-void JoinTo2i_Float( const LVM_FLOAT *srcL,
- const LVM_FLOAT *srcR,
- LVM_FLOAT *dst,
- LVM_INT16 n );
+void MSTo2i_Sat_Float(const LVM_FLOAT* srcM, const LVM_FLOAT* srcS, LVM_FLOAT* dst, LVM_INT16 n);
+void From2iToMS_Float(const LVM_FLOAT* src, LVM_FLOAT* dstM, LVM_FLOAT* dstS, LVM_INT16 n);
+void JoinTo2i_Float(const LVM_FLOAT* srcL, const LVM_FLOAT* srcR, LVM_FLOAT* dst, LVM_INT16 n);
/**********************************************************************************
DATA TYPE CONVERSION FUNCTIONS
***********************************************************************************/
-void Int16LShiftToInt32_16x32(const LVM_INT16 *src,
- LVM_INT32 *dst,
- LVM_INT16 n,
- LVM_INT16 shift );
+void Int16LShiftToInt32_16x32(const LVM_INT16* src, LVM_INT32* dst, LVM_INT16 n, LVM_INT16 shift);
-void Int32RShiftToInt16_Sat_32x16(const LVM_INT32 *src,
- LVM_INT16 *dst,
- LVM_INT16 n,
- LVM_INT16 shift );
+void Int32RShiftToInt16_Sat_32x16(const LVM_INT32* src, LVM_INT16* dst, LVM_INT16 n,
+ LVM_INT16 shift);
/**********************************************************************************/
-#endif /* _VECTOR_ARITHMETIC_H_ */
+#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 07fc0d1..ae8cdad 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
@@ -30,10 +30,10 @@
/* */
/****************************************************************************************/
-#define VOL_TC_SHIFT 21 /* As a power of 2 */
-#define DECAY_SHIFT 10 /* As a power of 2 */
-#define VOL_TC_FLOAT 2.0f /* As a power of 2 */
-#define DECAY_FAC_FLOAT 64.0f /* As a power of 2 */
+#define VOL_TC_SHIFT 21 /* As a power of 2 */
+#define DECAY_SHIFT 10 /* As a power of 2 */
+#define VOL_TC_FLOAT 2.0f /* As a power of 2 */
+#define DECAY_FAC_FLOAT 64.0f /* As a power of 2 */
/****************************************************************************************/
/* */
@@ -69,91 +69,83 @@
/* NOTES: */
/* */
/****************************************************************************************/
-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 */
- LVM_FLOAT *pDst, /* Stereo destination */
- LVM_UINT16 NumSamples) /* Number of samples */
+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 */
+ LVM_FLOAT* pDst, /* Stereo destination */
+ LVM_UINT16 NumSamples) /* Number of samples */
{
-
/*
* General variables
*/
- LVM_UINT16 i; /* Sample index */
- LVM_FLOAT Left; /* Left sample */
- LVM_FLOAT Right; /* Right sample */
- LVM_FLOAT Mono; /* Mono sample */
- LVM_FLOAT AbsPeak; /* Absolute peak signal */
- LVM_FLOAT AGC_Mult; /* Short AGC gain */
- LVM_FLOAT Vol_Mult; /* Short volume */
+ LVM_UINT16 i; /* Sample index */
+ LVM_FLOAT Left; /* Left sample */
+ LVM_FLOAT Right; /* Right sample */
+ LVM_FLOAT Mono; /* Mono sample */
+ LVM_FLOAT AbsPeak; /* Absolute peak signal */
+ LVM_FLOAT AGC_Mult; /* Short AGC gain */
+ LVM_FLOAT Vol_Mult; /* Short volume */
/*
* Instance control variables
*/
- LVM_FLOAT AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
- LVM_FLOAT AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
- LVM_FLOAT AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
- LVM_FLOAT AGC_Decay = (pInstance->AGC_Decay * (1 << (DECAY_SHIFT)));/* Decay scaler */
- LVM_FLOAT AGC_Target = pInstance->AGC_Target; /* Get the target level */
- LVM_FLOAT Vol_Current = pInstance->Volume; /* Actual volume setting */
- LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
- LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
+ LVM_FLOAT AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
+ LVM_FLOAT AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
+ LVM_FLOAT AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
+ LVM_FLOAT AGC_Decay = (pInstance->AGC_Decay * (1 << (DECAY_SHIFT))); /* Decay scaler */
+ LVM_FLOAT AGC_Target = pInstance->AGC_Target; /* Get the target level */
+ LVM_FLOAT Vol_Current = pInstance->Volume; /* Actual volume setting */
+ LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
+ LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
/*
* Process on a sample by sample basis
*/
- for (i = 0; i < NumSamples; i++) /* For each sample */
+ for (i = 0; i < NumSamples; i++) /* For each sample */
{
-
/*
* Get the short scalers
*/
- AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the short AGC gain */
- Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the short volume gain */
+ 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
*/
- Left = *pStSrc++; /* Get the left sample */
- Right = *pStSrc++; /* Get the right sample */
- Mono = *pMonoSrc++; /* Get the mono sample */
+ 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
*/
- Left += (Mono * AGC_Mult); /* Mix in the mono signal */
+ Left += (Mono * AGC_Mult); /* Mix in the mono signal */
Right += (Mono * AGC_Mult);
/*
* Apply the volume and write to the output stream
*/
- Left = Left * Vol_Mult;
+ Left = Left * Vol_Mult;
Right = Right * Vol_Mult;
- *pDst++ = Left; /* Save the results */
+ *pDst++ = Left; /* Save the results */
*pDst++ = Right;
/*
* Update the AGC gain
*/
AbsPeak = Abs_Float(Left) > Abs_Float(Right) ? Abs_Float(Left) : Abs_Float(Right);
- if (AbsPeak > AGC_Target)
- {
+ if (AbsPeak > AGC_Target) {
/*
* The signal is too large so decrease the gain
*/
AGC_Gain = AGC_Gain * AGC_Attack;
- }
- else
- {
+ } else {
/*
* The signal is too small so increase the gain
*/
- if (AGC_Gain > AGC_MaxGain)
- {
+ if (AGC_Gain > AGC_MaxGain) {
AGC_Gain -= (AGC_Decay);
- }
- else
- {
+ } else {
AGC_Gain += (AGC_Decay);
}
}
@@ -161,13 +153,13 @@
/*
* Update the gain
*/
- Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
+ Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
}
/*
* Update the parameters
*/
- pInstance->Volume = Vol_Current; /* Actual volume setting */
+ pInstance->Volume = Vol_Current; /* Actual volume setting */
pInstance->AGC_Gain = AGC_Gain;
return;
@@ -208,93 +200,80 @@
/* NOTES: */
/* */
/****************************************************************************************/
-void AGC_MIX_VOL_Mc1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t *pInstance,
- const LVM_FLOAT *pMcSrc,
- const LVM_FLOAT *pMonoSrc,
- LVM_FLOAT *pDst,
- LVM_UINT16 NrFrames,
- LVM_UINT16 NrChannels)
-{
-
+void AGC_MIX_VOL_Mc1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t* pInstance, const LVM_FLOAT* pMcSrc,
+ const LVM_FLOAT* pMonoSrc, LVM_FLOAT* pDst, LVM_UINT16 NrFrames,
+ LVM_UINT16 NrChannels) {
/*
* General variables
*/
- LVM_UINT16 i, jj; /* Sample index */
- LVM_FLOAT SampleVal; /* Sample value */
- LVM_FLOAT Mono; /* Mono sample */
- LVM_FLOAT AbsPeak; /* Absolute peak signal */
- LVM_FLOAT AGC_Mult; /* Short AGC gain */
- LVM_FLOAT Vol_Mult; /* Short volume */
+ LVM_UINT16 i, jj; /* Sample index */
+ LVM_FLOAT SampleVal; /* Sample value */
+ LVM_FLOAT Mono; /* Mono sample */
+ LVM_FLOAT AbsPeak; /* Absolute peak signal */
+ LVM_FLOAT AGC_Mult; /* Short AGC gain */
+ LVM_FLOAT Vol_Mult; /* Short volume */
/*
* Instance control variables
*/
- LVM_FLOAT AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
- LVM_FLOAT AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
- LVM_FLOAT AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
+ LVM_FLOAT AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
+ LVM_FLOAT AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
+ LVM_FLOAT AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
/* Decay scaler */
- LVM_FLOAT AGC_Decay = (pInstance->AGC_Decay * (1 << (DECAY_SHIFT)));
- LVM_FLOAT AGC_Target = pInstance->AGC_Target; /* Get the target level */
- LVM_FLOAT Vol_Current = pInstance->Volume; /* Actual volume setting */
- LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
- LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
+ LVM_FLOAT AGC_Decay = (pInstance->AGC_Decay * (1 << (DECAY_SHIFT)));
+ LVM_FLOAT AGC_Target = pInstance->AGC_Target; /* Get the target level */
+ LVM_FLOAT Vol_Current = pInstance->Volume; /* Actual volume setting */
+ LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */
+ LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */
/*
* Process on a sample by sample basis
*/
- for (i = 0; i < NrFrames; i++) /* For each frame */
+ for (i = 0; i < NrFrames; i++) /* For each frame */
{
-
/*
* Get the scalers
*/
- AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the AGC gain */
- Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the volume gain */
+ AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the AGC gain */
+ Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the volume gain */
AbsPeak = 0.0f;
/*
* Get the input samples
*/
- for (jj = 0; jj < NrChannels; jj++)
- {
- SampleVal = *pMcSrc++; /* Get the sample value of jj Channel*/
- Mono = *pMonoSrc; /* Get the mono sample */
+ for (jj = 0; jj < NrChannels; jj++) {
+ SampleVal = *pMcSrc++; /* Get the sample value of jj Channel*/
+ Mono = *pMonoSrc; /* Get the mono sample */
/*
* Apply the AGC gain to the mono input and mix with the input signal
*/
- SampleVal += (Mono * AGC_Mult); /* Mix in the mono signal */
+ SampleVal += (Mono * AGC_Mult); /* Mix in the mono signal */
/*
* Apply the volume and write to the output stream
*/
- SampleVal = SampleVal * Vol_Mult;
+ SampleVal = SampleVal * Vol_Mult;
- *pDst++ = SampleVal; /* Save the results */
+ *pDst++ = SampleVal; /* Save the results */
/*
* Update the AGC gain
*/
AbsPeak = Abs_Float(SampleVal) > AbsPeak ? Abs_Float(SampleVal) : AbsPeak;
}
- if (AbsPeak > AGC_Target)
- {
+ if (AbsPeak > AGC_Target) {
/*
* The signal is too large so decrease the gain
*/
AGC_Gain = AGC_Gain * AGC_Attack;
- }
- else
- {
+ } else {
/*
* The signal is too small so increase the gain
*/
- if (AGC_Gain > AGC_MaxGain)
- {
+ if (AGC_Gain > AGC_MaxGain) {
AGC_Gain -= (AGC_Decay);
- }
- else
- {
+ } else {
AGC_Gain += (AGC_Decay);
}
}
@@ -302,13 +281,13 @@
/*
* Update the gain
*/
- Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
+ Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT);
}
/*
* Update the parameters
*/
- pInstance->Volume = Vol_Current; /* Actual volume setting */
+ pInstance->Volume = Vol_Current; /* Actual volume setting */
pInstance->AGC_Gain = AGC_Gain;
return;
diff --git a/media/libeffects/lvm/lib/Common/src/Abs_32.cpp b/media/libeffects/lvm/lib/Common/src/Abs_32.cpp
index e013809..3e37d89 100644
--- a/media/libeffects/lvm/lib/Common/src/Abs_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Abs_32.cpp
@@ -19,7 +19,7 @@
/* Include files */
/*######################################################################################*/
-#include "ScalarArithmetic.h"
+#include "ScalarArithmetic.h"
/****************************************************************************************
* Name : Abs_32()
@@ -30,27 +30,20 @@
* Remarks :
****************************************************************************************/
-LVM_INT32 Abs_32(LVM_INT32 input)
-{
- if(input < 0)
- {
- if (input == (LVM_INT32)(0x80000000U))
- {
+LVM_INT32 Abs_32(LVM_INT32 input) {
+ if (input < 0) {
+ if (input == (LVM_INT32)(0x80000000U)) {
/* The corner case, so set to the maximum positive value */
- input=(LVM_INT32) 0x7fffffff;
- }
- else
- {
+ input = (LVM_INT32)0x7fffffff;
+ } else {
/* Negative input, so invert */
input = (LVM_INT32)(-input);
}
}
return input;
}
-LVM_FLOAT Abs_Float(LVM_FLOAT input)
-{
- if(input < 0)
- {
+LVM_FLOAT Abs_Float(LVM_FLOAT input) {
+ if (input < 0) {
/* Negative input, so invert */
input = (LVM_FLOAT)(-input);
}
diff --git a/media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.cpp b/media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.cpp
index 6978fe7..be20521 100644
--- a/media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.cpp
@@ -25,27 +25,18 @@
FUNCTION ADD2_SAT_16X16
***********************************************************************************/
-void Add2_Sat_16x16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n )
-{
+void Add2_Sat_16x16(const LVM_INT16* src, LVM_INT16* dst, LVM_INT16 n) {
LVM_INT32 Temp;
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
- Temp = ((LVM_INT32) *src) + ((LVM_INT32) *dst);
+ for (ii = n; ii != 0; ii--) {
+ Temp = ((LVM_INT32)*src) + ((LVM_INT32)*dst);
src++;
- if (Temp > 0x00007FFF)
- {
+ if (Temp > 0x00007FFF) {
*dst = 0x7FFF;
- }
- else if (Temp < -0x00008000)
- {
- *dst = - 0x8000;
- }
- else
- {
+ } else if (Temp < -0x00008000) {
+ *dst = -0x8000;
+ } else {
*dst = (LVM_INT16)Temp;
}
dst++;
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 a48e668..420f93e 100644
--- a/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.cpp
@@ -25,28 +25,21 @@
FUNCTION ADD2_SAT_32X32
***********************************************************************************/
-void Add2_Sat_32x32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n )
-{
- LVM_INT32 a,b,c;
+void Add2_Sat_32x32(const LVM_INT32* src, LVM_INT32* dst, LVM_INT16 n) {
+ LVM_INT32 a, b, c;
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
- a=*src;
+ for (ii = n; ii != 0; ii--) {
+ a = *src;
src++;
- b=*dst;
- c=a+b;
- if ((((c ^ a) & (c ^ b)) >> 31)!=0) /* overflow / underflow */
+ b = *dst;
+ c = a + b;
+ if ((((c ^ a) & (c ^ b)) >> 31) != 0) /* overflow / underflow */
{
- if(a<0)
- {
- c=0x80000000L;
- }
- else
- {
- c=0x7FFFFFFFL;
+ if (a < 0) {
+ c = 0x80000000L;
+ } else {
+ c = 0x7FFFFFFFL;
}
}
@@ -56,27 +49,18 @@
return;
}
-void Add2_Sat_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n )
-{
+void Add2_Sat_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n) {
LVM_FLOAT Temp;
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
- Temp = ((LVM_FLOAT) *src) + ((LVM_FLOAT) *dst);
+ for (ii = n; ii != 0; ii--) {
+ Temp = ((LVM_FLOAT)*src) + ((LVM_FLOAT)*dst);
src++;
- if (Temp > 1.000000f)
- {
+ if (Temp > 1.000000f) {
*dst = 1.000000f;
- }
- else if (Temp < -1.000000f)
- {
+ } else if (Temp < -1.000000f) {
*dst = -1.000000f;
- }
- else
- {
+ } else {
*dst = Temp;
}
dst++;
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 1a5e07f..198a6a1 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
@@ -32,45 +32,38 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
+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;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+{
+ LVM_FLOAT ynL;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL= (A0 * (x(n)L - x(n-2)L ) )
+ ynL = pBiquadState->coefs[0] * ((*pDataIn) - pBiquadState->pDelays[1]);
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL= (A0 * (x(n)L - x(n-2)L ) )
- ynL = pBiquadState->coefs[0] * ((*pDataIn)-pBiquadState->pDelays[1]);
+ // ynL+= ((-B2 * y(n-2)L ) )
+ ynL += pBiquadState->coefs[1] * pBiquadState->pDelays[3];
- // ynL+= ((-B2 * y(n-2)L ) )
- ynL += pBiquadState->coefs[1] * pBiquadState->pDelays[3];
+ // ynL+= ((-B1 * y(n-1)L ) )
+ ynL += pBiquadState->coefs[2] * pBiquadState->pDelays[2];
- // ynL+= ((-B1 * y(n-1)L ) )
- ynL += pBiquadState->coefs[2] * pBiquadState->pDelays[2];
+ /**************************************************************************
+ 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
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- /**************************************************************************
- 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
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++=ynL; // Write Left output
-
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = ynL; // Write Left output
}
-
+}
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 60b6c16..6d36302 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
@@ -37,12 +37,11 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+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) {
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
pBiquadState->coefs[0] = pCoef->A0;
pBiquadState->coefs[1] = pCoef->B2;
@@ -50,4 +49,3 @@
}
/*-------------------------------------------------------------------------*/
/* 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 8a000b6..a41c855 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
@@ -19,19 +19,16 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
-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 ;
+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 /*_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 c844d03..d4d4eb1 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
@@ -32,22 +32,18 @@
pBiquadState->pDelays[2] is y(n-1)L in Q16 format
pBiquadState->pDelays[3] is y(n-2)L in Q16 format
***************************************************************************/
-void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
-{
- LVM_FLOAT ynL,templ;
+void BP_1I_D16F32C30_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, templ;
LVM_INT16 ii;
PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
/**************************************************************************
PROCESSING OF THE LEFT CHANNEL
***************************************************************************/
// ynL= (A0 * (x(n)L - x(n-2)L ))
- templ = (LVM_FLOAT) *pDataIn - pBiquadState->pDelays[1];
+ templ = (LVM_FLOAT)*pDataIn - pBiquadState->pDelays[1];
ynL = pBiquadState->coefs[0] * templ;
// ynL+= ((-B2 * y(n-2)L ) )
@@ -61,14 +57,14 @@
/**************************************************************************
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
+ 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++ = (ynL); // Write Left output
- }
+ *pDataOut++ = (ynL); // Write Left output
+ }
}
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 eb15032..d322a8e 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
@@ -47,17 +47,15 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays =(LVM_FLOAT *) pTaps;
+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) {
+ 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;
+ pBiquadState->coefs[0] = pCoef->A0;
+ pBiquadState->coefs[1] = pCoef->B2;
+ pBiquadState->coefs[2] = pCoef->B1;
}
/*-------------------------------------------------------------------------*/
/* 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 6d754e2..0603256 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
@@ -19,17 +19,15 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
-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 ;
+typedef Filter_State* PFilter_State;
+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 /*_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 d0ba206..0670334 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
@@ -32,46 +32,39 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,templ;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void BP_1I_D32F32C30_TRC_WRA_02(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, templ;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL= (A0 * (x(n)L - x(n-2)L ) )
+ templ = (*pDataIn) - pBiquadState->pDelays[1];
+ ynL = pBiquadState->coefs[0] * templ;
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL= (A0 * (x(n)L - x(n-2)L ) )
- templ = (*pDataIn) - pBiquadState->pDelays[1];
- ynL = pBiquadState->coefs[0] * templ;
+ // ynL+= ((-B2 * y(n-2)L ) )
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[3];
+ ynL += templ;
- // ynL+= ((-B2 * y(n-2)L ) )
- templ = pBiquadState->coefs[1] * pBiquadState->pDelays[3];
- ynL += templ;
+ // ynL+= ((-B1 * y(n-1)L ) )
+ templ = pBiquadState->coefs[2] * pBiquadState->pDelays[2];
+ ynL += templ;
- // ynL+= ((-B1 * y(n-1)L ) )
- templ = pBiquadState->coefs[2] * pBiquadState->pDelays[2];
- 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
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- /**************************************************************************
- 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
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = ynL; // Write Left output in Q0
-
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = ynL; // Write Left output in Q0
}
+}
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 6f7d0b5..146cc63 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,12 +37,11 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays =(LVM_FLOAT *) pTaps;
+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) {
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
pBiquadState->coefs[0] = pCoef->A0;
@@ -52,4 +51,3 @@
}
/*-------------------------------------------------------------------------*/
/* 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 9f1c66a..ea83c0b 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
@@ -19,18 +19,16 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
-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 ;
+typedef Filter_State* PFilter_State;
+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 /*_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 9aecc40..a46b1ef 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,49 +32,42 @@
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
***************************************************************************/
-void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void BQ_1I_D16F16C15_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A2 * x(n-2)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[1];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 * x(n-2)L
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[1];
+ // ynL+=A1 * x(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
- // ynL+=A1 * x(n-1)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
- // ynL+=A0 * x(n)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+ // ynL+= (-B2 * y(n-2)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[3];
- // ynL+= (-B2 * y(n-2)L )
- ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[3];
+ // ynL+= (-B1 * y(n-1)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[2];
- // ynL+= (-B1 * y(n-1)L )
- ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[2];
+ /**************************************************************************
+ 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
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- /**************************************************************************
- 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
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
-
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
}
+}
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 f0b5d06..e8bfcd8 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,13 +37,12 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
+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) {
LVM_FLOAT temp;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *) pTaps ;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
temp = pCoef->A2;
pBiquadState->coefs[0] = temp;
temp = pCoef->A1;
@@ -57,4 +56,3 @@
}
/*-------------------------------------------------------------------------*/
/* 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 fad345d..ac2819e 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
@@ -19,19 +19,17 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
-typedef struct _Filter_State_FLOAT
-{
- LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+typedef struct _Filter_State_FLOAT {
+ LVM_FLOAT* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
-}Filter_State_FLOAT;
-typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+} Filter_State_FLOAT;
+typedef Filter_State_FLOAT* PFilter_State_FLOAT;
#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 043bc5f..c60dcf8 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,48 +32,42 @@
pBiquadState->pDelays[2] is y(n-1)L in Q16 format
pBiquadState->pDelays[3] is y(n-2)L in Q16 format
***************************************************************************/
-void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void BQ_1I_D16F32C14_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A2 * x(n-2)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[1];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 * x(n-2)L
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[1];
+ // ynL+=A1 * x(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
- // ynL+=A1 * x(n-1)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
- // ynL+=A0 * x(n)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+ // ynL+= ( (-B2 * y(n-2)L )
+ ynL += pBiquadState->pDelays[3] * pBiquadState->coefs[3];
- // ynL+= ( (-B2 * y(n-2)L )
- ynL += pBiquadState->pDelays[3] * pBiquadState->coefs[3];
+ // ynL+= -B1 * y(n-1)L
+ ynL += pBiquadState->pDelays[2] * pBiquadState->coefs[4];
- // ynL+= -B1 * y(n-1)L
- ynL += pBiquadState->pDelays[2] * pBiquadState->coefs[4];
+ /**************************************************************************
+ 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
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- /**************************************************************************
- 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
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (LVM_FLOAT)(ynL); // Write Left output
-
- }
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)(ynL); // Write Left output
}
+}
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 6a61d9a..af0efc8 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
@@ -19,19 +19,17 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
-typedef struct _Filter_State_FLOAT
-{
- LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+typedef struct _Filter_State_FLOAT {
+ LVM_FLOAT* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
-}Filter_State_FLOAT;
-typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+} Filter_State_FLOAT;
+typedef Filter_State_FLOAT* PFilter_State_FLOAT;
#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 2b80691..ecf44ca 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
@@ -37,13 +37,12 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
+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) {
LVM_FLOAT temp;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *)pTaps;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
temp = pCoef->A2;
pBiquadState->coefs[0] = temp;
@@ -58,4 +57,3 @@
}
/*-------------------------------------------------------------------------*/
/* 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 51cd918..d047e91 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
@@ -36,72 +36,65 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-void BQ_2I_D16F16C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void BQ_2I_D16F16C14_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A2 * x(n-2)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 * x(n-2)L
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+ // ynL+=A1 * x(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
- // ynL+=A1 * x(n-1)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
- // ynL+=A0 * x(n)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+ // ynL+= ( -B2 * y(n-2)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[6];
- // ynL+= ( -B2 * y(n-2)L )
- ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[6];
+ // ynL+=( -B1 * y(n-1)L )
+ ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[4];
- // ynL+=( -B1 * y(n-1)L )
- ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[4];
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ // ynR=A2 * x(n-2)R
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- // ynR=A2 * x(n-2)R
- ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+ // ynR+=A1 * x(n-1)R
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
- // ynR+=A1 * x(n-1)R
- ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+ // ynR+=A0 * x(n)R
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn + 1));
- // ynR+=A0 * x(n)R
- ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+ // ynR+= ( -B2 * y(n-2)R )
+ ynR += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[7];
- // ynR+= ( -B2 * y(n-2)R )
- ynR += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[7];
+ // ynR+=( -B1 * y(n-1)R )
+ ynR += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[5];
- // ynR+=( -B1 * y(n-1)R )
- ynR += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[5];
+ /**************************************************************************
+ 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
+ pBiquadState->pDelays[4] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+ pBiquadState->pDelays[1] = (*pDataIn++); // Update x(n-1)R
- /**************************************************************************
- 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
- pBiquadState->pDelays[4] = ynL; // Update y(n-1)L
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- pBiquadState->pDelays[1] = (*pDataIn++); // Update x(n-1)R
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
- *pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
-
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
+ *pDataOut++ = (LVM_FLOAT)ynR; // Write Right output
}
+}
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 8f74749..399b5ec 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
@@ -36,72 +36,65 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-void BQ_2I_D16F16C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void BQ_2I_D16F16C15_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A2 * x(n-2)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A2 * x(n-2)L
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+ // ynL+=A1 * x(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
- // ynL+=A1 * x(n-1)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
- // ynL+=A0 * x(n)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+ // ynL+= ( -B2 * y(n-2)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[6];
- // ynL+= ( -B2 * y(n-2)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[6];
+ // ynL+=( -B1 * y(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[4];
- // ynL+=( -B1 * y(n-1)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[4];
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ // ynR=A2 * x(n-2)R
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- // ynR=A2 * x(n-2)R
- ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+ // ynR+=A1 * x(n-1)R
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
- // ynR+=A1 * x(n-1)R
- ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+ // ynR+=A0 * x(n)R
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn + 1));
- // ynR+=A0 * x(n)R
- ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+ // ynR+= ( -B2 * y(n-2)R )
+ ynR += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[7];
- // ynR+= ( -B2 * y(n-2)R )
- ynR += (LVM_FLOAT)pBiquadState->coefs[3] * pBiquadState->pDelays[7];
+ // ynR+=( -B1 * y(n-1)R )
+ ynR += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[5];
- // ynR+=( -B1 * y(n-1)R )
- ynR += (LVM_FLOAT)pBiquadState->coefs[4] * pBiquadState->pDelays[5];
+ /**************************************************************************
+ 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
+ pBiquadState->pDelays[4] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+ pBiquadState->pDelays[1] = (*pDataIn++); // Update x(n-1)R
- /**************************************************************************
- 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
- pBiquadState->pDelays[4] = ynL; // Update y(n-1)L
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- pBiquadState->pDelays[1] = (*pDataIn++); // Update x(n-1)R
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
- *pDataOut++ = (LVM_FLOAT)ynR; // Write Right ouput
-
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
+ *pDataOut++ = (LVM_FLOAT)ynR; // Write Right output
}
+}
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 987cbcf..e0cd934 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
@@ -37,13 +37,12 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
+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) {
LVM_FLOAT temp;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *) pTaps ;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
temp = pCoef->A2;
pBiquadState->coefs[0] = temp;
@@ -58,4 +57,3 @@
}
/*-------------------------------------------------------------------------*/
/* 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 5a9a0e9..94cc794 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
@@ -20,20 +20,18 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
-typedef struct _Filter_State_FLOAT
-{
- LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+typedef struct _Filter_State_FLOAT {
+ LVM_FLOAT* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
-}Filter_State_FLOAT;
-typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+} Filter_State_FLOAT;
+typedef Filter_State_FLOAT* PFilter_State_FLOAT;
#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 331c97f..3b7eb5e 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
@@ -36,74 +36,69 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
-void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void BQ_2I_D16F32C13_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL=A2 * x(n-2)L */
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 * x(n-2)L */
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+ /* ynL+=A1* x(n-1)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
- /* ynL+=A1* x(n-1)L */
- ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ /* ynL+=A0* x(n)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
- /* ynL+=A0* x(n)L */
- ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+ /* ynL+=-B2*y(n-2)L */
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
- /* 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];
- /* ynL+=-B1*y(n-1)L */
- ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR=A2 * x(n-2)R */
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 * x(n-2)R */
- ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+ /* ynR+=A1* x(n-1)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
- /* ynR+=A1* x(n-1)R */
- ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+ /* ynR+=A0* x(n)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn + 1));
- /* ynR+=A0* x(n)R */
- ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+ /* ynR+=-B2 * y(n-2)R */
+ ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
- /* ynR+=-B2 * y(n-2)R */
- ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
+ /* ynR+=-B1 * y(n-1)R */
+ ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
- /* ynR+=-B1 * y(n-1)R */
- ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
+ /**************************************************************************
+ 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 */
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
- /**************************************************************************
- 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 */
- pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
- pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
- pDataIn++;
- pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
- pDataOut++;
- *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput */
- pDataOut++;
- }
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right output */
+ pDataOut++;
}
+}
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 3a396df..8c43430 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,75 +36,69 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
-void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void BQ_2I_D16F32C14_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL=A2 * x(n-2)L */
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 * x(n-2)L */
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+ /* ynL+=A1 * x(n-1)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
- /* ynL+=A1 * x(n-1)L */
- ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ /* ynL+=A0 * x(n)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
- /* ynL+=A0 * x(n)L */
- ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+ /* ynL+= ( (-B2 * y(n-2)L ))*/
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
- /* 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];
- /* ynL+=( (-B1 * y(n-1)L )) */
- ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR=A2 * x(n-2)R */
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 * x(n-2)R */
- ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+ /* ynR+=A1 * x(n-1)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
- /* ynR+=A1 * x(n-1)R */
- ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+ /* ynR+=A0 * x(n)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn + 1));
- /* ynR+=A0 * x(n)R */
- ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+ /* ynR+= ( (-B2 * y(n-2)R ))*/
+ ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
- /* ynR+= ( (-B2 * y(n-2)R ))*/
- ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
+ /* ynR+=( (-B1 * y(n-1)R )) */
+ ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
- /* ynR+=( (-B1 * y(n-1)R )) */
- ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
+ /**************************************************************************
+ 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 */
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
- /**************************************************************************
- 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 */
- pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
- pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
- pDataIn++;
- pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
- pDataOut++;
- *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput */
- pDataOut++;
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right output */
+ pDataOut++;
}
+}
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 1cbff1a..84fbadf 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,75 +36,69 @@
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
***************************************************************************/
-void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void BQ_2I_D16F32C15_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, ynR;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL=A2 * x(n-2)L */
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL=A2 * x(n-2)L */
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+ /* ynL+=A1 * x(n-1)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
- /* ynL+=A1 * x(n-1)L */
- ynL += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ /* ynL+=A0 * x(n)L */
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
- /* ynL+=A0 * x(n)L */
- ynL += (LVM_FLOAT)pBiquadState->coefs[2] * (*pDataIn);
+ /* ynL+= ( (-B2 * y(n-2)L ) */
+ ynL += pBiquadState->pDelays[6] * pBiquadState->coefs[3];
- /* 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];
- /* ynL+=( (-B1 * y(n-1)L )) */
- ynL += pBiquadState->pDelays[4] * pBiquadState->coefs[4];
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR=A2 * x(n-2)R */
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR=A2 * x(n-2)R */
- ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+ /* ynR+=A1 * x(n-1)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
- /* ynR+=A1 * x(n-1)R */
- ynR += (LVM_FLOAT)pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+ /* ynR+=A0 * x(n)R */
+ ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn + 1));
- /* ynR+=A0 * x(n)R */
- ynR += (LVM_FLOAT)pBiquadState->coefs[2] * (*(pDataIn+1));
+ /* ynR+= ( (-B2 * y(n-2)R ) */
+ ynR += pBiquadState->pDelays[7] * pBiquadState->coefs[3];
- /* 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];
- /* ynR+=( (-B1 * y(n-1)R )) in Q15 */
- ynR += pBiquadState->pDelays[5] * pBiquadState->coefs[4];
+ /**************************************************************************
+ 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*/
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L*/
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L*/
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R*/
+ pDataIn++;
- /**************************************************************************
- 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*/
- pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L*/
- pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L*/
- pDataIn++;
- pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R*/
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output*/
- pDataOut++;
- *pDataOut = (LVM_FLOAT)(ynR); /* Write Right ouput*/
- pDataOut++;
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)(ynL); /* Write Left output*/
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)(ynR); /* Write Right output*/
+ pDataOut++;
}
+}
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 314388a..1cc7618 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
@@ -20,20 +20,18 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
-typedef struct _Filter_State_FLOAT
-{
- LVM_FLOAT * pDelays; /* pointer to the delayed samples \
- (data of 32 bits) */
- LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
-}Filter_State_FLOAT;
-typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+typedef struct _Filter_State_FLOAT {
+ LVM_FLOAT* pDelays; /* pointer to the delayed samples \
+ (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+} Filter_State_FLOAT;
+typedef Filter_State_FLOAT* PFilter_State_FLOAT;
#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 058541a..6817d9f 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
@@ -36,13 +36,12 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
+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) {
LVM_FLOAT temp;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
temp = pCoef->A2;
pBiquadState->coefs[0] = temp;
temp = pCoef->A1;
@@ -56,4 +55,3 @@
}
/*-------------------------------------------------------------------------*/
/* 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 189fb9e..4eeaaa8 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,89 +36,83 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
+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;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+{
+ LVM_FLOAT ynL, ynR, templ, tempd;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL= ( A2 * x(n-2)L ) */
+ ynL = pBiquadState->coefs[0] * pBiquadState->pDelays[2];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL= ( A2 * x(n-2)L ) */
- ynL = pBiquadState->coefs[0] * pBiquadState->pDelays[2];
+ /* ynL+= ( A1 * x(n-1)L )*/
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[0];
+ ynL += templ;
- /* ynL+= ( A1 * x(n-1)L )*/
- templ = pBiquadState->coefs[1] * pBiquadState->pDelays[0];
- ynL += templ;
+ /* ynL+= ( A0 * x(n)L ) */
+ templ = pBiquadState->coefs[2] * (*pDataIn);
+ ynL += templ;
- /* ynL+= ( A0 * x(n)L ) */
- templ = pBiquadState->coefs[2] * (*pDataIn);
- ynL += templ;
+ /* ynL+= (-B2 * y(n-2)L ) */
+ templ = pBiquadState->coefs[3] * pBiquadState->pDelays[6];
+ ynL += templ;
- /* ynL+= (-B2 * y(n-2)L ) */
- templ = pBiquadState->coefs[3] * pBiquadState->pDelays[6];
- ynL += templ;
+ /* ynL+= (-B1 * y(n-1)L )*/
+ templ = pBiquadState->coefs[4] * pBiquadState->pDelays[4];
+ ynL += templ;
- /* ynL+= (-B1 * y(n-1)L )*/
- templ = pBiquadState->coefs[4] * pBiquadState->pDelays[4];
- ynL += templ;
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR= ( A2 * x(n-2)R ) */
+ ynR = pBiquadState->coefs[0] * pBiquadState->pDelays[3];
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR= ( A2 * x(n-2)R ) */
- ynR = pBiquadState->coefs[0] * pBiquadState->pDelays[3];
+ /* ynR+= ( A1 * x(n-1)R ) */
+ templ = pBiquadState->coefs[1] * pBiquadState->pDelays[1];
+ ynR += templ;
- /* ynR+= ( A1 * x(n-1)R ) */
- templ = pBiquadState->coefs[1] * pBiquadState->pDelays[1];
- ynR += templ;
+ /* ynR+= ( A0 * x(n)R ) */
+ tempd = *(pDataIn + 1);
+ templ = pBiquadState->coefs[2] * tempd;
+ ynR += templ;
- /* ynR+= ( A0 * x(n)R ) */
- tempd =* (pDataIn+1);
- templ = pBiquadState->coefs[2] * tempd;
- ynR += templ;
+ /* ynR+= (-B2 * y(n-2)R ) */
+ templ = pBiquadState->coefs[3] * pBiquadState->pDelays[7];
+ ynR += templ;
- /* ynR+= (-B2 * y(n-2)R ) */
- templ = pBiquadState->coefs[3] * pBiquadState->pDelays[7];
- ynR += templ;
+ /* ynR+= (-B1 * y(n-1)R ) */
+ templ = pBiquadState->coefs[4] * pBiquadState->pDelays[5];
+ ynR += templ;
- /* ynR+= (-B1 * y(n-1)R ) */
- templ = pBiquadState->coefs[4] * pBiquadState->pDelays[5];
- 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_FLOAT)ynR; /* Update y(n-1)R */
+ pBiquadState->pDelays[4] = (LVM_FLOAT)ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
- /**************************************************************************
- 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_FLOAT)ynR; /* Update y(n-1)R */
- pBiquadState->pDelays[4] = (LVM_FLOAT)ynL; /* Update y(n-1)L */
- pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
- pDataIn++;
- pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = (LVM_FLOAT)ynL; /* Write Left output */
- pDataOut++;
- *pDataOut = (LVM_FLOAT)ynR; /* Write Right ouput */
- pDataOut++;
-
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)ynL; /* Write Left output */
+ pDataOut++;
+ *pDataOut = (LVM_FLOAT)ynR; /* Write Right output */
+ pDataOut++;
}
+}
/**************************************************************************
ASSUMPTIONS:
@@ -140,60 +134,53 @@
pBiquadState->pDelays[3*NrChannels] to
pBiquadState->pDelays[4*NrChannels - 1] is y(n-2) for all NrChannels
***************************************************************************/
-void BQ_MC_D32F32C30_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
+void BQ_MC_D32F32C30_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels)
- {
- LVM_FLOAT yn, temp;
- LVM_INT16 ii, jj;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+{
+ LVM_FLOAT yn, temp;
+ LVM_INT16 ii, jj;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrFrames; ii != 0; ii--)
- {
+ for (ii = NrFrames; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING CHANNEL-WISE
+ ***************************************************************************/
+ for (jj = 0; jj < NrChannels; jj++) {
+ /* yn= (A2 * x(n-2)) */
+ yn = pBiquadState->coefs[0] * pBiquadState->pDelays[NrChannels + jj];
+
+ /* yn+= (A1 * x(n-1)) */
+ temp = pBiquadState->coefs[1] * pBiquadState->pDelays[jj];
+ yn += temp;
+
+ /* yn+= (A0 * x(n)) */
+ temp = pBiquadState->coefs[2] * (*pDataIn);
+ yn += temp;
+
+ /* yn+= (-B2 * y(n-2)) */
+ temp = pBiquadState->coefs[3] * pBiquadState->pDelays[NrChannels * 3 + jj];
+ yn += temp;
+
+ /* yn+= (-B1 * y(n-1)) */
+ temp = pBiquadState->coefs[4] * pBiquadState->pDelays[NrChannels * 2 + jj];
+ yn += temp;
+
/**************************************************************************
- PROCESSING CHANNEL-WISE
+ UPDATING THE DELAYS
***************************************************************************/
- for (jj = 0; jj < NrChannels; jj++)
- {
- /* yn= (A2 * x(n-2)) */
- yn = pBiquadState->coefs[0] * pBiquadState->pDelays[NrChannels + jj];
-
- /* yn+= (A1 * x(n-1)) */
- temp = pBiquadState->coefs[1] * pBiquadState->pDelays[jj];
- yn += temp;
-
- /* yn+= (A0 * x(n)) */
- temp = pBiquadState->coefs[2] * (*pDataIn);
- yn += temp;
-
- /* yn+= (-B2 * y(n-2)) */
- temp = pBiquadState->coefs[3] * pBiquadState->pDelays[NrChannels*3 + jj];
- yn += temp;
-
- /* yn+= (-B1 * y(n-1)) */
- temp = pBiquadState->coefs[4] * pBiquadState->pDelays[NrChannels*2 + jj];
- yn += temp;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[NrChannels * 3 + jj] =
+ pBiquadState->pDelays[NrChannels * 3 + jj] =
pBiquadState->pDelays[NrChannels * 2 + jj]; /* y(n-2)=y(n-1)*/
- pBiquadState->pDelays[NrChannels * 1 + jj] =
- pBiquadState->pDelays[jj]; /* x(n-2)=x(n-1)*/
- pBiquadState->pDelays[NrChannels * 2 + jj] = (LVM_FLOAT)yn; /* Update y(n-1)*/
- pBiquadState->pDelays[jj] = (*pDataIn); /* Update x(n-1)*/
- pDataIn++;
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = (LVM_FLOAT)yn; /* Write jj Channel output */
- pDataOut++;
- }
+ pBiquadState->pDelays[NrChannels * 1 + jj] =
+ pBiquadState->pDelays[jj]; /* x(n-2)=x(n-1)*/
+ pBiquadState->pDelays[NrChannels * 2 + jj] = (LVM_FLOAT)yn; /* Update y(n-1)*/
+ pBiquadState->pDelays[jj] = (*pDataIn); /* Update x(n-1)*/
+ pDataIn++;
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = (LVM_FLOAT)yn; /* Write jj Channel output */
+ pDataOut++;
}
-
}
-
+}
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 492a9e0..1e27391 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,13 +37,12 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
+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) {
LVM_FLOAT temp;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
temp = pCoef->A2;
pBiquadState->coefs[0] = temp;
temp = pCoef->A1;
@@ -57,4 +56,3 @@
}
/*-------------------------------------------------------------------------*/
/* 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 7eb6474..4a2149d 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
@@ -20,20 +20,18 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT32 coefs[5]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT32 coefs[5]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
-typedef struct _Filter_State_FLOAT
-{
- LVM_FLOAT * pDelays; /* pointer to the delayed samples \
- (data of 32 bits) */
- LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
-}Filter_State_FLOAT;
-typedef Filter_State_FLOAT * PFilter_State_FLOAT ;
+typedef struct _Filter_State_FLOAT {
+ LVM_FLOAT* pDelays; /* pointer to the delayed samples \
+ (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+} Filter_State_FLOAT;
+typedef Filter_State_FLOAT* PFilter_State_FLOAT;
#endif /* _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_*/
diff --git a/media/libeffects/lvm/lib/Common/src/CompLim_private.h b/media/libeffects/lvm/lib/Common/src/CompLim_private.h
index 06a21c3..9c7a96b 100644
--- a/media/libeffects/lvm/lib/Common/src/CompLim_private.h
+++ b/media/libeffects/lvm/lib/Common/src/CompLim_private.h
@@ -28,17 +28,16 @@
DEFINITIONS
***********************************************************************************/
-#define FS_48K 48000
+#define FS_48K 48000
-#define INTEGER_16 0xFFFF /* 65535*/
-#define INTEGER_15 0x7FFF /* 32767*/
+#define INTEGER_16 0xFFFF /* 65535*/
+#define INTEGER_15 0x7FFF /* 32767*/
-#define GAIN_6DB 1
-#define GAIN_12DB 2
-#define GAIN_18DB 3
-#define GAIN_24DB 4
+#define GAIN_6DB 1
+#define GAIN_12DB 2
+#define GAIN_18DB 3
+#define GAIN_24DB 4
#endif /* #ifndef _COMP_LIM_PRIVATE_ */
/*** End of file ******************************************************************/
-
diff --git a/media/libeffects/lvm/lib/Common/src/Copy_16.cpp b/media/libeffects/lvm/lib/Common/src/Copy_16.cpp
index 4b44f28..8887890 100644
--- a/media/libeffects/lvm/lib/Common/src/Copy_16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Copy_16.cpp
@@ -25,27 +25,19 @@
FUNCTION COPY_16
***********************************************************************************/
-void Copy_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n )
-{
+void Copy_16(const LVM_INT16* src, LVM_INT16* dst, LVM_INT16 n) {
LVM_INT16 ii;
- if (src > dst)
- {
- for (ii = n; ii != 0; ii--)
- {
+ if (src > dst) {
+ for (ii = n; ii != 0; ii--) {
*dst = *src;
dst++;
src++;
}
- }
- else
- {
+ } else {
src += n - 1;
dst += n - 1;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = *src;
dst--;
src--;
@@ -54,27 +46,19 @@
return;
}
-void Copy_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n )
-{
+void Copy_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n) {
LVM_INT16 ii;
- if (src > dst)
- {
- for (ii = n; ii != 0; ii--)
- {
+ if (src > dst) {
+ for (ii = n; ii != 0; ii--) {
*dst = *src;
dst++;
src++;
}
- }
- else
- {
+ } else {
src += n - 1;
dst += n - 1;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = *src;
dst--;
src--;
@@ -84,44 +68,34 @@
return;
}
// Extract out the stereo channel pair from multichannel source.
-void Copy_Float_Mc_Stereo(const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames, /* Number of frames */
- LVM_INT32 NrChannels)
-{
+void Copy_Float_Mc_Stereo(const LVM_FLOAT* src, LVM_FLOAT* dst,
+ LVM_INT16 NrFrames, /* Number of frames */
+ LVM_INT32 NrChannels) {
LVM_INT16 ii;
- if (NrChannels >= 2)
- {
- for (ii = NrFrames; ii != 0; ii--)
- {
+ if (NrChannels >= 2) {
+ for (ii = NrFrames; ii != 0; ii--) {
dst[0] = src[0];
dst[1] = src[1];
dst += 2;
src += NrChannels;
}
- }
- else if (NrChannels == 1)
- { // not expected to occur, provided for completeness.
+ } else if (NrChannels == 1) { // not expected to occur, provided for completeness.
src += (NrFrames - 1);
dst += 2 * (NrFrames - 1);
- for (ii = NrFrames; ii != 0; ii--)
- {
+ for (ii = NrFrames; ii != 0; ii--) {
dst[0] = src[0];
dst[1] = src[0];
dst -= 2;
- src --;
+ src--;
}
}
}
// Merge a multichannel source with stereo contained in StereoOut, to dst.
-void Copy_Float_Stereo_Mc(const LVM_FLOAT *src,
- LVM_FLOAT *StereoOut,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames, /* Number of frames*/
- LVM_INT32 NrChannels)
-{
+void Copy_Float_Stereo_Mc(const LVM_FLOAT* src, LVM_FLOAT* StereoOut, LVM_FLOAT* dst,
+ LVM_INT16 NrFrames, /* Number of frames*/
+ LVM_INT32 NrChannels) {
LVM_INT16 ii, jj;
// pack dst with stereo information of StereoOut
@@ -129,16 +103,14 @@
StereoOut += 2 * (NrFrames - 1);
dst += NrChannels * (NrFrames - 1);
src += NrChannels * (NrFrames - 1);
- for (ii = NrFrames; ii != 0; ii--)
- {
+ for (ii = NrFrames; ii != 0; ii--) {
dst[1] = StereoOut[1];
- dst[0] = StereoOut[0]; // copy 1 before 0 is required for NrChannels == 3.
- for (jj = 2; jj < NrChannels; jj++)
- {
+ dst[0] = StereoOut[0]; // copy 1 before 0 is required for NrChannels == 3.
+ for (jj = 2; jj < NrChannels; jj++) {
dst[jj] = src[jj];
}
- dst -= NrChannels;
- src -= NrChannels;
+ dst -= NrChannels;
+ src -= NrChannels;
StereoOut -= 2;
}
}
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 5e77335..2c2061a 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,13 +25,9 @@
/**********************************************************************************
FUNCTION CORE_MIXHARD_2ST_D32C31_SAT
***********************************************************************************/
-void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_FLOAT Temp1,Temp2,Temp3;
+void Core_MixHard_2St_D32C31_SAT(Mix_2St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_FLOAT Temp1, Temp2, Temp3;
LVM_INT16 ii;
LVM_FLOAT Current1Short;
LVM_FLOAT Current2Short;
@@ -39,7 +35,7 @@
Current1Short = (pInstance->Current1);
Current2Short = (pInstance->Current2);
- for (ii = n; ii != 0; ii--){
+ for (ii = n; ii != 0; ii--) {
Temp1 = *src1++;
Temp3 = Temp1 * Current1Short;
Temp2 = *src2++;
@@ -47,11 +43,11 @@
Temp2 = (Temp1 / 2.0f) + (Temp3 / 2.0f);
if (Temp2 > 0.5f)
Temp2 = 1.0f;
- else if (Temp2 < -0.5f )
+ else if (Temp2 < -0.5f)
Temp2 = -1.0f;
else
Temp2 = (Temp2 * 2);
- *dst++ = Temp2;
+ *dst++ = Temp2;
}
}
/**********************************************************************************/
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 8f5c0ae..be9e49b 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,53 +26,48 @@
FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
-void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_FLOAT Temp1,Temp2,Temp3;
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_FLOAT TargetTimesOneMinAlpha;
- LVM_FLOAT CurrentTimesAlpha;
- LVM_INT16 ii,jj;
+void Core_MixInSoft_D32C31_SAT(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst,
+ LVM_INT16 n) {
+ LVM_FLOAT Temp1, Temp2, Temp3;
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_FLOAT TargetTimesOneMinAlpha;
+ LVM_FLOAT CurrentTimesAlpha;
+ LVM_INT16 ii, jj;
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
OutLoop = (LVM_INT16)(n - (InLoop << 2));
- TargetTimesOneMinAlpha = ((1.0f -pInstance->Alpha) * pInstance->Target);
- if (pInstance->Target >= pInstance->Current){
- TargetTimesOneMinAlpha +=(LVM_FLOAT)(2.0f / 2147483647.0f); /* Ceil*/
+ TargetTimesOneMinAlpha = ((1.0f - pInstance->Alpha) * pInstance->Target);
+ if (pInstance->Target >= pInstance->Current) {
+ TargetTimesOneMinAlpha += (LVM_FLOAT)(2.0f / 2147483647.0f); /* Ceil*/
}
- if (OutLoop){
-
+ if (OutLoop) {
CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
- for (ii = OutLoop; ii != 0; ii--){
- Temp1 = *src++;
- Temp2 = *dst;
+ for (ii = OutLoop; ii != 0; ii--) {
+ Temp1 = *src++;
+ Temp2 = *dst;
- Temp3 = Temp1 * (pInstance->Current);
- Temp1 = Temp2 + Temp3;
+ Temp3 = Temp1 * (pInstance->Current);
+ Temp1 = Temp2 + Temp3;
- if (Temp1 > 1.0f)
- Temp1 = 1.0f;
- else if (Temp1 < -1.0f)
- Temp1 = -1.0f;
+ if (Temp1 > 1.0f)
+ Temp1 = 1.0f;
+ else if (Temp1 < -1.0f)
+ Temp1 = -1.0f;
- *dst++ = Temp1;
+ *dst++ = Temp1;
}
}
- for (ii = InLoop; ii != 0; ii--){
-
+ for (ii = InLoop; ii != 0; ii--) {
CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
- for (jj = 4; jj!=0 ; jj--){
+ for (jj = 4; jj != 0; jj--) {
Temp1 = *src++;
Temp2 = *dst;
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 6ff7853..61a4752 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,12 +25,9 @@
/**********************************************************************************
FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
-void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_FLOAT Temp1,Temp2;
+void Core_MixSoft_1St_D32C31_WRA(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_FLOAT Temp1, Temp2;
LVM_INT16 OutLoop;
LVM_INT16 InLoop;
LVM_FLOAT TargetTimesOneMinAlpha;
@@ -41,19 +38,17 @@
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
OutLoop = (LVM_INT16)(n - (InLoop << 2));
- TargetTimesOneMinAlpha = (1.0f - pInstance->Alpha) * pInstance->Target; /* float * float in float */
- if (pInstance->Target >= pInstance->Current)
- {
+ TargetTimesOneMinAlpha =
+ (1.0f - pInstance->Alpha) * pInstance->Target; /* float * float in float */
+ if (pInstance->Target >= pInstance->Current) {
TargetTimesOneMinAlpha += (LVM_FLOAT)(2.0f / 2147483647.0f); /* Ceil*/
}
- if (OutLoop != 0)
- {
+ if (OutLoop != 0) {
CurrentTimesAlpha = (pInstance->Current * pInstance->Alpha);
pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
- for (ii = OutLoop; ii != 0; ii--)
- {
+ for (ii = OutLoop; ii != 0; ii--) {
Temp1 = *src;
src++;
@@ -63,37 +58,36 @@
}
}
- for (ii = InLoop; ii != 0; ii--)
- {
+ for (ii = InLoop; ii != 0; ii--) {
CurrentTimesAlpha = pInstance->Current * pInstance->Alpha;
pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha;
- Temp1 = *src;
- src++;
+ Temp1 = *src;
+ src++;
- Temp2 = Temp1 * (pInstance->Current);
- *dst = Temp2;
- dst++;
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
- Temp1 = *src;
- src++;
+ Temp1 = *src;
+ src++;
- Temp2 = Temp1 * (pInstance->Current);
- *dst = Temp2;
- dst++;
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
- Temp1 = *src;
- src++;
+ Temp1 = *src;
+ src++;
- Temp2 = Temp1 * (pInstance->Current);
- *dst = Temp2;
- dst++;
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
- Temp1 = *src;
- src++;
- Temp2 = Temp1 * (pInstance->Current);
- *dst = Temp2;
- dst++;
+ Temp1 = *src;
+ src++;
+ Temp2 = Temp1 * (pInstance->Current);
+ *dst = Temp2;
+ dst++;
}
}
/**********************************************************************************/
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 f2b5813..2861be6 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,49 +18,47 @@
#include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
#include "LVM_Macros.h"
-void DC_2I_D16_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT LeftDC,RightDC;
- LVM_FLOAT Diff;
- LVM_INT32 j;
- PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State) pInstance;
+void DC_2I_D16_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT LeftDC, RightDC;
+ LVM_FLOAT Diff;
+ LVM_INT32 j;
+ PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State)pInstance;
- LeftDC = pBiquadState->LeftDC;
- RightDC = pBiquadState->RightDC;
- for(j = NrSamples-1; j >= 0; j--)
- {
- /* Subtract DC and saturate */
- Diff =* (pDataIn++) - (LeftDC);
- if (Diff > 1.0f) {
- Diff = 1.0f; }
- else if (Diff < -1.0f) {
- Diff = -1.0f; }
- *(pDataOut++) = (LVM_FLOAT)Diff;
- if (Diff < 0) {
- LeftDC -= DC_FLOAT_STEP; }
- else {
- LeftDC += DC_FLOAT_STEP; }
-
- /* Subtract DC an saturate */
- Diff =* (pDataIn++) - (RightDC);
- if (Diff > 1.0f) {
- Diff = 1.0f; }
- else if (Diff < -1.0f) {
- Diff = -1.0f; }
- *(pDataOut++) = (LVM_FLOAT)Diff;
- if (Diff < 0) {
- RightDC -= DC_FLOAT_STEP; }
- else {
- RightDC += DC_FLOAT_STEP; }
-
+ LeftDC = pBiquadState->LeftDC;
+ RightDC = pBiquadState->RightDC;
+ for (j = NrSamples - 1; j >= 0; j--) {
+ /* Subtract DC and saturate */
+ Diff = *(pDataIn++) - (LeftDC);
+ if (Diff > 1.0f) {
+ Diff = 1.0f;
+ } else if (Diff < -1.0f) {
+ Diff = -1.0f;
}
- pBiquadState->LeftDC = LeftDC;
- pBiquadState->RightDC = RightDC;
+ *(pDataOut++) = (LVM_FLOAT)Diff;
+ if (Diff < 0) {
+ LeftDC -= DC_FLOAT_STEP;
+ } else {
+ LeftDC += DC_FLOAT_STEP;
+ }
+ /* Subtract DC an saturate */
+ Diff = *(pDataIn++) - (RightDC);
+ if (Diff > 1.0f) {
+ Diff = 1.0f;
+ } else if (Diff < -1.0f) {
+ Diff = -1.0f;
+ }
+ *(pDataOut++) = (LVM_FLOAT)Diff;
+ if (Diff < 0) {
+ RightDC -= DC_FLOAT_STEP;
+ } else {
+ RightDC += DC_FLOAT_STEP;
+ }
}
+ pBiquadState->LeftDC = LeftDC;
+ pBiquadState->RightDC = RightDC;
+}
/*
* FUNCTION: DC_Mc_D16_TRC_WRA_01
*
@@ -78,36 +76,30 @@
* void
*
*/
-void DC_Mc_D16_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
- {
- LVM_FLOAT *ChDC;
- LVM_FLOAT Diff;
- LVM_INT32 j;
- LVM_INT32 i;
- PFilter_FLOAT_State_Mc pBiquadState = (PFilter_FLOAT_State_Mc) pInstance;
+void DC_Mc_D16_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels) {
+ LVM_FLOAT* ChDC;
+ LVM_FLOAT Diff;
+ LVM_INT32 j;
+ LVM_INT32 i;
+ PFilter_FLOAT_State_Mc pBiquadState = (PFilter_FLOAT_State_Mc)pInstance;
- ChDC = &pBiquadState->ChDC[0];
- for (j = NrFrames - 1; j >= 0; j--)
- {
- /* Subtract DC and saturate */
- for (i = NrChannels - 1; i >= 0; i--)
- {
- Diff = *(pDataIn++) - (ChDC[i]);
- if (Diff > 1.0f) {
- Diff = 1.0f;
- } else if (Diff < -1.0f) {
- Diff = -1.0f; }
- *(pDataOut++) = (LVM_FLOAT)Diff;
- if (Diff < 0) {
- ChDC[i] -= DC_FLOAT_STEP;
- } else {
- ChDC[i] += DC_FLOAT_STEP; }
+ ChDC = &pBiquadState->ChDC[0];
+ for (j = NrFrames - 1; j >= 0; j--) {
+ /* Subtract DC and saturate */
+ for (i = NrChannels - 1; i >= 0; i--) {
+ Diff = *(pDataIn++) - (ChDC[i]);
+ if (Diff > 1.0f) {
+ Diff = 1.0f;
+ } else if (Diff < -1.0f) {
+ Diff = -1.0f;
}
-
+ *(pDataOut++) = (LVM_FLOAT)Diff;
+ if (Diff < 0) {
+ ChDC[i] -= DC_FLOAT_STEP;
+ } else {
+ ChDC[i] += DC_FLOAT_STEP;
+ }
}
-
}
+}
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 42d98f2..2828cb3 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,18 +17,15 @@
#include "BIQUAD.h"
#include "DC_2I_D16_TRC_WRA_01_Private.h"
-void DC_2I_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance)
-{
- PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State) pInstance;
- pBiquadState->LeftDC = 0.0f;
- pBiquadState->RightDC = 0.0f;
+void DC_2I_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance) {
+ PFilter_FLOAT_State pBiquadState = (PFilter_FLOAT_State)pInstance;
+ pBiquadState->LeftDC = 0.0f;
+ pBiquadState->RightDC = 0.0f;
}
-void DC_Mc_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t *pInstance)
-{
- PFilter_FLOAT_State_Mc pBiquadState = (PFilter_FLOAT_State_Mc) pInstance;
+void DC_Mc_D16_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance) {
+ PFilter_FLOAT_State_Mc pBiquadState = (PFilter_FLOAT_State_Mc)pInstance;
LVM_INT32 i;
- for (i = 0; i < LVM_MAX_CHANNELS; i++)
- {
+ for (i = 0; i < LVM_MAX_CHANNELS; i++) {
pBiquadState->ChDC[i] = 0.0f;
}
}
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 999abea..8f459d2 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,19 +18,17 @@
#ifndef _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
#define _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
-#define DC_FLOAT_STEP 0.0000002384f
+#define DC_FLOAT_STEP 0.0000002384f
/* 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_FLOAT_State_
-{
- LVM_FLOAT LeftDC; /* LeftDC */
- LVM_FLOAT RightDC; /* RightDC */
-}Filter_FLOAT_State;
-typedef Filter_FLOAT_State * PFilter_FLOAT_State ;
-typedef struct _Filter_FLOAT_State_Mc_
-{
- LVM_FLOAT ChDC[LVM_MAX_CHANNELS]; /* ChannelDC */
+typedef struct _Filter_FLOAT_State_ {
+ LVM_FLOAT LeftDC; /* LeftDC */
+ LVM_FLOAT RightDC; /* RightDC */
+} Filter_FLOAT_State;
+typedef Filter_FLOAT_State* PFilter_FLOAT_State;
+typedef struct _Filter_FLOAT_State_Mc_ {
+ LVM_FLOAT ChDC[LVM_MAX_CHANNELS]; /* ChannelDC */
} Filter_FLOAT_State_Mc;
-typedef Filter_FLOAT_State_Mc * PFilter_FLOAT_State_Mc ;
+typedef Filter_FLOAT_State_Mc* PFilter_FLOAT_State_Mc;
#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 771fae2..5daef59 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.cpp
@@ -27,54 +27,44 @@
FUNCTION DelayAllPass_32x32
***********************************************************************************/
-void DelayAllPass_Sat_32x16To32( LVM_INT32 *delay, /* Delay buffer */
- LVM_UINT16 size, /* Delay size */
- LVM_INT16 coeff, /* All pass filter coefficient */
- LVM_UINT16 DelayOffset, /* Simple delay offset */
- LVM_UINT16 *pAllPassOffset, /* All pass filter delay offset */
- LVM_INT32 *dst, /* Source/destination */
- LVM_INT16 n) /* Number of samples */
+void DelayAllPass_Sat_32x16To32(LVM_INT32* delay, /* Delay buffer */
+ LVM_UINT16 size, /* Delay size */
+ LVM_INT16 coeff, /* All pass filter coefficient */
+ LVM_UINT16 DelayOffset, /* Simple delay offset */
+ LVM_UINT16* pAllPassOffset, /* All pass filter delay offset */
+ LVM_INT32* dst, /* Source/destination */
+ LVM_INT16 n) /* Number of samples */
{
- LVM_INT16 i;
- LVM_UINT16 AllPassOffset = *pAllPassOffset;
- LVM_INT32 temp;
- LVM_INT32 a,b,c;
+ LVM_INT16 i;
+ LVM_UINT16 AllPassOffset = *pAllPassOffset;
+ LVM_INT32 temp;
+ LVM_INT32 a, b, c;
- for (i = 0; i < n; i++)
- {
-
- MUL32x16INTO32(delay[AllPassOffset], coeff, temp, 15)
- a = temp;
+ for (i = 0; i < n; i++) {
+ MUL32x16INTO32(delay[AllPassOffset], coeff, temp, 15) a = temp;
b = delay[DelayOffset];
DelayOffset++;
c = a + b;
- if ((((c ^ a) & (c ^ b)) >> 31) != 0) /* overflow / underflow */
+ if ((((c ^ a) & (c ^ b)) >> 31) != 0) /* overflow / underflow */
{
- if(a < 0)
- {
+ if (a < 0) {
c = 0x80000000L;
- }
- else
- {
+ } else {
c = 0x7FFFFFFFL;
}
}
*dst = c;
dst++;
- MUL32x16INTO32(c, -coeff, temp, 15)
- a = temp;
+ MUL32x16INTO32(c, -coeff, temp, 15) a = temp;
b = delay[AllPassOffset];
c = a + b;
- if ((((c ^ a) & (c ^ b)) >> 31)!=0) /* overflow / underflow */
+ if ((((c ^ a) & (c ^ b)) >> 31) != 0) /* overflow / underflow */
{
- if(a < 0)
- {
+ if (a < 0) {
c = 0x80000000L;
- }
- else
- {
+ } else {
c = 0x7FFFFFFFL;
}
}
@@ -82,13 +72,11 @@
AllPassOffset++;
/* Make the delay buffer a circular buffer */
- if (DelayOffset >= size)
- {
+ if (DelayOffset >= size) {
DelayOffset = 0;
}
- if (AllPassOffset >= size)
- {
+ if (AllPassOffset >= size) {
AllPassOffset = 0;
}
}
@@ -100,4 +88,3 @@
}
/**********************************************************************************/
-
diff --git a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
index 52d263f..da75982 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/DelayMix_16x16.cpp
@@ -25,19 +25,18 @@
FUNCTION DelayMix_16x16
***********************************************************************************/
-void DelayMix_16x16(const LVM_INT16 *src, /* Source 1, to be delayed */
- LVM_INT16 *delay, /* Delay buffer */
- LVM_INT16 size, /* Delay size */
- LVM_INT16 *dst, /* Source/destination */
- LVM_INT16 *pOffset, /* Delay offset */
- LVM_INT16 n) /* Number of stereo samples */
+void DelayMix_16x16(const LVM_INT16* src, /* Source 1, to be delayed */
+ LVM_INT16* delay, /* Delay buffer */
+ LVM_INT16 size, /* Delay size */
+ LVM_INT16* dst, /* Source/destination */
+ LVM_INT16* pOffset, /* Delay offset */
+ LVM_INT16 n) /* Number of stereo samples */
{
- LVM_INT16 i;
- LVM_INT16 Offset = *pOffset;
- LVM_INT16 temp;
+ LVM_INT16 i;
+ LVM_INT16 Offset = *pOffset;
+ LVM_INT16 temp;
- for (i = 0; i < n; i++)
- {
+ for (i = 0; i < n; i++) {
/* Left channel */
temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) + (LVM_INT32)delay[Offset]) >> 1);
*dst = temp;
@@ -57,8 +56,7 @@
src++;
/* Make the reverb delay buffer a circular buffer */
- if (Offset >= size)
- {
+ if (Offset >= size) {
Offset = 0;
}
}
@@ -68,22 +66,21 @@
return;
}
-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 */
+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 */
{
- LVM_INT16 i;
- LVM_INT16 Offset = *pOffset;
- LVM_FLOAT temp;
+ LVM_INT16 i;
+ LVM_INT16 Offset = *pOffset;
+ LVM_FLOAT temp;
- for (i=0; i<n; i++)
- {
+ for (i = 0; i < n; i++) {
/* Left channel */
- temp = (LVM_FLOAT)((LVM_FLOAT)(*dst + (LVM_FLOAT)delay[Offset]) / 2.0f);
- *dst = temp;
+ temp = (LVM_FLOAT)((LVM_FLOAT)(*dst + (LVM_FLOAT)delay[Offset]) / 2.0f);
+ *dst = temp;
dst++;
delay[Offset] = *src;
@@ -91,8 +88,8 @@
src++;
/* Right channel */
- temp = (LVM_FLOAT)((LVM_FLOAT)(*dst - (LVM_FLOAT)delay[Offset]) / 2.0f);
- *dst = temp;
+ temp = (LVM_FLOAT)((LVM_FLOAT)(*dst - (LVM_FLOAT)delay[Offset]) / 2.0f);
+ *dst = temp;
dst++;
delay[Offset] = *src;
@@ -100,8 +97,7 @@
src++;
/* Make the reverb delay buffer a circular buffer */
- if (Offset >= size)
- {
+ if (Offset >= size) {
Offset = 0;
}
}
diff --git a/media/libeffects/lvm/lib/Common/src/DelayWrite_32.cpp b/media/libeffects/lvm/lib/Common/src/DelayWrite_32.cpp
index 809cddc..47cffbf 100644
--- a/media/libeffects/lvm/lib/Common/src/DelayWrite_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/DelayWrite_32.cpp
@@ -25,24 +25,22 @@
FUNCTION DelayMix_16x16
***********************************************************************************/
-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) /* Number of samples */
+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) /* Number of samples */
{
- LVM_INT16 i;
- LVM_INT16 Offset = (LVM_INT16)*pOffset;
+ LVM_INT16 i;
+ LVM_INT16 Offset = (LVM_INT16)*pOffset;
- for (i=0; i<n; i++)
- {
+ for (i = 0; i < n; i++) {
delay[Offset] = *src;
Offset++;
src++;
/* Make the delay buffer a circular buffer */
- if (Offset >= size)
- {
+ if (Offset >= size) {
Offset = 0;
}
}
@@ -54,4 +52,3 @@
}
/**********************************************************************************/
-
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 bef0d62..df8fadc 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,41 +31,34 @@
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
***************************************************************************/
-void FO_1I_D16F16C15_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void FO_1I_D16F16C15_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A1 * x(n-1)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[0];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A1 * x(n-1)L
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+ // ynL+=A0 * x(n)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[1] * (*pDataIn);
- // ynL+=A0 * x(n)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[1] * (*pDataIn);
+ // ynL+= (-B1 * y(n-1)L
+ ynL += (LVM_FLOAT)pBiquadState->coefs[2] * pBiquadState->pDelays[1];
- // ynL+= (-B1 * y(n-1)L
- ynL += (LVM_FLOAT)pBiquadState->coefs[2] * pBiquadState->pDelays[1];
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
-
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output
}
+}
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 161225e..10604bf 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
@@ -37,13 +37,12 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
+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) {
LVM_FLOAT temp;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *)pTaps;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
temp = pCoef->A1;
pBiquadState->coefs[0] = temp;
temp = pCoef->A0;
@@ -53,4 +52,3 @@
}
/*------------------------------------------------*/
/* 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 34f3df9..d1819fc 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
@@ -20,20 +20,18 @@
/* 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_
-{
- LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT16 coefs[3]; /* pointer to the filter coefficients */
-}Filter_State;
+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 */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
-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 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 ;
+typedef Filter_State_FLOAT* PFilter_State_FLOAT;
#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 e3efad7..4c75e04 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
@@ -30,42 +30,36 @@
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
***************************************************************************/
-void FO_1I_D32F32C31_TRC_WRA_01( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,templ;
- LVM_INT16 ii;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
+void FO_1I_D32F32C31_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, templ;
+ LVM_INT16 ii;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ // ynL=A1 * x(n-1)L
+ ynL = pBiquadState->coefs[0] * pBiquadState->pDelays[0];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- // ynL=A1 * x(n-1)L
- ynL = pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+ // ynL+=A0 * x(n)L
+ templ = pBiquadState->coefs[1] * (*pDataIn);
+ ynL += templ;
- // ynL+=A0 * x(n)L
- templ = pBiquadState->coefs[1] * (*pDataIn);
- ynL += templ;
+ // ynL+= (-B1 * y(n-1)L
+ templ = pBiquadState->coefs[2] * pBiquadState->pDelays[1];
+ ynL += templ;
- // ynL+= (-B1 * y(n-1)L
- templ = pBiquadState->coefs[2] * pBiquadState->pDelays[1];
- ynL += templ;
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut++ = (LVM_FLOAT)ynL; // Write Left output in Q0
}
+}
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 bb5295c..bf2e5e1 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
@@ -36,13 +36,12 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
+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) {
LVM_FLOAT temp;
- PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+ PFilter_State_FLOAT pBiquadState = (PFilter_State_FLOAT)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
temp = pCoef->A1;
pBiquadState->coefs[0] = temp;
@@ -53,4 +52,3 @@
}
/*------------------------------------------------*/
/* 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 67d1384..8645593 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
@@ -20,19 +20,17 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
-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 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 ;
+typedef Filter_State_FLOAT* PFilter_State_FLOAT;
#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 605932d..dad070b 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,87 +32,73 @@
pBiquadState->pDelays[2] is x(n-1)R in Q15 format
pBiquadState->pDelays[3] is y(n-1)R in Q30 format
***************************************************************************/
-void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR;
- LVM_FLOAT Temp;
- LVM_FLOAT NegSatValue;
- LVM_INT16 ii;
+void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, ynR;
+ LVM_FLOAT Temp;
+ LVM_FLOAT NegSatValue;
+ LVM_INT16 ii;
- PFilter_Float_State pBiquadState = (PFilter_Float_State) pInstance;
+ PFilter_Float_State pBiquadState = (PFilter_Float_State)pInstance;
- NegSatValue = -1.0f;
+ NegSatValue = -1.0f;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
+ // ynL =A1 * x(n-1)L
+ ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[0];
+ // ynR =A1 * x(n-1)R
+ ynR = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[2];
- // ynL =A1 * x(n-1)L
- ynL = (LVM_FLOAT)pBiquadState->coefs[0] * pBiquadState->pDelays[0];
- // 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+=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;
+ // ynR += (-B1 * y(n-1)R ) )
+ Temp = pBiquadState->pDelays[3] * pBiquadState->coefs[2];
+ ynR += Temp;
- // ynL += (-B1 * y(n-1)L )
- Temp = pBiquadState->pDelays[1] * pBiquadState->coefs[2];
- ynL += Temp;
- // ynR += (-B1 * y(n-1)R ) )
- Temp = pBiquadState->pDelays[3] * pBiquadState->coefs[2];
- ynR += Temp;
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
+ pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[1] = ynL; // Update y(n-1)L
- pBiquadState->pDelays[0] = (*pDataIn++); // Update x(n-1)L
+ pBiquadState->pDelays[3] = ynR; // Update y(n-1)R
+ pBiquadState->pDelays[2] = (*pDataIn++); // Update x(n-1)R
- pBiquadState->pDelays[3] = ynR; // Update y(n-1)R
- pBiquadState->pDelays[2] = (*pDataIn++); // Update x(n-1)R
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
-
- /*Saturate results*/
- if(ynL > 1.0f)
- {
- ynL = 1.0f;
+ /*Saturate results*/
+ if (ynL > 1.0f) {
+ ynL = 1.0f;
+ } else {
+ if (ynL < NegSatValue) {
+ ynL = NegSatValue;
}
- else
- {
- if(ynL < NegSatValue)
- {
- ynL = NegSatValue;
- }
- }
-
- if(ynR > 1.0f)
- {
- ynR = 1.0f;
- }
- else
- {
- if(ynR < NegSatValue)
- {
- ynR = NegSatValue;
- }
- }
-
- *pDataOut++ = (LVM_FLOAT)ynL;
- *pDataOut++ = (LVM_FLOAT)ynR;
}
+ if (ynR > 1.0f) {
+ ynR = 1.0f;
+ } else {
+ if (ynR < NegSatValue) {
+ ynR = NegSatValue;
+ }
+ }
+
+ *pDataOut++ = (LVM_FLOAT)ynL;
+ *pDataOut++ = (LVM_FLOAT)ynR;
}
+}
/**************************************************************************
ASSUMPTIONS:
COEFS-
@@ -134,63 +120,56 @@
RETURNS:
void
***************************************************************************/
-void FO_Mc_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
- {
- LVM_FLOAT yn;
- LVM_FLOAT Temp;
- LVM_INT16 ii;
- LVM_INT16 ch;
- PFilter_Float_State pBiquadState = (PFilter_Float_State) pInstance;
+void FO_Mc_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrFrames,
+ LVM_INT16 NrChannels) {
+ LVM_FLOAT yn;
+ LVM_FLOAT Temp;
+ LVM_INT16 ii;
+ LVM_INT16 ch;
+ PFilter_Float_State pBiquadState = (PFilter_Float_State)pInstance;
- LVM_FLOAT *pDelays = pBiquadState->pDelays;
- LVM_FLOAT *pCoefs = &pBiquadState->coefs[0];
- LVM_FLOAT A0 = pCoefs[1];
- LVM_FLOAT A1 = pCoefs[0];
- LVM_FLOAT B1 = pCoefs[2];
+ LVM_FLOAT* pDelays = pBiquadState->pDelays;
+ LVM_FLOAT* pCoefs = &pBiquadState->coefs[0];
+ LVM_FLOAT A0 = pCoefs[1];
+ LVM_FLOAT A1 = pCoefs[0];
+ LVM_FLOAT B1 = pCoefs[2];
- for (ii = NrFrames; ii != 0; ii--)
- {
+ for (ii = NrFrames; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE CHANNELS
+ ***************************************************************************/
+ for (ch = 0; ch < NrChannels; ch++) {
+ // yn =A1 * x(n-1)
+ yn = (LVM_FLOAT)A1 * pDelays[0];
+
+ // yn+=A0 * x(n)
+ yn += (LVM_FLOAT)A0 * (*pDataIn);
+
+ // yn += (-B1 * y(n-1))
+ Temp = B1 * pDelays[1];
+ yn += Temp;
/**************************************************************************
- PROCESSING OF THE CHANNELS
+ UPDATING THE DELAYS
***************************************************************************/
- for (ch = 0; ch < NrChannels; ch++)
- {
- // yn =A1 * x(n-1)
- yn = (LVM_FLOAT)A1 * pDelays[0];
+ pDelays[1] = yn; // Update y(n-1)
+ pDelays[0] = (*pDataIn++); // Update x(n-1)
- // yn+=A0 * x(n)
- yn += (LVM_FLOAT)A0 * (*pDataIn);
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
- // yn += (-B1 * y(n-1))
- Temp = B1 * pDelays[1];
- yn += Temp;
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pDelays[1] = yn; // Update y(n-1)
- pDelays[0] = (*pDataIn++); // Update x(n-1)
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
-
- /*Saturate results*/
- if (yn > 1.0f)
- {
- yn = 1.0f;
- } else if (yn < -1.0f) {
- yn = -1.0f;
- }
-
- *pDataOut++ = (LVM_FLOAT)yn;
- pDelays += 2;
+ /*Saturate results*/
+ if (yn > 1.0f) {
+ yn = 1.0f;
+ } else if (yn < -1.0f) {
+ yn = -1.0f;
}
- pDelays -= NrChannels * 2;
+
+ *pDataOut++ = (LVM_FLOAT)yn;
+ pDelays += 2;
}
+ pDelays -= NrChannels * 2;
}
+}
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 b81b976..552aeda 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,13 +37,12 @@
/* RETURNS: */
/* void return code */
/*-------------------------------------------------------------------------*/
-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)
-{
+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) {
LVM_FLOAT temp;
- PFilter_Float_State pBiquadState = (PFilter_Float_State) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *) pTaps ;
+ PFilter_Float_State pBiquadState = (PFilter_Float_State)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
temp = pCoef->A1;
pBiquadState->coefs[0] = temp;
@@ -54,4 +53,3 @@
}
/*-------------------------------------------------------------------------*/
/* 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 5022500..0103328 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,11 +20,10 @@
/* 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_
-{
- LVM_FLOAT *pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
-}Filter_Float_State;
+typedef struct _Filter_State_ {
+ LVM_FLOAT* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[3]; /* pointer to the filter coefficients */
+} Filter_Float_State;
-typedef Filter_Float_State * PFilter_Float_State ;
+typedef Filter_Float_State* PFilter_Float_State;
#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 b5db8f4..8eb3e76 100644
--- a/media/libeffects/lvm/lib/Common/src/Filters.h
+++ b/media/libeffects/lvm/lib/Common/src/Filters.h
@@ -30,26 +30,23 @@
* Biquad with coefficients A0, A1, A2, B1 and B2 coefficients
*/
/* Single precision (16-bit) Biquad section coefficients */
-typedef struct
-{
- LVM_FLOAT A0;
- LVM_FLOAT A1;
- LVM_FLOAT A2;
- LVM_FLOAT B1;
- LVM_FLOAT B2;
- LVM_UINT16 Scale;
+typedef struct {
+ LVM_FLOAT A0;
+ LVM_FLOAT A1;
+ LVM_FLOAT A2;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+ LVM_UINT16 Scale;
} BiquadA012B12CoefsSP_t;
/*
* Biquad with coefficients A0, A1 and B1 coefficients
*/
/* Single precision (16-bit) Biquad section coefficients */
-typedef struct
-{
- LVM_FLOAT A0;
- LVM_FLOAT A1;
- LVM_FLOAT B1;
- LVM_UINT16 Scale;
+typedef struct {
+ LVM_FLOAT A0;
+ LVM_FLOAT A1;
+ LVM_FLOAT B1;
+ LVM_UINT16 Scale;
} BiquadA01B1CoefsSP_t;
-#endif /* FILTERS_H */
-
+#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 c3f6648..b050267 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.cpp
@@ -25,15 +25,10 @@
FUNCTION From2iToMS_16x16
***********************************************************************************/
-void From2iToMS_16x16( const LVM_INT16 *src,
- LVM_INT16 *dstM,
- LVM_INT16 *dstS,
- LVM_INT16 n )
-{
- LVM_INT32 temp1,left,right;
+void From2iToMS_16x16(const LVM_INT16* src, LVM_INT16* dstM, LVM_INT16* dstS, LVM_INT16 n) {
+ LVM_INT32 temp1, left, right;
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
left = (LVM_INT32)*src;
src++;
@@ -41,27 +36,22 @@
src++;
/* Compute M signal*/
- temp1 = (left+right)>>1;
+ temp1 = (left + right) >> 1;
*dstM = (LVM_INT16)temp1;
dstM++;
/* Compute S signal*/
- temp1 = (left-right)>>1;
+ temp1 = (left - right) >> 1;
*dstS = (LVM_INT16)temp1;
dstS++;
}
return;
}
-void From2iToMS_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dstM,
- LVM_FLOAT *dstS,
- LVM_INT16 n )
-{
- LVM_FLOAT temp1,left,right;
+void From2iToMS_Float(const LVM_FLOAT* src, LVM_FLOAT* dstM, LVM_FLOAT* dstS, LVM_INT16 n) {
+ LVM_FLOAT temp1, left, right;
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
left = (LVM_FLOAT)*src;
src++;
@@ -69,12 +59,12 @@
src++;
/* Compute M signal*/
- temp1 = (left + right) / 2.0f;
+ temp1 = (left + right) / 2.0f;
*dstM = (LVM_FLOAT)temp1;
dstM++;
/* Compute S signal*/
- temp1 = (left - right) / 2.0f;
+ temp1 = (left - right) / 2.0f;
*dstS = (LVM_FLOAT)temp1;
dstS++;
}
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMono_16.cpp b/media/libeffects/lvm/lib/Common/src/From2iToMono_16.cpp
index b758ee7..9a54ee4 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMono_16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMono_16.cpp
@@ -25,21 +25,17 @@
FUNCTION From2iToMono_16
***********************************************************************************/
-void From2iToMono_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
+void From2iToMono_16(const LVM_INT16* src, LVM_INT16* dst, LVM_INT16 n) {
LVM_INT16 ii;
LVM_INT32 Temp;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
Temp = (LVM_INT32)*src;
src++;
Temp += (LVM_INT32)*src;
src++;
- *dst = (LVM_INT16)(Temp >>1);
+ *dst = (LVM_INT16)(Temp >> 1);
dst++;
}
diff --git a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
index 6b52feb..6ede958 100644
--- a/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/From2iToMono_32.cpp
@@ -25,19 +25,15 @@
FUNCTION From2iToMono_32
***********************************************************************************/
-void From2iToMono_32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
+void From2iToMono_32(const LVM_INT32* src, LVM_INT32* dst, LVM_INT16 n) {
LVM_INT16 ii;
LVM_INT32 Temp;
- for (ii = n; ii != 0; ii--)
- {
- Temp = (*src>>1);
+ for (ii = n; ii != 0; ii--) {
+ Temp = (*src >> 1);
src++;
- Temp +=(*src>>1);
+ Temp += (*src >> 1);
src++;
*dst = Temp;
@@ -46,15 +42,11 @@
return;
}
-void From2iToMono_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
+void From2iToMono_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n) {
LVM_INT16 ii;
LVM_FLOAT Temp;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
Temp = (*src);
src++;
@@ -84,19 +76,14 @@
* void
*
*/
-void FromMcToMono_Float(const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
-{
+void FromMcToMono_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 NrFrames,
+ LVM_INT16 NrChannels) {
LVM_INT16 ii, jj;
LVM_FLOAT Temp;
- for (ii = NrFrames; ii != 0; ii--)
- {
+ for (ii = NrFrames; ii != 0; ii--) {
Temp = 0.0f;
- for (jj = NrChannels; jj !=0; jj--)
- {
+ for (jj = NrChannels; jj != 0; jj--) {
Temp += (*src);
src++;
}
diff --git a/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp b/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
index a039bf5..2cfe056 100644
--- a/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
+++ b/media/libeffects/lvm/lib/Common/src/InstAlloc.cpp
@@ -26,9 +26,7 @@
* Remarks :
****************************************************************************************/
-void InstAlloc_Init( INST_ALLOC *pms,
- void *StartAddr )
-{
+void InstAlloc_Init(INST_ALLOC* pms, void* StartAddr) {
pms->TotalSize = 3;
pms->pNextMember = (((uintptr_t)StartAddr + 3) & (uintptr_t)~3);
}
@@ -44,10 +42,8 @@
* Remarks :
****************************************************************************************/
-void* InstAlloc_AddMember( INST_ALLOC *pms,
- LVM_UINT32 Size )
-{
- void *NewMemberAddress; /* Variable to temporarily store the return value */
+void* InstAlloc_AddMember(INST_ALLOC* pms, LVM_UINT32 Size) {
+ void* NewMemberAddress; /* Variable to temporarily store the return value */
NewMemberAddress = (void*)pms->pNextMember;
Size = ((Size + 3) & (LVM_UINT32)~3); /* Ceil the size to a multiple of four */
@@ -55,7 +51,7 @@
pms->TotalSize += Size;
pms->pNextMember += Size;
- return(NewMemberAddress);
+ return (NewMemberAddress);
}
/****************************************************************************************
@@ -66,21 +62,15 @@
* Remarks :
****************************************************************************************/
-LVM_UINT32 InstAlloc_GetTotal( INST_ALLOC *pms)
-{
- if (pms->TotalSize > 3)
- {
- return(pms->TotalSize);
- }
- else
- {
- return 0; /* No memory added */
+LVM_UINT32 InstAlloc_GetTotal(INST_ALLOC* pms) {
+ if (pms->TotalSize > 3) {
+ return (pms->TotalSize);
+ } else {
+ return 0; /* No memory added */
}
}
-void InstAlloc_InitAll( INST_ALLOC *pms,
- LVM_MemoryTable_st *pMemoryTable)
-{
+void InstAlloc_InitAll(INST_ALLOC* pms, LVM_MemoryTable_st* pMemoryTable) {
uintptr_t StartAddr;
StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress;
@@ -102,7 +92,6 @@
pms[3].TotalSize = 3;
pms[3].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
-
}
/****************************************************************************************
@@ -114,8 +103,7 @@
* Remarks :
****************************************************************************************/
-void InstAlloc_InitAll_NULL( INST_ALLOC *pms)
-{
+void InstAlloc_InitAll_NULL(INST_ALLOC* pms) {
pms[0].TotalSize = 3;
pms[0].pNextMember = 0;
@@ -127,47 +115,46 @@
pms[3].TotalSize = 3;
pms[3].pNextMember = 0;
-
}
-void* InstAlloc_AddMemberAll( INST_ALLOC *pms,
- LVM_UINT32 Size[],
- LVM_MemoryTable_st *pMemoryTable)
-{
- void *NewMemberAddress; /* Variable to temporarily store the return value */
+void* InstAlloc_AddMemberAll(INST_ALLOC* pms, LVM_UINT32 Size[], LVM_MemoryTable_st* pMemoryTable) {
+ void* NewMemberAddress; /* Variable to temporarily store the return value */
/* coverity[returned_pointer] Ignore coverity warning that ptr is not used */
- NewMemberAddress = InstAlloc_AddMember(&pms[LVM_PERSISTENT_SLOW_DATA], Size[LVM_PERSISTENT_SLOW_DATA]);
+ NewMemberAddress =
+ InstAlloc_AddMember(&pms[LVM_PERSISTENT_SLOW_DATA], Size[LVM_PERSISTENT_SLOW_DATA]);
- pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size = InstAlloc_GetTotal(&pms[LVM_PERSISTENT_SLOW_DATA]);
- pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Type = LVM_PERSISTENT_SLOW_DATA;
+ pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size =
+ InstAlloc_GetTotal(&pms[LVM_PERSISTENT_SLOW_DATA]);
+ pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Type = LVM_PERSISTENT_SLOW_DATA;
pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress = LVM_NULL;
- NewMemberAddress = InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_DATA], Size[LVM_PERSISTENT_FAST_DATA]);
+ NewMemberAddress =
+ InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_DATA], Size[LVM_PERSISTENT_FAST_DATA]);
- pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size = InstAlloc_GetTotal(&pms[LVM_PERSISTENT_FAST_DATA]);
- pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Type = LVM_PERSISTENT_FAST_DATA;
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size =
+ InstAlloc_GetTotal(&pms[LVM_PERSISTENT_FAST_DATA]);
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Type = LVM_PERSISTENT_FAST_DATA;
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress = LVM_NULL;
- NewMemberAddress = InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_COEF], Size[LVM_PERSISTENT_FAST_COEF]);
+ NewMemberAddress =
+ InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_COEF], Size[LVM_PERSISTENT_FAST_COEF]);
- pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size = InstAlloc_GetTotal(&pms[LVM_PERSISTENT_FAST_COEF]);
- pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Type = LVM_PERSISTENT_FAST_COEF;
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size =
+ InstAlloc_GetTotal(&pms[LVM_PERSISTENT_FAST_COEF]);
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Type = LVM_PERSISTENT_FAST_COEF;
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress = LVM_NULL;
NewMemberAddress = InstAlloc_AddMember(&pms[LVM_TEMPORARY_FAST], Size[LVM_TEMPORARY_FAST]);
- pMemoryTable->Region[LVM_TEMPORARY_FAST].Size = InstAlloc_GetTotal(&pms[LVM_TEMPORARY_FAST]);
- pMemoryTable->Region[LVM_TEMPORARY_FAST].Type = LVM_TEMPORARY_FAST;
- pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress = LVM_NULL;
+ pMemoryTable->Region[LVM_TEMPORARY_FAST].Size = InstAlloc_GetTotal(&pms[LVM_TEMPORARY_FAST]);
+ pMemoryTable->Region[LVM_TEMPORARY_FAST].Type = LVM_TEMPORARY_FAST;
+ pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress = LVM_NULL;
- return(NewMemberAddress);
+ return (NewMemberAddress);
}
-void* InstAlloc_AddMemberAllRet( INST_ALLOC *pms,
- LVM_UINT32 Size[],
- void **ptr)
-{
+void* InstAlloc_AddMemberAllRet(INST_ALLOC* pms, LVM_UINT32 Size[], void** ptr) {
ptr[0] = InstAlloc_AddMember(&pms[LVM_PERSISTENT_SLOW_DATA], Size[LVM_PERSISTENT_SLOW_DATA]);
ptr[1] = InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_DATA], Size[LVM_PERSISTENT_FAST_DATA]);
ptr[2] = InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_COEF], Size[LVM_PERSISTENT_FAST_COEF]);
diff --git a/media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.cpp b/media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.cpp
index 9f09e4d..9ddcbe4 100644
--- a/media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.cpp
@@ -25,19 +25,14 @@
FUNCTION INT16LSHIFTTOINT32_16X32
***********************************************************************************/
-void Int16LShiftToInt32_16x32(const LVM_INT16 *src,
- LVM_INT32 *dst,
- LVM_INT16 n,
- LVM_INT16 shift )
-{
+void Int16LShiftToInt32_16x32(const LVM_INT16* src, LVM_INT32* dst, LVM_INT16 n, LVM_INT16 shift) {
LVM_INT16 ii;
- src += n-1;
- dst += n-1;
+ src += n - 1;
+ dst += n - 1;
- for (ii = n; ii != 0; ii--)
- {
- *dst = ( ((LVM_INT32)*src) << shift);
+ for (ii = n; ii != 0; ii--) {
+ *dst = (((LVM_INT32)*src) << shift);
src--;
dst--;
}
diff --git a/media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.cpp b/media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.cpp
index 8c9980d..2584117 100644
--- a/media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.cpp
@@ -25,29 +25,20 @@
FUNCTION INT32RSHIFTTOINT16_SAT_32X16
***********************************************************************************/
-void Int32RShiftToInt16_Sat_32x16(const LVM_INT32 *src,
- LVM_INT16 *dst,
- LVM_INT16 n,
- LVM_INT16 shift )
-{
+void Int32RShiftToInt16_Sat_32x16(const LVM_INT32* src, LVM_INT16* dst, LVM_INT16 n,
+ LVM_INT16 shift) {
LVM_INT32 temp;
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
temp = *src >> shift;
src++;
- if (temp > 0x00007FFF)
- {
+ if (temp > 0x00007FFF) {
*dst = 0x7FFF;
- }
- else if (temp < -0x00008000)
- {
- *dst = - 0x8000;
- }
- else
- {
+ } else if (temp < -0x00008000) {
+ *dst = -0x8000;
+ } else {
*dst = (LVM_INT16)temp;
}
diff --git a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
index 05df656..0721b76 100644
--- a/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.cpp
@@ -25,19 +25,14 @@
FUNCTION JoinTo2i_32x32
***********************************************************************************/
-void JoinTo2i_32x32( const LVM_INT32 *srcL,
- const LVM_INT32 *srcR,
- LVM_INT32 *dst,
- LVM_INT16 n )
-{
+void JoinTo2i_32x32(const LVM_INT32* srcL, const LVM_INT32* srcR, LVM_INT32* dst, LVM_INT16 n) {
LVM_INT16 ii;
- srcL += n-1;
- srcR += n-1;
- dst += ((2*n)-1);
+ srcL += n - 1;
+ srcR += n - 1;
+ dst += ((2 * n) - 1);
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = *srcR;
dst--;
srcR--;
@@ -49,19 +44,14 @@
return;
}
-void JoinTo2i_Float( const LVM_FLOAT *srcL,
- const LVM_FLOAT *srcR,
- LVM_FLOAT *dst,
- LVM_INT16 n )
-{
+void JoinTo2i_Float(const LVM_FLOAT* srcL, const LVM_FLOAT* srcR, LVM_FLOAT* dst, LVM_INT16 n) {
LVM_INT16 ii;
srcL += n - 1;
srcR += n - 1;
- dst += ((2 * n) - 1);
+ dst += ((2 * n) - 1);
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = *srcR;
dst--;
srcR--;
@@ -74,4 +64,3 @@
return;
}
/**********************************************************************************/
-
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 d4f42de..8b00925 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
@@ -26,19 +26,15 @@
/**********************************************************************************
FUNCTION LVC_Core_MixHard_1St_2i_D16C31_SAT
***********************************************************************************/
-void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
- LVMixer3_FLOAT_st *ptrInstance2,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_FLOAT Temp;
+void LVC_Core_MixHard_1St_2i_D16C31_SAT(LVMixer3_FLOAT_st* ptrInstance1,
+ LVMixer3_FLOAT_st* ptrInstance2, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_FLOAT Temp;
LVM_INT16 ii;
- Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
- Mix_Private_FLOAT_st *pInstance2 = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
- for (ii = n; ii != 0; ii--)
- {
- Temp = ((LVM_FLOAT)*(src++) * (LVM_FLOAT)pInstance1->Current);
+ Mix_Private_FLOAT_st* pInstance1 = (Mix_Private_FLOAT_st*)(ptrInstance1->PrivateParams);
+ Mix_Private_FLOAT_st* pInstance2 = (Mix_Private_FLOAT_st*)(ptrInstance2->PrivateParams);
+ for (ii = n; ii != 0; ii--) {
+ Temp = ((LVM_FLOAT) * (src++) * (LVM_FLOAT)pInstance1->Current);
if (Temp > 1.0f)
*dst++ = 1.0f;
else if (Temp < -1.0f)
@@ -46,7 +42,7 @@
else
*dst++ = (LVM_FLOAT)Temp;
- Temp = ((LVM_FLOAT)*(src++) * (LVM_FLOAT)pInstance2->Current);
+ Temp = ((LVM_FLOAT) * (src++) * (LVM_FLOAT)pInstance2->Current);
if (Temp > 1.0f)
*dst++ = 1.0f;
else if (Temp < -1.0f)
@@ -54,22 +50,15 @@
else
*dst++ = (LVM_FLOAT)Temp;
}
-
}
-void LVC_Core_MixHard_1St_MC_float_SAT (Mix_Private_FLOAT_st **ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
-{
- LVM_FLOAT Temp;
+void LVC_Core_MixHard_1St_MC_float_SAT(Mix_Private_FLOAT_st** ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels) {
+ LVM_FLOAT Temp;
LVM_INT16 ii, jj;
- for (ii = NrFrames; ii != 0; ii--)
- {
- for (jj = 0; jj < NrChannels; jj++)
- {
- Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance[jj]);
- Temp = ((LVM_FLOAT)*(src++) * (LVM_FLOAT)pInstance1->Current);
+ for (ii = NrFrames; ii != 0; ii--) {
+ for (jj = 0; jj < NrChannels; jj++) {
+ Mix_Private_FLOAT_st* pInstance1 = (Mix_Private_FLOAT_st*)(ptrInstance[jj]);
+ Temp = ((LVM_FLOAT) * (src++) * (LVM_FLOAT)pInstance1->Current);
if (Temp > 1.0f)
*dst++ = 1.0f;
else if (Temp < -1.0f)
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 841fa1e..31cd805 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,26 +24,22 @@
/**********************************************************************************
FUNCTION LVCore_MIXHARD_2ST_D16C31_SAT
***********************************************************************************/
-void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
- LVMixer3_FLOAT_st *ptrInstance2,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_FLOAT Temp;
+void LVC_Core_MixHard_2St_D16C31_SAT(LVMixer3_FLOAT_st* ptrInstance1,
+ LVMixer3_FLOAT_st* ptrInstance2, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_FLOAT Temp;
LVM_INT16 ii;
LVM_FLOAT Current1;
LVM_FLOAT Current2;
- Mix_Private_FLOAT_st *pInstance1 = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
- Mix_Private_FLOAT_st *pInstance2 = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
+ 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);
- for (ii = n; ii != 0; ii--){
- Temp = (((LVM_FLOAT)*(src1++) * (LVM_FLOAT)Current1)) +
- (((LVM_FLOAT)*(src2++) * (LVM_FLOAT)Current2));
+ for (ii = n; ii != 0; ii--) {
+ Temp = (((LVM_FLOAT) * (src1++) * (LVM_FLOAT)Current1)) +
+ (((LVM_FLOAT) * (src2++) * (LVM_FLOAT)Current2));
if (Temp > 1.0f)
*dst++ = 1.0f;
else if (Temp < -1.0f)
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 7d13d5c..b7865d9 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,33 +25,28 @@
/**********************************************************************************
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
***********************************************************************************/
-void LVC_Core_MixInSoft_D16C31_SAT(LVMixer3_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
-
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 ii,jj;
- Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)(ptrInstance->PrivateParams);
- LVM_FLOAT Delta = pInstance->Delta;
- LVM_FLOAT Current = pInstance->Current;
- LVM_FLOAT Target = pInstance->Target;
- LVM_FLOAT Temp;
+void LVC_Core_MixInSoft_D16C31_SAT(LVMixer3_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii, jj;
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)(ptrInstance->PrivateParams);
+ LVM_FLOAT Delta = pInstance->Delta;
+ LVM_FLOAT Current = pInstance->Current;
+ LVM_FLOAT Target = pInstance->Target;
+ LVM_FLOAT Temp;
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
OutLoop = (LVM_INT16)(n - (InLoop << 2));
- if(Current < Target){
- if (OutLoop){
+ if (Current < Target) {
+ if (OutLoop) {
Temp = Current + Delta;
Current = Temp;
- if (Current > Target)
- Current = Target;
+ if (Current > Target) Current = Target;
- for (ii = OutLoop; ii != 0; ii--){
- Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ for (ii = OutLoop; ii != 0; ii--) {
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT) * (src++) * Current));
if (Temp > 1.0f)
*dst++ = 1.0f;
else if (Temp < -1.0f)
@@ -61,14 +56,13 @@
}
}
- for (ii = InLoop; ii != 0; ii--){
+ for (ii = InLoop; ii != 0; ii--) {
Temp = Current + Delta;
Current = Temp;
- if (Current > Target)
- Current = Target;
+ if (Current > Target) Current = Target;
- for (jj = 4; jj != 0 ; jj--){
- Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ for (jj = 4; jj != 0; jj--) {
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT) * (src++) * Current));
if (Temp > 1.0f)
*dst++ = 1.0f;
else if (Temp < -1.0f)
@@ -77,15 +71,13 @@
*dst++ = (LVM_FLOAT)Temp;
}
}
- }
- else{
- if (OutLoop){
+ } else {
+ if (OutLoop) {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
- for (ii = OutLoop; ii != 0; ii--){
- Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ for (ii = OutLoop; ii != 0; ii--) {
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT) * (src++) * Current));
if (Temp > 1.0f)
*dst++ = 1.0f;
else if (Temp < -1.0f)
@@ -95,13 +87,12 @@
}
}
- for (ii = InLoop; ii != 0; ii--){
+ for (ii = InLoop; ii != 0; ii--) {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
- for (jj = 4; jj != 0 ; jj--){
- Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT)*(src++) * Current));
+ for (jj = 4; jj != 0; jj--) {
+ Temp = ((LVM_FLOAT)*dst) + (((LVM_FLOAT) * (src++) * Current));
if (Temp > 1.0f)
*dst++ = 1.0f;
else if (Temp < -1.0f)
@@ -130,21 +121,16 @@
* void
*
*/
-void LVC_Core_MixInSoft_Mc_D16C31_SAT(LVMixer3_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
-{
-
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 ii, jj;
- Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)(ptrInstance->PrivateParams);
- LVM_FLOAT Delta = pInstance->Delta;
- LVM_FLOAT Current = pInstance->Current;
- LVM_FLOAT Target = pInstance->Target;
- LVM_FLOAT Temp;
+void LVC_Core_MixInSoft_Mc_D16C31_SAT(LVMixer3_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels) {
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii, jj;
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)(ptrInstance->PrivateParams);
+ LVM_FLOAT Delta = pInstance->Delta;
+ LVM_FLOAT Current = pInstance->Current;
+ LVM_FLOAT Target = pInstance->Target;
+ LVM_FLOAT Temp;
/*
* Same operation is performed on consecutive frames.
@@ -159,10 +145,9 @@
if (OutLoop) {
Temp = Current + Delta;
Current = Temp;
- if (Current > Target)
- Current = Target;
+ if (Current > Target) Current = Target;
- for (ii = OutLoop*NrChannels; ii != 0; ii--) {
+ for (ii = OutLoop * NrChannels; ii != 0; ii--) {
Temp = (*dst) + (*(src++) * Current);
if (Temp > 1.0f)
*dst++ = 1.0f;
@@ -176,10 +161,9 @@
for (ii = InLoop; ii != 0; ii--) {
Temp = Current + Delta;
Current = Temp;
- if (Current > Target)
- Current = Target;
+ if (Current > Target) Current = Target;
- for (jj = NrChannels; jj != 0 ; jj--) {
+ for (jj = NrChannels; jj != 0; jj--) {
Temp = (*dst) + (*(src++) * Current);
if (Temp > 1.0f)
*dst++ = 1.0f;
@@ -195,17 +179,14 @@
*dst++ = -1.0f;
else
*dst++ = Temp;
-
}
}
- }
- else{
+ } else {
if (OutLoop) {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
- for (ii = OutLoop*NrChannels; ii != 0; ii--) {
+ for (ii = OutLoop * NrChannels; ii != 0; ii--) {
Temp = (*dst) + (*(src++) * Current);
if (Temp > 1.0f)
*dst++ = 1.0f;
@@ -218,10 +199,9 @@
for (ii = InLoop; ii != 0; ii--) {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
- for (jj = NrChannels; jj != 0 ; jj--) {
+ for (jj = NrChannels; jj != 0; jj--) {
Temp = (*dst) + (*(src++) * Current);
if (Temp > 1.0f)
*dst++ = 1.0f;
@@ -237,7 +217,6 @@
*dst++ = -1.0f;
else
*dst++ = Temp;
-
}
}
}
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 784f339..d45845a 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,12 +26,9 @@
/**********************************************************************************
FUNCTION LVC_Core_MixSoft_1St_2i_D16C31_WRA
***********************************************************************************/
-static LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a,
- LVM_FLOAT b,
- LVM_FLOAT c)
-{
+static LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a, LVM_FLOAT b, LVM_FLOAT c) {
LVM_FLOAT temp;
- temp = a + b ;
+ temp = a + b;
if (temp < -1.0f)
c = -1.0f;
else if (temp > 1.0f)
@@ -40,151 +37,111 @@
c = temp;
return c;
}
-void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance1,
- LVMixer3_FLOAT_st *ptrInstance2,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 ii;
- Mix_Private_FLOAT_st *pInstanceL = (Mix_Private_FLOAT_st *)(ptrInstance1->PrivateParams);
- Mix_Private_FLOAT_st *pInstanceR = (Mix_Private_FLOAT_st *)(ptrInstance2->PrivateParams);
+void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1,
+ LVMixer3_FLOAT_st* ptrInstance2, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii;
+ Mix_Private_FLOAT_st* pInstanceL = (Mix_Private_FLOAT_st*)(ptrInstance1->PrivateParams);
+ Mix_Private_FLOAT_st* pInstanceR = (Mix_Private_FLOAT_st*)(ptrInstance2->PrivateParams);
- LVM_FLOAT DeltaL = pInstanceL->Delta;
- LVM_FLOAT CurrentL = pInstanceL->Current;
- LVM_FLOAT TargetL = pInstanceL->Target;
+ LVM_FLOAT DeltaL = pInstanceL->Delta;
+ LVM_FLOAT CurrentL = pInstanceL->Current;
+ LVM_FLOAT TargetL = pInstanceL->Target;
- LVM_FLOAT DeltaR = pInstanceR->Delta;
- LVM_FLOAT CurrentR = pInstanceR->Current;
- LVM_FLOAT TargetR = pInstanceR->Target;
+ LVM_FLOAT DeltaR = pInstanceR->Delta;
+ LVM_FLOAT CurrentR = pInstanceR->Current;
+ LVM_FLOAT TargetR = pInstanceR->Target;
- LVM_FLOAT Temp = 0;
+ LVM_FLOAT Temp = 0;
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
OutLoop = (LVM_INT16)(n - (InLoop << 2));
- if (OutLoop)
- {
- if(CurrentL < TargetL)
- {
+ if (OutLoop) {
+ if (CurrentL < TargetL) {
ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp);
CurrentL = Temp;
- if (CurrentL > TargetL)
- CurrentL = TargetL;
- }
- else
- {
+ if (CurrentL > TargetL) CurrentL = TargetL;
+ } else {
CurrentL -= DeltaL;
- if (CurrentL < TargetL)
- CurrentL = TargetL;
+ if (CurrentL < TargetL) CurrentL = TargetL;
}
- if(CurrentR < TargetR)
- {
+ if (CurrentR < TargetR) {
ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp);
CurrentR = Temp;
- if (CurrentR > TargetR)
- CurrentR = TargetR;
- }
- else
- {
+ if (CurrentR > TargetR) CurrentR = TargetR;
+ } else {
CurrentR -= DeltaR;
- if (CurrentR < TargetR)
- CurrentR = TargetR;
+ if (CurrentR < TargetR) CurrentR = TargetR;
}
- for (ii = OutLoop * 2; ii != 0; ii -= 2)
- {
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
+ for (ii = OutLoop * 2; ii != 0; ii -= 2) {
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentR));
}
}
- for (ii = InLoop * 2; ii != 0; ii-=2)
- {
- if(CurrentL < TargetL)
- {
+ for (ii = InLoop * 2; ii != 0; ii -= 2) {
+ if (CurrentL < TargetL) {
ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp);
CurrentL = Temp;
- if (CurrentL > TargetL)
- CurrentL = TargetL;
- }
- else
- {
+ if (CurrentL > TargetL) CurrentL = TargetL;
+ } else {
CurrentL -= DeltaL;
- if (CurrentL < TargetL)
- CurrentL = TargetL;
+ if (CurrentL < TargetL) CurrentL = TargetL;
}
- if(CurrentR < TargetR)
- {
+ if (CurrentR < TargetR) {
ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp);
CurrentR = Temp;
- if (CurrentR > TargetR)
- CurrentR = TargetR;
- }
- else
- {
+ if (CurrentR > TargetR) CurrentR = TargetR;
+ } else {
CurrentR -= DeltaR;
- if (CurrentR < TargetR)
- CurrentR = TargetR;
+ if (CurrentR < TargetR) CurrentR = TargetR;
}
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentL));
- *(dst++) = (LVM_FLOAT)(((LVM_FLOAT)*(src++) * (LVM_FLOAT)CurrentR));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentR));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentR));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentR));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentL));
+ *(dst++) = (LVM_FLOAT)(((LVM_FLOAT) * (src++) * (LVM_FLOAT)CurrentR));
}
pInstanceL->Current = CurrentL;
pInstanceR->Current = CurrentR;
-
}
-void LVC_Core_MixSoft_1St_MC_float_WRA (Mix_Private_FLOAT_st **ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
-{
- LVM_INT32 ii, ch;
- LVM_FLOAT Temp =0.0f;
- LVM_FLOAT tempCurrent[NrChannels];
- for (ch = 0; ch < NrChannels; ch++)
- {
+void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st** ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels) {
+ LVM_INT32 ii, ch;
+ LVM_FLOAT Temp = 0.0f;
+ LVM_FLOAT tempCurrent[NrChannels];
+ for (ch = 0; ch < NrChannels; ch++) {
tempCurrent[ch] = ptrInstance[ch]->Current;
}
- for (ii = NrFrames; ii > 0; ii--)
- {
- for (ch = 0; ch < NrChannels; ch++)
- {
- Mix_Private_FLOAT_st *pInstance = ptrInstance[ch];
- const LVM_FLOAT Delta = pInstance->Delta;
- LVM_FLOAT Current = tempCurrent[ch];
- const LVM_FLOAT Target = pInstance->Target;
- if (Current < Target)
- {
+ for (ii = NrFrames; ii > 0; ii--) {
+ for (ch = 0; ch < NrChannels; ch++) {
+ Mix_Private_FLOAT_st* pInstance = ptrInstance[ch];
+ const LVM_FLOAT Delta = pInstance->Delta;
+ LVM_FLOAT Current = tempCurrent[ch];
+ const LVM_FLOAT Target = pInstance->Target;
+ if (Current < Target) {
ADD2_SAT_FLOAT(Current, Delta, Temp);
Current = Temp;
- if (Current > Target)
- Current = Target;
- }
- else
- {
+ if (Current > Target) Current = Target;
+ } else {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
}
*dst++ = *src++ * Current;
tempCurrent[ch] = Current;
}
}
- for (ch = 0; ch < NrChannels; ch++)
- {
+ for (ch = 0; ch < NrChannels; ch++) {
ptrInstance[ch]->Current = tempCurrent[ch];
}
}
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 57f037e..f8c0a9d 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,43 +26,37 @@
/**********************************************************************************
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
***********************************************************************************/
-void LVC_Core_MixSoft_1St_D16C31_WRA(LVMixer3_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 ii;
- Mix_Private_FLOAT_st *pInstance=(Mix_Private_FLOAT_st *)(ptrInstance->PrivateParams);
- LVM_FLOAT Delta= (LVM_FLOAT)pInstance->Delta;
- LVM_FLOAT Current = (LVM_FLOAT)pInstance->Current;
- LVM_FLOAT Target= (LVM_FLOAT)pInstance->Target;
- LVM_FLOAT Temp;
+void LVC_Core_MixSoft_1St_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii;
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)(ptrInstance->PrivateParams);
+ LVM_FLOAT Delta = (LVM_FLOAT)pInstance->Delta;
+ LVM_FLOAT Current = (LVM_FLOAT)pInstance->Current;
+ LVM_FLOAT Target = (LVM_FLOAT)pInstance->Target;
+ LVM_FLOAT Temp;
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
OutLoop = (LVM_INT16)(n - (InLoop << 2));
- if(Current<Target){
- if (OutLoop){
-
+ if (Current < Target) {
+ if (OutLoop) {
Temp = Current + Delta;
if (Temp > 1.0f)
Temp = 1.0f;
else if (Temp < -1.0f)
Temp = -1.0f;
- Current=Temp;
- if (Current > Target)
- Current = Target;
+ Current = Temp;
+ if (Current > Target) Current = Target;
- for (ii = OutLoop; ii != 0; ii--){
- *(dst++) = (((LVM_FLOAT)*(src++) * (LVM_FLOAT)Current));
+ for (ii = OutLoop; ii != 0; ii--) {
+ *(dst++) = (((LVM_FLOAT) * (src++) * (LVM_FLOAT)Current));
}
}
- for (ii = InLoop; ii != 0; ii--){
-
+ for (ii = InLoop; ii != 0; ii--) {
Temp = Current + Delta;
if (Temp > 1.0f)
@@ -70,39 +64,35 @@
else if (Temp < -1.0f)
Temp = -1.0f;
- Current=Temp;
- if (Current > Target)
- Current = Target;
+ Current = Temp;
+ if (Current > Target) Current = Target;
- *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
- *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
- *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
- *(dst++) = (((LVM_FLOAT)*(src++) * Current) );
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
}
- }
- else{
- if (OutLoop){
+ } else {
+ if (OutLoop) {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
- for (ii = OutLoop; ii != 0; ii--){
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ for (ii = OutLoop; ii != 0; ii--) {
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
}
}
- for (ii = InLoop; ii != 0; ii--){
+ for (ii = InLoop; ii != 0; ii--) {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
}
}
- pInstance->Current=Current;
+ pInstance->Current = Current;
}
/*
@@ -122,20 +112,16 @@
* void
*
*/
-void LVC_Core_MixSoft_Mc_D16C31_WRA(LVMixer3_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
-{
- LVM_INT16 OutLoop;
- LVM_INT16 InLoop;
- LVM_INT32 ii, jj;
- Mix_Private_FLOAT_st *pInstance=(Mix_Private_FLOAT_st *)(ptrInstance->PrivateParams);
- LVM_FLOAT Delta= (LVM_FLOAT)pInstance->Delta;
- LVM_FLOAT Current = (LVM_FLOAT)pInstance->Current;
- LVM_FLOAT Target= (LVM_FLOAT)pInstance->Target;
- LVM_FLOAT Temp;
+void LVC_Core_MixSoft_Mc_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels) {
+ LVM_INT16 OutLoop;
+ LVM_INT16 InLoop;
+ LVM_INT32 ii, jj;
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)(ptrInstance->PrivateParams);
+ LVM_FLOAT Delta = (LVM_FLOAT)pInstance->Delta;
+ LVM_FLOAT Current = (LVM_FLOAT)pInstance->Current;
+ LVM_FLOAT Target = (LVM_FLOAT)pInstance->Target;
+ LVM_FLOAT Temp;
/*
* Same operation is performed on consecutive frames.
@@ -146,28 +132,25 @@
/* OutLoop is calculated to handle cases where NrFrames value can be odd.*/
OutLoop = (LVM_INT16)(NrFrames - (InLoop << 1));
- if (Current<Target) {
+ if (Current < Target) {
if (OutLoop) {
-
Temp = Current + Delta;
if (Temp > 1.0f)
Temp = 1.0f;
else if (Temp < -1.0f)
Temp = -1.0f;
- Current=Temp;
- if (Current > Target)
- Current = Target;
+ Current = Temp;
+ if (Current > Target) Current = Target;
for (ii = OutLoop; ii != 0; ii--) {
- for (jj = NrChannels; jj !=0; jj--) {
- *(dst++) = (((LVM_FLOAT)*(src++) * (LVM_FLOAT)Current));
+ for (jj = NrChannels; jj != 0; jj--) {
+ *(dst++) = (((LVM_FLOAT) * (src++) * (LVM_FLOAT)Current));
}
}
}
for (ii = InLoop; ii != 0; ii--) {
-
Temp = Current + Delta;
if (Temp > 1.0f)
@@ -175,43 +158,37 @@
else if (Temp < -1.0f)
Temp = -1.0f;
- Current=Temp;
- if (Current > Target)
- Current = Target;
+ Current = Temp;
+ if (Current > Target) Current = Target;
- for (jj = NrChannels; jj != 0 ; jj--)
- {
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ for (jj = NrChannels; jj != 0; jj--) {
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
}
}
- }
- else{
+ } else {
if (OutLoop) {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
for (ii = OutLoop; ii != 0; ii--) {
- for (jj = NrChannels; jj !=0; jj--) {
- *(dst++) = (((LVM_FLOAT)*(src++) * (LVM_FLOAT)Current));
+ for (jj = NrChannels; jj != 0; jj--) {
+ *(dst++) = (((LVM_FLOAT) * (src++) * (LVM_FLOAT)Current));
}
}
}
for (ii = InLoop; ii != 0; ii--) {
Current -= Delta;
- if (Current < Target)
- Current = Target;
+ if (Current < Target) Current = Target;
- for (jj = NrChannels; jj != 0 ; jj--)
- {
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
- *(dst++) = (((LVM_FLOAT)*(src++) * Current));
+ for (jj = NrChannels; jj != 0; jj--) {
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
+ *(dst++) = (((LVM_FLOAT) * (src++) * Current));
}
}
}
- pInstance->Current=Current;
+ pInstance->Current = Current;
}
/**********************************************************************************/
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 ede6dee..270c7e0 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
@@ -27,39 +27,35 @@
DEFINITIONS
***********************************************************************************/
-#define TRUE 1
-#define FALSE 0
+#define TRUE 1
+#define FALSE 0
/**********************************************************************************
FUNCTION MIXINSOFT_D16C31_SAT
***********************************************************************************/
-void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_FLOAT TargetGain;
- Mix_Private_FLOAT_st *pInstance = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n) {
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st* pInstance =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[0].PrivateParams);
- if(n <= 0) return;
+ if (n <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Delta == 1.0f){
+ if (pInstance->Current != pInstance->Target) {
+ if (pInstance->Delta == 1.0f) {
pInstance->Current = pInstance->Target;
TargetGain = pInstance->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ } else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta) {
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }else{
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
LVC_Core_MixInSoft_D16C31_SAT(&(ptrInstance->MixerStream[0]), src, dst, n);
@@ -70,12 +66,11 @@
HARD MIXING
*******************************************************************************/
- if (HardMixing){
- if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
- if ((pInstance->Target) == 1.0f){
+ if (HardMixing) {
+ if (pInstance->Target != 0) { /* Nothing to do in case Target = 0 */
+ if ((pInstance->Target) == 1.0f) {
Add2_Sat_Float(src, dst, n);
- }
- else{
+ } else {
Mac3s_Sat_Float(src, (pInstance->Target), dst, n);
/* In case the LVCore function would have changed the Current value */
pInstance->Current = pInstance->Target;
@@ -87,22 +82,21 @@
CALL BACK
*******************************************************************************/
- if (ptrInstance->MixerStream[0].CallbackSet){
- if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ if (ptrInstance->MixerStream[0].CallbackSet) {
+ if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta) {
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance->Target;
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 );
+ if (ptrInstance->MixerStream[0].pCallBack != 0) {
+ (*ptrInstance->MixerStream[0].pCallBack)(
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam);
}
}
}
-
}
/*
@@ -122,40 +116,32 @@
* void
*
*/
-void LVC_MixInSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
-{
- char HardMixing = TRUE;
- LVM_FLOAT TargetGain;
- Mix_Private_FLOAT_st *pInstance = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+void LVC_MixInSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels) {
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st* pInstance =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[0].PrivateParams);
- if (NrFrames <= 0) return;
+ if (NrFrames <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
+ if (pInstance->Current != pInstance->Target) {
if (pInstance->Delta == 1.0f) {
pInstance->Current = pInstance->Target;
TargetGain = pInstance->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta) {
+ } else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta) {
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }else{
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
- LVC_Core_MixInSoft_Mc_D16C31_SAT(&(ptrInstance->MixerStream[0]),
- src,
- dst,
- NrFrames,
+ LVC_Core_MixInSoft_Mc_D16C31_SAT(&(ptrInstance->MixerStream[0]), src, dst, NrFrames,
NrChannels);
}
}
@@ -167,13 +153,9 @@
if (HardMixing) {
if (pInstance->Target != 0) { /* Nothing to do in case Target = 0 */
if ((pInstance->Target) == 1.0f) {
- Add2_Sat_Float(src, dst, NrFrames*NrChannels);
- }
- else{
- Mac3s_Sat_Float(src,
- (pInstance->Target),
- dst,
- NrFrames * NrChannels);
+ Add2_Sat_Float(src, dst, NrFrames * NrChannels);
+ } else {
+ Mac3s_Sat_Float(src, (pInstance->Target), dst, NrFrames * NrChannels);
/* In case the LVCore function would have changed the Current value */
pInstance->Current = pInstance->Target;
}
@@ -192,14 +174,13 @@
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);
+ (*ptrInstance->MixerStream[0].pCallBack)(
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam);
}
}
}
-
}
/**********************************************************************************/
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 8fced60..c74c8c6 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
@@ -29,8 +29,8 @@
DEFINITIONS
***********************************************************************************/
-#define TRUE 1
-#define FALSE 0
+#define TRUE 1
+#define FALSE 0
#define ARRAY_SIZE(a) ((sizeof(a)) / (sizeof(*(a))))
@@ -41,131 +41,105 @@
* front center and back center channels
*/
#define LVM_VOL_BAL_THR (0.000016f)
-void LVC_MixSoft_1St_MC_float_SAT (LVMixer3_2St_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT32 NrChannels,
- LVM_INT32 ChMask)
-{
- char HardMixing = TRUE;
- LVM_FLOAT TargetGain;
- Mix_Private_FLOAT_st Target_lfe = {LVM_MAXFLOAT, LVM_MAXFLOAT, LVM_MAXFLOAT};
- Mix_Private_FLOAT_st Target_ctr = {LVM_MAXFLOAT, LVM_MAXFLOAT, LVM_MAXFLOAT};
- Mix_Private_FLOAT_st *pInstance1 = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
- Mix_Private_FLOAT_st *pInstance2 = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[1].PrivateParams);
- Mix_Private_FLOAT_st *pMixPrivInst[4] = {pInstance1, pInstance2, &Target_ctr, &Target_lfe};
- Mix_Private_FLOAT_st *pInstance[NrChannels];
+void LVC_MixSoft_1St_MC_float_SAT(LVMixer3_2St_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT32 NrChannels,
+ LVM_INT32 ChMask) {
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st Target_lfe = {LVM_MAXFLOAT, LVM_MAXFLOAT, LVM_MAXFLOAT};
+ Mix_Private_FLOAT_st Target_ctr = {LVM_MAXFLOAT, LVM_MAXFLOAT, LVM_MAXFLOAT};
+ Mix_Private_FLOAT_st* pInstance1 =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[0].PrivateParams);
+ Mix_Private_FLOAT_st* pInstance2 =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[1].PrivateParams);
+ Mix_Private_FLOAT_st* pMixPrivInst[4] = {pInstance1, pInstance2, &Target_ctr, &Target_lfe};
+ Mix_Private_FLOAT_st* pInstance[NrChannels];
- if (audio_channel_mask_get_representation(ChMask)
- == AUDIO_CHANNEL_REPRESENTATION_INDEX)
- {
- for (int i = 0; i < 2; i++)
- {
+ if (audio_channel_mask_get_representation(ChMask) == AUDIO_CHANNEL_REPRESENTATION_INDEX) {
+ for (int i = 0; i < 2; i++) {
pInstance[i] = pMixPrivInst[i];
}
- for (int i = 2; i < NrChannels; i++)
- {
+ for (int i = 2; i < NrChannels; i++) {
pInstance[i] = pMixPrivInst[2];
}
- }
- else
- {
+ } else {
// TODO: Combine with system/media/audio_utils/Balance.cpp
// Constants in system/media/audio/include/system/audio-base.h
// 'mixInstIdx' is used to map the appropriate mixer instance for each channel.
const int mixInstIdx[] = {
- 0, // AUDIO_CHANNEL_OUT_FRONT_LEFT = 0x1u,
- 1, // AUDIO_CHANNEL_OUT_FRONT_RIGHT = 0x2u,
- 2, // AUDIO_CHANNEL_OUT_FRONT_CENTER = 0x4u,
- 3, // AUDIO_CHANNEL_OUT_LOW_FREQUENCY = 0x8u,
- 0, // AUDIO_CHANNEL_OUT_BACK_LEFT = 0x10u,
- 1, // AUDIO_CHANNEL_OUT_BACK_RIGHT = 0x20u,
- 0, // AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40u,
- 1, // AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80u,
- 2, // AUDIO_CHANNEL_OUT_BACK_CENTER = 0x100u,
- 0, // AUDIO_CHANNEL_OUT_SIDE_LEFT = 0x200u,
- 1, // AUDIO_CHANNEL_OUT_SIDE_RIGHT = 0x400u,
- 2, // AUDIO_CHANNEL_OUT_TOP_CENTER = 0x800u,
- 0, // AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000u,
- 2, // AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000u,
- 1, // AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000u,
- 0, // AUDIO_CHANNEL_OUT_TOP_BACK_LEFT = 0x8000u,
- 2, // AUDIO_CHANNEL_OUT_TOP_BACK_CENTER = 0x10000u,
- 1, // AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000u,
- 0, // AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT = 0x40000u,
- 1, // AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT = 0x80000u
+ 0, // AUDIO_CHANNEL_OUT_FRONT_LEFT = 0x1u,
+ 1, // AUDIO_CHANNEL_OUT_FRONT_RIGHT = 0x2u,
+ 2, // AUDIO_CHANNEL_OUT_FRONT_CENTER = 0x4u,
+ 3, // AUDIO_CHANNEL_OUT_LOW_FREQUENCY = 0x8u,
+ 0, // AUDIO_CHANNEL_OUT_BACK_LEFT = 0x10u,
+ 1, // AUDIO_CHANNEL_OUT_BACK_RIGHT = 0x20u,
+ 0, // AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40u,
+ 1, // AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80u,
+ 2, // AUDIO_CHANNEL_OUT_BACK_CENTER = 0x100u,
+ 0, // AUDIO_CHANNEL_OUT_SIDE_LEFT = 0x200u,
+ 1, // AUDIO_CHANNEL_OUT_SIDE_RIGHT = 0x400u,
+ 2, // AUDIO_CHANNEL_OUT_TOP_CENTER = 0x800u,
+ 0, // AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000u,
+ 2, // AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000u,
+ 1, // AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000u,
+ 0, // AUDIO_CHANNEL_OUT_TOP_BACK_LEFT = 0x8000u,
+ 2, // AUDIO_CHANNEL_OUT_TOP_BACK_CENTER = 0x10000u,
+ 1, // AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000u,
+ 0, // AUDIO_CHANNEL_OUT_TOP_SIDE_LEFT = 0x40000u,
+ 1, // AUDIO_CHANNEL_OUT_TOP_SIDE_RIGHT = 0x80000u
};
- if (pInstance1->Target <= LVM_VOL_BAL_THR ||
- pInstance2->Target <= LVM_VOL_BAL_THR)
- {
- Target_ctr.Target = 0.0f;
+ if (pInstance1->Target <= LVM_VOL_BAL_THR || pInstance2->Target <= LVM_VOL_BAL_THR) {
+ Target_ctr.Target = 0.0f;
Target_ctr.Current = 0.0f;
- Target_ctr.Delta = 0.0f;
+ Target_ctr.Delta = 0.0f;
}
const unsigned int idxArrSize = ARRAY_SIZE(mixInstIdx);
- for (unsigned int i = 0, channel = ChMask; channel !=0 ; ++i)
- {
+ for (unsigned int i = 0, channel = ChMask; channel != 0; ++i) {
const unsigned int idx = __builtin_ctz(channel);
- if (idx < idxArrSize)
- {
+ if (idx < idxArrSize) {
pInstance[i] = pMixPrivInst[mixInstIdx[idx]];
- }
- else
- {
+ } else {
pInstance[i] = pMixPrivInst[2];
}
channel &= ~(1 << idx);
}
}
- if (NrFrames <= 0) return;
+ if (NrFrames <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
if ((pInstance1->Current != pInstance1->Target) ||
- (pInstance2->Current != pInstance2->Target))
- {
+ (pInstance2->Current != pInstance2->Target)) {
// TODO: combine similar checks below.
- if (pInstance1->Delta == LVM_MAXFLOAT
- || Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta)
- {
+ if (pInstance1->Delta == LVM_MAXFLOAT ||
+ Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta) {
/* Difference is not significant anymore. Make them equal. */
pInstance1->Current = pInstance1->Target;
TargetGain = pInstance1->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }
- else
- {
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
}
- if (HardMixing == TRUE)
- {
- if (pInstance2->Delta == LVM_MAXFLOAT
- || Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta)
- {
+ if (HardMixing == TRUE) {
+ if (pInstance2->Delta == LVM_MAXFLOAT ||
+ Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta) {
/* Difference is not significant anymore. Make them equal. */
pInstance2->Current = pInstance2->Target;
TargetGain = pInstance2->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]), TargetGain);
- }
- else
- {
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
}
}
- if (HardMixing == FALSE)
- {
- LVC_Core_MixSoft_1St_MC_float_WRA (&pInstance[0],
- src, dst, NrFrames, NrChannels);
+ if (HardMixing == FALSE) {
+ LVC_Core_MixSoft_1St_MC_float_WRA(&pInstance[0], src, dst, NrFrames, NrChannels);
}
}
@@ -173,19 +147,13 @@
HARD MIXING
*******************************************************************************/
- if (HardMixing == TRUE)
- {
- if ((pInstance1->Target == LVM_MAXFLOAT) && (pInstance2->Target == LVM_MAXFLOAT))
- {
- if (src != dst)
- {
- Copy_Float(src, dst, NrFrames*NrChannels);
+ if (HardMixing == TRUE) {
+ if ((pInstance1->Target == LVM_MAXFLOAT) && (pInstance2->Target == LVM_MAXFLOAT)) {
+ if (src != dst) {
+ Copy_Float(src, dst, NrFrames * NrChannels);
}
- }
- else
- {
- LVC_Core_MixHard_1St_MC_float_SAT(&(pInstance[0]),
- src, dst, NrFrames, NrChannels);
+ } else {
+ LVC_Core_MixHard_1St_MC_float_SAT(&(pInstance[0]), src, dst, NrFrames, NrChannels);
}
}
@@ -193,108 +161,86 @@
CALL BACK
*******************************************************************************/
- if (ptrInstance->MixerStream[0].CallbackSet)
- {
- if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta)
- {
+ if (ptrInstance->MixerStream[0].CallbackSet) {
+ if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta) {
pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance1->Target;
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[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_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta)
- {
+ if (ptrInstance->MixerStream[1].CallbackSet) {
+ if (Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta) {
pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore.
Make them equal. */
TargetGain = pInstance2->Target;
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);
+ if (ptrInstance->MixerStream[1].pCallBack != 0) {
+ (*ptrInstance->MixerStream[1].pCallBack)(
+ ptrInstance->MixerStream[1].pCallbackHandle,
+ ptrInstance->MixerStream[1].pGeneralPurpose,
+ ptrInstance->MixerStream[1].CallbackParam);
}
}
}
}
-void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_FLOAT TargetGain;
- Mix_Private_FLOAT_st *pInstance1 = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
- Mix_Private_FLOAT_st *pInstance2 = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[1].PrivateParams);
+void LVC_MixSoft_1St_2i_D16C31_SAT(LVMixer3_2St_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n) {
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st* pInstance1 =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[0].PrivateParams);
+ Mix_Private_FLOAT_st* pInstance2 =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[1].PrivateParams);
- if(n <= 0) return;
+ if (n <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if ((pInstance1->Current != pInstance1->Target) || (pInstance2->Current != pInstance2->Target))
- {
- if(pInstance1->Delta == 1.0f)
- {
+ if ((pInstance1->Current != pInstance1->Target) ||
+ (pInstance2->Current != pInstance2->Target)) {
+ if (pInstance1->Delta == 1.0f) {
pInstance1->Current = pInstance1->Target;
TargetGain = pInstance1->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }
- else if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta)
- {
+ } else if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta) {
pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance1->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }
- else
- {
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
}
- if(HardMixing == TRUE)
- {
- if(pInstance2->Delta == 1.0f)
- {
+ if (HardMixing == TRUE) {
+ if (pInstance2->Delta == 1.0f) {
pInstance2->Current = pInstance2->Target;
TargetGain = pInstance2->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]), TargetGain);
- }
- else if (Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta)
- {
- pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. \
- Make them equal. */
+ } else if (Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta) {
+ pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore.
+ \ Make them equal. */
TargetGain = pInstance2->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]), TargetGain);
- }
- else
- {
+ } 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);
+ if (HardMixing == FALSE) {
+ LVC_Core_MixSoft_1St_2i_D16C31_WRA(&(ptrInstance->MixerStream[0]),
+ &(ptrInstance->MixerStream[1]), src, dst, n);
}
}
@@ -302,20 +248,14 @@
HARD MIXING
*******************************************************************************/
- if (HardMixing)
- {
- if ((pInstance1->Target == 1.0f) && (pInstance2->Target == 1.0f))
- {
- if(src != dst)
- {
+ if (HardMixing) {
+ if ((pInstance1->Target == 1.0f) && (pInstance2->Target == 1.0f)) {
+ if (src != dst) {
Copy_Float(src, dst, n);
}
- }
- else
- {
+ } else {
LVC_Core_MixHard_1St_2i_D16C31_SAT(&(ptrInstance->MixerStream[0]),
- &(ptrInstance->MixerStream[1]),
- src, dst, n);
+ &(ptrInstance->MixerStream[1]), src, dst, n);
}
}
@@ -323,39 +263,33 @@
CALL BACK
*******************************************************************************/
- if (ptrInstance->MixerStream[0].CallbackSet)
- {
- if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta)
- {
+ if (ptrInstance->MixerStream[0].CallbackSet) {
+ if (Abs_Float(pInstance1->Current - pInstance1->Target) < pInstance1->Delta) {
pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance1->Target;
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[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_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta)
- {
+ if (ptrInstance->MixerStream[1].CallbackSet) {
+ if (Abs_Float(pInstance2->Current - pInstance2->Target) < pInstance2->Delta) {
pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore.
Make them equal. */
TargetGain = pInstance2->Target;
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 );
+ if (ptrInstance->MixerStream[1].pCallBack != 0) {
+ (*ptrInstance->MixerStream[1].pCallBack)(
+ ptrInstance->MixerStream[1].pCallbackHandle,
+ ptrInstance->MixerStream[1].pGeneralPurpose,
+ ptrInstance->MixerStream[1].CallbackParam);
}
}
}
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 f893919..be19fa0 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
@@ -27,39 +27,35 @@
DEFINITIONS
***********************************************************************************/
-#define TRUE 1
-#define FALSE 0
+#define TRUE 1
+#define FALSE 0
/**********************************************************************************
FUNCTION LVMixer3_MIXSOFT_1ST_D16C31_SAT
***********************************************************************************/
-void LVC_MixSoft_1St_D16C31_SAT( LVMixer3_1St_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- char HardMixing = TRUE;
- LVM_FLOAT TargetGain;
- Mix_Private_FLOAT_st *pInstance = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+void LVC_MixSoft_1St_D16C31_SAT(LVMixer3_1St_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n) {
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st* pInstance =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[0].PrivateParams);
- if(n <= 0) return;
+ if (n <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Delta == 1.0f){
+ if (pInstance->Current != pInstance->Target) {
+ if (pInstance->Delta == 1.0f) {
pInstance->Current = pInstance->Target;
TargetGain = pInstance->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ } else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta) {
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }else{
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
LVC_Core_MixSoft_1St_D16C31_WRA(&(ptrInstance->MixerStream[0]), src, dst, n);
@@ -70,34 +66,33 @@
HARD MIXING
*******************************************************************************/
- if (HardMixing){
+ if (HardMixing) {
if (pInstance->Target == 0)
LoadConst_Float(0.0, dst, n);
else {
if ((pInstance->Target) != 1.0f)
Mult3s_Float(src, (pInstance->Target), dst, n);
- else if(src != dst)
+ else if (src != dst)
Copy_Float(src, dst, n);
}
-
}
/******************************************************************************
CALL BACK
*******************************************************************************/
- if (ptrInstance->MixerStream[0].CallbackSet){
- if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta){
+ if (ptrInstance->MixerStream[0].CallbackSet) {
+ if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta) {
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance->Target;
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 );
+ if (ptrInstance->MixerStream[0].pCallBack != 0) {
+ (*ptrInstance->MixerStream[0].pCallBack)(
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam);
}
}
}
@@ -119,40 +114,32 @@
* void
*
*/
-void LVC_MixSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
-{
- char HardMixing = TRUE;
- LVM_FLOAT TargetGain;
- Mix_Private_FLOAT_st *pInstance = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
+void LVC_MixSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels) {
+ char HardMixing = TRUE;
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st* pInstance =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[0].PrivateParams);
- if (NrFrames <= 0) return;
+ if (NrFrames <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
+ if (pInstance->Current != pInstance->Target) {
if (pInstance->Delta == 1.0f) {
pInstance->Current = pInstance->Target;
TargetGain = pInstance->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta) {
+ } else if (Abs_Float(pInstance->Current - pInstance->Target) < pInstance->Delta) {
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
Make them equal. */
TargetGain = pInstance->Target;
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]), TargetGain);
- }else{
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
- LVC_Core_MixSoft_Mc_D16C31_WRA(&(ptrInstance->MixerStream[0]),
- src,
- dst,
- NrFrames,
+ LVC_Core_MixSoft_Mc_D16C31_WRA(&(ptrInstance->MixerStream[0]), src, dst, NrFrames,
NrChannels);
}
}
@@ -170,7 +157,6 @@
else if (src != dst)
Copy_Float(src, dst, NrFrames * NrChannels);
}
-
}
/******************************************************************************
@@ -185,14 +171,13 @@
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);
+ (*ptrInstance->MixerStream[0].pCallBack)(
+ ptrInstance->MixerStream[0].pCallbackHandle,
+ ptrInstance->MixerStream[0].pGeneralPurpose,
+ ptrInstance->MixerStream[0].CallbackParam);
}
}
}
}
-
/**********************************************************************************/
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 2958637..882a8ce 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,45 +25,36 @@
/**********************************************************************************
FUNCTION LVC_MixSoft_2St_D16C31_SAT.c
***********************************************************************************/
-void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- Mix_Private_FLOAT_st *pInstance1 = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
- Mix_Private_FLOAT_st *pInstance2 = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[1].PrivateParams);
+void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st* ptrInstance, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 n) {
+ Mix_Private_FLOAT_st* pInstance1 =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[0].PrivateParams);
+ Mix_Private_FLOAT_st* pInstance2 =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[1].PrivateParams);
- if(n <= 0) return;
+ if (n <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if ((pInstance1->Current == pInstance1->Target) && (pInstance1->Current == 0)){
- LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[1]),
- src2, dst, n);
- }
- else if ((pInstance2->Current == pInstance2->Target) && (pInstance2->Current == 0)){
- LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[0]),
- src1, dst, n);
- }
- else if ((pInstance1->Current != pInstance1->Target) || \
- (pInstance2->Current != pInstance2->Target))
- {
- LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[0]),
- src1, dst, n);
- LVC_MixInSoft_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[1]),
- src2, dst, n);
- }
- else{
+ if ((pInstance1->Current == pInstance1->Target) && (pInstance1->Current == 0)) {
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st*)(&ptrInstance->MixerStream[1]), src2,
+ dst, n);
+ } else if ((pInstance2->Current == pInstance2->Target) && (pInstance2->Current == 0)) {
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st*)(&ptrInstance->MixerStream[0]), src1,
+ dst, n);
+ } else if ((pInstance1->Current != pInstance1->Target) ||
+ (pInstance2->Current != pInstance2->Target)) {
+ LVC_MixSoft_1St_D16C31_SAT((LVMixer3_1St_FLOAT_st*)(&ptrInstance->MixerStream[0]), src1,
+ dst, n);
+ LVC_MixInSoft_D16C31_SAT((LVMixer3_1St_FLOAT_st*)(&ptrInstance->MixerStream[1]), src2, dst,
+ n);
+ } else {
/******************************************************************************
HARD MIXING
*******************************************************************************/
- LVC_Core_MixHard_2St_D16C31_SAT( &ptrInstance->MixerStream[0],
- &ptrInstance->MixerStream[1],
- src1, src2, dst, n);
+ LVC_Core_MixHard_2St_D16C31_SAT(&ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1],
+ src1, src2, dst, n);
}
}
@@ -85,45 +76,36 @@
* void
*
*/
-void LVC_MixSoft_2Mc_D16C31_SAT(LVMixer3_2St_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
-{
- Mix_Private_FLOAT_st *pInstance1 = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[0].PrivateParams);
- Mix_Private_FLOAT_st *pInstance2 = \
- (Mix_Private_FLOAT_st *)(ptrInstance->MixerStream[1].PrivateParams);
+void LVC_MixSoft_2Mc_D16C31_SAT(LVMixer3_2St_FLOAT_st* ptrInstance, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 NrFrames,
+ LVM_INT16 NrChannels) {
+ Mix_Private_FLOAT_st* pInstance1 =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[0].PrivateParams);
+ Mix_Private_FLOAT_st* pInstance2 =
+ (Mix_Private_FLOAT_st*)(ptrInstance->MixerStream[1].PrivateParams);
- if (NrFrames <= 0) return;
+ if (NrFrames <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
if ((pInstance1->Current == pInstance1->Target) && (pInstance1->Current == 0)) {
- LVC_MixSoft_Mc_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[1]),
- src2, dst, NrFrames, NrChannels);
- }
- else if ((pInstance2->Current == pInstance2->Target) && (pInstance2->Current == 0)) {
- LVC_MixSoft_Mc_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[0]),
- src1, dst, NrFrames, NrChannels);
- }
- else if ((pInstance1->Current != pInstance1->Target) || \
- (pInstance2->Current != pInstance2->Target))
- {
- LVC_MixSoft_Mc_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[0]),
- src1, dst, NrFrames, NrChannels);
- LVC_MixInSoft_Mc_D16C31_SAT((LVMixer3_1St_FLOAT_st *)(&ptrInstance->MixerStream[1]),
- src2, dst, NrFrames, NrChannels);
- }
- else{
+ LVC_MixSoft_Mc_D16C31_SAT((LVMixer3_1St_FLOAT_st*)(&ptrInstance->MixerStream[1]), src2, dst,
+ NrFrames, NrChannels);
+ } else if ((pInstance2->Current == pInstance2->Target) && (pInstance2->Current == 0)) {
+ LVC_MixSoft_Mc_D16C31_SAT((LVMixer3_1St_FLOAT_st*)(&ptrInstance->MixerStream[0]), src1, dst,
+ NrFrames, NrChannels);
+ } else if ((pInstance1->Current != pInstance1->Target) ||
+ (pInstance2->Current != pInstance2->Target)) {
+ LVC_MixSoft_Mc_D16C31_SAT((LVMixer3_1St_FLOAT_st*)(&ptrInstance->MixerStream[0]), src1, dst,
+ NrFrames, NrChannels);
+ LVC_MixInSoft_Mc_D16C31_SAT((LVMixer3_1St_FLOAT_st*)(&ptrInstance->MixerStream[1]), src2,
+ dst, NrFrames, NrChannels);
+ } else {
/******************************************************************************
HARD MIXING
*******************************************************************************/
- LVC_Core_MixHard_2St_D16C31_SAT(&ptrInstance->MixerStream[0],
- &ptrInstance->MixerStream[1],
+ LVC_Core_MixHard_2St_D16C31_SAT(&ptrInstance->MixerStream[0], &ptrInstance->MixerStream[1],
src1, src2, dst, NrFrames * NrChannels);
}
}
diff --git a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
index 6206273..55255a6 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer.h
@@ -25,34 +25,31 @@
***********************************************************************************/
/* LVMixer3_st structure stores Instance parameters for one audio stream */
-typedef struct
-{
- LVM_FLOAT PrivateParams[3]; /* Private Instance params for \
- Audio Stream shift parameter */
- 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 */
+typedef struct {
+ LVM_FLOAT PrivateParams[3]; /* Private Instance params for \
+ Audio Stream shift parameter */
+ 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_FLOAT_st;
-typedef struct
-{
- LVMixer3_FLOAT_st MixerStream[1]; /* Instance Params for one Audio Stream */
+typedef struct {
+ LVMixer3_FLOAT_st MixerStream[1]; /* Instance Params for one Audio Stream */
} LVMixer3_1St_FLOAT_st;
-typedef struct
-{
- LVMixer3_FLOAT_st MixerStream[2]; /* Instance Params for two Audio Streams */
+typedef struct {
+ LVMixer3_FLOAT_st MixerStream[2]; /* Instance Params for two Audio Streams */
} LVMixer3_2St_FLOAT_st;
/**********************************************************************************
FUNCTION PROTOTYPES (HIGH LEVEL FUNCTIONS)
***********************************************************************************/
/* Function names should be unique within first 16 characters */
-#define LVMixer3_MixSoft_1St_D16C31_SAT LVMixer3_1St_D16C31_SAT_MixSoft
-#define LVMixer3_MixInSoft_D16C31_SAT LVMixer3_D16C31_SAT_MixInSoft
-#define LVMixer3_MixSoft_2St_D16C31_SAT LVMixer3_2St_D16C31_SAT_MixSoft
-#define LVMixer3_MixSoft_3St_D16C31_SAT LVMixer3_3St_D16C31_SAT_MixSoft
+#define LVMixer3_MixSoft_1St_D16C31_SAT LVMixer3_1St_D16C31_SAT_MixSoft
+#define LVMixer3_MixInSoft_D16C31_SAT LVMixer3_D16C31_SAT_MixInSoft
+#define LVMixer3_MixSoft_2St_D16C31_SAT LVMixer3_2St_D16C31_SAT_MixSoft
+#define LVMixer3_MixSoft_3St_D16C31_SAT LVMixer3_3St_D16C31_SAT_MixSoft
/*** General functions ************************************************************/
@@ -62,77 +59,52 @@
/* then the calculation will give an incorrect value for alpha, see the mixer */
/* documentation for further details. */
/* ********************************************************************************/
-void LVC_Mixer_SetTarget( LVMixer3_FLOAT_st *pStream,
- LVM_FLOAT TargetGain);
-LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream);
+void LVC_Mixer_SetTarget(LVMixer3_FLOAT_st* pStream, LVM_FLOAT TargetGain);
+LVM_FLOAT LVC_Mixer_GetTarget(LVMixer3_FLOAT_st* pStream);
-LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream);
+LVM_FLOAT LVC_Mixer_GetCurrent(LVMixer3_FLOAT_st* pStream);
-void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
- LVM_FLOAT TargetGain,
- LVM_FLOAT CurrentGain);
+void LVC_Mixer_Init(LVMixer3_FLOAT_st* pStream, LVM_FLOAT TargetGain, LVM_FLOAT CurrentGain);
-void LVC_Mixer_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels);
+void LVC_Mixer_SetTimeConstant(LVMixer3_FLOAT_st* pStream, LVM_INT32 Tc_millisec, LVM_Fs_en Fs,
+ LVM_INT16 NumChannels);
-void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels);
+void LVC_Mixer_VarSlope_SetTimeConstant(LVMixer3_FLOAT_st* pStream, LVM_INT32 Tc_millisec,
+ LVM_Fs_en Fs, LVM_INT16 NumChannels);
/*** 16 bit functions *************************************************************/
-void LVC_MixSoft_1St_D16C31_SAT(LVMixer3_1St_FLOAT_st *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void LVC_MixSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
+void LVC_MixSoft_1St_D16C31_SAT(LVMixer3_1St_FLOAT_st* pInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n);
+void LVC_MixSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st* pInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
-void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void LVC_MixInSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
+void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st* pInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n);
+void LVC_MixInSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st* pInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
-void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st *pInstance,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst, /* dst cannot be equal to src2 */
- LVM_INT16 n);
-void LVC_MixSoft_2Mc_D16C31_SAT(LVMixer3_2St_FLOAT_st *pInstance,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst, /* dst cannot be equal to src2 */
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
+void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st* pInstance, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2,
+ LVM_FLOAT* dst, /* dst cannot be equal to src2 */
+ LVM_INT16 n);
+void LVC_MixSoft_2Mc_D16C31_SAT(LVMixer3_2St_FLOAT_st* pInstance, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2,
+ LVM_FLOAT* dst, /* dst cannot be equal to src2 */
+ LVM_INT16 NrFrames, LVM_INT16 NrChannels);
/**********************************************************************************/
/* 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 */
/**********************************************************************************/
-void LVC_MixSoft_1St_MC_float_SAT(LVMixer3_2St_FLOAT_st *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst, /* dst can be equal to src */
- LVM_INT16 NrFrames,
- LVM_INT32 NrChannels,
- LVM_INT32 ChMask);
-void LVC_MixSoft_1St_2i_D16C31_SAT(LVMixer3_2St_FLOAT_st *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst, /* dst can be equal to src */
- LVM_INT16 n); /* Number of stereo samples */
+void LVC_MixSoft_1St_MC_float_SAT(LVMixer3_2St_FLOAT_st* pInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, /* dst can be equal to src */
+ LVM_INT16 NrFrames, LVM_INT32 NrChannels, LVM_INT32 ChMask);
+void LVC_MixSoft_1St_2i_D16C31_SAT(LVMixer3_2St_FLOAT_st* pInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, /* dst can be equal to src */
+ LVM_INT16 n); /* Number of stereo samples */
/**********************************************************************************/
-#endif //#ifndef __LVC_MIXER_H__
-
+#endif //#ifndef __LVC_MIXER_H__
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 d0b50e6..03de8b0 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetCurrent.cpp
@@ -30,10 +30,9 @@
/* CurrentGain - CurrentGain value in Q 16.15 format */
/* */
/************************************************************************/
-LVM_FLOAT LVC_Mixer_GetCurrent( LVMixer3_FLOAT_st *pStream)
-{
- LVM_FLOAT CurrentGain;
- Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+LVM_FLOAT LVC_Mixer_GetCurrent(LVMixer3_FLOAT_st* pStream) {
+ LVM_FLOAT CurrentGain;
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)pStream->PrivateParams;
CurrentGain = pInstance->Current; // CurrentGain
return CurrentGain;
}
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 3ae5ba4..21ebac1f 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_GetTarget.cpp
@@ -30,10 +30,9 @@
/* TargetGain - TargetGain value in Q 16.15 format */
/* */
/************************************************************************/
-LVM_FLOAT LVC_Mixer_GetTarget( LVMixer3_FLOAT_st *pStream)
-{
- LVM_FLOAT TargetGain;
- Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+LVM_FLOAT LVC_Mixer_GetTarget(LVMixer3_FLOAT_st* pStream) {
+ LVM_FLOAT TargetGain;
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)pStream->PrivateParams;
TargetGain = pInstance->Target; // TargetGain
return TargetGain;
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 c9fd344..e37f635 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Init.cpp
@@ -44,14 +44,10 @@
/* void */
/* */
/************************************************************************/
-void LVC_Mixer_Init( LVMixer3_FLOAT_st *pStream,
- LVM_FLOAT TargetGain,
- LVM_FLOAT CurrentGain)
-{
+void LVC_Mixer_Init(LVMixer3_FLOAT_st* pStream, LVM_FLOAT TargetGain, LVM_FLOAT CurrentGain) {
LVM_FLOAT MaxGain = TargetGain;
- Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
- if(CurrentGain > MaxGain)
- MaxGain = CurrentGain;
- pInstance->Target = TargetGain; // Update fractional gain Target
- pInstance->Current = CurrentGain; // Update fractional gain Current
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)pStream->PrivateParams;
+ if (CurrentGain > MaxGain) MaxGain = CurrentGain;
+ pInstance->Target = TargetGain; // Update fractional gain Target
+ pInstance->Current = CurrentGain; // Update fractional gain Current
}
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 7cba671..5f22d77 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_Private.h
@@ -26,50 +26,36 @@
#include "VectorArithmetic.h"
/* Instance parameter structure */
-typedef struct
-{
+typedef struct {
/* General */
- LVM_FLOAT Target; /*number specifying value of Target Gain */
- LVM_FLOAT Current; /*number specifying value of Current Gain */
- LVM_FLOAT Delta; /*number specifying value of Delta Gain */
+ LVM_FLOAT Target; /*number specifying value of Target Gain */
+ LVM_FLOAT Current; /*number specifying value of Current Gain */
+ LVM_FLOAT Delta; /*number specifying value of Delta Gain */
} Mix_Private_FLOAT_st;
/**********************************************************************************
DEFINITIONS
***********************************************************************************/
-#define LVCore_MixInSoft_D32C31_SAT LVCore_InSoft_D32C31_SAT
-#define LVCore_MixSoft_1St_D32C31_WRA LVCore_Soft_1St_D32C31_WRA
-#define LVCore_MixHard_2St_D32C31_SAT LVCore_Hard_2St_D32C31_SAT
+#define LVCore_MixInSoft_D32C31_SAT LVCore_InSoft_D32C31_SAT
+#define LVCore_MixSoft_1St_D32C31_WRA LVCore_Soft_1St_D32C31_WRA
+#define LVCore_MixHard_2St_D32C31_SAT LVCore_Hard_2St_D32C31_SAT
/**********************************************************************************
FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS)
***********************************************************************************/
/*** 16 bit functions *************************************************************/
-void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void LVC_Core_MixInSoft_Mc_D16C31_SAT(LVMixer3_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
-void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
-void LVC_Core_MixSoft_Mc_D16C31_WRA(LVMixer3_FLOAT_st *ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
-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);
+void LVC_Core_MixInSoft_D16C31_SAT(LVMixer3_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n);
+void LVC_Core_MixInSoft_Mc_D16C31_SAT(LVMixer3_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
+void LVC_Core_MixSoft_1St_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n);
+void LVC_Core_MixSoft_Mc_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
+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);
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
@@ -77,16 +63,11 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st **ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
-void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_FLOAT_st *ptrInstance1,
- LVMixer3_FLOAT_st *ptrInstance2,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
+void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st** ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
+void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1,
+ LVMixer3_FLOAT_st* ptrInstance2, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n);
/**********************************************************************************/
/* For applying different gains to Left and right chennals */
@@ -94,19 +75,13 @@
/* ptrInstance2 applies to Right channel */
/* Gain values should not be more that 1.0 */
/**********************************************************************************/
-void LVC_Core_MixHard_1St_MC_float_SAT(Mix_Private_FLOAT_st **ptrInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels);
-void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_FLOAT_st *ptrInstance1,
- LVMixer3_FLOAT_st *ptrInstance2,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n);
+void LVC_Core_MixHard_1St_MC_float_SAT(Mix_Private_FLOAT_st** ptrInstance, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
+void LVC_Core_MixHard_1St_2i_D16C31_SAT(LVMixer3_FLOAT_st* ptrInstance1,
+ LVMixer3_FLOAT_st* ptrInstance2, const LVM_FLOAT* src,
+ LVM_FLOAT* dst, LVM_INT16 n);
/*** 32 bit functions *************************************************************/
/**********************************************************************************/
-#endif //#ifndef __LVC_MIXER_PRIVATE_H__
-
+#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 47b0cec..d8015c4 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTarget.cpp
@@ -43,9 +43,7 @@
/* void */
/* */
/************************************************************************/
-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
+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
}
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 1a8da7a..715b908 100644
--- a/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVC_Mixer_SetTimeConstant.cpp
@@ -44,36 +44,33 @@
/* RETURNS: */
/* void */
/************************************************************************/
-void LVC_Mixer_SetTimeConstant(LVMixer3_FLOAT_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels)
-{
- LVM_FLOAT DeltaTable[13] = {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*/
- 0.045352f,/*88200*/
- 0.041667f,/*96000*/
- 0.022676f,/*176400*/
- 0.020833f};/*192000*/
+void LVC_Mixer_SetTimeConstant(LVMixer3_FLOAT_st* pStream, LVM_INT32 Tc_millisec, LVM_Fs_en Fs,
+ LVM_INT16 NumChannels) {
+ LVM_FLOAT DeltaTable[13] = {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*/
+ 0.045352f, /*88200*/
+ 0.041667f, /*96000*/
+ 0.022676f, /*176400*/
+ 0.020833f}; /*192000*/
- Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)pStream->PrivateParams;
LVM_FLOAT Delta = DeltaTable[Fs];
Delta = Delta / (NumChannels);
- if(Tc_millisec == 0)
+ if (Tc_millisec == 0)
Delta = 1.000000f;
else
Delta = Delta / Tc_millisec;
- if(Delta == 0)
- Delta = 0.0000000005f; /* If Time Constant is so large that Delta is 0, \
- assign minimum value to Delta */
+ if (Delta == 0)
+ Delta = 0.0000000005f; /* 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)
}
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 f335a1e..cf84613 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
@@ -44,57 +44,50 @@
/* RETURNS: */
/* void */
/************************************************************************/
-void LVC_Mixer_VarSlope_SetTimeConstant( LVMixer3_FLOAT_st *pStream,
- LVM_INT32 Tc_millisec,
- LVM_Fs_en Fs,
- LVM_INT16 NumChannels)
-{
- LVM_FLOAT DeltaTable[13] = {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*/
- 0.045352f,/*88200*/
- 0.041666f,/*96000*/
- 0.022676f,/*176400*/
- 0.020833f};/*192000*/
+void LVC_Mixer_VarSlope_SetTimeConstant(LVMixer3_FLOAT_st* pStream, LVM_INT32 Tc_millisec,
+ LVM_Fs_en Fs, LVM_INT16 NumChannels) {
+ LVM_FLOAT DeltaTable[13] = {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*/
+ 0.045352f, /*88200*/
+ 0.041666f, /*96000*/
+ 0.022676f, /*176400*/
+ 0.020833f}; /*192000*/
LVM_FLOAT Tc_millisec_float;
- Mix_Private_FLOAT_st *pInstance = (Mix_Private_FLOAT_st *)pStream->PrivateParams;
+ Mix_Private_FLOAT_st* pInstance = (Mix_Private_FLOAT_st*)pStream->PrivateParams;
LVM_FLOAT Delta = DeltaTable[Fs];
- LVM_FLOAT Current;
- LVM_FLOAT Target;
+ LVM_FLOAT Current;
+ LVM_FLOAT Target;
- Delta=Delta / (NumChannels);
+ Delta = Delta / (NumChannels);
/* Get gain values */
Current = pInstance->Current;
Target = pInstance->Target;
- if (Current != Target)
- {
+ if (Current != Target) {
Tc_millisec_float = (LVM_FLOAT)(Tc_millisec) / (Current - Target);
- if (Tc_millisec_float < 0)
- Tc_millisec_float = -Tc_millisec_float;
+ if (Tc_millisec_float < 0) Tc_millisec_float = -Tc_millisec_float;
- if(Tc_millisec == 0)
+ if (Tc_millisec == 0)
Delta = 1.000000f;
else
Delta = Delta / Tc_millisec_float;
- if(Delta == 0)
+ if (Delta == 0)
Delta = 0.0000000005f; /* If Time Constant is so large that Delta is 0, \
assign minimum value to Delta */
- }
- else
- {
- Delta = 0.0000000005f; /* Minimum value for proper call-backs \
- (setting it to zero has some problems, to be corrected) */
+ } else {
+ Delta = 0.0000000005f; /* 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)
+ pInstance->Delta = Delta; // Delta=(2147483647*4*1000)/(NumChannels*SampleRate*Tc_millisec)
}
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 2497d29..59095df 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_HPF.cpp
@@ -67,31 +67,19 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
-LVM_FLOAT LVM_FO_HPF( LVM_FLOAT w,
- FO_FLOAT_Coefs_t *pCoeffs)
-{
- LVM_FLOAT Y,Coefficients[13] = {-0.999996f,
- 0.999801f,
- -0.497824f,
- 0.322937f,
- -0.180880f,
- 0.087658f,
- -0.032102f,
- 0.008163f,
- -0.001252f,
- 0.000089f,
- 0,
- 0,
- 0};
- Y=LVM_Polynomial((LVM_UINT16)9, Coefficients, w);
+LVM_FLOAT LVM_FO_HPF(LVM_FLOAT w, FO_FLOAT_Coefs_t* pCoeffs) {
+ LVM_FLOAT Y, Coefficients[13] = {-0.999996f, 0.999801f, -0.497824f, 0.322937f, -0.180880f,
+ 0.087658f, -0.032102f, 0.008163f, -0.001252f, 0.000089f,
+ 0, 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 / 2.0f; /* A0=Y=B1/2*/
- Y = Y - 0.5f; /* A0=Y=(B1/2 - 0.5)*/
+ pCoeffs->B1 = -Y; /* Store -B1 in filter structure instead of B1!*/
+ /* A0=(1-B1)/2= B1/2 - 0.5*/
+ Y = Y / 2.0f; /* A0=Y=B1/2*/
+ Y = Y - 0.5f; /* A0=Y=(B1/2 - 0.5)*/
- pCoeffs->A0 = Y * FILTER_LOSS_FLOAT; /* Apply loss to avoid overflow*/
- pCoeffs->A1 = -pCoeffs->A0; /* Store A1=-A0*/
+ pCoeffs->A0 = Y * FILTER_LOSS_FLOAT; /* Apply loss to avoid overflow*/
+ pCoeffs->A1 = -pCoeffs->A0; /* Store A1=-A0*/
return 1;
}
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 7bc6046..91964fb 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_FO_LPF.cpp
@@ -67,25 +67,15 @@
/* RETURNS: */
/* */
/*-------------------------------------------------------------------------*/
-LVM_FLOAT LVM_FO_LPF( LVM_FLOAT w,
- FO_FLOAT_Coefs_t *pCoeffs)
-{
- LVM_FLOAT Y,Coefficients[13] = {-0.999996f,
- 0.999801f,
- -0.497824f,
- 0.322937f,
- -0.180880f,
- 0.087658f,
- -0.032102f,
- 0.008163f,
- -0.001252f,
- 0.000089f,
- 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 / 2.0f; // A0=Y=B1/2
- Y = Y + 0.5f; // A0=Y=(B1/2 + 0.5)
+LVM_FLOAT LVM_FO_LPF(LVM_FLOAT w, FO_FLOAT_Coefs_t* pCoeffs) {
+ LVM_FLOAT Y,
+ Coefficients[13] = {-0.999996f, 0.999801f, -0.497824f, 0.322937f, -0.180880f, 0.087658f,
+ -0.032102f, 0.008163f, -0.001252f, 0.000089f, 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 / 2.0f; // A0=Y=B1/2
+ Y = Y + 0.5f; // A0=Y=(B1/2 + 0.5)
pCoeffs->A0 = Y * FILTER_LOSS_FLOAT;
pCoeffs->A1 = pCoeffs->A0;
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
index 2a7cca2..5f25677 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_GetOmega.cpp
@@ -25,41 +25,32 @@
/* */
/************************************************************************************/
-#define LVVDL_2PiBy_8000 1727108826 /* In Q41 format */
-#define LVVDL_2PiBy_11025 1253230894 /* In Q41 format */
-#define LVVDL_2PiBy_12000 1151405884 /* In Q41 format */
+#define LVVDL_2PiBy_8000 1727108826 /* In Q41 format */
+#define LVVDL_2PiBy_11025 1253230894 /* In Q41 format */
+#define LVVDL_2PiBy_12000 1151405884 /* In Q41 format */
-#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 */
-#define LVVDL_2PiBy_8000_f 0.000785398f
-#define LVVDL_2PiBy_11025_f 0.000569903f
-#define LVVDL_2PiBy_12000_f 0.000523599f
-#define LVVDL_2PiBy_16000_f 0.000392700f
-#define LVVDL_2PiBy_22050_f 0.000284952f
-#define LVVDL_2PiBy_24000_f 0.000261800f
-#define LVVDL_2PiBy_32000_f 0.000196350f
-#define LVVDL_2PiBy_44100_f 0.000142476f
-#define LVVDL_2PiBy_48000_f 0.000130900f
+#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 */
+#define LVVDL_2PiBy_8000_f 0.000785398f
+#define LVVDL_2PiBy_11025_f 0.000569903f
+#define LVVDL_2PiBy_12000_f 0.000523599f
+#define LVVDL_2PiBy_16000_f 0.000392700f
+#define LVVDL_2PiBy_22050_f 0.000284952f
+#define LVVDL_2PiBy_24000_f 0.000261800f
+#define LVVDL_2PiBy_32000_f 0.000196350f
+#define LVVDL_2PiBy_44100_f 0.000142476f
+#define LVVDL_2PiBy_48000_f 0.000130900f
-#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
-const LVM_FLOAT LVVDL_2PiOnFsTable[] = {LVVDL_2PiBy_8000_f,
- LVVDL_2PiBy_11025_f,
- LVVDL_2PiBy_12000_f,
- LVVDL_2PiBy_16000_f,
- LVVDL_2PiBy_22050_f,
- LVVDL_2PiBy_24000_f,
- LVVDL_2PiBy_32000_f,
- LVVDL_2PiBy_44100_f,
- LVVDL_2PiBy_48000_f
- ,LVVDL_2PiBy_88200_f
- ,LVVDL_2PiBy_96000_f
- ,LVVDL_2PiBy_176400_f
- ,LVVDL_2PiBy_192000_f
- };
+#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
+const LVM_FLOAT LVVDL_2PiOnFsTable[] = {
+ LVVDL_2PiBy_8000_f, LVVDL_2PiBy_11025_f, LVVDL_2PiBy_12000_f, LVVDL_2PiBy_16000_f,
+ LVVDL_2PiBy_22050_f, LVVDL_2PiBy_24000_f, LVVDL_2PiBy_32000_f, LVVDL_2PiBy_44100_f,
+ LVVDL_2PiBy_48000_f, LVVDL_2PiBy_88200_f, LVVDL_2PiBy_96000_f, LVVDL_2PiBy_176400_f,
+ LVVDL_2PiBy_192000_f};
/*-------------------------------------------------------------------------*/
/* FUNCTION: */
/* LVM_GetOmega */
@@ -77,10 +68,8 @@
/* RETURNS: */
/* w=2*pi*Fc/Fs in Q2.29 format */
/*-------------------------------------------------------------------------*/
-LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc,
- LVM_Fs_en Fs)
-{
- LVM_FLOAT w;
+LVM_FLOAT LVM_GetOmega(LVM_UINT32 Fc, LVM_Fs_en Fs) {
+ LVM_FLOAT w;
w = (LVM_FLOAT)Fc * LVVDL_2PiOnFsTable[Fs];
return w;
}
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 244f09d..31dcaa4 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_FilterCoeffs.h
@@ -33,109 +33,109 @@
/* */
/************************************************************************************/
-#define Alpha_TableSize 50 /* The number of table entires */
-#define ALPHA_0 2147480769 /* Floating point Alpha = 0.999999 */
-#define ALPHA_1 2147479577 /* Floating point Alpha = 0.999998 */
-#define ALPHA_2 2147477892 /* Floating point Alpha = 0.999997 */
-#define ALPHA_3 2147475510 /* Floating point Alpha = 0.999996 */
-#define ALPHA_4 2147472141 /* Floating point Alpha = 0.999995 */
-#define ALPHA_5 2147467377 /* Floating point Alpha = 0.999992 */
-#define ALPHA_6 2147460642 /* Floating point Alpha = 0.999989 */
-#define ALPHA_7 2147451118 /* Floating point Alpha = 0.999985 */
-#define ALPHA_8 2147437651 /* Floating point Alpha = 0.999979 */
-#define ALPHA_9 2147418608 /* Floating point Alpha = 0.999970 */
-#define ALPHA_10 2147391683 /* Floating point Alpha = 0.999957 */
-#define ALPHA_11 2147353611 /* Floating point Alpha = 0.999939 */
-#define ALPHA_12 2147299779 /* Floating point Alpha = 0.999914 */
-#define ALPHA_13 2147223662 /* Floating point Alpha = 0.999879 */
-#define ALPHA_14 2147116037 /* Floating point Alpha = 0.999829 */
-#define ALPHA_15 2146963865 /* Floating point Alpha = 0.999758 */
-#define ALPHA_16 2146748712 /* Floating point Alpha = 0.999658 */
-#define ALPHA_17 2146444522 /* Floating point Alpha = 0.999516 */
-#define ALPHA_18 2146014472 /* Floating point Alpha = 0.999316 */
-#define ALPHA_19 2145406527 /* Floating point Alpha = 0.999033 */
-#define ALPHA_20 2144547188 /* Floating point Alpha = 0.998633 */
-#define ALPHA_21 2143332669 /* Floating point Alpha = 0.998067 */
-#define ALPHA_22 2141616514 /* Floating point Alpha = 0.997268 */
-#define ALPHA_23 2139192215 /* Floating point Alpha = 0.996139 */
-#define ALPHA_24 2135768939 /* Floating point Alpha = 0.994545 */
-#define ALPHA_25 2130937774 /* Floating point Alpha = 0.992295 */
-#define ALPHA_26 2124125153 /* Floating point Alpha = 0.989123 */
-#define ALPHA_27 2114529263 /* Floating point Alpha = 0.984654 */
-#define ALPHA_28 2101034612 /* Floating point Alpha = 0.978370 */
-#define ALPHA_29 2082100030 /* Floating point Alpha = 0.969553 */
-#define ALPHA_30 2055617398 /* Floating point Alpha = 0.957221 */
-#define ALPHA_31 2018744824 /* Floating point Alpha = 0.940051 */
-#define ALPHA_32 1967733015 /* Floating point Alpha = 0.916297 */
-#define ALPHA_33 1897794587 /* Floating point Alpha = 0.883729 */
-#define ALPHA_34 1803123234 /* Floating point Alpha = 0.839645 */
-#define ALPHA_35 1677262220 /* Floating point Alpha = 0.781036 */
-#define ALPHA_36 1514142675 /* Floating point Alpha = 0.705078 */
-#define ALPHA_37 1310197875 /* Floating point Alpha = 0.610108 */
-#define ALPHA_38 1067813480 /* Floating point Alpha = 0.497239 */
-#define ALPHA_39 799601371 /* Floating point Alpha = 0.372343 */
-#define ALPHA_40 531183049 /* Floating point Alpha = 0.247351 */
-#define ALPHA_41 297904007 /* Floating point Alpha = 0.138722 */
-#define ALPHA_42 131499768 /* Floating point Alpha = 0.061234 */
-#define ALPHA_43 41375282 /* Floating point Alpha = 0.019267 */
-#define ALPHA_44 8065899 /* Floating point Alpha = 0.003756 */
-#define ALPHA_45 799076 /* Floating point Alpha = 0.000372 */
-#define ALPHA_46 30398 /* Floating point Alpha = 0.000014 */
-#define ALPHA_47 299 /* Floating point Alpha = 0.000000 */
-#define ALPHA_48 0 /* Floating point Alpha = 0.000000 */
-#define ALPHA_49 0 /* Floating point Alpha = 0.000000 */
-#define ALPHA_50 0 /* Floating point Alpha = 0.000000 */
+#define Alpha_TableSize 50 /* The number of table entires */
+#define ALPHA_0 2147480769 /* Floating point Alpha = 0.999999 */
+#define ALPHA_1 2147479577 /* Floating point Alpha = 0.999998 */
+#define ALPHA_2 2147477892 /* Floating point Alpha = 0.999997 */
+#define ALPHA_3 2147475510 /* Floating point Alpha = 0.999996 */
+#define ALPHA_4 2147472141 /* Floating point Alpha = 0.999995 */
+#define ALPHA_5 2147467377 /* Floating point Alpha = 0.999992 */
+#define ALPHA_6 2147460642 /* Floating point Alpha = 0.999989 */
+#define ALPHA_7 2147451118 /* Floating point Alpha = 0.999985 */
+#define ALPHA_8 2147437651 /* Floating point Alpha = 0.999979 */
+#define ALPHA_9 2147418608 /* Floating point Alpha = 0.999970 */
+#define ALPHA_10 2147391683 /* Floating point Alpha = 0.999957 */
+#define ALPHA_11 2147353611 /* Floating point Alpha = 0.999939 */
+#define ALPHA_12 2147299779 /* Floating point Alpha = 0.999914 */
+#define ALPHA_13 2147223662 /* Floating point Alpha = 0.999879 */
+#define ALPHA_14 2147116037 /* Floating point Alpha = 0.999829 */
+#define ALPHA_15 2146963865 /* Floating point Alpha = 0.999758 */
+#define ALPHA_16 2146748712 /* Floating point Alpha = 0.999658 */
+#define ALPHA_17 2146444522 /* Floating point Alpha = 0.999516 */
+#define ALPHA_18 2146014472 /* Floating point Alpha = 0.999316 */
+#define ALPHA_19 2145406527 /* Floating point Alpha = 0.999033 */
+#define ALPHA_20 2144547188 /* Floating point Alpha = 0.998633 */
+#define ALPHA_21 2143332669 /* Floating point Alpha = 0.998067 */
+#define ALPHA_22 2141616514 /* Floating point Alpha = 0.997268 */
+#define ALPHA_23 2139192215 /* Floating point Alpha = 0.996139 */
+#define ALPHA_24 2135768939 /* Floating point Alpha = 0.994545 */
+#define ALPHA_25 2130937774 /* Floating point Alpha = 0.992295 */
+#define ALPHA_26 2124125153 /* Floating point Alpha = 0.989123 */
+#define ALPHA_27 2114529263 /* Floating point Alpha = 0.984654 */
+#define ALPHA_28 2101034612 /* Floating point Alpha = 0.978370 */
+#define ALPHA_29 2082100030 /* Floating point Alpha = 0.969553 */
+#define ALPHA_30 2055617398 /* Floating point Alpha = 0.957221 */
+#define ALPHA_31 2018744824 /* Floating point Alpha = 0.940051 */
+#define ALPHA_32 1967733015 /* Floating point Alpha = 0.916297 */
+#define ALPHA_33 1897794587 /* Floating point Alpha = 0.883729 */
+#define ALPHA_34 1803123234 /* Floating point Alpha = 0.839645 */
+#define ALPHA_35 1677262220 /* Floating point Alpha = 0.781036 */
+#define ALPHA_36 1514142675 /* Floating point Alpha = 0.705078 */
+#define ALPHA_37 1310197875 /* Floating point Alpha = 0.610108 */
+#define ALPHA_38 1067813480 /* Floating point Alpha = 0.497239 */
+#define ALPHA_39 799601371 /* Floating point Alpha = 0.372343 */
+#define ALPHA_40 531183049 /* Floating point Alpha = 0.247351 */
+#define ALPHA_41 297904007 /* Floating point Alpha = 0.138722 */
+#define ALPHA_42 131499768 /* Floating point Alpha = 0.061234 */
+#define ALPHA_43 41375282 /* Floating point Alpha = 0.019267 */
+#define ALPHA_44 8065899 /* Floating point Alpha = 0.003756 */
+#define ALPHA_45 799076 /* Floating point Alpha = 0.000372 */
+#define ALPHA_46 30398 /* Floating point Alpha = 0.000014 */
+#define ALPHA_47 299 /* Floating point Alpha = 0.000000 */
+#define ALPHA_48 0 /* Floating point Alpha = 0.000000 */
+#define ALPHA_49 0 /* Floating point Alpha = 0.000000 */
+#define ALPHA_50 0 /* Floating point Alpha = 0.000000 */
-#define ALPHA_Float_0 0.999999f
-#define ALPHA_Float_1 0.999998f
-#define ALPHA_Float_2 0.999997f
-#define ALPHA_Float_3 0.999996f
-#define ALPHA_Float_4 0.999995f
-#define ALPHA_Float_5 0.999992f
-#define ALPHA_Float_6 0.999989f
-#define ALPHA_Float_7 0.999985f
-#define ALPHA_Float_8 0.999979f
-#define ALPHA_Float_9 0.999970f
-#define ALPHA_Float_10 0.999957f
-#define ALPHA_Float_11 0.999939f
-#define ALPHA_Float_12 0.999914f
-#define ALPHA_Float_13 0.999879f
-#define ALPHA_Float_14 0.999829f
-#define ALPHA_Float_15 0.999758f
-#define ALPHA_Float_16 0.999658f
-#define ALPHA_Float_17 0.999516f
-#define ALPHA_Float_18 0.999316f
-#define ALPHA_Float_19 0.999033f
-#define ALPHA_Float_20 0.998633f
-#define ALPHA_Float_21 0.998067f
-#define ALPHA_Float_22 0.997268f
-#define ALPHA_Float_23 0.996139f
-#define ALPHA_Float_24 0.994545f
-#define ALPHA_Float_25 0.992295f
-#define ALPHA_Float_26 0.989123f
-#define ALPHA_Float_27 0.984654f
-#define ALPHA_Float_28 0.978370f
-#define ALPHA_Float_29 0.969553f
-#define ALPHA_Float_30 0.957221f
-#define ALPHA_Float_31 0.940051f
-#define ALPHA_Float_32 0.916297f
-#define ALPHA_Float_33 0.883729f
-#define ALPHA_Float_34 0.839645f
-#define ALPHA_Float_35 0.781036f
-#define ALPHA_Float_36 0.705078f
-#define ALPHA_Float_37 0.610108f
-#define ALPHA_Float_38 0.497239f
-#define ALPHA_Float_39 0.372343f
-#define ALPHA_Float_40 0.247351f
-#define ALPHA_Float_41 0.138722f
-#define ALPHA_Float_42 0.061234f
-#define ALPHA_Float_43 0.019267f
-#define ALPHA_Float_44 0.003756f
-#define ALPHA_Float_45 0.000372f
-#define ALPHA_Float_46 0.000014f
-#define ALPHA_Float_47 0.000000f
-#define ALPHA_Float_48 0.000000f
-#define ALPHA_Float_49 0.000000f
-#define ALPHA_Float_50 0.000000f
+#define ALPHA_Float_0 0.999999f
+#define ALPHA_Float_1 0.999998f
+#define ALPHA_Float_2 0.999997f
+#define ALPHA_Float_3 0.999996f
+#define ALPHA_Float_4 0.999995f
+#define ALPHA_Float_5 0.999992f
+#define ALPHA_Float_6 0.999989f
+#define ALPHA_Float_7 0.999985f
+#define ALPHA_Float_8 0.999979f
+#define ALPHA_Float_9 0.999970f
+#define ALPHA_Float_10 0.999957f
+#define ALPHA_Float_11 0.999939f
+#define ALPHA_Float_12 0.999914f
+#define ALPHA_Float_13 0.999879f
+#define ALPHA_Float_14 0.999829f
+#define ALPHA_Float_15 0.999758f
+#define ALPHA_Float_16 0.999658f
+#define ALPHA_Float_17 0.999516f
+#define ALPHA_Float_18 0.999316f
+#define ALPHA_Float_19 0.999033f
+#define ALPHA_Float_20 0.998633f
+#define ALPHA_Float_21 0.998067f
+#define ALPHA_Float_22 0.997268f
+#define ALPHA_Float_23 0.996139f
+#define ALPHA_Float_24 0.994545f
+#define ALPHA_Float_25 0.992295f
+#define ALPHA_Float_26 0.989123f
+#define ALPHA_Float_27 0.984654f
+#define ALPHA_Float_28 0.978370f
+#define ALPHA_Float_29 0.969553f
+#define ALPHA_Float_30 0.957221f
+#define ALPHA_Float_31 0.940051f
+#define ALPHA_Float_32 0.916297f
+#define ALPHA_Float_33 0.883729f
+#define ALPHA_Float_34 0.839645f
+#define ALPHA_Float_35 0.781036f
+#define ALPHA_Float_36 0.705078f
+#define ALPHA_Float_37 0.610108f
+#define ALPHA_Float_38 0.497239f
+#define ALPHA_Float_39 0.372343f
+#define ALPHA_Float_40 0.247351f
+#define ALPHA_Float_41 0.138722f
+#define ALPHA_Float_42 0.061234f
+#define ALPHA_Float_43 0.019267f
+#define ALPHA_Float_44 0.003756f
+#define ALPHA_Float_45 0.000372f
+#define ALPHA_Float_46 0.000014f
+#define ALPHA_Float_47 0.000000f
+#define ALPHA_Float_48 0.000000f
+#define ALPHA_Float_49 0.000000f
+#define ALPHA_Float_50 0.000000f
#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 73da2cf..3ec103a 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Mixer_TimeConstant.cpp
@@ -56,83 +56,37 @@
/* Alpha - the filter coefficient Q31 format */
/* */
/************************************************************************/
-LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc,
- LVM_UINT32 Fs,
- LVM_UINT16 NumChannels)
-{
-
- LVM_UINT32 Product;
- LVM_FLOAT ProductFloat;
- LVM_INT16 InterpolateShort;
- LVM_FLOAT Interpolate;
- LVM_UINT16 Shift;
- LVM_FLOAT Diff;
- LVM_FLOAT Table[] = {ALPHA_Float_0, /* Log spaced look-up table */
- ALPHA_Float_1,
- ALPHA_Float_2,
- ALPHA_Float_3,
- ALPHA_Float_4,
- ALPHA_Float_5,
- ALPHA_Float_6,
- ALPHA_Float_7,
- ALPHA_Float_8,
- ALPHA_Float_9,
- ALPHA_Float_10,
- ALPHA_Float_11,
- ALPHA_Float_12,
- ALPHA_Float_13,
- ALPHA_Float_14,
- ALPHA_Float_15,
- ALPHA_Float_16,
- ALPHA_Float_17,
- ALPHA_Float_18,
- ALPHA_Float_19,
- ALPHA_Float_20,
- ALPHA_Float_21,
- ALPHA_Float_22,
- ALPHA_Float_23,
- ALPHA_Float_24,
- ALPHA_Float_25,
- ALPHA_Float_26,
- ALPHA_Float_27,
- ALPHA_Float_28,
- ALPHA_Float_29,
- ALPHA_Float_30,
- ALPHA_Float_31,
- ALPHA_Float_32,
- ALPHA_Float_33,
- ALPHA_Float_34,
- ALPHA_Float_35,
- ALPHA_Float_36,
- ALPHA_Float_37,
- ALPHA_Float_38,
- ALPHA_Float_39,
- ALPHA_Float_40,
- ALPHA_Float_41,
- ALPHA_Float_42,
- ALPHA_Float_43,
- ALPHA_Float_44,
- ALPHA_Float_45,
- ALPHA_Float_46,
- ALPHA_Float_47,
- ALPHA_Float_48,
- ALPHA_Float_49,
- ALPHA_Float_50};
+LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc, LVM_UINT32 Fs, LVM_UINT16 NumChannels) {
+ LVM_UINT32 Product;
+ LVM_FLOAT ProductFloat;
+ LVM_INT16 InterpolateShort;
+ LVM_FLOAT Interpolate;
+ LVM_UINT16 Shift;
+ LVM_FLOAT Diff;
+ LVM_FLOAT Table[] = {
+ ALPHA_Float_0, /* Log spaced look-up table */
+ ALPHA_Float_1, ALPHA_Float_2, ALPHA_Float_3, ALPHA_Float_4, ALPHA_Float_5,
+ ALPHA_Float_6, ALPHA_Float_7, ALPHA_Float_8, ALPHA_Float_9, ALPHA_Float_10,
+ ALPHA_Float_11, ALPHA_Float_12, ALPHA_Float_13, ALPHA_Float_14, ALPHA_Float_15,
+ ALPHA_Float_16, ALPHA_Float_17, ALPHA_Float_18, ALPHA_Float_19, ALPHA_Float_20,
+ ALPHA_Float_21, ALPHA_Float_22, ALPHA_Float_23, ALPHA_Float_24, ALPHA_Float_25,
+ ALPHA_Float_26, ALPHA_Float_27, ALPHA_Float_28, ALPHA_Float_29, ALPHA_Float_30,
+ ALPHA_Float_31, ALPHA_Float_32, ALPHA_Float_33, ALPHA_Float_34, ALPHA_Float_35,
+ ALPHA_Float_36, ALPHA_Float_37, ALPHA_Float_38, ALPHA_Float_39, ALPHA_Float_40,
+ ALPHA_Float_41, ALPHA_Float_42, ALPHA_Float_43, ALPHA_Float_44, ALPHA_Float_45,
+ ALPHA_Float_46, ALPHA_Float_47, ALPHA_Float_48, ALPHA_Float_49, ALPHA_Float_50};
/* Calculate the product of the time constant and the sample rate */
- Product = ((tc >> 16) * (LVM_UINT32)Fs) << 13; /* Stereo value */
+ 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 */
+ 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)
- {
+ for (Shift = 0; Shift < ((Alpha_TableSize - 1) / 2); Shift++) {
+ if ((Product & 0x80000000) != 0) {
break;
}
@@ -140,8 +94,7 @@
}
Shift = (LVM_UINT16)((Shift << 1));
- if ((Product & 0x40000000)==0)
- {
+ if ((Product & 0x40000000) == 0) {
Shift++;
}
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
index 2c3e9ec..8382529 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Polynomial.cpp
@@ -40,33 +40,25 @@
/* RETURNS: */
/* The result of the polynomial expansion in Q1.31 format */
/*-------------------------------------------------------------------------*/
-LVM_FLOAT LVM_Polynomial(LVM_UINT16 N,
- LVM_FLOAT *pCoefficients,
- LVM_FLOAT X)
-{
+LVM_FLOAT LVM_Polynomial(LVM_UINT16 N, LVM_FLOAT* pCoefficients, LVM_FLOAT X) {
LVM_INT32 i;
- LVM_FLOAT Y,A,XTemp,Temp,sign;
+ LVM_FLOAT Y, A, XTemp, Temp, sign;
Y = *pCoefficients; /* Y=A0*/
pCoefficients++;
- if(X == -1.0f)
- {
+ if (X == -1.0f) {
Temp = -1;
sign = Temp;
- for(i = 1; i <= N; i++)
- {
+ for (i = 1; i <= N; i++) {
Y += ((*pCoefficients) * sign);
pCoefficients++;
sign *= Temp;
}
- }
- else
- {
+ } else {
XTemp = X;
- for(i = N-1; i >= 0; i--)
- {
+ for (i = N - 1; i >= 0; i--) {
A = *pCoefficients;
pCoefficients++;
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp b/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
index ae8e9d1..85596aa 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Power10.cpp
@@ -53,23 +53,10 @@
/* RETURNS: */
/* The result of the 10x expansion in Q8.24 format */
/*-------------------------------------------------------------------------*/
-LVM_FLOAT LVM_Power10(LVM_FLOAT X)
-{
- LVM_FLOAT Y,Coefficients[13]={0.999906f,
- 2.302475f,
- 2.652765f,
- 2.035494f,
- 1.165667f,
- 0.537676f,
- 0.213192f,
- 0.069603f,
- 0.016553f,
- 0.004373f,
- 0.001817f,
- 0.000367f,
- 0};
- Y=LVM_Polynomial((LVM_UINT16)11,
- Coefficients,
- X);
+LVM_FLOAT LVM_Power10(LVM_FLOAT X) {
+ LVM_FLOAT Y, Coefficients[13] = {0.999906f, 2.302475f, 2.652765f, 2.035494f, 1.165667f,
+ 0.537676f, 0.213192f, 0.069603f, 0.016553f, 0.004373f,
+ 0.001817f, 0.000367f, 0};
+ Y = LVM_Polynomial((LVM_UINT16)11, Coefficients, X);
return Y;
}
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Timer.cpp b/media/libeffects/lvm/lib/Common/src/LVM_Timer.cpp
index 5995f54..be7c8e4 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Timer.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Timer.cpp
@@ -26,19 +26,16 @@
/* TIMER FUNCTION */
/****************************************************************************************/
-void LVM_Timer ( LVM_Timer_Instance_t *pInstance,
- LVM_INT16 BlockSize ){
+void LVM_Timer(LVM_Timer_Instance_t* pInstance, LVM_INT16 BlockSize) {
+ LVM_Timer_Instance_Private_t* pInstancePr;
+ pInstancePr = (LVM_Timer_Instance_Private_t*)pInstance;
- LVM_Timer_Instance_Private_t *pInstancePr;
- pInstancePr = (LVM_Timer_Instance_Private_t *)pInstance;
-
- if (pInstancePr->TimerArmed){
+ if (pInstancePr->TimerArmed) {
pInstancePr->RemainingTimeInSamples -= BlockSize;
- if (pInstancePr->RemainingTimeInSamples <= 0){
+ if (pInstancePr->RemainingTimeInSamples <= 0) {
pInstancePr->TimerArmed = 0;
- (*pInstancePr->pCallBack) ( pInstancePr->pCallbackInstance,
- pInstancePr->pCallBackParams,
- pInstancePr->CallBackParam );
+ (*pInstancePr->pCallBack)(pInstancePr->pCallbackInstance, pInstancePr->pCallBackParams,
+ pInstancePr->CallBackParam);
}
}
}
diff --git a/media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.cpp b/media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.cpp
index 3015057..bfd6bcf 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Timer_Init.cpp
@@ -33,20 +33,20 @@
/* INIT FUNCTION */
/****************************************************************************************/
-void LVM_Timer_Init ( LVM_Timer_Instance_t *pInstance,
- LVM_Timer_Params_t *pParams ){
+void LVM_Timer_Init(LVM_Timer_Instance_t* pInstance, LVM_Timer_Params_t* pParams) {
+ LVM_Timer_Instance_Private_t* pInstancePr;
+ pInstancePr = (LVM_Timer_Instance_Private_t*)pInstance;
- LVM_Timer_Instance_Private_t *pInstancePr;
- pInstancePr = (LVM_Timer_Instance_Private_t *)pInstance;
-
- pInstancePr->CallBackParam = pParams->CallBackParam;
- pInstancePr->pCallBackParams = (LVM_INT32 *)pParams->pCallBackParams;
+ pInstancePr->CallBackParam = pParams->CallBackParam;
+ pInstancePr->pCallBackParams = (LVM_INT32*)pParams->pCallBackParams;
pInstancePr->pCallbackInstance = pParams->pCallbackInstance;
- pInstancePr->pCallBack = pParams->pCallBack;
- pInstancePr->TimerArmed = 1;
+ pInstancePr->pCallBack = pParams->pCallBack;
+ pInstancePr->TimerArmed = 1;
- MUL32x16INTO32(pParams->SamplingRate,OneOverThousandInQ24,pInstancePr->RemainingTimeInSamples,16); /* (Q0 * Q24) >>16 into Q8*/
- MUL32x16INTO32(pInstancePr->RemainingTimeInSamples,pParams->TimeInMs,pInstancePr->RemainingTimeInSamples,8); /* (Q8 * Q0) >>8 into Q0*/
+ MUL32x16INTO32(pParams->SamplingRate, OneOverThousandInQ24, pInstancePr->RemainingTimeInSamples,
+ 16); /* (Q0 * Q24) >>16 into Q8*/
+ MUL32x16INTO32(pInstancePr->RemainingTimeInSamples, pParams->TimeInMs,
+ pInstancePr->RemainingTimeInSamples, 8); /* (Q8 * Q0) >>8 into Q0*/
}
/****************************************************************************************/
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 a372b82..3e8aba8 100644
--- a/media/libeffects/lvm/lib/Common/src/LVM_Timer_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/LVM_Timer_Private.h
@@ -24,14 +24,13 @@
/* TYPE DEFINITIONS */
/****************************************************************************************/
-typedef struct
-{
- LVM_INT32 RemainingTimeInSamples;
- LVM_INT32 CallBackParam;
- LVM_INT32 *pCallBackParams;
- void *pCallbackInstance;
- void (*pCallBack)(void*,void*,LVM_INT32);
- LVM_INT16 TimerArmed; /* Boolean, true between init and callback */
+typedef struct {
+ LVM_INT32 RemainingTimeInSamples;
+ LVM_INT32 CallBackParam;
+ LVM_INT32* pCallBackParams;
+ void* pCallbackInstance;
+ void (*pCallBack)(void*, void*, LVM_INT32);
+ LVM_INT16 TimerArmed; /* Boolean, true between init and callback */
} LVM_Timer_Instance_Private_t;
@@ -39,4 +38,4 @@
/* END OF HEADER */
/****************************************************************************************/
-#endif /* LVM_TIMER_PRIVATE_H */
+#endif /* LVM_TIMER_PRIVATE_H */
diff --git a/media/libeffects/lvm/lib/Common/src/LoadConst_16.cpp b/media/libeffects/lvm/lib/Common/src/LoadConst_16.cpp
index f88ca0e..a39fa2f 100644
--- a/media/libeffects/lvm/lib/Common/src/LoadConst_16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LoadConst_16.cpp
@@ -25,14 +25,10 @@
FUNCTION LoadConst_16
***********************************************************************************/
-void LoadConst_16(const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n )
-{
+void LoadConst_16(const LVM_INT16 val, LVM_INT16* dst, LVM_INT16 n) {
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = val;
dst++;
}
diff --git a/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp b/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
index c789756..df7a558 100644
--- a/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/LoadConst_32.cpp
@@ -24,14 +24,10 @@
/**********************************************************************************
FUNCTION LoadConst_32
***********************************************************************************/
-void LoadConst_Float(const LVM_FLOAT val,
- LVM_FLOAT *dst,
- LVM_INT16 n )
-{
+void LoadConst_Float(const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n) {
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = val;
dst++;
}
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 1ea765a..a19e66f 100644
--- a/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MSTo2i_Sat_16x16.cpp
@@ -25,50 +25,35 @@
FUNCTION MSTO2I_SAT_16X16
***********************************************************************************/
-void MSTo2i_Sat_16x16(const LVM_INT16 *srcM,
- const LVM_INT16 *srcS,
- LVM_INT16 *dst,
- LVM_INT16 n )
-{
- LVM_INT32 temp,mVal,sVal;
+void MSTo2i_Sat_16x16(const LVM_INT16* srcM, const LVM_INT16* srcS, LVM_INT16* dst, LVM_INT16 n) {
+ LVM_INT32 temp, mVal, sVal;
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
- mVal=(LVM_INT32)*srcM;
+ for (ii = n; ii != 0; ii--) {
+ mVal = (LVM_INT32)*srcM;
srcM++;
- sVal=(LVM_INT32)*srcS;
+ sVal = (LVM_INT32)*srcS;
srcS++;
temp = mVal + sVal;
- if (temp > 0x00007FFF)
- {
+ if (temp > 0x00007FFF) {
*dst = 0x7FFF;
- }
- else if (temp < -0x00008000)
- {
- *dst = - 0x8000;
- }
- else
- {
+ } else if (temp < -0x00008000) {
+ *dst = -0x8000;
+ } else {
*dst = (LVM_INT16)temp;
}
dst++;
temp = mVal - sVal;
- if (temp > 0x00007FFF)
- {
+ if (temp > 0x00007FFF) {
*dst = 0x7FFF;
- }
- else if (temp < -0x00008000)
- {
- *dst = - 0x8000;
- }
- else
- {
+ } else if (temp < -0x00008000) {
+ *dst = -0x8000;
+ } else {
*dst = (LVM_INT16)temp;
}
dst++;
@@ -76,16 +61,11 @@
return;
}
-void MSTo2i_Sat_Float(const LVM_FLOAT *srcM,
- const LVM_FLOAT *srcS,
- LVM_FLOAT *dst,
- LVM_INT16 n )
-{
- LVM_FLOAT temp,mVal,sVal;
+void MSTo2i_Sat_Float(const LVM_FLOAT* srcM, const LVM_FLOAT* srcS, LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_FLOAT temp, mVal, sVal;
LVM_INT16 ii;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
mVal = (LVM_FLOAT)*srcM;
srcM++;
@@ -94,32 +74,22 @@
temp = mVal + sVal;
- if (temp > 1.0f)
- {
+ if (temp > 1.0f) {
*dst = 1.0f;
- }
- else if (temp < -1.0f)
- {
+ } else if (temp < -1.0f) {
*dst = -1.0f;
- }
- else
- {
+ } else {
*dst = (LVM_FLOAT)temp;
}
dst++;
temp = mVal - sVal;
- if (temp > 1.0f)
- {
+ if (temp > 1.0f) {
*dst = 1.0f;
- }
- else if (temp < -1.0f)
- {
- *dst = - 1.0f;
- }
- else
- {
+ } else if (temp < -1.0f) {
+ *dst = -1.0f;
+ } else {
*dst = (LVM_FLOAT)temp;
}
dst++;
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 6584251..1d450b0 100644
--- a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_16x16.cpp
@@ -35,36 +35,26 @@
FUNCTION Mac3S_16X16
***********************************************************************************/
-void Mac3s_Sat_16x16( const LVM_INT16 *src,
- const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
+void Mac3s_Sat_16x16(const LVM_INT16* src, const LVM_INT16 val, LVM_INT16* dst, LVM_INT16 n) {
LVM_INT16 ii;
LVM_INT16 srcval;
- LVM_INT32 Temp,dInVal;
+ LVM_INT32 Temp, dInVal;
- for (ii = n; ii != 0; ii--)
- {
- srcval=*src;
+ for (ii = n; ii != 0; ii--) {
+ srcval = *src;
src++;
- Temp = (srcval *val)>>15;
+ Temp = (srcval * val) >> 15;
- dInVal = (LVM_INT32)*dst;
+ dInVal = (LVM_INT32)*dst;
Temp = Temp + dInVal;
- if (Temp > 0x00007FFF)
- {
+ if (Temp > 0x00007FFF) {
*dst = 0x7FFF;
- }
- else if (Temp < -0x00008000)
- {
- *dst = - 0x8000;
- }
- else
- {
+ } else if (Temp < -0x00008000) {
+ *dst = -0x8000;
+ } else {
*dst = (LVM_INT16)Temp;
}
@@ -75,4 +65,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 5d5564f..0fe9fef 100644
--- a/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Mac3s_Sat_32x16.cpp
@@ -26,33 +26,25 @@
FUNCTION MAC3S_16X16
***********************************************************************************/
-void Mac3s_Sat_32x16( const LVM_INT32 *src,
- const LVM_INT16 val,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
+void Mac3s_Sat_32x16(const LVM_INT32* src, const LVM_INT16 val, LVM_INT32* dst, LVM_INT16 n) {
LVM_INT16 ii;
- LVM_INT32 srcval,temp, dInVal, dOutVal;
+ LVM_INT32 srcval, temp, dInVal, dOutVal;
- for (ii = n; ii != 0; ii--)
- {
- srcval=*src;
+ for (ii = n; ii != 0; ii--) {
+ srcval = *src;
src++;
- MUL32x16INTO32(srcval,val,temp,15)
+ MUL32x16INTO32(srcval, val, temp, 15)
- dInVal = *dst;
+ dInVal = *dst;
dOutVal = temp + dInVal;
- if ((((dOutVal ^ temp) & (dOutVal ^ dInVal)) >> 31)!=0) /* overflow / underflow */
+ if ((((dOutVal ^ temp) & (dOutVal ^ dInVal)) >> 31) != 0) /* overflow / underflow */
{
- if(temp<0)
- {
- dOutVal=0x80000000L;
- }
- else
- {
- dOutVal=0x7FFFFFFFL;
+ if (temp < 0) {
+ dOutVal = 0x80000000L;
+ } else {
+ dOutVal = 0x7FFFFFFFL;
}
}
@@ -62,35 +54,25 @@
return;
}
-void Mac3s_Sat_Float(const LVM_FLOAT *src,
- const LVM_FLOAT val,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
+void Mac3s_Sat_Float(const LVM_FLOAT* src, const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n) {
LVM_INT16 ii;
LVM_FLOAT srcval;
- LVM_FLOAT Temp,dInVal;
+ LVM_FLOAT Temp, dInVal;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
srcval = *src;
src++;
Temp = srcval * val;
- dInVal = (LVM_FLOAT)*dst;
+ dInVal = (LVM_FLOAT)*dst;
Temp = Temp + dInVal;
- if (Temp > 1.000000f)
- {
+ if (Temp > 1.000000f) {
*dst = 1.000000f;
- }
- else if (Temp < -1.000000f)
- {
+ } else if (Temp < -1.000000f) {
*dst = -1.000000f;
- }
- else
- {
+ } else {
*dst = Temp;
}
dst++;
@@ -99,4 +81,3 @@
return;
}
/**********************************************************************************/
-
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 7c7b36f..9663998 100644
--- a/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp
@@ -26,33 +26,29 @@
DEFINITIONS
***********************************************************************************/
-#define TRUE 1
-#define FALSE 0
+#define TRUE 1
+#define FALSE 0
/**********************************************************************************
FUNCTION MIXINSOFT_D32C31_SAT
***********************************************************************************/
-void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
+void MixInSoft_D32C31_SAT(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst,
+ LVM_INT16 n) {
char HardMixing = TRUE;
- if(n <= 0) return;
+ if (n <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Alpha == 0){
+ if (pInstance->Current != pInstance->Target) {
+ if (pInstance->Alpha == 0) {
pInstance->Current = pInstance->Target;
- }else if ((pInstance->Current-pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
- (pInstance->Current-pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ } else if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)) {
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
Make them equal. */
- }else{
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
Core_MixInSoft_D32C31_SAT(pInstance, src, dst, n);
@@ -63,11 +59,11 @@
HARD MIXING
*******************************************************************************/
- if (HardMixing){
- if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
+ if (HardMixing) {
+ if (pInstance->Target != 0) { /* Nothing to do in case Target = 0 */
if ((pInstance->Target) == 1.0f)
Add2_Sat_Float(src, dst, n);
- else{
+ else {
Core_MixInSoft_D32C31_SAT(pInstance, src, dst, n);
pInstance->Current = pInstance->Target; /* In case the core function would \
have changed the Current value */
@@ -81,16 +77,15 @@
/* 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->CallbackSet) {
if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
- (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)) {
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 );
+ if (pInstance->pCallBack != 0) {
+ (*pInstance->pCallBack)(pInstance->pCallbackHandle, pInstance->pGeneralPurpose,
+ pInstance->CallbackParam);
}
}
}
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 d3325ec..8408962 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
@@ -26,33 +26,29 @@
DEFINITIONS
***********************************************************************************/
-#define TRUE 1
-#define FALSE 0
+#define TRUE 1
+#define FALSE 0
/**********************************************************************************
FUNCTION MIXSOFT_1ST_D32C31_WRA
***********************************************************************************/
-void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
+void MixSoft_1St_D32C31_WRA(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst,
+ LVM_INT16 n) {
char HardMixing = TRUE;
- if(n <= 0) return;
+ if (n <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if (pInstance->Current != pInstance->Target)
- {
- if(pInstance->Alpha == 0){
+ if (pInstance->Current != pInstance->Target) {
+ if (pInstance->Alpha == 0) {
pInstance->Current = pInstance->Target;
- }else if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
- (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ } else if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)) {
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. \
Make them equal. */
- }else{
+ } else {
/* Soft mixing has to be applied */
HardMixing = FALSE;
Core_MixSoft_1St_D32C31_WRA(pInstance, src, dst, n);
@@ -63,14 +59,12 @@
HARD MIXING
*******************************************************************************/
- if (HardMixing){
+ if (HardMixing) {
if (pInstance->Target == 0)
LoadConst_Float(0, dst, n);
- else if ((pInstance->Target) == 1.0f){
- if (src != dst)
- Copy_Float((LVM_FLOAT*)src, (LVM_FLOAT*)dst, (LVM_INT16)(n));
- }
- else
+ else if ((pInstance->Target) == 1.0f) {
+ if (src != dst) Copy_Float((LVM_FLOAT*)src, (LVM_FLOAT*)dst, (LVM_INT16)(n));
+ } else
Mult3s_Float(src, pInstance->Current, dst, n);
}
@@ -78,16 +72,15 @@
CALL BACK
*******************************************************************************/
- if (pInstance->CallbackSet){
+ if (pInstance->CallbackSet) {
if ((pInstance->Current - pInstance->Target < POINT_ZERO_ONE_DB_FLOAT) &&
- (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)){
+ (pInstance->Current - pInstance->Target > -POINT_ZERO_ONE_DB_FLOAT)) {
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 );
+ if (pInstance->pCallBack != 0) {
+ (*pInstance->pCallBack)(pInstance->pCallbackHandle, pInstance->pGeneralPurpose,
+ pInstance->CallbackParam);
}
}
}
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 b002738..aba8537 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
@@ -25,42 +25,35 @@
/**********************************************************************************
FUNCTION MIXSOFT_2ST_D32C31_SAT
***********************************************************************************/
-void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance,
- const LVM_FLOAT *src1,
- const LVM_FLOAT *src2,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
-
- if(n <= 0) return;
+void MixSoft_2St_D32C31_SAT(Mix_2St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src1,
+ const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 n) {
+ if (n <= 0) return;
/******************************************************************************
SOFT MIXING
*******************************************************************************/
- if ((pInstance->Current1 != pInstance->Target1) || (pInstance->Current2 != pInstance->Target2))
- {
+ if ((pInstance->Current1 != pInstance->Target1) ||
+ (pInstance->Current2 != pInstance->Target2)) {
MixSoft_1St_D32C31_WRA((Mix_1St_Cll_FLOAT_t*)pInstance, src1, dst, n);
- MixInSoft_D32C31_SAT((Mix_1St_Cll_FLOAT_t *)&pInstance->Alpha2, /* Cast to void: \
- no dereferencing in function*/
- src2, dst, n);
+ MixInSoft_D32C31_SAT((Mix_1St_Cll_FLOAT_t*)&pInstance->Alpha2, /* Cast to void: \
+ no dereferencing in function*/
+ src2, dst, n);
}
/******************************************************************************
HARD MIXING
*******************************************************************************/
- else
- {
+ else {
if (pInstance->Current1 == 0)
MixSoft_1St_D32C31_WRA(
- (Mix_1St_Cll_FLOAT_t *) &pInstance->Alpha2, /* Cast to void: no \
- dereferencing in function*/
- src2, dst, n);
+ (Mix_1St_Cll_FLOAT_t*)&pInstance->Alpha2, /* Cast to void: no \
+ dereferencing in function*/
+ src2, dst, n);
else if (pInstance->Current2 == 0)
- MixSoft_1St_D32C31_WRA((Mix_1St_Cll_FLOAT_t*) pInstance, src1, dst, n);
+ MixSoft_1St_D32C31_WRA((Mix_1St_Cll_FLOAT_t*)pInstance, src1, dst, n);
else
Core_MixHard_2St_D32C31_SAT(pInstance, src1, src2, dst, n);
}
}
/**********************************************************************************/
-
diff --git a/media/libeffects/lvm/lib/Common/src/Mixer_private.h b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
index 1d653bb..e1e62c5 100644
--- a/media/libeffects/lvm/lib/Common/src/Mixer_private.h
+++ b/media/libeffects/lvm/lib/Common/src/Mixer_private.h
@@ -26,13 +26,13 @@
#define POINT_ZERO_ONE_DB 2473805 /* 0.01 dB on a full scale signal = (10^(0.01/20) -1) * 2^31 */
-#define POINT_ZERO_ONE_DB_FLOAT 0.001152 /* 0.01 dB on a full scale \
- signal = (10^(0.01/20) -1) * 2^31 */
+#define POINT_ZERO_ONE_DB_FLOAT \
+ 0.001152 /* 0.01 dB on a full scale \
+ signal = (10^(0.01/20) -1) * 2^31 */
/**********************************************************************************
DEFINITIONS
***********************************************************************************/
/**********************************************************************************/
-#endif //#ifndef __MIXER_PRIVATE_H__
-
+#endif //#ifndef __MIXER_PRIVATE_H__
diff --git a/media/libeffects/lvm/lib/Common/src/MonoTo2I_16.cpp b/media/libeffects/lvm/lib/Common/src/MonoTo2I_16.cpp
index ead798d..7ab5d49 100644
--- a/media/libeffects/lvm/lib/Common/src/MonoTo2I_16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MonoTo2I_16.cpp
@@ -25,16 +25,12 @@
FUNCTION MonoTo2I_16
***********************************************************************************/
-void MonoTo2I_16( const LVM_INT16 *src,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
+void MonoTo2I_16(const LVM_INT16* src, LVM_INT16* dst, LVM_INT16 n) {
LVM_INT16 ii;
- src += (n-1);
- dst += ((n*2)-1);
+ src += (n - 1);
+ dst += ((n * 2) - 1);
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = *src;
dst--;
diff --git a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
index 603d1fc..1ba669f 100644
--- a/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/MonoTo2I_32.cpp
@@ -25,16 +25,12 @@
FUNCTION MonoTo2I_32
***********************************************************************************/
-void MonoTo2I_32( const LVM_INT32 *src,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
+void MonoTo2I_32(const LVM_INT32* src, LVM_INT32* dst, LVM_INT16 n) {
LVM_INT16 ii;
- src += (n-1);
- dst += ((n*2)-1);
+ src += (n - 1);
+ dst += ((n * 2) - 1);
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = *src;
dst--;
@@ -45,16 +41,12 @@
return;
}
-void MonoTo2I_Float( const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
+void MonoTo2I_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n) {
LVM_INT16 ii;
src += (n - 1);
dst += ((n * 2) - 1);
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
*dst = *src;
dst--;
diff --git a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
index 370c39a..4589703 100644
--- a/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Mult3s_32x16.cpp
@@ -26,37 +26,27 @@
FUNCTION MULT3S_16X16
***********************************************************************************/
-void Mult3s_32x16( const LVM_INT32 *src,
- const LVM_INT16 val,
- LVM_INT32 *dst,
- LVM_INT16 n)
-{
+void Mult3s_32x16(const LVM_INT32* src, const LVM_INT16 val, LVM_INT32* dst, LVM_INT16 n) {
LVM_INT16 ii;
- LVM_INT32 srcval,temp;
+ LVM_INT32 srcval, temp;
- for (ii = n; ii != 0; ii--)
- {
- srcval=*src;
+ for (ii = n; ii != 0; ii--) {
+ srcval = *src;
src++;
- MUL32x16INTO32(srcval,val,temp,15)
+ MUL32x16INTO32(srcval, val, temp, 15)
- *dst = temp;
+ * dst = temp;
dst++;
}
return;
}
-void Mult3s_Float( const LVM_FLOAT *src,
- const LVM_FLOAT val,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
+void Mult3s_Float(const LVM_FLOAT* src, const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n) {
LVM_INT16 ii;
LVM_FLOAT temp;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
temp = (*src) * val;
src++;
*dst = temp;
diff --git a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
index 36d1149..fba0666 100644
--- a/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/NonLinComp_D16.cpp
@@ -61,22 +61,16 @@
/* */
/****************************************************************************************/
-void NonLinComp_D16(LVM_INT16 Gain,
- LVM_INT16 *pDataIn,
- LVM_INT16 *pDataOut,
- LVM_INT32 BlockLength)
-{
-
- LVM_INT16 Sample; /* Input samples */
- LVM_INT32 SampleNo; /* Sample index */
- LVM_INT16 Temp;
+void NonLinComp_D16(LVM_INT16 Gain, LVM_INT16* pDataIn, LVM_INT16* pDataOut,
+ LVM_INT32 BlockLength) {
+ LVM_INT16 Sample; /* Input samples */
+ LVM_INT32 SampleNo; /* Sample index */
+ LVM_INT16 Temp;
/*
* Process a block of samples
*/
- for(SampleNo = 0; SampleNo<BlockLength; SampleNo++)
- {
-
+ for (SampleNo = 0; SampleNo < BlockLength; SampleNo++) {
/*
* Read the input
*/
@@ -88,15 +82,11 @@
* harmonic distortion. The amount of compression is control by the
* gain factor
*/
- if ((LVM_INT32)Sample != -32768)
- {
+ if ((LVM_INT32)Sample != -32768) {
Temp = (LVM_INT16)((Sample * Sample) >> 15);
- if(Sample >0)
- {
+ if (Sample > 0) {
Sample = (LVM_INT16)(Sample + ((Gain * (Sample - Temp)) >> 15));
- }
- else
- {
+ } else {
Sample = (LVM_INT16)(Sample + ((Gain * (Sample + Temp)) >> 15));
}
}
@@ -106,25 +96,18 @@
*/
*pDataOut = Sample;
pDataOut++;
-
}
-
}
-void NonLinComp_Float(LVM_FLOAT Gain,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT32 BlockLength)
-{
-
- LVM_FLOAT Sample; /* Input samples */
- LVM_INT32 SampleNo; /* Sample index */
- LVM_FLOAT Temp;
+void NonLinComp_Float(LVM_FLOAT Gain, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut,
+ LVM_INT32 BlockLength) {
+ LVM_FLOAT Sample; /* Input samples */
+ LVM_INT32 SampleNo; /* Sample index */
+ LVM_FLOAT Temp;
/*
* Process a block of samples
*/
- for(SampleNo = 0; SampleNo < BlockLength; SampleNo++)
- {
+ for (SampleNo = 0; SampleNo < BlockLength; SampleNo++) {
/*
* Read the input
*/
@@ -136,16 +119,12 @@
* harmonic distortion. The amount of compression is control by the
* gain factor
*/
- if (Sample != -1.0f)
- {
+ if (Sample != -1.0f) {
Temp = ((Sample * Sample));
- if(Sample > 0)
- {
- Sample = (Sample + ((Gain * (Sample - Temp)) ));
- }
- else
- {
- Sample = (Sample + ((Gain * (Sample + Temp)) ));
+ if (Sample > 0) {
+ Sample = (Sample + ((Gain * (Sample - Temp))));
+ } else {
+ Sample = (Sample + ((Gain * (Sample + Temp))));
}
}
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 23b4fae..0afaad2 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
@@ -37,85 +37,78 @@
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
***************************************************************************/
-void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrSamples)
- {
- LVM_FLOAT ynL,ynR,ynLO,ynRO,templ;
- LVM_INT16 ii;
- PFilter_State_Float pBiquadState = (PFilter_State_Float) pInstance;
+void PK_2I_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrSamples) {
+ LVM_FLOAT ynL, ynR, ynLO, ynRO, templ;
+ LVM_INT16 ii;
+ PFilter_State_Float pBiquadState = (PFilter_State_Float)pInstance;
- for (ii = NrSamples; ii != 0; ii--)
- {
+ for (ii = NrSamples; ii != 0; ii--) {
+ /**************************************************************************
+ PROCESSING OF THE LEFT CHANNEL
+ ***************************************************************************/
+ /* ynL= (A0 * (x(n)L - x(n-2)L ) )*/
+ templ = (*pDataIn) - pBiquadState->pDelays[2];
+ ynL = templ * pBiquadState->coefs[0];
- /**************************************************************************
- PROCESSING OF THE LEFT CHANNEL
- ***************************************************************************/
- /* ynL= (A0 * (x(n)L - x(n-2)L ) )*/
- templ = (*pDataIn) - pBiquadState->pDelays[2];
- ynL = templ * pBiquadState->coefs[0];
+ /* ynL+= ((-B2 * y(n-2)L )) */
+ templ = pBiquadState->pDelays[6] * pBiquadState->coefs[1];
+ ynL += templ;
- /* ynL+= ((-B2 * y(n-2)L )) */
- templ = pBiquadState->pDelays[6] * pBiquadState->coefs[1];
- ynL += templ;
+ /* ynL+= ((-B1 * y(n-1)L ) ) */
+ templ = pBiquadState->pDelays[4] * pBiquadState->coefs[2];
+ ynL += templ;
- /* ynL+= ((-B1 * y(n-1)L ) ) */
- templ = pBiquadState->pDelays[4] * pBiquadState->coefs[2];
- ynL += templ;
+ /* ynLO= ((Gain * ynL )) */
+ ynLO = ynL * pBiquadState->coefs[3];
- /* ynLO= ((Gain * ynL )) */
- ynLO = ynL * pBiquadState->coefs[3];
+ /* ynLO=( ynLO + x(n)L )*/
+ ynLO += (*pDataIn);
- /* ynLO=( ynLO + x(n)L )*/
- ynLO += (*pDataIn);
+ /**************************************************************************
+ PROCESSING OF THE RIGHT CHANNEL
+ ***************************************************************************/
+ /* ynR= (A0 * (x(n)R - x(n-2)R ) ) */
+ templ = (*(pDataIn + 1)) - pBiquadState->pDelays[3];
+ ynR = templ * pBiquadState->coefs[0];
- /**************************************************************************
- PROCESSING OF THE RIGHT CHANNEL
- ***************************************************************************/
- /* ynR= (A0 * (x(n)R - x(n-2)R ) ) */
- templ = (*(pDataIn + 1)) - pBiquadState->pDelays[3];
- ynR = templ * pBiquadState->coefs[0];
+ /* ynR+= ((-B2 * y(n-2)R ) ) */
+ templ = pBiquadState->pDelays[7] * pBiquadState->coefs[1];
+ ynR += templ;
- /* ynR+= ((-B2 * y(n-2)R ) ) */
- templ = pBiquadState->pDelays[7] * pBiquadState->coefs[1];
- ynR += templ;
+ /* ynR+= ((-B1 * y(n-1)R ) ) */
+ templ = pBiquadState->pDelays[5] * pBiquadState->coefs[2];
+ ynR += templ;
- /* ynR+= ((-B1 * y(n-1)R ) ) */
- templ = pBiquadState->pDelays[5] * pBiquadState->coefs[2];
- ynR += templ;
+ /* ynRO= ((Gain * ynR )) */
+ ynRO = ynR * pBiquadState->coefs[3];
- /* ynRO= ((Gain * ynR )) */
- ynRO = ynR * pBiquadState->coefs[3];
+ /* ynRO=( ynRO + x(n)R )*/
+ ynRO += (*(pDataIn + 1));
- /* ynRO=( ynRO + x(n)R )*/
- 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 */
+ pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
+ pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
+ pDataIn++;
+ pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
+ pDataIn++;
- /**************************************************************************
- 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 */
- pBiquadState->pDelays[4] = ynL; /* Update y(n-1)L */
- pBiquadState->pDelays[0] = (*pDataIn); /* Update x(n-1)L */
- pDataIn++;
- pBiquadState->pDelays[1] = (*pDataIn); /* Update x(n-1)R */
- pDataIn++;
-
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = ynLO; /* Write Left output*/
- pDataOut++;
- *pDataOut = ynRO; /* Write Right ouput*/
- pDataOut++;
-
- }
-
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = ynLO; /* Write Left output*/
+ pDataOut++;
+ *pDataOut = ynRO; /* Write Right output*/
+ pDataOut++;
}
+}
/**************************************************************************
DELAYS-
@@ -132,59 +125,51 @@
pBiquadState->pDelays[4*NrChannels - 1] is y(n-2) for all NrChannels
***************************************************************************/
-void PK_Mc_D32F32C14G11_TRC_WRA_01 (Biquad_FLOAT_Instance_t *pInstance,
- LVM_FLOAT *pDataIn,
- LVM_FLOAT *pDataOut,
- LVM_INT16 NrFrames,
- LVM_INT16 NrChannels)
- {
- LVM_FLOAT yn, ynO, temp;
- LVM_INT16 ii, jj;
- PFilter_State_Float pBiquadState = (PFilter_State_Float) pInstance;
+void PK_Mc_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn,
+ LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels) {
+ LVM_FLOAT yn, ynO, temp;
+ LVM_INT16 ii, jj;
+ PFilter_State_Float pBiquadState = (PFilter_State_Float)pInstance;
- for (ii = NrFrames; ii != 0; ii--)
- {
+ for (ii = NrFrames; ii != 0; ii--) {
+ for (jj = 0; jj < NrChannels; jj++) {
+ /**************************************************************************
+ PROCESSING OF THE jj CHANNEL
+ ***************************************************************************/
+ /* yn= (A0 * (x(n) - x(n-2)))*/
+ temp = (*pDataIn) - pBiquadState->pDelays[NrChannels + jj];
+ yn = temp * pBiquadState->coefs[0];
- for (jj = 0; jj < NrChannels; jj++)
- {
- /**************************************************************************
- PROCESSING OF THE jj CHANNEL
- ***************************************************************************/
- /* yn= (A0 * (x(n) - x(n-2)))*/
- temp = (*pDataIn) - pBiquadState->pDelays[NrChannels + jj];
- yn = temp * pBiquadState->coefs[0];
+ /* yn+= ((-B2 * y(n-2))) */
+ temp = pBiquadState->pDelays[NrChannels * 3 + jj] * pBiquadState->coefs[1];
+ yn += temp;
- /* yn+= ((-B2 * y(n-2))) */
- temp = pBiquadState->pDelays[NrChannels*3 + jj] * pBiquadState->coefs[1];
- yn += temp;
+ /* yn+= ((-B1 * y(n-1))) */
+ temp = pBiquadState->pDelays[NrChannels * 2 + jj] * pBiquadState->coefs[2];
+ yn += temp;
- /* yn+= ((-B1 * y(n-1))) */
- temp = pBiquadState->pDelays[NrChannels*2 + jj] * pBiquadState->coefs[2];
- yn += temp;
+ /* ynO= ((Gain * yn)) */
+ ynO = yn * pBiquadState->coefs[3];
- /* ynO= ((Gain * yn)) */
- ynO = yn * pBiquadState->coefs[3];
+ /* ynO=(ynO + x(n))*/
+ ynO += (*pDataIn);
- /* ynO=(ynO + x(n))*/
- ynO += (*pDataIn);
-
- /**************************************************************************
- UPDATING THE DELAYS
- ***************************************************************************/
- pBiquadState->pDelays[NrChannels * 3 + jj] =
+ /**************************************************************************
+ UPDATING THE DELAYS
+ ***************************************************************************/
+ pBiquadState->pDelays[NrChannels * 3 + jj] =
pBiquadState->pDelays[NrChannels * 2 + jj]; /* y(n-2)=y(n-1)*/
- pBiquadState->pDelays[NrChannels * 1 + jj] =
- pBiquadState->pDelays[jj]; /* x(n-2)=x(n-1)*/
- pBiquadState->pDelays[NrChannels * 2 + jj] = yn; /* Update y(n-1) */
- pBiquadState->pDelays[jj] = (*pDataIn); /* Update x(n-1)*/
- pDataIn++;
+ pBiquadState->pDelays[NrChannels * 1 + jj] =
+ pBiquadState->pDelays[jj]; /* x(n-2)=x(n-1)*/
+ pBiquadState->pDelays[NrChannels * 2 + jj] = yn; /* Update y(n-1) */
+ pBiquadState->pDelays[jj] = (*pDataIn); /* Update x(n-1)*/
+ pDataIn++;
- /**************************************************************************
- WRITING THE OUTPUT
- ***************************************************************************/
- *pDataOut = ynO; /* Write output*/
- pDataOut++;
- }
+ /**************************************************************************
+ WRITING THE OUTPUT
+ ***************************************************************************/
+ *pDataOut = ynO; /* Write output*/
+ pDataOut++;
}
-
}
+}
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 714aa52..1e08a55 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
@@ -17,4 +17,3 @@
#include "BIQUAD.h"
#include "PK_2I_D32F32CllGss_TRC_WRA_01_Private.h"
-
diff --git a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Private.h b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Private.h
index c5f9c7c..3f5d332 100644
--- a/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Private.h
+++ b/media/libeffects/lvm/lib/Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Private.h
@@ -20,12 +20,11 @@
/* 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_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT32 coefs[5]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT32 coefs[5]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
#endif /* _PK_2I_D32F32CLLGSS_TRC_WRA_01_PRIVATE_H_ */
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 f6c05da..178d766 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,12 +17,11 @@
#include "BIQUAD.h"
#include "PK_2I_D32F32CssGss_TRC_WRA_01_Private.h"
-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)
-{
- PFilter_State_Float pBiquadState = (PFilter_State_Float) pInstance;
- pBiquadState->pDelays = (LVM_FLOAT *) pTaps;
+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) {
+ PFilter_State_Float pBiquadState = (PFilter_State_Float)pInstance;
+ pBiquadState->pDelays = (LVM_FLOAT*)pTaps;
pBiquadState->coefs[0] = pCoef->A0;
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 cc924c4..57a1c16 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
@@ -21,19 +21,17 @@
/* 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_Float_
-{
- LVM_FLOAT * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
-}Filter_State_Float;
+typedef struct _Filter_State_Float_ {
+ LVM_FLOAT* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_FLOAT coefs[5]; /* pointer to the filter coefficients */
+} Filter_State_Float;
-typedef Filter_State_Float * PFilter_State_Float ;
-typedef struct _Filter_State_
-{
- LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
- LVM_INT32 coefs[5]; /* pointer to the filter coefficients */
-}Filter_State;
+typedef Filter_State_Float* PFilter_State_Float;
+typedef struct _Filter_State_ {
+ LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
+ LVM_INT32 coefs[5]; /* pointer to the filter coefficients */
+} Filter_State;
-typedef Filter_State * PFilter_State ;
+typedef Filter_State* PFilter_State;
#endif /* _PK_2I_D32F32CSSGSS_TRC_WRA_01_PRIVATE_H_ */
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 97a04c1..f54ba90 100644
--- a/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp
@@ -24,55 +24,39 @@
/**********************************************************************************
FUNCTION Shift_Sat_v32xv32
***********************************************************************************/
-void Shift_Sat_Float (const LVM_INT16 val,
- const LVM_FLOAT *src,
- LVM_FLOAT *dst,
- LVM_INT16 n)
-{
- LVM_FLOAT temp;
- LVM_INT32 ii,ij;
- LVM_INT16 RShift;
+void Shift_Sat_Float(const LVM_INT16 val, const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n) {
+ LVM_FLOAT temp;
+ LVM_INT32 ii, ij;
+ LVM_INT16 RShift;
- if(val > 0)
- {
- for (ii = n; ii != 0; ii--)
- {
+ if (val > 0) {
+ for (ii = n; ii != 0; ii--) {
temp = (LVM_FLOAT)*src;
src++;
- for(ij = 0; ij < val; ij++)
- {
+ for (ij = 0; ij < val; ij++) {
temp = temp * 2;
}
- if(temp > 1.0)
- temp = 1.0;
- if(temp < -1.0)
- temp = -1.0;
+ if (temp > 1.0) temp = 1.0;
+ if (temp < -1.0) temp = -1.0;
*dst = (LVM_FLOAT)temp;
dst++;
}
- }
- else if(val < 0)
- {
- RShift=(LVM_INT16)(-val);
+ } else if (val < 0) {
+ RShift = (LVM_INT16)(-val);
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
temp = (LVM_FLOAT)*src;
src++;
- for(ij = 0; ij < RShift; ij++)
- {
+ for (ij = 0; ij < RShift; ij++) {
temp = temp / 2;
}
*dst = (LVM_FLOAT)temp;
dst++;
}
- }
- else
- {
- if(src != dst)
- {
+ } else {
+ if (src != dst) {
Copy_Float(src, dst, n);
}
}
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 4da2013..2143465 100644
--- a/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp
+++ b/media/libeffects/lvm/lib/Common/src/dB_to_Lin32.cpp
@@ -57,17 +57,16 @@
*
****************************************************************************************/
-#define FOUR_OVER_SIX 21846 /* (4 / 6) * 2^15 */
-#define SIX_DB 96 /* 6 * 16 or 6dB in Q11.4 format */
-#define FIRST_COEF_NEG 14884305
-#define FIRST_COEF_POS 7442152 /* FIRST_COEF_NEG / 2 */
-#define SECOND_COEF 38836
-#define MAX_VALUE 1536 /* 96 * 16 */
+#define FOUR_OVER_SIX 21846 /* (4 / 6) * 2^15 */
+#define SIX_DB 96 /* 6 * 16 or 6dB in Q11.4 format */
+#define FIRST_COEF_NEG 14884305
+#define FIRST_COEF_POS 7442152 /* FIRST_COEF_NEG / 2 */
+#define SECOND_COEF 38836
+#define MAX_VALUE 1536 /* 96 * 16 */
-LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix)
-{
- LVM_FLOAT dB_Float;
- LVM_FLOAT LinFloat;
+LVM_FLOAT dB_to_LinFloat(LVM_INT16 db_fix) {
+ LVM_FLOAT dB_Float;
+ LVM_FLOAT LinFloat;
dB_Float = (LVM_FLOAT)((LVM_FLOAT)db_fix / 16.0f);
LinFloat = pow(10, dB_Float / 20.0);
diff --git a/media/libeffects/lvm/lib/Common/src/mult3s_16x16.cpp b/media/libeffects/lvm/lib/Common/src/mult3s_16x16.cpp
index 4092560..66f9132 100644
--- a/media/libeffects/lvm/lib/Common/src/mult3s_16x16.cpp
+++ b/media/libeffects/lvm/lib/Common/src/mult3s_16x16.cpp
@@ -25,16 +25,11 @@
FUNCTION MULT3S_16X16
***********************************************************************************/
-void Mult3s_16x16( const LVM_INT16 *src,
- const LVM_INT16 val,
- LVM_INT16 *dst,
- LVM_INT16 n)
-{
+void Mult3s_16x16(const LVM_INT16* src, const LVM_INT16 val, LVM_INT16* dst, LVM_INT16 n) {
LVM_INT16 ii;
LVM_INT32 temp;
- for (ii = n; ii != 0; ii--)
- {
+ for (ii = n; ii != 0; ii--) {
temp = (LVM_INT32)(*src) * (LVM_INT32)val;
src++;
diff --git a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
index 41e2bb5..f1afcd6 100644
--- a/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
+++ b/media/libeffects/lvm/lib/Eq/lib/LVEQNB.h
@@ -87,8 +87,8 @@
/****************************************************************************************/
/* Callback events */
-#define LVEQNB_EVENT_NONE 0x0000 /* Not a valid event */
-#define LVEQNB_EVENT_ALGOFF 0x0001 /* EQNB has completed switch off */
+#define LVEQNB_EVENT_NONE 0x0000 /* Not a valid event */
+#define LVEQNB_EVENT_ALGOFF 0x0001 /* EQNB has completed switch off */
/****************************************************************************************/
/* */
@@ -97,32 +97,25 @@
/****************************************************************************************/
/* Instance handle */
-typedef void *LVEQNB_Handle_t;
+typedef void* LVEQNB_Handle_t;
/* Operating modes */
-typedef enum
-{
- LVEQNB_BYPASS = 0,
- LVEQNB_ON = 1,
- LVEQNB_MODE_MAX = LVM_MAXINT_32
-} LVEQNB_Mode_en;
+typedef enum { LVEQNB_BYPASS = 0, LVEQNB_ON = 1, LVEQNB_MODE_MAX = LVM_MAXINT_32 } LVEQNB_Mode_en;
/* Filter mode control */
-typedef enum
-{
- LVEQNB_FILTER_OFF = 0,
- LVEQNB_FILTER_ON = 1,
+typedef enum {
+ LVEQNB_FILTER_OFF = 0,
+ LVEQNB_FILTER_ON = 1,
LVEQNB_FILTER_DUMMY = LVM_MAXINT_32
} LVEQNB_FilterMode_en;
/* Function return status */
-typedef enum
-{
- LVEQNB_SUCCESS = 0, /* Successful return from a routine */
- LVEQNB_ALIGNMENTERROR = 1, /* Memory alignment error */
- LVEQNB_NULLADDRESS = 2, /* NULL allocation address */
- LVEQNB_TOOMANYSAMPLES = 3, /* Maximum block size exceeded */
- LVEQNB_STATUS_MAX = LVM_MAXINT_32
+typedef enum {
+ LVEQNB_SUCCESS = 0, /* Successful return from a routine */
+ LVEQNB_ALIGNMENTERROR = 1, /* Memory alignment error */
+ LVEQNB_NULLADDRESS = 2, /* NULL allocation address */
+ LVEQNB_TOOMANYSAMPLES = 3, /* Maximum block size exceeded */
+ LVEQNB_STATUS_MAX = LVM_MAXINT_32
} LVEQNB_ReturnStatus_en;
/****************************************************************************************/
@@ -149,37 +142,35 @@
/*
* Supported source data formats
*/
-#define LVEQNB_CAP_STEREO 1
-#define LVEQNB_CAP_MONOINSTEREO 2
+#define LVEQNB_CAP_STEREO 1
+#define LVEQNB_CAP_MONOINSTEREO 2
-typedef enum
-{
- LVEQNB_STEREO = 0,
+typedef enum {
+ LVEQNB_STEREO = 0,
LVEQNB_MONOINSTEREO = 1,
LVEQNB_MULTICHANNEL = 2,
- LVEQNB_SOURCE_MAX = LVM_MAXINT_32
+ LVEQNB_SOURCE_MAX = LVM_MAXINT_32
} LVEQNB_SourceFormat_en;
/*
* Supported sample rates in samples per second
*/
-#define LVEQNB_CAP_FS_8000 1
-#define LVEQNB_CAP_FS_11025 2
-#define LVEQNB_CAP_FS_12000 4
-#define LVEQNB_CAP_FS_16000 8
-#define LVEQNB_CAP_FS_22050 16
-#define LVEQNB_CAP_FS_24000 32
-#define LVEQNB_CAP_FS_32000 64
-#define LVEQNB_CAP_FS_44100 128
-#define LVEQNB_CAP_FS_48000 256
-#define LVEQNB_CAP_FS_88200 512
-#define LVEQNB_CAP_FS_96000 1024
-#define LVEQNB_CAP_FS_176400 2048
-#define LVEQNB_CAP_FS_192000 4096
+#define LVEQNB_CAP_FS_8000 1
+#define LVEQNB_CAP_FS_11025 2
+#define LVEQNB_CAP_FS_12000 4
+#define LVEQNB_CAP_FS_16000 8
+#define LVEQNB_CAP_FS_22050 16
+#define LVEQNB_CAP_FS_24000 32
+#define LVEQNB_CAP_FS_32000 64
+#define LVEQNB_CAP_FS_44100 128
+#define LVEQNB_CAP_FS_48000 256
+#define LVEQNB_CAP_FS_88200 512
+#define LVEQNB_CAP_FS_96000 1024
+#define LVEQNB_CAP_FS_176400 2048
+#define LVEQNB_CAP_FS_192000 4096
-typedef enum
-{
- LVEQNB_FS_8000 = 0,
+typedef enum {
+ LVEQNB_FS_8000 = 0,
LVEQNB_FS_11025 = 1,
LVEQNB_FS_12000 = 2,
LVEQNB_FS_16000 = 3,
@@ -192,7 +183,7 @@
LVEQNB_FS_96000 = 10,
LVEQNB_FS_176400 = 11,
LVEQNB_FS_192000 = 12,
- LVEQNB_FS_MAX = LVM_MAXINT_32
+ LVEQNB_FS_MAX = LVM_MAXINT_32
} LVEQNB_Fs_en;
/****************************************************************************************/
@@ -202,40 +193,37 @@
/****************************************************************************************/
/* Equaliser band definition */
-typedef struct
-{
- LVM_INT16 Gain; /* Band gain in dB */
- LVM_UINT16 Frequency; /* Band centre frequency in Hz */
- LVM_UINT16 QFactor; /* Band quality factor */
+typedef struct {
+ LVM_INT16 Gain; /* Band gain in dB */
+ LVM_UINT16 Frequency; /* Band centre frequency in Hz */
+ LVM_UINT16 QFactor; /* Band quality factor */
} LVEQNB_BandDef_t;
/* Parameter structure */
-typedef struct
-{
+typedef struct {
/* General parameters */
- LVEQNB_Mode_en OperatingMode;
- LVEQNB_Fs_en SampleRate;
- LVEQNB_SourceFormat_en SourceFormat;
+ LVEQNB_Mode_en OperatingMode;
+ LVEQNB_Fs_en SampleRate;
+ LVEQNB_SourceFormat_en SourceFormat;
/* Equaliser parameters */
- LVM_UINT16 NBands; /* Number of bands */
- LVEQNB_BandDef_t *pBandDefinition; /* Pointer to equaliser definitions */
- LVM_INT16 NrChannels;
+ LVM_UINT16 NBands; /* Number of bands */
+ LVEQNB_BandDef_t* pBandDefinition; /* Pointer to equaliser definitions */
+ LVM_INT16 NrChannels;
} LVEQNB_Params_t;
/* Capability structure */
-typedef struct
-{
+typedef struct {
/* General parameters */
- LVM_UINT16 SampleRate;
+ LVM_UINT16 SampleRate;
- LVM_UINT16 SourceFormat;
- LVM_UINT16 MaxBlockSize;
- LVM_UINT16 MaxBands;
+ LVM_UINT16 SourceFormat;
+ LVM_UINT16 MaxBlockSize;
+ LVM_UINT16 MaxBands;
/* Callback parameters */
- LVM_Callback CallBack; /* Bundle callback */
- void *pBundleInstance; /* Bundle instance handle */
+ LVM_Callback CallBack; /* Bundle callback */
+ void* pBundleInstance; /* Bundle instance handle */
} LVEQNB_Capabilities_t;
@@ -266,9 +254,8 @@
/* 1. This function must not be interrupted by the LVEQNB_Process function */
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_Init(LVEQNB_Handle_t *phInstance,
- LVEQNB_Capabilities_t *pCapabilities,
- void *pScratch);
+LVEQNB_ReturnStatus_en LVEQNB_Init(LVEQNB_Handle_t* phInstance,
+ LVEQNB_Capabilities_t* pCapabilities, void* pScratch);
/****************************************************************************************/
/* */
@@ -284,7 +271,7 @@
/* 1. This function must not be interrupted by the LVEQNB_Process function */
/* */
/****************************************************************************************/
-void LVEQNB_DeInit(LVEQNB_Handle_t *phInstance);
+void LVEQNB_DeInit(LVEQNB_Handle_t* phInstance);
/****************************************************************************************/
/* */
@@ -307,8 +294,7 @@
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_GetParameters(LVEQNB_Handle_t hInstance,
- LVEQNB_Params_t *pParams);
+LVEQNB_ReturnStatus_en LVEQNB_GetParameters(LVEQNB_Handle_t hInstance, LVEQNB_Params_t* pParams);
/****************************************************************************************/
/* */
@@ -331,8 +317,8 @@
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_GetCapabilities(LVEQNB_Handle_t hInstance,
- LVEQNB_Capabilities_t *pCapabilities);
+LVEQNB_ReturnStatus_en LVEQNB_GetCapabilities(LVEQNB_Handle_t hInstance,
+ LVEQNB_Capabilities_t* pCapabilities);
/****************************************************************************************/
/* */
@@ -356,8 +342,7 @@
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_Control(LVEQNB_Handle_t hInstance,
- LVEQNB_Params_t *pParams);
+LVEQNB_ReturnStatus_en LVEQNB_Control(LVEQNB_Handle_t hInstance, LVEQNB_Params_t* pParams);
/****************************************************************************************/
/* */
@@ -381,10 +366,7 @@
/* NOTES: */
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples);
+LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, LVM_UINT16 NumSamples);
-#endif /* __LVEQNB__ */
-
+#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 c3c0fad..f8a5f2a 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_CalcCoef.cpp
@@ -111,43 +111,37 @@
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_FLOAT_Coefs_t *pCoefficients)
-{
-
- extern LVM_FLOAT LVEQNB_GainTable[];
- extern LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
- extern LVM_FLOAT LVEQNB_DTable[];
+LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs, LVEQNB_BandDef_t* pFilterDefinition,
+ PK_FLOAT_Coefs_t* pCoefficients) {
+ extern LVM_FLOAT LVEQNB_GainTable[];
+ extern LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVEQNB_DTable[];
/*
* Get the filter definition
*/
- LVM_INT16 Gain = pFilterDefinition->Gain;
- LVM_UINT16 Frequency = pFilterDefinition->Frequency;
+ LVM_INT16 Gain = pFilterDefinition->Gain;
+ LVM_UINT16 Frequency = pFilterDefinition->Frequency;
/* As mentioned in effectbundle.h */
- LVM_FLOAT QFactor = (LVM_FLOAT)pFilterDefinition->QFactor / 100.0f;
+ LVM_FLOAT QFactor = (LVM_FLOAT)pFilterDefinition->QFactor / 100.0f;
/*
* Intermediate variables and temporary values
*/
- LVM_FLOAT T0;
- LVM_FLOAT D;
- LVM_FLOAT A0;
- LVM_FLOAT B1;
- LVM_FLOAT B2;
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
/*
* Calculating the intermediate values
*/
- T0 = 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 */
+ T0 = 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 */
}
/*
@@ -164,7 +158,7 @@
pCoefficients->A0 = 2 * A0;
pCoefficients->B1 = 2 * B1;
pCoefficients->B2 = 2 * B2;
- pCoefficients->G = LVEQNB_GainTable[Gain + 15];
+ pCoefficients->G = LVEQNB_GainTable[Gain + 15];
- return(LVEQNB_SUCCESS);
+ return (LVEQNB_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
index 6329181..c44a9be 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
@@ -23,78 +23,78 @@
/* Gain table for (10^(Gain/20) - 1) */
/* */
/************************************************************************************/
-#define LVEQNB_Gain_Neg15_dB (-0.822172f)
-#define LVEQNB_Gain_Neg14_dB (-0.800474f)
-#define LVEQNB_Gain_Neg13_dB (-0.776128f)
-#define LVEQNB_Gain_Neg12_dB (-0.748811f)
-#define LVEQNB_Gain_Neg11_dB (-0.718162f)
-#define LVEQNB_Gain_Neg10_dB (-0.683772f)
-#define LVEQNB_Gain_Neg9_dB (-0.645187f)
-#define LVEQNB_Gain_Neg8_dB (-0.601893f)
-#define LVEQNB_Gain_Neg7_dB (-0.553316f)
-#define LVEQNB_Gain_Neg6_dB (-0.498813f)
-#define LVEQNB_Gain_Neg5_dB (-0.437659f)
-#define LVEQNB_Gain_Neg4_dB (-0.369043f)
-#define LVEQNB_Gain_Neg3_dB (-0.292054f)
-#define LVEQNB_Gain_Neg2_dB (-0.205672f)
-#define LVEQNB_Gain_Neg1_dB (-0.108749f)
-#define LVEQNB_Gain_0_dB 0.000000f
-#define LVEQNB_Gain_1_dB 0.122018f
-#define LVEQNB_Gain_2_dB 0.258925f
-#define LVEQNB_Gain_3_dB 0.412538f
-#define LVEQNB_Gain_4_dB 0.584893f
-#define LVEQNB_Gain_5_dB 0.778279f
-#define LVEQNB_Gain_6_dB 0.995262f
-#define LVEQNB_Gain_7_dB 1.238721f
-#define LVEQNB_Gain_8_dB 1.511886f
-#define LVEQNB_Gain_9_dB 1.818383f
-#define LVEQNB_Gain_10_dB 2.162278f
-#define LVEQNB_Gain_11_dB 2.548134f
-#define LVEQNB_Gain_12_dB 2.981072f
-#define LVEQNB_Gain_13_dB 3.466836f
-#define LVEQNB_Gain_14_dB 4.011872f
-#define LVEQNB_Gain_15_dB 4.623413f
+#define LVEQNB_Gain_Neg15_dB (-0.822172f)
+#define LVEQNB_Gain_Neg14_dB (-0.800474f)
+#define LVEQNB_Gain_Neg13_dB (-0.776128f)
+#define LVEQNB_Gain_Neg12_dB (-0.748811f)
+#define LVEQNB_Gain_Neg11_dB (-0.718162f)
+#define LVEQNB_Gain_Neg10_dB (-0.683772f)
+#define LVEQNB_Gain_Neg9_dB (-0.645187f)
+#define LVEQNB_Gain_Neg8_dB (-0.601893f)
+#define LVEQNB_Gain_Neg7_dB (-0.553316f)
+#define LVEQNB_Gain_Neg6_dB (-0.498813f)
+#define LVEQNB_Gain_Neg5_dB (-0.437659f)
+#define LVEQNB_Gain_Neg4_dB (-0.369043f)
+#define LVEQNB_Gain_Neg3_dB (-0.292054f)
+#define LVEQNB_Gain_Neg2_dB (-0.205672f)
+#define LVEQNB_Gain_Neg1_dB (-0.108749f)
+#define LVEQNB_Gain_0_dB 0.000000f
+#define LVEQNB_Gain_1_dB 0.122018f
+#define LVEQNB_Gain_2_dB 0.258925f
+#define LVEQNB_Gain_3_dB 0.412538f
+#define LVEQNB_Gain_4_dB 0.584893f
+#define LVEQNB_Gain_5_dB 0.778279f
+#define LVEQNB_Gain_6_dB 0.995262f
+#define LVEQNB_Gain_7_dB 1.238721f
+#define LVEQNB_Gain_8_dB 1.511886f
+#define LVEQNB_Gain_9_dB 1.818383f
+#define LVEQNB_Gain_10_dB 2.162278f
+#define LVEQNB_Gain_11_dB 2.548134f
+#define LVEQNB_Gain_12_dB 2.981072f
+#define LVEQNB_Gain_13_dB 3.466836f
+#define LVEQNB_Gain_14_dB 4.011872f
+#define LVEQNB_Gain_15_dB 4.623413f
/************************************************************************************/
/* */
/* Frequency table for 2*Pi/Fs */
/* */
/************************************************************************************/
-#define LVEQNB_2PiOn_8000 0.000785f
-#define LVEQNB_2PiOn_11025 0.000570f
-#define LVEQNB_2PiOn_12000 0.000524f
-#define LVEQNB_2PiOn_16000 0.000393f
-#define LVEQNB_2PiOn_22050 0.000285f
-#define LVEQNB_2PiOn_24000 0.000262f
-#define LVEQNB_2PiOn_32000 0.000196f
-#define LVEQNB_2PiOn_44100 0.000142f
-#define LVEQNB_2PiOn_48000 0.000131f
+#define LVEQNB_2PiOn_8000 0.000785f
+#define LVEQNB_2PiOn_11025 0.000570f
+#define LVEQNB_2PiOn_12000 0.000524f
+#define LVEQNB_2PiOn_16000 0.000393f
+#define LVEQNB_2PiOn_22050 0.000285f
+#define LVEQNB_2PiOn_24000 0.000262f
+#define LVEQNB_2PiOn_32000 0.000196f
+#define LVEQNB_2PiOn_44100 0.000142f
+#define LVEQNB_2PiOn_48000 0.000131f
-#define LVEQNB_2PiOn_88200 0.000071f
-#define LVEQNB_2PiOn_96000 0.000065f
-#define LVEQNB_2PiOn_176400 0.000036f
-#define LVEQNB_2PiOn_192000 0.000033f
+#define LVEQNB_2PiOn_88200 0.000071f
+#define LVEQNB_2PiOn_96000 0.000065f
+#define LVEQNB_2PiOn_176400 0.000036f
+#define LVEQNB_2PiOn_192000 0.000033f
/************************************************************************************/
/* */
/* 50D table for 50 / ( 1 + Gain ) */
/* */
/************************************************************************************/
-#define LVEQNB_100D_Neg15_dB 5.623413f
-#define LVEQNB_100D_Neg14_dB 5.011872f
-#define LVEQNB_100D_Neg13_dB 4.466836f
-#define LVEQNB_100D_Neg12_dB 3.981072f
-#define LVEQNB_100D_Neg11_dB 3.548134f
-#define LVEQNB_100D_Neg10_dB 3.162278f
-#define LVEQNB_100D_Neg9_dB 2.818383f
-#define LVEQNB_100D_Neg8_dB 2.511886f
-#define LVEQNB_100D_Neg7_dB 2.238721f
-#define LVEQNB_100D_Neg6_dB 1.995262f
-#define LVEQNB_100D_Neg5_dB 1.778279f
-#define LVEQNB_100D_Neg4_dB 1.584893f
-#define LVEQNB_100D_Neg3_dB 1.412538f
-#define LVEQNB_100D_Neg2_dB 1.258925f
-#define LVEQNB_100D_Neg1_dB 1.122018f
-#define LVEQNB_100D_0_dB 1.000000f
+#define LVEQNB_100D_Neg15_dB 5.623413f
+#define LVEQNB_100D_Neg14_dB 5.011872f
+#define LVEQNB_100D_Neg13_dB 4.466836f
+#define LVEQNB_100D_Neg12_dB 3.981072f
+#define LVEQNB_100D_Neg11_dB 3.548134f
+#define LVEQNB_100D_Neg10_dB 3.162278f
+#define LVEQNB_100D_Neg9_dB 2.818383f
+#define LVEQNB_100D_Neg8_dB 2.511886f
+#define LVEQNB_100D_Neg7_dB 2.238721f
+#define LVEQNB_100D_Neg6_dB 1.995262f
+#define LVEQNB_100D_Neg5_dB 1.778279f
+#define LVEQNB_100D_Neg4_dB 1.584893f
+#define LVEQNB_100D_Neg3_dB 1.412538f
+#define LVEQNB_100D_Neg2_dB 1.258925f
+#define LVEQNB_100D_Neg1_dB 1.122018f
+#define LVEQNB_100D_0_dB 1.000000f
#endif
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
index 6bb4a7e..bccbe86 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Control.cpp
@@ -32,8 +32,8 @@
/* */
/****************************************************************************************/
-#define LOW_FREQ 298 /* 32768/110 for low test frequency */
-#define HIGH_FREQ 386 /* 32768/85 for high test frequency */
+#define LOW_FREQ 298 /* 32768/110 for low test frequency */
+#define HIGH_FREQ 386 /* 32768/85 for high test frequency */
/****************************************************************************************/
/* */
@@ -56,23 +56,19 @@
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_GetParameters(LVEQNB_Handle_t hInstance,
- LVEQNB_Params_t *pParams)
-{
+LVEQNB_ReturnStatus_en LVEQNB_GetParameters(LVEQNB_Handle_t hInstance, LVEQNB_Params_t* pParams) {
+ LVEQNB_Instance_t* pInstance = (LVEQNB_Instance_t*)hInstance;
- LVEQNB_Instance_t *pInstance =(LVEQNB_Instance_t *)hInstance;
-
- /*
+ /*
* Check for error conditions
*/
- if((hInstance == LVM_NULL) || (pParams == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pParams == LVM_NULL)) {
return LVEQNB_NULLADDRESS;
}
*pParams = pInstance->Params;
- return(LVEQNB_SUCCESS);
+ return (LVEQNB_SUCCESS);
}
/************************************************************************************/
@@ -96,20 +92,17 @@
/* */
/************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_GetCapabilities(LVEQNB_Handle_t hInstance,
- LVEQNB_Capabilities_t *pCapabilities)
-{
+LVEQNB_ReturnStatus_en LVEQNB_GetCapabilities(LVEQNB_Handle_t hInstance,
+ LVEQNB_Capabilities_t* pCapabilities) {
+ LVEQNB_Instance_t* pInstance = (LVEQNB_Instance_t*)hInstance;
- LVEQNB_Instance_t *pInstance =(LVEQNB_Instance_t *)hInstance;
-
- if((hInstance == LVM_NULL) || (pCapabilities == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pCapabilities == LVM_NULL)) {
return LVEQNB_NULLADDRESS;
}
*pCapabilities = pInstance->Capabilities;
- return(LVEQNB_SUCCESS);
+ return (LVEQNB_SUCCESS);
}
/************************************************************************************/
@@ -134,33 +127,30 @@
/* */
/************************************************************************************/
-void LVEQNB_SetFilters(LVEQNB_Instance_t *pInstance,
- LVEQNB_Params_t *pParams)
-{
- extern const LVM_UINT32 LVEQNB_SampleRateTab[]; /* Sample rate table */
+void LVEQNB_SetFilters(LVEQNB_Instance_t* pInstance, LVEQNB_Params_t* pParams) {
+ extern const LVM_UINT32 LVEQNB_SampleRateTab[]; /* Sample rate table */
- 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 */
+ 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++)
- {
+ for (i = 0; i < pParams->NBands; i++) {
/*
* Get the filter settings
*/
- fc = (LVM_UINT32)pParams->pBandDefinition[i].Frequency; /* Get the band centre frequency */
- QFactor = (LVM_INT16)pParams->pBandDefinition[i].QFactor; /* Get the band Q factor */
+ fc = (LVM_UINT32)pParams->pBandDefinition[i].Frequency; /* Get the band centre frequency */
+ QFactor = (LVM_INT16)pParams->pBandDefinition[i].QFactor; /* Get the band Q factor */
pInstance->pBiquadType[i] = LVEQNB_SinglePrecision_Float; /* Default to single precision */
/*
* Check for out of range frequencies
*/
- if (fc > (fs >> 1))
- {
+ if (fc > (fs >> 1)) {
pInstance->pBiquadType[i] = LVEQNB_OutOfRange;
}
@@ -168,7 +158,6 @@
* Copy the filter definition to persistant memory
*/
pInstance->pBandDefinitions[i] = pParams->pBandDefinition[i];
-
}
}
@@ -186,46 +175,37 @@
/* */
/************************************************************************************/
-void LVEQNB_SetCoefficients(LVEQNB_Instance_t *pInstance)
-{
-
- LVM_UINT16 i; /* Filter band index */
- LVEQNB_BiquadType_en BiquadType; /* Filter biquad type */
+void LVEQNB_SetCoefficients(LVEQNB_Instance_t* pInstance) {
+ LVM_UINT16 i; /* Filter band index */
+ LVEQNB_BiquadType_en BiquadType; /* Filter biquad type */
/*
* Set the coefficients for each band by the init function
*/
- for (i=0; i<pInstance->Params.NBands; i++)
- {
-
+ for (i = 0; i < pInstance->Params.NBands; i++) {
/*
* Check band type for correct initialisation method and recalculate the coefficients
*/
BiquadType = pInstance->pBiquadType[i];
- switch (BiquadType)
- {
- case LVEQNB_SinglePrecision_Float:
- {
- PK_FLOAT_Coefs_t Coefficients;
+ switch (BiquadType) {
+ case LVEQNB_SinglePrecision_Float: {
+ PK_FLOAT_Coefs_t Coefficients;
/*
* Calculate the single precision coefficients
*/
LVEQNB_SinglePrecCoefs((LVM_UINT16)pInstance->Params.SampleRate,
- &pInstance->pBandDefinitions[i],
- &Coefficients);
+ &pInstance->pBandDefinitions[i], &Coefficients);
/*
* Set the coefficients
*/
PK_2I_D32F32CssGss_TRC_WRA_01_Init(&pInstance->pEQNB_FilterState_Float[i],
- &pInstance->pEQNB_Taps_Float[i],
- &Coefficients);
+ &pInstance->pEQNB_Taps_Float[i], &Coefficients);
break;
}
default:
break;
}
}
-
}
/************************************************************************************/
@@ -239,20 +219,19 @@
/* pInstance Pointer to the instance */
/* */
/************************************************************************************/
-void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance)
-{
- LVM_FLOAT *pTapAddress;
- LVM_INT16 NumTaps;
+void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t* pInstance) {
+ LVM_FLOAT* pTapAddress;
+ LVM_INT16 NumTaps;
- pTapAddress = (LVM_FLOAT *)pInstance->pEQNB_Taps_Float;
- NumTaps = (LVM_INT16)((pInstance->Capabilities.MaxBands * \
- sizeof(Biquad_2I_Order2_FLOAT_Taps_t)) / sizeof(LVM_FLOAT));
+ pTapAddress = (LVM_FLOAT*)pInstance->pEQNB_Taps_Float;
+ NumTaps =
+ (LVM_INT16)((pInstance->Capabilities.MaxBands * sizeof(Biquad_2I_Order2_FLOAT_Taps_t)) /
+ sizeof(LVM_FLOAT));
- if (NumTaps != 0)
- {
- LoadConst_Float(0, /* Clear the history, value 0 */
- pTapAddress, /* Destination */
- NumTaps); /* Number of words */
+ if (NumTaps != 0) {
+ LoadConst_Float(0, /* Clear the history, value 0 */
+ pTapAddress, /* Destination */
+ NumTaps); /* Number of words */
}
}
/****************************************************************************************/
@@ -277,56 +256,47 @@
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_Control(LVEQNB_Handle_t hInstance,
- LVEQNB_Params_t *pParams)
-{
-
- LVEQNB_Instance_t *pInstance = (LVEQNB_Instance_t *)hInstance;
- LVM_INT16 bChange = LVM_FALSE;
- LVM_INT16 i = 0;
- LVEQNB_Mode_en OperatingModeSave ;
+LVEQNB_ReturnStatus_en LVEQNB_Control(LVEQNB_Handle_t hInstance, LVEQNB_Params_t* pParams) {
+ LVEQNB_Instance_t* pInstance = (LVEQNB_Instance_t*)hInstance;
+ LVM_INT16 bChange = LVM_FALSE;
+ LVM_INT16 i = 0;
+ LVEQNB_Mode_en OperatingModeSave;
/*
* Check for error conditions
*/
- if((hInstance == LVM_NULL) || (pParams == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pParams == LVM_NULL)) {
return LVEQNB_NULLADDRESS;
}
- if((pParams->NBands !=0) && (pParams->pBandDefinition==LVM_NULL))
- {
+ if ((pParams->NBands != 0) && (pParams->pBandDefinition == LVM_NULL)) {
return LVEQNB_NULLADDRESS;
}
OperatingModeSave = pInstance->Params.OperatingMode;
/* Set the alpha factor of the mixer */
- if (pParams->SampleRate != pInstance->Params.SampleRate)
- {
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
+ if (pParams->SampleRate != pInstance->Params.SampleRate) {
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],
+ LVEQNB_BYPASS_MIXER_TC, (LVM_Fs_en)pParams->SampleRate,
+ 2);
+ 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 ) ||
- (pInstance->Params.SampleRate != pParams->SampleRate ) ||
- (pInstance->Params.SourceFormat != pParams->SourceFormat ))
- {
-
+ if ((pInstance->Params.NBands != pParams->NBands) ||
+ (pInstance->Params.OperatingMode != pParams->OperatingMode) ||
+ (pInstance->Params.pBandDefinition != pParams->pBandDefinition) ||
+ (pInstance->Params.SampleRate != pParams->SampleRate) ||
+ (pInstance->Params.SourceFormat != pParams->SourceFormat)) {
bChange = LVM_TRUE;
- }
- else
- {
- for(i = 0; i < pParams->NBands; i++)
- {
-
- if((pInstance->pBandDefinitions[i].Frequency != pParams->pBandDefinition[i].Frequency )||
- (pInstance->pBandDefinitions[i].Gain != pParams->pBandDefinition[i].Gain )||
- (pInstance->pBandDefinitions[i].QFactor != pParams->pBandDefinition[i].QFactor ))
- {
-
+ } else {
+ for (i = 0; i < pParams->NBands; i++) {
+ if ((pInstance->pBandDefinitions[i].Frequency !=
+ pParams->pBandDefinition[i].Frequency) ||
+ (pInstance->pBandDefinitions[i].Gain != pParams->pBandDefinition[i].Gain) ||
+ (pInstance->pBandDefinitions[i].QFactor != pParams->pBandDefinition[i].QFactor)) {
bChange = LVM_TRUE;
}
}
@@ -335,19 +305,17 @@
// 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.
- const int /* bool */ modeChange = pParams->OperatingMode != OperatingModeSave
- || (OperatingModeSave == LVEQNB_ON
- && pInstance->bInOperatingModeTransition
- && LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0);
+ const int /* bool */ modeChange =
+ pParams->OperatingMode != OperatingModeSave ||
+ (OperatingModeSave == LVEQNB_ON && pInstance->bInOperatingModeTransition &&
+ LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0);
if (bChange || modeChange) {
-
/*
* If the sample rate has changed clear the history
*/
- if (pInstance->Params.SampleRate != pParams->SampleRate)
- {
- LVEQNB_ClearFilterHistory(pInstance); /* Clear the history */
+ if (pInstance->Params.SampleRate != pParams->SampleRate) {
+ LVEQNB_ClearFilterHistory(pInstance); /* Clear the history */
}
/*
@@ -358,45 +326,45 @@
/*
* Reset the filters except if the algo is switched off
*/
- if(pParams->OperatingMode != LVEQNB_BYPASS){
+ if (pParams->OperatingMode != LVEQNB_BYPASS) {
/*
* Reset the filters as all parameters could have changed
*/
- LVEQNB_SetFilters(pInstance, /* Instance pointer */
- pParams); /* New parameters */
+ LVEQNB_SetFilters(pInstance, /* Instance pointer */
+ pParams); /* New parameters */
/*
* Update the filters
*/
- LVEQNB_SetCoefficients(pInstance); /* Instance pointer */
+ LVEQNB_SetCoefficients(pInstance); /* Instance pointer */
}
if (modeChange) {
- if(pParams->OperatingMode == LVEQNB_ON)
- {
+ if (pParams->OperatingMode == LVEQNB_ON) {
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0], 1.0f);
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1], 0.0f);
- pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
- pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
- }
- else
- {
+ pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
+ pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
+ } else {
/* Stay on the ON operating mode until the transition is done */
// 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;
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[0], 0.0f);
LVC_Mixer_SetTarget(&pInstance->BypassMixer.MixerStream[1], 1.0f);
- pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
- pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
+ pInstance->BypassMixer.MixerStream[0].CallbackSet = 1;
+ pInstance->BypassMixer.MixerStream[1].CallbackSet = 1;
}
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
- LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],LVEQNB_BYPASS_MIXER_TC,(LVM_Fs_en)pParams->SampleRate,2);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],
+ LVEQNB_BYPASS_MIXER_TC,
+ (LVM_Fs_en)pParams->SampleRate, 2);
+ LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1],
+ LVEQNB_BYPASS_MIXER_TC,
+ (LVM_Fs_en)pParams->SampleRate, 2);
pInstance->bInOperatingModeTransition = LVM_TRUE;
}
-
}
- return(LVEQNB_SUCCESS);
+ return (LVEQNB_SUCCESS);
}
/****************************************************************************************/
@@ -408,23 +376,22 @@
/* transition */
/* */
/****************************************************************************************/
-LVM_INT32 LVEQNB_BypassMixerCallBack (void* hInstance,
- void *pGeneralPurpose,
- LVM_INT16 CallbackParam)
-{
- LVEQNB_Instance_t *pInstance =(LVEQNB_Instance_t *)hInstance;
- LVM_Callback CallBack = pInstance->Capabilities.CallBack;
+LVM_INT32 LVEQNB_BypassMixerCallBack(void* hInstance, void* pGeneralPurpose,
+ LVM_INT16 CallbackParam) {
+ LVEQNB_Instance_t* pInstance = (LVEQNB_Instance_t*)hInstance;
+ LVM_Callback CallBack = pInstance->Capabilities.CallBack;
- (void) pGeneralPurpose;
+ (void)pGeneralPurpose;
- /*
- * Send an ALGOFF event if the ON->OFF switch transition is finished
- */
- if((LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0) &&
- (CallbackParam == 0)){
+ /*
+ * Send an ALGOFF event if the ON->OFF switch transition is finished
+ */
+ if ((LVC_Mixer_GetTarget(&pInstance->BypassMixer.MixerStream[0]) == 0) &&
+ (CallbackParam == 0)) {
pInstance->Params.OperatingMode = LVEQNB_BYPASS;
- if (CallBack != LVM_NULL){
- CallBack(pInstance->Capabilities.pBundleInstance, LVM_NULL, ALGORITHM_EQNB_ID|LVEQNB_EVENT_ALGOFF);
+ 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 932af71..1d2a5f5 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp
@@ -48,42 +48,35 @@
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_Init(LVEQNB_Handle_t *phInstance,
- LVEQNB_Capabilities_t *pCapabilities,
- void *pScratch)
-{
-
- LVEQNB_Instance_t *pInstance;
+LVEQNB_ReturnStatus_en LVEQNB_Init(LVEQNB_Handle_t* phInstance,
+ LVEQNB_Capabilities_t* pCapabilities, void* pScratch) {
+ LVEQNB_Instance_t* pInstance;
*phInstance = calloc(1, sizeof(*pInstance));
- if (phInstance == LVM_NULL)
- {
+ if (phInstance == LVM_NULL) {
return LVEQNB_NULLADDRESS;
}
- pInstance =(LVEQNB_Instance_t *)*phInstance;
+ pInstance = (LVEQNB_Instance_t*)*phInstance;
pInstance->Capabilities = *pCapabilities;
pInstance->pScratch = pScratch;
/* Equaliser Biquad Instance */
LVM_UINT32 MemSize = pCapabilities->MaxBands * sizeof(*(pInstance->pEQNB_FilterState_Float));
- pInstance->pEQNB_FilterState_Float = (Biquad_FLOAT_Instance_t *)calloc(1, MemSize);
- if (pInstance->pEQNB_FilterState_Float == LVM_NULL)
- {
+ pInstance->pEQNB_FilterState_Float = (Biquad_FLOAT_Instance_t*)calloc(1, MemSize);
+ if (pInstance->pEQNB_FilterState_Float == LVM_NULL) {
return LVEQNB_NULLADDRESS;
}
MemSize = (pCapabilities->MaxBands * sizeof(*(pInstance->pEQNB_Taps_Float)));
- pInstance->pEQNB_Taps_Float = (Biquad_2I_Order2_FLOAT_Taps_t *)calloc(1, MemSize);
- if (pInstance->pEQNB_Taps_Float == LVM_NULL)
- {
+ pInstance->pEQNB_Taps_Float = (Biquad_2I_Order2_FLOAT_Taps_t*)calloc(1, MemSize);
+ if (pInstance->pEQNB_Taps_Float == LVM_NULL) {
return LVEQNB_NULLADDRESS;
}
MemSize = (pCapabilities->MaxBands * sizeof(*(pInstance->pBandDefinitions)));
- pInstance->pBandDefinitions = (LVEQNB_BandDef_t *)calloc(1, MemSize);
- if (pInstance->pBandDefinitions == LVM_NULL)
- {
+ pInstance->pBandDefinitions = (LVEQNB_BandDef_t*)calloc(1, MemSize);
+ if (pInstance->pBandDefinitions == LVM_NULL) {
return LVEQNB_NULLADDRESS;
}
// clear all the bands, setting their gain to 0, otherwise when applying new params,
@@ -91,54 +84,53 @@
memset(pInstance->pBandDefinitions, 0, MemSize);
MemSize = (pCapabilities->MaxBands * sizeof(*(pInstance->pBiquadType)));
- pInstance->pBiquadType = (LVEQNB_BiquadType_en *)calloc(1, MemSize);
- if (pInstance->pBiquadType == LVM_NULL)
- {
+ pInstance->pBiquadType = (LVEQNB_BiquadType_en*)calloc(1, MemSize);
+ if (pInstance->pBiquadType == LVM_NULL) {
return LVEQNB_NULLADDRESS;
}
- pInstance->pFastTemporary = (LVM_FLOAT *)pScratch;
+ pInstance->pFastTemporary = (LVM_FLOAT*)pScratch;
/*
* Update the instance parameters
*/
- pInstance->Params.NBands = 0;
- pInstance->Params.OperatingMode = LVEQNB_BYPASS;
+ pInstance->Params.NBands = 0;
+ pInstance->Params.OperatingMode = LVEQNB_BYPASS;
pInstance->Params.pBandDefinition = LVM_NULL;
- pInstance->Params.SampleRate = LVEQNB_FS_8000;
- pInstance->Params.SourceFormat = LVEQNB_STEREO;
+ pInstance->Params.SampleRate = LVEQNB_FS_8000;
+ pInstance->Params.SourceFormat = LVEQNB_STEREO;
/*
* Initialise the filters
*/
- LVEQNB_SetFilters(pInstance, /* Set the filter types */
+ LVEQNB_SetFilters(pInstance, /* Set the filter types */
&pInstance->Params);
- LVEQNB_SetCoefficients(pInstance); /* Set the filter coefficients */
+ LVEQNB_SetCoefficients(pInstance); /* Set the filter coefficients */
- LVEQNB_ClearFilterHistory(pInstance); /* Clear the filter history */
+ LVEQNB_ClearFilterHistory(pInstance); /* Clear the filter history */
/*
* Initialise the bypass variables
*/
- pInstance->BypassMixer.MixerStream[0].CallbackSet = 0;
- pInstance->BypassMixer.MixerStream[0].CallbackParam = 0;
- pInstance->BypassMixer.MixerStream[0].pCallbackHandle = (void*)pInstance;
- pInstance->BypassMixer.MixerStream[0].pCallBack = LVEQNB_BypassMixerCallBack;
+ pInstance->BypassMixer.MixerStream[0].CallbackSet = 0;
+ pInstance->BypassMixer.MixerStream[0].CallbackParam = 0;
+ pInstance->BypassMixer.MixerStream[0].pCallbackHandle = (void*)pInstance;
+ pInstance->BypassMixer.MixerStream[0].pCallBack = LVEQNB_BypassMixerCallBack;
- LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[0],0,0);
- LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[0],0,LVM_FS_8000,2);
+ 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;
+ 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;
LVC_Mixer_Init(&pInstance->BypassMixer.MixerStream[1], 0, 1.0f);
LVC_Mixer_SetTimeConstant(&pInstance->BypassMixer.MixerStream[1], 0, LVM_FS_8000, 2);
- pInstance->bInOperatingModeTransition = LVM_FALSE;
+ pInstance->bInOperatingModeTransition = LVM_FALSE;
- return(LVEQNB_SUCCESS);
+ return (LVEQNB_SUCCESS);
}
/****************************************************************************************/
/* */
@@ -155,14 +147,12 @@
/* */
/****************************************************************************************/
-void LVEQNB_DeInit(LVEQNB_Handle_t *phInstance)
-{
-
- LVEQNB_Instance_t *pInstance;
+void LVEQNB_DeInit(LVEQNB_Handle_t* phInstance) {
+ LVEQNB_Instance_t* pInstance;
if (phInstance == LVM_NULL) {
return;
}
- pInstance =(LVEQNB_Instance_t *)*phInstance;
+ pInstance = (LVEQNB_Instance_t*)*phInstance;
/* Equaliser Biquad Instance */
if (pInstance->pEQNB_FilterState_Float != LVM_NULL) {
@@ -184,4 +174,3 @@
free(pInstance);
*phInstance = LVM_NULL;
}
-
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
index 9569d85..83a3449 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Private.h
@@ -24,7 +24,7 @@
/* */
/****************************************************************************************/
-#include "LVEQNB.h" /* Calling or Application layer definitions */
+#include "LVEQNB.h" /* Calling or Application layer definitions */
#include "BIQUAD.h"
#include "LVC_Mixer.h"
@@ -35,8 +35,8 @@
/****************************************************************************************/
/* General */
-#define LVEQNB_INVALID 0xFFFF /* Invalid init parameter */
-#define LVEQNB_BYPASS_MIXER_TC 100 /* Bypass Mixer TC */
+#define LVEQNB_INVALID 0xFFFF /* Invalid init parameter */
+#define LVEQNB_BYPASS_MIXER_TC 100 /* Bypass Mixer TC */
/****************************************************************************************/
/* */
@@ -45,13 +45,12 @@
/****************************************************************************************/
/* Filter biquad types */
-typedef enum
-{
+typedef enum {
LVEQNB_SinglePrecision_Float = -1,
LVEQNB_SinglePrecision = 0,
LVEQNB_DoublePrecision = 1,
- LVEQNB_OutOfRange = 2,
- LVEQNB_BIQUADTYPE_MAX = LVM_MAXINT_32
+ LVEQNB_OutOfRange = 2,
+ LVEQNB_BIQUADTYPE_MAX = LVM_MAXINT_32
} LVEQNB_BiquadType_en;
/****************************************************************************************/
@@ -61,28 +60,27 @@
/****************************************************************************************/
/* Instance structure */
-typedef struct
-{
+typedef struct {
/* Public parameters */
- void *pScratch; /* Pointer to bundle scratch buffer */
- LVEQNB_Params_t Params; /* Instance parameters */
- LVEQNB_Capabilities_t Capabilities; /* Instance capabilities */
+ void* pScratch; /* Pointer to bundle scratch buffer */
+ LVEQNB_Params_t Params; /* Instance parameters */
+ LVEQNB_Capabilities_t Capabilities; /* Instance capabilities */
/* Aligned memory pointers */
- LVM_FLOAT *pFastTemporary; /* Fast temporary data base address */
+ LVM_FLOAT* pFastTemporary; /* Fast temporary data base address */
- Biquad_2I_Order2_FLOAT_Taps_t *pEQNB_Taps_Float; /* Equaliser Taps */
- Biquad_FLOAT_Instance_t *pEQNB_FilterState_Float; /* State for each filter band */
+ Biquad_2I_Order2_FLOAT_Taps_t* pEQNB_Taps_Float; /* Equaliser Taps */
+ Biquad_FLOAT_Instance_t* pEQNB_FilterState_Float; /* State for each filter band */
/* Filter definitions and call back */
- LVM_UINT16 NBands; /* Number of bands */
- LVEQNB_BandDef_t *pBandDefinitions; /* Filter band definitions */
- LVEQNB_BiquadType_en *pBiquadType; /* Filter biquad types */
+ LVM_UINT16 NBands; /* Number of bands */
+ LVEQNB_BandDef_t* pBandDefinitions; /* Filter band definitions */
+ LVEQNB_BiquadType_en* pBiquadType; /* Filter biquad types */
/* Bypass variable */
- LVMixer3_2St_FLOAT_st BypassMixer;
+ LVMixer3_2St_FLOAT_st BypassMixer;
- LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */
+ LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */
} LVEQNB_Instance_t;
@@ -92,17 +90,15 @@
/* */
/****************************************************************************************/
-void LVEQNB_SetFilters(LVEQNB_Instance_t *pInstance,
- LVEQNB_Params_t *pParams);
+void LVEQNB_SetFilters(LVEQNB_Instance_t* pInstance, LVEQNB_Params_t* pParams);
-void LVEQNB_SetCoefficients(LVEQNB_Instance_t *pInstance);
+void LVEQNB_SetCoefficients(LVEQNB_Instance_t* pInstance);
-void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t *pInstance);
-LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs,
- LVEQNB_BandDef_t *pFilterDefinition,
- PK_FLOAT_Coefs_t *pCoefficients);
+void LVEQNB_ClearFilterHistory(LVEQNB_Instance_t* pInstance);
+LVEQNB_ReturnStatus_en LVEQNB_SinglePrecCoefs(LVM_UINT16 Fs, LVEQNB_BandDef_t* pFilterDefinition,
+ PK_FLOAT_Coefs_t* pCoefficients);
-LVM_INT32 LVEQNB_BypassMixerCallBack (void* hInstance, void *pGeneralPurpose, LVM_INT16 CallbackParam);
+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 8dd5587..d2a26db 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.cpp
@@ -34,7 +34,7 @@
/* */
/****************************************************************************************/
-#define SHIFT 13
+#define SHIFT 13
/****************************************************************************************/
/* */
@@ -58,76 +58,63 @@
/* NOTES: */
/* */
/****************************************************************************************/
-LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- const LVM_UINT16 NrFrames)
-{ // updated to use samples = frames * channels.
- LVEQNB_Instance_t *pInstance = (LVEQNB_Instance_t *)hInstance;
+LVEQNB_ReturnStatus_en LVEQNB_Process(
+ LVEQNB_Handle_t hInstance, const LVM_FLOAT* pInData, LVM_FLOAT* pOutData,
+ const LVM_UINT16 NrFrames) { // updated to use samples = frames * channels.
+ LVEQNB_Instance_t* pInstance = (LVEQNB_Instance_t*)hInstance;
// Mono passed in as stereo
- const LVM_INT32 NrChannels = pInstance->Params.NrChannels == 1
- ? 2 : pInstance->Params.NrChannels;
+ const LVM_INT32 NrChannels =
+ pInstance->Params.NrChannels == 1 ? 2 : pInstance->Params.NrChannels;
const LVM_INT32 NrSamples = NrChannels * NrFrames;
- /* Check for NULL pointers */
- if((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
- {
+ /* 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))
- {
+ if ((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0)) {
return LVEQNB_ALIGNMENTERROR;
}
- LVM_FLOAT * const pScratch = (LVM_FLOAT *)pInstance->pFastTemporary;
+ LVM_FLOAT* const pScratch = (LVM_FLOAT*)pInstance->pFastTemporary;
/*
- * Check the number of frames is not too large
- */
- if (NrFrames > pInstance->Capabilities.MaxBlockSize)
- {
+ * Check the number of frames is not too large
+ */
+ if (NrFrames > pInstance->Capabilities.MaxBlockSize) {
return LVEQNB_TOOMANYSAMPLES;
}
- if (pInstance->Params.OperatingMode == LVEQNB_ON)
- {
+ if (pInstance->Params.OperatingMode == LVEQNB_ON) {
/*
* Copy input data in to scratch buffer
*/
- Copy_Float(pInData, /* Source */
- pScratch, /* Destination */
+ Copy_Float(pInData, /* Source */
+ pScratch, /* Destination */
(LVM_INT16)NrSamples);
/*
* For each section execte the filter unless the gain is 0dB
*/
- if (pInstance->NBands != 0)
- {
- for (LVM_UINT16 i = 0; i < pInstance->NBands; i++)
- {
+ if (pInstance->NBands != 0) {
+ for (LVM_UINT16 i = 0; i < pInstance->NBands; i++) {
/*
* Check if band is non-zero dB gain
*/
- if (pInstance->pBandDefinitions[i].Gain != 0)
- {
+ if (pInstance->pBandDefinitions[i].Gain != 0) {
/*
* Get the address of the biquad instance
*/
- Biquad_FLOAT_Instance_t *pBiquad = &pInstance->pEQNB_FilterState_Float[i];
+ Biquad_FLOAT_Instance_t* pBiquad = &pInstance->pEQNB_FilterState_Float[i];
/*
* Select single or double precision as required
*/
- switch (pInstance->pBiquadType[i])
- {
- case LVEQNB_SinglePrecision_Float:
- {
- PK_Mc_D32F32C14G11_TRC_WRA_01(pBiquad,
- pScratch,
- pScratch,
+ switch (pInstance->pBiquadType[i]) {
+ case LVEQNB_SinglePrecision_Float: {
+ PK_Mc_D32F32C14G11_TRC_WRA_01(pBiquad, pScratch, pScratch,
(LVM_INT16)NrFrames,
(LVM_INT16)NrChannels);
break;
@@ -139,36 +126,27 @@
}
}
- if(pInstance->bInOperatingModeTransition == LVM_TRUE){
- LVC_MixSoft_2Mc_D16C31_SAT(&pInstance->BypassMixer,
- pScratch,
- pInData,
- pScratch,
- (LVM_INT16)NrFrames,
- (LVM_INT16)NrChannels);
+ if (pInstance->bInOperatingModeTransition == LVM_TRUE) {
+ LVC_MixSoft_2Mc_D16C31_SAT(&pInstance->BypassMixer, pScratch, pInData, pScratch,
+ (LVM_INT16)NrFrames, (LVM_INT16)NrChannels);
// duplicate with else clause(s)
- Copy_Float(pScratch, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)NrSamples); /* All channel samples */
- }
- else{
+ Copy_Float(pScratch, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16)NrSamples); /* All channel samples */
+ } else {
Copy_Float(pScratch, /* Source */
pOutData, /* Destination */
(LVM_INT16)NrSamples); /* All channel samples */
}
- }
- else
- {
+ } else {
/*
* Mode is OFF so copy the data if necessary
*/
- if (pInData != pOutData)
- {
- Copy_Float(pInData, /* Source */
- pOutData, /* Destination */
- (LVM_INT16)NrSamples); /* All channel samples */
+ if (pInData != pOutData) {
+ Copy_Float(pInData, /* Source */
+ pOutData, /* Destination */
+ (LVM_INT16)NrSamples); /* All channel samples */
}
}
return LVEQNB_SUCCESS;
-
}
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
index 0628114..d79d7c9 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.cpp
@@ -35,20 +35,9 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-const LVM_UINT32 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000,
- 88200,
- 96000,
- 176400,
- 192000
-};
+const LVM_UINT32 LVEQNB_SampleRateTab[] = {8000, /* 8kS/s */
+ 11025, 12000, 16000, 22050, 24000, 32000,
+ 44100, 48000, 88200, 96000, 176400, 192000};
/************************************************************************************/
/* */
@@ -59,74 +48,34 @@
/*
* Table for 2 * Pi / Fs
*/
-const LVM_FLOAT 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
- ,LVEQNB_2PiOn_88200
- ,LVEQNB_2PiOn_96000
- ,LVEQNB_2PiOn_176400
- ,LVEQNB_2PiOn_192000
- };
+const LVM_FLOAT 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,
+ LVEQNB_2PiOn_88200, LVEQNB_2PiOn_96000, LVEQNB_2PiOn_176400, LVEQNB_2PiOn_192000};
/*
* Gain table
*/
-const LVM_FLOAT 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 */
+const LVM_FLOAT 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 */
/*
* D table for 100 / (Gain + 1)
*/
-const LVM_FLOAT 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 */
+const LVM_FLOAT 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 */
/************************************************************************************/
/* */
/* Filter polynomial coefficients */
@@ -142,13 +91,13 @@
* a range of 0 to Pi. The output is in the range 32767 to -32768 representing the range
* +1.0 to -1.0
*/
-const LVM_INT16 LVEQNB_CosCoef[] = {3, /* Shifts */
- 4096, /* a0 */
- -36, /* a1 */
- -19725, /* a2 */
- -2671, /* a3 */
- 23730, /* a4 */
- -9490}; /* a5 */
+const LVM_INT16 LVEQNB_CosCoef[] = {3, /* Shifts */
+ 4096, /* a0 */
+ -36, /* a1 */
+ -19725, /* a2 */
+ -2671, /* a3 */
+ 23730, /* a4 */
+ -9490}; /* a5 */
/*
* Coefficients for calculating the cosine error with the equation:
@@ -164,9 +113,8 @@
*
* Cos(x) = 1.0 - CosErr(x)
*/
-const LVM_INT16 LVEQNB_DPCosCoef[] = {1, /* Shifts */
- 0, /* a0 */
- -6, /* a1 */
- 16586, /* a2 */
- -44}; /* a3 */
-
+const LVM_INT16 LVEQNB_DPCosCoef[] = {1, /* Shifts */
+ 0, /* a0 */
+ -6, /* a1 */
+ 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 a71eeb9..ab51196 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Tables.h
@@ -27,7 +27,7 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-extern const LVM_UINT32 LVEQNB_SampleRateTab[];
+extern const LVM_UINT32 LVEQNB_SampleRateTab[];
/************************************************************************************/
/* */
@@ -38,17 +38,17 @@
/*
* Table for 2 * Pi / Fs
*/
-extern const LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
+extern const LVM_FLOAT LVEQNB_TwoPiOnFsTable[];
/*
* Gain table
*/
-extern const LVM_FLOAT LVEQNB_GainTable[];
+extern const LVM_FLOAT LVEQNB_GainTable[];
/*
* D table for 100 / (Gain + 1)
*/
-extern const LVM_FLOAT LVEQNB_DTable[];
+extern const LVM_FLOAT LVEQNB_DTable[];
/************************************************************************************/
/* */
@@ -65,7 +65,7 @@
* a range of 0 to Pi. The output is in the range 32767 to -32768 representing the range
* +1.0 to -1.0
*/
-extern const LVM_INT16 LVEQNB_CosCoef[];
+extern const LVM_INT16 LVEQNB_CosCoef[];
/*
* Coefficients for calculating the cosine error with the equation:
@@ -81,6 +81,6 @@
*
* Cos(x) = 1.0 - CosErr(x)
*/
-extern const LVM_INT16 LVEQNB_DPCosCoef[];
+extern const LVM_INT16 LVEQNB_DPCosCoef[];
#endif /* __LVEQNB_TABLES_H__ */
diff --git a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
index 8c91ea9..484787a 100644
--- a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
+++ b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
@@ -41,11 +41,11 @@
/* */
/****************************************************************************************/
/* General */
-#define LVREV_BLOCKSIZE_MULTIPLE 1 /* Processing block size multiple */
-#define LVREV_MAX_T60 7000 /* Maximum decay time is 7000ms */
+#define LVREV_BLOCKSIZE_MULTIPLE 1 /* Processing block size multiple */
+#define LVREV_MAX_T60 7000 /* Maximum decay time is 7000ms */
/* Memory table*/
-#define LVREV_NR_MEMORY_REGIONS 4 /* Number of memory regions */
+#define LVREV_NR_MEMORY_REGIONS 4 /* Number of memory regions */
/****************************************************************************************/
/* */
@@ -53,24 +53,22 @@
/* */
/****************************************************************************************/
/* Instance handle */
-typedef void *LVREV_Handle_t;
+typedef void* LVREV_Handle_t;
/* Status return values */
-typedef enum
-{
- LVREV_SUCCESS = 0, /* Successful return from a routine */
- LVREV_NULLADDRESS = 1, /* NULL allocation address */
- LVREV_OUTOFRANGE = 2, /* Out of range control parameter */
- LVREV_INVALIDNUMSAMPLES = 3, /* Invalid number of samples */
+typedef enum {
+ LVREV_SUCCESS = 0, /* Successful return from a routine */
+ LVREV_NULLADDRESS = 1, /* NULL allocation address */
+ LVREV_OUTOFRANGE = 2, /* Out of range control parameter */
+ LVREV_INVALIDNUMSAMPLES = 3, /* Invalid number of samples */
LVREV_RETURNSTATUS_DUMMY = LVM_MAXENUM
} LVREV_ReturnStatus_en;
/* Reverb delay lines */
-typedef enum
-{
- LVREV_DELAYLINES_1 = 1, /* One delay line */
- LVREV_DELAYLINES_2 = 2, /* Two delay lines */
- LVREV_DELAYLINES_4 = 4, /* Four delay lines */
+typedef enum {
+ LVREV_DELAYLINES_1 = 1, /* One delay line */
+ LVREV_DELAYLINES_2 = 2, /* Two delay lines */
+ LVREV_DELAYLINES_4 = 4, /* Four delay lines */
LVREV_DELAYLINES_DUMMY = LVM_MAXENUM
} LVREV_NumDelayLines_en;
@@ -81,40 +79,37 @@
/****************************************************************************************/
/* Memory table containing the region definitions */
-typedef struct
-{
- LVM_MemoryRegion_st Region[LVREV_NR_MEMORY_REGIONS]; /* One definition for each region */
+typedef struct {
+ LVM_MemoryRegion_st Region[LVREV_NR_MEMORY_REGIONS]; /* One definition for each region */
} LVREV_MemoryTable_st;
/* Control Parameter structure */
-typedef struct
-{
+typedef struct {
/* General parameters */
- LVM_Mode_en OperatingMode; /* Operating mode */
- LVM_Fs_en SampleRate; /* Sample rate */
- LVM_Format_en SourceFormat; /* Source data format */
+ LVM_Mode_en OperatingMode; /* Operating mode */
+ LVM_Fs_en SampleRate; /* Sample rate */
+ LVM_Format_en SourceFormat; /* Source data format */
/* Parameters for REV */
- LVM_UINT16 Level; /* Level, 0 to 100 representing percentage of reverb */
- LVM_UINT32 LPF; /* Low pass filter, in Hz */
- LVM_UINT32 HPF; /* High pass filter, in Hz */
+ LVM_UINT16 Level; /* Level, 0 to 100 representing percentage of reverb */
+ LVM_UINT32 LPF; /* Low pass filter, in Hz */
+ LVM_UINT32 HPF; /* High pass filter, in Hz */
- LVM_UINT16 T60; /* Decay time constant, in ms */
- LVM_UINT16 Density; /* Echo density, 0 to 100 for minimum to maximum density */
- LVM_UINT16 Damping; /* Damping */
- LVM_UINT16 RoomSize; /* Simulated room size, 1 to 100 for minimum to maximum size */
+ LVM_UINT16 T60; /* Decay time constant, in ms */
+ LVM_UINT16 Density; /* Echo density, 0 to 100 for minimum to maximum density */
+ LVM_UINT16 Damping; /* Damping */
+ LVM_UINT16 RoomSize; /* Simulated room size, 1 to 100 for minimum to maximum size */
} LVREV_ControlParams_st;
/* Instance Parameter structure */
-typedef struct
-{
+typedef struct {
/* General */
- LVM_UINT16 MaxBlockSize; /* Maximum processing block size */
+ LVM_UINT16 MaxBlockSize; /* Maximum processing block size */
/* Reverb */
- LVM_Format_en SourceFormat; /* Source data formats to support */
- LVREV_NumDelayLines_en NumDelays; /* The number of delay lines, 1, 2 or 4 */
+ LVM_Format_en SourceFormat; /* Source data formats to support */
+ LVREV_NumDelayLines_en NumDelays; /* The number of delay lines, 1, 2 or 4 */
} LVREV_InstanceParams_st;
@@ -160,9 +155,9 @@
/* 1. This function may be interrupted by the LVREV_Process function */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_GetMemoryTable(LVREV_Handle_t hInstance,
- LVREV_MemoryTable_st *pMemoryTable,
- LVREV_InstanceParams_st *pInstanceParams);
+LVREV_ReturnStatus_en LVREV_GetMemoryTable(LVREV_Handle_t hInstance,
+ LVREV_MemoryTable_st* pMemoryTable,
+ LVREV_InstanceParams_st* pInstanceParams);
/****************************************************************************************/
/* */
@@ -190,9 +185,9 @@
/* NOTES: */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t *phInstance,
- LVREV_MemoryTable_st *pMemoryTable,
- LVREV_InstanceParams_st *pInstanceParams);
+LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t* phInstance,
+ LVREV_MemoryTable_st* pMemoryTable,
+ LVREV_InstanceParams_st* pInstanceParams);
/****************************************************************************************/
/* */
@@ -214,8 +209,8 @@
/* 1. This function may be interrupted by the LVREV_Process function */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_GetControlParameters(LVREV_Handle_t hInstance,
- LVREV_ControlParams_st *pControlParams);
+LVREV_ReturnStatus_en LVREV_GetControlParameters(LVREV_Handle_t hInstance,
+ LVREV_ControlParams_st* pControlParams);
/****************************************************************************************/
/* */
@@ -236,8 +231,8 @@
/* 1. This function may be interrupted by the LVREV_Process function */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_SetControlParameters(LVREV_Handle_t hInstance,
- LVREV_ControlParams_st *pNewParams);
+LVREV_ReturnStatus_en LVREV_SetControlParameters(LVREV_Handle_t hInstance,
+ LVREV_ControlParams_st* pNewParams);
/****************************************************************************************/
/* */
@@ -257,7 +252,7 @@
/* 1. This function must not be interrupted by the LVREV_Process function */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t hInstance);
+LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t hInstance);
/****************************************************************************************/
/* */
@@ -280,11 +275,9 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- const LVM_UINT16 NumSamples);
+LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, const LVM_UINT16 NumSamples);
-#endif /* __LVREV_H__ */
+#endif /* __LVREV_H__ */
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp
index 1f0d39b..737ef01 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.cpp
@@ -41,160 +41,134 @@
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
-{
-
- LVM_Mode_en OperatingMode;
- LVM_INT32 NumberOfDelayLines;
+LVREV_ReturnStatus_en LVREV_ApplyNewSettings(LVREV_Instance_st* pPrivate) {
+ LVM_Mode_en OperatingMode;
+ LVM_INT32 NumberOfDelayLines;
/* Check for NULL pointer */
- if(pPrivate == LVM_NULL)
- {
+ if (pPrivate == LVM_NULL) {
return LVREV_NULLADDRESS;
}
OperatingMode = pPrivate->NewParams.OperatingMode;
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
+ if (pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4) {
NumberOfDelayLines = 4;
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
- {
+ } else if (pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2) {
NumberOfDelayLines = 2;
- }
- else
- {
+ } 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_FLOAT Omega;
- FO_FLOAT_Coefs_t Coeffs;
+ if ((pPrivate->NewParams.HPF != pPrivate->CurrentParams.HPF) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE)) {
+ LVM_FLOAT Omega;
+ FO_FLOAT_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_Float(0,
- (LVM_FLOAT *)&pPrivate->pFastData->HPTaps,
+ FO_1I_D32F32Cll_TRC_WRA_01_Init(&pPrivate->pFastCoef->HPCoefs, &pPrivate->pFastData->HPTaps,
+ &Coeffs);
+ LoadConst_Float(0, (LVM_FLOAT*)&pPrivate->pFastData->HPTaps,
sizeof(Biquad_1I_Order1_FLOAT_Taps_t) / sizeof(LVM_FLOAT));
}
/*
* Update the low pass filter coefficients
*/
- if((pPrivate->NewParams.LPF != pPrivate->CurrentParams.LPF) ||
- (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_FLOAT Omega;
- FO_FLOAT_Coefs_t Coeffs;
+ if ((pPrivate->NewParams.LPF != pPrivate->CurrentParams.LPF) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE)) {
+ LVM_FLOAT Omega;
+ FO_FLOAT_Coefs_t Coeffs;
Coeffs.A0 = 1;
Coeffs.A1 = 0;
Coeffs.B1 = 0;
- if(pPrivate->NewParams.LPF <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
- {
+ 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 <= (LVM_FLOAT)LVREV_2_9_INQ29)
- {
+ if (Omega <= (LVM_FLOAT)LVREV_2_9_INQ29) {
LVM_FO_LPF(Omega, &Coeffs);
}
}
- FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->LPCoefs,
- &pPrivate->pFastData->LPTaps, &Coeffs);
- LoadConst_Float(0,
- (LVM_FLOAT *)&pPrivate->pFastData->LPTaps,
+ FO_1I_D32F32Cll_TRC_WRA_01_Init(&pPrivate->pFastCoef->LPCoefs, &pPrivate->pFastData->LPTaps,
+ &Coeffs);
+ LoadConst_Float(0, (LVM_FLOAT*)&pPrivate->pFastData->LPTaps,
sizeof(Biquad_1I_Order1_FLOAT_Taps_t) / sizeof(LVM_FLOAT));
}
/*
* Calculate the room size parameter
*/
- if( pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize)
- {
+ 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);
+ 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) ||
+ 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_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};
- 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};
+ (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_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};
+ 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_FLOAT Temp1; /* to avoid QAC warning on type conversion */
+ for (i = 0; i < NumberOfDelayLines; i++) {
+ if (i != 0) {
+ LVM_FLOAT Temp1; /* to avoid QAC warning on type conversion */
- Temp1=(LVM_FLOAT)DelayLengthSamples;
+ Temp1 = (LVM_FLOAT)DelayLengthSamples;
Temp = (LVM_UINT32)(Temp1 * ScaleTable[i]);
+ } else {
+ Temp = DelayLengthSamples;
}
- else
- {
- Temp = DelayLengthSamples;
- }
- APDelaySize = Temp / 1500;
+ APDelaySize = Temp / 1500;
/*
* Set the fixed delay
*/
- Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 192000;
+ Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 192000;
pPrivate->Delay_AP[i] = pPrivate->T[i] - Temp;
/*
* Set the tap selection
*/
- if (pPrivate->AB_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->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 = 1.0f;
- }
- else
- {
+ } 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->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 = 1.0f;
}
@@ -202,22 +176,17 @@
/*
* Set the maximum block size to the smallest delay size
*/
- pPrivate->MaxBlkLen = Temp;
- if (pPrivate->MaxBlkLen > pPrivate->A_DelaySize[i])
- {
+ pPrivate->MaxBlkLen = Temp;
+ if (pPrivate->MaxBlkLen > pPrivate->A_DelaySize[i]) {
pPrivate->MaxBlkLen = pPrivate->A_DelaySize[i];
}
- if (pPrivate->MaxBlkLen > pPrivate->B_DelaySize[i])
- {
+ if (pPrivate->MaxBlkLen > pPrivate->B_DelaySize[i]) {
pPrivate->MaxBlkLen = pPrivate->B_DelaySize[i];
}
}
- if (pPrivate->AB_Selection)
- {
+ if (pPrivate->AB_Selection) {
pPrivate->AB_Selection = 0;
- }
- else
- {
+ } else {
pPrivate->AB_Selection = 1;
}
@@ -226,8 +195,7 @@
*/
/* Just as a precausion, but no problem if we remove this line */
pPrivate->MaxBlkLen = pPrivate->MaxBlkLen - 2;
- if(pPrivate->MaxBlkLen > pPrivate->InstanceParams.MaxBlockSize)
- {
+ if (pPrivate->MaxBlkLen > pPrivate->InstanceParams.MaxBlockSize) {
pPrivate->MaxBlkLen = (LVM_INT32)pPrivate->InstanceParams.MaxBlockSize;
}
}
@@ -235,39 +203,30 @@
/*
* Update the low pass filter coefficient
*/
- if( (pPrivate->NewParams.Damping != pPrivate->CurrentParams.Damping) ||
+ if ((pPrivate->NewParams.Damping != pPrivate->CurrentParams.Damping) ||
(pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
-
- LVM_INT32 Temp;
- LVM_FLOAT Omega;
- FO_FLOAT_Coefs_t Coeffs;
- LVM_INT16 i;
- LVM_INT16 Damping = (LVM_INT16)((pPrivate->NewParams.Damping * 100) + 1000);
- 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};
+ (pPrivate->bFirstControl == LVM_TRUE)) {
+ LVM_INT32 Temp;
+ LVM_FLOAT Omega;
+ FO_FLOAT_Coefs_t Coeffs;
+ LVM_INT16 i;
+ LVM_INT16 Damping = (LVM_INT16)((pPrivate->NewParams.Damping * 100) + 1000);
+ 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
*/
- for (i = 0; i < NumberOfDelayLines; i++)
- {
- if (i != 0)
- {
+ for (i = 0; i < NumberOfDelayLines; i++) {
+ if (i != 0) {
Temp = (LVM_INT32)(ScaleTable[i] * Damping);
- }
- else
- {
+ } else {
Temp = Damping;
}
- if(Temp <= (LVM_INT32)(LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
- {
+ if (Temp <= (LVM_INT32)(LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1)) {
Omega = LVM_GetOmega(Temp, pPrivate->NewParams.SampleRate);
LVM_FO_LPF(Omega, &Coeffs);
- }
- else
- {
+ } else {
Coeffs.A0 = 1;
Coeffs.A1 = 0;
Coeffs.B1 = 0;
@@ -280,27 +239,23 @@
/*
* Update All-pass filter mixer time constants
*/
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ if ((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
(pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density))
- {
- LVM_INT16 i;
- LVM_FLOAT Alpha;
- LVM_FLOAT AlphaTap;
+ (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density)) {
+ LVM_INT16 i;
+ LVM_FLOAT Alpha;
+ LVM_FLOAT AlphaTap;
Alpha = LVM_Mixer_TimeConstant(LVREV_ALLPASS_TC,
- LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
- 1);
+ LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), 1);
AlphaTap = LVM_Mixer_TimeConstant(LVREV_ALLPASS_TAP_TC,
- LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
- 1);
+ 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;
+ 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;
}
}
@@ -308,150 +263,121 @@
/*
* Update the feed back gain
*/
- if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ if ((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
(pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
- (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
+ (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) ||
+ (pPrivate->bFirstControl == LVM_TRUE)) {
+ LVM_FLOAT G[4]; /* Feedback gain (Q7.24) */
- LVM_FLOAT G[4]; /* Feedback gain (Q7.24) */
-
- if(pPrivate->NewParams.T60 == 0)
- {
+ if (pPrivate->NewParams.T60 == 0) {
G[3] = 0;
G[2] = 0;
G[1] = 0;
G[0] = 0;
- }
- else
- {
- LVM_FLOAT Temp1;
- LVM_FLOAT Temp2;
- LVM_INT16 i;
- 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};
+ } else {
+ LVM_FLOAT Temp1;
+ LVM_FLOAT Temp2;
+ LVM_INT16 i;
+ 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
*/
- for (i = 0; i < NumberOfDelayLines; i++)
- {
+ for (i = 0; i < NumberOfDelayLines; i++) {
Temp1 = (3 * pPrivate->RoomSizeInms * ScaleTable[i]) / pPrivate->NewParams.T60;
- if(Temp1 >= (4))
- {
+ if (Temp1 >= (4)) {
G[i] = 0;
- }
- else if((Temp1 >= (2)))
- {
+ } else if ((Temp1 >= (2))) {
Temp2 = LVM_Power10(-(Temp1 / 2.0f));
Temp1 = LVM_Power10(-(Temp1 / 2.0f));
Temp1 = Temp1 * Temp2;
- }
- else
- {
+ } else {
Temp1 = LVM_Power10(-(Temp1));
}
- if (NumberOfDelayLines == 1)
- {
+ if (NumberOfDelayLines == 1) {
G[i] = Temp1;
- }
- else
- {
- LVM_FLOAT TempG;
+ } else {
+ LVM_FLOAT TempG;
TempG = Temp1 * ONE_OVER_SQRT_TWO;
- G[i]=TempG;
+ G[i] = TempG;
}
}
}
/* Set up the feedback mixers for four delay lines */
- pPrivate->FeedbackMixer[0].Target=G[0];
- pPrivate->FeedbackMixer[1].Target=G[1];
- pPrivate->FeedbackMixer[2].Target=G[2];
- pPrivate->FeedbackMixer[3].Target=G[3];
+ pPrivate->FeedbackMixer[0].Target = G[0];
+ pPrivate->FeedbackMixer[1].Target = G[1];
+ pPrivate->FeedbackMixer[2].Target = G[2];
+ pPrivate->FeedbackMixer[3].Target = G[3];
}
/*
* 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;
+ if ((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) ||
+ (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60)) {
+ LVM_INT32 Index = 0;
LVM_FLOAT Index_FLOAT;
- LVM_INT32 i=0;
- LVM_FLOAT Gain=0;
- LVM_INT32 RoomSize=0;
+ LVM_INT32 i = 0;
+ LVM_FLOAT Gain = 0;
+ LVM_INT32 RoomSize = 0;
LVM_FLOAT T60;
LVM_FLOAT Coefs[5];
- if(pPrivate->NewParams.RoomSize == 0)
- {
+ if (pPrivate->NewParams.RoomSize == 0) {
RoomSize = 1;
- }
- else
- {
+ } else {
RoomSize = (LVM_INT32)pPrivate->NewParams.RoomSize;
}
- if(pPrivate->NewParams.T60 < 100)
- {
+ if (pPrivate->NewParams.T60 < 100) {
T60 = 100 * LVREV_T60_SCALE;
- }
- else
- {
+ } 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])
- {
+ for (i = 0; i < 24; i++) {
+ if (RoomSize <= LVREV_GainPolyTable[i][0]) {
Index = i;
break;
}
}
- if(RoomSize == LVREV_GainPolyTable[Index][0])
- {
+ 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];
+ 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
- {
+ Gain = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
+ } else {
/* Interpolate the gain between nearest room sizes */
- LVM_FLOAT Gain1,Gain2;
- LVM_INT32 Tot_Dist,Dist;
+ LVM_FLOAT Gain1, Gain2;
+ LVM_INT32 Tot_Dist, Dist;
- Tot_Dist = (LVM_UINT32)LVREV_GainPolyTable[Index][0] - \
- (LVM_UINT32)LVREV_GainPolyTable[Index-1][0];
+ Tot_Dist = (LVM_UINT32)LVREV_GainPolyTable[Index][0] -
+ (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++)
- {
- Coefs[i-1] = LVREV_GainPolyTable[Index-1][i];
+ 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 */
+ 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];
+ 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 */
+ Gain2 = LVM_Polynomial(3, Coefs, T60); /* Q.24 result */
/* Linear Interpolate the gain */
Gain = Gain1 + (((Gain2 - Gain1) * Dist) / (Tot_Dist));
@@ -461,32 +387,27 @@
* Get the inverse of gain: Q.15
* Gain is mostly above one except few cases, take only gains above 1
*/
- if(Gain < 1)
- {
+ if (Gain < 1) {
pPrivate->Gain = 1;
- }
- else
- {
+ } else {
pPrivate->Gain = 1 / Gain;
}
Index_FLOAT = 100.0f / (LVM_FLOAT)(100 + pPrivate->NewParams.Level);
pPrivate->Gain = pPrivate->Gain * Index_FLOAT;
- pPrivate->GainMixer.Target = (pPrivate->Gain*Index_FLOAT) / 2;
+ pPrivate->GainMixer.Target = (pPrivate->Gain * Index_FLOAT) / 2;
}
/*
* Update the all pass comb filter coefficient
*/
- if( (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density) ||
- (pPrivate->bFirstControl == LVM_TRUE))
- {
- LVM_INT16 i;
- LVM_FLOAT b = (LVM_FLOAT)pPrivate->NewParams.Density * LVREV_B_8_on_1000;
+ if ((pPrivate->NewParams.Density != pPrivate->CurrentParams.Density) ||
+ (pPrivate->bFirstControl == LVM_TRUE)) {
+ LVM_INT16 i;
+ LVM_FLOAT b = (LVM_FLOAT)pPrivate->NewParams.Density * LVREV_B_8_on_1000;
- for (i = 0; i < 4; i++)
- {
- pPrivate->Mixer_SGFeedback[i].Target = b;
+ for (i = 0; i < 4; i++) {
+ pPrivate->Mixer_SGFeedback[i].Target = b;
pPrivate->Mixer_SGFeedforward[i].Target = b;
}
}
@@ -494,11 +415,10 @@
/*
* 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_FLOAT Alpha;
+ if ((pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE)) {
+ LVM_UINT16 NumChannels = 1; /* Assume MONO format */
+ LVM_FLOAT Alpha;
Alpha = LVM_Mixer_TimeConstant(LVREV_FEEDBACKMIXER_TC,
LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
@@ -508,67 +428,55 @@
pPrivate->FeedbackMixer[2].Alpha = Alpha;
pPrivate->FeedbackMixer[3].Alpha = Alpha;
- NumChannels = 2; /* Always stereo output */
- pPrivate->BypassMixer.Alpha1 = LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC,
- LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
+ NumChannels = 2; /* Always stereo output */
+ pPrivate->BypassMixer.Alpha1 = LVM_Mixer_TimeConstant(
+ LVREV_BYPASSMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate),
+ NumChannels);
pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
- pPrivate->GainMixer.Alpha = 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_FLOAT)(pPrivate->NewParams.Level ) / 100.0f;
+ if ((pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) &&
+ (pPrivate->NewParams.OperatingMode == LVM_MODE_ON)) {
+ pPrivate->BypassMixer.Target2 = (LVM_FLOAT)(pPrivate->NewParams.Level) / 100.0f;
pPrivate->BypassMixer.Target1 = 0x00000000;
- if ((pPrivate->NewParams.Level == 0) && (pPrivate->bFirstControl == LVM_FALSE))
- {
+ if ((pPrivate->NewParams.Level == 0) && (pPrivate->bFirstControl == LVM_FALSE)) {
pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
}
- if (pPrivate->NewParams.Level != 0)
- {
+ 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_FLOAT)(pPrivate->NewParams.Level ) / 100.0f;
+ if (pPrivate->NewParams.OperatingMode != pPrivate->CurrentParams.OperatingMode) {
+ if (pPrivate->NewParams.OperatingMode == LVM_MODE_ON) {
+ pPrivate->BypassMixer.Target2 = (LVM_FLOAT)(pPrivate->NewParams.Level) / 100.0f;
pPrivate->BypassMixer.Target1 = 0x00000000;
pPrivate->BypassMixer.CallbackSet2 = LVM_FALSE;
- OperatingMode = LVM_MODE_ON;
- if (pPrivate->NewParams.Level == 0)
- {
+ OperatingMode = LVM_MODE_ON;
+ if (pPrivate->NewParams.Level == 0) {
pPrivate->bDisableReverb = LVM_TRUE;
- }
- else
- {
+ } else {
pPrivate->bDisableReverb = LVM_FALSE;
}
- }
- else if (pPrivate->bFirstControl == LVM_FALSE)
- {
+ } else if (pPrivate->bFirstControl == LVM_FALSE) {
pPrivate->BypassMixer.Target2 = 0x00000000;
pPrivate->BypassMixer.Target1 = 0x00000000;
pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
- pPrivate->GainMixer.Target = 0.03125f;
+ pPrivate->GainMixer.Target = 0.03125f;
OperatingMode = LVM_MODE_ON;
- }
- else
- {
+ } 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)
- {
+ if (pPrivate->bFirstControl == LVM_TRUE) {
pPrivate->BypassMixer.Current1 = pPrivate->BypassMixer.Target1;
pPrivate->BypassMixer.Current2 = pPrivate->BypassMixer.Target2;
}
@@ -582,8 +490,7 @@
/*
* Update flag
*/
- if(pPrivate->bFirstControl == LVM_TRUE)
- {
+ if (pPrivate->bFirstControl == LVM_TRUE) {
pPrivate->bFirstControl = LVM_FALSE;
}
@@ -606,12 +513,9 @@
/* NOTES: */
/* */
/****************************************************************************************/
-LVM_INT32 BypassMixer_Callback (void *pCallbackData,
- void *pGeneralPurpose,
- LVM_INT16 GeneralPurpose )
-{
-
- LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)pCallbackData;
+LVM_INT32 BypassMixer_Callback(void* pCallbackData, void* pGeneralPurpose,
+ LVM_INT16 GeneralPurpose) {
+ LVREV_Instance_st* pLVREV_Private = (LVREV_Instance_st*)pCallbackData;
/*
* Avoid build warnings
@@ -623,11 +527,10 @@
* Turn off
*/
pLVREV_Private->CurrentParams.OperatingMode = LVM_MODE_OFF;
- pLVREV_Private->bDisableReverb = LVM_TRUE;
+ pLVREV_Private->bDisableReverb = LVM_TRUE;
LVREV_ClearAudioBuffers((LVREV_Handle_t)pCallbackData);
return 0;
}
/* End of file */
-
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
index 586539f..5c83ce5 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.cpp
@@ -41,17 +41,14 @@
/* 1. This function must not be interrupted by the LVM_Process function */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t hInstance)
-{
-
- LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t hInstance) {
+ LVREV_Instance_st* pLVREV_Private = (LVREV_Instance_st*)hInstance;
/*
* Check for error conditions
*/
/* Check for NULL pointers */
- if(hInstance == LVM_NULL)
- {
+ if (hInstance == LVM_NULL) {
return LVREV_NULLADDRESS;
}
@@ -59,18 +56,13 @@
* Clear all filter tap data, delay-lines and other signal related data
*/
- LoadConst_Float(0,
- (LVM_FLOAT *)&pLVREV_Private->pFastData->HPTaps,
- 2);
- LoadConst_Float(0,
- (LVM_FLOAT *)&pLVREV_Private->pFastData->LPTaps,
- 2);
- if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
- 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);
- LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+ LoadConst_Float(0, (LVM_FLOAT*)&pLVREV_Private->pFastData->HPTaps, 2);
+ LoadConst_Float(0, (LVM_FLOAT*)&pLVREV_Private->pFastData->LPTaps, 2);
+ if ((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays == LVREV_DELAYLINES_4) {
+ 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);
+ LoadConst_Float(0, (LVM_FLOAT*)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
LoadConst_Float(0, pLVREV_Private->pDelay_T[3], LVREV_MAX_T3_DELAY);
LoadConst_Float(0, pLVREV_Private->pDelay_T[2], LVREV_MAX_T2_DELAY);
@@ -78,18 +70,16 @@
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
}
- if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_2)
- {
- LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
- LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+ if ((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_2) {
+ 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);
}
- if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_1)
- {
- LoadConst_Float(0, (LVM_FLOAT *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+ if ((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_1) {
+ LoadConst_Float(0, (LVM_FLOAT*)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
}
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 e0b0142..f858b74 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.cpp
@@ -42,17 +42,14 @@
/* 1. This function may be interrupted by the LVREV_Process function */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_GetControlParameters(LVREV_Handle_t hInstance,
- LVREV_ControlParams_st *pControlParams)
-{
-
- LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+LVREV_ReturnStatus_en LVREV_GetControlParameters(LVREV_Handle_t hInstance,
+ LVREV_ControlParams_st* pControlParams) {
+ LVREV_Instance_st* pLVREV_Private = (LVREV_Instance_st*)hInstance;
/*
* Check for error conditions
*/
- if((hInstance == LVM_NULL) || (pControlParams == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pControlParams == LVM_NULL)) {
return LVREV_NULLADDRESS;
}
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
index 68f883a..b5db23b 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.cpp
@@ -45,35 +45,29 @@
/* NOTES: */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t *phInstance,
- LVREV_MemoryTable_st *pMemoryTable,
- LVREV_InstanceParams_st *pInstanceParams)
-{
-
- INST_ALLOC SlowData;
- INST_ALLOC FastData;
- INST_ALLOC FastCoef;
- INST_ALLOC Temporary;
- LVREV_Instance_st *pLVREV_Private;
- LVM_INT16 i;
- LVM_UINT16 MaxBlockSize;
+LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t* phInstance,
+ LVREV_MemoryTable_st* pMemoryTable,
+ LVREV_InstanceParams_st* pInstanceParams) {
+ INST_ALLOC SlowData;
+ INST_ALLOC FastData;
+ INST_ALLOC FastCoef;
+ INST_ALLOC Temporary;
+ LVREV_Instance_st* pLVREV_Private;
+ LVM_INT16 i;
+ LVM_UINT16 MaxBlockSize;
/*
* Check for error conditions
*/
/* Check for NULL pointers */
- if((phInstance == LVM_NULL) || (pMemoryTable == LVM_NULL) || (pInstanceParams == LVM_NULL))
- {
+ if ((phInstance == LVM_NULL) || (pMemoryTable == LVM_NULL) || (pInstanceParams == LVM_NULL)) {
return LVREV_NULLADDRESS;
}
/* Check the memory table for NULL pointers */
- for (i = 0; i < LVREV_NR_MEMORY_REGIONS; i++)
- {
- if (pMemoryTable->Region[i].Size!=0)
- {
- if (pMemoryTable->Region[i].pBaseAddress==LVM_NULL)
- {
- return(LVREV_NULLADDRESS);
+ for (i = 0; i < LVREV_NR_MEMORY_REGIONS; i++) {
+ if (pMemoryTable->Region[i].Size != 0) {
+ if (pMemoryTable->Region[i].pBaseAddress == LVM_NULL) {
+ return (LVREV_NULLADDRESS);
}
}
}
@@ -82,101 +76,81 @@
* Check all instance parameters are in range
*/
/* Check for a non-zero block size */
- if (pInstanceParams->MaxBlockSize == 0)
- {
+ if (pInstanceParams->MaxBlockSize == 0) {
return LVREV_OUTOFRANGE;
}
/* Check for a valid number of delay lines */
- if ((pInstanceParams->NumDelays != LVREV_DELAYLINES_1)&&
- (pInstanceParams->NumDelays != LVREV_DELAYLINES_2)&&
- (pInstanceParams->NumDelays != LVREV_DELAYLINES_4))
- {
+ if ((pInstanceParams->NumDelays != LVREV_DELAYLINES_1) &&
+ (pInstanceParams->NumDelays != LVREV_DELAYLINES_2) &&
+ (pInstanceParams->NumDelays != LVREV_DELAYLINES_4)) {
return LVREV_OUTOFRANGE;
}
/*
* Initialise the InstAlloc instances
*/
- InstAlloc_Init(&SlowData, pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress);
- InstAlloc_Init(&FastData, pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress);
- InstAlloc_Init(&FastCoef, pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress);
+ InstAlloc_Init(&SlowData, pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress);
+ InstAlloc_Init(&FastData, pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress);
+ InstAlloc_Init(&FastCoef, pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress);
InstAlloc_Init(&Temporary, pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress);
/*
* Zero all memory regions
*/
- LoadConst_Float(0,
- (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress,
- (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size) / \
- sizeof(LVM_FLOAT)));
- LoadConst_Float(0,
- (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress,
- (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size) / \
- sizeof(LVM_FLOAT)));
- LoadConst_Float(0,
- (LVM_FLOAT *)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress,
- (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size) / \
- sizeof(LVM_FLOAT)));
- LoadConst_Float(0,
- (LVM_FLOAT *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress,
- (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size) / \
- sizeof(LVM_FLOAT)));
+ LoadConst_Float(
+ 0, (LVM_FLOAT*)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size) / sizeof(LVM_FLOAT)));
+ LoadConst_Float(
+ 0, (LVM_FLOAT*)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size) / sizeof(LVM_FLOAT)));
+ LoadConst_Float(
+ 0, (LVM_FLOAT*)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size) / sizeof(LVM_FLOAT)));
+ LoadConst_Float(
+ 0, (LVM_FLOAT*)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress,
+ (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size) / sizeof(LVM_FLOAT)));
/*
* Set the instance handle if not already initialised
*/
- if (*phInstance == LVM_NULL)
- {
+ if (*phInstance == LVM_NULL) {
*phInstance = InstAlloc_AddMember(&SlowData, sizeof(LVREV_Instance_st));
}
- pLVREV_Private =(LVREV_Instance_st *)*phInstance;
+ pLVREV_Private = (LVREV_Instance_st*)*phInstance;
pLVREV_Private->MemoryTable = *pMemoryTable;
- if(pInstanceParams->NumDelays ==LVREV_DELAYLINES_4)
- {
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_4) {
MaxBlockSize = LVREV_MAX_AP3_DELAY;
- }
- else if(pInstanceParams->NumDelays ==LVREV_DELAYLINES_2)
- {
+ } else if (pInstanceParams->NumDelays == LVREV_DELAYLINES_2) {
MaxBlockSize = LVREV_MAX_AP1_DELAY;
- }
- else
- {
+ } else {
MaxBlockSize = LVREV_MAX_AP0_DELAY;
}
- if(MaxBlockSize>pInstanceParams->MaxBlockSize)
- {
- MaxBlockSize=pInstanceParams->MaxBlockSize;
+ if (MaxBlockSize > pInstanceParams->MaxBlockSize) {
+ 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));
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
- {
- pLVREV_Private->pDelay_T[3] =
- (LVM_FLOAT *)InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * \
- sizeof(LVM_FLOAT));
- pLVREV_Private->pDelay_T[2] =
- (LVM_FLOAT *)InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * \
- sizeof(LVM_FLOAT));
- pLVREV_Private->pDelay_T[1] =
- (LVM_FLOAT *)InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
- sizeof(LVM_FLOAT));
- pLVREV_Private->pDelay_T[0] =
- (LVM_FLOAT *)InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * \
- sizeof(LVM_FLOAT));
+ pLVREV_Private->pFastData =
+ (LVREV_FastData_st*)InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st));
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_4) {
+ pLVREV_Private->pDelay_T[3] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[2] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[1] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[0] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
- for(i = 0; i < 4; i++)
- {
+ for (i = 0; i < 4; i++) {
/* Scratch for each delay line output */
- pLVREV_Private->pScratchDelayLine[i] = (LVM_FLOAT *)InstAlloc_AddMember(&Temporary,
- sizeof(LVM_FLOAT) * \
- MaxBlockSize);
+ pLVREV_Private->pScratchDelayLine[i] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
}
LoadConst_Float(0, pLVREV_Private->pDelay_T[3], LVREV_MAX_T3_DELAY);
@@ -185,60 +159,50 @@
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], LVREV_MAX_T0_DELAY);
}
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
- {
- pLVREV_Private->pDelay_T[1] = (LVM_FLOAT *)
- InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * \
- sizeof(LVM_FLOAT));
- pLVREV_Private->pDelay_T[0] = (LVM_FLOAT *)
- InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * \
- sizeof(LVM_FLOAT));
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_2) {
+ pLVREV_Private->pDelay_T[1] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
+ pLVREV_Private->pDelay_T[0] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
- for(i = 0; i < 2; i++)
- {
+ for (i = 0; i < 2; i++) {
/* Scratch for each delay line output */
- pLVREV_Private->pScratchDelayLine[i] = (LVM_FLOAT *)InstAlloc_AddMember(&Temporary,
- sizeof(LVM_FLOAT) * \
- MaxBlockSize);
+ pLVREV_Private->pScratchDelayLine[i] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
}
LoadConst_Float(0, pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
}
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
- {
- pLVREV_Private->pDelay_T[0] = (LVM_FLOAT *)InstAlloc_AddMember(&FastData,
- LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_1) {
+ pLVREV_Private->pDelay_T[0] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
- for(i = 0; i < 1; i++)
- {
+ for (i = 0; i < 1; i++) {
/* Scratch for each delay line output */
- pLVREV_Private->pScratchDelayLine[i] = (LVM_FLOAT *)InstAlloc_AddMember(&Temporary,
- sizeof(LVM_FLOAT) * \
- MaxBlockSize);
+ pLVREV_Private->pScratchDelayLine[i] =
+ (LVM_FLOAT*)InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
}
LoadConst_Float(0, pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
}
/* All-pass delay buffer addresses and sizes */
- pLVREV_Private->T[0] = LVREV_MAX_T0_DELAY;
- pLVREV_Private->T[1] = LVREV_MAX_T1_DELAY;
- pLVREV_Private->T[2] = LVREV_MAX_T2_DELAY;
- pLVREV_Private->T[3] = LVREV_MAX_T3_DELAY;
- pLVREV_Private->AB_Selection = 1; /* Select smoothing A to B */
+ pLVREV_Private->T[0] = LVREV_MAX_T0_DELAY;
+ pLVREV_Private->T[1] = LVREV_MAX_T1_DELAY;
+ pLVREV_Private->T[2] = LVREV_MAX_T2_DELAY;
+ pLVREV_Private->T[3] = LVREV_MAX_T3_DELAY;
+ pLVREV_Private->AB_Selection = 1; /* Select smoothing A to B */
/* Fast coefficient memory base address */
- pLVREV_Private->pFastCoef =
- (LVREV_FastCoef_st *)InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st));
+ pLVREV_Private->pFastCoef =
+ (LVREV_FastCoef_st*)InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st));
/* General purpose scratch */
- pLVREV_Private->pScratch =
- (LVM_FLOAT *)InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * \
- MaxBlockSize);
+ pLVREV_Private->pScratch =
+ (LVM_FLOAT*)InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
/* Mono->stereo input save for end mix */
- pLVREV_Private->pInputSave =
- (LVM_FLOAT *)InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * \
- MaxBlockSize);
+ pLVREV_Private->pInputSave =
+ (LVM_FLOAT*)InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * MaxBlockSize);
LoadConst_Float(0, pLVREV_Private->pInputSave, (LVM_INT16)(MaxBlockSize * 2));
/*
@@ -249,91 +213,90 @@
/*
* Set the parameters to invalid
*/
- pLVREV_Private->CurrentParams.SampleRate = LVM_FS_INVALID;
+ pLVREV_Private->CurrentParams.SampleRate = LVM_FS_INVALID;
pLVREV_Private->CurrentParams.OperatingMode = LVM_MODE_DUMMY;
- pLVREV_Private->CurrentParams.SourceFormat = LVM_SOURCE_DUMMY;
+ pLVREV_Private->CurrentParams.SourceFormat = LVM_SOURCE_DUMMY;
- pLVREV_Private->bControlPending = LVM_FALSE;
- pLVREV_Private->bFirstControl = LVM_TRUE;
- pLVREV_Private->bDisableReverb = LVM_FALSE;
+ pLVREV_Private->bControlPending = LVM_FALSE;
+ pLVREV_Private->bFirstControl = LVM_TRUE;
+ pLVREV_Private->bDisableReverb = LVM_FALSE;
/*
* Set mixer parameters
*/
- pLVREV_Private->BypassMixer.CallbackParam2 = 0;
- pLVREV_Private->BypassMixer.pCallbackHandle2 = pLVREV_Private;
- pLVREV_Private->BypassMixer.pGeneralPurpose2 = LVM_NULL;
- pLVREV_Private->BypassMixer.pCallBack2 = BypassMixer_Callback;
- pLVREV_Private->BypassMixer.CallbackSet2 = LVM_FALSE;
- pLVREV_Private->BypassMixer.Current2 = 0;
- pLVREV_Private->BypassMixer.Target2 = 0;
- pLVREV_Private->BypassMixer.CallbackParam1 = 0;
- pLVREV_Private->BypassMixer.pCallbackHandle1 = LVM_NULL;
- pLVREV_Private->BypassMixer.pGeneralPurpose1 = LVM_NULL;
- pLVREV_Private->BypassMixer.pCallBack1 = LVM_NULL;
- pLVREV_Private->BypassMixer.CallbackSet1 = LVM_FALSE;
- pLVREV_Private->BypassMixer.Current1 = 0x00000000;
- pLVREV_Private->BypassMixer.Target1 = 0x00000000;
+ pLVREV_Private->BypassMixer.CallbackParam2 = 0;
+ pLVREV_Private->BypassMixer.pCallbackHandle2 = pLVREV_Private;
+ pLVREV_Private->BypassMixer.pGeneralPurpose2 = LVM_NULL;
+ pLVREV_Private->BypassMixer.pCallBack2 = BypassMixer_Callback;
+ pLVREV_Private->BypassMixer.CallbackSet2 = LVM_FALSE;
+ pLVREV_Private->BypassMixer.Current2 = 0;
+ pLVREV_Private->BypassMixer.Target2 = 0;
+ pLVREV_Private->BypassMixer.CallbackParam1 = 0;
+ pLVREV_Private->BypassMixer.pCallbackHandle1 = LVM_NULL;
+ pLVREV_Private->BypassMixer.pGeneralPurpose1 = LVM_NULL;
+ pLVREV_Private->BypassMixer.pCallBack1 = LVM_NULL;
+ pLVREV_Private->BypassMixer.CallbackSet1 = LVM_FALSE;
+ pLVREV_Private->BypassMixer.Current1 = 0x00000000;
+ pLVREV_Private->BypassMixer.Target1 = 0x00000000;
- pLVREV_Private->RoomSizeInms = 100; // 100 msec
+ pLVREV_Private->RoomSizeInms = 100; // 100 msec
/*
* Set the output gain mixer parameters
*/
- pLVREV_Private->GainMixer.CallbackParam = 0;
- pLVREV_Private->GainMixer.pCallbackHandle = LVM_NULL;
- pLVREV_Private->GainMixer.pGeneralPurpose = LVM_NULL;
- pLVREV_Private->GainMixer.pCallBack = LVM_NULL;
- pLVREV_Private->GainMixer.CallbackSet = LVM_FALSE;
- pLVREV_Private->GainMixer.Current = 0.03125f;//0x03ffffff;
- pLVREV_Private->GainMixer.Target = 0.03125f;//0x03ffffff;
+ pLVREV_Private->GainMixer.CallbackParam = 0;
+ pLVREV_Private->GainMixer.pCallbackHandle = LVM_NULL;
+ pLVREV_Private->GainMixer.pGeneralPurpose = LVM_NULL;
+ pLVREV_Private->GainMixer.pCallBack = LVM_NULL;
+ pLVREV_Private->GainMixer.CallbackSet = LVM_FALSE;
+ pLVREV_Private->GainMixer.Current = 0.03125f; // 0x03ffffff;
+ pLVREV_Private->GainMixer.Target = 0.03125f; // 0x03ffffff;
/*
* Set the All-Pass Filter mixers
*/
- for (i=0; i<4; i++)
- {
+ for (i = 0; i < 4; i++) {
pLVREV_Private->pOffsetA[i] = pLVREV_Private->pDelay_T[i];
pLVREV_Private->pOffsetB[i] = pLVREV_Private->pDelay_T[i];
/* Delay tap selection mixer */
- pLVREV_Private->Mixer_APTaps[i].CallbackParam2 = 0;
+ pLVREV_Private->Mixer_APTaps[i].CallbackParam2 = 0;
pLVREV_Private->Mixer_APTaps[i].pCallbackHandle2 = LVM_NULL;
pLVREV_Private->Mixer_APTaps[i].pGeneralPurpose2 = LVM_NULL;
- pLVREV_Private->Mixer_APTaps[i].pCallBack2 = LVM_NULL;
- pLVREV_Private->Mixer_APTaps[i].CallbackSet2 = LVM_FALSE;
- pLVREV_Private->Mixer_APTaps[i].Current2 = 0;
- pLVREV_Private->Mixer_APTaps[i].Target2 = 0;
- pLVREV_Private->Mixer_APTaps[i].CallbackParam1 = 0;
+ pLVREV_Private->Mixer_APTaps[i].pCallBack2 = LVM_NULL;
+ pLVREV_Private->Mixer_APTaps[i].CallbackSet2 = LVM_FALSE;
+ pLVREV_Private->Mixer_APTaps[i].Current2 = 0;
+ pLVREV_Private->Mixer_APTaps[i].Target2 = 0;
+ pLVREV_Private->Mixer_APTaps[i].CallbackParam1 = 0;
pLVREV_Private->Mixer_APTaps[i].pCallbackHandle1 = LVM_NULL;
pLVREV_Private->Mixer_APTaps[i].pGeneralPurpose1 = LVM_NULL;
- pLVREV_Private->Mixer_APTaps[i].pCallBack1 = LVM_NULL;
- pLVREV_Private->Mixer_APTaps[i].CallbackSet1 = LVM_FALSE;
- pLVREV_Private->Mixer_APTaps[i].Current1 = 0;
- pLVREV_Private->Mixer_APTaps[i].Target1 = 1;
+ pLVREV_Private->Mixer_APTaps[i].pCallBack1 = LVM_NULL;
+ pLVREV_Private->Mixer_APTaps[i].CallbackSet1 = LVM_FALSE;
+ pLVREV_Private->Mixer_APTaps[i].Current1 = 0;
+ pLVREV_Private->Mixer_APTaps[i].Target1 = 1;
/* Feedforward mixer */
- pLVREV_Private->Mixer_SGFeedforward[i].CallbackParam = 0;
+ pLVREV_Private->Mixer_SGFeedforward[i].CallbackParam = 0;
pLVREV_Private->Mixer_SGFeedforward[i].pCallbackHandle = LVM_NULL;
pLVREV_Private->Mixer_SGFeedforward[i].pGeneralPurpose = LVM_NULL;
- pLVREV_Private->Mixer_SGFeedforward[i].pCallBack = LVM_NULL;
- pLVREV_Private->Mixer_SGFeedforward[i].CallbackSet = LVM_FALSE;
- pLVREV_Private->Mixer_SGFeedforward[i].Current = 0;
- pLVREV_Private->Mixer_SGFeedforward[i].Target = 0;
+ pLVREV_Private->Mixer_SGFeedforward[i].pCallBack = LVM_NULL;
+ pLVREV_Private->Mixer_SGFeedforward[i].CallbackSet = LVM_FALSE;
+ pLVREV_Private->Mixer_SGFeedforward[i].Current = 0;
+ pLVREV_Private->Mixer_SGFeedforward[i].Target = 0;
/* Feedback mixer */
- pLVREV_Private->Mixer_SGFeedback[i].CallbackParam = 0;
+ pLVREV_Private->Mixer_SGFeedback[i].CallbackParam = 0;
pLVREV_Private->Mixer_SGFeedback[i].pCallbackHandle = LVM_NULL;
pLVREV_Private->Mixer_SGFeedback[i].pGeneralPurpose = LVM_NULL;
- pLVREV_Private->Mixer_SGFeedback[i].pCallBack = LVM_NULL;
- pLVREV_Private->Mixer_SGFeedback[i].CallbackSet = LVM_FALSE;
- pLVREV_Private->Mixer_SGFeedback[i].Current = 0;
- pLVREV_Private->Mixer_SGFeedback[i].Target = 0;
+ pLVREV_Private->Mixer_SGFeedback[i].pCallBack = LVM_NULL;
+ pLVREV_Private->Mixer_SGFeedback[i].CallbackSet = LVM_FALSE;
+ pLVREV_Private->Mixer_SGFeedback[i].Current = 0;
+ pLVREV_Private->Mixer_SGFeedback[i].Target = 0;
/* Feedback gain mixer */
- pLVREV_Private->FeedbackMixer[i].CallbackParam = 0;
- pLVREV_Private->FeedbackMixer[i].pCallbackHandle = LVM_NULL;
- pLVREV_Private->FeedbackMixer[i].pGeneralPurpose = LVM_NULL;
- pLVREV_Private->FeedbackMixer[i].pCallBack = LVM_NULL;
- pLVREV_Private->FeedbackMixer[i].CallbackSet = LVM_FALSE;
- pLVREV_Private->FeedbackMixer[i].Current = 0;
- pLVREV_Private->FeedbackMixer[i].Target = 0;
+ pLVREV_Private->FeedbackMixer[i].CallbackParam = 0;
+ pLVREV_Private->FeedbackMixer[i].pCallbackHandle = LVM_NULL;
+ pLVREV_Private->FeedbackMixer[i].pGeneralPurpose = LVM_NULL;
+ pLVREV_Private->FeedbackMixer[i].pCallBack = LVM_NULL;
+ pLVREV_Private->FeedbackMixer[i].CallbackSet = LVM_FALSE;
+ pLVREV_Private->FeedbackMixer[i].Current = 0;
+ pLVREV_Private->FeedbackMixer[i].Target = 0;
}
/* Delay tap index */
pLVREV_Private->A_DelaySize[0] = LVREV_MAX_AP0_DELAY;
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
index f59933c..2c1e04d 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.cpp
@@ -56,46 +56,40 @@
/* 1. This function may be interrupted by the LVREV_Process function */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_GetMemoryTable(LVREV_Handle_t hInstance,
- LVREV_MemoryTable_st *pMemoryTable,
- LVREV_InstanceParams_st *pInstanceParams)
-{
-
- INST_ALLOC SlowData;
- INST_ALLOC FastData;
- INST_ALLOC FastCoef;
- INST_ALLOC Temporary;
- LVM_INT16 i;
- LVM_UINT16 MaxBlockSize;
+LVREV_ReturnStatus_en LVREV_GetMemoryTable(LVREV_Handle_t hInstance,
+ LVREV_MemoryTable_st* pMemoryTable,
+ LVREV_InstanceParams_st* pInstanceParams) {
+ INST_ALLOC SlowData;
+ INST_ALLOC FastData;
+ INST_ALLOC FastCoef;
+ INST_ALLOC Temporary;
+ LVM_INT16 i;
+ LVM_UINT16 MaxBlockSize;
/*
* Check for error conditions
*/
/* Check for NULL pointer */
- if (pMemoryTable == LVM_NULL)
- {
- return(LVREV_NULLADDRESS);
+ if (pMemoryTable == LVM_NULL) {
+ return (LVREV_NULLADDRESS);
}
/*
* Check all instance parameters are in range
*/
- if (pInstanceParams != LVM_NULL)
- {
+ if (pInstanceParams != LVM_NULL) {
/*
* Call for memory allocation, so check the parameters
*/
/* Check for a non-zero block size */
- if (pInstanceParams->MaxBlockSize == 0)
- {
+ if (pInstanceParams->MaxBlockSize == 0) {
return LVREV_OUTOFRANGE;
}
/* Check for a valid number of delay lines */
if ((pInstanceParams->NumDelays != LVREV_DELAYLINES_1) &&
(pInstanceParams->NumDelays != LVREV_DELAYLINES_2) &&
- (pInstanceParams->NumDelays != LVREV_DELAYLINES_4))
- {
+ (pInstanceParams->NumDelays != LVREV_DELAYLINES_4)) {
return LVREV_OUTOFRANGE;
}
}
@@ -103,86 +97,75 @@
/*
* Initialise the InstAlloc instances
*/
- InstAlloc_Init(&SlowData, (void *)LVM_NULL);
- InstAlloc_Init(&FastData, (void *)LVM_NULL);
- InstAlloc_Init(&FastCoef, (void *)LVM_NULL);
- InstAlloc_Init(&Temporary, (void *)LVM_NULL);
+ InstAlloc_Init(&SlowData, (void*)LVM_NULL);
+ InstAlloc_Init(&FastData, (void*)LVM_NULL);
+ InstAlloc_Init(&FastCoef, (void*)LVM_NULL);
+ InstAlloc_Init(&Temporary, (void*)LVM_NULL);
/*
* Fill in the memory table
*/
- if (hInstance == LVM_NULL)
- {
+ if (hInstance == LVM_NULL) {
/*
* Check for null pointers
*/
- if (pInstanceParams == LVM_NULL)
- {
- return(LVREV_NULLADDRESS);
+ if (pInstanceParams == LVM_NULL) {
+ return (LVREV_NULLADDRESS);
}
/*
* Select the maximum internal block size
*/
- if(pInstanceParams->NumDelays ==LVREV_DELAYLINES_4)
- {
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_4) {
MaxBlockSize = LVREV_MAX_AP3_DELAY;
- }
- else if(pInstanceParams->NumDelays ==LVREV_DELAYLINES_2)
- {
+ } else if (pInstanceParams->NumDelays == LVREV_DELAYLINES_2) {
MaxBlockSize = LVREV_MAX_AP1_DELAY;
- }
- else
- {
+ } else {
MaxBlockSize = LVREV_MAX_AP0_DELAY;
}
- if(MaxBlockSize>pInstanceParams->MaxBlockSize)
- {
- MaxBlockSize=pInstanceParams->MaxBlockSize;
+ if (MaxBlockSize > pInstanceParams->MaxBlockSize) {
+ MaxBlockSize = pInstanceParams->MaxBlockSize;
}
/*
* Slow data memory
*/
InstAlloc_AddMember(&SlowData, sizeof(LVREV_Instance_st));
- pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size = InstAlloc_GetTotal(&SlowData);
- pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Type = LVM_PERSISTENT_SLOW_DATA;
+ pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size = InstAlloc_GetTotal(&SlowData);
+ 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)
- {
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_4) {
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));
}
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
- {
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_2) {
InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_FLOAT));
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
}
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
- {
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_1) {
InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_FLOAT));
}
- 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].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
*/
InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st));
- pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size = InstAlloc_GetTotal(&FastCoef);
- pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Type = LVM_PERSISTENT_FAST_COEF;
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size = InstAlloc_GetTotal(&FastCoef);
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Type = LVM_PERSISTENT_FAST_COEF;
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress = LVM_NULL;
/*
@@ -192,41 +175,33 @@
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
/* Mono->stereo input saved for end mix */
InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_FLOAT) * MaxBlockSize);
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
- {
- for(i=0; i<4; i++)
- {
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_4) {
+ for (i = 0; i < 4; i++) {
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
}
}
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
- {
- for(i=0; i<2; i++)
- {
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_2) {
+ for (i = 0; i < 2; i++) {
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
}
}
- if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
- {
- for(i=0; i<1; i++)
- {
+ if (pInstanceParams->NumDelays == LVREV_DELAYLINES_1) {
+ for (i = 0; i < 1; i++) {
/* A Scratch buffer for each delay line */
InstAlloc_AddMember(&Temporary, sizeof(LVM_FLOAT) * MaxBlockSize);
}
}
- pMemoryTable->Region[LVM_TEMPORARY_FAST].Size = InstAlloc_GetTotal(&Temporary);
- pMemoryTable->Region[LVM_TEMPORARY_FAST].Type = LVM_TEMPORARY_FAST;
+ pMemoryTable->Region[LVM_TEMPORARY_FAST].Size = InstAlloc_GetTotal(&Temporary);
+ pMemoryTable->Region[LVM_TEMPORARY_FAST].Type = LVM_TEMPORARY_FAST;
pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress = LVM_NULL;
- }
- else
- {
- LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+ } else {
+ LVREV_Instance_st* pLVREV_Private = (LVREV_Instance_st*)hInstance;
/*
* Read back memory allocation table
@@ -234,7 +209,7 @@
*pMemoryTable = pLVREV_Private->MemoryTable;
}
- return(LVREV_SUCCESS);
+ return (LVREV_SUCCESS);
}
/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
index 2c27c6e..b6edb03 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
@@ -37,63 +37,63 @@
/* */
/****************************************************************************************/
/* 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 */
+#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 */
/* Intenal constants */
-#define LVREV_LP_Poly_Order 4
-#define LVREV_LP_Poly_Shift 5
+#define LVREV_LP_Poly_Order 4
+#define LVREV_LP_Poly_Shift 5
-#define LVREV_T60_SCALE 0.000142f /*(1/7000) */
+#define LVREV_T60_SCALE 0.000142f /*(1/7000) */
-#define LVREV_T_3_Power_0_on_4 1.0f
-#define LVREV_T_3_Power_1_on_4 1.316074f
-#define LVREV_T_3_Power_2_on_4 1.732051f
-#define LVREV_T_3_Power_3_on_4 2.279507f
-#define LVREV_T_3_Power_minus0_on_4 1.0f /* 3^(-0/4) * 2^15 */
-#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 */
+#define LVREV_T_3_Power_0_on_4 1.0f
+#define LVREV_T_3_Power_1_on_4 1.316074f
+#define LVREV_T_3_Power_2_on_4 1.732051f
+#define LVREV_T_3_Power_3_on_4 2.279507f
+#define LVREV_T_3_Power_minus0_on_4 1.0f /* 3^(-0/4) * 2^15 */
+#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 */
- /* ((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 */
-#define LVREV_MAX_T2_DELAY 13304
- /* ((192000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T1_DELAY 17508
- /* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
-#define LVREV_MAX_T0_DELAY 23040
- /* ((192000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP3_DELAY 6740
- /* ((192000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP2_DELAY 8872
- /* ((192000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP1_DELAY 11672
- /* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
-#define LVREV_MAX_AP0_DELAY 15360
+/* ((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 */
+#define LVREV_MAX_T2_DELAY 13304
+/* ((192000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T1_DELAY 17508
+/* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T0_DELAY 23040
+/* ((192000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP3_DELAY 6740
+/* ((192000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP2_DELAY 8872
+/* ((192000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP1_DELAY 11672
+/* ((192000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP0_DELAY 15360
-#define LVREV_BYPASSMIXER_TC 1000 /* Bypass mixer time constant*/
-#define LVREV_ALLPASS_TC 1000 /* All-pass filter time constant */
-#define LVREV_ALLPASS_TAP_TC 10000 /* All-pass filter dely tap change */
-#define LVREV_FEEDBACKMIXER_TC 100 /* Feedback mixer time constant*/
-#define LVREV_OUTPUTGAIN_SHIFT 5 /* Bits shift for output gain correction */
+#define LVREV_BYPASSMIXER_TC 1000 /* Bypass mixer time constant*/
+#define LVREV_ALLPASS_TC 1000 /* All-pass filter time constant */
+#define LVREV_ALLPASS_TAP_TC 10000 /* All-pass filter dely tap change */
+#define LVREV_FEEDBACKMIXER_TC 100 /* Feedback mixer time constant*/
+#define LVREV_OUTPUTGAIN_SHIFT 5 /* Bits shift for output gain correction */
/* Parameter limits */
-#define LVREV_NUM_FS 13 /* Number of supported sample rates */
+#define LVREV_NUM_FS 13 /* Number of supported sample rates */
-#define LVREV_MAXBLKSIZE_LIMIT 64 /* Maximum block size low limit */
-#define LVREV_MAX_LEVEL 100 /* Maximum level, 100% */
-#define LVREV_MIN_LPF_CORNER 50 /* Low pass filter limits */
-#define LVREV_MAX_LPF_CORNER 23999
-#define LVREV_MIN_HPF_CORNER 20 /* High pass filrer limits */
-#define LVREV_MAX_HPF_CORNER 1000
-#define LVREV_MAX_T60 7000 /* Maximum T60 time in ms */
-#define LVREV_MAX_DENSITY 100 /* Maximum density, 100% */
-#define LVREV_MAX_DAMPING 100 /* Maximum damping, 100% */
-#define LVREV_MAX_ROOMSIZE 100 /* Maximum room size, 100% */
+#define LVREV_MAXBLKSIZE_LIMIT 64 /* Maximum block size low limit */
+#define LVREV_MAX_LEVEL 100 /* Maximum level, 100% */
+#define LVREV_MIN_LPF_CORNER 50 /* Low pass filter limits */
+#define LVREV_MAX_LPF_CORNER 23999
+#define LVREV_MIN_HPF_CORNER 20 /* High pass filrer limits */
+#define LVREV_MAX_HPF_CORNER 1000
+#define LVREV_MAX_T60 7000 /* Maximum T60 time in ms */
+#define LVREV_MAX_DENSITY 100 /* Maximum density, 100% */
+#define LVREV_MAX_DAMPING 100 /* Maximum damping, 100% */
+#define LVREV_MAX_ROOMSIZE 100 /* Maximum room size, 100% */
/****************************************************************************************/
/* */
@@ -102,72 +102,68 @@
/****************************************************************************************/
/* Fast data structure */
-typedef struct
-{
- Biquad_1I_Order1_FLOAT_Taps_t HPTaps; /* High pass filter taps */
- Biquad_1I_Order1_FLOAT_Taps_t LPTaps; /* Low pass filter taps */
- Biquad_1I_Order1_FLOAT_Taps_t RevLPTaps[4]; /* Reverb low pass filters taps */
+typedef struct {
+ Biquad_1I_Order1_FLOAT_Taps_t HPTaps; /* High pass filter taps */
+ Biquad_1I_Order1_FLOAT_Taps_t LPTaps; /* Low pass filter taps */
+ Biquad_1I_Order1_FLOAT_Taps_t RevLPTaps[4]; /* Reverb low pass filters taps */
} LVREV_FastData_st;
/* Fast coefficient structure */
-typedef struct
-{
-
- Biquad_FLOAT_Instance_t HPCoefs; /* High pass filter coefficients */
- Biquad_FLOAT_Instance_t LPCoefs; /* Low pass filter coefficients */
- Biquad_FLOAT_Instance_t RevLPCoefs[4]; /* Reverb low pass filters coefficients */
+typedef struct {
+ Biquad_FLOAT_Instance_t HPCoefs; /* High pass filter coefficients */
+ Biquad_FLOAT_Instance_t LPCoefs; /* Low pass filter coefficients */
+ Biquad_FLOAT_Instance_t RevLPCoefs[4]; /* Reverb low pass filters coefficients */
} LVREV_FastCoef_st;
-typedef struct
-{
+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 */
+ 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_FLOAT *pScratchDelayLine[4]; /* Delay line scratch memory */
- LVM_FLOAT *pScratch; /* Multi ussge scratch */
- LVM_FLOAT *pInputSave; /* Reverb block input save for dry/wet
- mixing*/
+ LVREV_FastData_st* pFastData; /* Fast data memory base address */
+ LVREV_FastCoef_st* pFastCoef; /* Fast coefficient memory base address */
+ LVM_FLOAT* pScratchDelayLine[4]; /* Delay line scratch memory */
+ LVM_FLOAT* pScratch; /* Multi ussge scratch */
+ LVM_FLOAT* pInputSave; /* Reverb block input save for dry/wet
+ mixing*/
/* Feedback matrix */
- Mix_1St_Cll_FLOAT_t FeedbackMixer[4]; /* Mixer for Pop and Click Supression \
- caused by feedback Gain */
+ Mix_1St_Cll_FLOAT_t FeedbackMixer[4]; /* Mixer for Pop and Click Suppression \
+ 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 */
- 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_FLOAT *pOffsetA[4]; /* Offset for the A delay tap */
- LVM_FLOAT *pOffsetB[4]; /* Offset for the B delay tap */
- Mix_2St_Cll_FLOAT_t Mixer_APTaps[4]; /* Smoothed AP delay mixer */
- Mix_1St_Cll_FLOAT_t Mixer_SGFeedback[4]; /* Smoothed SAfeedback gain */
- Mix_1St_Cll_FLOAT_t Mixer_SGFeedforward[4]; /* Smoothed AP feedforward gain */
+ LVM_INT32 T[4]; /* Maximum delay size of buffer */
+ LVM_FLOAT* 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_FLOAT* pOffsetA[4]; /* Offset for the A delay tap */
+ LVM_FLOAT* pOffsetB[4]; /* Offset for the B delay tap */
+ Mix_2St_Cll_FLOAT_t Mixer_APTaps[4]; /* Smoothed AP delay mixer */
+ Mix_1St_Cll_FLOAT_t Mixer_SGFeedback[4]; /* Smoothed SAfeedback gain */
+ Mix_1St_Cll_FLOAT_t Mixer_SGFeedforward[4]; /* Smoothed AP feedforward gain */
/* Output gain */
- Mix_2St_Cll_FLOAT_t BypassMixer; /* Dry/wet mixer */
- LVM_FLOAT Gain; /* Gain applied to output to maintain
- average signal power */
- Mix_1St_Cll_FLOAT_t GainMixer; /* Gain smoothing */
+ Mix_2St_Cll_FLOAT_t BypassMixer; /* Dry/wet mixer */
+ LVM_FLOAT Gain; /* Gain applied to output to maintain
+ average signal power */
+ Mix_1St_Cll_FLOAT_t GainMixer; /* Gain smoothing */
} LVREV_Instance_st;
@@ -177,15 +173,12 @@
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_ApplyNewSettings(LVREV_Instance_st *pPrivate);
-void ReverbBlock(LVM_FLOAT *pInput,
- LVM_FLOAT *pOutput,
- LVREV_Instance_st *pPrivate,
- LVM_UINT16 NumSamples);
-LVM_INT32 BypassMixer_Callback(void *pCallbackData,
- void *pGeneralPurpose,
- LVM_INT16 GeneralPurpose );
+LVREV_ReturnStatus_en LVREV_ApplyNewSettings(LVREV_Instance_st* pPrivate);
+void ReverbBlock(LVM_FLOAT* pInput, LVM_FLOAT* pOutput, LVREV_Instance_st* pPrivate,
+ LVM_UINT16 NumSamples);
+LVM_INT32 BypassMixer_Callback(void* pCallbackData, void* pGeneralPurpose,
+ LVM_INT16 GeneralPurpose);
-#endif /** __LVREV_PRIVATE_H__ **/
+#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 35f9ad8..ed3b89c 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.cpp
@@ -45,43 +45,37 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- const LVM_UINT16 NumSamples)
-{
- LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
- LVM_FLOAT *pInput = (LVM_FLOAT *)pInData;
- LVM_FLOAT *pOutput = pOutData;
- LVM_INT32 SamplesToProcess, RemainingSamples;
- LVM_INT32 format = 1;
+LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, const LVM_UINT16 NumSamples) {
+ LVREV_Instance_st* pLVREV_Private = (LVREV_Instance_st*)hInstance;
+ LVM_FLOAT* pInput = (LVM_FLOAT*)pInData;
+ LVM_FLOAT* pOutput = pOutData;
+ LVM_INT32 SamplesToProcess, RemainingSamples;
+ LVM_INT32 format = 1;
/*
* Check for error conditions
*/
/* Check for NULL pointers */
- if((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL)) {
return LVREV_NULLADDRESS;
}
/*
* Apply the new controls settings if required
*/
- if(pLVREV_Private->bControlPending == LVM_TRUE)
- {
- LVREV_ReturnStatus_en errorCode;
+ if (pLVREV_Private->bControlPending == LVM_TRUE) {
+ LVREV_ReturnStatus_en errorCode;
/*
* Clear the pending flag and update the control settings
*/
pLVREV_Private->bControlPending = LVM_FALSE;
- errorCode = LVREV_ApplyNewSettings (pLVREV_Private);
+ errorCode = LVREV_ApplyNewSettings(pLVREV_Private);
- if(errorCode != LVREV_SUCCESS)
- {
+ if (errorCode != LVREV_SUCCESS) {
return errorCode;
}
}
@@ -89,27 +83,23 @@
/*
* Trap the case where the number of samples is zero.
*/
- if (NumSamples == 0)
- {
+ if (NumSamples == 0) {
return LVREV_SUCCESS;
}
/*
* If OFF copy and reformat the data as necessary
*/
- if (pLVREV_Private->CurrentParams.OperatingMode == LVM_MODE_OFF)
- {
- if(pInput != pOutput)
- {
+ if (pLVREV_Private->CurrentParams.OperatingMode == LVM_MODE_OFF) {
+ if (pInput != pOutput) {
/*
* Copy the data to the output buffer, convert to stereo is required
*/
- if(pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO){
+ if (pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO) {
MonoTo2I_Float(pInput, pOutput, NumSamples);
} else {
- Copy_Float(pInput,
- pOutput,
- (LVM_INT16)(NumSamples << 1)); // 32 bit data, stereo
+ Copy_Float(pInput, pOutput,
+ (LVM_INT16)(NumSamples << 1)); // 32 bit data, stereo
}
}
@@ -118,31 +108,26 @@
RemainingSamples = (LVM_INT32)NumSamples;
- if (pLVREV_Private->CurrentParams.SourceFormat != LVM_MONO)
- {
+ if (pLVREV_Private->CurrentParams.SourceFormat != LVM_MONO) {
format = 2;
}
- while (RemainingSamples!=0)
- {
+ while (RemainingSamples != 0) {
/*
* Process the data
*/
- if(RemainingSamples > pLVREV_Private->MaxBlkLen)
- {
- SamplesToProcess = pLVREV_Private->MaxBlkLen;
+ if (RemainingSamples > pLVREV_Private->MaxBlkLen) {
+ SamplesToProcess = pLVREV_Private->MaxBlkLen;
RemainingSamples = (LVM_INT16)(RemainingSamples - SamplesToProcess);
- }
- else
- {
+ } else {
SamplesToProcess = RemainingSamples;
RemainingSamples = 0;
}
ReverbBlock(pInput, pOutput, pLVREV_Private, (LVM_UINT16)SamplesToProcess);
- pInput = (LVM_FLOAT *)(pInput + (SamplesToProcess * format));
- pOutput = (LVM_FLOAT *)(pOutput + (SamplesToProcess * 2)); // Always stereo output
+ pInput = (LVM_FLOAT*)(pInput + (SamplesToProcess * format));
+ pOutput = (LVM_FLOAT*)(pOutput + (SamplesToProcess * 2)); // Always stereo output
}
return LVREV_SUCCESS;
@@ -170,16 +155,15 @@
/* 1. The input and output buffers must be 32-bit aligned */
/* */
/****************************************************************************************/
-void ReverbBlock(LVM_FLOAT *pInput, LVM_FLOAT *pOutput,
- LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
-{
- LVM_INT16 j, size;
- LVM_FLOAT *pDelayLine;
- LVM_FLOAT *pDelayLineInput = pPrivate->pScratch;
- LVM_FLOAT *pScratch = pPrivate->pScratch;
- LVM_FLOAT *pIn;
- LVM_FLOAT *pTemp = pPrivate->pInputSave;
- LVM_INT32 NumberOfDelayLines;
+void ReverbBlock(LVM_FLOAT* pInput, LVM_FLOAT* pOutput, LVREV_Instance_st* pPrivate,
+ LVM_UINT16 NumSamples) {
+ LVM_INT16 j, size;
+ LVM_FLOAT* pDelayLine;
+ LVM_FLOAT* pDelayLineInput = pPrivate->pScratch;
+ LVM_FLOAT* pScratch = pPrivate->pScratch;
+ LVM_FLOAT* pIn;
+ LVM_FLOAT* pTemp = pPrivate->pInputSave;
+ LVM_INT32 NumberOfDelayLines;
/******************************************************************************
* All calculations will go into the buffer pointed to by pTemp, this will *
@@ -196,85 +180,60 @@
* and the final output is converted to STEREO after the mixer *
******************************************************************************/
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
+ if (pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4) {
NumberOfDelayLines = 4;
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
- {
+ } else if (pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2) {
NumberOfDelayLines = 2;
- }
- else
- {
+ } else {
NumberOfDelayLines = 1;
}
- if(pPrivate->CurrentParams.SourceFormat == LVM_MONO)
- {
+ if (pPrivate->CurrentParams.SourceFormat == LVM_MONO) {
pIn = pInput;
- }
- else
- {
+ } else {
/*
* Stereo to mono conversion
*/
- From2iToMono_Float(pInput,
- pTemp,
- (LVM_INT16)NumSamples);
+ From2iToMono_Float(pInput, pTemp, (LVM_INT16)NumSamples);
pIn = pTemp;
}
- Mult3s_Float(pIn,
- (LVM_FLOAT)LVREV_HEADROOM,
- pTemp,
- (LVM_INT16)NumSamples);
+ Mult3s_Float(pIn, (LVM_FLOAT)LVREV_HEADROOM, pTemp, (LVM_INT16)NumSamples);
/*
* High pass filter
*/
- FO_1I_D32F32C31_TRC_WRA_01(&pPrivate->pFastCoef->HPCoefs,
- pTemp,
- pTemp,
- (LVM_INT16)NumSamples);
+ 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);
+ FO_1I_D32F32C31_TRC_WRA_01(&pPrivate->pFastCoef->LPCoefs, pTemp, pTemp, (LVM_INT16)NumSamples);
/*
* Process all delay lines
*/
- for(j = 0; j < NumberOfDelayLines; j++)
- {
+ 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);
+ 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_Float(&pPrivate->pDelay_T[j][NumSamples],
- pPrivate->pDelay_T[j],
- (LVM_INT16)(pPrivate->T[j] - NumSamples)); /* 32-bit data */
+ Copy_Float(&pPrivate->pDelay_T[j][NumSamples], pPrivate->pDelay_T[j],
+ (LVM_INT16)(pPrivate->T[j] - NumSamples)); /* 32-bit data */
/* Apply the smoothed feedback and save to fixed delay input (currently empty) */
- MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedback[j],
- pDelayLine,
+ 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_Float(&pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
- -1.0f, /* Invert since the feedback coefficient is negative */
+ -1.0f, /* 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) */
@@ -283,9 +242,7 @@
&pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
(LVM_INT16)NumSamples);
/* Sum into the AP output */
- Mac3s_Sat_Float(&pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
- 1.0f,
- pDelayLine,
+ Mac3s_Sat_Float(&pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples], 1.0f, pDelayLine,
(LVM_INT16)NumSamples);
/*
@@ -296,34 +253,27 @@
/*
* Low pass filter
*/
- FO_1I_D32F32C31_TRC_WRA_01(&pPrivate->pFastCoef->RevLPCoefs[j],
- pDelayLine,
- pDelayLine,
+ 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_Float(pTemp,
- pDelayLineInput,
- (LVM_INT16)(NumSamples));
+ for (j = 0; j < NumberOfDelayLines; j++) {
+ Copy_Float(pTemp, pDelayLineInput, (LVM_INT16)(NumSamples));
/*
* Rotation matrix mix
*/
- switch(j)
- {
+ switch (j) {
case 3:
/*
* Add delay line 1 and 2 contribution
*/
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[2], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[2], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
break;
case 2:
@@ -331,61 +281,52 @@
/*
* Add delay line 0 and 3 contribution
*/
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[3], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[3], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
break;
case 1:
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
+ if (pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4) {
/*
* Add delay line 0 and 3 contribution
*/
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
Add2_Sat_Float(pPrivate->pScratchDelayLine[3], pDelayLineInput,
(LVM_INT16)NumSamples);
- }
- else
- {
+ } else {
/*
* Add delay line 0 and 1 contribution
*/
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
-
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
}
break;
case 0:
- if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
- {
+ if (pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4) {
/*
* Add delay line 1 and 2 contribution
*/
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
Add2_Sat_Float(pPrivate->pScratchDelayLine[2], pDelayLineInput,
(LVM_INT16)NumSamples);
- }
- else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
- {
+ } else if (pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2) {
/*
* Add delay line 0 and 1 contribution
*/
Add2_Sat_Float(pPrivate->pScratchDelayLine[0], pDelayLineInput,
(LVM_INT16)NumSamples);
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f,
- pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[1], -1.0f, pDelayLineInput,
+ (LVM_INT16)NumSamples);
- }
- else
- {
+ } else {
/*
* Add delay line 0 contribution
*/
@@ -402,54 +343,37 @@
/*
* Delay samples
*/
- Copy_Float(pDelayLineInput,
- &pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
- (LVM_INT16)(NumSamples)); /* 32-bit data */
+ Copy_Float(pDelayLineInput, &pPrivate->pDelay_T[j][pPrivate->T[j] - NumSamples],
+ (LVM_INT16)(NumSamples)); /* 32-bit data */
}
/*
* Create stereo output
*/
- switch(pPrivate->InstanceParams.NumDelays)
- {
+ switch (pPrivate->InstanceParams.NumDelays) {
case LVREV_DELAYLINES_4:
- Add2_Sat_Float(pPrivate->pScratchDelayLine[3],
- pPrivate->pScratchDelayLine[0],
- (LVM_INT16)NumSamples);
- Add2_Sat_Float(pPrivate->pScratchDelayLine[2],
- pPrivate->pScratchDelayLine[1],
- (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[3], pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[2], pPrivate->pScratchDelayLine[1],
+ (LVM_INT16)NumSamples);
- JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
- pPrivate->pScratchDelayLine[1],
- pTemp,
+ JoinTo2i_Float(pPrivate->pScratchDelayLine[0], pPrivate->pScratchDelayLine[1], pTemp,
(LVM_INT16)NumSamples);
break;
case LVREV_DELAYLINES_2:
- Copy_Float(pPrivate->pScratchDelayLine[1],
- pScratch,
- (LVM_INT16)(NumSamples));
+ Copy_Float(pPrivate->pScratchDelayLine[1], pScratch, (LVM_INT16)(NumSamples));
- Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0],
- -1.0f,
- pScratch,
- (LVM_INT16)NumSamples);
+ Mac3s_Sat_Float(pPrivate->pScratchDelayLine[0], -1.0f, pScratch, (LVM_INT16)NumSamples);
- Add2_Sat_Float(pPrivate->pScratchDelayLine[1],
- pPrivate->pScratchDelayLine[0],
- (LVM_INT16)NumSamples);
+ Add2_Sat_Float(pPrivate->pScratchDelayLine[1], pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
- JoinTo2i_Float(pPrivate->pScratchDelayLine[0],
- pScratch,
- pTemp,
- (LVM_INT16)NumSamples);
+ JoinTo2i_Float(pPrivate->pScratchDelayLine[0], pScratch, pTemp, (LVM_INT16)NumSamples);
break;
case LVREV_DELAYLINES_1:
- MonoTo2I_Float(pPrivate->pScratchDelayLine[0],
- pTemp,
- (LVM_INT16)NumSamples);
+ MonoTo2I_Float(pPrivate->pScratchDelayLine[0], pTemp, (LVM_INT16)NumSamples);
break;
default:
break;
@@ -460,25 +384,14 @@
*/
size = (LVM_INT16)(NumSamples << 1);
- MixSoft_2St_D32C31_SAT(&pPrivate->BypassMixer,
- pTemp,
- pTemp,
- pOutput,
- size);
+ MixSoft_2St_D32C31_SAT(&pPrivate->BypassMixer, pTemp, pTemp, pOutput, size);
/* Apply Gain*/
- Shift_Sat_Float(LVREV_OUTPUTGAIN_SHIFT,
- pOutput,
- pOutput,
- size);
+ Shift_Sat_Float(LVREV_OUTPUTGAIN_SHIFT, pOutput, pOutput, size);
- MixSoft_1St_D32C31_WRA(&pPrivate->GainMixer,
- pOutput,
- pOutput,
- size);
+ MixSoft_1St_D32C31_WRA(&pPrivate->GainMixer, pOutput, pOutput, size);
return;
}
/* 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 7a68c21..e5a0bc8 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.cpp
@@ -42,80 +42,67 @@
/* 1. This function may be interrupted by the LVREV_Process function */
/* */
/****************************************************************************************/
-LVREV_ReturnStatus_en LVREV_SetControlParameters(LVREV_Handle_t hInstance,
- LVREV_ControlParams_st *pNewParams)
-{
-
- LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+LVREV_ReturnStatus_en LVREV_SetControlParameters(LVREV_Handle_t hInstance,
+ LVREV_ControlParams_st* pNewParams) {
+ LVREV_Instance_st* pLVREV_Private = (LVREV_Instance_st*)hInstance;
/*
* Check for error conditions
*/
- if((hInstance == LVM_NULL) || (pNewParams == LVM_NULL))
- {
+ if ((hInstance == LVM_NULL) || (pNewParams == LVM_NULL)) {
return LVREV_NULLADDRESS;
}
/*
* Check all new control parameters are in range
*/
- if( ((pNewParams->OperatingMode != LVM_MODE_OFF) && (pNewParams->OperatingMode != LVM_MODE_ON)) ||
- (
- (pNewParams->SampleRate != LVM_FS_8000) && (pNewParams->SampleRate != LVM_FS_11025) && (pNewParams->SampleRate != LVM_FS_12000) &&
- (pNewParams->SampleRate != LVM_FS_16000) && (pNewParams->SampleRate != LVM_FS_22050) && (pNewParams->SampleRate != LVM_FS_24000) &&
- (pNewParams->SampleRate != LVM_FS_32000) &&
- (pNewParams->SampleRate != LVM_FS_44100) &&
- (pNewParams->SampleRate != LVM_FS_48000)
- && (pNewParams->SampleRate != LVM_FS_88200) && (pNewParams->SampleRate != LVM_FS_96000)
- && (pNewParams->SampleRate != LVM_FS_176400) && (pNewParams->SampleRate != LVM_FS_192000)
- )
- || ((pNewParams->SourceFormat != LVM_STEREO) &&
- (pNewParams->SourceFormat != LVM_MONOINSTEREO) &&
- (pNewParams->SourceFormat != LVM_MONO) &&
- (pNewParams->SourceFormat != LVM_MULTICHANNEL)))
- {
+ if (((pNewParams->OperatingMode != LVM_MODE_OFF) &&
+ (pNewParams->OperatingMode != LVM_MODE_ON)) ||
+ ((pNewParams->SampleRate != LVM_FS_8000) && (pNewParams->SampleRate != LVM_FS_11025) &&
+ (pNewParams->SampleRate != LVM_FS_12000) && (pNewParams->SampleRate != LVM_FS_16000) &&
+ (pNewParams->SampleRate != LVM_FS_22050) && (pNewParams->SampleRate != LVM_FS_24000) &&
+ (pNewParams->SampleRate != LVM_FS_32000) && (pNewParams->SampleRate != LVM_FS_44100) &&
+ (pNewParams->SampleRate != LVM_FS_48000) && (pNewParams->SampleRate != LVM_FS_88200) &&
+ (pNewParams->SampleRate != LVM_FS_96000) && (pNewParams->SampleRate != LVM_FS_176400) &&
+ (pNewParams->SampleRate != LVM_FS_192000)) ||
+ ((pNewParams->SourceFormat != LVM_STEREO) &&
+ (pNewParams->SourceFormat != LVM_MONOINSTEREO) && (pNewParams->SourceFormat != LVM_MONO) &&
+ (pNewParams->SourceFormat != LVM_MULTICHANNEL))) {
return (LVREV_OUTOFRANGE);
}
- if (pNewParams->Level > LVREV_MAX_LEVEL)
- {
+ if (pNewParams->Level > LVREV_MAX_LEVEL) {
return LVREV_OUTOFRANGE;
}
- if ((pNewParams->LPF < LVREV_MIN_LPF_CORNER) || (pNewParams->LPF > LVREV_MAX_LPF_CORNER))
- {
+ if ((pNewParams->LPF < LVREV_MIN_LPF_CORNER) || (pNewParams->LPF > LVREV_MAX_LPF_CORNER)) {
return LVREV_OUTOFRANGE;
}
- if ((pNewParams->HPF < LVREV_MIN_HPF_CORNER) || (pNewParams->HPF > LVREV_MAX_HPF_CORNER))
- {
+ if ((pNewParams->HPF < LVREV_MIN_HPF_CORNER) || (pNewParams->HPF > LVREV_MAX_HPF_CORNER)) {
return LVREV_OUTOFRANGE;
}
- if (pNewParams->T60 > LVREV_MAX_T60)
- {
+ if (pNewParams->T60 > LVREV_MAX_T60) {
return LVREV_OUTOFRANGE;
}
- if (pNewParams->Density > LVREV_MAX_DENSITY)
- {
+ if (pNewParams->Density > LVREV_MAX_DENSITY) {
return LVREV_OUTOFRANGE;
}
- if (pNewParams->Damping > LVREV_MAX_DAMPING)
- {
+ if (pNewParams->Damping > LVREV_MAX_DAMPING) {
return LVREV_OUTOFRANGE;
}
- if (pNewParams->RoomSize > LVREV_MAX_ROOMSIZE)
- {
+ if (pNewParams->RoomSize > LVREV_MAX_ROOMSIZE) {
return LVREV_OUTOFRANGE;
}
/*
* Copy the new parameters and set the flag to indicate they are available
*/
- pLVREV_Private->NewParams = *pNewParams;
+ pLVREV_Private->NewParams = *pNewParams;
pLVREV_Private->bControlPending = LVM_TRUE;
return LVREV_SUCCESS;
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
index 5cd623e..35a6522 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.cpp
@@ -30,25 +30,11 @@
/****************************************************************************************/
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
-const LVM_UINT32 LVM_FsTable[] = {
- 8000 ,
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000,
- 88200,
- 96000,
- 176400,
- 192000
-};
+const LVM_UINT32 LVM_FsTable[] = {8000, 11025, 12000, 16000, 22050, 24000, 32000,
+ 44100, 48000, 88200, 96000, 176400, 192000};
/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
-LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
- if (FsIndex > LVM_FS_192000)
- return 0;
+LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex) {
+ if (FsIndex > LVM_FS_192000) return 0;
return (LVM_FsTable[FsIndex]);
}
@@ -73,30 +59,174 @@
*/
/* Normalizing output including Reverb Level part (only shift up)*/
-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,},
- {4,1.035927f,10.182567f,-10.346134f,4.546533f,},
- {5,1.130313f,12.538727f,-13.627023f,6.165208f,},
- {6,1.060743f,8.091713f,-8.588079f,3.834230f,},
- {7,1.040381f,10.406566f,-11.176650f,5.075132f,},
- {8,1.026944f,8.387302f,-8.689796f,3.895863f,},
- {9,1.013312f,9.727236f,-10.534165f,4.742272f,},
- {10,0.996095f,8.492249f,-7.947677f,3.478917f,},
- {13,1.079346f,8.894425f,-9.641768f,4.434442f,},
- {15,0.994327f,7.441335f,-8.003979f,3.581177f,},
- {17,0.991067f,7.208373f,-7.257859f,3.167774f,},
- {20,1.033445f,7.476371f,-7.546960f,3.369703f,},
- {25,0.982830f,5.913867f,-5.638448f,2.420932f,},
- {30,0.928782f,5.035343f,-4.492104f,1.844904f,},
- {40,0.953714f,5.060232f,-4.472204f,1.829642f,},
- {50,0.899258f,4.273357f,-3.537492f,1.387576f,},
- {60,0.943584f,4.093228f,-3.469658f,1.410911f,},
- {70,0.926021f,3.973125f,-3.331985f,1.344690f,},
- {75,0.894853f,2.871747f,-1.438758f,0.311856f,},
- {80,0.935122f,2.991857f,-2.038882f,0.686395f,},
- {90,0.953872f,2.880315f,-2.122365f,0.784032f,},
- {100,0.951005f,2.894294f,-2.009086f,0.698316f,},
+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,
+ },
+ {
+ 4,
+ 1.035927f,
+ 10.182567f,
+ -10.346134f,
+ 4.546533f,
+ },
+ {
+ 5,
+ 1.130313f,
+ 12.538727f,
+ -13.627023f,
+ 6.165208f,
+ },
+ {
+ 6,
+ 1.060743f,
+ 8.091713f,
+ -8.588079f,
+ 3.834230f,
+ },
+ {
+ 7,
+ 1.040381f,
+ 10.406566f,
+ -11.176650f,
+ 5.075132f,
+ },
+ {
+ 8,
+ 1.026944f,
+ 8.387302f,
+ -8.689796f,
+ 3.895863f,
+ },
+ {
+ 9,
+ 1.013312f,
+ 9.727236f,
+ -10.534165f,
+ 4.742272f,
+ },
+ {
+ 10,
+ 0.996095f,
+ 8.492249f,
+ -7.947677f,
+ 3.478917f,
+ },
+ {
+ 13,
+ 1.079346f,
+ 8.894425f,
+ -9.641768f,
+ 4.434442f,
+ },
+ {
+ 15,
+ 0.994327f,
+ 7.441335f,
+ -8.003979f,
+ 3.581177f,
+ },
+ {
+ 17,
+ 0.991067f,
+ 7.208373f,
+ -7.257859f,
+ 3.167774f,
+ },
+ {
+ 20,
+ 1.033445f,
+ 7.476371f,
+ -7.546960f,
+ 3.369703f,
+ },
+ {
+ 25,
+ 0.982830f,
+ 5.913867f,
+ -5.638448f,
+ 2.420932f,
+ },
+ {
+ 30,
+ 0.928782f,
+ 5.035343f,
+ -4.492104f,
+ 1.844904f,
+ },
+ {
+ 40,
+ 0.953714f,
+ 5.060232f,
+ -4.472204f,
+ 1.829642f,
+ },
+ {
+ 50,
+ 0.899258f,
+ 4.273357f,
+ -3.537492f,
+ 1.387576f,
+ },
+ {
+ 60,
+ 0.943584f,
+ 4.093228f,
+ -3.469658f,
+ 1.410911f,
+ },
+ {
+ 70,
+ 0.926021f,
+ 3.973125f,
+ -3.331985f,
+ 1.344690f,
+ },
+ {
+ 75,
+ 0.894853f,
+ 2.871747f,
+ -1.438758f,
+ 0.311856f,
+ },
+ {
+ 80,
+ 0.935122f,
+ 2.991857f,
+ -2.038882f,
+ 0.686395f,
+ },
+ {
+ 90,
+ 0.953872f,
+ 2.880315f,
+ -2.122365f,
+ 0.784032f,
+ },
+ {
+ 100,
+ 0.951005f,
+ 2.894294f,
+ -2.009086f,
+ 0.698316f,
+ },
};
/* 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 e100d8a..4b0dcca 100644
--- a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
@@ -31,11 +31,11 @@
/* */
/****************************************************************************************/
-extern const LVM_UINT32 LVM_FsTable[];
-extern LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
+extern const LVM_UINT32 LVM_FsTable[];
+extern LVM_UINT32 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
-extern const LVM_FLOAT LVREV_GainPolyTable[24][5];
+extern const LVM_FLOAT LVREV_GainPolyTable[24][5];
-#endif /** _LVREV_TABLES_H_ **/
+#endif /** _LVREV_TABLES_H_ **/
/* End of file */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
index 0ba662a..85e3ab9 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/lib/LVPSA.h
@@ -26,38 +26,36 @@
/* */
/****************************************************************************************/
/* Level detection speed control parameters */
-typedef enum
-{
- LVPSA_SPEED_LOW, /* Low speed level detection */
- LVPSA_SPEED_MEDIUM, /* Medium speed level detection */
- LVPSA_SPEED_HIGH, /* High speed level detection */
- LVPSA_SPEED_DUMMY = LVM_MAXINT_32 /* Force 32 bits enum, don't use it! */
+typedef enum {
+ LVPSA_SPEED_LOW, /* Low speed level detection */
+ LVPSA_SPEED_MEDIUM, /* Medium speed level detection */
+ LVPSA_SPEED_HIGH, /* High speed level detection */
+ LVPSA_SPEED_DUMMY = LVM_MAXINT_32 /* Force 32 bits enum, don't use it! */
} LVPSA_LevelDetectSpeed_en;
/* Filter control parameters */
-typedef struct
-{
- LVM_UINT16 CenterFrequency; /* Center frequency of the band-pass filter (in Hz) */
- LVM_UINT16 QFactor; /* Quality factor of the filter (in 1/100) */
- LVM_INT16 PostGain; /* Postgain to apply after the filtering (in dB Q16.0) */
+typedef struct {
+ LVM_UINT16 CenterFrequency; /* Center frequency of the band-pass filter (in Hz) */
+ LVM_UINT16 QFactor; /* Quality factor of the filter (in 1/100) */
+ LVM_INT16 PostGain; /* Postgain to apply after the filtering (in dB Q16.0) */
} LVPSA_FilterParam_t;
/* LVPSA initialization parameters */
-typedef struct
-{
- LVM_UINT16 SpectralDataBufferDuration; /* Spectral data buffer duration in time (ms in Q16.0) */
- LVM_UINT16 MaxInputBlockSize; /* Maximum expected input block size (in samples) */
- LVM_UINT16 nBands; /* Number of bands of the SA */
- LVPSA_FilterParam_t *pFiltersParams; /* Points to nBands filter param structures for filters settings */
+typedef struct {
+ LVM_UINT16
+ SpectralDataBufferDuration; /* Spectral data buffer duration in time (ms in Q16.0) */
+ LVM_UINT16 MaxInputBlockSize; /* Maximum expected input block size (in samples) */
+ LVM_UINT16 nBands; /* Number of bands of the SA */
+ LVPSA_FilterParam_t*
+ pFiltersParams; /* Points to nBands filter param structures for filters settings */
} LVPSA_InitParams_t, *pLVPSA_InitParams_t;
/* LVPSA control parameters */
-typedef struct
-{
- LVM_Fs_en Fs; /* Input sampling rate */
- LVPSA_LevelDetectSpeed_en LevelDetectionSpeed; /* Level detection speed */
+typedef struct {
+ LVM_Fs_en Fs; /* Input sampling rate */
+ LVPSA_LevelDetectSpeed_en LevelDetectionSpeed; /* Level detection speed */
} LVPSA_ControlParams_t, *pLVPSA_ControlParams_t;
@@ -65,16 +63,15 @@
typedef LVM_INT32 LVPSA_Time;
/* Module instance Handle */
-typedef void *pLVPSA_Handle_t;
+typedef void* pLVPSA_Handle_t;
/* LVPSA return codes */
-typedef enum
-{
- LVPSA_OK, /* The function ran without any problem */
- LVPSA_ERROR_INVALIDPARAM, /* A parameter is incorrect */
- LVPSA_ERROR_WRONGTIME, /* An incorrect AudioTime is used */
- LVPSA_ERROR_NULLADDRESS, /* A pointer has a NULL value */
- LVPSA_RETURN_DUMMY = LVM_MAXINT_32 /* Force 32 bits enum, don't use it! */
+typedef enum {
+ LVPSA_OK, /* The function ran without any problem */
+ LVPSA_ERROR_INVALIDPARAM, /* A parameter is incorrect */
+ LVPSA_ERROR_WRONGTIME, /* An incorrect AudioTime is used */
+ LVPSA_ERROR_NULLADDRESS, /* A pointer has a NULL value */
+ LVPSA_RETURN_DUMMY = LVM_MAXINT_32 /* Force 32 bits enum, don't use it! */
} LVPSA_RETURN;
/*********************************************************************************************************************************
@@ -100,10 +97,8 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_Init(pLVPSA_Handle_t *phInstance,
- LVPSA_InitParams_t *pInitParams,
- LVPSA_ControlParams_t *pControlParams,
- void *pScratch);
+LVPSA_RETURN LVPSA_Init(pLVPSA_Handle_t* phInstance, LVPSA_InitParams_t* pInitParams,
+ LVPSA_ControlParams_t* pControlParams, void* pScratch);
/************************************************************************************/
/* */
@@ -116,109 +111,102 @@
/* phInstance Pointer to the instance handle */
/* */
/************************************************************************************/
-void LVPSA_DeInit(pLVPSA_Handle_t *phInstance);
+void LVPSA_DeInit(pLVPSA_Handle_t* phInstance);
/*********************************************************************************************************************************/
/* */
-/* FUNCTION: LVPSA_Control */
+/* FUNCTION: LVPSA_Control */
/* */
-/* DESCRIPTION: */
-/* Controls the LVPSA module. */
+/* DESCRIPTION: */
+/* Controls the LVPSA module. */
/* */
-/* PARAMETERS: */
-/* hInstance Instance Handle */
-/* pNewParams Pointer to the instance new control parameters */
+/* PARAMETERS: */
+/* hInstance Instance Handle */
+/* pNewParams Pointer to the instance new control parameters */
/* */
-/* RETURNS: */
-/* LVPSA_OK Succeeds */
-/* otherwise Error due to bad parameters */
+/* RETURNS: */
+/* LVPSA_OK Succeeds */
+/* otherwise Error due to bad parameters */
/* */
/*********************************************************************************************************************************/
-LVPSA_RETURN LVPSA_Control ( pLVPSA_Handle_t hInstance,
- LVPSA_ControlParams_t *pNewParams );
+LVPSA_RETURN LVPSA_Control(pLVPSA_Handle_t hInstance, LVPSA_ControlParams_t* pNewParams);
/*********************************************************************************************************************************/
/* */
-/* FUNCTION: LVPSA_Process */
+/* FUNCTION: LVPSA_Process */
/* */
-/* DESCRIPTION: */
-/* The process calculates the levels of the frequency bands. */
+/* DESCRIPTION: */
+/* The process calculates the levels of the frequency bands. */
/* */
-/* PARAMETERS: */
-/* hInstance Instance Handle */
-/* pLVPSA_InputSamples Pointer to the input samples buffer */
-/* InputBlockSize Number of mono samples to process */
-/* AudioTime Playback time of the first input sample */
+/* PARAMETERS: */
+/* hInstance Instance Handle */
+/* pLVPSA_InputSamples Pointer to the input samples buffer */
+/* InputBlockSize Number of mono samples to process */
+/* AudioTime Playback time of the first input sample */
/* */
/* */
-/* RETURNS: */
-/* LVPSA_OK Succeeds */
-/* otherwise Error due to bad parameters */
+/* RETURNS: */
+/* LVPSA_OK Succeeds */
+/* otherwise Error due to bad parameters */
/* */
/*********************************************************************************************************************************/
-LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
- LVM_FLOAT *pLVPSA_InputSamples,
- LVM_UINT16 InputBlockSize,
- LVPSA_Time AudioTime );
+LVPSA_RETURN LVPSA_Process(pLVPSA_Handle_t hInstance, LVM_FLOAT* pLVPSA_InputSamples,
+ LVM_UINT16 InputBlockSize, LVPSA_Time AudioTime);
/*********************************************************************************************************************************/
/* */
-/* FUNCTION: LVPSA_GetSpectrum */
+/* FUNCTION: LVPSA_GetSpectrum */
/* */
-/* DESCRIPTION: */
-/* This function is used for memory allocation and free. */
+/* DESCRIPTION: */
+/* This function is used for memory allocation and free. */
/* */
/* */
-/* PARAMETERS: */
-/* hInstance Instance Handle */
-/* GetSpectrumAudioTime Time to retrieve the values at */
-/* pCurrentValues Pointer to an empty buffer : Current level values output */
-/* pPeakValues Pointer to an empty buffer : Peak level values output */
+/* PARAMETERS: */
+/* hInstance Instance Handle */
+/* GetSpectrumAudioTime Time to retrieve the values at */
+/* pCurrentValues Pointer to an empty buffer : Current level values output */
+/* pPeakValues Pointer to an empty buffer : Peak level values output */
/* */
/* */
-/* RETURNS: */
-/* LVPSA_OK Succeeds */
-/* otherwise Error due to bad parameters */
+/* RETURNS: */
+/* LVPSA_OK Succeeds */
+/* otherwise Error due to bad parameters */
/* */
/*********************************************************************************************************************************/
-LVPSA_RETURN LVPSA_GetSpectrum ( pLVPSA_Handle_t hInstance,
- LVPSA_Time GetSpectrumAudioTime,
- LVM_UINT8 *pCurrentValues,
- LVM_UINT8 *pPeakValues );
+LVPSA_RETURN LVPSA_GetSpectrum(pLVPSA_Handle_t hInstance, LVPSA_Time GetSpectrumAudioTime,
+ LVM_UINT8* pCurrentValues, LVM_UINT8* pPeakValues);
/*********************************************************************************************************************************/
/* */
-/* FUNCTION: LVPSA_GetControlParams */
+/* FUNCTION: LVPSA_GetControlParams */
/* */
-/* DESCRIPTION: */
-/* Get the current control parameters of the LVPSA module. */
+/* DESCRIPTION: */
+/* Get the current control parameters of the LVPSA module. */
/* */
-/* PARAMETERS: */
-/* hInstance Instance Handle */
-/* pParams Pointer to an empty control parameters structure */
-/* RETURNS: */
-/* LVPSA_OK Succeeds */
-/* otherwise Error due to bad parameters */
+/* PARAMETERS: */
+/* hInstance Instance Handle */
+/* pParams Pointer to an empty control parameters structure */
+/* RETURNS: */
+/* LVPSA_OK Succeeds */
+/* otherwise Error due to bad parameters */
/* */
/*********************************************************************************************************************************/
-LVPSA_RETURN LVPSA_GetControlParams ( pLVPSA_Handle_t hInstance,
- LVPSA_ControlParams_t *pParams );
+LVPSA_RETURN LVPSA_GetControlParams(pLVPSA_Handle_t hInstance, LVPSA_ControlParams_t* pParams);
/*********************************************************************************************************************************/
/* */
-/* FUNCTION: LVPSA_GetInitParams */
+/* FUNCTION: LVPSA_GetInitParams */
/* */
-/* DESCRIPTION: */
-/* Get the initialization parameters of the LVPSA module. */
+/* DESCRIPTION: */
+/* Get the initialization parameters of the LVPSA module. */
/* */
-/* PARAMETERS: */
-/* hInstance Instance Handle */
-/* pParams Pointer to an empty init parameters structure */
-/* RETURNS: */
-/* LVPSA_OK Succeeds */
-/* otherwise Error due to bad parameters */
+/* PARAMETERS: */
+/* hInstance Instance Handle */
+/* pParams Pointer to an empty init parameters structure */
+/* RETURNS: */
+/* LVPSA_OK Succeeds */
+/* otherwise Error due to bad parameters */
/* */
/*********************************************************************************************************************************/
-LVPSA_RETURN LVPSA_GetInitParams ( pLVPSA_Handle_t hInstance,
- LVPSA_InitParams_t *pParams );
+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 deafaa7..4e90a42 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Control.cpp
@@ -15,30 +15,25 @@
* limitations under the License.
*/
-#include "LVPSA.h"
-#include "LVPSA_Private.h"
-#include "VectorArithmetic.h"
+#include "LVPSA.h"
+#include "LVPSA_Private.h"
+#include "VectorArithmetic.h"
-#define LOW_FREQ 298 /* 32768/110 for low test frequency */
-#define HIGH_FREQ 386 /* 32768/85 for high test frequency */
+#define LOW_FREQ 298 /* 32768/110 for low test frequency */
+#define HIGH_FREQ 386 /* 32768/85 for high test frequency */
-LVPSA_RETURN LVPSA_SetBPFiltersType ( LVPSA_InstancePr_t *pInst,
- LVPSA_ControlParams_t *pParams );
+LVPSA_RETURN LVPSA_SetBPFiltersType(LVPSA_InstancePr_t* pInst, LVPSA_ControlParams_t* pParams);
-LVPSA_RETURN LVPSA_SetQPFCoefficients( LVPSA_InstancePr_t *pInst,
- LVPSA_ControlParams_t *pParams );
+LVPSA_RETURN LVPSA_SetQPFCoefficients(LVPSA_InstancePr_t* pInst, LVPSA_ControlParams_t* pParams);
-LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_FLOAT_Coefs_t *pCoefficients);
+LVPSA_RETURN LVPSA_BPSinglePrecCoefs(LVM_UINT16 Fs, LVPSA_FilterParam_t* pFilterParams,
+ BP_FLOAT_Coefs_t* pCoefficients);
-LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_FLOAT_Coefs_t *pCoefficients);
-LVPSA_RETURN LVPSA_SetBPFCoefficients( LVPSA_InstancePr_t *pInst,
- LVPSA_ControlParams_t *pParams );
+LVPSA_RETURN LVPSA_BPDoublePrecCoefs(LVM_UINT16 Fs, LVPSA_FilterParam_t* pFilterParams,
+ BP_FLOAT_Coefs_t* pCoefficients);
+LVPSA_RETURN LVPSA_SetBPFCoefficients(LVPSA_InstancePr_t* pInst, LVPSA_ControlParams_t* pParams);
-LVPSA_RETURN LVPSA_ClearFilterHistory( LVPSA_InstancePr_t *pInst);
+LVPSA_RETURN LVPSA_ClearFilterHistory(LVPSA_InstancePr_t* pInst);
/************************************************************************************/
/* */
@@ -56,29 +51,23 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_Control ( pLVPSA_Handle_t hInstance,
- LVPSA_ControlParams_t *pNewParams )
-{
+LVPSA_RETURN LVPSA_Control(pLVPSA_Handle_t hInstance, LVPSA_ControlParams_t* pNewParams) {
+ LVPSA_InstancePr_t* pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
-
- if((hInstance == LVM_NULL) || (pNewParams == LVM_NULL))
- {
- return(LVPSA_ERROR_NULLADDRESS);
+ if ((hInstance == LVM_NULL) || (pNewParams == LVM_NULL)) {
+ return (LVPSA_ERROR_NULLADDRESS);
}
- if(pNewParams->Fs >= LVPSA_NR_SUPPORTED_RATE)
- {
- return(LVPSA_ERROR_INVALIDPARAM);
+ if (pNewParams->Fs >= LVPSA_NR_SUPPORTED_RATE) {
+ return (LVPSA_ERROR_INVALIDPARAM);
}
- if(pNewParams->LevelDetectionSpeed >= LVPSA_NR_SUPPORTED_SPEED)
- {
- return(LVPSA_ERROR_INVALIDPARAM);
+ if (pNewParams->LevelDetectionSpeed >= LVPSA_NR_SUPPORTED_SPEED) {
+ return (LVPSA_ERROR_INVALIDPARAM);
}
pLVPSA_Inst->NewParams = *pNewParams;
pLVPSA_Inst->bControlPending = LVM_TRUE;
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/************************************************************************************/
@@ -96,20 +85,17 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_GetControlParams ( pLVPSA_Handle_t hInstance,
- LVPSA_ControlParams_t *pParams )
-{
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+LVPSA_RETURN LVPSA_GetControlParams(pLVPSA_Handle_t hInstance, LVPSA_ControlParams_t* pParams) {
+ LVPSA_InstancePr_t* pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- if((hInstance == LVM_NULL) || (pParams == LVM_NULL))
- {
- return(LVPSA_ERROR_NULLADDRESS);
+ if ((hInstance == LVM_NULL) || (pParams == LVM_NULL)) {
+ return (LVPSA_ERROR_NULLADDRESS);
}
- pParams->Fs = pLVPSA_Inst->CurrentParams.Fs;
- pParams->LevelDetectionSpeed = pLVPSA_Inst->CurrentParams.LevelDetectionSpeed;
+ pParams->Fs = pLVPSA_Inst->CurrentParams.Fs;
+ pParams->LevelDetectionSpeed = pLVPSA_Inst->CurrentParams.LevelDetectionSpeed;
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/************************************************************************************/
@@ -127,22 +113,19 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_GetInitParams ( pLVPSA_Handle_t hInstance,
- LVPSA_InitParams_t *pParams )
-{
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+LVPSA_RETURN LVPSA_GetInitParams(pLVPSA_Handle_t hInstance, LVPSA_InitParams_t* pParams) {
+ LVPSA_InstancePr_t* pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- if((hInstance == LVM_NULL) || (pParams == LVM_NULL))
- {
- return(LVPSA_ERROR_NULLADDRESS);
+ if ((hInstance == LVM_NULL) || (pParams == LVM_NULL)) {
+ return (LVPSA_ERROR_NULLADDRESS);
}
- pParams->SpectralDataBufferDuration = pLVPSA_Inst->SpectralDataBufferDuration;
- pParams->MaxInputBlockSize = pLVPSA_Inst->MaxInputBlockSize;
- pParams->nBands = pLVPSA_Inst->nBands;
- pParams->pFiltersParams = pLVPSA_Inst->pFiltersParams;
+ pParams->SpectralDataBufferDuration = pLVPSA_Inst->SpectralDataBufferDuration;
+ pParams->MaxInputBlockSize = pLVPSA_Inst->MaxInputBlockSize;
+ pParams->nBands = pLVPSA_Inst->nBands;
+ pParams->pFiltersParams = pLVPSA_Inst->pFiltersParams;
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/************************************************************************************/
@@ -163,42 +146,38 @@
/* NOTES: */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_ApplyNewSettings (LVPSA_InstancePr_t *pInst)
-{
+LVPSA_RETURN LVPSA_ApplyNewSettings(LVPSA_InstancePr_t* pInst) {
LVM_UINT16 ii;
LVM_UINT16 Freq;
- LVPSA_ControlParams_t Params;
- extern LVM_INT16 LVPSA_nSamplesBufferUpdate[];
- extern LVM_UINT32 LVPSA_SampleRateTab[];
- extern LVM_UINT16 LVPSA_DownSamplingFactor[];
+ LVPSA_ControlParams_t Params;
+ extern LVM_INT16 LVPSA_nSamplesBufferUpdate[];
+ extern LVM_UINT32 LVPSA_SampleRateTab[];
+ extern LVM_UINT16 LVPSA_DownSamplingFactor[];
- if(pInst == 0)
- {
- return(LVPSA_ERROR_NULLADDRESS);
+ if (pInst == 0) {
+ return (LVPSA_ERROR_NULLADDRESS);
}
Params = pInst->NewParams;
/* Modifies filters types and coefficients, clear the taps and
re-initializes parameters if sample frequency has changed */
- if(Params.Fs != pInst->CurrentParams.Fs)
- {
+ if (Params.Fs != pInst->CurrentParams.Fs) {
pInst->CurrentParams.Fs = Params.Fs;
/* Initialize the center freqeuncies as a function of the sample rate */
- Freq = (LVM_UINT16) ((LVPSA_SampleRateTab[pInst->CurrentParams.Fs]>>1) / (pInst->nBands + 1));
- for(ii = pInst->nBands; ii > 0; ii--)
- {
- pInst->pFiltersParams[ii-1].CenterFrequency = (LVM_UINT16) (Freq * ii);
+ Freq = (LVM_UINT16)((LVPSA_SampleRateTab[pInst->CurrentParams.Fs] >> 1) /
+ (pInst->nBands + 1));
+ for (ii = pInst->nBands; ii > 0; ii--) {
+ pInst->pFiltersParams[ii - 1].CenterFrequency = (LVM_UINT16)(Freq * ii);
}
/* Count the number of relevant filters. If the center frequency of the filter is
bigger than the nyquist frequency, then the filter is not relevant and doesn't
need to be used */
- for(ii = pInst->nBands; ii > 0; ii--)
- {
- if(pInst->pFiltersParams[ii-1].CenterFrequency < (LVPSA_SampleRateTab[pInst->CurrentParams.Fs]>>1))
- {
+ for (ii = pInst->nBands; ii > 0; ii--) {
+ if (pInst->pFiltersParams[ii - 1].CenterFrequency <
+ (LVPSA_SampleRateTab[pInst->CurrentParams.Fs] >> 1)) {
pInst->nRelevantFilters = ii;
break;
}
@@ -211,19 +190,14 @@
pInst->BufferUpdateSamplesCount = 0;
pInst->DownSamplingFactor = LVPSA_DownSamplingFactor[Params.Fs];
pInst->DownSamplingCount = 0;
- for(ii = 0; ii < (pInst->nBands * pInst->SpectralDataBufferLength); ii++)
- {
+ for (ii = 0; ii < (pInst->nBands * pInst->SpectralDataBufferLength); ii++) {
pInst->pSpectralDataBufferStart[ii] = 0;
}
- for(ii = 0; ii < pInst->nBands; ii++)
- {
+ for (ii = 0; ii < pInst->nBands; ii++) {
pInst->pPreviousPeaks[ii] = 0;
}
- }
- else
- {
- if(Params.LevelDetectionSpeed != pInst->CurrentParams.LevelDetectionSpeed)
- {
+ } else {
+ if (Params.LevelDetectionSpeed != pInst->CurrentParams.LevelDetectionSpeed) {
LVPSA_SetQPFCoefficients(pInst, &Params);
}
}
@@ -253,47 +227,43 @@
/* Single precision otherwise */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_SetBPFiltersType ( LVPSA_InstancePr_t *pInst,
- LVPSA_ControlParams_t *pParams )
-{
- extern LVM_UINT32 LVPSA_SampleRateTab[]; /* Sample rate table */
- 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 */
- LVM_INT16 QFactor; /* Filter Q factor */
+LVPSA_RETURN LVPSA_SetBPFiltersType(LVPSA_InstancePr_t* pInst, LVPSA_ControlParams_t* pParams) {
+ extern LVM_UINT32 LVPSA_SampleRateTab[]; /* Sample rate table */
+ 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 */
+ LVM_INT16 QFactor; /* Filter Q factor */
- for (ii = 0; ii < pInst->nRelevantFilters; ii++)
- {
+ for (ii = 0; ii < pInst->nRelevantFilters; ii++) {
/*
* Get the filter settings
*/
- fc = (LVM_UINT32)pInst->pFiltersParams[ii].CenterFrequency; /* Get the band centre frequency */
- QFactor =(LVM_INT16) pInst->pFiltersParams[ii].QFactor; /* Get the band Q factor */
+ 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
*/
- pInst->pBPFiltersPrecision[ii] = LVPSA_SimplePrecisionFilter; /* Default to single precision */
- if ((LOW_FREQ * fs) >= (fc << 15))
- {
+ pInst->pBPFiltersPrecision[ii] =
+ LVPSA_SimplePrecisionFilter; /* Default to single precision */
+ if ((LOW_FREQ * fs) >= (fc << 15)) {
/*
* fc <= fs/110
*/
pInst->pBPFiltersPrecision[ii] = LVPSA_DoublePrecisionFilter;
- }
- else
- {
- if (((LOW_FREQ * fs) < (fc << 15)) && ((fc << 15) < (HIGH_FREQ * fs)) && (QFactor > 300))
- {
+ } else {
+ if (((LOW_FREQ * fs) < (fc << 15)) && ((fc << 15) < (HIGH_FREQ * fs)) &&
+ (QFactor > 300)) {
/*
- * (fs/110 < fc < fs/85) & (Q>3)
- */
+ * (fs/110 < fc < fs/85) & (Q>3)
+ */
pInst->pBPFiltersPrecision[ii] = LVPSA_DoublePrecisionFilter;
}
}
}
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/************************************************************************************/
@@ -314,60 +284,49 @@
/* NOTES: */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_SetBPFCoefficients( LVPSA_InstancePr_t *pInst,
- LVPSA_ControlParams_t *pParams)
-{
-
- LVM_UINT16 ii;
+LVPSA_RETURN LVPSA_SetBPFCoefficients(LVPSA_InstancePr_t* pInst, LVPSA_ControlParams_t* pParams) {
+ LVM_UINT16 ii;
/*
* Set the coefficients for each band by the init function
*/
- for (ii = 0; ii < pInst->nRelevantFilters; ii++)
- {
- switch (pInst->pBPFiltersPrecision[ii])
- {
- case LVPSA_DoublePrecisionFilter:
- {
- BP_FLOAT_Coefs_t Coefficients;
+ for (ii = 0; ii < pInst->nRelevantFilters; ii++) {
+ switch (pInst->pBPFiltersPrecision[ii]) {
+ case LVPSA_DoublePrecisionFilter: {
+ BP_FLOAT_Coefs_t Coefficients;
/*
* Calculate the double precision coefficients
*/
- LVPSA_BPDoublePrecCoefs((LVM_UINT16)pParams->Fs,
- &pInst->pFiltersParams[ii],
+ 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);
+ BP_1I_D16F32Cll_TRC_WRA_01_Init(&pInst->pBP_Instances[ii], &pInst->pBP_Taps[ii],
+ &Coefficients);
break;
}
- case LVPSA_SimplePrecisionFilter:
- {
- BP_FLOAT_Coefs_t Coefficients;
+ case LVPSA_SimplePrecisionFilter: {
+ BP_FLOAT_Coefs_t Coefficients;
/*
* Calculate the single precision coefficients
*/
- LVPSA_BPSinglePrecCoefs((LVM_UINT16)pParams->Fs,
- &pInst->pFiltersParams[ii],
+ 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);
+ BP_1I_D16F16Css_TRC_WRA_01_Init(&pInst->pBP_Instances[ii], &pInst->pBP_Taps[ii],
+ &Coefficients);
break;
}
}
}
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/************************************************************************************/
@@ -388,26 +347,20 @@
/* NOTES: */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_SetQPFCoefficients( LVPSA_InstancePr_t *pInst,
- LVPSA_ControlParams_t *pParams )
-{
- LVM_UINT16 ii;
- LVM_Fs_en Fs = pParams->Fs;
- QPD_FLOAT_Coefs *pCoefficients;
- extern QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[];
+LVPSA_RETURN LVPSA_SetQPFCoefficients(LVPSA_InstancePr_t* pInst, LVPSA_ControlParams_t* pParams) {
+ LVM_UINT16 ii;
+ LVM_Fs_en Fs = pParams->Fs;
+ QPD_FLOAT_Coefs* pCoefficients;
+ extern QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[];
- pCoefficients = &LVPSA_QPD_Float_Coefs[(pParams->LevelDetectionSpeed * \
- LVPSA_NR_SUPPORTED_RATE) + Fs];
+ pCoefficients =
+ &LVPSA_QPD_Float_Coefs[(pParams->LevelDetectionSpeed * LVPSA_NR_SUPPORTED_RATE) + Fs];
- for (ii = 0; ii < pInst->nRelevantFilters; ii++)
- {
- LVPSA_QPD_Init_Float (&pInst->pQPD_States[ii],
- &pInst->pQPD_Taps[ii],
- pCoefficients );
+ for (ii = 0; ii < pInst->nRelevantFilters; ii++) {
+ LVPSA_QPD_Init_Float(&pInst->pQPD_States[ii], &pInst->pQPD_Taps[ii], pCoefficients);
}
- return(LVPSA_OK);
-
+ return (LVPSA_OK);
}
/****************************************************************************************/
@@ -443,49 +396,46 @@
/* of the n bands equalizer (LVEQNB */
/* */
/****************************************************************************************/
-LVPSA_RETURN LVPSA_BPSinglePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_FLOAT_Coefs_t *pCoefficients)
-{
-
- extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
- extern LVM_FLOAT LVPSA_Float_CosCoef[];
+LVPSA_RETURN LVPSA_BPSinglePrecCoefs(LVM_UINT16 Fs, LVPSA_FilterParam_t* pFilterParams,
+ BP_FLOAT_Coefs_t* pCoefficients) {
+ extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVPSA_Float_CosCoef[];
/*
* Intermediate variables and temporary values
*/
- LVM_FLOAT T0;
- LVM_FLOAT D;
- LVM_FLOAT A0;
- LVM_FLOAT B1;
- LVM_FLOAT B2;
- LVM_FLOAT Dt0;
- LVM_FLOAT B2_Den;
- LVM_FLOAT B2_Num;
- LVM_FLOAT COS_T0;
- LVM_FLOAT coef;
- LVM_FLOAT factor;
- LVM_FLOAT t0;
- LVM_INT16 i;
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+ LVM_FLOAT Dt0;
+ LVM_FLOAT B2_Den;
+ LVM_FLOAT B2_Num;
+ LVM_FLOAT COS_T0;
+ LVM_FLOAT coef;
+ LVM_FLOAT factor;
+ LVM_FLOAT t0;
+ LVM_INT16 i;
/*
* Get the filter definition
*/
- LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
- LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
+ LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
+ LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
/*
* Calculating the intermediate values
*/
- T0 = Frequency * LVPSA_Float_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 */
+ T0 = Frequency * LVPSA_Float_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 = T0 / 2048 ;
+ Dt0 = T0 / 2048;
B2_Den = QFactor + Dt0;
B2_Num = Dt0 - QFactor;
B2 = B2_Num / (2 * B2_Den);
@@ -495,20 +445,19 @@
*
* Cos += coef(n) * t0^n For n = 0 to 6
*/
- T0 = (T0 / 2048) * 0.63658558f; /* Scale to 1.0 in 16-bit for range 0 to fs/2 */
- t0 = T0 ;
- factor = 1.0f; /* Initialise to 1.0 for the a0 coefficient */
- COS_T0 = 0.0f; /* Initialise the error to zero */
- for (i = 1; i < 7; i++)
- {
- coef = LVPSA_Float_CosCoef[i]; /* Get the nth coefficient */
- COS_T0 += (factor * coef); /* The nth partial sum */
- factor = (factor * t0) ; /* Calculate t0^n */
+ T0 = (T0 / 2048) * 0.63658558f; /* Scale to 1.0 in 16-bit for range 0 to fs/2 */
+ t0 = T0;
+ factor = 1.0f; /* Initialise to 1.0 for the a0 coefficient */
+ COS_T0 = 0.0f; /* Initialise the error to zero */
+ for (i = 1; i < 7; i++) {
+ coef = LVPSA_Float_CosCoef[i]; /* Get the nth coefficient */
+ COS_T0 += (factor * coef); /* The nth partial sum */
+ factor = (factor * t0); /* Calculate t0^n */
}
- COS_T0 = COS_T0 * 8; /*LVPSA_CosCoef_float[0]*/ /* Correct the scaling */
+ 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 */
+ 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 */
/*
* Write coeff into the data structure
@@ -517,7 +466,7 @@
pCoefficients->B1 = B1 * 2;
pCoefficients->B2 = B2 * 2;
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/****************************************************************************************/
/* */
@@ -561,49 +510,46 @@
/* of the n bands equalizer (LVEQNB */
/* */
/****************************************************************************************/
-LVPSA_RETURN LVPSA_BPDoublePrecCoefs( LVM_UINT16 Fs,
- LVPSA_FilterParam_t *pFilterParams,
- BP_FLOAT_Coefs_t *pCoefficients)
-{
-
- extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
- extern LVM_FLOAT LVPSA_Float_DPCosCoef[];
+LVPSA_RETURN LVPSA_BPDoublePrecCoefs(LVM_UINT16 Fs, LVPSA_FilterParam_t* pFilterParams,
+ BP_FLOAT_Coefs_t* pCoefficients) {
+ extern LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
+ extern LVM_FLOAT LVPSA_Float_DPCosCoef[];
/*
* Intermediate variables and temporary values
*/
- LVM_FLOAT T0;
- LVM_FLOAT D;
- LVM_FLOAT A0;
- LVM_FLOAT B1;
- LVM_FLOAT B2;
- LVM_FLOAT Dt0;
- LVM_FLOAT B2_Den;
- LVM_FLOAT B2_Num;
- LVM_FLOAT CosErr;
- LVM_FLOAT coef;
- LVM_FLOAT factor;
- LVM_FLOAT t0;
- LVM_INT16 i;
+ LVM_FLOAT T0;
+ LVM_FLOAT D;
+ LVM_FLOAT A0;
+ LVM_FLOAT B1;
+ LVM_FLOAT B2;
+ LVM_FLOAT Dt0;
+ LVM_FLOAT B2_Den;
+ LVM_FLOAT B2_Num;
+ LVM_FLOAT CosErr;
+ LVM_FLOAT coef;
+ LVM_FLOAT factor;
+ LVM_FLOAT t0;
+ LVM_INT16 i;
/*
* Get the filter definition
*/
- LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
- LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
+ LVM_FLOAT Frequency = (LVM_FLOAT)(pFilterParams->CenterFrequency);
+ LVM_FLOAT QFactor = ((LVM_FLOAT)(pFilterParams->QFactor)) / 100;
/*
* Calculating the intermediate values
*/
- T0 = Frequency * LVPSA_Float_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 */
+ T0 = Frequency * LVPSA_Float_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 = T0 / 2048 ;
+ Dt0 = T0 / 2048;
B2_Den = QFactor + Dt0;
B2_Num = Dt0 - QFactor;
B2 = B2_Num / (2 * B2_Den);
@@ -613,25 +559,24 @@
*
* CosErr += coef(n) * t0^n For n = 0 to 4
*/
- T0 = T0 * 0.994750f; /* Scale to 1.0 in 16-bit for range 0 to fs/50 */
+ T0 = T0 * 0.994750f; /* Scale to 1.0 in 16-bit for range 0 to fs/50 */
t0 = T0;
- factor = 1.0f; /* Initialise to 1.0 for the a0 coefficient */
- CosErr = 0.0f; /* Initialise the error to zero */
- for (i = 1; i < 5; i++)
- {
- coef = LVPSA_Float_DPCosCoef[i]; /* Get the nth coefficient */
+ factor = 1.0f; /* Initialise to 1.0 for the a0 coefficient */
+ CosErr = 0.0f; /* Initialise the error to zero */
+ for (i = 1; i < 5; i++) {
+ coef = LVPSA_Float_DPCosCoef[i]; /* Get the nth coefficient */
CosErr += factor * coef; /* The nth partial sum */
- factor = factor * t0; /* Calculate t0^n */
+ factor = factor * t0; /* Calculate t0^n */
}
- CosErr = CosErr * 2; /* Correct the scaling */
+ CosErr = CosErr * 2; /* Correct the scaling */
/*
* Calculate the B1 and A0 coefficients
*/
- B1 = ((LVM_FLOAT)0.5 - B2); /* B1 = (0.5 - b2) */
- A0 = B1 * CosErr ; /* Temporary storage for (0.5 - b2) * coserr(t0) */
- B1 -= A0; /* B1 = (0.5 - b2) * (1 - coserr(t0)) */
- A0 = ((LVM_FLOAT)0.5 + B2) / 2; /* A0 = (0.5 + b2) / 2 */
+ B1 = ((LVM_FLOAT)0.5 - B2); /* B1 = (0.5 - b2) */
+ A0 = B1 * CosErr; /* Temporary storage for (0.5 - b2) * coserr(t0) */
+ B1 -= A0; /* B1 = (0.5 - b2) * (1 - coserr(t0)) */
+ A0 = ((LVM_FLOAT)0.5 + B2) / 2; /* A0 = (0.5 + b2) / 2 */
/*
* Write coeff into the data structure
@@ -640,7 +585,7 @@
pCoefficients->B1 = B1;
pCoefficients->B2 = B2;
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/************************************************************************************/
/* */
@@ -658,24 +603,20 @@
/* NOTES: */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_ClearFilterHistory(LVPSA_InstancePr_t *pInst)
-{
- LVM_INT8 *pTapAddress;
- LVM_UINT32 i;
+LVPSA_RETURN LVPSA_ClearFilterHistory(LVPSA_InstancePr_t* pInst) {
+ LVM_INT8* pTapAddress;
+ LVM_UINT32 i;
/* Band Pass filters taps */
- pTapAddress = (LVM_INT8 *)pInst->pBP_Taps;
- for(i = 0; i < pInst->nBands * sizeof(Biquad_1I_Order2_FLOAT_Taps_t); i++)
- {
+ pTapAddress = (LVM_INT8*)pInst->pBP_Taps;
+ for (i = 0; i < pInst->nBands * sizeof(Biquad_1I_Order2_FLOAT_Taps_t); i++) {
pTapAddress[i] = 0;
}
/* Quasi-peak filters taps */
- pTapAddress = (LVM_INT8 *)pInst->pQPD_Taps;
- for(i = 0; i < pInst->nBands * sizeof(QPD_Taps_t); i++)
- {
+ pTapAddress = (LVM_INT8*)pInst->pQPD_Taps;
+ for (i = 0; i < pInst->nBands * sizeof(QPD_Taps_t); i++) {
pTapAddress[i] = 0;
}
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
-
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
index be3c68f..9a2b29f 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Init.cpp
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-#include <stdlib.h>
-#include "LVPSA.h"
-#include "LVPSA_Private.h"
-#include "InstAlloc.h"
+#include <stdlib.h>
+#include "LVPSA.h"
+#include "LVPSA_Private.h"
+#include "InstAlloc.h"
/************************************************************************************/
/* */
@@ -40,24 +40,20 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_Init(pLVPSA_Handle_t *phInstance,
- LVPSA_InitParams_t *pInitParams,
- LVPSA_ControlParams_t *pControlParams,
- void *pScratch)
-{
- LVPSA_InstancePr_t *pLVPSA_Inst;
- LVPSA_RETURN errorCode = LVPSA_OK;
- LVM_UINT32 ii;
- extern LVM_FLOAT LVPSA_Float_GainTable[];
- LVM_UINT32 BufferLength = 0;
+LVPSA_RETURN LVPSA_Init(pLVPSA_Handle_t* phInstance, LVPSA_InitParams_t* pInitParams,
+ LVPSA_ControlParams_t* pControlParams, void* pScratch) {
+ LVPSA_InstancePr_t* pLVPSA_Inst;
+ LVPSA_RETURN errorCode = LVPSA_OK;
+ LVM_UINT32 ii;
+ extern LVM_FLOAT LVPSA_Float_GainTable[];
+ LVM_UINT32 BufferLength = 0;
/* Set the instance handle if not already initialised */
*phInstance = calloc(1, sizeof(*pLVPSA_Inst));
- if (*phInstance == LVM_NULL)
- {
+ if (*phInstance == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst =(LVPSA_InstancePr_t*)*phInstance;
+ pLVPSA_Inst = (LVPSA_InstancePr_t*)*phInstance;
pLVPSA_Inst->pScratch = pScratch;
@@ -69,112 +65,96 @@
pLVPSA_Inst->CurrentParams.Fs = LVM_FS_DUMMY;
pLVPSA_Inst->CurrentParams.LevelDetectionSpeed = LVPSA_SPEED_DUMMY;
- { /* for avoiding QAC warnings */
- LVM_INT32 SDBD=(LVM_INT32)pLVPSA_Inst->SpectralDataBufferDuration;
- LVM_INT32 IRTI=(LVM_INT32)LVPSA_InternalRefreshTimeInv;
+ { /* for avoiding QAC warnings */
+ LVM_INT32 SDBD = (LVM_INT32)pLVPSA_Inst->SpectralDataBufferDuration;
+ LVM_INT32 IRTI = (LVM_INT32)LVPSA_InternalRefreshTimeInv;
LVM_INT32 BL;
- MUL32x32INTO32(SDBD,IRTI,BL,LVPSA_InternalRefreshTimeShift)
+ MUL32x32INTO32(SDBD, IRTI, BL, LVPSA_InternalRefreshTimeShift)
- BufferLength=(LVM_UINT32)BL;
+ BufferLength = (LVM_UINT32)BL;
}
- if((BufferLength * LVPSA_InternalRefreshTime) != pLVPSA_Inst->SpectralDataBufferDuration)
- {
+ if ((BufferLength * LVPSA_InternalRefreshTime) != pLVPSA_Inst->SpectralDataBufferDuration) {
pLVPSA_Inst->SpectralDataBufferLength = BufferLength + 1;
- }
- else
- {
+ } else {
pLVPSA_Inst->SpectralDataBufferLength = BufferLength;
}
/* Assign the pointers */
- pLVPSA_Inst->pPostGains = (LVM_FLOAT *)
- calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pPostGains)));
- if (pLVPSA_Inst->pPostGains == LVM_NULL)
- {
+ pLVPSA_Inst->pPostGains =
+ (LVM_FLOAT*)calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pPostGains)));
+ if (pLVPSA_Inst->pPostGains == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst->pFiltersParams = (LVPSA_FilterParam_t *)
- calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pFiltersParams)));
- if (pLVPSA_Inst->pFiltersParams == LVM_NULL)
- {
+ pLVPSA_Inst->pFiltersParams = (LVPSA_FilterParam_t*)calloc(
+ pInitParams->nBands, sizeof(*(pLVPSA_Inst->pFiltersParams)));
+ if (pLVPSA_Inst->pFiltersParams == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst->pSpectralDataBufferStart = (LVM_UINT8 *)
- calloc(pInitParams->nBands, pLVPSA_Inst->SpectralDataBufferLength * \
- sizeof(*(pLVPSA_Inst->pSpectralDataBufferStart)));
- if (pLVPSA_Inst->pSpectralDataBufferStart == LVM_NULL)
- {
+ pLVPSA_Inst->pSpectralDataBufferStart = (LVM_UINT8*)calloc(
+ pInitParams->nBands, pLVPSA_Inst->SpectralDataBufferLength *
+ sizeof(*(pLVPSA_Inst->pSpectralDataBufferStart)));
+ if (pLVPSA_Inst->pSpectralDataBufferStart == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst->pPreviousPeaks = (LVM_UINT8 *)
- calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pPreviousPeaks)));
- if (pLVPSA_Inst->pPreviousPeaks == LVM_NULL)
- {
+ pLVPSA_Inst->pPreviousPeaks =
+ (LVM_UINT8*)calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pPreviousPeaks)));
+ if (pLVPSA_Inst->pPreviousPeaks == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst->pBPFiltersPrecision = (LVPSA_BPFilterPrecision_en *)
- calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pBPFiltersPrecision)));
- if (pLVPSA_Inst->pBPFiltersPrecision == LVM_NULL)
- {
+ pLVPSA_Inst->pBPFiltersPrecision = (LVPSA_BPFilterPrecision_en*)calloc(
+ pInitParams->nBands, sizeof(*(pLVPSA_Inst->pBPFiltersPrecision)));
+ if (pLVPSA_Inst->pBPFiltersPrecision == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst->pBP_Instances = (Biquad_FLOAT_Instance_t *)
- calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pBP_Instances)));
- if (pLVPSA_Inst->pBP_Instances == LVM_NULL)
- {
+ pLVPSA_Inst->pBP_Instances = (Biquad_FLOAT_Instance_t*)calloc(
+ pInitParams->nBands, sizeof(*(pLVPSA_Inst->pBP_Instances)));
+ if (pLVPSA_Inst->pBP_Instances == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst->pQPD_States = (QPD_FLOAT_State_t *)
- calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pQPD_States)));
- if (pLVPSA_Inst->pQPD_States == LVM_NULL)
- {
+ pLVPSA_Inst->pQPD_States =
+ (QPD_FLOAT_State_t*)calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pQPD_States)));
+ if (pLVPSA_Inst->pQPD_States == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst->pBP_Taps = (Biquad_1I_Order2_FLOAT_Taps_t *)
- calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pBP_Taps)));
- if (pLVPSA_Inst->pBP_Taps == LVM_NULL)
- {
+ pLVPSA_Inst->pBP_Taps = (Biquad_1I_Order2_FLOAT_Taps_t*)calloc(
+ pInitParams->nBands, sizeof(*(pLVPSA_Inst->pBP_Taps)));
+ if (pLVPSA_Inst->pBP_Taps == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
- pLVPSA_Inst->pQPD_Taps = (QPD_FLOAT_Taps_t *)
- calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pQPD_Taps)));
- if (pLVPSA_Inst->pQPD_Taps == LVM_NULL)
- {
+ pLVPSA_Inst->pQPD_Taps =
+ (QPD_FLOAT_Taps_t*)calloc(pInitParams->nBands, sizeof(*(pLVPSA_Inst->pQPD_Taps)));
+ if (pLVPSA_Inst->pQPD_Taps == LVM_NULL) {
return LVPSA_ERROR_NULLADDRESS;
}
/* Copy filters parameters in the private instance */
- for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
- {
+ for (ii = 0; ii < pLVPSA_Inst->nBands; ii++) {
pLVPSA_Inst->pFiltersParams[ii] = pInitParams->pFiltersParams[ii];
}
/* Set Post filters gains*/
- for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
- {
- pLVPSA_Inst->pPostGains[ii] = LVPSA_Float_GainTable[15 + \
- pInitParams->pFiltersParams[ii].PostGain];
+ for (ii = 0; ii < pLVPSA_Inst->nBands; ii++) {
+ pLVPSA_Inst->pPostGains[ii] =
+ LVPSA_Float_GainTable[15 + pInitParams->pFiltersParams[ii].PostGain];
}
pLVPSA_Inst->pSpectralDataBufferWritePointer = pLVPSA_Inst->pSpectralDataBufferStart;
/* Initialize control dependant internal parameters */
- errorCode = LVPSA_Control (*phInstance, pControlParams);
+ errorCode = LVPSA_Control(*phInstance, pControlParams);
- if(errorCode!=0)
- {
+ if (errorCode != 0) {
return errorCode;
}
- errorCode = LVPSA_ApplyNewSettings (pLVPSA_Inst);
+ errorCode = LVPSA_ApplyNewSettings(pLVPSA_Inst);
- if(errorCode!=0)
- {
+ if (errorCode != 0) {
return errorCode;
}
- return(errorCode);
+ return (errorCode);
}
/************************************************************************************/
@@ -188,9 +168,8 @@
/* phInstance Pointer to the instance handle */
/* */
/************************************************************************************/
-void LVPSA_DeInit(pLVPSA_Handle_t *phInstance)
-{
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t *)*phInstance;
+void LVPSA_DeInit(pLVPSA_Handle_t* phInstance) {
+ LVPSA_InstancePr_t* pLVPSA_Inst = (LVPSA_InstancePr_t*)*phInstance;
if (pLVPSA_Inst == LVM_NULL) {
return;
}
@@ -233,4 +212,3 @@
free(pLVPSA_Inst);
*phInstance = 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 fc67a75..e00c11c 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
@@ -27,86 +27,100 @@
CONSTANT DEFINITIONS
***********************************************************************************/
-#define LVPSA_NR_SUPPORTED_RATE 13 /* From 8000Hz to 192000Hz*/
-#define LVPSA_NR_SUPPORTED_SPEED 3 /* LOW, MEDIUM, HIGH */
+#define LVPSA_NR_SUPPORTED_RATE 13 /* From 8000Hz to 192000Hz*/
+#define LVPSA_NR_SUPPORTED_SPEED \
+ 3 /* LOW, MEDIUM, HIGH */
-#define LVPSA_MAXBUFFERDURATION 4000 /* Maximum length in ms of the levels buffer */
-#define LVPSA_MAXINPUTBLOCKSIZE 5000 /* Maximum length in mono samples of the block to process */
-#define LVPSA_NBANDSMIN 1 /* Minimum number of frequency band */
-#define LVPSA_NBANDSMAX 30 /* Maximum number of frequency band */
-#define LVPSA_MAXCENTERFREQ 20000 /* Maximum possible center frequency */
-#define LVPSA_MINPOSTGAIN (-15) /* Minimum possible post gain */
-#define LVPSA_MAXPOSTGAIN 15 /* Maximum possible post gain */
-#define LVPSA_MINQFACTOR 25 /* Minimum possible Q factor */
-#define LVPSA_MAXQFACTOR 1200 /* Maximum possible Q factor */
+#define LVPSA_MAXBUFFERDURATION \
+ 4000 /* Maximum length in ms of the levels buffer */
+#define LVPSA_MAXINPUTBLOCKSIZE \
+ 5000 /* Maximum length in mono samples of the block to process */
+#define LVPSA_NBANDSMIN 1 /* Minimum number of frequency band */
+#define LVPSA_NBANDSMAX 30 /* Maximum number of frequency band */
+#define LVPSA_MAXCENTERFREQ \
+ 20000 /* Maximum possible center frequency */
+#define LVPSA_MINPOSTGAIN \
+ (-15) /* Minimum possible post gain */
+#define LVPSA_MAXPOSTGAIN 15 /* Maximum possible post gain */
+#define LVPSA_MINQFACTOR 25 /* Minimum possible Q factor */
+#define LVPSA_MAXQFACTOR 1200 /* Maximum possible Q factor */
-#define LVPSA_MAXLEVELDECAYFACTOR 0x4111 /* Decay factor for the maximum values calculation */
-#define LVPSA_MAXLEVELDECAYSHIFT 14 /* Decay shift for the maximum values calculation */
+#define LVPSA_MAXLEVELDECAYFACTOR \
+ 0x4111 /* Decay factor for the maximum values calculation */
+#define LVPSA_MAXLEVELDECAYSHIFT \
+ 14 /* Decay shift for the maximum values calculation */
-#define LVPSA_MAXUNSIGNEDCHAR 0xFF
+#define LVPSA_MAXUNSIGNEDCHAR 0xFF
-#define LVPSA_FsInvertShift 31
-#define LVPSA_GAINSHIFT 11
-#define LVPSA_FREQSHIFT 25
+#define LVPSA_FsInvertShift 31
+#define LVPSA_GAINSHIFT 11
+#define LVPSA_FREQSHIFT 25
/**********************************************************************************
TYPES DEFINITIONS
***********************************************************************************/
-#define LVPSA_InternalRefreshTime 0x0014 /* 20 ms (50Hz) in Q16.0 */
-#define LVPSA_InternalRefreshTimeInv 0x0666 /* 1/20ms left shifted by 15 */
-#define LVPSA_InternalRefreshTimeShift 15
+#define LVPSA_InternalRefreshTime 0x0014 /* 20 ms (50Hz) in Q16.0 */
+#define LVPSA_InternalRefreshTimeInv 0x0666 /* 1/20ms left shifted by 15 */
+#define LVPSA_InternalRefreshTimeShift 15
/* Precision of the filter */
-typedef enum
-{
- LVPSA_SimplePrecisionFilter, /* Simple precision */
- LVPSA_DoublePrecisionFilter /* Double precision */
+typedef enum {
+ LVPSA_SimplePrecisionFilter, /* Simple precision */
+ LVPSA_DoublePrecisionFilter /* Double precision */
} LVPSA_BPFilterPrecision_en;
-typedef struct
-{
- LVM_CHAR bControlPending; /* Flag incating a change of the control parameters */
- LVM_UINT16 nBands; /* Number of bands of the spectrum analyzer */
- LVM_UINT16 MaxInputBlockSize; /* Maximum input data buffer size */
+typedef struct {
+ LVM_CHAR bControlPending; /* Flag incating a change of the control parameters */
+ LVM_UINT16 nBands; /* Number of bands of the spectrum analyzer */
+ LVM_UINT16 MaxInputBlockSize; /* Maximum input data buffer size */
- LVPSA_ControlParams_t CurrentParams; /* Current control parameters of the module */
- LVPSA_ControlParams_t NewParams; /* New control parameters given by the user */
- void *pScratch;
+ LVPSA_ControlParams_t CurrentParams; /* Current control parameters of the module */
+ LVPSA_ControlParams_t NewParams; /* New control parameters given by the user */
+ void* pScratch;
/* Pointer to bundle scratch buffer */
- LVPSA_BPFilterPrecision_en *pBPFiltersPrecision; /* Points a nBands elements array that contains the filter precision for each band */
- Biquad_FLOAT_Instance_t *pBP_Instances;
+ LVPSA_BPFilterPrecision_en* pBPFiltersPrecision; /* Points a nBands elements array that contains
+ the filter precision for each band */
+ 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;
+ Biquad_1I_Order2_FLOAT_Taps_t* pBP_Taps;
/* Points a nBands elements array that contains the QPD filter instance for each band */
- QPD_FLOAT_State_t *pQPD_States;
+ 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;
+ QPD_FLOAT_Taps_t* pQPD_Taps;
/* Points a nBands elements array that contains the post-filter gains for each band */
- LVM_FLOAT *pPostGains;
- LVPSA_FilterParam_t *pFiltersParams; /* Copy of the filters parameters from the input parameters */
+ LVM_FLOAT* pPostGains;
+ 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 */
- LVM_UINT16 LocalSamplesCount; /* Counter used to update the SpectralDataBufferAudioTime */
+ 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 relevant filters depending on sampling frequency and
+ bands center frequency */
+ LVM_UINT16 LocalSamplesCount; /* Counter used to update the SpectralDataBufferAudioTime */
- LVM_UINT16 DownSamplingFactor; /* Down sampling factor depending on the sampling frequency */
- LVM_UINT16 DownSamplingCount; /* Counter used for the downsampling handling */
+ LVM_UINT16 DownSamplingFactor; /* Down sampling factor depending on the sampling frequency */
+ LVM_UINT16 DownSamplingCount; /* Counter used for the downsampling handling */
- LVM_UINT16 SpectralDataBufferDuration; /* Length of the buffer in time (ms) defined by the application */
- LVM_UINT8 *pSpectralDataBufferStart; /* Starting address of the buffer */
- LVM_UINT8 *pSpectralDataBufferWritePointer; /* Current position of the writting pointer of the buffer */
- LVPSA_Time SpectralDataBufferAudioTime; /* AudioTime at which the last value save occured in the buffer */
- LVM_UINT32 SpectralDataBufferLength; /* Number of spectrum data value that the buffer can contain (per band)
- = SpectralDataBufferDuration/20ms */
+ LVM_UINT16 SpectralDataBufferDuration; /* Length of the buffer in time (ms) defined by the
+ application */
+ LVM_UINT8* pSpectralDataBufferStart; /* Starting address of the buffer */
+ LVM_UINT8* pSpectralDataBufferWritePointer; /* Current position of the writing pointer of the
+ buffer */
+ LVPSA_Time SpectralDataBufferAudioTime; /* AudioTime at which the last value save occurred in
+ the buffer */
+ LVM_UINT32
+ SpectralDataBufferLength; /* Number of spectrum data value that the buffer can contain
+ (per band) = SpectralDataBufferDuration/20ms */
- LVM_UINT8 *pPreviousPeaks; /* Points to a nBands elements array that contains the previous peak value of the level
- detection. Those values are decremented after each call to the GetSpectrum function */
+ LVM_UINT8* pPreviousPeaks; /* Points to a nBands elements array that contains the previous peak
+ value of the level detection. Those values are decremented after
+ each call to the GetSpectrum function */
-}LVPSA_InstancePr_t, *pLVPSA_InstancePr_t;
+} LVPSA_InstancePr_t, *pLVPSA_InstancePr_t;
/**********************************************************************************
FUNCTIONS PROTOTYPE
@@ -126,6 +140,6 @@
/* LVPSA_OK Always succeeds */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_ApplyNewSettings (LVPSA_InstancePr_t *pInst);
+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 b4d111e..299dfd2 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Process.cpp
@@ -15,23 +15,23 @@
* limitations under the License.
*/
-#include "LVPSA.h"
-#include "LVPSA_Private.h"
-#include "LVM_Macros.h"
-#include "VectorArithmetic.h"
+#include "LVPSA.h"
+#include "LVPSA_Private.h"
+#include "LVM_Macros.h"
+#include "VectorArithmetic.h"
-#define LVM_MININT_32 0x80000000
+#define LVM_MININT_32 0x80000000
static LVM_INT32 mult32x32in32_shiftr(LVM_INT32 a, LVM_INT32 b, LVM_INT32 c) {
- LVM_INT64 result = ((LVM_INT64)a * b) >> c;
+ LVM_INT64 result = ((LVM_INT64)a * b) >> c;
- if (result >= INT32_MAX) {
- return INT32_MAX;
- } else if (result <= INT32_MIN) {
- return INT32_MIN;
- } else {
- return (LVM_INT32)result;
- }
+ if (result >= INT32_MAX) {
+ return INT32_MAX;
+ } else if (result <= INT32_MIN) {
+ return INT32_MIN;
+ } else {
+ return (LVM_INT32)result;
+ }
}
/************************************************************************************/
@@ -54,30 +54,26 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_Process ( pLVPSA_Handle_t hInstance,
- LVM_FLOAT *pLVPSA_InputSamples,
- LVM_UINT16 InputBlockSize,
- LVPSA_Time AudioTime )
+LVPSA_RETURN LVPSA_Process(pLVPSA_Handle_t hInstance, LVM_FLOAT* pLVPSA_InputSamples,
+ LVM_UINT16 InputBlockSize, LVPSA_Time AudioTime)
{
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- LVM_FLOAT *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 */
+ LVPSA_InstancePr_t* pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+ LVM_FLOAT* 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 (hInstance == LVM_NULL || pLVPSA_InputSamples == LVM_NULL) {
+ return (LVPSA_ERROR_NULLADDRESS);
}
- if(InputBlockSize == 0 || InputBlockSize > pLVPSA_Inst->MaxInputBlockSize)
- {
- return(LVPSA_ERROR_INVALIDPARAM);
+ if (InputBlockSize == 0 || InputBlockSize > pLVPSA_Inst->MaxInputBlockSize) {
+ return (LVPSA_ERROR_INVALIDPARAM);
}
pScratch = (LVM_FLOAT*)pLVPSA_Inst->pScratch;
pWrite_Save = pLVPSA_Inst->pSpectralDataBufferWritePointer;
@@ -85,10 +81,9 @@
/******************************************************************************
APPLY NEW SETTINGS IF NEEDED
*******************************************************************************/
- if (pLVPSA_Inst->bControlPending == LVM_TRUE)
- {
+ if (pLVPSA_Inst->bControlPending == LVM_TRUE) {
pLVPSA_Inst->bControlPending = 0;
- LVPSA_ApplyNewSettings( pLVPSA_Inst);
+ LVPSA_ApplyNewSettings(pLVPSA_Inst);
}
/******************************************************************************
@@ -98,39 +93,30 @@
Copy_Float(pLVPSA_InputSamples, pScratch, (LVM_INT16)InputBlockSize);
Shift_Sat_Float(-1, pScratch, pScratch, (LVM_INT16)InputBlockSize);
- for (ii = 0; ii < pLVPSA_Inst->nRelevantFilters; ii++)
- {
- switch(pLVPSA_Inst->pBPFiltersPrecision[ii])
- {
+ 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);
+ 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);
+ BP_1I_D16F32C30_TRC_WRA_01(&pLVPSA_Inst->pBP_Instances[ii], pScratch,
+ pScratch + InputBlockSize, (LVM_INT16)InputBlockSize);
break;
default:
break;
}
- LVPSA_QPD_Process_Float ( pLVPSA_Inst,
- pScratch + InputBlockSize,
- (LVM_INT16)InputBlockSize,
- ii);
+ LVPSA_QPD_Process_Float(pLVPSA_Inst, pScratch + InputBlockSize, (LVM_INT16)InputBlockSize,
+ ii);
}
/******************************************************************************
UPDATE SpectralDataBufferAudioTime
*******************************************************************************/
- if(pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite_Save)
- {
+ if (pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite_Save) {
AudioTimeInc = mult32x32in32_shiftr(
(AudioTime + ((LVM_INT32)pLVPSA_Inst->LocalSamplesCount * 1000)),
(LVM_INT32)LVPSA_SampleRateInvTab[pLVPSA_Inst->CurrentParams.Fs],
@@ -138,7 +124,7 @@
pLVPSA_Inst->SpectralDataBufferAudioTime = AudioTime + AudioTimeInc;
}
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/************************************************************************************/
@@ -161,99 +147,95 @@
/* otherwise Error due to bad parameters */
/* */
/************************************************************************************/
-LVPSA_RETURN LVPSA_GetSpectrum ( pLVPSA_Handle_t hInstance,
- LVPSA_Time GetSpectrumAudioTime,
- LVM_UINT8 *pCurrentValues,
- LVM_UINT8 *pPeakValues )
+LVPSA_RETURN LVPSA_GetSpectrum(pLVPSA_Handle_t hInstance, LVPSA_Time GetSpectrumAudioTime,
+ LVM_UINT8* pCurrentValues, LVM_UINT8* pPeakValues)
{
+ LVPSA_InstancePr_t* pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+ LVM_INT32 StatusDelta, ii;
+ LVM_UINT8* pRead;
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- LVM_INT32 StatusDelta, ii;
- LVM_UINT8 *pRead;
-
- if(hInstance == LVM_NULL || pCurrentValues == LVM_NULL || pPeakValues == LVM_NULL)
- {
- return(LVPSA_ERROR_NULLADDRESS);
+ if (hInstance == LVM_NULL || pCurrentValues == LVM_NULL || pPeakValues == LVM_NULL) {
+ return (LVPSA_ERROR_NULLADDRESS);
}
/* First find the place where to look in the status buffer */
- if(GetSpectrumAudioTime <= pLVPSA_Inst->SpectralDataBufferAudioTime)
- {
- MUL32x32INTO32((pLVPSA_Inst->SpectralDataBufferAudioTime - GetSpectrumAudioTime),LVPSA_InternalRefreshTimeInv,StatusDelta,LVPSA_InternalRefreshTimeShift);
- if((StatusDelta * LVPSA_InternalRefreshTime) != (pLVPSA_Inst->SpectralDataBufferAudioTime - GetSpectrumAudioTime))
- {
+ if (GetSpectrumAudioTime <= pLVPSA_Inst->SpectralDataBufferAudioTime) {
+ MUL32x32INTO32((pLVPSA_Inst->SpectralDataBufferAudioTime - GetSpectrumAudioTime),
+ LVPSA_InternalRefreshTimeInv, StatusDelta, LVPSA_InternalRefreshTimeShift);
+ if ((StatusDelta * LVPSA_InternalRefreshTime) !=
+ (pLVPSA_Inst->SpectralDataBufferAudioTime - GetSpectrumAudioTime)) {
StatusDelta += 1;
}
- }
- else
- {
+ } else {
/* This part handles the wrap around */
- MUL32x32INTO32(((pLVPSA_Inst->SpectralDataBufferAudioTime - (LVM_INT32)LVM_MININT_32) + ((LVM_INT32)LVM_MAXINT_32 - GetSpectrumAudioTime)),LVPSA_InternalRefreshTimeInv,StatusDelta,LVPSA_InternalRefreshTimeShift)
- if(((LVM_INT32)(StatusDelta * LVPSA_InternalRefreshTime)) != ((LVM_INT32)((pLVPSA_Inst->SpectralDataBufferAudioTime - (LVM_INT32)LVM_MININT_32) + ((LVM_INT32)LVM_MAXINT_32 - GetSpectrumAudioTime))))
- {
+ MUL32x32INTO32(
+ ((pLVPSA_Inst->SpectralDataBufferAudioTime - (LVM_INT32)LVM_MININT_32) +
+ ((LVM_INT32)LVM_MAXINT_32 - GetSpectrumAudioTime)),
+ LVPSA_InternalRefreshTimeInv, StatusDelta,
+ LVPSA_InternalRefreshTimeShift) if (((LVM_INT32)(StatusDelta *
+ LVPSA_InternalRefreshTime)) !=
+ ((LVM_INT32)(
+ (pLVPSA_Inst
+ ->SpectralDataBufferAudioTime -
+ (LVM_INT32)LVM_MININT_32) +
+ ((LVM_INT32)LVM_MAXINT_32 -
+ GetSpectrumAudioTime)))) {
StatusDelta += 1;
}
}
/* Check whether the desired level is not too "old" (see 2.10 in LVPSA_DesignNotes.doc)*/
- if(
- ((GetSpectrumAudioTime < pLVPSA_Inst->SpectralDataBufferAudioTime)&&
- ((GetSpectrumAudioTime<0)&&(pLVPSA_Inst->SpectralDataBufferAudioTime>0))&&
- (((LVM_INT32)(-GetSpectrumAudioTime + pLVPSA_Inst->SpectralDataBufferAudioTime))>LVM_MAXINT_32))||
+ if (((GetSpectrumAudioTime < pLVPSA_Inst->SpectralDataBufferAudioTime) &&
+ ((GetSpectrumAudioTime < 0) && (pLVPSA_Inst->SpectralDataBufferAudioTime > 0)) &&
+ (((LVM_INT32)(-GetSpectrumAudioTime + pLVPSA_Inst->SpectralDataBufferAudioTime)) >
+ LVM_MAXINT_32)) ||
- ((GetSpectrumAudioTime > pLVPSA_Inst->SpectralDataBufferAudioTime)&&
- (((GetSpectrumAudioTime>=0)&&(pLVPSA_Inst->SpectralDataBufferAudioTime>=0))||
- ((GetSpectrumAudioTime<=0)&&(pLVPSA_Inst->SpectralDataBufferAudioTime<=0))||
- (((GetSpectrumAudioTime>=0)&&(pLVPSA_Inst->SpectralDataBufferAudioTime<=0))&&
- (((LVM_INT32)(GetSpectrumAudioTime - pLVPSA_Inst->SpectralDataBufferAudioTime))<LVM_MAXINT_32))))||
+ ((GetSpectrumAudioTime > pLVPSA_Inst->SpectralDataBufferAudioTime) &&
+ (((GetSpectrumAudioTime >= 0) && (pLVPSA_Inst->SpectralDataBufferAudioTime >= 0)) ||
+ ((GetSpectrumAudioTime <= 0) && (pLVPSA_Inst->SpectralDataBufferAudioTime <= 0)) ||
+ (((GetSpectrumAudioTime >= 0) && (pLVPSA_Inst->SpectralDataBufferAudioTime <= 0)) &&
+ (((LVM_INT32)(GetSpectrumAudioTime - pLVPSA_Inst->SpectralDataBufferAudioTime)) <
+ LVM_MAXINT_32)))) ||
- (StatusDelta > (LVM_INT32)pLVPSA_Inst->SpectralDataBufferLength) ||
- (!StatusDelta))
- {
- for(ii = 0; ii < pLVPSA_Inst->nBands; ii++)
- {
- pCurrentValues[ii] = 0;
- pPeakValues[ii] = 0;
+ (StatusDelta > (LVM_INT32)pLVPSA_Inst->SpectralDataBufferLength) || (!StatusDelta)) {
+ for (ii = 0; ii < pLVPSA_Inst->nBands; ii++) {
+ pCurrentValues[ii] = 0;
+ pPeakValues[ii] = 0;
}
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
/* Set the reading pointer */
- if((LVM_INT32)(StatusDelta * pLVPSA_Inst->nBands) > (pLVPSA_Inst->pSpectralDataBufferWritePointer - pLVPSA_Inst->pSpectralDataBufferStart))
- {
- pRead = pLVPSA_Inst->pSpectralDataBufferWritePointer + (pLVPSA_Inst->SpectralDataBufferLength - (LVM_UINT32)StatusDelta) * pLVPSA_Inst->nBands;
- }
- else
- {
- pRead = pLVPSA_Inst->pSpectralDataBufferWritePointer - StatusDelta * pLVPSA_Inst->nBands;
+ if ((LVM_INT32)(StatusDelta * pLVPSA_Inst->nBands) >
+ (pLVPSA_Inst->pSpectralDataBufferWritePointer - pLVPSA_Inst->pSpectralDataBufferStart)) {
+ pRead = pLVPSA_Inst->pSpectralDataBufferWritePointer +
+ (pLVPSA_Inst->SpectralDataBufferLength - (LVM_UINT32)StatusDelta) *
+ pLVPSA_Inst->nBands;
+ } else {
+ 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++)
- {
+ for (ii = 0; ii < pLVPSA_Inst->nBands; ii++) {
pCurrentValues[ii] = pRead[ii];
- if(pLVPSA_Inst->pPreviousPeaks[ii] <= pRead[ii])
- {
+ if (pLVPSA_Inst->pPreviousPeaks[ii] <= pRead[ii]) {
pLVPSA_Inst->pPreviousPeaks[ii] = pRead[ii];
- }
- else if(pLVPSA_Inst->pPreviousPeaks[ii] != 0)
- {
+ } else if (pLVPSA_Inst->pPreviousPeaks[ii] != 0) {
LVM_INT32 temp;
/*Re-compute max values for decay */
temp = (LVM_INT32)(LVPSA_MAXUNSIGNEDCHAR - pLVPSA_Inst->pPreviousPeaks[ii]);
- temp = ((temp * LVPSA_MAXLEVELDECAYFACTOR)>>LVPSA_MAXLEVELDECAYSHIFT);
+ temp = ((temp * LVPSA_MAXLEVELDECAYFACTOR) >> LVPSA_MAXLEVELDECAYSHIFT);
/* If the gain has no effect, "help" the value to increase */
- if(temp == (LVPSA_MAXUNSIGNEDCHAR - pLVPSA_Inst->pPreviousPeaks[ii]))
- {
+ if (temp == (LVPSA_MAXUNSIGNEDCHAR - pLVPSA_Inst->pPreviousPeaks[ii])) {
temp += 1;
}
/* Saturate */
temp = (temp > LVPSA_MAXUNSIGNEDCHAR) ? LVPSA_MAXUNSIGNEDCHAR : temp;
/* Store new max level */
- pLVPSA_Inst->pPreviousPeaks[ii] = (LVM_UINT8)(LVPSA_MAXUNSIGNEDCHAR - temp);
+ pLVPSA_Inst->pPreviousPeaks[ii] = (LVM_UINT8)(LVPSA_MAXUNSIGNEDCHAR - temp);
}
pPeakValues[ii] = pLVPSA_Inst->pPreviousPeaks[ii];
}
- return(LVPSA_OK);
+ return (LVPSA_OK);
}
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
index 609a485..2f752bf 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD.h
@@ -20,41 +20,35 @@
#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;
+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;
-typedef struct
-{
+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;
+ LVM_FLOAT* pDelay;
+ LVM_FLOAT Coefs[2]; /* pointer to the filter coefficients */
+} QPD_FLOAT_State_t, *pQPD_FLOAT_State_t;
-typedef struct
-{
- LVM_INT32 KP; /*should store a0*/
- LVM_INT32 KM; /*should store b2*/
+typedef struct {
+ LVM_INT32 KP; /*should store a0*/
+ LVM_INT32 KM; /*should store b2*/
} QPD_C32_Coefs, *PQPD_C32_Coefs;
-typedef struct
-{
- LVM_FLOAT KP; /*should store a0*/
- LVM_FLOAT KM; /*should store b2*/
+typedef struct {
+ LVM_FLOAT KP; /*should store a0*/
+ LVM_FLOAT KM; /*should store b2*/
} QPD_FLOAT_Coefs, *PQPD_FLOAT_Coefs;
-typedef struct
-{
+typedef struct {
LVM_INT32 Storage[1];
} QPD_Taps_t, *pQPD_Taps_t;
-typedef struct
-{
+typedef struct {
LVM_FLOAT Storage[1];
} QPD_FLOAT_Taps_t, *pQPD_FLOAT_Taps_t;
@@ -72,15 +66,11 @@
/* RETURNS: void */
/* */
/************************************************************************************/
-void LVPSA_QPD_Process ( void *hInstance,
- LVM_INT16 *pInSamps,
- LVM_INT16 numSamples,
- LVM_INT16 BandIndex);
+void LVPSA_QPD_Process(void* hInstance, LVM_INT16* pInSamps, LVM_INT16 numSamples,
+ LVM_INT16 BandIndex);
-void LVPSA_QPD_Process_Float ( void *hInstance,
- LVM_FLOAT *pInSamps,
- LVM_INT16 numSamples,
- LVM_INT16 BandIndex);
+void LVPSA_QPD_Process_Float(void* hInstance, LVM_FLOAT* pInSamps, LVM_INT16 numSamples,
+ LVM_INT16 BandIndex);
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Init */
@@ -96,13 +86,9 @@
/* RETURNS: void */
/* */
/************************************************************************************/
-void LVPSA_QPD_Init ( QPD_State_t *pInstance,
- QPD_Taps_t *pTaps,
- QPD_C32_Coefs *pCoef );
+void LVPSA_QPD_Init(QPD_State_t* pInstance, QPD_Taps_t* pTaps, QPD_C32_Coefs* pCoef);
-void LVPSA_QPD_Init_Float ( QPD_FLOAT_State_t *pInstance,
- QPD_FLOAT_Taps_t *pTaps,
- QPD_FLOAT_Coefs *pCoef );
+void LVPSA_QPD_Init_Float(QPD_FLOAT_State_t* pInstance, QPD_FLOAT_Taps_t* pTaps,
+ QPD_FLOAT_Coefs* pCoef);
#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 2dbf694..c5023c3 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Init.cpp
@@ -32,20 +32,15 @@
/* RETURNS: void */
/* */
/************************************************************************************/
-void LVPSA_QPD_Init ( pQPD_State_t pQPD_State,
- QPD_Taps_t *pTaps,
- QPD_C32_Coefs *pCoef )
-{
- pQPD_State->pDelay = pTaps->Storage;
- pQPD_State->Coefs[0] = pCoef->KP;
- pQPD_State->Coefs[1] = pCoef->KM;
+void LVPSA_QPD_Init(pQPD_State_t pQPD_State, QPD_Taps_t* pTaps, QPD_C32_Coefs* pCoef) {
+ pQPD_State->pDelay = pTaps->Storage;
+ pQPD_State->Coefs[0] = pCoef->KP;
+ pQPD_State->Coefs[1] = pCoef->KM;
}
-void LVPSA_QPD_Init_Float ( pQPD_FLOAT_State_t pQPD_State,
- QPD_FLOAT_Taps_t *pTaps,
- QPD_FLOAT_Coefs *pCoef )
-{
- pQPD_State->pDelay = pTaps->Storage;
- pQPD_State->Coefs[0] = ((LVM_FLOAT)pCoef->KP);
- pQPD_State->Coefs[1] = ((LVM_FLOAT)pCoef->KM);
+void LVPSA_QPD_Init_Float(pQPD_FLOAT_State_t pQPD_State, QPD_FLOAT_Taps_t* pTaps,
+ QPD_FLOAT_Coefs* pCoef) {
+ pQPD_State->pDelay = pTaps->Storage;
+ pQPD_State->Coefs[0] = ((LVM_FLOAT)pCoef->KP);
+ pQPD_State->Coefs[1] = ((LVM_FLOAT)pCoef->KM);
}
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 8805420..e301cf9 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_QPD_Process.cpp
@@ -34,15 +34,11 @@
/* RETURNS: void */
/* */
/************************************************************************************/
-void LVPSA_QPD_WritePeak( pLVPSA_InstancePr_t pLVPSA_Inst,
- LVM_UINT8 **ppWrite,
- LVM_INT16 BandIndex,
- LVM_INT16 Value );
+void LVPSA_QPD_WritePeak(pLVPSA_InstancePr_t pLVPSA_Inst, LVM_UINT8** ppWrite, LVM_INT16 BandIndex,
+ LVM_INT16 Value);
-void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
- LVM_UINT8 **ppWrite,
- LVM_INT16 BandIndex,
- LVM_FLOAT Value );
+void LVPSA_QPD_WritePeak_Float(pLVPSA_InstancePr_t pLVPSA_Inst, LVM_UINT8** ppWrite,
+ LVM_INT16 BandIndex, LVM_FLOAT Value);
/************************************************************************************/
/* */
/* FUNCTION: LVPSA_QPD_Process */
@@ -56,38 +52,34 @@
/* RETURNS: void */
/* */
/************************************************************************************/
-void LVPSA_QPD_Process_Float ( void *hInstance,
- LVM_FLOAT *pInSamps,
- LVM_INT16 numSamples,
- LVM_INT16 BandIndex)
-{
-
+void LVPSA_QPD_Process_Float(void* hInstance, LVM_FLOAT* pInSamps, LVM_INT16 numSamples,
+ LVM_INT16 BandIndex) {
/******************************************************************************
PARAMETERS
*******************************************************************************/
- LVPSA_InstancePr_t *pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
- QPD_FLOAT_State_t *pQPDState = (QPD_FLOAT_State_t*)&pLVPSA_Inst->pQPD_States[BandIndex];
+ LVPSA_InstancePr_t* pLVPSA_Inst = (LVPSA_InstancePr_t*)hInstance;
+ QPD_FLOAT_State_t* pQPDState = (QPD_FLOAT_State_t*)&pLVPSA_Inst->pQPD_States[BandIndex];
/* Pointer to taps */
- LVM_FLOAT* pDelay = pQPDState->pDelay;
+ LVM_FLOAT* pDelay = pQPDState->pDelay;
/* Parameters needed during quasi peak calculations */
- LVM_FLOAT X0;
- LVM_FLOAT temp,temp2;
- LVM_FLOAT accu;
- LVM_FLOAT Xg0;
- LVM_FLOAT D0;
- LVM_FLOAT V0 = (LVM_FLOAT)(*pDelay);
+ LVM_FLOAT X0;
+ LVM_FLOAT temp, temp2;
+ LVM_FLOAT accu;
+ LVM_FLOAT Xg0;
+ LVM_FLOAT D0;
+ LVM_FLOAT V0 = (LVM_FLOAT)(*pDelay);
/* Filter's coef */
- LVM_FLOAT Kp = ((LVM_FLOAT)(pQPDState->Coefs[0]));
- LVM_FLOAT Km = ((LVM_FLOAT)(pQPDState->Coefs[1]));
+ LVM_FLOAT Kp = ((LVM_FLOAT)(pQPDState->Coefs[0]));
+ LVM_FLOAT Km = ((LVM_FLOAT)(pQPDState->Coefs[1]));
- LVM_INT16 ii = numSamples;
+ LVM_INT16 ii = numSamples;
- LVM_UINT8 *pWrite = pLVPSA_Inst->pSpectralDataBufferWritePointer;
- LVM_INT32 BufferUpdateSamplesCount = pLVPSA_Inst->BufferUpdateSamplesCount;
- LVM_UINT16 DownSamplingFactor = pLVPSA_Inst->DownSamplingFactor;
+ LVM_UINT8* pWrite = pLVPSA_Inst->pSpectralDataBufferWritePointer;
+ LVM_INT32 BufferUpdateSamplesCount = pLVPSA_Inst->BufferUpdateSamplesCount;
+ LVM_UINT16 DownSamplingFactor = pLVPSA_Inst->DownSamplingFactor;
/******************************************************************************
INITIALIZATION
@@ -97,29 +89,27 @@
/* Correct also the number of samples */
ii = (LVM_INT16)(ii - (LVM_INT16)pLVPSA_Inst->DownSamplingCount);
- while (ii > 0)
- {
+ while (ii > 0) {
/* Apply post gain */
/* - 1 to compensate scaling in process function*/
X0 = (*pInSamps) * pLVPSA_Inst->pPostGains[BandIndex];
pInSamps = pInSamps + DownSamplingFactor;
/* Saturate and take absolute value */
- if(X0 < 0.0f)
- X0 = -X0;
+ if (X0 < 0.0f) X0 = -X0;
if (X0 > 1.0f)
Xg0 = 1.0f;
else
- Xg0 =X0;
+ Xg0 = X0;
/* Quasi peak filter calculation */
- D0 = Xg0 - V0;
+ D0 = Xg0 - V0;
temp2 = D0;
accu = temp2 * Kp;
- D0 = D0 / 2.0f;
- if (D0 < 0.0f){
+ D0 = D0 / 2.0f;
+ if (D0 < 0.0f) {
D0 = -D0;
}
@@ -130,17 +120,13 @@
if (accu > 1.0f)
accu = 1.0f;
- else if(accu < 0.0f)
+ else if (accu < 0.0f)
accu = 0.0f;
V0 = accu;
- if(((pLVPSA_Inst->nSamplesBufferUpdate - BufferUpdateSamplesCount) < DownSamplingFactor))
- {
- LVPSA_QPD_WritePeak_Float( pLVPSA_Inst,
- &pWrite,
- BandIndex,
- V0);
+ if (((pLVPSA_Inst->nSamplesBufferUpdate - BufferUpdateSamplesCount) < DownSamplingFactor)) {
+ LVPSA_QPD_WritePeak_Float(pLVPSA_Inst, &pWrite, BandIndex, V0);
BufferUpdateSamplesCount -= pLVPSA_Inst->nSamplesBufferUpdate;
pLVPSA_Inst->LocalSamplesCount = (LVM_UINT16)(numSamples - ii);
@@ -148,7 +134,6 @@
BufferUpdateSamplesCount += DownSamplingFactor;
ii = (LVM_INT16)(ii - DownSamplingFactor);
-
}
/* Store last taps in memory */
@@ -156,20 +141,15 @@
/* If this is the last call to the function after last band processing,
update the parameters. */
- if(BandIndex == (pLVPSA_Inst->nRelevantFilters - 1))
- {
+ 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)
- {
+ if ((pLVPSA_Inst->pSpectralDataBufferWritePointer != pWrite) &&
+ (pLVPSA_Inst->CurrentParams.Fs == LVM_FS_11025)) {
+ if (pLVPSA_Inst->nSamplesBufferUpdate == 220) {
pLVPSA_Inst->nSamplesBufferUpdate = 221;
- }
- else
- {
+ } else {
pLVPSA_Inst->nSamplesBufferUpdate = 220;
}
}
@@ -194,37 +174,29 @@
/* RETURNS: void */
/* */
/************************************************************************************/
-void LVPSA_QPD_WritePeak( pLVPSA_InstancePr_t pLVPSA_Inst,
- LVM_UINT8 **ppWrite,
- LVM_INT16 BandIndex,
- LVM_INT16 Value )
-{
- LVM_UINT8 *pWrite = *ppWrite;
+void LVPSA_QPD_WritePeak(pLVPSA_InstancePr_t pLVPSA_Inst, LVM_UINT8** ppWrite, LVM_INT16 BandIndex,
+ LVM_INT16 Value) {
+ LVM_UINT8* pWrite = *ppWrite;
/* Write the value and update the write pointer */
- *(pWrite + BandIndex) = (LVM_UINT8)(Value>>7);
+ *(pWrite + BandIndex) = (LVM_UINT8)(Value >> 7);
pWrite += pLVPSA_Inst->nBands;
- if (pWrite == (pLVPSA_Inst->pSpectralDataBufferStart + pLVPSA_Inst->nBands * pLVPSA_Inst->SpectralDataBufferLength))
- {
+ if (pWrite == (pLVPSA_Inst->pSpectralDataBufferStart +
+ pLVPSA_Inst->nBands * pLVPSA_Inst->SpectralDataBufferLength)) {
pWrite = pLVPSA_Inst->pSpectralDataBufferStart;
}
*ppWrite = pWrite;
-
}
-void LVPSA_QPD_WritePeak_Float( pLVPSA_InstancePr_t pLVPSA_Inst,
- LVM_UINT8 **ppWrite,
- LVM_INT16 BandIndex,
- LVM_FLOAT Value )
-{
- LVM_UINT8 *pWrite = *ppWrite;
+void LVPSA_QPD_WritePeak_Float(pLVPSA_InstancePr_t pLVPSA_Inst, LVM_UINT8** ppWrite,
+ LVM_INT16 BandIndex, LVM_FLOAT Value) {
+ LVM_UINT8* pWrite = *ppWrite;
/* Write the value and update the write pointer */
*(pWrite + BandIndex) = (LVM_UINT8)(Value * 256);
pWrite += pLVPSA_Inst->nBands;
- if (pWrite == (pLVPSA_Inst->pSpectralDataBufferStart + pLVPSA_Inst->nBands * \
- pLVPSA_Inst->SpectralDataBufferLength))
- {
+ if (pWrite == (pLVPSA_Inst->pSpectralDataBufferStart +
+ pLVPSA_Inst->nBands * pLVPSA_Inst->SpectralDataBufferLength)) {
pWrite = pLVPSA_Inst->pSpectralDataBufferStart;
}
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
index 9f0aa02..4fbff6f 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.cpp
@@ -34,19 +34,9 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-const LVM_UINT32 LVPSA_SampleRateTab[] = { 8000, /* 8kS/s */
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000,
- 88200,
- 96000,
- 176400,
- 192000}; /* 192kS/s */
+const LVM_UINT32 LVPSA_SampleRateTab[] = {8000, /* 8kS/s */
+ 11025, 12000, 16000, 22050, 24000, 32000,
+ 44100, 48000, 88200, 96000, 176400, 192000}; /* 192kS/s */
/************************************************************************************/
/* */
@@ -58,20 +48,11 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-const LVM_UINT32 LVPSA_SampleRateInvTab[] = { 268435, /* 8kS/s */
- 194783,
- 178957,
- 134218,
- 97391,
- 89478,
- 67109,
- 48696,
- 44739
- ,24348
- ,22369
- ,12174
- ,11185 /* 192kS/s */
- };
+const LVM_UINT32 LVPSA_SampleRateInvTab[] = {
+ 268435, /* 8kS/s */
+ 194783, 178957, 134218, 97391, 89478, 67109,
+ 48696, 44739, 24348, 22369, 12174, 11185 /* 192kS/s */
+};
/************************************************************************************/
/* */
@@ -83,20 +64,10 @@
* Table for converting between the enumerated type and the number of samples
* during 20ms
*/
-const LVM_UINT16 LVPSA_nSamplesBufferUpdate[] = { 160, /* 8kS/s */
- 220,
- 240,
- 320,
- 441,
- 480,
- 640,
- 882,
- 960
- ,1764
- ,1920
- ,3528
- ,3840 /* 192kS/s */
- };
+const LVM_UINT16 LVPSA_nSamplesBufferUpdate[] = {
+ 160, /* 8kS/s */
+ 220, 240, 320, 441, 480, 640, 882, 960, 1764, 1920, 3528, 3840 /* 192kS/s */
+};
/************************************************************************************/
/* */
/* Down sampling factors */
@@ -106,20 +77,25 @@
/*
* Table for converting between the enumerated type and the down sampling factor
*/
-const LVM_UINT16 LVPSA_DownSamplingFactor[] = { 5, /* 8000 S/s */
- 7, /* 11025 S/s */
- 8, /* 12000 S/s */
- 10, /* 16000 S/s */
- 15, /* 22050 S/s */
- 16, /* 24000 S/s */
- 21, /* 32000 S/s */
- 30, /* 44100 S/s */
- 32 /* 48000 S/s */
- ,60 /* 88200 S/s */
- ,64 /* 96000 S/s */
- ,120 /* 176400 S/s */
- ,128 /*192000 S/s */
- };
+const LVM_UINT16 LVPSA_DownSamplingFactor[] = {
+ 5, /* 8000 S/s */
+ 7, /* 11025 S/s */
+ 8, /* 12000 S/s */
+ 10, /* 16000 S/s */
+ 15, /* 22050 S/s */
+ 16, /* 24000 S/s */
+ 21, /* 32000 S/s */
+ 30, /* 44100 S/s */
+ 32 /* 48000 S/s */
+ ,
+ 60 /* 88200 S/s */
+ ,
+ 64 /* 96000 S/s */
+ ,
+ 120 /* 176400 S/s */
+ ,
+ 128 /*192000 S/s */
+};
/************************************************************************************/
/* */
@@ -130,102 +106,34 @@
/*
* Table for 2 * Pi / Fs
*/
-const LVM_INT16 LVPSA_TwoPiOnFsTable[] = { 26354, /* 8kS/s */
- 19123,
- 17569,
- 13177,
- 9561,
- 8785,
- 6588,
- 4781,
- 4392
- ,2390
- ,2196
- ,1195
- ,1098 /* 192kS/s */
- };
+const LVM_INT16 LVPSA_TwoPiOnFsTable[] = {
+ 26354, /* 8kS/s */
+ 19123, 17569, 13177, 9561, 8785, 6588, 4781, 4392, 2390, 2196, 1195, 1098 /* 192kS/s */
+};
-const LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[] = { 0.8042847f, /* 8kS/s */
- 0.5836054f,
- 0.5361796f,
- 0.4021423f,
- 0.2917874f,
- 0.2681051f,
- 0.2010559f,
- 0.1459089f,
- 0.1340372f
- ,0.0729476f
- ,0.0670186f
- ,0.0364738f
- ,0.0335093f /* 192kS/s */
- };
+const LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[] = {
+ 0.8042847f, /* 8kS/s */
+ 0.5836054f, 0.5361796f, 0.4021423f, 0.2917874f, 0.2681051f, 0.2010559f,
+ 0.1459089f, 0.1340372f, 0.0729476f, 0.0670186f, 0.0364738f, 0.0335093f /* 192kS/s */
+};
/*
* Gain table
*/
-const LVM_INT16 LVPSA_GainTable[] = { 364, /* -15dB gain */
- 408,
- 458,
- 514,
- 577,
- 647,
- 726,
- 815,
- 914,
- 1026,
- 1151,
- 1292,
- 1449,
- 1626,
- 1825,
- 2048, /* 0dB gain */
- 2297,
- 2578,
- 2892,
- 3245,
- 3641,
- 4096,
- 4584,
- 5144,
- 5772,
- 6476,
- 7266,
- 8153,
- 9148,
- 10264,
- 11576}; /* +15dB gain */
+const LVM_INT16 LVPSA_GainTable[] = {364, /* -15dB gain */
+ 408, 458, 514, 577, 647, 726, 815, 914,
+ 1026, 1151, 1292, 1449, 1626, 1825, 2048, /* 0dB gain */
+ 2297, 2578, 2892, 3245, 3641, 4096, 4584, 5144,
+ 5772, 6476, 7266, 8153, 9148, 10264, 11576}; /* +15dB gain */
-const LVM_FLOAT LVPSA_Float_GainTable[]={ 0.177734375f, /* -15dB gain */
- 0.199218750f,
- 0.223632812f,
- 0.250976562f,
- 0.281738281f,
- 0.315917968f,
- 0.354492187f,
- 0.397949218f,
- 0.446289062f,
- 0.500976562f,
- 0.562011718f,
- 0.630859375f,
- 0.707519531f,
- 0.793945312f,
- 0.891113281f,
- 1.000000000f, /* 0dB gain */
- 1.121582031f,
- 1.258789062f,
- 1.412109375f,
- 1.584472656f,
- 1.777832031f,
- 2.000000000f,
- 2.238281250f,
- 2.511718750f,
- 2.818359375f,
- 3.162109375f,
- 3.547851562f,
- 3.980957031f,
- 4.466796875f,
- 5.011718750f,
- 5.652343750f}; /* +15dB gain */
+const LVM_FLOAT LVPSA_Float_GainTable[] = {
+ 0.177734375f, /* -15dB gain */
+ 0.199218750f, 0.223632812f, 0.250976562f, 0.281738281f, 0.315917968f,
+ 0.354492187f, 0.397949218f, 0.446289062f, 0.500976562f, 0.562011718f,
+ 0.630859375f, 0.707519531f, 0.793945312f, 0.891113281f, 1.000000000f, /* 0dB gain */
+ 1.121582031f, 1.258789062f, 1.412109375f, 1.584472656f, 1.777832031f,
+ 2.000000000f, 2.238281250f, 2.511718750f, 2.818359375f, 3.162109375f,
+ 3.547851562f, 3.980957031f, 4.466796875f, 5.011718750f, 5.652343750f}; /* +15dB gain */
/************************************************************************************/
/* */
/* Cosone polynomial coefficients */
@@ -241,20 +149,20 @@
* a range of 0 to Pi. The output is in the range 32767 to -32768 representing the range
* +1.0 to -1.0
*/
-const LVM_INT16 LVPSA_CosCoef[] = { 3, /* Shifts */
- 4096, /* a0 */
- -36, /* a1 */
- -19725, /* a2 */
- -2671, /* a3 */
- 23730, /* a4 */
- -9490}; /* a5 */
-const LVM_FLOAT LVPSA_Float_CosCoef[] = { 3, /* Shifts */
- 0.1250038f, /* a0 */
- -0.0010986f, /* a1 */
- -0.6019775f, /* a2 */
- -0.0815149f, /* a3 */
- 0.7242042f, /* a4 */
- -0.2896206f}; /* a5 */
+const LVM_INT16 LVPSA_CosCoef[] = {3, /* Shifts */
+ 4096, /* a0 */
+ -36, /* a1 */
+ -19725, /* a2 */
+ -2671, /* a3 */
+ 23730, /* a4 */
+ -9490}; /* a5 */
+const LVM_FLOAT LVPSA_Float_CosCoef[] = {3, /* Shifts */
+ 0.1250038f, /* a0 */
+ -0.0010986f, /* a1 */
+ -0.6019775f, /* a2 */
+ -0.0815149f, /* a3 */
+ 0.7242042f, /* a4 */
+ -0.2896206f}; /* a5 */
/*
* Coefficients for calculating the cosine error with the equation:
*
@@ -269,101 +177,100 @@
*
* Cos(x) = 1.0 - CosErr(x)
*/
-const LVM_INT16 LVPSA_DPCosCoef[] = { 1, /* Shifts */
- 0, /* a0 */
- -6, /* a1 */
- 16586, /* a2 */
- -44}; /* a3 */
-const LVM_FLOAT LVPSA_Float_DPCosCoef[] = {1.0f, /* Shifts */
- 0.0f, /* a0 */
- -0.00008311f, /* a1 */
- 0.50617999f, /* a2 */
- -0.00134281f}; /* a3 */
+const LVM_INT16 LVPSA_DPCosCoef[] = {1, /* Shifts */
+ 0, /* a0 */
+ -6, /* a1 */
+ 16586, /* a2 */
+ -44}; /* a3 */
+const LVM_FLOAT LVPSA_Float_DPCosCoef[] = {1.0f, /* Shifts */
+ 0.0f, /* a0 */
+ -0.00008311f, /* a1 */
+ 0.50617999f, /* a2 */
+ -0.00134281f}; /* a3 */
/************************************************************************************/
/* */
/* Quasi peak filter coefficients table */
/* */
/************************************************************************************/
-const QPD_C32_Coefs LVPSA_QPD_Coefs[] = {
- /* 8kS/s */ /* LVPSA_SPEED_LOW */
- {(LVM_INT32)0x80CEFD2B,0x00CB9B17},
- {(LVM_INT32)0x80D242E7,0x00CED11D},
- {(LVM_INT32)0x80DCBAF5,0x00D91679},
- {(LVM_INT32)0x80CEFD2B,0x00CB9B17},
- {(LVM_INT32)0x80E13739,0x00DD7CD3},
- {(LVM_INT32)0x80DCBAF5,0x00D91679},
- {(LVM_INT32)0x80D94BAF,0x00D5B7E7},
- {(LVM_INT32)0x80E13739,0x00DD7CD3},
- {(LVM_INT32)0x80DCBAF5,0x00D91679}, /* 48kS/s */
+const QPD_C32_Coefs LVPSA_QPD_Coefs[] = {
+ /* 8kS/s */ /* LVPSA_SPEED_LOW */
+ {(LVM_INT32)0x80CEFD2B, 0x00CB9B17},
+ {(LVM_INT32)0x80D242E7, 0x00CED11D},
+ {(LVM_INT32)0x80DCBAF5, 0x00D91679},
+ {(LVM_INT32)0x80CEFD2B, 0x00CB9B17},
+ {(LVM_INT32)0x80E13739, 0x00DD7CD3},
+ {(LVM_INT32)0x80DCBAF5, 0x00D91679},
+ {(LVM_INT32)0x80D94BAF, 0x00D5B7E7},
+ {(LVM_INT32)0x80E13739, 0x00DD7CD3},
+ {(LVM_INT32)0x80DCBAF5, 0x00D91679}, /* 48kS/s */
- /* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
- {(LVM_INT32)0x8587513D,0x055C22CF},
- {(LVM_INT32)0x859D2967,0x0570F007},
- {(LVM_INT32)0x85E2EFAC,0x05B34D79},
- {(LVM_INT32)0x8587513D,0x055C22CF},
- {(LVM_INT32)0x8600C7B9,0x05CFA6CF},
- {(LVM_INT32)0x85E2EFAC,0x05B34D79},
- {(LVM_INT32)0x85CC1018,0x059D8F69},
- {(LVM_INT32)0x8600C7B9,0x05CFA6CF},
- {(LVM_INT32)0x85E2EFAC,0x05B34D79}, /* 48kS/s */
+ /* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
+ {(LVM_INT32)0x8587513D, 0x055C22CF},
+ {(LVM_INT32)0x859D2967, 0x0570F007},
+ {(LVM_INT32)0x85E2EFAC, 0x05B34D79},
+ {(LVM_INT32)0x8587513D, 0x055C22CF},
+ {(LVM_INT32)0x8600C7B9, 0x05CFA6CF},
+ {(LVM_INT32)0x85E2EFAC, 0x05B34D79},
+ {(LVM_INT32)0x85CC1018, 0x059D8F69},
+ {(LVM_INT32)0x8600C7B9, 0x05CFA6CF},
+ {(LVM_INT32)0x85E2EFAC, 0x05B34D79}, /* 48kS/s */
- /* 8kS/s */ /* LVPSA_SPEED_HIGH */
- {(LVM_INT32)0xA115EA7A,0x1CDB3F5C},
- {(LVM_INT32)0xA18475F0,0x1D2C83A2},
- {(LVM_INT32)0xA2E1E950,0x1E2A532E},
- {(LVM_INT32)0xA115EA7A,0x1CDB3F5C},
- {(LVM_INT32)0xA375B2C6,0x1E943BBC},
- {(LVM_INT32)0xA2E1E950,0x1E2A532E},
- {(LVM_INT32)0xA26FF6BD,0x1DD81530},
- {(LVM_INT32)0xA375B2C6,0x1E943BBC},
- {(LVM_INT32)0xA2E1E950,0x1E2A532E}}; /* 48kS/s */
+ /* 8kS/s */ /* LVPSA_SPEED_HIGH */
+ {(LVM_INT32)0xA115EA7A, 0x1CDB3F5C},
+ {(LVM_INT32)0xA18475F0, 0x1D2C83A2},
+ {(LVM_INT32)0xA2E1E950, 0x1E2A532E},
+ {(LVM_INT32)0xA115EA7A, 0x1CDB3F5C},
+ {(LVM_INT32)0xA375B2C6, 0x1E943BBC},
+ {(LVM_INT32)0xA2E1E950, 0x1E2A532E},
+ {(LVM_INT32)0xA26FF6BD, 0x1DD81530},
+ {(LVM_INT32)0xA375B2C6, 0x1E943BBC},
+ {(LVM_INT32)0xA2E1E950, 0x1E2A532E}}; /* 48kS/s */
-const QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[] = {
+const QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[] = {
- /* 8kS/s */ /* LVPSA_SPEED_LOW */
- {-0.9936831989325583f,0.0062135565094650f},
- {-0.9935833332128823f,0.0063115493394434f},
- {-0.9932638457976282f,0.0066249934025109f},
- {-0.9936831989325583f,0.0062135565094650f},
- {-0.9931269618682563f,0.0067592649720609f},
- {-0.9932638457976282f,0.0066249934025109f},
- {-0.9933686633594334f,0.0065221670083702f},
- {-0.9931269618682563f,0.0067592649720609f},
- /* 48kS/s */
- {-0.9932638457976282f,0.0066249934025109f},
- {-0.9931269618682563f,0.0067592649720609f},
- {-0.9932638457976282f,0.0066249934025109f},
- {-0.9931269618682563f,0.0067592649720609f},
- {-0.9932638457976282f,0.0066249934025109f},
- /* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
- {-0.9568079425953329f,0.0418742666952312f},
- {-0.9561413046903908f,0.0425090822391212f},
- {-0.9540119562298059f,0.0445343819446862f},
- {-0.9568079425953329f,0.0418742666952312f},
- {-0.9531011912040412f,0.0453995238058269f},
- {-0.9540119562298059f,0.0445343819446862f},
- {-0.9547099955379963f,0.0438708555884659f},
- //{0x8600C7B9,0x05CFA6CF},
- {-0.9531011912040412f,0.0453995238058269f},
- /* 48kS/s */
- {-0.9540119562298059f,0.0445343819446862f},
- {-0.9531011912040412f,0.0453995238058269f},
- {-0.9540119562298059f,0.0445343819446862f},
- {-0.9531011912040412f,0.0453995238058269f},
- {-0.9540119562298059f,0.0445343819446862f},
- /* 8kS/s */ /* LVPSA_SPEED_HIGH */
- {-0.7415186790749431f,0.2254409026354551f},
- {-0.7381451204419136f,0.2279209652915597f},
- {-0.7274807319045067f,0.2356666540727019f},
- {-0.7415186790749431f,0.2254409026354551f},
- {-0.7229706319049001f,0.2388987224549055f},
- {-0.7274807319045067f,0.2356666540727019f},
- {-0.7309581353329122f,0.2331568226218224f},
- {-0.7229706319049001f,0.2388987224549055f},
- /* 48kS/s */
- {-0.7274807319045067f,0.2356666540727019f}
- ,{-0.7229706319049001f,0.2388987224549055f}
- ,{-0.7274807319045067f,0.2356666540727019f}
- ,{-0.7229706319049001f,0.2388987224549055f}
- ,{-0.7274807319045067f,0.2356666540727019f}
- };
+ /* 8kS/s */ /* LVPSA_SPEED_LOW */
+ {-0.9936831989325583f, 0.0062135565094650f},
+ {-0.9935833332128823f, 0.0063115493394434f},
+ {-0.9932638457976282f, 0.0066249934025109f},
+ {-0.9936831989325583f, 0.0062135565094650f},
+ {-0.9931269618682563f, 0.0067592649720609f},
+ {-0.9932638457976282f, 0.0066249934025109f},
+ {-0.9933686633594334f, 0.0065221670083702f},
+ {-0.9931269618682563f, 0.0067592649720609f},
+ /* 48kS/s */
+ {-0.9932638457976282f, 0.0066249934025109f},
+ {-0.9931269618682563f, 0.0067592649720609f},
+ {-0.9932638457976282f, 0.0066249934025109f},
+ {-0.9931269618682563f, 0.0067592649720609f},
+ {-0.9932638457976282f, 0.0066249934025109f},
+ /* 8kS/s */ /* LVPSA_SPEED_MEDIUM */
+ {-0.9568079425953329f, 0.0418742666952312f},
+ {-0.9561413046903908f, 0.0425090822391212f},
+ {-0.9540119562298059f, 0.0445343819446862f},
+ {-0.9568079425953329f, 0.0418742666952312f},
+ {-0.9531011912040412f, 0.0453995238058269f},
+ {-0.9540119562298059f, 0.0445343819446862f},
+ {-0.9547099955379963f, 0.0438708555884659f},
+ //{0x8600C7B9,0x05CFA6CF},
+ {-0.9531011912040412f, 0.0453995238058269f},
+ /* 48kS/s */
+ {-0.9540119562298059f, 0.0445343819446862f},
+ {-0.9531011912040412f, 0.0453995238058269f},
+ {-0.9540119562298059f, 0.0445343819446862f},
+ {-0.9531011912040412f, 0.0453995238058269f},
+ {-0.9540119562298059f, 0.0445343819446862f},
+ /* 8kS/s */ /* LVPSA_SPEED_HIGH */
+ {-0.7415186790749431f, 0.2254409026354551f},
+ {-0.7381451204419136f, 0.2279209652915597f},
+ {-0.7274807319045067f, 0.2356666540727019f},
+ {-0.7415186790749431f, 0.2254409026354551f},
+ {-0.7229706319049001f, 0.2388987224549055f},
+ {-0.7274807319045067f, 0.2356666540727019f},
+ {-0.7309581353329122f, 0.2331568226218224f},
+ {-0.7229706319049001f, 0.2388987224549055f},
+ /* 48kS/s */
+ {-0.7274807319045067f, 0.2356666540727019f},
+ {-0.7229706319049001f, 0.2388987224549055f},
+ {-0.7274807319045067f, 0.2356666540727019f},
+ {-0.7229706319049001f, 0.2388987224549055f},
+ {-0.7274807319045067f, 0.2356666540727019f}};
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h
index 65872fe..c771dad 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Tables.h
@@ -27,7 +27,7 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-extern const LVM_UINT32 LVPSA_SampleRateTab[];
+extern const LVM_UINT32 LVPSA_SampleRateTab[];
/************************************************************************************/
/* */
@@ -39,7 +39,7 @@
* Sample rate table for converting between the enumerated type and the actual
* frequency
*/
-extern const LVM_UINT32 LVPSA_SampleRateInvTab[];
+extern const LVM_UINT32 LVPSA_SampleRateInvTab[];
/************************************************************************************/
/* */
@@ -51,7 +51,7 @@
* Table for converting between the enumerated type and the number of samples
* during 20ms
*/
-extern const LVM_UINT16 LVPSA_nSamplesBufferUpdate[];
+extern const LVM_UINT16 LVPSA_nSamplesBufferUpdate[];
/************************************************************************************/
/* */
@@ -62,7 +62,7 @@
/*
* Table for converting between the enumerated type and the down sampling factor
*/
-extern const LVM_UINT16 LVPSA_DownSamplingFactor[];
+extern const LVM_UINT16 LVPSA_DownSamplingFactor[];
/************************************************************************************/
/* */
@@ -73,14 +73,14 @@
/*
* Table for 2 * Pi / Fs
*/
-extern const LVM_INT16 LVPSA_TwoPiOnFsTable[];
-extern const LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
+extern const LVM_INT16 LVPSA_TwoPiOnFsTable[];
+extern const LVM_FLOAT LVPSA_Float_TwoPiOnFsTable[];
/*
* Gain table
*/
-extern const LVM_INT16 LVPSA_GainTable[];
-extern const LVM_FLOAT LVPSA_Float_GainTable[];
+extern const LVM_INT16 LVPSA_GainTable[];
+extern const LVM_FLOAT LVPSA_Float_GainTable[];
/************************************************************************************/
/* */
@@ -97,8 +97,8 @@
* a range of 0 to Pi. The output is in the range 32767 to -32768 representing the range
* +1.0 to -1.0
*/
-extern const LVM_INT16 LVPSA_CosCoef[];
-extern const LVM_FLOAT LVPSA_Float_CosCoef[];
+extern const LVM_INT16 LVPSA_CosCoef[];
+extern const LVM_FLOAT LVPSA_Float_CosCoef[];
/*
* Coefficients for calculating the cosine error with the equation:
@@ -114,15 +114,15 @@
*
* Cos(x) = 1.0 - CosErr(x)
*/
-extern const LVM_INT16 LVPSA_DPCosCoef[];
-extern const LVM_FLOAT LVPSA_Float_DPCosCoef[];
+extern const LVM_INT16 LVPSA_DPCosCoef[];
+extern const LVM_FLOAT LVPSA_Float_DPCosCoef[];
/************************************************************************************/
/* */
/* Quasi peak filter coefficients table */
/* */
/************************************************************************************/
-extern const QPD_C32_Coefs LVPSA_QPD_Coefs[];
-extern const QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[];
+extern const QPD_C32_Coefs LVPSA_QPD_Coefs[];
+extern const QPD_FLOAT_Coefs LVPSA_QPD_Float_Coefs[];
#endif /* __LVPSA_TABLES_H__ */
diff --git a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
index 58ba8ad..ffe7902 100644
--- a/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
+++ b/media/libeffects/lvm/lib/StereoWidening/lib/LVCS.h
@@ -72,13 +72,13 @@
/****************************************************************************************/
/* Effect Level */
-#define LVCS_EFFECT_LOW 16384 /* Effect scaling 50% */
-#define LVCS_EFFECT_MEDIUM 24576 /* Effect scaling 75% */
-#define LVCS_EFFECT_HIGH 32767 /* Effect Scaling 100% */
+#define LVCS_EFFECT_LOW 16384 /* Effect scaling 50% */
+#define LVCS_EFFECT_MEDIUM 24576 /* Effect scaling 75% */
+#define LVCS_EFFECT_HIGH 32767 /* Effect Scaling 100% */
/* Callback events */
-#define LVCS_EVENT_NONE 0x0000 /* Not a valid event */
-#define LVCS_EVENT_ALGOFF 0x0001 /* CS has completed switch off */
+#define LVCS_EVENT_NONE 0x0000 /* Not a valid event */
+#define LVCS_EVENT_ALGOFF 0x0001 /* CS has completed switch off */
/****************************************************************************************/
/* */
@@ -87,58 +87,49 @@
/****************************************************************************************/
/* Instance handle */
-typedef void *LVCS_Handle_t;
+typedef void* LVCS_Handle_t;
/* Operating modes */
-typedef enum
-{
- LVCS_OFF = 0,
- LVCS_ON = 15,
- LVCS_MAX = LVM_MAXENUM
-} LVCS_Modes_en;
+typedef enum { LVCS_OFF = 0, LVCS_ON = 15, LVCS_MAX = LVM_MAXENUM } LVCS_Modes_en;
/* Function return status */
-typedef enum
-{
- LVCS_SUCCESS = 0, /* Successful return from a routine */
- LVCS_NULLADDRESS = 1, /* NULL allocation address */
- LVCS_TOOMANYSAMPLES = 2, /* Maximum block size exceeded */
- LVCS_STATUSMAX = LVM_MAXENUM
+typedef enum {
+ LVCS_SUCCESS = 0, /* Successful return from a routine */
+ LVCS_NULLADDRESS = 1, /* NULL allocation address */
+ LVCS_TOOMANYSAMPLES = 2, /* Maximum block size exceeded */
+ LVCS_STATUSMAX = LVM_MAXENUM
} LVCS_ReturnStatus_en;
/*
* Source data formats
*/
-typedef enum
-{
- LVCS_STEREO = 0,
+typedef enum {
+ LVCS_STEREO = 0,
LVCS_MONOINSTEREO = 1,
- LVCS_SOURCEMAX = LVM_MAXENUM
+ LVCS_SOURCEMAX = LVM_MAXENUM
} LVCS_SourceFormat_en;
/*
* Supported output devices
*/
-typedef enum
-{
- LVCS_HEADPHONES = 0,
- LVCS_EX_HEADPHONES = 1,
- LVCS_SPEAKERTYPE_MAX = LVM_MAXENUM
+typedef enum {
+ LVCS_HEADPHONES = 0,
+ LVCS_EX_HEADPHONES = 1,
+ LVCS_SPEAKERTYPE_MAX = LVM_MAXENUM
} LVCS_SpeakerType_en;
/*
* Speaker Coefficients Table
*/
-typedef struct
-{
- void *pTable1;
- void *pTable2;
- void *pTable3;
- void *pTable4;
- void *pTable5;
- void *pTable6;
- void *pTable7;
- void *pTable8;
+typedef struct {
+ void* pTable1;
+ void* pTable2;
+ void* pTable3;
+ void* pTable4;
+ void* pTable5;
+ void* pTable6;
+ void* pTable7;
+ void* pTable8;
} LVCS_CSMS_Coef_Tables_t;
/****************************************************************************************/
@@ -148,27 +139,25 @@
/****************************************************************************************/
/* Concert Sound parameter structure */
-typedef struct
-{
- LVCS_Modes_en OperatingMode; /* Algorithm mode */
- LVCS_SpeakerType_en SpeakerType; /* Output device type */
- LVCS_SourceFormat_en SourceFormat; /* Source data format */
- LVM_Mode_en CompressorMode; /* Non-Linear Compressor Mode */
- LVM_Fs_en SampleRate; /* Sampling rate */
- LVM_INT16 EffectLevel; /* Effect level */
- LVM_UINT16 ReverbLevel; /* Reverb level in % */
- LVM_INT32 NrChannels;
+typedef struct {
+ LVCS_Modes_en OperatingMode; /* Algorithm mode */
+ LVCS_SpeakerType_en SpeakerType; /* Output device type */
+ LVCS_SourceFormat_en SourceFormat; /* Source data format */
+ LVM_Mode_en CompressorMode; /* Non-Linear Compressor Mode */
+ LVM_Fs_en SampleRate; /* Sampling rate */
+ LVM_INT16 EffectLevel; /* Effect level */
+ LVM_UINT16 ReverbLevel; /* Reverb level in % */
+ LVM_INT32 NrChannels;
} LVCS_Params_t;
/* Concert Sound Capability structure */
-typedef struct
-{
+typedef struct {
/* General parameters */
- LVM_UINT16 MaxBlockSize; /* Maximum block size in sample pairs */
+ LVM_UINT16 MaxBlockSize; /* Maximum block size in sample pairs */
/* Callback parameters */
- LVM_Callback CallBack; /* Bundle callback */
- void *pBundleInstance; /* Bundle instance handle */
+ LVM_Callback CallBack; /* Bundle callback */
+ void* pBundleInstance; /* Bundle instance handle */
} LVCS_Capabilities_t;
@@ -198,9 +187,8 @@
/* 1. This function must not be interrupted by the LVCS_Process function */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_Init(LVCS_Handle_t *phInstance,
- LVCS_Capabilities_t *pCapabilities,
- void *pScratch);
+LVCS_ReturnStatus_en LVCS_Init(LVCS_Handle_t* phInstance, LVCS_Capabilities_t* pCapabilities,
+ void* pScratch);
/************************************************************************************/
/* */
@@ -216,7 +204,7 @@
/* 1. This function must not be interrupted by the LVCS_Process function */
/* */
/************************************************************************************/
-void LVCS_DeInit(LVCS_Handle_t *phInstance);
+void LVCS_DeInit(LVCS_Handle_t* phInstance);
/****************************************************************************************/
/* */
@@ -238,8 +226,7 @@
/* */
/****************************************************************************************/
-LVCS_ReturnStatus_en LVCS_GetParameters(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams);
+LVCS_ReturnStatus_en LVCS_GetParameters(LVCS_Handle_t hInstance, LVCS_Params_t* pParams);
/****************************************************************************************/
/* */
@@ -260,8 +247,7 @@
/* */
/****************************************************************************************/
-LVCS_ReturnStatus_en LVCS_Control(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams);
+LVCS_ReturnStatus_en LVCS_Control(LVCS_Handle_t hInstance, LVCS_Params_t* pParams);
/****************************************************************************************/
/* */
@@ -284,9 +270,7 @@
/* NOTES: */
/* */
/****************************************************************************************/
-LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples);
+LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, LVM_UINT16 NumSamples);
-#endif /* LVCS_H */
+#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 ba152c0..efca27d 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.cpp
@@ -32,9 +32,8 @@
/* Function Prototypes */
/* */
/****************************************************************************************/
-LVM_INT32 LVCS_MixerCallback( LVCS_Handle_t hInstance,
- void *pGeneralPurpose,
- LVM_INT16 CallbackParam);
+LVM_INT32 LVCS_MixerCallback(LVCS_Handle_t hInstance, void* pGeneralPurpose,
+ LVM_INT16 CallbackParam);
/************************************************************************************/
/* */
@@ -65,29 +64,22 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_BypassMixInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
-
- LVM_UINT16 Offset;
- LVM_FLOAT Gain;
- LVM_FLOAT Current;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_BypassMix_t *pConfig = (LVCS_BypassMix_t *)&pInstance->BypassMix;
- const Gain_t *pOutputGainTable;
+LVCS_ReturnStatus_en LVCS_BypassMixInit(LVCS_Handle_t hInstance, LVCS_Params_t* pParams) {
+ LVM_UINT16 Offset;
+ LVM_FLOAT Gain;
+ LVM_FLOAT Current;
+ 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
*/
- if ((pParams->OperatingMode == LVCS_ON) &&
- (pInstance->bTimerDone == LVM_TRUE)
- && (pInstance->MSTarget1 != 0x7FFF) /* this indicates an off->on transtion */
- )
- {
+ if ((pParams->OperatingMode == LVCS_ON) && (pInstance->bTimerDone == LVM_TRUE) &&
+ (pInstance->MSTarget1 != 0x7FFF) /* this indicates an off->on transition */
+ ) {
pInstance->TransitionGain = ((LVM_FLOAT)pParams->EffectLevel / 32767);
- }
- else
- {
+ } else {
/* Select no effect level */
pInstance->TransitionGain = 0;
}
@@ -95,18 +87,19 @@
/*
* Calculate the output gain table offset
*/
- Offset = (LVM_UINT16)(pParams->SpeakerType + (pParams->SourceFormat*(1+LVCS_EX_HEADPHONES)));
+ Offset =
+ (LVM_UINT16)(pParams->SpeakerType + (pParams->SourceFormat * (1 + LVCS_EX_HEADPHONES)));
pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
/*
* Setup the mixer gain for the processed path
*/
- Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * pInstance->TransitionGain);
+ Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * pInstance->TransitionGain);
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;
+ pConfig->Mixer_Instance.MixerStream[0].CallbackSet = 1;
Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[0]);
LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[0], (LVM_FLOAT)(Gain), Current);
@@ -116,8 +109,8 @@
/*
* Setup the mixer gain for the unprocessed path
*/
- Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss * (1.0 - \
- (LVM_FLOAT)pInstance->TransitionGain));
+ Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss *
+ (1.0 - (LVM_FLOAT)pInstance->TransitionGain));
Gain = (LVM_FLOAT)pOutputGainTable[Offset].UnprocLoss * Gain;
Current = LVC_Mixer_GetCurrent(&pConfig->Mixer_Instance.MixerStream[1]);
LVC_Mixer_Init(&pConfig->Mixer_Instance.MixerStream[1], (LVM_FLOAT)(Gain), Current);
@@ -125,7 +118,7 @@
LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
pConfig->Mixer_Instance.MixerStream[1].CallbackParam = 0;
pConfig->Mixer_Instance.MixerStream[1].pCallbackHandle = hInstance;
- pConfig->Mixer_Instance.MixerStream[1].CallbackSet=1;
+ pConfig->Mixer_Instance.MixerStream[1].CallbackSet = 1;
pConfig->Mixer_Instance.MixerStream[1].pCallBack = LVCS_MixerCallback;
/*
@@ -137,45 +130,42 @@
* Correct gain for the effect level
*/
{
- LVM_FLOAT GainCorrect;
- LVM_FLOAT Gain1;
- LVM_FLOAT Gain2;
+ LVM_FLOAT GainCorrect;
+ LVM_FLOAT Gain1;
+ LVM_FLOAT 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_FLOAT)( pInstance->VolCorrect.GainMin
- - (((LVM_FLOAT)pInstance->VolCorrect.GainMin * \
- ((LVM_FLOAT)pInstance->TransitionGain)))
- + (((LVM_FLOAT)pInstance->VolCorrect.GainFull * \
- ((LVM_FLOAT)pInstance->TransitionGain))));
+ if (pInstance->Params.CompressorMode == LVM_MODE_ON) {
+ GainCorrect = (LVM_FLOAT)(pInstance->VolCorrect.GainMin -
+ (((LVM_FLOAT)pInstance->VolCorrect.GainMin *
+ ((LVM_FLOAT)pInstance->TransitionGain))) +
+ (((LVM_FLOAT)pInstance->VolCorrect.GainFull *
+ ((LVM_FLOAT)pInstance->TransitionGain))));
- /*
- * Apply the gain correction
- */
- Gain1 = (Gain1 * GainCorrect);
- Gain2 = (Gain2 * GainCorrect);
-
+ /*
+ * Apply the gain correction
+ */
+ Gain1 = (Gain1 * GainCorrect);
+ Gain2 = (Gain2 * GainCorrect);
}
/*
* Set the gain values
*/
pConfig->Output_Shift = pConfig->Output_Shift;
- LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[0],Gain1);
+ LVC_Mixer_SetTarget(&pConfig->Mixer_Instance.MixerStream[0], Gain1);
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);
+ 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);
}
- return(LVCS_SUCCESS);
-
+ return (LVCS_SUCCESS);
}
/************************************************************************************/
@@ -205,39 +195,29 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pProcessed,
- const LVM_FLOAT *pUnprocessed,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_BypassMix_t *pConfig = (LVCS_BypassMix_t *)&pInstance->BypassMix;
+LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance, const LVM_FLOAT* pProcessed,
+ const LVM_FLOAT* pUnprocessed, LVM_FLOAT* pOutData,
+ LVM_UINT16 NumSamples) {
+ LVCS_Instance_t* pInstance = (LVCS_Instance_t*)hInstance;
+ LVCS_BypassMix_t* pConfig = (LVCS_BypassMix_t*)&pInstance->BypassMix;
/*
* Check if the bypass mixer is enabled
*/
- if ((pInstance->Params.OperatingMode & LVCS_BYPASSMIXSWITCH) != 0)
- {
+ if ((pInstance->Params.OperatingMode & LVCS_BYPASSMIXSWITCH) != 0) {
/*
* Apply the bypass mix
*/
- LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance,
- pProcessed,
- (LVM_FLOAT *) pUnprocessed,
- pOutData,
- (LVM_INT16)(2 * NumSamples));
+ LVC_MixSoft_2St_D16C31_SAT(&pConfig->Mixer_Instance, pProcessed, (LVM_FLOAT*)pUnprocessed,
+ pOutData, (LVM_INT16)(2 * NumSamples));
/*
* Apply output gain correction shift
*/
- Shift_Sat_Float((LVM_INT16)pConfig->Output_Shift,
- (LVM_FLOAT*)pOutData,
- (LVM_FLOAT*)pOutData,
- (LVM_INT16)(2 * NumSamples)); /* Left and right*/
+ Shift_Sat_Float((LVM_INT16)pConfig->Output_Shift, (LVM_FLOAT*)pOutData,
+ (LVM_FLOAT*)pOutData, (LVM_INT16)(2 * NumSamples)); /* Left and right*/
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
/************************************************************************************/
@@ -245,22 +225,18 @@
/* FUNCTION: LVCS_MixerCallback */
/* */
/************************************************************************************/
-LVM_INT32 LVCS_MixerCallback(LVCS_Handle_t hInstance,
- void *pGeneralPurpose,
- LVM_INT16 CallbackParam)
-{
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+LVM_INT32 LVCS_MixerCallback(LVCS_Handle_t hInstance, void* pGeneralPurpose,
+ LVM_INT16 CallbackParam) {
+ LVCS_Instance_t* pInstance = (LVCS_Instance_t*)hInstance;
- (void)pGeneralPurpose;
+ (void)pGeneralPurpose;
/*
* Off transition has completed in Headphone mode
*/
- if ((pInstance->OutputDevice == LVCS_HEADPHONE) &&
- (pInstance->bInOperatingModeTransition) &&
- (pInstance->MSTarget0 == 0x0000)&& /* this indicates an on->off transition */
- (CallbackParam == 0))
- {
+ if ((pInstance->OutputDevice == LVCS_HEADPHONE) && (pInstance->bInOperatingModeTransition) &&
+ (pInstance->MSTarget0 == 0x0000) && /* this indicates an on->off transition */
+ (CallbackParam == 0)) {
/* Set operating mode to OFF */
pInstance->Params.OperatingMode = LVCS_OFF;
@@ -268,21 +244,17 @@
pInstance->bInOperatingModeTransition = LVM_FALSE;
/* Signal to the bundle */
- if((*pInstance->Capabilities.CallBack) != LVM_NULL){
- (*pInstance->Capabilities.CallBack)(pInstance->Capabilities.pBundleInstance,
- LVM_NULL,
+ if ((*pInstance->Capabilities.CallBack) != LVM_NULL) {
+ (*pInstance->Capabilities.CallBack)(pInstance->Capabilities.pBundleInstance, LVM_NULL,
(ALGORITHM_CS_ID | LVCS_EVENT_ALGOFF));
}
}
- if ((pInstance->OutputDevice == LVCS_HEADPHONE) &&
- (pInstance->MSTarget0 == 1) &&
- (pInstance->bTimerDone == LVM_TRUE)){
-
+ if ((pInstance->OutputDevice == LVCS_HEADPHONE) && (pInstance->MSTarget0 == 1) &&
+ (pInstance->bTimerDone == LVM_TRUE)) {
/* Exit transition state */
pInstance->bInOperatingModeTransition = LVM_FALSE;
}
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 fcd8ee3..69afcbb 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_BypassMix.h
@@ -33,20 +33,18 @@
/************************************************************************************/
/* Bypass mixer structure */
-typedef struct
-{
+typedef struct {
/* Mixer settings */
- LVMixer3_2St_FLOAT_st Mixer_Instance; /* Mixer instance */
- LVM_UINT16 Output_Shift; /* Correcting gain output shift */
+ LVMixer3_2St_FLOAT_st Mixer_Instance; /* Mixer instance */
+ LVM_UINT16 Output_Shift; /* Correcting gain output shift */
} LVCS_BypassMix_t;
-typedef struct
-{
+typedef struct {
/* Output gain settings, Gain = (Loss/32768) * 2^Shift */
- LVM_UINT16 Shift; /* Left shifts required */
- LVM_FLOAT Loss; /* Loss required */
- LVM_FLOAT UnprocLoss; /* Unprocessed path loss */
+ LVM_UINT16 Shift; /* Left shifts required */
+ LVM_FLOAT Loss; /* Loss required */
+ LVM_FLOAT UnprocLoss; /* Unprocessed path loss */
} Gain_t;
/************************************************************************************/
/* */
@@ -54,13 +52,10 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_BypassMixInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams);
+LVCS_ReturnStatus_en LVCS_BypassMixInit(LVCS_Handle_t hInstance, LVCS_Params_t* pParams);
-LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pProcessed,
- const LVM_FLOAT *unProcessed,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples);
+LVCS_ReturnStatus_en LVCS_BypassMixer(LVCS_Handle_t hInstance, const LVM_FLOAT* pProcessed,
+ const LVM_FLOAT* unProcessed, LVM_FLOAT* pOutData,
+ LVM_UINT16 NumSamples);
-#endif /* BYPASSMIX_H */
+#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 50db03d..8f88986 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.cpp
@@ -45,15 +45,12 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_GetParameters(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
-
- LVCS_Instance_t *pInstance =(LVCS_Instance_t *)hInstance;
+LVCS_ReturnStatus_en LVCS_GetParameters(LVCS_Handle_t hInstance, LVCS_Params_t* pParams) {
+ LVCS_Instance_t* pInstance = (LVCS_Instance_t*)hInstance;
*pParams = pInstance->Params;
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
/************************************************************************************/
@@ -75,34 +72,29 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_Control(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
- LVM_INT16 Offset;
- LVCS_Instance_t *pInstance =(LVCS_Instance_t *)hInstance;
- LVCS_ReturnStatus_en err;
- LVCS_Modes_en OperatingModeSave = pInstance->Params.OperatingMode;
+LVCS_ReturnStatus_en LVCS_Control(LVCS_Handle_t hInstance, LVCS_Params_t* pParams) {
+ LVM_INT16 Offset;
+ LVCS_Instance_t* pInstance = (LVCS_Instance_t*)hInstance;
+ LVCS_ReturnStatus_en err;
+ LVCS_Modes_en OperatingModeSave = pInstance->Params.OperatingMode;
- if (pParams->SampleRate != pInstance->Params.SampleRate)
- {
+ if (pParams->SampleRate != pInstance->Params.SampleRate) {
pInstance->TimerParams.SamplingRate = LVCS_SampleRateTable[pParams->SampleRate];
}
/*
* If the reverb level has changed
*/
- if(pInstance->Params.ReverbLevel != pParams->ReverbLevel)
- {
- err=LVCS_ReverbGeneratorInit(hInstance,pParams);
+ if (pInstance->Params.ReverbLevel != pParams->ReverbLevel) {
+ err = LVCS_ReverbGeneratorInit(hInstance, pParams);
}
/*
* If the sample rate or speaker has changed then perform a full re-initialisation
*/
if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
- (pInstance->Params.SpeakerType != pParams->SpeakerType))
- {
- const LVCS_VolCorrect_t *pLVCS_VolCorrectTable;
+ (pInstance->Params.SpeakerType != pParams->SpeakerType)) {
+ const LVCS_VolCorrect_t* pLVCS_VolCorrectTable;
/*
* Output device
@@ -114,15 +106,16 @@
*/
/* Use internal coefficient table */
pLVCS_VolCorrectTable = (LVCS_VolCorrect_t*)&LVCS_VolCorrectTable[0];
- Offset = (LVM_INT16)(pParams->SpeakerType + pParams->SourceFormat*(1+LVCS_EX_HEADPHONES));
+ Offset = (LVM_INT16)(pParams->SpeakerType +
+ pParams->SourceFormat * (1 + LVCS_EX_HEADPHONES));
pInstance->VolCorrect = pLVCS_VolCorrectTable[Offset];
pInstance->CompressGain = pInstance->VolCorrect.CompMin;
LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0], 0, 0);
{
- LVM_FLOAT Gain;
- const Gain_t *pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
+ LVM_FLOAT Gain;
+ const Gain_t* pOutputGainTable = (Gain_t*)&LVCS_OutputGainTable[0];
Gain = (LVM_FLOAT)(pOutputGainTable[Offset].Loss);
Gain = (LVM_FLOAT)pOutputGainTable[Offset].UnprocLoss * (Gain);
@@ -133,22 +126,18 @@
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);
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],
- LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
+ LVCS_BYPASS_MIXER_TC, pParams->SampleRate, 2);
}
- err=LVCS_SEnhancerInit(hInstance,
- pParams);
+ err = LVCS_SEnhancerInit(hInstance, pParams);
- err=LVCS_ReverbGeneratorInit(hInstance,
- pParams);
+ err = LVCS_ReverbGeneratorInit(hInstance, pParams);
- err=LVCS_EqualiserInit(hInstance,
- pParams);
+ err = LVCS_EqualiserInit(hInstance, pParams);
- err=LVCS_BypassMixInit(hInstance,
- pParams);
+ err = LVCS_BypassMixInit(hInstance, pParams);
}
@@ -156,30 +145,26 @@
* Check if the effect level or source format has changed
*/
else if ((pInstance->Params.EffectLevel != pParams->EffectLevel) ||
- (pInstance->Params.SourceFormat != pParams->SourceFormat))
- {
- const LVCS_VolCorrect_t *pLVCS_VolCorrectTable;
+ (pInstance->Params.SourceFormat != pParams->SourceFormat)) {
+ const LVCS_VolCorrect_t* pLVCS_VolCorrectTable;
/*
* Get the volume correction parameters
*/
/* Use internal coefficient table */
pLVCS_VolCorrectTable = (LVCS_VolCorrect_t*)&LVCS_VolCorrectTable[0];
- Offset = (LVM_INT16)(pParams->SpeakerType + pParams->SourceFormat*(1+LVCS_EX_HEADPHONES));
+ Offset = (LVM_INT16)(pParams->SpeakerType +
+ pParams->SourceFormat * (1 + LVCS_EX_HEADPHONES));
pInstance->VolCorrect = pLVCS_VolCorrectTable[Offset];
/* Update the effect level and alpha-mixer gains */
- err=LVCS_BypassMixInit(hInstance,
- pParams);
+ err = LVCS_BypassMixInit(hInstance, pParams);
- if(err != LVCS_SUCCESS)
- {
+ if (err != LVCS_SUCCESS) {
return err;
}
- }
- else
- {
+ } else {
pInstance->Params = *pParams;
}
@@ -189,40 +174,36 @@
pInstance->Params = *pParams;
/* Stay on the current operating mode until the transition is done */
- if((pParams->OperatingMode != OperatingModeSave) ||
- (pInstance->bInOperatingModeTransition == LVM_TRUE)){
-
+ if ((pParams->OperatingMode != OperatingModeSave) ||
+ (pInstance->bInOperatingModeTransition == LVM_TRUE)) {
/* Set the reverb delay timeout */
- if(pInstance->bInOperatingModeTransition != LVM_TRUE){
+ if (pInstance->bInOperatingModeTransition != LVM_TRUE) {
pInstance->bTimerDone = LVM_FALSE;
pInstance->TimerParams.TimeInMs =
- (LVM_INT16)(((pInstance->Reverberation.DelaySize << 2)
- /pInstance->TimerParams.SamplingRate) + 1);
- LVM_Timer_Init ( &pInstance->TimerInstance,
- &pInstance->TimerParams);
+ (LVM_INT16)(((pInstance->Reverberation.DelaySize << 2) /
+ pInstance->TimerParams.SamplingRate) +
+ 1);
+ LVM_Timer_Init(&pInstance->TimerInstance, &pInstance->TimerParams);
}
/* Update the effect level and alpha-mixer gains */
- err=LVCS_BypassMixInit(hInstance,
- pParams);
+ err = LVCS_BypassMixInit(hInstance, pParams);
/* Change transition bypass mixer settings if needed depending on transition type */
- if(pParams->OperatingMode != LVCS_OFF){
- pInstance->MSTarget0=LVM_MAXINT_16;
- pInstance->MSTarget1=0;
- }
- else
- {
+ if (pParams->OperatingMode != LVCS_OFF) {
+ pInstance->MSTarget0 = LVM_MAXINT_16;
+ pInstance->MSTarget1 = 0;
+ } else {
pInstance->Params.OperatingMode = OperatingModeSave;
- pInstance->MSTarget1=LVM_MAXINT_16;
- pInstance->MSTarget0=0;
+ pInstance->MSTarget1 = LVM_MAXINT_16;
+ pInstance->MSTarget0 = 0;
}
/* Set transition flag */
pInstance->bInOperatingModeTransition = LVM_TRUE;
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
/****************************************************************************************/
@@ -233,12 +214,11 @@
/* CallBack function of the Timer. */
/* */
/****************************************************************************************/
-void LVCS_TimerCallBack (void* hInstance, void* pCallBackParams, LVM_INT32 CallbackParam)
-{
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+void LVCS_TimerCallBack(void* hInstance, void* pCallBackParams, LVM_INT32 CallbackParam) {
+ LVCS_Instance_t* pInstance = (LVCS_Instance_t*)hInstance;
/* Avoid warnings because pCallBackParams and CallbackParam are not used*/
- if((pCallBackParams != LVM_NULL) || (CallbackParam != 0)){
+ if ((pCallBackParams != LVM_NULL) || (CallbackParam != 0)) {
pCallBackParams = hInstance;
CallbackParam = 0;
return;
@@ -248,4 +228,3 @@
return;
}
-
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
index abadae3..bad9aef 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.cpp
@@ -53,26 +53,22 @@
/* NOTES: */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
+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_Coefficient_t* pCoefficients;
+ BQ_FLOAT_Coefs_t Coeffs;
+ const BiquadA012B12CoefsSP_t* pEqualiserCoefTable;
- 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_Coefficient_t *pCoefficients;
- BQ_FLOAT_Coefs_t Coeffs;
- const BiquadA012B12CoefsSP_t *pEqualiserCoefTable;
-
- pData = (LVCS_Data_t *)pInstance->pData;
- pCoefficients = (LVCS_Coefficient_t *)pInstance->pCoeff;
+ pData = (LVCS_Data_t*)pInstance->pData;
+ pCoefficients = (LVCS_Coefficient_t*)pInstance->pCoeff;
/*
* If the sample rate changes re-initialise the filters
*/
if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
- (pInstance->Params.SpeakerType != pParams->SpeakerType))
- {
+ (pInstance->Params.SpeakerType != pParams->SpeakerType)) {
/*
* Setup the filter coefficients and clear the history
*/
@@ -81,37 +77,35 @@
/* Left and right filters */
/* Convert incoming coefficients to the required format/ordering */
- Coeffs.A0 = (LVM_FLOAT) pEqualiserCoefTable[Offset].A0;
- Coeffs.A1 = (LVM_FLOAT) pEqualiserCoefTable[Offset].A1;
- Coeffs.A2 = (LVM_FLOAT) pEqualiserCoefTable[Offset].A2;
+ Coeffs.A0 = (LVM_FLOAT)pEqualiserCoefTable[Offset].A0;
+ Coeffs.A1 = (LVM_FLOAT)pEqualiserCoefTable[Offset].A1;
+ Coeffs.A2 = (LVM_FLOAT)pEqualiserCoefTable[Offset].A2;
Coeffs.B1 = (LVM_FLOAT)-pEqualiserCoefTable[Offset].B1;
Coeffs.B2 = (LVM_FLOAT)-pEqualiserCoefTable[Offset].B2;
- LoadConst_Float((LVM_INT16)0, /* Value */
- (LVM_FLOAT *)&pData->EqualiserBiquadTaps, /* Destination */
+ LoadConst_Float((LVM_INT16)0, /* Value */
+ (LVM_FLOAT*)&pData->EqualiserBiquadTaps, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->EqualiserBiquadTaps) / sizeof(LVM_FLOAT)));
BQ_2I_D16F32Css_TRC_WRA_01_Init(&pCoefficients->EqualiserBiquadInstance,
- &pData->EqualiserBiquadTaps,
- &Coeffs);
+ &pData->EqualiserBiquadTaps, &Coeffs);
/* Callbacks */
- switch(pEqualiserCoefTable[Offset].Scale)
- {
+ switch (pEqualiserCoefTable[Offset].Scale) {
case 13:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C13_TRC_WRA_01;
+ pConfig->pBiquadCallBack = BQ_2I_D16F32C13_TRC_WRA_01;
break;
case 14:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C14_TRC_WRA_01;
+ pConfig->pBiquadCallBack = BQ_2I_D16F32C14_TRC_WRA_01;
break;
case 15:
- pConfig->pBiquadCallBack = BQ_2I_D16F32C15_TRC_WRA_01;
+ pConfig->pBiquadCallBack = BQ_2I_D16F32C15_TRC_WRA_01;
break;
}
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
/************************************************************************************/
/* */
@@ -132,29 +126,23 @@
/* 1. Always processes in place. */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
- LVM_FLOAT *pInputOutput,
- LVM_UINT16 NumSamples)
-{
+LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance, LVM_FLOAT* 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_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_Equaliser_t *pConfig = (LVCS_Equaliser_t *)&pInstance->Equaliser;
- LVCS_Coefficient_t *pCoefficients;
-
- pCoefficients = (LVCS_Coefficient_t *)pInstance->pCoeff;
+ pCoefficients = (LVCS_Coefficient_t*)pInstance->pCoeff;
/*
* Check if the equaliser is required
*/
- if ((pInstance->Params.OperatingMode & LVCS_EQUALISERSWITCH) != 0)
- {
+ if ((pInstance->Params.OperatingMode & LVCS_EQUALISERSWITCH) != 0) {
/* Apply filter to the left and right channels */
- (pConfig->pBiquadCallBack)((Biquad_FLOAT_Instance_t*) \
- &pCoefficients->EqualiserBiquadInstance,
- (LVM_FLOAT *)pInputOutput,
- (LVM_FLOAT *)pInputOutput,
- (LVM_INT16)NumSamples);
+ (pConfig->pBiquadCallBack)(
+ (Biquad_FLOAT_Instance_t*)&pCoefficients->EqualiserBiquadInstance,
+ (LVM_FLOAT*)pInputOutput, (LVM_FLOAT*)pInputOutput, (LVM_INT16)NumSamples);
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
index 918d931..c0d0950 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.h
@@ -25,9 +25,8 @@
/************************************************************************************/
/* Equaliser structure */
-typedef struct
-{
- void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*, LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
+typedef struct {
+ void (*pBiquadCallBack)(Biquad_FLOAT_Instance_t*, LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
} LVCS_Equaliser_t;
/************************************************************************************/
@@ -36,10 +35,8 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams);
-LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance,
- LVM_FLOAT *pInputOutput,
- LVM_UINT16 NumSamples);
+LVCS_ReturnStatus_en LVCS_EqualiserInit(LVCS_Handle_t hInstance, LVCS_Params_t* pParams);
+LVCS_ReturnStatus_en LVCS_Equaliser(LVCS_Handle_t hInstance, LVM_FLOAT* pInputOutput,
+ LVM_UINT16 NumSamples);
-#endif /* EQUALISER_H */
+#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 c7ee232..69c46c6 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
@@ -24,201 +24,201 @@
/* */
/************************************************************************************/
/* 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)
-#define CS_MIDDLE_8000_A2 0.000000
-#define CS_MIDDLE_8000_B1 (-0.921899)
-#define CS_MIDDLE_8000_B2 0.000000
-#define CS_MIDDLE_8000_SCALE 15
-#define CS_SIDE_8000_A0 0.611441
-#define CS_SIDE_8000_A1 (-0.380344)
-#define CS_SIDE_8000_A2 (-0.231097)
-#define CS_SIDE_8000_B1 (-0.622470)
-#define CS_SIDE_8000_B2 (-0.130759)
-#define CS_SIDE_8000_SCALE 15
+#define CS_MIDDLE_8000_A0 0.227720
+#define CS_MIDDLE_8000_A1 (-0.215125)
+#define CS_MIDDLE_8000_A2 0.000000
+#define CS_MIDDLE_8000_B1 (-0.921899)
+#define CS_MIDDLE_8000_B2 0.000000
+#define CS_MIDDLE_8000_SCALE 15
+#define CS_SIDE_8000_A0 0.611441
+#define CS_SIDE_8000_A1 (-0.380344)
+#define CS_SIDE_8000_A2 (-0.231097)
+#define CS_SIDE_8000_B1 (-0.622470)
+#define CS_SIDE_8000_B2 (-0.130759)
+#define CS_SIDE_8000_SCALE 15
/* Stereo Enhancer coefficients for 11025Hz sample rate, scaled with 0.162943 */
-#define CS_MIDDLE_11025_A0 0.230838
-#define CS_MIDDLE_11025_A1 (-0.221559)
-#define CS_MIDDLE_11025_A2 0.000000
-#define CS_MIDDLE_11025_B1 (-0.943056)
-#define CS_MIDDLE_11025_B2 0.000000
-#define CS_MIDDLE_11025_SCALE 15
-#define CS_SIDE_11025_A0 0.557372
-#define CS_SIDE_11025_A1 (-0.391490)
-#define CS_SIDE_11025_A2 (-0.165881)
-#define CS_SIDE_11025_B1 (-0.880608)
-#define CS_SIDE_11025_B2 0.032397
-#define CS_SIDE_11025_SCALE 15
+#define CS_MIDDLE_11025_A0 0.230838
+#define CS_MIDDLE_11025_A1 (-0.221559)
+#define CS_MIDDLE_11025_A2 0.000000
+#define CS_MIDDLE_11025_B1 (-0.943056)
+#define CS_MIDDLE_11025_B2 0.000000
+#define CS_MIDDLE_11025_SCALE 15
+#define CS_SIDE_11025_A0 0.557372
+#define CS_SIDE_11025_A1 (-0.391490)
+#define CS_SIDE_11025_A2 (-0.165881)
+#define CS_SIDE_11025_B1 (-0.880608)
+#define CS_SIDE_11025_B2 0.032397
+#define CS_SIDE_11025_SCALE 15
/* Stereo Enhancer coefficients for 12000Hz sample rate, scaled with 0.162191 */
-#define CS_MIDDLE_12000_A0 0.229932
-#define CS_MIDDLE_12000_A1 (-0.221436)
-#define CS_MIDDLE_12000_A2 0.000000
-#define CS_MIDDLE_12000_B1 (-0.947616)
-#define CS_MIDDLE_12000_B2 0.000000
-#define CS_MIDDLE_12000_SCALE 15
-#define CS_SIDE_12000_A0 0.558398
-#define CS_SIDE_12000_A1 (-0.392211)
-#define CS_SIDE_12000_A2 (-0.166187)
-#define CS_SIDE_12000_B1 (-0.892550)
-#define CS_SIDE_12000_B2 0.032856
-#define CS_SIDE_12000_SCALE 15
+#define CS_MIDDLE_12000_A0 0.229932
+#define CS_MIDDLE_12000_A1 (-0.221436)
+#define CS_MIDDLE_12000_A2 0.000000
+#define CS_MIDDLE_12000_B1 (-0.947616)
+#define CS_MIDDLE_12000_B2 0.000000
+#define CS_MIDDLE_12000_SCALE 15
+#define CS_SIDE_12000_A0 0.558398
+#define CS_SIDE_12000_A1 (-0.392211)
+#define CS_SIDE_12000_A2 (-0.166187)
+#define CS_SIDE_12000_B1 (-0.892550)
+#define CS_SIDE_12000_B2 0.032856
+#define CS_SIDE_12000_SCALE 15
/* Stereo Enhancer coefficients for 16000Hz sample rate, scaled with 0.162371 */
-#define CS_MIDDLE_16000_A0 0.230638
-#define CS_MIDDLE_16000_A1 (-0.224232)
-#define CS_MIDDLE_16000_A2 0.000000
-#define CS_MIDDLE_16000_B1 (-0.960550)
-#define CS_MIDDLE_16000_B2 0.000000
-#define CS_MIDDLE_16000_SCALE 15
-#define CS_SIDE_16000_A0 0.499695
-#define CS_SIDE_16000_A1 (-0.355543)
-#define CS_SIDE_16000_A2 (-0.144152)
-#define CS_SIDE_16000_B1 (-1.050788)
-#define CS_SIDE_16000_B2 0.144104
-#define CS_SIDE_16000_SCALE 14
+#define CS_MIDDLE_16000_A0 0.230638
+#define CS_MIDDLE_16000_A1 (-0.224232)
+#define CS_MIDDLE_16000_A2 0.000000
+#define CS_MIDDLE_16000_B1 (-0.960550)
+#define CS_MIDDLE_16000_B2 0.000000
+#define CS_MIDDLE_16000_SCALE 15
+#define CS_SIDE_16000_A0 0.499695
+#define CS_SIDE_16000_A1 (-0.355543)
+#define CS_SIDE_16000_A2 (-0.144152)
+#define CS_SIDE_16000_B1 (-1.050788)
+#define CS_SIDE_16000_B2 0.144104
+#define CS_SIDE_16000_SCALE 14
/* Stereo Enhancer coefficients for 22050Hz sample rate, scaled with 0.160781 */
-#define CS_MIDDLE_22050_A0 0.228749
-#define CS_MIDDLE_22050_A1 (-0.224128)
-#define CS_MIDDLE_22050_A2 0.000000
-#define CS_MIDDLE_22050_B1 (-0.971262)
-#define CS_MIDDLE_22050_B2 0.000000
-#define CS_MIDDLE_22050_SCALE 15
-#define CS_SIDE_22050_A0 0.440112
-#define CS_SIDE_22050_A1 (-0.261096)
-#define CS_SIDE_22050_A2 (-0.179016)
-#define CS_SIDE_22050_B1 (-1.116786)
-#define CS_SIDE_22050_B2 0.182507
-#define CS_SIDE_22050_SCALE 14
+#define CS_MIDDLE_22050_A0 0.228749
+#define CS_MIDDLE_22050_A1 (-0.224128)
+#define CS_MIDDLE_22050_A2 0.000000
+#define CS_MIDDLE_22050_B1 (-0.971262)
+#define CS_MIDDLE_22050_B2 0.000000
+#define CS_MIDDLE_22050_SCALE 15
+#define CS_SIDE_22050_A0 0.440112
+#define CS_SIDE_22050_A1 (-0.261096)
+#define CS_SIDE_22050_A2 (-0.179016)
+#define CS_SIDE_22050_B1 (-1.116786)
+#define CS_SIDE_22050_B2 0.182507
+#define CS_SIDE_22050_SCALE 14
/* Stereo Enhancer coefficients for 24000Hz sample rate, scaled with 0.161882 */
-#define CS_MIDDLE_24000_A0 0.230395
-#define CS_MIDDLE_24000_A1 (-0.226117)
-#define CS_MIDDLE_24000_A2 0.000000
-#define CS_MIDDLE_24000_B1 (-0.973573)
-#define CS_MIDDLE_24000_B2 0.000000
-#define CS_MIDDLE_24000_SCALE 15
-#define CS_SIDE_24000_A0 0.414770
-#define CS_SIDE_24000_A1 (-0.287182)
-#define CS_SIDE_24000_A2 (-0.127588)
-#define CS_SIDE_24000_B1 (-1.229648)
-#define CS_SIDE_24000_B2 0.282177
-#define CS_SIDE_24000_SCALE 14
+#define CS_MIDDLE_24000_A0 0.230395
+#define CS_MIDDLE_24000_A1 (-0.226117)
+#define CS_MIDDLE_24000_A2 0.000000
+#define CS_MIDDLE_24000_B1 (-0.973573)
+#define CS_MIDDLE_24000_B2 0.000000
+#define CS_MIDDLE_24000_SCALE 15
+#define CS_SIDE_24000_A0 0.414770
+#define CS_SIDE_24000_A1 (-0.287182)
+#define CS_SIDE_24000_A2 (-0.127588)
+#define CS_SIDE_24000_B1 (-1.229648)
+#define CS_SIDE_24000_B2 0.282177
+#define CS_SIDE_24000_SCALE 14
/* Stereo Enhancer coefficients for 32000Hz sample rate, scaled with 0.160322 */
-#define CS_MIDDLE_32000_A0 0.228400
-#define CS_MIDDLE_32000_A1 (-0.225214)
-#define CS_MIDDLE_32000_A2 0.000000
-#define CS_MIDDLE_32000_B1 (-0.980126)
-#define CS_MIDDLE_32000_B2 0.000000
-#define CS_MIDDLE_32000_SCALE 15
-#define CS_SIDE_32000_A0 0.364579
-#define CS_SIDE_32000_A1 (-0.207355)
-#define CS_SIDE_32000_A2 (-0.157224)
-#define CS_SIDE_32000_B1 (-1.274231)
-#define CS_SIDE_32000_B2 0.312495
-#define CS_SIDE_32000_SCALE 14
+#define CS_MIDDLE_32000_A0 0.228400
+#define CS_MIDDLE_32000_A1 (-0.225214)
+#define CS_MIDDLE_32000_A2 0.000000
+#define CS_MIDDLE_32000_B1 (-0.980126)
+#define CS_MIDDLE_32000_B2 0.000000
+#define CS_MIDDLE_32000_SCALE 15
+#define CS_SIDE_32000_A0 0.364579
+#define CS_SIDE_32000_A1 (-0.207355)
+#define CS_SIDE_32000_A2 (-0.157224)
+#define CS_SIDE_32000_B1 (-1.274231)
+#define CS_SIDE_32000_B2 0.312495
+#define CS_SIDE_32000_SCALE 14
/* Stereo Enhancer coefficients for 44100Hz sample rate, scaled with 0.163834 */
-#define CS_MIDDLE_44100_A0 0.233593
-#define CS_MIDDLE_44100_A1 (-0.231225)
-#define CS_MIDDLE_44100_A2 0.000000
-#define CS_MIDDLE_44100_B1 (-0.985545)
-#define CS_MIDDLE_44100_B2 0.000000
-#define CS_MIDDLE_44100_SCALE 15
-#define CS_SIDE_44100_A0 0.284573
-#define CS_SIDE_44100_A1 (-0.258910)
-#define CS_SIDE_44100_A2 (-0.025662)
-#define CS_SIDE_44100_B1 (-1.572248)
-#define CS_SIDE_44100_B2 0.588399
-#define CS_SIDE_44100_SCALE 14
+#define CS_MIDDLE_44100_A0 0.233593
+#define CS_MIDDLE_44100_A1 (-0.231225)
+#define CS_MIDDLE_44100_A2 0.000000
+#define CS_MIDDLE_44100_B1 (-0.985545)
+#define CS_MIDDLE_44100_B2 0.000000
+#define CS_MIDDLE_44100_SCALE 15
+#define CS_SIDE_44100_A0 0.284573
+#define CS_SIDE_44100_A1 (-0.258910)
+#define CS_SIDE_44100_A2 (-0.025662)
+#define CS_SIDE_44100_B1 (-1.572248)
+#define CS_SIDE_44100_B2 0.588399
+#define CS_SIDE_44100_SCALE 14
/* Stereo Enhancer coefficients for 48000Hz sample rate, scaled with 0.164402 */
-#define CS_MIDDLE_48000_A0 0.234445
-#define CS_MIDDLE_48000_A1 (-0.232261)
-#define CS_MIDDLE_48000_A2 0.000000
-#define CS_MIDDLE_48000_B1 (-0.986713)
-#define CS_MIDDLE_48000_B2 0.000000
-#define CS_MIDDLE_48000_SCALE 15
-#define CS_SIDE_48000_A0 0.272606
-#define CS_SIDE_48000_A1 (-0.266952)
-#define CS_SIDE_48000_A2 (-0.005654)
-#define CS_SIDE_48000_B1 (-1.617141)
-#define CS_SIDE_48000_B2 0.630405
-#define CS_SIDE_48000_SCALE 14
+#define CS_MIDDLE_48000_A0 0.234445
+#define CS_MIDDLE_48000_A1 (-0.232261)
+#define CS_MIDDLE_48000_A2 0.000000
+#define CS_MIDDLE_48000_B1 (-0.986713)
+#define CS_MIDDLE_48000_B2 0.000000
+#define CS_MIDDLE_48000_SCALE 15
+#define CS_SIDE_48000_A0 0.272606
+#define CS_SIDE_48000_A1 (-0.266952)
+#define CS_SIDE_48000_A2 (-0.005654)
+#define CS_SIDE_48000_B1 (-1.617141)
+#define CS_SIDE_48000_B2 0.630405
+#define CS_SIDE_48000_SCALE 14
/* Coefficients for 88200Hz sample rate.
* The filter coefficients are obtained by carrying out
* state-space analysis using the coefficients available
* for 44100Hz.
*/
-#define CS_MIDDLE_88200_A0 0.233846f
-#define CS_MIDDLE_88200_A1 (-0.232657f)
-#define CS_MIDDLE_88200_A2 0.000000f
-#define CS_MIDDLE_88200_B1 (-0.992747f)
-#define CS_MIDDLE_88200_B2 0.000000f
-#define CS_MIDDLE_88200_SCALE 15
-#define CS_SIDE_88200_A0 0.231541f
-#define CS_SIDE_88200_A1 (-0.289586f)
-#define CS_SIDE_88200_A2 0.058045f
-#define CS_SIDE_88200_B1 (-1.765300f)
-#define CS_SIDE_88200_B2 0.769816f
-#define CS_SIDE_88200_SCALE 14
+#define CS_MIDDLE_88200_A0 0.233846f
+#define CS_MIDDLE_88200_A1 (-0.232657f)
+#define CS_MIDDLE_88200_A2 0.000000f
+#define CS_MIDDLE_88200_B1 (-0.992747f)
+#define CS_MIDDLE_88200_B2 0.000000f
+#define CS_MIDDLE_88200_SCALE 15
+#define CS_SIDE_88200_A0 0.231541f
+#define CS_SIDE_88200_A1 (-0.289586f)
+#define CS_SIDE_88200_A2 0.058045f
+#define CS_SIDE_88200_B1 (-1.765300f)
+#define CS_SIDE_88200_B2 0.769816f
+#define CS_SIDE_88200_SCALE 14
/* Stereo Enhancer coefficients for 96000Hz sample rate, scaled with 0.165*/
/* high pass filter with cutoff frequency 102.18 Hz*/
-#define CS_MIDDLE_96000_A0 0.235532
-#define CS_MIDDLE_96000_A1 (-0.234432)
-#define CS_MIDDLE_96000_A2 0.000000
-#define CS_MIDDLE_96000_B1 (-0.993334)
-#define CS_MIDDLE_96000_B2 0.000000
-#define CS_MIDDLE_96000_SCALE 15
+#define CS_MIDDLE_96000_A0 0.235532
+#define CS_MIDDLE_96000_A1 (-0.234432)
+#define CS_MIDDLE_96000_A2 0.000000
+#define CS_MIDDLE_96000_B1 (-0.993334)
+#define CS_MIDDLE_96000_B2 0.000000
+#define CS_MIDDLE_96000_SCALE 15
/* Coefficients calculated using tf2ss and ss2tf functions based on
* coefficients available for 48000Hz sampling frequency
*/
-#define CS_SIDE_96000_A0 0.224326f
-#define CS_SIDE_96000_A1 (-0.294937f)
-#define CS_SIDE_96000_A2 0.070611f
-#define CS_SIDE_96000_B1 (-1.792166f)
-#define CS_SIDE_96000_B2 0.795830f
-#define CS_SIDE_96000_SCALE 14
+#define CS_SIDE_96000_A0 0.224326f
+#define CS_SIDE_96000_A1 (-0.294937f)
+#define CS_SIDE_96000_A2 0.070611f
+#define CS_SIDE_96000_B1 (-1.792166f)
+#define CS_SIDE_96000_B2 0.795830f
+#define CS_SIDE_96000_SCALE 14
/* Stereo Enhancer coefficients for 176400Hz sample rate.
* The filter coefficients are obtained by carrying out
* state-space analysis using the coefficients available
* for 44100Hz.
*/
-#define CS_MIDDLE_176400_A0 0.233973f
-#define CS_MIDDLE_176400_A1 (-0.233378f)
-#define CS_MIDDLE_176400_A2 0.000000f
-#define CS_MIDDLE_176400_B1 (-0.996367f)
-#define CS_MIDDLE_176400_B2 0.000000f
-#define CS_MIDDLE_176400_SCALE 15
-#define CS_SIDE_176400_A0 0.199836f
-#define CS_SIDE_176400_A1 (-0.307544f)
-#define CS_SIDE_176400_A2 0.107708f
-#define CS_SIDE_176400_B1 (-1.876572f)
-#define CS_SIDE_176400_B2 0.877771f
-#define CS_SIDE_176400_SCALE 14
+#define CS_MIDDLE_176400_A0 0.233973f
+#define CS_MIDDLE_176400_A1 (-0.233378f)
+#define CS_MIDDLE_176400_A2 0.000000f
+#define CS_MIDDLE_176400_B1 (-0.996367f)
+#define CS_MIDDLE_176400_B2 0.000000f
+#define CS_MIDDLE_176400_SCALE 15
+#define CS_SIDE_176400_A0 0.199836f
+#define CS_SIDE_176400_A1 (-0.307544f)
+#define CS_SIDE_176400_A2 0.107708f
+#define CS_SIDE_176400_B1 (-1.876572f)
+#define CS_SIDE_176400_B2 0.877771f
+#define CS_SIDE_176400_SCALE 14
/* Stereo Enhancer coefficients for 192000Hz sample rate, scaled with 0.1689*/
-#define CS_MIDDLE_192000_A0 0.241219
-#define CS_MIDDLE_192000_A1 (-0.240656)
-#define CS_MIDDLE_192000_A2 0.000000
-#define CS_MIDDLE_192000_B1 (-0.996661)
-#define CS_MIDDLE_192000_B2 0.000000
-#define CS_MIDDLE_192000_SCALE 15
+#define CS_MIDDLE_192000_A0 0.241219
+#define CS_MIDDLE_192000_A1 (-0.240656)
+#define CS_MIDDLE_192000_A2 0.000000
+#define CS_MIDDLE_192000_B1 (-0.996661)
+#define CS_MIDDLE_192000_B2 0.000000
+#define CS_MIDDLE_192000_SCALE 15
/* Coefficients calculated using tf2ss and ss2tf functions based on
* coefficients available for 48000Hz sampling frequency
*/
-#define CS_SIDE_192000_A0 0.196039f
-#define CS_SIDE_192000_A1 (-0.311027f)
-#define CS_SIDE_192000_A2 0.114988f
-#define CS_SIDE_192000_B1 (-1.891380f)
-#define CS_SIDE_192000_B2 0.8923460f
-#define CS_SIDE_192000_SCALE 14
+#define CS_SIDE_192000_A0 0.196039f
+#define CS_SIDE_192000_A1 (-0.311027f)
+#define CS_SIDE_192000_A2 0.114988f
+#define CS_SIDE_192000_B1 (-1.891380f)
+#define CS_SIDE_192000_B2 0.8923460f
+#define CS_SIDE_192000_SCALE 14
/************************************************************************************/
/* */
@@ -227,133 +227,133 @@
/************************************************************************************/
/* 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 557 /* Sample rate 48kS/s */
-#define LVCS_STEREODELAY_CS_88KHZ 1024 /* Sample rate 88.2kS/s */
-#define LVCS_STEREODELAY_CS_96KHZ 1115 /* Sample rate 96kS/s */
-#define LVCS_STEREODELAY_CS_176KHZ 2048 /* Sample rate 176.4kS/s */
-#define LVCS_STEREODELAY_CS_192KHZ 2229 /* Sample rate 196kS/s */
-#define LVCS_STEREODELAY_CS_MAX_VAL LVCS_STEREODELAY_CS_192KHZ
+#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 557 /* Sample rate 48kS/s */
+#define LVCS_STEREODELAY_CS_88KHZ 1024 /* Sample rate 88.2kS/s */
+#define LVCS_STEREODELAY_CS_96KHZ 1115 /* Sample rate 96kS/s */
+#define LVCS_STEREODELAY_CS_176KHZ 2048 /* Sample rate 176.4kS/s */
+#define LVCS_STEREODELAY_CS_192KHZ 2229 /* Sample rate 196kS/s */
+#define LVCS_STEREODELAY_CS_MAX_VAL LVCS_STEREODELAY_CS_192KHZ
/* Reverb coefficients for 8000 Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_8000_A0 0.667271
-#define CS_REVERB_8000_A1 (-0.667271)
-#define CS_REVERB_8000_A2 0.000000
-#define CS_REVERB_8000_B1 (-0.668179)
-#define CS_REVERB_8000_B2 0.000000
-#define CS_REVERB_8000_SCALE 15
+#define CS_REVERB_8000_A0 0.667271
+#define CS_REVERB_8000_A1 (-0.667271)
+#define CS_REVERB_8000_A2 0.000000
+#define CS_REVERB_8000_B1 (-0.668179)
+#define CS_REVERB_8000_B2 0.000000
+#define CS_REVERB_8000_SCALE 15
/* Reverb coefficients for 11025Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_11025_A0 0.699638
-#define CS_REVERB_11025_A1 (-0.699638)
-#define CS_REVERB_11025_A2 0.000000
-#define CS_REVERB_11025_B1 (-0.749096)
-#define CS_REVERB_11025_B2 0.000000
-#define CS_REVERB_11025_SCALE 15
+#define CS_REVERB_11025_A0 0.699638
+#define CS_REVERB_11025_A1 (-0.699638)
+#define CS_REVERB_11025_A2 0.000000
+#define CS_REVERB_11025_B1 (-0.749096)
+#define CS_REVERB_11025_B2 0.000000
+#define CS_REVERB_11025_SCALE 15
/* Reverb coefficients for 12000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_12000_A0 0.706931
-#define CS_REVERB_12000_A1 (-0.706931)
-#define CS_REVERB_12000_A2 0.000000
-#define CS_REVERB_12000_B1 (-0.767327)
-#define CS_REVERB_12000_B2 0.000000
-#define CS_REVERB_12000_SCALE 15
+#define CS_REVERB_12000_A0 0.706931
+#define CS_REVERB_12000_A1 (-0.706931)
+#define CS_REVERB_12000_A2 0.000000
+#define CS_REVERB_12000_B1 (-0.767327)
+#define CS_REVERB_12000_B2 0.000000
+#define CS_REVERB_12000_SCALE 15
/* Reverb coefficients for 16000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_16000_A0 0.728272
-#define CS_REVERB_16000_A1 (-0.728272)
-#define CS_REVERB_16000_A2 0.000000
-#define CS_REVERB_16000_B1 (-0.820679)
-#define CS_REVERB_16000_B2 0.000000
-#define CS_REVERB_16000_SCALE 15
+#define CS_REVERB_16000_A0 0.728272
+#define CS_REVERB_16000_A1 (-0.728272)
+#define CS_REVERB_16000_A2 0.000000
+#define CS_REVERB_16000_B1 (-0.820679)
+#define CS_REVERB_16000_B2 0.000000
+#define CS_REVERB_16000_SCALE 15
/* Reverb coefficients for 22050Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_22050_A0 0.516396
-#define CS_REVERB_22050_A1 0.000000
-#define CS_REVERB_22050_A2 (-0.516396)
-#define CS_REVERB_22050_B1 (-0.518512)
-#define CS_REVERB_22050_B2 (-0.290990)
-#define CS_REVERB_22050_SCALE 15
+#define CS_REVERB_22050_A0 0.516396
+#define CS_REVERB_22050_A1 0.000000
+#define CS_REVERB_22050_A2 (-0.516396)
+#define CS_REVERB_22050_B1 (-0.518512)
+#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
-#define CS_REVERB_24000_A2 (-0.479565)
-#define CS_REVERB_24000_B1 (-0.637745)
-#define CS_REVERB_24000_B2 (-0.198912)
-#define CS_REVERB_24000_SCALE 15
+#define CS_REVERB_24000_A0 0.479565
+#define CS_REVERB_24000_A1 0.000000
+#define CS_REVERB_24000_A2 (-0.479565)
+#define CS_REVERB_24000_B1 (-0.637745)
+#define CS_REVERB_24000_B2 (-0.198912)
+#define CS_REVERB_24000_SCALE 15
/* Reverb coefficients for 32000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_32000_A0 0.380349
-#define CS_REVERB_32000_A1 0.000000
-#define CS_REVERB_32000_A2 (-0.380349)
-#define CS_REVERB_32000_B1 (-0.950873)
-#define CS_REVERB_32000_B2 0.049127
-#define CS_REVERB_32000_SCALE 15
+#define CS_REVERB_32000_A0 0.380349
+#define CS_REVERB_32000_A1 0.000000
+#define CS_REVERB_32000_A2 (-0.380349)
+#define CS_REVERB_32000_B1 (-0.950873)
+#define CS_REVERB_32000_B2 0.049127
+#define CS_REVERB_32000_SCALE 15
/* Reverb coefficients for 44100Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_44100_A0 0.297389
-#define CS_REVERB_44100_A1 0.000000
-#define CS_REVERB_44100_A2 (-0.297389)
-#define CS_REVERB_44100_B1 (-1.200423)
-#define CS_REVERB_44100_B2 0.256529
-#define CS_REVERB_44100_SCALE 14
+#define CS_REVERB_44100_A0 0.297389
+#define CS_REVERB_44100_A1 0.000000
+#define CS_REVERB_44100_A2 (-0.297389)
+#define CS_REVERB_44100_B1 (-1.200423)
+#define CS_REVERB_44100_B2 0.256529
+#define CS_REVERB_44100_SCALE 14
/* Reverb coefficients for 48000Hz sample rate, scaled with 1.038030 */
-#define CS_REVERB_48000_A0 0.278661
-#define CS_REVERB_48000_A1 0.000000
-#define CS_REVERB_48000_A2 (-0.278661)
-#define CS_REVERB_48000_B1 (-1.254993)
-#define CS_REVERB_48000_B2 0.303347
-#define CS_REVERB_48000_SCALE 14
+#define CS_REVERB_48000_A0 0.278661
+#define CS_REVERB_48000_A1 0.000000
+#define CS_REVERB_48000_A2 (-0.278661)
+#define CS_REVERB_48000_B1 (-1.254993)
+#define CS_REVERB_48000_B2 0.303347
+#define CS_REVERB_48000_SCALE 14
/* 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
-#define CS_REVERB_88200_A1 0.000000f
-#define CS_REVERB_88200_A2 (-0.171901f)
-#define CS_REVERB_88200_B1 (-1.553948f)
-#define CS_REVERB_88200_B2 (0.570248f)
-#define CS_REVERB_88200_SCALE 14
+#define CS_REVERB_88200_A0 0.171901f
+#define CS_REVERB_88200_A1 0.000000f
+#define CS_REVERB_88200_A2 (-0.171901f)
+#define CS_REVERB_88200_B1 (-1.553948f)
+#define CS_REVERB_88200_B2 (0.570248f)
+#define CS_REVERB_88200_SCALE 14
/* Reverb coefficients for 96000Hz sample rate, scaled with 0.8 */
/* Band pass filter with fc1=500 and fc2=8000*/
-#define CS_REVERB_96000_A0 0.1602488
-#define CS_REVERB_96000_A1 0.000000
-#define CS_REVERB_96000_A2 (-0.1602488)
-#define CS_REVERB_96000_B1 (-1.585413)
-#define CS_REVERB_96000_B2 0.599377
-#define CS_REVERB_96000_SCALE 14
+#define CS_REVERB_96000_A0 0.1602488
+#define CS_REVERB_96000_A1 0.000000
+#define CS_REVERB_96000_A2 (-0.1602488)
+#define CS_REVERB_96000_B1 (-1.585413)
+#define CS_REVERB_96000_B2 0.599377
+#define CS_REVERB_96000_SCALE 14
/* Reverb coefficients for 176400Hz sample rate, scaled with 0.8 */
/* Band pass filter with fc1=500 and fc2=8000 */
-#define CS_REVERB_176400_A0 0.094763f
-#define CS_REVERB_176400_A1 0.000000f
-#define CS_REVERB_176400_A2 (-0.094763f)
-#define CS_REVERB_176400_B1 (-1.758593f)
-#define CS_REVERB_176400_B2 (0.763091f)
-#define CS_REVERB_176400_SCALE 14
+#define CS_REVERB_176400_A0 0.094763f
+#define CS_REVERB_176400_A1 0.000000f
+#define CS_REVERB_176400_A2 (-0.094763f)
+#define CS_REVERB_176400_B1 (-1.758593f)
+#define CS_REVERB_176400_B2 (0.763091f)
+#define CS_REVERB_176400_SCALE 14
/* Reverb coefficients for 192000Hz sample rate, scaled with 0.8 */
/* Band pass filter with fc1=500 and fc2=8000*/
-#define CS_REVERB_192000_A0 0.0878369
-#define CS_REVERB_192000_A1 0.000000
-#define CS_REVERB_192000_A2 (-0.0878369)
-#define CS_REVERB_192000_B1 (-1.7765764)
-#define CS_REVERB_192000_B2 0.7804076
-#define CS_REVERB_192000_SCALE 14
+#define CS_REVERB_192000_A0 0.0878369
+#define CS_REVERB_192000_A1 0.000000
+#define CS_REVERB_192000_A2 (-0.0878369)
+#define CS_REVERB_192000_B1 (-1.7765764)
+#define CS_REVERB_192000_B2 0.7804076
+#define CS_REVERB_192000_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 */
+#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 */
/************************************************************************************/
/* */
@@ -363,205 +363,204 @@
/* Equaliser coefficients for 8000 Hz sample rate, \
CS scaled with 1.038497 and CSEX scaled with 0.775480 */
-#define CS_EQUALISER_8000_A0 1.263312
-#define CS_EQUALISER_8000_A1 (-0.601748)
-#define CS_EQUALISER_8000_A2 (-0.280681)
-#define CS_EQUALISER_8000_B1 (-0.475865)
-#define CS_EQUALISER_8000_B2 (-0.408154)
-#define CS_EQUALISER_8000_SCALE 14
-#define CSEX_EQUALISER_8000_A0 0.943357
-#define CSEX_EQUALISER_8000_A1 (-0.449345)
-#define CSEX_EQUALISER_8000_A2 (-0.209594)
-#define CSEX_EQUALISER_8000_B1 (-0.475865)
-#define CSEX_EQUALISER_8000_B2 (-0.408154)
-#define CSEX_EQUALISER_8000_SCALE 15
+#define CS_EQUALISER_8000_A0 1.263312
+#define CS_EQUALISER_8000_A1 (-0.601748)
+#define CS_EQUALISER_8000_A2 (-0.280681)
+#define CS_EQUALISER_8000_B1 (-0.475865)
+#define CS_EQUALISER_8000_B2 (-0.408154)
+#define CS_EQUALISER_8000_SCALE 14
+#define CSEX_EQUALISER_8000_A0 0.943357
+#define CSEX_EQUALISER_8000_A1 (-0.449345)
+#define CSEX_EQUALISER_8000_A2 (-0.209594)
+#define CSEX_EQUALISER_8000_B1 (-0.475865)
+#define CSEX_EQUALISER_8000_B2 (-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 1.101145
-#define CS_EQUALISER_11025_A1 0.139020
-#define CS_EQUALISER_11025_A2 (-0.864423)
-#define CS_EQUALISER_11025_B1 0.024541
-#define CS_EQUALISER_11025_B2 (-0.908930)
-#define CS_EQUALISER_11025_SCALE 14
-#define CSEX_EQUALISER_11025_A0 0.976058
-#define CSEX_EQUALISER_11025_A1 (-0.695326)
-#define CSEX_EQUALISER_11025_A2 (-0.090809)
-#define CSEX_EQUALISER_11025_B1 (-0.610594)
-#define CSEX_EQUALISER_11025_B2 (-0.311149)
-#define CSEX_EQUALISER_11025_SCALE 15
+#define CS_EQUALISER_11025_A0 1.101145
+#define CS_EQUALISER_11025_A1 0.139020
+#define CS_EQUALISER_11025_A2 (-0.864423)
+#define CS_EQUALISER_11025_B1 0.024541
+#define CS_EQUALISER_11025_B2 (-0.908930)
+#define CS_EQUALISER_11025_SCALE 14
+#define CSEX_EQUALISER_11025_A0 0.976058
+#define CSEX_EQUALISER_11025_A1 (-0.695326)
+#define CSEX_EQUALISER_11025_A2 (-0.090809)
+#define CSEX_EQUALISER_11025_B1 (-0.610594)
+#define CSEX_EQUALISER_11025_B2 (-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 1.276661
-#define CS_EQUALISER_12000_A1 (-1.017519)
-#define CS_EQUALISER_12000_A2 (-0.044128)
-#define CS_EQUALISER_12000_B1 (-0.729616)
-#define CS_EQUALISER_12000_B2 (-0.204532)
-#define CS_EQUALISER_12000_SCALE 14
-#define CSEX_EQUALISER_12000_A0 1.007095
-#define CSEX_EQUALISER_12000_A1 (-0.871912)
-#define CSEX_EQUALISER_12000_A2 0.023232
-#define CSEX_EQUALISER_12000_B1 (-0.745857)
-#define CSEX_EQUALISER_12000_B2 (-0.189171)
-#define CSEX_EQUALISER_12000_SCALE 14
+#define CS_EQUALISER_12000_A0 1.276661
+#define CS_EQUALISER_12000_A1 (-1.017519)
+#define CS_EQUALISER_12000_A2 (-0.044128)
+#define CS_EQUALISER_12000_B1 (-0.729616)
+#define CS_EQUALISER_12000_B2 (-0.204532)
+#define CS_EQUALISER_12000_SCALE 14
+#define CSEX_EQUALISER_12000_A0 1.007095
+#define CSEX_EQUALISER_12000_A1 (-0.871912)
+#define CSEX_EQUALISER_12000_A2 0.023232
+#define CSEX_EQUALISER_12000_B1 (-0.745857)
+#define CSEX_EQUALISER_12000_B2 (-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 1.281629
-#define CS_EQUALISER_16000_A1 (-1.075872)
-#define CS_EQUALISER_16000_A2 (-0.041365)
-#define CS_EQUALISER_16000_B1 (-0.725239)
-#define CS_EQUALISER_16000_B2 (-0.224358)
-#define CS_EQUALISER_16000_SCALE 14
-#define CSEX_EQUALISER_16000_A0 1.081091
-#define CSEX_EQUALISER_16000_A1 (-0.867183)
-#define CSEX_EQUALISER_16000_A2 (-0.070247)
-#define CSEX_EQUALISER_16000_B1 (-0.515121)
-#define CSEX_EQUALISER_16000_B2 (-0.425893)
-#define CSEX_EQUALISER_16000_SCALE 14
+#define CS_EQUALISER_16000_A0 1.281629
+#define CS_EQUALISER_16000_A1 (-1.075872)
+#define CS_EQUALISER_16000_A2 (-0.041365)
+#define CS_EQUALISER_16000_B1 (-0.725239)
+#define CS_EQUALISER_16000_B2 (-0.224358)
+#define CS_EQUALISER_16000_SCALE 14
+#define CSEX_EQUALISER_16000_A0 1.081091
+#define CSEX_EQUALISER_16000_A1 (-0.867183)
+#define CSEX_EQUALISER_16000_A2 (-0.070247)
+#define CSEX_EQUALISER_16000_B1 (-0.515121)
+#define CSEX_EQUALISER_16000_B2 (-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 1.388605
-#define CS_EQUALISER_22050_A1 (-1.305799)
-#define CS_EQUALISER_22050_A2 0.039922
-#define CS_EQUALISER_22050_B1 (-0.719494)
-#define CS_EQUALISER_22050_B2 (-0.243245)
-#define CS_EQUALISER_22050_SCALE 14
-#define CSEX_EQUALISER_22050_A0 1.272910
-#define CSEX_EQUALISER_22050_A1 (-1.341014)
-#define CSEX_EQUALISER_22050_A2 0.167462
-#define CSEX_EQUALISER_22050_B1 (-0.614219)
-#define CSEX_EQUALISER_22050_B2 (-0.345384)
-#define CSEX_EQUALISER_22050_SCALE 14
+#define CS_EQUALISER_22050_A0 1.388605
+#define CS_EQUALISER_22050_A1 (-1.305799)
+#define CS_EQUALISER_22050_A2 0.039922
+#define CS_EQUALISER_22050_B1 (-0.719494)
+#define CS_EQUALISER_22050_B2 (-0.243245)
+#define CS_EQUALISER_22050_SCALE 14
+#define CSEX_EQUALISER_22050_A0 1.272910
+#define CSEX_EQUALISER_22050_A1 (-1.341014)
+#define CSEX_EQUALISER_22050_A2 0.167462
+#define CSEX_EQUALISER_22050_B1 (-0.614219)
+#define CSEX_EQUALISER_22050_B2 (-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 1.409832
-#define CS_EQUALISER_24000_A1 (-1.456506)
-#define CS_EQUALISER_24000_A2 0.151410
-#define CS_EQUALISER_24000_B1 (-0.804201)
-#define CS_EQUALISER_24000_B2 (-0.163783)
-#define CS_EQUALISER_24000_SCALE 14
-#define CSEX_EQUALISER_24000_A0 1.299198
-#define CSEX_EQUALISER_24000_A1 (-1.452447)
-#define CSEX_EQUALISER_24000_A2 0.240489
-#define CSEX_EQUALISER_24000_B1 (-0.669303)
-#define CSEX_EQUALISER_24000_B2 (-0.294984)
-#define CSEX_EQUALISER_24000_SCALE 14
+#define CS_EQUALISER_24000_A0 1.409832
+#define CS_EQUALISER_24000_A1 (-1.456506)
+#define CS_EQUALISER_24000_A2 0.151410
+#define CS_EQUALISER_24000_B1 (-0.804201)
+#define CS_EQUALISER_24000_B2 (-0.163783)
+#define CS_EQUALISER_24000_SCALE 14
+#define CSEX_EQUALISER_24000_A0 1.299198
+#define CSEX_EQUALISER_24000_A1 (-1.452447)
+#define CSEX_EQUALISER_24000_A2 0.240489
+#define CSEX_EQUALISER_24000_B1 (-0.669303)
+#define CSEX_EQUALISER_24000_B2 (-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 1.560988
-#define CS_EQUALISER_32000_A1 (-1.877724)
-#define CS_EQUALISER_32000_A2 0.389741
-#define CS_EQUALISER_32000_B1 (-0.907410)
-#define CS_EQUALISER_32000_B2 (-0.070489)
-#define CS_EQUALISER_32000_SCALE 14
-#define CSEX_EQUALISER_32000_A0 1.785049
-#define CSEX_EQUALISER_32000_A1 (-2.233497)
-#define CSEX_EQUALISER_32000_A2 0.526431
-#define CSEX_EQUALISER_32000_B1 (-0.445939)
-#define CSEX_EQUALISER_32000_B2 (-0.522446)
-#define CSEX_EQUALISER_32000_SCALE 13
+#define CS_EQUALISER_32000_A0 1.560988
+#define CS_EQUALISER_32000_A1 (-1.877724)
+#define CS_EQUALISER_32000_A2 0.389741
+#define CS_EQUALISER_32000_B1 (-0.907410)
+#define CS_EQUALISER_32000_B2 (-0.070489)
+#define CS_EQUALISER_32000_SCALE 14
+#define CSEX_EQUALISER_32000_A0 1.785049
+#define CSEX_EQUALISER_32000_A1 (-2.233497)
+#define CSEX_EQUALISER_32000_A2 0.526431
+#define CSEX_EQUALISER_32000_B1 (-0.445939)
+#define CSEX_EQUALISER_32000_B2 (-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 1.623993
-#define CS_EQUALISER_44100_A1 (-2.270743)
-#define CS_EQUALISER_44100_A2 0.688829
-#define CS_EQUALISER_44100_B1 (-1.117190)
-#define CS_EQUALISER_44100_B2 0.130208
-#define CS_EQUALISER_44100_SCALE 13
-#define CSEX_EQUALISER_44100_A0 2.028315
-#define CSEX_EQUALISER_44100_A1 (-2.882459)
-#define CSEX_EQUALISER_44100_A2 0.904535
-#define CSEX_EQUALISER_44100_B1 (-0.593308)
-#define CSEX_EQUALISER_44100_B2 (-0.385816)
-#define CSEX_EQUALISER_44100_SCALE 13
+#define CS_EQUALISER_44100_A0 1.623993
+#define CS_EQUALISER_44100_A1 (-2.270743)
+#define CS_EQUALISER_44100_A2 0.688829
+#define CS_EQUALISER_44100_B1 (-1.117190)
+#define CS_EQUALISER_44100_B2 0.130208
+#define CS_EQUALISER_44100_SCALE 13
+#define CSEX_EQUALISER_44100_A0 2.028315
+#define CSEX_EQUALISER_44100_A1 (-2.882459)
+#define CSEX_EQUALISER_44100_A2 0.904535
+#define CSEX_EQUALISER_44100_B1 (-0.593308)
+#define CSEX_EQUALISER_44100_B2 (-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 1.641177
-#define CS_EQUALISER_48000_A1 (-2.364687)
-#define CS_EQUALISER_48000_A2 0.759910
-#define CS_EQUALISER_48000_B1 (-1.166774)
-#define CS_EQUALISER_48000_B2 0.178074
-#define CS_EQUALISER_48000_SCALE 13
-#define CSEX_EQUALISER_48000_A0 2.099655
-#define CSEX_EQUALISER_48000_A1 (-3.065220)
-#define CSEX_EQUALISER_48000_A2 1.010417
-#define CSEX_EQUALISER_48000_B1 (-0.634021)
-#define CSEX_EQUALISER_48000_B2 (-0.347332)
-#define CSEX_EQUALISER_48000_SCALE 13
+#define CS_EQUALISER_48000_A0 1.641177
+#define CS_EQUALISER_48000_A1 (-2.364687)
+#define CS_EQUALISER_48000_A2 0.759910
+#define CS_EQUALISER_48000_B1 (-1.166774)
+#define CS_EQUALISER_48000_B2 0.178074
+#define CS_EQUALISER_48000_SCALE 13
+#define CSEX_EQUALISER_48000_A0 2.099655
+#define CSEX_EQUALISER_48000_A1 (-3.065220)
+#define CSEX_EQUALISER_48000_A2 1.010417
+#define CSEX_EQUALISER_48000_B1 (-0.634021)
+#define CSEX_EQUALISER_48000_B2 (-0.347332)
+#define CSEX_EQUALISER_48000_SCALE 13
/* Equaliser coefficients for 88200Hz sample rate.
* The filter coefficients are obtained by carrying out
* state-space analysis using the coefficients available
* for 44100Hz.
*/
-#define CS_EQUALISER_88200_A0 1.771899f
-#define CS_EQUALISER_88200_A1 (-2.930762f)
-#define CS_EQUALISER_88200_A2 1.172175f
-#define CS_EQUALISER_88200_B1 (-1.438349f)
-#define CS_EQUALISER_88200_B2 0.442520f
-#define CS_EQUALISER_88200_SCALE 13
-#define CSEX_EQUALISER_88200_A0 2.675241f
-#define CSEX_EQUALISER_88200_A1 (-4.466154f)
-#define CSEX_EQUALISER_88200_A2 1.810305f
-#define CSEX_EQUALISER_88200_B1 (-0.925350f)
-#define CSEX_EQUALISER_88200_B2 (-0.066616f)
-#define CSEX_EQUALISER_88200_SCALE 13
+#define CS_EQUALISER_88200_A0 1.771899f
+#define CS_EQUALISER_88200_A1 (-2.930762f)
+#define CS_EQUALISER_88200_A2 1.172175f
+#define CS_EQUALISER_88200_B1 (-1.438349f)
+#define CS_EQUALISER_88200_B2 0.442520f
+#define CS_EQUALISER_88200_SCALE 13
+#define CSEX_EQUALISER_88200_A0 2.675241f
+#define CSEX_EQUALISER_88200_A1 (-4.466154f)
+#define CSEX_EQUALISER_88200_A2 1.810305f
+#define CSEX_EQUALISER_88200_B1 (-0.925350f)
+#define CSEX_EQUALISER_88200_B2 (-0.066616f)
+#define CSEX_EQUALISER_88200_SCALE 13
-#define CS_EQUALISER_96000_A0 1.784497
-#define CS_EQUALISER_96000_A1 (-3.001435)
-#define CS_EQUALISER_96000_A2 1.228422
-#define CS_EQUALISER_96000_B1 (-1.477804)
-#define CS_EQUALISER_96000_B2 0.481369
-#define CS_EQUALISER_96000_SCALE 13
-#define CSEX_EQUALISER_96000_A0 2.7573
-#define CSEX_EQUALISER_96000_A1 (-4.6721)
-#define CSEX_EQUALISER_96000_A2 1.9317
-#define CSEX_EQUALISER_96000_B1 (-0.971718)
-#define CSEX_EQUALISER_96000_B2 (-0.021216)
-#define CSEX_EQUALISER_96000_SCALE 13
+#define CS_EQUALISER_96000_A0 1.784497
+#define CS_EQUALISER_96000_A1 (-3.001435)
+#define CS_EQUALISER_96000_A2 1.228422
+#define CS_EQUALISER_96000_B1 (-1.477804)
+#define CS_EQUALISER_96000_B2 0.481369
+#define CS_EQUALISER_96000_SCALE 13
+#define CSEX_EQUALISER_96000_A0 2.7573
+#define CSEX_EQUALISER_96000_A1 (-4.6721)
+#define CSEX_EQUALISER_96000_A2 1.9317
+#define CSEX_EQUALISER_96000_B1 (-0.971718)
+#define CSEX_EQUALISER_96000_B2 (-0.021216)
+#define CSEX_EQUALISER_96000_SCALE 13
/* Equaliser coefficients for 176400Hz sample rate.
* The filter coefficients are obtained by carrying out
* state-space analysis using the coefficients available
* for 44100Hz.
*/
-#define CS_EQUALISER_176400_A0 1.883440f
-#define CS_EQUALISER_176400_A1 (-3.414272f)
-#define CS_EQUALISER_176400_A2 1.534702f
-#define CS_EQUALISER_176400_B1 (-1.674614f)
-#define CS_EQUALISER_176400_B2 0.675827f
-#define CS_EQUALISER_176400_SCALE 13
-#define CSEX_EQUALISER_176400_A0 3.355068f
-#define CSEX_EQUALISER_176400_A1 (-6.112578f)
-#define CSEX_EQUALISER_176400_A2 2.764135f
-#define CSEX_EQUALISER_176400_B1 (-1.268533f)
-#define CSEX_EQUALISER_176400_B2 0.271277f
-#define CSEX_EQUALISER_176400_SCALE 13
+#define CS_EQUALISER_176400_A0 1.883440f
+#define CS_EQUALISER_176400_A1 (-3.414272f)
+#define CS_EQUALISER_176400_A2 1.534702f
+#define CS_EQUALISER_176400_B1 (-1.674614f)
+#define CS_EQUALISER_176400_B2 0.675827f
+#define CS_EQUALISER_176400_SCALE 13
+#define CSEX_EQUALISER_176400_A0 3.355068f
+#define CSEX_EQUALISER_176400_A1 (-6.112578f)
+#define CSEX_EQUALISER_176400_A2 2.764135f
+#define CSEX_EQUALISER_176400_B1 (-1.268533f)
+#define CSEX_EQUALISER_176400_B2 0.271277f
+#define CSEX_EQUALISER_176400_SCALE 13
-#define CS_EQUALISER_192000_A0 1.889582
-#define CS_EQUALISER_192000_A1 (-3.456140)
-#define CS_EQUALISER_192000_A2 1.569864
-#define CS_EQUALISER_192000_B1 (-1.700798)
-#define CS_EQUALISER_192000_B2 0.701824
-#define CS_EQUALISER_192000_SCALE 13
-#define CSEX_EQUALISER_192000_A0 3.4273
-#define CSEX_EQUALISER_192000_A1 (-6.2936)
-#define CSEX_EQUALISER_192000_A2 2.8720
-#define CSEX_EQUALISER_192000_B1 (-1.31074)
-#define CSEX_EQUALISER_192000_B2 0.31312
-#define CSEX_EQUALISER_192000_SCALE 13
+#define CS_EQUALISER_192000_A0 1.889582
+#define CS_EQUALISER_192000_A1 (-3.456140)
+#define CS_EQUALISER_192000_A2 1.569864
+#define CS_EQUALISER_192000_B1 (-1.700798)
+#define CS_EQUALISER_192000_B2 0.701824
+#define CS_EQUALISER_192000_SCALE 13
+#define CSEX_EQUALISER_192000_A0 3.4273
+#define CSEX_EQUALISER_192000_A1 (-6.2936)
+#define CSEX_EQUALISER_192000_A2 2.8720
+#define CSEX_EQUALISER_192000_B1 (-1.31074)
+#define CSEX_EQUALISER_192000_B2 0.31312
+#define CSEX_EQUALISER_192000_SCALE 13
-#define LVCS_HEADPHONE_SHIFT 2 /* Output Shift */
-#define LVCS_HEADPHONE_SHIFTLOSS 0.8477735 /* Output Shift loss */
-#define LVCS_HEADPHONE_GAIN 0.2087465 /* Unprocessed path gain */
-#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 */
+#define LVCS_HEADPHONE_SHIFT 2 /* Output Shift */
+#define LVCS_HEADPHONE_SHIFTLOSS 0.8477735 /* Output Shift loss */
+#define LVCS_HEADPHONE_GAIN 0.2087465 /* Unprocessed path gain */
+#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 */
#endif
-
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
index 312885c..5c8f1ae 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.cpp
@@ -46,67 +46,62 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_Init(LVCS_Handle_t *phInstance,
- LVCS_Capabilities_t *pCapabilities,
- void *pScratch)
-{
-
- LVCS_Instance_t *pInstance;
- LVCS_VolCorrect_t *pLVCS_VolCorrectTable;
+LVCS_ReturnStatus_en LVCS_Init(LVCS_Handle_t* phInstance, LVCS_Capabilities_t* pCapabilities,
+ void* pScratch) {
+ LVCS_Instance_t* pInstance;
+ LVCS_VolCorrect_t* pLVCS_VolCorrectTable;
/*
* Create the instance handle if not already initialised
*/
- if (*phInstance == LVM_NULL)
- {
+ if (*phInstance == LVM_NULL) {
*phInstance = calloc(1, sizeof(*pInstance));
}
- if (*phInstance == LVM_NULL)
- {
+ if (*phInstance == LVM_NULL) {
return LVCS_NULLADDRESS;
}
- pInstance =(LVCS_Instance_t *)*phInstance;
+ pInstance = (LVCS_Instance_t*)*phInstance;
/*
* Save the capabilities in the instance structure
*/
pInstance->Capabilities = *pCapabilities;
- pInstance->pScratch = pScratch;
+ pInstance->pScratch = pScratch;
/*
* Set all initial parameters to invalid to force a full initialisation
*/
- pInstance->Params.OperatingMode = LVCS_OFF;
- pInstance->Params.SpeakerType = LVCS_SPEAKERTYPE_MAX;
- pInstance->OutputDevice = LVCS_HEADPHONE;
- pInstance->Params.SourceFormat = LVCS_SOURCEMAX;
+ pInstance->Params.OperatingMode = LVCS_OFF;
+ pInstance->Params.SpeakerType = LVCS_SPEAKERTYPE_MAX;
+ pInstance->OutputDevice = LVCS_HEADPHONE;
+ pInstance->Params.SourceFormat = LVCS_SOURCEMAX;
pInstance->Params.CompressorMode = LVM_MODE_OFF;
- pInstance->Params.SampleRate = LVM_FS_INVALID;
- pInstance->Params.EffectLevel = 0;
- pInstance->Params.ReverbLevel = (LVM_UINT16)0x8000;
- pLVCS_VolCorrectTable = (LVCS_VolCorrect_t*)&LVCS_VolCorrectTable[0];
- pInstance->VolCorrect = pLVCS_VolCorrectTable[0];
- pInstance->TransitionGain = 0;
+ pInstance->Params.SampleRate = LVM_FS_INVALID;
+ pInstance->Params.EffectLevel = 0;
+ pInstance->Params.ReverbLevel = (LVM_UINT16)0x8000;
+ pLVCS_VolCorrectTable = (LVCS_VolCorrect_t*)&LVCS_VolCorrectTable[0];
+ pInstance->VolCorrect = pLVCS_VolCorrectTable[0];
+ pInstance->TransitionGain = 0;
/* These current and target values are intialized again in LVCS_Control.c */
- LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0],0,0);
+ LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[0], 0, 0);
/* These current and target values are intialized again in LVCS_Control.c */
- LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[1],0,0);
+ LVC_Mixer_Init(&pInstance->BypassMix.Mixer_Instance.MixerStream[1], 0, 0);
/*
* Initialise the bypass variables
*/
- pInstance->MSTarget0=0;
- pInstance->MSTarget1=0;
- pInstance->bInOperatingModeTransition = LVM_FALSE;
- pInstance->bTimerDone = LVM_FALSE;
- pInstance->TimerParams.CallBackParam = 0;
- pInstance->TimerParams.pCallBack = LVCS_TimerCallBack;
- pInstance->TimerParams.pCallbackInstance = pInstance;
- pInstance->TimerParams.pCallBackParams = LVM_NULL;
+ pInstance->MSTarget0 = 0;
+ pInstance->MSTarget1 = 0;
+ pInstance->bInOperatingModeTransition = LVM_FALSE;
+ pInstance->bTimerDone = LVM_FALSE;
+ pInstance->TimerParams.CallBackParam = 0;
+ pInstance->TimerParams.pCallBack = LVCS_TimerCallBack;
+ pInstance->TimerParams.pCallbackInstance = pInstance;
+ pInstance->TimerParams.pCallBackParams = LVM_NULL;
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
/************************************************************************************/
@@ -123,9 +118,8 @@
/* 1. This function must not be interrupted by the LVCS_Process function */
/* */
/************************************************************************************/
-void LVCS_DeInit(LVCS_Handle_t *phInstance)
-{
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)*phInstance;
+void LVCS_DeInit(LVCS_Handle_t* phInstance) {
+ LVCS_Instance_t* pInstance = (LVCS_Instance_t*)*phInstance;
if (pInstance == LVM_NULL) {
return;
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
index 7adfb50..f9c23b3 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Private.h
@@ -33,11 +33,11 @@
/* */
/************************************************************************************/
-#include "LVCS.h" /* Calling or Application layer definitions */
-#include "LVCS_StereoEnhancer.h" /* Stereo enhancer module definitions */
-#include "LVCS_ReverbGenerator.h" /* Reverberation module definitions */
-#include "LVCS_Equaliser.h" /* Equaliser module definitions */
-#include "LVCS_BypassMix.h" /* Bypass Mixer module definitions */
+#include "LVCS.h" /* Calling or Application layer definitions */
+#include "LVCS_StereoEnhancer.h" /* Stereo enhancer module definitions */
+#include "LVCS_ReverbGenerator.h" /* Reverberation module definitions */
+#include "LVCS_Equaliser.h" /* Equaliser module definitions */
+#include "LVCS_BypassMix.h" /* Bypass Mixer module definitions */
#include "LVM_Timer.h"
/************************************************************************************/
@@ -47,29 +47,29 @@
/************************************************************************************/
/* Configuration switch controls */
-#define LVCS_STEREOENHANCESWITCH 0x0001 /* Stereo enhancement enable control */
-#define LVCS_REVERBSWITCH 0x0002 /* Reverberation enable control */
-#define LVCS_EQUALISERSWITCH 0x0004 /* Equaliser enable control */
-#define LVCS_BYPASSMIXSWITCH 0x0008 /* Bypass mixer enable control */
-#define LVCS_COMPGAINFRAME 64 /* Compressor gain update interval */
+#define LVCS_STEREOENHANCESWITCH 0x0001 /* Stereo enhancement enable control */
+#define LVCS_REVERBSWITCH 0x0002 /* Reverberation enable control */
+#define LVCS_EQUALISERSWITCH 0x0004 /* Equaliser enable control */
+#define LVCS_BYPASSMIXSWITCH 0x0008 /* Bypass mixer enable control */
+#define LVCS_COMPGAINFRAME 64 /* Compressor gain update interval */
/* Memory */
-#define LVCS_SCRATCHBUFFERS 8 /* Number of buffers required for inplace processing */
+#define LVCS_SCRATCHBUFFERS 8 /* Number of buffers required for inplace processing */
/*
* The Concert Surround module applies processing only on the first two
* channels of a multichannel input. The data of first two channels is copied
* from the multichannel input into scratch buffer. The buffers added here
* are used for this purpose
*/
-#define LVCS_MC_SCRATCHBUFFERS 2
+#define LVCS_MC_SCRATCHBUFFERS 2
/* General */
-#define LVCS_INVALID 0xFFFF /* Invalid init parameter */
-#define LVCS_BYPASS_MIXER_TC 100 /* Bypass mixer time */
+#define LVCS_INVALID 0xFFFF /* Invalid init parameter */
+#define LVCS_BYPASS_MIXER_TC 100 /* Bypass mixer time */
/* Access to external coefficients table */
-#define LVCS_NR_OF_FS 9
-#define LVCS_NR_OF_CHAN_CFG 2
+#define LVCS_NR_OF_FS 9
+#define LVCS_NR_OF_CHAN_CFG 2
/************************************************************************************/
/* */
@@ -77,13 +77,9 @@
/* */
/************************************************************************************/
-typedef LVM_UINT16 LVCS_Configuration_t; /* Internal algorithm configuration */
+typedef LVM_UINT16 LVCS_Configuration_t; /* Internal algorithm configuration */
-typedef enum
-{
- LVCS_HEADPHONE = 0,
- LVCS_DEVICE_MAX = LVM_MAXENUM
-} LVCS_OutputDevice_en;
+typedef enum { LVCS_HEADPHONE = 0, LVCS_DEVICE_MAX = LVM_MAXENUM } LVCS_OutputDevice_en;
/************************************************************************************/
/* */
@@ -92,67 +88,60 @@
/************************************************************************************/
/* Volume correction structure */
-typedef struct
-{
- 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 */
+typedef struct {
+ 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 */
} LVCS_VolCorrect_t;
/* Instance structure */
-typedef struct
-{
+typedef struct {
/* Public parameters */
- LVCS_Params_t Params; /* Instance parameters */
- LVCS_Capabilities_t Capabilities; /* Initialisation capabilities */
+ LVCS_Params_t Params; /* Instance parameters */
+ LVCS_Capabilities_t Capabilities; /* Initialisation capabilities */
/* Private parameters */
- LVCS_OutputDevice_en OutputDevice; /* Selected output device type */
- LVCS_VolCorrect_t VolCorrect; /* Volume correction settings */
- LVM_FLOAT TransitionGain; /* Transition gain */
- LVM_FLOAT CompressGain; /* Last used compressor gain*/
+ LVCS_OutputDevice_en OutputDevice; /* Selected output device type */
+ LVCS_VolCorrect_t VolCorrect; /* Volume correction settings */
+ LVM_FLOAT TransitionGain; /* Transition gain */
+ LVM_FLOAT CompressGain; /* Last used compressor gain*/
/* Sub-block configurations */
- LVCS_StereoEnhancer_t StereoEnhancer; /* Stereo enhancer configuration */
- LVCS_ReverbGenerator_t Reverberation; /* Reverberation configuration */
- LVCS_Equaliser_t Equaliser; /* Equaliser configuration */
- LVCS_BypassMix_t BypassMix; /* Bypass mixer configuration */
+ LVCS_StereoEnhancer_t StereoEnhancer; /* Stereo enhancer configuration */
+ LVCS_ReverbGenerator_t Reverberation; /* Reverberation configuration */
+ LVCS_Equaliser_t Equaliser; /* Equaliser configuration */
+ LVCS_BypassMix_t BypassMix; /* Bypass mixer configuration */
/* Bypass variable */
- LVM_INT16 MSTarget0; /* Mixer state control variable for smooth transtion */
- LVM_INT16 MSTarget1; /* Mixer state control variable for smooth transtion */
- LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */
- LVM_INT16 bTimerDone; /* Timer completion flag */
- LVM_Timer_Params_t TimerParams; /* Timer parameters */
- LVM_Timer_Instance_t TimerInstance; /* Timer instance */
- void *pCoeff; /* pointer to buffer for equaliser filter coeffs */
- void *pData; /* pointer to buffer for equaliser filter states */
- void *pScratch; /* Pointer to bundle scratch buffer */
+ LVM_INT16 MSTarget0; /* Mixer state control variable for smooth transition */
+ LVM_INT16 MSTarget1; /* Mixer state control variable for smooth transition */
+ LVM_INT16 bInOperatingModeTransition; /* Operating mode transition flag */
+ LVM_INT16 bTimerDone; /* Timer completion flag */
+ LVM_Timer_Params_t TimerParams; /* Timer parameters */
+ LVM_Timer_Instance_t TimerInstance; /* Timer instance */
+ void* pCoeff; /* pointer to buffer for equaliser filter coeffs */
+ void* pData; /* pointer to buffer for equaliser filter states */
+ void* pScratch; /* Pointer to bundle scratch buffer */
} LVCS_Instance_t;
/* Coefficient Structure */
-typedef struct
-{
- Biquad_FLOAT_Instance_t EqualiserBiquadInstance;
- Biquad_FLOAT_Instance_t ReverbBiquadInstance;
- Biquad_FLOAT_Instance_t SEBiquadInstanceMid;
- Biquad_FLOAT_Instance_t SEBiquadInstanceSide;
+typedef struct {
+ Biquad_FLOAT_Instance_t EqualiserBiquadInstance;
+ Biquad_FLOAT_Instance_t ReverbBiquadInstance;
+ Biquad_FLOAT_Instance_t SEBiquadInstanceMid;
+ Biquad_FLOAT_Instance_t SEBiquadInstanceSide;
} LVCS_Coefficient_t;
/* Data Structure */
-typedef struct
-{
+typedef struct {
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;
} LVCS_Data_t;
-void LVCS_TimerCallBack ( void* hInstance,
- void* pCallBackParams,
- LVM_INT32 CallbackParam);
+void LVCS_TimerCallBack(void* hInstance, void* pCallBackParams, LVM_INT32 CallbackParam);
-#endif /* PRIVATE_H */
-
+#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 72b4c8b..d18f2c3 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Process.cpp
@@ -65,17 +65,14 @@
/* NOTES: */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples)
-{
- const LVM_FLOAT *pInput;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVM_FLOAT *pScratch;
+LVCS_ReturnStatus_en LVCS_Process_CS(LVCS_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, LVM_UINT16 NumSamples) {
+ const LVM_FLOAT* pInput;
+ LVCS_Instance_t* pInstance = (LVCS_Instance_t*)hInstance;
+ LVM_FLOAT* pScratch;
LVCS_ReturnStatus_en err;
- LVM_FLOAT *pStIn;
- LVM_INT32 channels = pInstance->Params.NrChannels;
+ LVM_FLOAT* pStIn;
+ LVM_INT32 channels = pInstance->Params.NrChannels;
#define NrFrames NumSamples // alias for clarity
/*In case of mono processing, stereo input is created from mono
@@ -84,12 +81,11 @@
*at this point.
*So to treat the pInData as stereo we are setting channels to 2
*/
- if (channels == 1)
- {
+ if (channels == 1) {
channels = 2;
}
- pScratch = (LVM_FLOAT *)pInstance->pScratch;
+ pScratch = (LVM_FLOAT*)pInstance->pScratch;
/*
* Check if the processing is inplace
@@ -100,55 +96,49 @@
* The Concert Surround module carries out processing only on L, R.
*/
pInput = pScratch + (2 * NrFrames);
- pStIn = pScratch + ((LVCS_SCRATCHBUFFERS - 2) * NrFrames);
+ pStIn = pScratch + ((LVCS_SCRATCHBUFFERS - 2) * NrFrames);
/* The first two channel data is extracted from the input data and
* copied into pInput buffer
*/
- Copy_Float_Mc_Stereo((LVM_FLOAT *)pInData,
- (LVM_FLOAT *)pInput,
- NrFrames,
- channels);
- Copy_Float((LVM_FLOAT *)pInput,
- (LVM_FLOAT *)pStIn,
- (LVM_INT16)(2 * NrFrames));
+ Copy_Float_Mc_Stereo((LVM_FLOAT*)pInData, (LVM_FLOAT*)pInput, NrFrames, channels);
+ Copy_Float((LVM_FLOAT*)pInput, (LVM_FLOAT*)pStIn, (LVM_INT16)(2 * NrFrames));
/*
* Call the stereo enhancer
*/
- err = LVCS_StereoEnhancer(hInstance, /* Instance handle */
- pStIn, /* Pointer to the input data */
- pOutData, /* Pointer to the output data */
- NrFrames); /* Number of frames to process */
+ err = LVCS_StereoEnhancer(hInstance, /* Instance handle */
+ pStIn, /* Pointer to the input data */
+ pOutData, /* Pointer to the output data */
+ NrFrames); /* Number of frames 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 */
+ 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 */
+ 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 */
+ 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)
- {
+ if (err != LVCS_SUCCESS) {
return err;
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
/************************************************************************************/
/* */
@@ -176,108 +166,84 @@
/* NOTES: */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples)
-{
-
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
+LVCS_ReturnStatus_en LVCS_Process(LVCS_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, LVM_UINT16 NumSamples) {
+ LVCS_Instance_t* pInstance = (LVCS_Instance_t*)hInstance;
LVCS_ReturnStatus_en err;
/*Extract number of Channels info*/
LVM_INT32 channels = pInstance->Params.NrChannels;
#define NrFrames NumSamples // alias for clarity
- if (channels == 1)
- {
+ if (channels == 1) {
channels = 2;
}
/*
* Check the number of samples is not too large
*/
- if (NumSamples > pInstance->Capabilities.MaxBlockSize)
- {
- return(LVCS_TOOMANYSAMPLES);
+ if (NumSamples > pInstance->Capabilities.MaxBlockSize) {
+ return (LVCS_TOOMANYSAMPLES);
}
/*
* Check if the algorithm is enabled
*/
- if (pInstance->Params.OperatingMode != LVCS_OFF)
- {
- LVM_FLOAT *pStereoOut;
+ if (pInstance->Params.OperatingMode != LVCS_OFF) {
+ LVM_FLOAT* pStereoOut;
/*
* LVCS_Process_CS uses output buffer to store intermediate outputs of StereoEnhancer,
* Equalizer, ReverbGenerator and BypassMixer.
* So, to avoid i/o data overlapping, when i/o buffers are common, use scratch buffer
* to store intermediate outputs.
*/
- if (pOutData == pInData)
- {
- /*
- * Scratch memory is used in 4 chunks of (2 * NrFrames) size.
- * First chunk of memory is used by LVCS_StereoEnhancer and LVCS_ReverbGenerator,
- * second and fourth are used as input buffers by pInput and pStIn in LVCS_Process_CS.
- * Hence, pStereoOut is pointed to use unused third portion of scratch memory.
- */
- pStereoOut = (LVM_FLOAT *)pInstance->pScratch +
- ((LVCS_SCRATCHBUFFERS - 4) * NrFrames);
- }
- else
- {
+ if (pOutData == pInData) {
+ /*
+ * Scratch memory is used in 4 chunks of (2 * NrFrames) size.
+ * First chunk of memory is used by LVCS_StereoEnhancer and LVCS_ReverbGenerator,
+ * second and fourth are used as input buffers by pInput and pStIn in LVCS_Process_CS.
+ * Hence, pStereoOut is pointed to use unused third portion of scratch memory.
+ */
+ pStereoOut = (LVM_FLOAT*)pInstance->pScratch + ((LVCS_SCRATCHBUFFERS - 4) * NrFrames);
+ } else {
pStereoOut = pOutData;
}
/*
* Call CS process function
*/
- err = LVCS_Process_CS(hInstance,
- pInData,
- pStereoOut,
- NrFrames);
+ err = LVCS_Process_CS(hInstance, pInData, pStereoOut, NrFrames);
/*
* 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))
- {
+ if ((pInstance->Params.OperatingMode == LVCS_ON) &&
+ (pInstance->Params.CompressorMode == LVM_MODE_ON)) {
LVM_FLOAT Gain = pInstance->VolCorrect.CompMin;
LVM_FLOAT Current1;
Current1 = LVC_Mixer_GetCurrent(&pInstance->BypassMix.Mixer_Instance.MixerStream[0]);
- Gain = (LVM_FLOAT)( pInstance->VolCorrect.CompMin
- - (((LVM_FLOAT)pInstance->VolCorrect.CompMin * (Current1)))
- + (((LVM_FLOAT)pInstance->VolCorrect.CompFull * (Current1))));
+ Gain = (LVM_FLOAT)(pInstance->VolCorrect.CompMin -
+ (((LVM_FLOAT)pInstance->VolCorrect.CompMin * (Current1))) +
+ (((LVM_FLOAT)pInstance->VolCorrect.CompFull * (Current1))));
- if(NumSamples < LVCS_COMPGAINFRAME)
- {
- NonLinComp_Float(Gain, /* Compressor gain setting */
- pStereoOut,
- pStereoOut,
- (LVM_INT32)(2 * NrFrames));
- }
- else
- {
- LVM_FLOAT GainStep;
- LVM_FLOAT FinalGain;
- LVM_INT16 SampleToProcess = NumSamples;
- LVM_FLOAT *pOutPtr;
+ if (NumSamples < LVCS_COMPGAINFRAME) {
+ NonLinComp_Float(Gain, /* Compressor gain setting */
+ pStereoOut, pStereoOut, (LVM_INT32)(2 * NrFrames));
+ } else {
+ LVM_FLOAT GainStep;
+ LVM_FLOAT FinalGain;
+ LVM_INT16 SampleToProcess = NumSamples;
+ LVM_FLOAT* pOutPtr;
/* Large changes in Gain can cause clicks in output
Split data into small blocks and use interpolated gain values */
- GainStep = (LVM_FLOAT)(((Gain-pInstance->CompressGain) * \
- LVCS_COMPGAINFRAME) / NumSamples);
+ GainStep = (LVM_FLOAT)(((Gain - pInstance->CompressGain) * LVCS_COMPGAINFRAME) /
+ NumSamples);
- if((GainStep == 0) && (pInstance->CompressGain < Gain))
- {
+ if ((GainStep == 0) && (pInstance->CompressGain < Gain)) {
GainStep = 1;
- }
- else
- {
- if((GainStep == 0) && (pInstance->CompressGain > Gain))
- {
+ } else {
+ if ((GainStep == 0) && (pInstance->CompressGain > Gain)) {
GainStep = -1;
}
}
@@ -286,39 +252,28 @@
Gain = pInstance->CompressGain;
pOutPtr = pStereoOut;
- while(SampleToProcess > 0)
- {
+ while (SampleToProcess > 0) {
Gain = (LVM_FLOAT)(Gain + GainStep);
- if((GainStep > 0) && (FinalGain <= Gain))
- {
+ if ((GainStep > 0) && (FinalGain <= Gain)) {
Gain = FinalGain;
GainStep = 0;
}
- if((GainStep < 0) && (FinalGain > Gain))
- {
+ if ((GainStep < 0) && (FinalGain > Gain)) {
Gain = FinalGain;
GainStep = 0;
}
- if(SampleToProcess > LVCS_COMPGAINFRAME)
- {
- NonLinComp_Float(Gain, /* Compressor gain setting */
- pOutPtr,
- pOutPtr,
- (LVM_INT32)(2 * LVCS_COMPGAINFRAME));
+ if (SampleToProcess > LVCS_COMPGAINFRAME) {
+ NonLinComp_Float(Gain, /* Compressor gain setting */
+ pOutPtr, pOutPtr, (LVM_INT32)(2 * LVCS_COMPGAINFRAME));
pOutPtr += (2 * LVCS_COMPGAINFRAME);
SampleToProcess = (LVM_INT16)(SampleToProcess - LVCS_COMPGAINFRAME);
- }
- else
- {
- NonLinComp_Float(Gain, /* Compressor gain setting */
- pOutPtr,
- pOutPtr,
- (LVM_INT32)(2 * SampleToProcess));
+ } else {
+ NonLinComp_Float(Gain, /* Compressor gain setting */
+ pOutPtr, pOutPtr, (LVM_INT32)(2 * SampleToProcess));
SampleToProcess = 0;
}
-
}
}
@@ -326,46 +281,33 @@
pInstance->CompressGain = Gain;
}
- if(pInstance->bInOperatingModeTransition == LVM_TRUE){
-
+ 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);
+ (pInstance->BypassMix.Mixer_Instance.MixerStream[1].CallbackSet == 0)) {
+ err = LVCS_BypassMixInit(hInstance, &pInstance->Params);
- if(err != LVCS_SUCCESS)
- {
+ if (err != LVCS_SUCCESS) {
return err;
}
- }
- else{
- LVM_Timer ( &pInstance->TimerInstance,
- (LVM_INT16)NumSamples);
+ } else {
+ LVM_Timer(&pInstance->TimerInstance, (LVM_INT16)NumSamples);
}
}
- Copy_Float_Stereo_Mc(pInData,
- pStereoOut,
- pOutData,
- NrFrames,
- channels);
- }
- else
- {
- if (pInData != pOutData)
- {
+ Copy_Float_Stereo_Mc(pInData, pStereoOut, pOutData, NrFrames, channels);
+ } else {
+ if (pInData != pOutData) {
/*
* The algorithm is disabled so just copy the data
*/
- Copy_Float((LVM_FLOAT *)pInData, /* Source */
- (LVM_FLOAT *)pOutData, /* Destination */
- (LVM_INT16)(channels * NrFrames)); /* All Channels*/
+ Copy_Float((LVM_FLOAT*)pInData, /* Source */
+ (LVM_FLOAT*)pOutData, /* Destination */
+ (LVM_INT16)(channels * NrFrames)); /* All Channels*/
}
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
index 441b667..f6d2453 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.cpp
@@ -57,43 +57,31 @@
/* 2. The numerator coefficients of the filter are negated to cause an inversion. */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
+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_Coefficient_t* pCoefficients;
+ BQ_FLOAT_Coefs_t Coeffs;
+ const BiquadA012B12CoefsSP_t* pReverbCoefTable;
- 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_Coefficient_t *pCoefficients;
- BQ_FLOAT_Coefs_t Coeffs;
- const BiquadA012B12CoefsSP_t *pReverbCoefTable;
-
- if (pInstance->pData == LVM_NULL)
- {
- pInstance->pData = pData = (LVCS_Data_t *)calloc(1, sizeof(*pData));
- if (pData == LVM_NULL)
- {
+ if (pInstance->pData == LVM_NULL) {
+ pInstance->pData = pData = (LVCS_Data_t*)calloc(1, sizeof(*pData));
+ if (pData == LVM_NULL) {
return LVCS_NULLADDRESS;
}
+ } else {
+ pData = (LVCS_Data_t*)pInstance->pData;
}
- else
- {
- pData = (LVCS_Data_t *)pInstance->pData;
- }
- if (pInstance->pCoeff == LVM_NULL)
- {
- pInstance->pCoeff = pCoefficients = (LVCS_Coefficient_t *)calloc(1, \
- sizeof(*pCoefficients));
- if (pCoefficients == LVM_NULL)
- {
+ if (pInstance->pCoeff == LVM_NULL) {
+ pInstance->pCoeff = pCoefficients = (LVCS_Coefficient_t*)calloc(1, sizeof(*pCoefficients));
+ if (pCoefficients == LVM_NULL) {
return LVCS_NULLADDRESS;
}
- }
- else
- {
- pCoefficients = (LVCS_Coefficient_t *)pInstance->pCoeff;
+ } else {
+ pCoefficients = (LVCS_Coefficient_t*)pInstance->pCoeff;
}
/*
@@ -101,7 +89,7 @@
* - 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 */
+ if (pInstance->Params.SampleRate != pParams->SampleRate) /* Sample rate change test */
{
/*
@@ -109,10 +97,10 @@
*/
Delay = (LVM_UINT16)LVCS_StereoDelayCS[(LVM_UINT16)pParams->SampleRate];
- pConfig->DelaySize = (LVM_INT16)(2 * Delay);
- pConfig->DelayOffset = 0;
- LoadConst_Float(0, /* Value */
- (LVM_FLOAT *)&pConfig->StereoSamples[0], /* Destination */
+ pConfig->DelaySize = (LVM_INT16)(2 * Delay);
+ pConfig->DelayOffset = 0;
+ LoadConst_Float(0, /* Value */
+ (LVM_FLOAT*)&pConfig->StereoSamples[0], /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pConfig->StereoSamples) / sizeof(LVM_FLOAT)));
/*
@@ -128,23 +116,21 @@
Coeffs.B1 = (LVM_FLOAT)-pReverbCoefTable[Offset].B1;
Coeffs.B2 = (LVM_FLOAT)-pReverbCoefTable[Offset].B2;
- LoadConst_Float(0, /* Value */
- (LVM_FLOAT *)&pData->ReverbBiquadTaps, /* Destination */
+ LoadConst_Float(0, /* Value */
+ (LVM_FLOAT*)&pData->ReverbBiquadTaps, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->ReverbBiquadTaps) / sizeof(LVM_FLOAT)));
BQ_2I_D16F16Css_TRC_WRA_01_Init(&pCoefficients->ReverbBiquadInstance,
- &pData->ReverbBiquadTaps,
- &Coeffs);
+ &pData->ReverbBiquadTaps, &Coeffs);
/* Callbacks */
- switch(pReverbCoefTable[Offset].Scale)
- {
+ switch (pReverbCoefTable[Offset].Scale) {
case 14:
- pConfig->pBiquadCallBack = BQ_2I_D16F16C14_TRC_WRA_01;
+ pConfig->pBiquadCallBack = BQ_2I_D16F16C14_TRC_WRA_01;
break;
case 15:
- pConfig->pBiquadCallBack = BQ_2I_D16F16C15_TRC_WRA_01;
+ pConfig->pBiquadCallBack = BQ_2I_D16F16C15_TRC_WRA_01;
break;
}
@@ -152,16 +138,15 @@
* Setup the mixer
*/
pConfig->ProcGain = (LVM_UINT16)(HEADPHONEGAINPROC);
- pConfig->UnprocGain = (LVM_UINT16)(HEADPHONEGAINUNPROC);
+ 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
+ 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_FLOAT)(ReverbPercentage>>8)) / 32767.0f;
+ pConfig->ReverbLevel = ((LVM_FLOAT)(ReverbPercentage >> 8)) / 32767.0f;
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
/************************************************************************************/
/* */
@@ -201,43 +186,37 @@
/* 2. The Gain is combined with the LPF and incorporated in to the coefficients */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples)
-{
+LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* 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;
+ LVM_FLOAT* pScratch;
- LVCS_Instance_t *pInstance = (LVCS_Instance_t *)hInstance;
- LVCS_ReverbGenerator_t *pConfig = (LVCS_ReverbGenerator_t *)&pInstance->Reverberation;
- LVCS_Coefficient_t *pCoefficients;
- LVM_FLOAT *pScratch;
-
- pCoefficients = (LVCS_Coefficient_t *)pInstance->pCoeff;
- pScratch = (LVM_FLOAT *)pInstance->pScratch;
+ pCoefficients = (LVCS_Coefficient_t*)pInstance->pCoeff;
+ pScratch = (LVM_FLOAT*)pInstance->pScratch;
/*
* Copy the data to the output in outplace processing
*/
- if (pInData != pOutData)
- {
+ if (pInData != pOutData) {
/*
* Reverb not required so just copy the data
*/
- Copy_Float((LVM_FLOAT *)pInData, /* Source */
- (LVM_FLOAT *)pOutData, /* Destination */
- (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ Copy_Float((LVM_FLOAT*)pInData, /* Source */
+ (LVM_FLOAT*)pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
}
/*
* Check if the reverb is required
*/
/* Disable when CS4MS in stereo mode */
- if ((((LVCS_OutputDevice_en)pInstance->Params.SpeakerType == LVCS_HEADPHONE) || \
+ if ((((LVCS_OutputDevice_en)pInstance->Params.SpeakerType == LVCS_HEADPHONE) ||
(pInstance->Params.SpeakerType == LVCS_EX_HEADPHONES) ||
- (pInstance->Params.SourceFormat != LVCS_STEREO)) &&
- /* For validation testing */
- ((pInstance->Params.OperatingMode & LVCS_REVERBSWITCH) !=0))
- {
+ (pInstance->Params.SourceFormat != LVCS_STEREO)) &&
+ /* For validation testing */
+ ((pInstance->Params.OperatingMode & LVCS_REVERBSWITCH) != 0)) {
/********************************************************************************/
/* */
/* Copy the input data to scratch memory and filter it */
@@ -247,34 +226,26 @@
/*
* Copy the input data to the scratch memory
*/
- Copy_Float((LVM_FLOAT *)pInData, /* Source */
- (LVM_FLOAT *)pScratch, /* Destination */
- (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ Copy_Float((LVM_FLOAT*)pInData, /* Source */
+ (LVM_FLOAT*)pScratch, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
/*
* Filter the data
*/
(pConfig->pBiquadCallBack)((Biquad_FLOAT_Instance_t*)&pCoefficients->ReverbBiquadInstance,
- (LVM_FLOAT *)pScratch,
- (LVM_FLOAT *)pScratch,
+ (LVM_FLOAT*)pScratch, (LVM_FLOAT*)pScratch,
(LVM_INT16)NumSamples);
- Mult3s_Float( (LVM_FLOAT *)pScratch,
- pConfig->ReverbLevel,
- (LVM_FLOAT *)pScratch,
- (LVM_INT16)(2 * NumSamples));
+ Mult3s_Float((LVM_FLOAT*)pScratch, pConfig->ReverbLevel, (LVM_FLOAT*)pScratch,
+ (LVM_INT16)(2 * NumSamples));
/*
* Apply the delay mix
*/
- DelayMix_Float((LVM_FLOAT *)pScratch,
- &pConfig->StereoSamples[0],
- pConfig->DelaySize,
- pOutData,
- &pConfig->DelayOffset,
- (LVM_INT16)NumSamples);
-
+ DelayMix_Float((LVM_FLOAT*)pScratch, &pConfig->StereoSamples[0], pConfig->DelaySize,
+ pOutData, &pConfig->DelayOffset, (LVM_INT16)NumSamples);
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
index 1bc4338..b666da3 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_ReverbGenerator.h
@@ -32,8 +32,8 @@
/* */
/************************************************************************************/
-#define HEADPHONEGAINPROC LVCS_HEADPHONE_PROCGAIN
-#define HEADPHONEGAINUNPROC LVCS_HEADPHONE_UNPROCGAIN
+#define HEADPHONEGAINPROC LVCS_HEADPHONE_PROCGAIN
+#define HEADPHONEGAINUNPROC LVCS_HEADPHONE_UNPROCGAIN
/************************************************************************************/
/* */
@@ -42,20 +42,17 @@
/************************************************************************************/
/* Reverberation module structure */
-typedef struct
-{
-
+typedef struct {
/* Stereo delay */
- LVM_INT16 DelaySize;
- LVM_INT16 DelayOffset;
- LVM_INT16 ProcGain;
- LVM_INT16 UnprocGain;
- LVM_FLOAT StereoSamples[2 * LVCS_STEREODELAY_CS_MAX_VAL];
+ LVM_INT16 DelaySize;
+ LVM_INT16 DelayOffset;
+ LVM_INT16 ProcGain;
+ LVM_INT16 UnprocGain;
+ LVM_FLOAT StereoSamples[2 * LVCS_STEREODELAY_CS_MAX_VAL];
/* Reverb Level */
- LVM_FLOAT ReverbLevel;
+ LVM_FLOAT ReverbLevel;
/* Filter */
- void (*pBiquadCallBack) (Biquad_FLOAT_Instance_t*,
- LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
+ void (*pBiquadCallBack)(Biquad_FLOAT_Instance_t*, LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
} LVCS_ReverbGenerator_t;
/************************************************************************************/
@@ -64,11 +61,8 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams);
-LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pInput,
- LVM_FLOAT *pOutput,
- LVM_UINT16 NumSamples);
+LVCS_ReturnStatus_en LVCS_ReverbGeneratorInit(LVCS_Handle_t hInstance, LVCS_Params_t* pParams);
+LVCS_ReturnStatus_en LVCS_ReverbGenerator(LVCS_Handle_t hInstance, const LVM_FLOAT* pInput,
+ LVM_FLOAT* pOutput, LVM_UINT16 NumSamples);
-#endif /* REVERB_H */
+#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 6929015..ffa9c9b 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.cpp
@@ -49,28 +49,24 @@
/* NOTES: */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams)
-{
+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_Coefficient_t* pCoefficient;
+ FO_FLOAT_Coefs_t CoeffsMid;
+ BQ_FLOAT_Coefs_t CoeffsSide;
+ const BiquadA012B12CoefsSP_t* pSESideCoefs;
- 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_Coefficient_t *pCoefficient;
- FO_FLOAT_Coefs_t CoeffsMid;
- BQ_FLOAT_Coefs_t CoeffsSide;
- const BiquadA012B12CoefsSP_t *pSESideCoefs;
-
- pData = (LVCS_Data_t *)pInstance->pData;
- pCoefficient = (LVCS_Coefficient_t *)pInstance->pCoeff;
+ pData = (LVCS_Data_t*)pInstance->pData;
+ pCoefficient = (LVCS_Coefficient_t*)pInstance->pCoeff;
/*
* If the sample rate or speaker type has changed update the filters
*/
if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
- (pInstance->Params.SpeakerType != pParams->SpeakerType))
- {
+ (pInstance->Params.SpeakerType != pParams->SpeakerType)) {
/*
* Set the filter coefficients based on the sample rate
*/
@@ -78,24 +74,22 @@
Offset = (LVM_UINT16)pParams->SampleRate;
/* Convert incoming coefficients to the required format/ordering */
- CoeffsMid.A0 = (LVM_FLOAT) LVCS_SEMidCoefTable[Offset].A0;
- CoeffsMid.A1 = (LVM_FLOAT) LVCS_SEMidCoefTable[Offset].A1;
+ CoeffsMid.A0 = (LVM_FLOAT)LVCS_SEMidCoefTable[Offset].A0;
+ CoeffsMid.A1 = (LVM_FLOAT)LVCS_SEMidCoefTable[Offset].A1;
CoeffsMid.B1 = (LVM_FLOAT)-LVCS_SEMidCoefTable[Offset].B1;
/* Clear the taps */
- LoadConst_Float(0, /* Value */
- (LVM_FLOAT *)&pData->SEBiquadTapsMid, /* Destination */
+ LoadConst_Float(0, /* Value */
+ (LVM_FLOAT*)&pData->SEBiquadTapsMid, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->SEBiquadTapsMid) / sizeof(LVM_FLOAT)));
- FO_1I_D16F16Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceMid,
- &pData->SEBiquadTapsMid,
+ 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;
+ if (LVCS_SEMidCoefTable[Offset].Scale == 15) {
+ pConfig->pBiquadCallBack_Mid = FO_1I_D16F16C15_TRC_WRA_01;
}
Offset = (LVM_UINT16)(pParams->SampleRate);
@@ -103,39 +97,35 @@
/* Side filter */
/* Convert incoming coefficients to the required format/ordering */
- CoeffsSide.A0 = (LVM_FLOAT) pSESideCoefs[Offset].A0;
- CoeffsSide.A1 = (LVM_FLOAT) pSESideCoefs[Offset].A1;
- CoeffsSide.A2 = (LVM_FLOAT) pSESideCoefs[Offset].A2;
+ CoeffsSide.A0 = (LVM_FLOAT)pSESideCoefs[Offset].A0;
+ CoeffsSide.A1 = (LVM_FLOAT)pSESideCoefs[Offset].A1;
+ CoeffsSide.A2 = (LVM_FLOAT)pSESideCoefs[Offset].A2;
CoeffsSide.B1 = (LVM_FLOAT)-pSESideCoefs[Offset].B1;
CoeffsSide.B2 = (LVM_FLOAT)-pSESideCoefs[Offset].B2;
/* Clear the taps */
- LoadConst_Float(0, /* Value */
- (LVM_FLOAT *)&pData->SEBiquadTapsSide, /* Destination */
+ LoadConst_Float(0, /* Value */
+ (LVM_FLOAT*)&pData->SEBiquadTapsSide, /* Destination */
/* Number of words */
(LVM_UINT16)(sizeof(pData->SEBiquadTapsSide) / sizeof(LVM_FLOAT)));
/* Callbacks */
- switch(pSESideCoefs[Offset].Scale)
- {
+ switch (pSESideCoefs[Offset].Scale) {
case 14:
BQ_1I_D16F32Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceSide,
- &pData->SEBiquadTapsSide,
- &CoeffsSide);
+ &pData->SEBiquadTapsSide, &CoeffsSide);
- pConfig->pBiquadCallBack_Side = BQ_1I_D16F32C14_TRC_WRA_01;
+ pConfig->pBiquadCallBack_Side = BQ_1I_D16F32C14_TRC_WRA_01;
break;
case 15:
BQ_1I_D16F16Css_TRC_WRA_01_Init(&pCoefficient->SEBiquadInstanceSide,
- &pData->SEBiquadTapsSide,
- &CoeffsSide);
+ &pData->SEBiquadTapsSide, &CoeffsSide);
- pConfig->pBiquadCallBack_Side = BQ_1I_D16F16C15_TRC_WRA_01;
+ pConfig->pBiquadCallBack_Side = BQ_1I_D16F16C15_TRC_WRA_01;
break;
}
-
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
/************************************************************************************/
/* */
@@ -175,81 +165,61 @@
/* 1. The side filter is not used in Mobile Speaker mode */
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *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;
- LVM_FLOAT *pScratch;
- pCoefficient = (LVCS_Coefficient_t *)pInstance->pCoeff;
- pScratch = (LVM_FLOAT *)pInstance->pScratch;
+LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* 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;
+ LVM_FLOAT* pScratch;
+ pCoefficient = (LVCS_Coefficient_t*)pInstance->pCoeff;
+ pScratch = (LVM_FLOAT*)pInstance->pScratch;
/*
* Check if the Stereo Enhancer is enabled
*/
- if ((pInstance->Params.OperatingMode & LVCS_STEREOENHANCESWITCH) != 0)
- {
+ if ((pInstance->Params.OperatingMode & LVCS_STEREOENHANCESWITCH) != 0) {
/*
* Convert from stereo to middle and side
*/
- From2iToMS_Float(pInData,
- pScratch,
- pScratch + NumSamples,
- (LVM_INT16)NumSamples);
+ From2iToMS_Float(pInData, pScratch, pScratch + NumSamples, (LVM_INT16)NumSamples);
/*
* Apply filter to the middle signal
*/
- if (pInstance->OutputDevice == LVCS_HEADPHONE)
- {
- (pConfig->pBiquadCallBack_Mid)((Biquad_FLOAT_Instance_t*)\
- &pCoefficient->SEBiquadInstanceMid,
- (LVM_FLOAT *)pScratch,
- (LVM_FLOAT *)pScratch,
- (LVM_INT16)NumSamples);
- }
- else
- {
- Mult3s_Float(pScratch, /* Source */
- (LVM_FLOAT)pConfig->MidGain, /* Gain */
- pScratch, /* Destination */
- (LVM_INT16)NumSamples); /* Number of samples */
+ if (pInstance->OutputDevice == LVCS_HEADPHONE) {
+ (pConfig->pBiquadCallBack_Mid)(
+ (Biquad_FLOAT_Instance_t*)&pCoefficient->SEBiquadInstanceMid,
+ (LVM_FLOAT*)pScratch, (LVM_FLOAT*)pScratch, (LVM_INT16)NumSamples);
+ } else {
+ Mult3s_Float(pScratch, /* Source */
+ (LVM_FLOAT)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_FLOAT_Instance_t*) \
- &pCoefficient->SEBiquadInstanceSide,
- (LVM_FLOAT *)(pScratch + NumSamples),
- (LVM_FLOAT *)(pScratch + NumSamples),
- (LVM_INT16)NumSamples);
+ if (pInstance->Params.SourceFormat == LVCS_STEREO) {
+ (pConfig->pBiquadCallBack_Side)(
+ (Biquad_FLOAT_Instance_t*)&pCoefficient->SEBiquadInstanceSide,
+ (LVM_FLOAT*)(pScratch + NumSamples), (LVM_FLOAT*)(pScratch + NumSamples),
+ (LVM_INT16)NumSamples);
}
/*
* Convert from middle and side to stereo
*/
- MSTo2i_Sat_Float(pScratch,
- pScratch + NumSamples,
- pOutData,
- (LVM_INT16)NumSamples);
+ MSTo2i_Sat_Float(pScratch, pScratch + NumSamples, pOutData, (LVM_INT16)NumSamples);
- }
- else
- {
+ } else {
/*
* The stereo enhancer is disabled so just copy the data
*/
- Copy_Float((LVM_FLOAT *)pInData, /* Source */
- (LVM_FLOAT *)pOutData, /* Destination */
- (LVM_INT16)(2 * NumSamples)); /* Left and right */
+ Copy_Float((LVM_FLOAT*)pInData, /* Source */
+ (LVM_FLOAT*)pOutData, /* Destination */
+ (LVM_INT16)(2 * NumSamples)); /* Left and right */
}
- return(LVCS_SUCCESS);
+ return (LVCS_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
index 12a5982..c92f8a5 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.h
@@ -24,8 +24,8 @@
/* */
/************************************************************************************/
-#include "Filters.h" /* Filter definitions */
-#include "LVCS_Headphone_Coeffs.h" /* Headphone coefficients */
+#include "Filters.h" /* Filter definitions */
+#include "LVCS_Headphone_Coeffs.h" /* Headphone coefficients */
#include "BIQUAD.h"
/************************************************************************************/
@@ -35,21 +35,17 @@
/************************************************************************************/
/* Stereo enhancer structure */
-typedef struct
-{
-
+typedef struct {
/*
* Middle filter
*/
- void (*pBiquadCallBack_Mid)(Biquad_FLOAT_Instance_t*,
- LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
+ void (*pBiquadCallBack_Mid)(Biquad_FLOAT_Instance_t*, LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
/*
* Side filter
*/
- void (*pBiquadCallBack_Side)(Biquad_FLOAT_Instance_t*,
- LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
- LVM_FLOAT MidGain; /* Middle gain in mobile speaker mode */
+ void (*pBiquadCallBack_Side)(Biquad_FLOAT_Instance_t*, LVM_FLOAT*, LVM_FLOAT*, LVM_INT16);
+ LVM_FLOAT MidGain; /* Middle gain in mobile speaker mode */
} LVCS_StereoEnhancer_t;
/************************************************************************************/
@@ -58,12 +54,9 @@
/* */
/************************************************************************************/
-LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance,
- LVCS_Params_t *pParams);
+LVCS_ReturnStatus_en LVCS_SEnhancerInit(LVCS_Handle_t hInstance, LVCS_Params_t* pParams);
-LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance,
- const LVM_FLOAT *pInData,
- LVM_FLOAT *pOutData,
- LVM_UINT16 NumSamples);
+LVCS_ReturnStatus_en LVCS_StereoEnhancer(LVCS_Handle_t hInstance, const LVM_FLOAT* pInData,
+ LVM_FLOAT* pOutData, LVM_UINT16 NumSamples);
-#endif /* STEREOENHANCE_H */
+#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 d79db61..55b5243 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.cpp
@@ -23,9 +23,9 @@
#include "LVCS_Private.h"
#include "LVCS_Tables.h"
-#include "Filters.h" /* Filter definitions */
-#include "BIQUAD.h" /* Biquad definitions */
-#include "LVCS_Headphone_Coeffs.h" /* Headphone coefficients */
+#include "Filters.h" /* Filter definitions */
+#include "BIQUAD.h" /* Biquad definitions */
+#include "LVCS_Headphone_Coeffs.h" /* Headphone coefficients */
/************************************************************************************/
/* */
@@ -35,144 +35,75 @@
/* Coefficient table for the middle filter */
const BiquadA01B1CoefsSP_t LVCS_SEMidCoefTable[] = {
- {CS_MIDDLE_8000_A0, /* 8kS/s coefficients */
- CS_MIDDLE_8000_A1,
- CS_MIDDLE_8000_B1,
- (LVM_UINT16 )CS_MIDDLE_8000_SCALE},
- {CS_MIDDLE_11025_A0, /* 11kS/s coefficients */
- CS_MIDDLE_11025_A1,
- CS_MIDDLE_11025_B1,
- (LVM_UINT16 )CS_MIDDLE_11025_SCALE},
- {CS_MIDDLE_12000_A0, /* 12kS/s coefficients */
- CS_MIDDLE_12000_A1,
- CS_MIDDLE_12000_B1,
- (LVM_UINT16 )CS_MIDDLE_12000_SCALE},
- {CS_MIDDLE_16000_A0, /* 16kS/s coefficients */
- CS_MIDDLE_16000_A1,
- CS_MIDDLE_16000_B1,
- (LVM_UINT16 )CS_MIDDLE_16000_SCALE},
- {CS_MIDDLE_22050_A0, /* 22kS/s coefficients */
- CS_MIDDLE_22050_A1,
- CS_MIDDLE_22050_B1,
- (LVM_UINT16 )CS_MIDDLE_22050_SCALE},
- {CS_MIDDLE_24000_A0, /* 24kS/s coefficients */
- CS_MIDDLE_24000_A1,
- CS_MIDDLE_24000_B1,
- (LVM_UINT16 )CS_MIDDLE_24000_SCALE},
- {CS_MIDDLE_32000_A0, /* 32kS/s coefficients */
- CS_MIDDLE_32000_A1,
- CS_MIDDLE_32000_B1,
- (LVM_UINT16 )CS_MIDDLE_32000_SCALE},
- {CS_MIDDLE_44100_A0, /* 44kS/s coefficients */
- CS_MIDDLE_44100_A1,
- CS_MIDDLE_44100_B1,
- (LVM_UINT16 )CS_MIDDLE_44100_SCALE},
- {CS_MIDDLE_48000_A0, /* 48kS/s coefficients */
- CS_MIDDLE_48000_A1,
- CS_MIDDLE_48000_B1,
- (LVM_UINT16 )CS_MIDDLE_48000_SCALE}
- ,
- {CS_MIDDLE_88200_A0, /* 88kS/s coefficients */
- CS_MIDDLE_88200_A1,
- CS_MIDDLE_88200_B1,
- (LVM_UINT16)CS_MIDDLE_88200_SCALE},
- {CS_MIDDLE_96000_A0, /* 96kS/s coefficients */
- CS_MIDDLE_96000_A1,
- CS_MIDDLE_96000_B1,
- (LVM_UINT16 )CS_MIDDLE_96000_SCALE},
- {CS_MIDDLE_176400_A0, /* 176kS/s coefficients */
- CS_MIDDLE_176400_A1,
- CS_MIDDLE_176400_B1,
- (LVM_UINT16)CS_MIDDLE_176400_SCALE},
- {CS_MIDDLE_192000_A0, /* 192kS/s coefficients */
- CS_MIDDLE_192000_A1,
- CS_MIDDLE_192000_B1,
- (LVM_UINT16 )CS_MIDDLE_192000_SCALE}
- };
+ {CS_MIDDLE_8000_A0, /* 8kS/s coefficients */
+ CS_MIDDLE_8000_A1, CS_MIDDLE_8000_B1, (LVM_UINT16)CS_MIDDLE_8000_SCALE},
+ {CS_MIDDLE_11025_A0, /* 11kS/s coefficients */
+ CS_MIDDLE_11025_A1, CS_MIDDLE_11025_B1, (LVM_UINT16)CS_MIDDLE_11025_SCALE},
+ {CS_MIDDLE_12000_A0, /* 12kS/s coefficients */
+ CS_MIDDLE_12000_A1, CS_MIDDLE_12000_B1, (LVM_UINT16)CS_MIDDLE_12000_SCALE},
+ {CS_MIDDLE_16000_A0, /* 16kS/s coefficients */
+ CS_MIDDLE_16000_A1, CS_MIDDLE_16000_B1, (LVM_UINT16)CS_MIDDLE_16000_SCALE},
+ {CS_MIDDLE_22050_A0, /* 22kS/s coefficients */
+ CS_MIDDLE_22050_A1, CS_MIDDLE_22050_B1, (LVM_UINT16)CS_MIDDLE_22050_SCALE},
+ {CS_MIDDLE_24000_A0, /* 24kS/s coefficients */
+ CS_MIDDLE_24000_A1, CS_MIDDLE_24000_B1, (LVM_UINT16)CS_MIDDLE_24000_SCALE},
+ {CS_MIDDLE_32000_A0, /* 32kS/s coefficients */
+ CS_MIDDLE_32000_A1, CS_MIDDLE_32000_B1, (LVM_UINT16)CS_MIDDLE_32000_SCALE},
+ {CS_MIDDLE_44100_A0, /* 44kS/s coefficients */
+ CS_MIDDLE_44100_A1, CS_MIDDLE_44100_B1, (LVM_UINT16)CS_MIDDLE_44100_SCALE},
+ {CS_MIDDLE_48000_A0, /* 48kS/s coefficients */
+ CS_MIDDLE_48000_A1, CS_MIDDLE_48000_B1, (LVM_UINT16)CS_MIDDLE_48000_SCALE},
+ {CS_MIDDLE_88200_A0, /* 88kS/s coefficients */
+ CS_MIDDLE_88200_A1, CS_MIDDLE_88200_B1, (LVM_UINT16)CS_MIDDLE_88200_SCALE},
+ {CS_MIDDLE_96000_A0, /* 96kS/s coefficients */
+ CS_MIDDLE_96000_A1, CS_MIDDLE_96000_B1, (LVM_UINT16)CS_MIDDLE_96000_SCALE},
+ {CS_MIDDLE_176400_A0, /* 176kS/s coefficients */
+ CS_MIDDLE_176400_A1, CS_MIDDLE_176400_B1, (LVM_UINT16)CS_MIDDLE_176400_SCALE},
+ {CS_MIDDLE_192000_A0, /* 192kS/s coefficients */
+ CS_MIDDLE_192000_A1, CS_MIDDLE_192000_B1, (LVM_UINT16)CS_MIDDLE_192000_SCALE}};
/* Coefficient table for the side filter */
const BiquadA012B12CoefsSP_t LVCS_SESideCoefTable[] = {
- /* Headphone Side coefficients */
- {CS_SIDE_8000_A0, /* 8kS/s coefficients */
- CS_SIDE_8000_A1,
- CS_SIDE_8000_A2,
- CS_SIDE_8000_B1,
- CS_SIDE_8000_B2,
- (LVM_UINT16 )CS_SIDE_8000_SCALE},
- {CS_SIDE_11025_A0, /* 11kS/s coefficients */
- CS_SIDE_11025_A1,
- CS_SIDE_11025_A2,
- CS_SIDE_11025_B1,
- CS_SIDE_11025_B2,
- (LVM_UINT16 )CS_SIDE_11025_SCALE},
- {CS_SIDE_12000_A0, /* 12kS/s coefficients */
- CS_SIDE_12000_A1,
- CS_SIDE_12000_A2,
- CS_SIDE_12000_B1,
- CS_SIDE_12000_B2,
- (LVM_UINT16 )CS_SIDE_12000_SCALE},
- {CS_SIDE_16000_A0, /* 16kS/s coefficients */
- CS_SIDE_16000_A1,
- CS_SIDE_16000_A2,
- CS_SIDE_16000_B1,
- CS_SIDE_16000_B2,
- (LVM_UINT16 )CS_SIDE_16000_SCALE},
- {CS_SIDE_22050_A0, /* 22kS/s coefficients */
- CS_SIDE_22050_A1,
- CS_SIDE_22050_A2,
- CS_SIDE_22050_B1,
- CS_SIDE_22050_B2,
- (LVM_UINT16 )CS_SIDE_22050_SCALE},
- {CS_SIDE_24000_A0, /* 24kS/s coefficients */
- CS_SIDE_24000_A1,
- CS_SIDE_24000_A2,
- CS_SIDE_24000_B1,
- CS_SIDE_24000_B2,
- (LVM_UINT16 )CS_SIDE_24000_SCALE},
- {CS_SIDE_32000_A0, /* 32kS/s coefficients */
- CS_SIDE_32000_A1,
- CS_SIDE_32000_A2,
- CS_SIDE_32000_B1,
- CS_SIDE_32000_B2,
- (LVM_UINT16 )CS_SIDE_32000_SCALE},
- {CS_SIDE_44100_A0, /* 44kS/s coefficients */
- CS_SIDE_44100_A1,
- CS_SIDE_44100_A2,
- CS_SIDE_44100_B1,
- CS_SIDE_44100_B2,
- (LVM_UINT16 )CS_SIDE_44100_SCALE},
- {CS_SIDE_48000_A0, /* 48kS/s coefficients */
- CS_SIDE_48000_A1,
- CS_SIDE_48000_A2,
- CS_SIDE_48000_B1,
- CS_SIDE_48000_B2,
- (LVM_UINT16 )CS_SIDE_48000_SCALE}
- ,
- {CS_SIDE_88200_A0, /* 88kS/s coefficients */
- CS_SIDE_88200_A1,
- CS_SIDE_88200_A2,
- CS_SIDE_88200_B1,
- CS_SIDE_88200_B2,
- (LVM_UINT16)CS_SIDE_88200_SCALE},
- {CS_SIDE_96000_A0, /* 96kS/s coefficients */
- CS_SIDE_96000_A1,
- CS_SIDE_96000_A2,
- CS_SIDE_96000_B1,
- CS_SIDE_96000_B2,
- (LVM_UINT16 )CS_SIDE_96000_SCALE},
- {CS_SIDE_176400_A0, /*176kS/s coefficients */
- CS_SIDE_176400_A1,
- CS_SIDE_176400_A2,
- CS_SIDE_176400_B1,
- CS_SIDE_176400_B2,
- (LVM_UINT16)CS_SIDE_176400_SCALE},
- {CS_SIDE_192000_A0, /* 192kS/s coefficients */
- CS_SIDE_192000_A1,
- CS_SIDE_192000_A2,
- CS_SIDE_192000_B1,
- CS_SIDE_192000_B2,
- (LVM_UINT16 )CS_SIDE_192000_SCALE}
-};
+ /* Headphone Side coefficients */
+ {CS_SIDE_8000_A0, /* 8kS/s coefficients */
+ CS_SIDE_8000_A1, CS_SIDE_8000_A2, CS_SIDE_8000_B1, CS_SIDE_8000_B2,
+ (LVM_UINT16)CS_SIDE_8000_SCALE},
+ {CS_SIDE_11025_A0, /* 11kS/s coefficients */
+ CS_SIDE_11025_A1, CS_SIDE_11025_A2, CS_SIDE_11025_B1, CS_SIDE_11025_B2,
+ (LVM_UINT16)CS_SIDE_11025_SCALE},
+ {CS_SIDE_12000_A0, /* 12kS/s coefficients */
+ CS_SIDE_12000_A1, CS_SIDE_12000_A2, CS_SIDE_12000_B1, CS_SIDE_12000_B2,
+ (LVM_UINT16)CS_SIDE_12000_SCALE},
+ {CS_SIDE_16000_A0, /* 16kS/s coefficients */
+ CS_SIDE_16000_A1, CS_SIDE_16000_A2, CS_SIDE_16000_B1, CS_SIDE_16000_B2,
+ (LVM_UINT16)CS_SIDE_16000_SCALE},
+ {CS_SIDE_22050_A0, /* 22kS/s coefficients */
+ CS_SIDE_22050_A1, CS_SIDE_22050_A2, CS_SIDE_22050_B1, CS_SIDE_22050_B2,
+ (LVM_UINT16)CS_SIDE_22050_SCALE},
+ {CS_SIDE_24000_A0, /* 24kS/s coefficients */
+ CS_SIDE_24000_A1, CS_SIDE_24000_A2, CS_SIDE_24000_B1, CS_SIDE_24000_B2,
+ (LVM_UINT16)CS_SIDE_24000_SCALE},
+ {CS_SIDE_32000_A0, /* 32kS/s coefficients */
+ CS_SIDE_32000_A1, CS_SIDE_32000_A2, CS_SIDE_32000_B1, CS_SIDE_32000_B2,
+ (LVM_UINT16)CS_SIDE_32000_SCALE},
+ {CS_SIDE_44100_A0, /* 44kS/s coefficients */
+ CS_SIDE_44100_A1, CS_SIDE_44100_A2, CS_SIDE_44100_B1, CS_SIDE_44100_B2,
+ (LVM_UINT16)CS_SIDE_44100_SCALE},
+ {CS_SIDE_48000_A0, /* 48kS/s coefficients */
+ CS_SIDE_48000_A1, CS_SIDE_48000_A2, CS_SIDE_48000_B1, CS_SIDE_48000_B2,
+ (LVM_UINT16)CS_SIDE_48000_SCALE},
+ {CS_SIDE_88200_A0, /* 88kS/s coefficients */
+ CS_SIDE_88200_A1, CS_SIDE_88200_A2, CS_SIDE_88200_B1, CS_SIDE_88200_B2,
+ (LVM_UINT16)CS_SIDE_88200_SCALE},
+ {CS_SIDE_96000_A0, /* 96kS/s coefficients */
+ CS_SIDE_96000_A1, CS_SIDE_96000_A2, CS_SIDE_96000_B1, CS_SIDE_96000_B2,
+ (LVM_UINT16)CS_SIDE_96000_SCALE},
+ {CS_SIDE_176400_A0, /*176kS/s coefficients */
+ CS_SIDE_176400_A1, CS_SIDE_176400_A2, CS_SIDE_176400_B1, CS_SIDE_176400_B2,
+ (LVM_UINT16)CS_SIDE_176400_SCALE},
+ {CS_SIDE_192000_A0, /* 192kS/s coefficients */
+ CS_SIDE_192000_A1, CS_SIDE_192000_A2, CS_SIDE_192000_B1, CS_SIDE_192000_B2,
+ (LVM_UINT16)CS_SIDE_192000_SCALE}};
/************************************************************************************/
/* */
@@ -181,167 +112,87 @@
/************************************************************************************/
const BiquadA012B12CoefsSP_t LVCS_EqualiserCoefTable[] = {
- /* Headphone coefficients */
- {CS_EQUALISER_8000_A0, /* 8kS/s coefficients */
- CS_EQUALISER_8000_A1,
- CS_EQUALISER_8000_A2,
- CS_EQUALISER_8000_B1,
- CS_EQUALISER_8000_B2,
- (LVM_UINT16 )CS_EQUALISER_8000_SCALE},
- {CS_EQUALISER_11025_A0, /* 11kS/s coefficients */
- CS_EQUALISER_11025_A1,
- CS_EQUALISER_11025_A2,
- CS_EQUALISER_11025_B1,
- CS_EQUALISER_11025_B2,
- (LVM_UINT16 )CS_EQUALISER_11025_SCALE},
- {CS_EQUALISER_12000_A0, /* 12kS/s coefficients */
- CS_EQUALISER_12000_A1,
- CS_EQUALISER_12000_A2,
- CS_EQUALISER_12000_B1,
- CS_EQUALISER_12000_B2,
- (LVM_UINT16 )CS_EQUALISER_12000_SCALE},
- {CS_EQUALISER_16000_A0, /* 16kS/s coefficients */
- CS_EQUALISER_16000_A1,
- CS_EQUALISER_16000_A2,
- CS_EQUALISER_16000_B1,
- CS_EQUALISER_16000_B2,
- (LVM_UINT16 )CS_EQUALISER_16000_SCALE},
- {CS_EQUALISER_22050_A0, /* 22kS/s coefficients */
- CS_EQUALISER_22050_A1,
- CS_EQUALISER_22050_A2,
- CS_EQUALISER_22050_B1,
- CS_EQUALISER_22050_B2,
- (LVM_UINT16 )CS_EQUALISER_22050_SCALE},
- {CS_EQUALISER_24000_A0, /* 24kS/s coefficients */
- CS_EQUALISER_24000_A1,
- CS_EQUALISER_24000_A2,
- CS_EQUALISER_24000_B1,
- CS_EQUALISER_24000_B2,
- (LVM_UINT16 )CS_EQUALISER_24000_SCALE},
- {CS_EQUALISER_32000_A0, /* 32kS/s coefficients */
- CS_EQUALISER_32000_A1,
- CS_EQUALISER_32000_A2,
- CS_EQUALISER_32000_B1,
- CS_EQUALISER_32000_B2,
- (LVM_UINT16 )CS_EQUALISER_32000_SCALE},
- {CS_EQUALISER_44100_A0, /* 44kS/s coefficients */
- CS_EQUALISER_44100_A1,
- CS_EQUALISER_44100_A2,
- CS_EQUALISER_44100_B1,
- CS_EQUALISER_44100_B2,
- (LVM_UINT16 )CS_EQUALISER_44100_SCALE},
- {CS_EQUALISER_48000_A0, /* 48kS/s coefficients */
- CS_EQUALISER_48000_A1,
- CS_EQUALISER_48000_A2,
- CS_EQUALISER_48000_B1,
- CS_EQUALISER_48000_B2,
- (LVM_UINT16 )CS_EQUALISER_48000_SCALE},
- {CS_EQUALISER_88200_A0, /* 88kS/s coeffieients */
- CS_EQUALISER_88200_A1,
- CS_EQUALISER_88200_A2,
- CS_EQUALISER_88200_B1,
- CS_EQUALISER_88200_B2,
- (LVM_UINT16)CS_EQUALISER_88200_SCALE},
- {CS_EQUALISER_96000_A0, /* 96kS/s coefficients */
- CS_EQUALISER_96000_A1,
- CS_EQUALISER_96000_A2,
- CS_EQUALISER_96000_B1,
- CS_EQUALISER_96000_B2,
- (LVM_UINT16 )CS_EQUALISER_96000_SCALE},
- {CS_EQUALISER_176400_A0, /* 176kS/s coefficients */
- CS_EQUALISER_176400_A1,
- CS_EQUALISER_176400_A2,
- CS_EQUALISER_176400_B1,
- CS_EQUALISER_176400_B2,
- (LVM_UINT16)CS_EQUALISER_176400_SCALE},
- {CS_EQUALISER_192000_A0, /* 192kS/s coefficients */
- CS_EQUALISER_192000_A1,
- CS_EQUALISER_192000_A2,
- CS_EQUALISER_192000_B1,
- CS_EQUALISER_192000_B2,
- (LVM_UINT16 )CS_EQUALISER_192000_SCALE},
+ /* Headphone coefficients */
+ {CS_EQUALISER_8000_A0, /* 8kS/s coefficients */
+ CS_EQUALISER_8000_A1, CS_EQUALISER_8000_A2, CS_EQUALISER_8000_B1, CS_EQUALISER_8000_B2,
+ (LVM_UINT16)CS_EQUALISER_8000_SCALE},
+ {CS_EQUALISER_11025_A0, /* 11kS/s coefficients */
+ CS_EQUALISER_11025_A1, CS_EQUALISER_11025_A2, CS_EQUALISER_11025_B1, CS_EQUALISER_11025_B2,
+ (LVM_UINT16)CS_EQUALISER_11025_SCALE},
+ {CS_EQUALISER_12000_A0, /* 12kS/s coefficients */
+ CS_EQUALISER_12000_A1, CS_EQUALISER_12000_A2, CS_EQUALISER_12000_B1, CS_EQUALISER_12000_B2,
+ (LVM_UINT16)CS_EQUALISER_12000_SCALE},
+ {CS_EQUALISER_16000_A0, /* 16kS/s coefficients */
+ CS_EQUALISER_16000_A1, CS_EQUALISER_16000_A2, CS_EQUALISER_16000_B1, CS_EQUALISER_16000_B2,
+ (LVM_UINT16)CS_EQUALISER_16000_SCALE},
+ {CS_EQUALISER_22050_A0, /* 22kS/s coefficients */
+ CS_EQUALISER_22050_A1, CS_EQUALISER_22050_A2, CS_EQUALISER_22050_B1, CS_EQUALISER_22050_B2,
+ (LVM_UINT16)CS_EQUALISER_22050_SCALE},
+ {CS_EQUALISER_24000_A0, /* 24kS/s coefficients */
+ CS_EQUALISER_24000_A1, CS_EQUALISER_24000_A2, CS_EQUALISER_24000_B1, CS_EQUALISER_24000_B2,
+ (LVM_UINT16)CS_EQUALISER_24000_SCALE},
+ {CS_EQUALISER_32000_A0, /* 32kS/s coefficients */
+ CS_EQUALISER_32000_A1, CS_EQUALISER_32000_A2, CS_EQUALISER_32000_B1, CS_EQUALISER_32000_B2,
+ (LVM_UINT16)CS_EQUALISER_32000_SCALE},
+ {CS_EQUALISER_44100_A0, /* 44kS/s coefficients */
+ CS_EQUALISER_44100_A1, CS_EQUALISER_44100_A2, CS_EQUALISER_44100_B1, CS_EQUALISER_44100_B2,
+ (LVM_UINT16)CS_EQUALISER_44100_SCALE},
+ {CS_EQUALISER_48000_A0, /* 48kS/s coefficients */
+ CS_EQUALISER_48000_A1, CS_EQUALISER_48000_A2, CS_EQUALISER_48000_B1, CS_EQUALISER_48000_B2,
+ (LVM_UINT16)CS_EQUALISER_48000_SCALE},
+ {CS_EQUALISER_88200_A0, /* 88kS/s coeffieients */
+ CS_EQUALISER_88200_A1, CS_EQUALISER_88200_A2, CS_EQUALISER_88200_B1, CS_EQUALISER_88200_B2,
+ (LVM_UINT16)CS_EQUALISER_88200_SCALE},
+ {CS_EQUALISER_96000_A0, /* 96kS/s coefficients */
+ CS_EQUALISER_96000_A1, CS_EQUALISER_96000_A2, CS_EQUALISER_96000_B1, CS_EQUALISER_96000_B2,
+ (LVM_UINT16)CS_EQUALISER_96000_SCALE},
+ {CS_EQUALISER_176400_A0, /* 176kS/s coefficients */
+ CS_EQUALISER_176400_A1, CS_EQUALISER_176400_A2, CS_EQUALISER_176400_B1,
+ CS_EQUALISER_176400_B2, (LVM_UINT16)CS_EQUALISER_176400_SCALE},
+ {CS_EQUALISER_192000_A0, /* 192kS/s coefficients */
+ CS_EQUALISER_192000_A1, CS_EQUALISER_192000_A2, CS_EQUALISER_192000_B1,
+ CS_EQUALISER_192000_B2, (LVM_UINT16)CS_EQUALISER_192000_SCALE},
- /* Concert Sound EX Headphone coefficients */
- {CSEX_EQUALISER_8000_A0, /* 8kS/s coefficients */
- CSEX_EQUALISER_8000_A1,
- CSEX_EQUALISER_8000_A2,
- CSEX_EQUALISER_8000_B1,
- CSEX_EQUALISER_8000_B2,
- (LVM_UINT16 )CSEX_EQUALISER_8000_SCALE},
- {CSEX_EQUALISER_11025_A0, /* 11kS/s coefficients */
- CSEX_EQUALISER_11025_A1,
- CSEX_EQUALISER_11025_A2,
- CSEX_EQUALISER_11025_B1,
- CSEX_EQUALISER_11025_B2,
- (LVM_UINT16 )CSEX_EQUALISER_11025_SCALE},
- {CSEX_EQUALISER_12000_A0, /* 12kS/s coefficients */
- CSEX_EQUALISER_12000_A1,
- CSEX_EQUALISER_12000_A2,
- CSEX_EQUALISER_12000_B1,
- CSEX_EQUALISER_12000_B2,
- (LVM_UINT16 )CSEX_EQUALISER_12000_SCALE},
- {CSEX_EQUALISER_16000_A0, /* 16kS/s coefficients */
- CSEX_EQUALISER_16000_A1,
- CSEX_EQUALISER_16000_A2,
- CSEX_EQUALISER_16000_B1,
- CSEX_EQUALISER_16000_B2,
- (LVM_UINT16 )CSEX_EQUALISER_16000_SCALE},
- {CSEX_EQUALISER_22050_A0, /* 22kS/s coefficients */
- CSEX_EQUALISER_22050_A1,
- CSEX_EQUALISER_22050_A2,
- CSEX_EQUALISER_22050_B1,
- CSEX_EQUALISER_22050_B2,
- (LVM_UINT16 )CSEX_EQUALISER_22050_SCALE},
- {CSEX_EQUALISER_24000_A0, /* 24kS/s coefficients */
- CSEX_EQUALISER_24000_A1,
- CSEX_EQUALISER_24000_A2,
- CSEX_EQUALISER_24000_B1,
- CSEX_EQUALISER_24000_B2,
- (LVM_UINT16 )CSEX_EQUALISER_24000_SCALE},
- {CSEX_EQUALISER_32000_A0, /* 32kS/s coefficients */
- CSEX_EQUALISER_32000_A1,
- CSEX_EQUALISER_32000_A2,
- CSEX_EQUALISER_32000_B1,
- CSEX_EQUALISER_32000_B2,
- (LVM_UINT16 )CSEX_EQUALISER_32000_SCALE},
- {CSEX_EQUALISER_44100_A0, /* 44kS/s coefficients */
- CSEX_EQUALISER_44100_A1,
- CSEX_EQUALISER_44100_A2,
- CSEX_EQUALISER_44100_B1,
- CSEX_EQUALISER_44100_B2,
- (LVM_UINT16 )CSEX_EQUALISER_44100_SCALE},
- {CSEX_EQUALISER_48000_A0, /* 48kS/s coefficients */
- CSEX_EQUALISER_48000_A1,
- CSEX_EQUALISER_48000_A2,
- CSEX_EQUALISER_48000_B1,
- CSEX_EQUALISER_48000_B2,
- (LVM_UINT16 )CSEX_EQUALISER_48000_SCALE}
- ,
- {CSEX_EQUALISER_88200_A0, /* 88kS/s coefficients */
- CSEX_EQUALISER_88200_A1,
- CSEX_EQUALISER_88200_A2,
- CSEX_EQUALISER_88200_B1,
- CSEX_EQUALISER_88200_B2,
- (LVM_UINT16)CSEX_EQUALISER_88200_SCALE},
- {CSEX_EQUALISER_96000_A0, /* 96kS/s coefficients */
- CSEX_EQUALISER_96000_A1,
- CSEX_EQUALISER_96000_A2,
- CSEX_EQUALISER_96000_B1,
- CSEX_EQUALISER_96000_B2,
- (LVM_UINT16 )CSEX_EQUALISER_96000_SCALE},
- {CSEX_EQUALISER_176400_A0, /* 176kS/s coefficients */
- CSEX_EQUALISER_176400_A1,
- CSEX_EQUALISER_176400_A2,
- CSEX_EQUALISER_176400_B1,
- CSEX_EQUALISER_176400_B2,
- (LVM_UINT16)CSEX_EQUALISER_176400_SCALE},
- {CSEX_EQUALISER_192000_A0, /* 192kS/s coefficients */
- CSEX_EQUALISER_192000_A1,
- CSEX_EQUALISER_192000_A2,
- CSEX_EQUALISER_192000_B1,
- CSEX_EQUALISER_192000_B2,
- (LVM_UINT16 )CSEX_EQUALISER_192000_SCALE}
-};
+ /* Concert Sound EX Headphone coefficients */
+ {CSEX_EQUALISER_8000_A0, /* 8kS/s coefficients */
+ CSEX_EQUALISER_8000_A1, CSEX_EQUALISER_8000_A2, CSEX_EQUALISER_8000_B1,
+ CSEX_EQUALISER_8000_B2, (LVM_UINT16)CSEX_EQUALISER_8000_SCALE},
+ {CSEX_EQUALISER_11025_A0, /* 11kS/s coefficients */
+ CSEX_EQUALISER_11025_A1, CSEX_EQUALISER_11025_A2, CSEX_EQUALISER_11025_B1,
+ CSEX_EQUALISER_11025_B2, (LVM_UINT16)CSEX_EQUALISER_11025_SCALE},
+ {CSEX_EQUALISER_12000_A0, /* 12kS/s coefficients */
+ CSEX_EQUALISER_12000_A1, CSEX_EQUALISER_12000_A2, CSEX_EQUALISER_12000_B1,
+ CSEX_EQUALISER_12000_B2, (LVM_UINT16)CSEX_EQUALISER_12000_SCALE},
+ {CSEX_EQUALISER_16000_A0, /* 16kS/s coefficients */
+ CSEX_EQUALISER_16000_A1, CSEX_EQUALISER_16000_A2, CSEX_EQUALISER_16000_B1,
+ CSEX_EQUALISER_16000_B2, (LVM_UINT16)CSEX_EQUALISER_16000_SCALE},
+ {CSEX_EQUALISER_22050_A0, /* 22kS/s coefficients */
+ CSEX_EQUALISER_22050_A1, CSEX_EQUALISER_22050_A2, CSEX_EQUALISER_22050_B1,
+ CSEX_EQUALISER_22050_B2, (LVM_UINT16)CSEX_EQUALISER_22050_SCALE},
+ {CSEX_EQUALISER_24000_A0, /* 24kS/s coefficients */
+ CSEX_EQUALISER_24000_A1, CSEX_EQUALISER_24000_A2, CSEX_EQUALISER_24000_B1,
+ CSEX_EQUALISER_24000_B2, (LVM_UINT16)CSEX_EQUALISER_24000_SCALE},
+ {CSEX_EQUALISER_32000_A0, /* 32kS/s coefficients */
+ CSEX_EQUALISER_32000_A1, CSEX_EQUALISER_32000_A2, CSEX_EQUALISER_32000_B1,
+ CSEX_EQUALISER_32000_B2, (LVM_UINT16)CSEX_EQUALISER_32000_SCALE},
+ {CSEX_EQUALISER_44100_A0, /* 44kS/s coefficients */
+ CSEX_EQUALISER_44100_A1, CSEX_EQUALISER_44100_A2, CSEX_EQUALISER_44100_B1,
+ CSEX_EQUALISER_44100_B2, (LVM_UINT16)CSEX_EQUALISER_44100_SCALE},
+ {CSEX_EQUALISER_48000_A0, /* 48kS/s coefficients */
+ CSEX_EQUALISER_48000_A1, CSEX_EQUALISER_48000_A2, CSEX_EQUALISER_48000_B1,
+ CSEX_EQUALISER_48000_B2, (LVM_UINT16)CSEX_EQUALISER_48000_SCALE},
+ {CSEX_EQUALISER_88200_A0, /* 88kS/s coefficients */
+ CSEX_EQUALISER_88200_A1, CSEX_EQUALISER_88200_A2, CSEX_EQUALISER_88200_B1,
+ CSEX_EQUALISER_88200_B2, (LVM_UINT16)CSEX_EQUALISER_88200_SCALE},
+ {CSEX_EQUALISER_96000_A0, /* 96kS/s coefficients */
+ CSEX_EQUALISER_96000_A1, CSEX_EQUALISER_96000_A2, CSEX_EQUALISER_96000_B1,
+ CSEX_EQUALISER_96000_B2, (LVM_UINT16)CSEX_EQUALISER_96000_SCALE},
+ {CSEX_EQUALISER_176400_A0, /* 176kS/s coefficients */
+ CSEX_EQUALISER_176400_A1, CSEX_EQUALISER_176400_A2, CSEX_EQUALISER_176400_B1,
+ CSEX_EQUALISER_176400_B2, (LVM_UINT16)CSEX_EQUALISER_176400_SCALE},
+ {CSEX_EQUALISER_192000_A0, /* 192kS/s coefficients */
+ CSEX_EQUALISER_192000_A1, CSEX_EQUALISER_192000_A2, CSEX_EQUALISER_192000_B1,
+ CSEX_EQUALISER_192000_B2, (LVM_UINT16)CSEX_EQUALISER_192000_SCALE}};
/************************************************************************************/
/* */
@@ -350,20 +201,12 @@
/************************************************************************************/
/* Stereo delay table for Concert Sound */
-const LVM_UINT16 LVCS_StereoDelayCS[] = {
- LVCS_STEREODELAY_CS_8KHZ,
- LVCS_STEREODELAY_CS_11KHZ,
- LVCS_STEREODELAY_CS_12KHZ,
- LVCS_STEREODELAY_CS_16KHZ,
- LVCS_STEREODELAY_CS_22KHZ,
- LVCS_STEREODELAY_CS_24KHZ,
- LVCS_STEREODELAY_CS_32KHZ,
- LVCS_STEREODELAY_CS_44KHZ,
- LVCS_STEREODELAY_CS_48KHZ,
- LVCS_STEREODELAY_CS_88KHZ,
- LVCS_STEREODELAY_CS_96KHZ,
- LVCS_STEREODELAY_CS_176KHZ,
- LVCS_STEREODELAY_CS_192KHZ,
+const LVM_UINT16 LVCS_StereoDelayCS[] = {
+ LVCS_STEREODELAY_CS_8KHZ, LVCS_STEREODELAY_CS_11KHZ, LVCS_STEREODELAY_CS_12KHZ,
+ LVCS_STEREODELAY_CS_16KHZ, LVCS_STEREODELAY_CS_22KHZ, LVCS_STEREODELAY_CS_24KHZ,
+ LVCS_STEREODELAY_CS_32KHZ, LVCS_STEREODELAY_CS_44KHZ, LVCS_STEREODELAY_CS_48KHZ,
+ LVCS_STEREODELAY_CS_88KHZ, LVCS_STEREODELAY_CS_96KHZ, LVCS_STEREODELAY_CS_176KHZ,
+ LVCS_STEREODELAY_CS_192KHZ,
};
/************************************************************************************/
@@ -373,87 +216,46 @@
/************************************************************************************/
const BiquadA012B12CoefsSP_t LVCS_ReverbCoefTable[] = {
- /* Headphone coefficients */
- {CS_REVERB_8000_A0, /* 8kS/s coefficients */
- CS_REVERB_8000_A1,
- CS_REVERB_8000_A2,
- CS_REVERB_8000_B1,
- CS_REVERB_8000_B2,
- (LVM_UINT16 )CS_REVERB_8000_SCALE},
- {CS_REVERB_11025_A0, /* 11kS/s coefficients */
- CS_REVERB_11025_A1,
- CS_REVERB_11025_A2,
- CS_REVERB_11025_B1,
- CS_REVERB_11025_B2,
- (LVM_UINT16 )CS_REVERB_11025_SCALE},
- {CS_REVERB_12000_A0, /* 12kS/s coefficients */
- CS_REVERB_12000_A1,
- CS_REVERB_12000_A2,
- CS_REVERB_12000_B1,
- CS_REVERB_12000_B2,
- (LVM_UINT16 )CS_REVERB_12000_SCALE},
- {CS_REVERB_16000_A0, /* 16kS/s coefficients */
- CS_REVERB_16000_A1,
- CS_REVERB_16000_A2,
- CS_REVERB_16000_B1,
- CS_REVERB_16000_B2,
- (LVM_UINT16 )CS_REVERB_16000_SCALE},
- {CS_REVERB_22050_A0, /* 22kS/s coefficients */
- CS_REVERB_22050_A1,
- CS_REVERB_22050_A2,
- CS_REVERB_22050_B1,
- CS_REVERB_22050_B2,
- (LVM_UINT16 )CS_REVERB_22050_SCALE},
- {CS_REVERB_24000_A0, /* 24kS/s coefficients */
- CS_REVERB_24000_A1,
- CS_REVERB_24000_A2,
- CS_REVERB_24000_B1,
- CS_REVERB_24000_B2,
- (LVM_UINT16 )CS_REVERB_24000_SCALE},
- {CS_REVERB_32000_A0, /* 32kS/s coefficients */
- CS_REVERB_32000_A1,
- CS_REVERB_32000_A2,
- CS_REVERB_32000_B1,
- CS_REVERB_32000_B2,
- (LVM_UINT16 )CS_REVERB_32000_SCALE},
- {CS_REVERB_44100_A0, /* 44kS/s coefficients */
- CS_REVERB_44100_A1,
- CS_REVERB_44100_A2,
- CS_REVERB_44100_B1,
- CS_REVERB_44100_B2,
- (LVM_UINT16 )CS_REVERB_44100_SCALE},
- {CS_REVERB_48000_A0, /* 48kS/s coefficients */
- CS_REVERB_48000_A1,
- CS_REVERB_48000_A2,
- CS_REVERB_48000_B1,
- CS_REVERB_48000_B2,
- (LVM_UINT16 )CS_REVERB_48000_SCALE}
- ,
- {CS_REVERB_88200_A0, /* 88kS/s coefficients */
- CS_REVERB_88200_A1,
- CS_REVERB_88200_A2,
- CS_REVERB_88200_B1,
- CS_REVERB_88200_B2,
- (LVM_UINT16)CS_REVERB_88200_SCALE},
- {CS_REVERB_96000_A0, /* 96kS/s coefficients */
- CS_REVERB_96000_A1,
- CS_REVERB_96000_A2,
- CS_REVERB_96000_B1,
- CS_REVERB_96000_B2,
- (LVM_UINT16 )CS_REVERB_96000_SCALE},
- {CS_REVERB_176400_A0, /* 176kS/s coefficients */
- CS_REVERB_176400_A1,
- CS_REVERB_176400_A2,
- CS_REVERB_176400_B1,
- CS_REVERB_176400_B2,
- (LVM_UINT16)CS_REVERB_176400_SCALE},
- {CS_REVERB_192000_A0, /* 192kS/s coefficients */
- CS_REVERB_192000_A1,
- CS_REVERB_192000_A2,
- CS_REVERB_192000_B1,
- CS_REVERB_192000_B2,
- (LVM_UINT16 )CS_REVERB_192000_SCALE}
-};
+ /* Headphone coefficients */
+ {CS_REVERB_8000_A0, /* 8kS/s coefficients */
+ CS_REVERB_8000_A1, CS_REVERB_8000_A2, CS_REVERB_8000_B1, CS_REVERB_8000_B2,
+ (LVM_UINT16)CS_REVERB_8000_SCALE},
+ {CS_REVERB_11025_A0, /* 11kS/s coefficients */
+ CS_REVERB_11025_A1, CS_REVERB_11025_A2, CS_REVERB_11025_B1, CS_REVERB_11025_B2,
+ (LVM_UINT16)CS_REVERB_11025_SCALE},
+ {CS_REVERB_12000_A0, /* 12kS/s coefficients */
+ CS_REVERB_12000_A1, CS_REVERB_12000_A2, CS_REVERB_12000_B1, CS_REVERB_12000_B2,
+ (LVM_UINT16)CS_REVERB_12000_SCALE},
+ {CS_REVERB_16000_A0, /* 16kS/s coefficients */
+ CS_REVERB_16000_A1, CS_REVERB_16000_A2, CS_REVERB_16000_B1, CS_REVERB_16000_B2,
+ (LVM_UINT16)CS_REVERB_16000_SCALE},
+ {CS_REVERB_22050_A0, /* 22kS/s coefficients */
+ CS_REVERB_22050_A1, CS_REVERB_22050_A2, CS_REVERB_22050_B1, CS_REVERB_22050_B2,
+ (LVM_UINT16)CS_REVERB_22050_SCALE},
+ {CS_REVERB_24000_A0, /* 24kS/s coefficients */
+ CS_REVERB_24000_A1, CS_REVERB_24000_A2, CS_REVERB_24000_B1, CS_REVERB_24000_B2,
+ (LVM_UINT16)CS_REVERB_24000_SCALE},
+ {CS_REVERB_32000_A0, /* 32kS/s coefficients */
+ CS_REVERB_32000_A1, CS_REVERB_32000_A2, CS_REVERB_32000_B1, CS_REVERB_32000_B2,
+ (LVM_UINT16)CS_REVERB_32000_SCALE},
+ {CS_REVERB_44100_A0, /* 44kS/s coefficients */
+ CS_REVERB_44100_A1, CS_REVERB_44100_A2, CS_REVERB_44100_B1, CS_REVERB_44100_B2,
+ (LVM_UINT16)CS_REVERB_44100_SCALE},
+ {CS_REVERB_48000_A0, /* 48kS/s coefficients */
+ CS_REVERB_48000_A1, CS_REVERB_48000_A2, CS_REVERB_48000_B1, CS_REVERB_48000_B2,
+ (LVM_UINT16)CS_REVERB_48000_SCALE},
+ {CS_REVERB_88200_A0, /* 88kS/s coefficients */
+ CS_REVERB_88200_A1, CS_REVERB_88200_A2, CS_REVERB_88200_B1, CS_REVERB_88200_B2,
+ (LVM_UINT16)CS_REVERB_88200_SCALE},
+ {CS_REVERB_96000_A0, /* 96kS/s coefficients */
+ CS_REVERB_96000_A1, CS_REVERB_96000_A2, CS_REVERB_96000_B1, CS_REVERB_96000_B2,
+ (LVM_UINT16)CS_REVERB_96000_SCALE},
+ {CS_REVERB_176400_A0, /* 176kS/s coefficients */
+ CS_REVERB_176400_A1, CS_REVERB_176400_A2, CS_REVERB_176400_B1, CS_REVERB_176400_B2,
+ (LVM_UINT16)CS_REVERB_176400_SCALE},
+ {CS_REVERB_192000_A0, /* 192kS/s coefficients */
+ CS_REVERB_192000_A1, CS_REVERB_192000_A2, CS_REVERB_192000_B1, CS_REVERB_192000_B2,
+ (LVM_UINT16)CS_REVERB_192000_SCALE}};
/************************************************************************************/
/* */
@@ -461,20 +263,14 @@
/* */
/************************************************************************************/
-const Gain_t LVCS_OutputGainTable[] = {
- {LVCS_HEADPHONE_SHIFT, /* Headphone, stereo mode */
- LVCS_HEADPHONE_SHIFTLOSS,
- LVCS_HEADPHONE_GAIN},
- {LVCS_EX_HEADPHONE_SHIFT, /* EX Headphone, stereo mode */
- LVCS_EX_HEADPHONE_SHIFTLOSS,
- LVCS_EX_HEADPHONE_GAIN},
- {LVCS_HEADPHONE_SHIFT, /* Headphone, mono mode */
- LVCS_HEADPHONE_SHIFTLOSS,
- LVCS_HEADPHONE_GAIN},
- {LVCS_EX_HEADPHONE_SHIFT, /* EX Headphone, mono mode */
- LVCS_EX_HEADPHONE_SHIFTLOSS,
- LVCS_EX_HEADPHONE_GAIN}
-};
+const Gain_t LVCS_OutputGainTable[] = {{LVCS_HEADPHONE_SHIFT, /* Headphone, stereo mode */
+ LVCS_HEADPHONE_SHIFTLOSS, LVCS_HEADPHONE_GAIN},
+ {LVCS_EX_HEADPHONE_SHIFT, /* EX Headphone, stereo mode */
+ LVCS_EX_HEADPHONE_SHIFTLOSS, LVCS_EX_HEADPHONE_GAIN},
+ {LVCS_HEADPHONE_SHIFT, /* Headphone, mono mode */
+ LVCS_HEADPHONE_SHIFTLOSS, LVCS_HEADPHONE_GAIN},
+ {LVCS_EX_HEADPHONE_SHIFT, /* EX Headphone, mono mode */
+ LVCS_EX_HEADPHONE_SHIFTLOSS, LVCS_EX_HEADPHONE_GAIN}};
/************************************************************************************/
/* */
@@ -501,24 +297,14 @@
/* 1024 is -12dB gain */
/* */
/************************************************************************************/
-const LVCS_VolCorrect_t LVCS_VolCorrectTable[] = {
- {0.433362f, /* Headphone, stereo mode */
- 0.000000f,
- 1.000024f,
- 1.412640f},
- {0.433362f, /* EX Headphone, stereo mode */
- 0.000000f,
- 1.000024f,
- 1.412640f},
- {1.000000f, /* Headphone, mono mode */
- 0.000000f,
- 1.000024f,
- 1.412640f},
- {1.000000f, /* EX Headphone, mono mode */
- 0.000000f,
- 1.000024f,
- 1.412640f}
-};
+const LVCS_VolCorrect_t LVCS_VolCorrectTable[] = {{0.433362f, /* Headphone, stereo mode */
+ 0.000000f, 1.000024f, 1.412640f},
+ {0.433362f, /* EX Headphone, stereo mode */
+ 0.000000f, 1.000024f, 1.412640f},
+ {1.000000f, /* Headphone, mono mode */
+ 0.000000f, 1.000024f, 1.412640f},
+ {1.000000f, /* EX Headphone, mono mode */
+ 0.000000f, 1.000024f, 1.412640f}};
/************************************************************************************/
/* */
@@ -526,51 +312,32 @@
/* */
/************************************************************************************/
-#define LVCS_VOL_TC_Fs8000 32580 /* Floating point value 0.994262695 */
-#define LVCS_VOL_TC_Fs11025 32632 /* Floating point value 0.995849609 */
-#define LVCS_VOL_TC_Fs12000 32643 /* Floating point value 0.996185303 */
-#define LVCS_VOL_TC_Fs16000 32674 /* Floating point value 0.997131348 */
-#define LVCS_VOL_TC_Fs22050 32700 /* Floating point value 0.997924805 */
-#define LVCS_VOL_TC_Fs24000 32705 /* Floating point value 0.998077393 */
-#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 */
-#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*/
+#define LVCS_VOL_TC_Fs8000 32580 /* Floating point value 0.994262695 */
+#define LVCS_VOL_TC_Fs11025 32632 /* Floating point value 0.995849609 */
+#define LVCS_VOL_TC_Fs12000 32643 /* Floating point value 0.996185303 */
+#define LVCS_VOL_TC_Fs16000 32674 /* Floating point value 0.997131348 */
+#define LVCS_VOL_TC_Fs22050 32700 /* Floating point value 0.997924805 */
+#define LVCS_VOL_TC_Fs24000 32705 /* Floating point value 0.998077393 */
+#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 */
+#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*/
-const LVM_INT16 LVCS_VolumeTCTable[13] = {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,
- LVCS_VOL_TC_Fs88200,
- LVCS_VOL_TC_Fs96000,
- LVCS_VOL_TC_Fs176400,
- LVCS_VOL_TC_Fs192000
-};
+const LVM_INT16 LVCS_VolumeTCTable[13] = {
+ 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, LVCS_VOL_TC_Fs88200, LVCS_VOL_TC_Fs96000, LVCS_VOL_TC_Fs176400,
+ LVCS_VOL_TC_Fs192000};
/************************************************************************************/
/* */
/* Sample rate table */
/* */
/************************************************************************************/
-const LVM_INT32 LVCS_SampleRateTable[13] = {8000,
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 32000,
- 44100,
- 48000,
- 88200,
- 96000,
- 176400,
- 192000
-};
+const LVM_INT32 LVCS_SampleRateTable[13] = {8000, 11025, 12000, 16000, 22050, 24000, 32000,
+ 44100, 48000, 88200, 96000, 176400, 192000};
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
index 5490699..766f5f2 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Tables.h
@@ -24,7 +24,7 @@
/* */
/************************************************************************************/
-#include "BIQUAD.h" /* Biquad definitions */
+#include "BIQUAD.h" /* Biquad definitions */
/************************************************************************************/
/* */
@@ -106,35 +106,34 @@
/* */
/************************************************************************************/
-extern const LVM_INT32 LVCS_SampleRateTable[];
+extern const LVM_INT32 LVCS_SampleRateTable[];
/*Speaker coeffient tables*/
-extern LVM_UINT16 LVCS_MS_Small_SEMiddleGainTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Small_SESideCoefTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Small_EqualiserCoefTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Small_ReverbCoefTable[] ;
-extern LVM_UINT16 LVCS_MS_Small_StereoDelayCS4MS[];
-extern Gain_t LVCS_MS_Small_OutputGainTable[];
-extern LVCS_VolCorrect_t LVCS_MS_Small_VolCorrectTable[];
-extern LVM_UINT16 LVCS_MS_Small_ReverbGainTable[];
+extern LVM_UINT16 LVCS_MS_Small_SEMiddleGainTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Small_SESideCoefTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Small_EqualiserCoefTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Small_ReverbCoefTable[];
+extern LVM_UINT16 LVCS_MS_Small_StereoDelayCS4MS[];
+extern Gain_t LVCS_MS_Small_OutputGainTable[];
+extern LVCS_VolCorrect_t LVCS_MS_Small_VolCorrectTable[];
+extern LVM_UINT16 LVCS_MS_Small_ReverbGainTable[];
-extern LVM_UINT16 LVCS_MS_Medium_SEMiddleGainTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Medium_SESideCoefTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Medium_EqualiserCoefTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Medium_ReverbCoefTable[] ;
-extern LVM_UINT16 LVCS_MS_Medium_StereoDelayCS4MS[];
-extern Gain_t LVCS_MS_Medium_OutputGainTable[];
-extern LVCS_VolCorrect_t LVCS_MS_Medium_VolCorrectTable[];
-extern LVM_UINT16 LVCS_MS_Medium_ReverbGainTable[];
+extern LVM_UINT16 LVCS_MS_Medium_SEMiddleGainTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Medium_SESideCoefTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Medium_EqualiserCoefTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Medium_ReverbCoefTable[];
+extern LVM_UINT16 LVCS_MS_Medium_StereoDelayCS4MS[];
+extern Gain_t LVCS_MS_Medium_OutputGainTable[];
+extern LVCS_VolCorrect_t LVCS_MS_Medium_VolCorrectTable[];
+extern LVM_UINT16 LVCS_MS_Medium_ReverbGainTable[];
-extern LVM_UINT16 LVCS_MS_Large_SEMiddleGainTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Large_SESideCoefTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Large_EqualiserCoefTable[];
-extern BiquadA012B12CoefsSP_t LVCS_MS_Large_ReverbCoefTable[] ;
-extern LVM_UINT16 LVCS_MS_Large_StereoDelayCS4MS[];
-extern Gain_t LVCS_MS_Large_OutputGainTable[];
-extern LVCS_VolCorrect_t LVCS_MS_Large_VolCorrectTable[];
-extern LVM_UINT16 LVCS_MS_Large_ReverbGainTable[];
+extern LVM_UINT16 LVCS_MS_Large_SEMiddleGainTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Large_SESideCoefTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Large_EqualiserCoefTable[];
+extern BiquadA012B12CoefsSP_t LVCS_MS_Large_ReverbCoefTable[];
+extern LVM_UINT16 LVCS_MS_Large_StereoDelayCS4MS[];
+extern Gain_t LVCS_MS_Large_OutputGainTable[];
+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 aea7703..d026ab6 100644
--- a/media/libeffects/lvm/tests/Android.bp
+++ b/media/libeffects/lvm/tests/Android.bp
@@ -49,7 +49,7 @@
proprietary: true,
include_dirs: [
- "frameworks/av/media/libeffects/lvm/wrapper/Reverb"
+ "frameworks/av/media/libeffects/lvm/wrapper/Reverb",
],
header_libs: [
diff --git a/media/libeffects/lvm/tests/lvmtest.cpp b/media/libeffects/lvm/tests/lvmtest.cpp
index 59b27ad..5c5f646 100644
--- a/media/libeffects/lvm/tests/lvmtest.cpp
+++ b/media/libeffects/lvm/tests/lvmtest.cpp
@@ -33,156 +33,149 @@
#define ALOGVV ALOGV
#else
#define ALOGVV(a...) \
- do { \
- } while (false)
+ do { \
+ } while (false)
#endif
-#define CHECK_ARG(cond) \
- { \
- if (!(cond)) { \
- ALOGE("\tLVM_ERROR : Invalid argument: " #cond); \
- return -EINVAL; \
- } \
- \
-}
+#define CHECK_ARG(cond) \
+ { \
+ if (!(cond)) { \
+ ALOGE("\tLVM_ERROR : Invalid argument: " #cond); \
+ return -EINVAL; \
+ } \
+ }
-#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc) \
- { \
- if ((LvmStatus) == LVM_NULLADDRESS) { \
- ALOGE( \
- "\tLVM_ERROR : Parameter error - " \
- "null pointer returned by %s in %s\n\n\n\n", \
- callingFunc, calledFunc); \
- } \
- if ((LvmStatus) == LVM_ALIGNMENTERROR) { \
- ALOGE( \
- "\tLVM_ERROR : Parameter error - " \
- "bad alignment returned by %s in %s\n\n\n\n", \
- callingFunc, calledFunc); \
- } \
- if ((LvmStatus) == LVM_INVALIDNUMSAMPLES) { \
- ALOGE( \
- "\tLVM_ERROR : Parameter error - " \
- "bad number of samples returned by %s in %s\n\n\n\n", \
- callingFunc, calledFunc); \
- } \
- if ((LvmStatus) == LVM_OUTOFRANGE) { \
- ALOGE( \
- "\tLVM_ERROR : Parameter error - " \
- "out of range returned by %s in %s\n", \
- callingFunc, calledFunc); \
- } \
- }
+#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc) \
+ { \
+ if ((LvmStatus) == LVM_NULLADDRESS) { \
+ ALOGE("\tLVM_ERROR : Parameter error - " \
+ "null pointer returned by %s in %s\n\n\n\n", \
+ callingFunc, calledFunc); \
+ } \
+ if ((LvmStatus) == LVM_ALIGNMENTERROR) { \
+ ALOGE("\tLVM_ERROR : Parameter error - " \
+ "bad alignment returned by %s in %s\n\n\n\n", \
+ callingFunc, calledFunc); \
+ } \
+ if ((LvmStatus) == LVM_INVALIDNUMSAMPLES) { \
+ ALOGE("\tLVM_ERROR : Parameter error - " \
+ "bad number of samples returned by %s in %s\n\n\n\n", \
+ callingFunc, calledFunc); \
+ } \
+ if ((LvmStatus) == LVM_OUTOFRANGE) { \
+ ALOGE("\tLVM_ERROR : Parameter error - " \
+ "out of range returned by %s in %s\n", \
+ callingFunc, calledFunc); \
+ } \
+ }
struct lvmConfigParams_t {
- int samplingFreq = 44100;
- int nrChannels = 2;
- int chMask = AUDIO_CHANNEL_OUT_STEREO;
- int vcBal = 0;
- int fChannels = 2;
- bool monoMode = false;
- int bassEffectLevel = 0;
- int eqPresetLevel = 0;
- int frameLength = 256;
- LVM_BE_Mode_en bassEnable = LVM_BE_OFF;
- LVM_TE_Mode_en trebleEnable = LVM_TE_OFF;
- LVM_EQNB_Mode_en eqEnable = LVM_EQNB_OFF;
- LVM_Mode_en csEnable = LVM_MODE_OFF;
+ int samplingFreq = 44100;
+ int nrChannels = 2;
+ int chMask = AUDIO_CHANNEL_OUT_STEREO;
+ int vcBal = 0;
+ int fChannels = 2;
+ bool monoMode = false;
+ int bassEffectLevel = 0;
+ int eqPresetLevel = 0;
+ int frameLength = 256;
+ LVM_BE_Mode_en bassEnable = LVM_BE_OFF;
+ LVM_TE_Mode_en trebleEnable = LVM_TE_OFF;
+ LVM_EQNB_Mode_en eqEnable = LVM_EQNB_OFF;
+ LVM_Mode_en csEnable = LVM_MODE_OFF;
};
constexpr audio_channel_mask_t lvmConfigChMask[] = {
- AUDIO_CHANNEL_OUT_MONO,
- AUDIO_CHANNEL_OUT_STEREO,
- AUDIO_CHANNEL_OUT_2POINT1,
- AUDIO_CHANNEL_OUT_2POINT0POINT2,
- AUDIO_CHANNEL_OUT_QUAD,
- AUDIO_CHANNEL_OUT_QUAD_BACK,
- AUDIO_CHANNEL_OUT_QUAD_SIDE,
- AUDIO_CHANNEL_OUT_SURROUND,
- (1 << 4) - 1,
- AUDIO_CHANNEL_OUT_2POINT1POINT2,
- AUDIO_CHANNEL_OUT_3POINT0POINT2,
- AUDIO_CHANNEL_OUT_PENTA,
- (1 << 5) - 1,
- AUDIO_CHANNEL_OUT_3POINT1POINT2,
- AUDIO_CHANNEL_OUT_5POINT1,
- AUDIO_CHANNEL_OUT_5POINT1_BACK,
- AUDIO_CHANNEL_OUT_5POINT1_SIDE,
- (1 << 6) - 1,
- AUDIO_CHANNEL_OUT_6POINT1,
- (1 << 7) - 1,
- AUDIO_CHANNEL_OUT_5POINT1POINT2,
- AUDIO_CHANNEL_OUT_7POINT1,
- (1 << 8) - 1,
+ AUDIO_CHANNEL_OUT_MONO,
+ AUDIO_CHANNEL_OUT_STEREO,
+ AUDIO_CHANNEL_OUT_2POINT1,
+ AUDIO_CHANNEL_OUT_2POINT0POINT2,
+ AUDIO_CHANNEL_OUT_QUAD,
+ AUDIO_CHANNEL_OUT_QUAD_BACK,
+ AUDIO_CHANNEL_OUT_QUAD_SIDE,
+ AUDIO_CHANNEL_OUT_SURROUND,
+ AUDIO_CHANNEL_INDEX_MASK_4,
+ AUDIO_CHANNEL_OUT_2POINT1POINT2,
+ AUDIO_CHANNEL_OUT_3POINT0POINT2,
+ AUDIO_CHANNEL_OUT_PENTA,
+ AUDIO_CHANNEL_INDEX_MASK_5,
+ AUDIO_CHANNEL_OUT_3POINT1POINT2,
+ AUDIO_CHANNEL_OUT_5POINT1,
+ AUDIO_CHANNEL_OUT_5POINT1_BACK,
+ AUDIO_CHANNEL_OUT_5POINT1_SIDE,
+ AUDIO_CHANNEL_INDEX_MASK_6,
+ AUDIO_CHANNEL_OUT_6POINT1,
+ AUDIO_CHANNEL_INDEX_MASK_7,
+ AUDIO_CHANNEL_OUT_5POINT1POINT2,
+ AUDIO_CHANNEL_OUT_7POINT1,
+ AUDIO_CHANNEL_INDEX_MASK_8,
};
-
void printUsage() {
- printf("\nUsage: ");
- printf("\n <executable> -i:<input_file> -o:<out_file> [options]\n");
- printf("\nwhere, \n <inputfile> is the input file name");
- printf("\n on which LVM effects are applied");
- printf("\n <outputfile> processed output file");
- printf("\n and options are mentioned below");
- printf("\n");
- printf("\n -help (or) -h");
- printf("\n Prints this usage information");
- printf("\n");
- printf("\n -chMask:<channel_mask>\n");
- printf("\n 0 - AUDIO_CHANNEL_OUT_MONO");
- printf("\n 1 - AUDIO_CHANNEL_OUT_STEREO");
- printf("\n 2 - AUDIO_CHANNEL_OUT_2POINT1");
- printf("\n 3 - AUDIO_CHANNEL_OUT_2POINT0POINT2");
- printf("\n 4 - AUDIO_CHANNEL_OUT_QUAD");
- printf("\n 5 - AUDIO_CHANNEL_OUT_QUAD_BACK");
- printf("\n 6 - AUDIO_CHANNEL_OUT_QUAD_SIDE");
- printf("\n 7 - AUDIO_CHANNEL_OUT_SURROUND");
- printf("\n 8 - canonical channel index mask for 4 ch: (1 << 4) - 1");
- printf("\n 9 - AUDIO_CHANNEL_OUT_2POINT1POINT2");
- printf("\n 10 - AUDIO_CHANNEL_OUT_3POINT0POINT2");
- printf("\n 11 - AUDIO_CHANNEL_OUT_PENTA");
- printf("\n 12 - canonical channel index mask for 5 ch: (1 << 5) - 1");
- printf("\n 13 - AUDIO_CHANNEL_OUT_3POINT1POINT2");
- printf("\n 14 - AUDIO_CHANNEL_OUT_5POINT1");
- printf("\n 15 - AUDIO_CHANNEL_OUT_5POINT1_BACK");
- printf("\n 16 - AUDIO_CHANNEL_OUT_5POINT1_SIDE");
- printf("\n 17 - canonical channel index mask for 6 ch: (1 << 6) - 1");
- printf("\n 18 - AUDIO_CHANNEL_OUT_6POINT1");
- printf("\n 19 - canonical channel index mask for 7 ch: (1 << 7) - 1");
- printf("\n 20 - AUDIO_CHANNEL_OUT_5POINT1POINT2");
- printf("\n 21 - AUDIO_CHANNEL_OUT_7POINT1");
- printf("\n 22 - canonical channel index mask for 8 ch: (1 << 8) - 1");
- printf("\n default 0");
- printf("\n -vcBal:<Left Right Balance control in dB [-96 to 96 dB]>");
- printf("\n -ve values reduce Right channel while +ve value reduces Left channel");
- printf("\n default 0");
- printf("\n -fch:<file_channels> (1 through 8)\n\n");
- printf("\n -M");
- printf("\n Mono mode (force all input audio channels to be identical)");
- printf("\n -basslvl:<effect_level>");
- printf("\n A value that ranges between %d - %d default 0", LVM_BE_MIN_EFFECTLEVEL,
- LVM_BE_MAX_EFFECTLEVEL);
- printf("\n");
- printf("\n -eqPreset:<preset Value>");
- const size_t numPresetLvls = std::size(gEqualizerPresets);
- for (size_t i = 0; i < numPresetLvls; ++i) {
- printf("\n %zu - %s", i, gEqualizerPresets[i].name);
- }
- printf("\n default - 0");
- printf("\n -bE ");
- printf("\n Enable Dynamic Bass Enhancement");
- printf("\n");
- printf("\n -tE ");
- printf("\n Enable Treble Boost");
- printf("\n");
- printf("\n -csE ");
- printf("\n Enable Concert Surround");
- printf("\n");
- printf("\n -eqE ");
- printf("\n Enable Equalizer");
+ printf("\nUsage: ");
+ printf("\n <executable> -i:<input_file> -o:<out_file> [options]\n");
+ printf("\nwhere, \n <inputfile> is the input file name");
+ printf("\n on which LVM effects are applied");
+ printf("\n <outputfile> processed output file");
+ printf("\n and options are mentioned below");
+ printf("\n");
+ printf("\n -help (or) -h");
+ printf("\n Prints this usage information");
+ printf("\n");
+ printf("\n -chMask:<channel_mask>\n");
+ printf("\n 0 - AUDIO_CHANNEL_OUT_MONO");
+ printf("\n 1 - AUDIO_CHANNEL_OUT_STEREO");
+ printf("\n 2 - AUDIO_CHANNEL_OUT_2POINT1");
+ printf("\n 3 - AUDIO_CHANNEL_OUT_2POINT0POINT2");
+ printf("\n 4 - AUDIO_CHANNEL_OUT_QUAD");
+ printf("\n 5 - AUDIO_CHANNEL_OUT_QUAD_BACK");
+ printf("\n 6 - AUDIO_CHANNEL_OUT_QUAD_SIDE");
+ printf("\n 7 - AUDIO_CHANNEL_OUT_SURROUND");
+ printf("\n 8 - canonical channel index mask for 4 ch: (1 << 4) - 1");
+ printf("\n 9 - AUDIO_CHANNEL_OUT_2POINT1POINT2");
+ printf("\n 10 - AUDIO_CHANNEL_OUT_3POINT0POINT2");
+ printf("\n 11 - AUDIO_CHANNEL_OUT_PENTA");
+ printf("\n 12 - canonical channel index mask for 5 ch: (1 << 5) - 1");
+ printf("\n 13 - AUDIO_CHANNEL_OUT_3POINT1POINT2");
+ printf("\n 14 - AUDIO_CHANNEL_OUT_5POINT1");
+ printf("\n 15 - AUDIO_CHANNEL_OUT_5POINT1_BACK");
+ printf("\n 16 - AUDIO_CHANNEL_OUT_5POINT1_SIDE");
+ printf("\n 17 - canonical channel index mask for 6 ch: (1 << 6) - 1");
+ printf("\n 18 - AUDIO_CHANNEL_OUT_6POINT1");
+ printf("\n 19 - canonical channel index mask for 7 ch: (1 << 7) - 1");
+ printf("\n 20 - AUDIO_CHANNEL_OUT_5POINT1POINT2");
+ printf("\n 21 - AUDIO_CHANNEL_OUT_7POINT1");
+ printf("\n 22 - canonical channel index mask for 8 ch: (1 << 8) - 1");
+ printf("\n default 0");
+ printf("\n -vcBal:<Left Right Balance control in dB [-96 to 96 dB]>");
+ printf("\n -ve values reduce Right channel while +ve value reduces Left channel");
+ printf("\n default 0");
+ printf("\n -fch:<file_channels> (1 through 8)\n\n");
+ printf("\n -M");
+ printf("\n Mono mode (force all input audio channels to be identical)");
+ printf("\n -basslvl:<effect_level>");
+ printf("\n A value that ranges between %d - %d default 0", LVM_BE_MIN_EFFECTLEVEL,
+ LVM_BE_MAX_EFFECTLEVEL);
+ printf("\n");
+ printf("\n -eqPreset:<preset Value>");
+ const size_t numPresetLvls = std::size(gEqualizerPresets);
+ for (size_t i = 0; i < numPresetLvls; ++i) {
+ printf("\n %zu - %s", i, gEqualizerPresets[i].name);
+ }
+ printf("\n default - 0");
+ printf("\n -bE ");
+ printf("\n Enable Dynamic Bass Enhancement");
+ printf("\n");
+ printf("\n -tE ");
+ printf("\n Enable Treble Boost");
+ printf("\n");
+ printf("\n -csE ");
+ printf("\n Enable Concert Surround");
+ printf("\n");
+ printf("\n -eqE ");
+ printf("\n Enable Equalizer");
}
-
//----------------------------------------------------------------------------
// LvmBundle_init()
//----------------------------------------------------------------------------
@@ -196,528 +189,510 @@
//
//----------------------------------------------------------------------------
-int LvmBundle_init(struct EffectContext *pContext, LVM_ControlParams_t *params) {
- ALOGV("\tLvmBundle_init start");
+int LvmBundle_init(struct EffectContext* pContext, LVM_ControlParams_t* params) {
+ ALOGV("\tLvmBundle_init start");
- pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
- pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
- pContext->config.inputCfg.format = EFFECT_BUFFER_FORMAT;
- pContext->config.inputCfg.samplingRate = 44100;
- pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
- pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
- pContext->config.inputCfg.bufferProvider.cookie = NULL;
- pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
- pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
- pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
- pContext->config.outputCfg.format = EFFECT_BUFFER_FORMAT;
- pContext->config.outputCfg.samplingRate = 44100;
- pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
- pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL;
- pContext->config.outputCfg.bufferProvider.cookie = NULL;
- pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL;
+ pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
+ pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.inputCfg.format = EFFECT_BUFFER_FORMAT;
+ pContext->config.inputCfg.samplingRate = 44100;
+ pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
+ pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
+ pContext->config.inputCfg.bufferProvider.cookie = NULL;
+ pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
+ pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
+ pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.outputCfg.format = EFFECT_BUFFER_FORMAT;
+ pContext->config.outputCfg.samplingRate = 44100;
+ pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
+ pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL;
+ pContext->config.outputCfg.bufferProvider.cookie = NULL;
+ pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL;
- if (pContext->pBundledContext->hInstance != NULL) {
- ALOGV(
- "\tLvmBundle_init pContext->pBassBoost != NULL "
- "-> Calling pContext->pBassBoost->free()");
- LVM_DelInstanceHandle(&pContext->pBundledContext->hInstance);
+ if (pContext->pBundledContext->hInstance != NULL) {
+ ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
+ "-> Calling pContext->pBassBoost->free()");
+ LVM_DelInstanceHandle(&pContext->pBundledContext->hInstance);
- ALOGV(
- "\tLvmBundle_init pContext->pBassBoost != NULL "
- "-> Called pContext->pBassBoost->free()");
- }
+ ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
+ "-> Called pContext->pBassBoost->free()");
+ }
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
- LVM_InstParams_t InstParams; /* Instance parameters */
- LVM_EQNB_BandDef_t BandDefs[MAX_NUM_BANDS]; /* Equaliser band definitions */
- LVM_HeadroomParams_t HeadroomParams; /* Headroom parameters */
- LVM_HeadroomBandDef_t HeadroomBandDef[LVM_HEADROOM_MAX_NBANDS];
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_InstParams_t InstParams; /* Instance parameters */
+ LVM_EQNB_BandDef_t BandDefs[MAX_NUM_BANDS]; /* Equaliser band definitions */
+ LVM_HeadroomParams_t HeadroomParams; /* Headroom parameters */
+ LVM_HeadroomBandDef_t HeadroomBandDef[LVM_HEADROOM_MAX_NBANDS];
- /* Set the capabilities */
- InstParams.BufferMode = LVM_UNMANAGED_BUFFERS;
- InstParams.MaxBlockSize = MAX_CALL_SIZE;
- InstParams.EQNB_NumBands = MAX_NUM_BANDS;
- InstParams.PSA_Included = LVM_PSA_ON;
+ /* Set the capabilities */
+ InstParams.BufferMode = LVM_UNMANAGED_BUFFERS;
+ InstParams.MaxBlockSize = MAX_CALL_SIZE;
+ InstParams.EQNB_NumBands = MAX_NUM_BANDS;
+ InstParams.PSA_Included = LVM_PSA_ON;
- LvmStatus = LVM_GetInstanceHandle(&pContext->pBundledContext->hInstance,
- &InstParams);
+ LvmStatus = LVM_GetInstanceHandle(&pContext->pBundledContext->hInstance, &InstParams);
- LVM_ERROR_CHECK(LvmStatus, "LVM_GetInstanceHandle", "LvmBundle_init");
- if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+ LVM_ERROR_CHECK(LvmStatus, "LVM_GetInstanceHandle", "LvmBundle_init");
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- ALOGV(
- "\tLvmBundle_init CreateInstance Succesfully called "
- "LVM_GetInstanceHandle\n");
+ ALOGV("\tLvmBundle_init CreateInstance Successfully called "
+ "LVM_GetInstanceHandle\n");
- /* Set the initial process parameters */
- /* General parameters */
- params->OperatingMode = LVM_MODE_ON;
- params->SampleRate = LVM_FS_44100;
- params->SourceFormat = LVM_STEREO;
- params->ChMask = AUDIO_CHANNEL_OUT_STEREO;
- params->SpeakerType = LVM_HEADPHONES;
+ /* Set the initial process parameters */
+ /* General parameters */
+ params->OperatingMode = LVM_MODE_ON;
+ params->SampleRate = LVM_FS_44100;
+ params->SourceFormat = LVM_STEREO;
+ params->ChMask = AUDIO_CHANNEL_OUT_STEREO;
+ params->SpeakerType = LVM_HEADPHONES;
- pContext->pBundledContext->SampleRate = LVM_FS_44100;
+ pContext->pBundledContext->SampleRate = LVM_FS_44100;
- /* Concert Sound parameters */
- params->VirtualizerOperatingMode = LVM_MODE_OFF;
- params->VirtualizerType = LVM_CONCERTSOUND;
- params->VirtualizerReverbLevel = 100;
- params->CS_EffectLevel = LVM_CS_EFFECT_NONE;
+ /* Concert Sound parameters */
+ params->VirtualizerOperatingMode = LVM_MODE_OFF;
+ params->VirtualizerType = LVM_CONCERTSOUND;
+ params->VirtualizerReverbLevel = 100;
+ params->CS_EffectLevel = LVM_CS_EFFECT_NONE;
- /* N-Band Equaliser parameters */
- params->EQNB_OperatingMode = LVM_EQNB_ON;
- params->EQNB_NBands = FIVEBAND_NUMBANDS;
- params->pEQNB_BandDefinition = &BandDefs[0];
+ /* N-Band Equaliser parameters */
+ params->EQNB_OperatingMode = LVM_EQNB_ON;
+ params->EQNB_NBands = FIVEBAND_NUMBANDS;
+ params->pEQNB_BandDefinition = &BandDefs[0];
- for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- BandDefs[i].Frequency = EQNB_5BandPresetsFrequencies[i];
- BandDefs[i].QFactor = EQNB_5BandPresetsQFactors[i];
- BandDefs[i].Gain = EQNB_5BandSoftPresets[i];
- }
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
+ BandDefs[i].Frequency = EQNB_5BandPresetsFrequencies[i];
+ BandDefs[i].QFactor = EQNB_5BandPresetsQFactors[i];
+ BandDefs[i].Gain = EQNB_5BandSoftPresets[i];
+ }
- /* Volume Control parameters */
- params->VC_EffectLevel = 0;
- params->VC_Balance = 0;
+ /* Volume Control parameters */
+ params->VC_EffectLevel = 0;
+ params->VC_Balance = 0;
- /* Treble Enhancement parameters */
- params->TE_OperatingMode = LVM_TE_OFF;
- params->TE_EffectLevel = 0;
+ /* Treble Enhancement parameters */
+ params->TE_OperatingMode = LVM_TE_OFF;
+ params->TE_EffectLevel = 0;
- /* PSA Control parameters */
- params->PSA_Enable = LVM_PSA_OFF;
- params->PSA_PeakDecayRate = (LVM_PSA_DecaySpeed_en)0;
+ /* PSA Control parameters */
+ params->PSA_Enable = LVM_PSA_OFF;
+ params->PSA_PeakDecayRate = (LVM_PSA_DecaySpeed_en)0;
- /* Bass Enhancement parameters */
- params->BE_OperatingMode = LVM_BE_ON;
- params->BE_EffectLevel = 0;
- params->BE_CentreFreq = LVM_BE_CENTRE_90Hz;
- params->BE_HPF = LVM_BE_HPF_ON;
+ /* Bass Enhancement parameters */
+ params->BE_OperatingMode = LVM_BE_ON;
+ params->BE_EffectLevel = 0;
+ params->BE_CentreFreq = LVM_BE_CENTRE_90Hz;
+ params->BE_HPF = LVM_BE_HPF_ON;
- /* PSA Control parameters */
- params->PSA_Enable = LVM_PSA_OFF;
- params->PSA_PeakDecayRate = LVM_PSA_SPEED_MEDIUM;
+ /* PSA Control parameters */
+ params->PSA_Enable = LVM_PSA_OFF;
+ params->PSA_PeakDecayRate = LVM_PSA_SPEED_MEDIUM;
- /* TE Control parameters */
- params->TE_OperatingMode = LVM_TE_OFF;
- params->TE_EffectLevel = 0;
+ /* TE Control parameters */
+ params->TE_OperatingMode = LVM_TE_OFF;
+ params->TE_EffectLevel = 0;
- /* Activate the initial settings */
- LvmStatus =
- LVM_SetControlParameters(pContext->pBundledContext->hInstance, params);
+ /* Activate the initial settings */
+ LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, params);
- LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmBundle_init");
- if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+ LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmBundle_init");
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- ALOGV(
- "\tLvmBundle_init CreateInstance Succesfully called "
- "LVM_SetControlParameters\n");
+ ALOGV("\tLvmBundle_init CreateInstance Successfully called "
+ "LVM_SetControlParameters\n");
- /* Set the headroom parameters */
- HeadroomBandDef[0].Limit_Low = 20;
- HeadroomBandDef[0].Limit_High = 4999;
- HeadroomBandDef[0].Headroom_Offset = 0;
- HeadroomBandDef[1].Limit_Low = 5000;
- HeadroomBandDef[1].Limit_High = 24000;
- HeadroomBandDef[1].Headroom_Offset = 0;
- HeadroomParams.pHeadroomDefinition = &HeadroomBandDef[0];
- HeadroomParams.Headroom_OperatingMode = LVM_HEADROOM_ON;
- HeadroomParams.NHeadroomBands = 2;
+ /* Set the headroom parameters */
+ HeadroomBandDef[0].Limit_Low = 20;
+ HeadroomBandDef[0].Limit_High = 4999;
+ HeadroomBandDef[0].Headroom_Offset = 0;
+ HeadroomBandDef[1].Limit_Low = 5000;
+ HeadroomBandDef[1].Limit_High = 24000;
+ HeadroomBandDef[1].Headroom_Offset = 0;
+ HeadroomParams.pHeadroomDefinition = &HeadroomBandDef[0];
+ HeadroomParams.Headroom_OperatingMode = LVM_HEADROOM_ON;
+ HeadroomParams.NHeadroomBands = 2;
- LvmStatus = LVM_SetHeadroomParams(pContext->pBundledContext->hInstance,
- &HeadroomParams);
+ LvmStatus = LVM_SetHeadroomParams(pContext->pBundledContext->hInstance, &HeadroomParams);
- LVM_ERROR_CHECK(LvmStatus, "LVM_SetHeadroomParams", "LvmBundle_init");
- if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+ LVM_ERROR_CHECK(LvmStatus, "LVM_SetHeadroomParams", "LvmBundle_init");
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- ALOGV(
- "\tLvmBundle_init CreateInstance Succesfully called "
- "LVM_SetHeadroomParams\n");
- ALOGV("\tLvmBundle_init End");
- return 0;
+ ALOGV("\tLvmBundle_init CreateInstance Successfully called "
+ "LVM_SetHeadroomParams\n");
+ ALOGV("\tLvmBundle_init End");
+ return 0;
} /* end LvmBundle_init */
-int lvmCreate(struct EffectContext *pContext,
- lvmConfigParams_t *plvmConfigParams,
- LVM_ControlParams_t *params) {
- int ret = 0;
- pContext->pBundledContext = NULL;
- pContext->pBundledContext = (BundledEffectContext *)malloc(sizeof(struct BundledEffectContext));
- if (NULL == pContext->pBundledContext) {
- return -EINVAL;
- }
-
- pContext->pBundledContext->SessionNo = 0;
- pContext->pBundledContext->SessionId = 0;
- pContext->pBundledContext->hInstance = NULL;
- pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
- pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
- pContext->pBundledContext->bBassEnabled = LVM_FALSE;
- pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
- pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
- pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
- pContext->pBundledContext->nOutputDevice = AUDIO_DEVICE_NONE;
- pContext->pBundledContext->nVirtualizerForcedDevice = AUDIO_DEVICE_NONE;
- pContext->pBundledContext->NumberEffectsEnabled = 0;
- pContext->pBundledContext->NumberEffectsCalled = 0;
- pContext->pBundledContext->firstVolume = LVM_TRUE;
- pContext->pBundledContext->volume = 0;
-
- /* 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
- * quantisation like effect when returning
- */
- pContext->pBundledContext->BassStrengthSaved = 0;
- pContext->pBundledContext->VirtStrengthSaved = 0;
- pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
- pContext->pBundledContext->levelSaved = 0;
- pContext->pBundledContext->bMuteEnabled = LVM_FALSE;
- pContext->pBundledContext->bStereoPositionEnabled = LVM_FALSE;
- pContext->pBundledContext->positionSaved = 0;
- pContext->pBundledContext->workBuffer = NULL;
- pContext->pBundledContext->frameCount = -1;
- pContext->pBundledContext->SamplesToExitCountVirt = 0;
- pContext->pBundledContext->SamplesToExitCountBb = 0;
- pContext->pBundledContext->SamplesToExitCountEq = 0;
- for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
- }
- pContext->config.inputCfg.channels = plvmConfigParams->nrChannels;
- ALOGV("\tEffectCreate - Calling LvmBundle_init");
- ret = LvmBundle_init(pContext, params);
-
- if (ret < 0) {
- ALOGE("\tLVM_ERROR : lvmCreate() Bundle init failed");
- return ret;
- }
- return 0;
-}
-
-int lvmControl(struct EffectContext *pContext,
- lvmConfigParams_t *plvmConfigParams,
- LVM_ControlParams_t *params) {
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
-
- /* Set the initial process parameters */
- /* General parameters */
- params->OperatingMode = LVM_MODE_ON;
- params->SpeakerType = LVM_HEADPHONES;
-
- params->ChMask = plvmConfigParams->chMask;
- params->NrChannels = plvmConfigParams->nrChannels;
- if (params->NrChannels == 1) {
- params->SourceFormat = LVM_MONO;
- } else if (params->NrChannels == 2) {
- params->SourceFormat = LVM_STEREO;
- } else if (params->NrChannels > 2 && params->NrChannels <= 8) { // FCC_2 FCC_8
- params->SourceFormat = LVM_MULTICHANNEL;
- } else {
- return -EINVAL;
- }
-
- LVM_Fs_en sampleRate;
- switch (plvmConfigParams->samplingFreq) {
- case 8000:
- sampleRate = LVM_FS_8000;
- break;
- case 11025:
- sampleRate = LVM_FS_11025;
- break;
- case 12000:
- sampleRate = LVM_FS_12000;
- break;
- case 16000:
- sampleRate = LVM_FS_16000;
- break;
- case 22050:
- sampleRate = LVM_FS_22050;
- break;
- case 24000:
- sampleRate = LVM_FS_24000;
- break;
- case 32000:
- sampleRate = LVM_FS_32000;
- break;
- case 44100:
- sampleRate = LVM_FS_44100;
- break;
- case 48000:
- sampleRate = LVM_FS_48000;
- break;
- case 88200:
- sampleRate = LVM_FS_88200;
- break;
- case 96000:
- sampleRate = LVM_FS_96000;
- break;
- case 176400:
- sampleRate = LVM_FS_176400;
- break;
- case 192000:
- sampleRate = LVM_FS_192000;
- break;
- default:
- return -EINVAL;
- }
- params->SampleRate = sampleRate;
-
- /* Concert Sound parameters */
- params->VirtualizerOperatingMode = plvmConfigParams->csEnable;
- params->VirtualizerType = LVM_CONCERTSOUND;
- params->VirtualizerReverbLevel = 100;
- params->CS_EffectLevel = LVM_CS_EFFECT_NONE;
-
- /* N-Band Equaliser parameters */
- const int eqPresetLevel = plvmConfigParams->eqPresetLevel;
- LVM_EQNB_BandDef_t BandDefs[MAX_NUM_BANDS]; /* Equaliser band definitions */
- for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- BandDefs[i].Frequency = EQNB_5BandPresetsFrequencies[i];
- BandDefs[i].QFactor = EQNB_5BandPresetsQFactors[i];
- BandDefs[i].Gain =
- EQNB_5BandSoftPresets[(FIVEBAND_NUMBANDS * eqPresetLevel) + i];
- }
- params->EQNB_OperatingMode = plvmConfigParams->eqEnable;
- // Caution: raw pointer to stack data, stored in instance by LVM_SetControlParameters.
- params->pEQNB_BandDefinition = &BandDefs[0];
-
- /* Volume Control parameters */
- params->VC_EffectLevel = 0;
- params->VC_Balance = plvmConfigParams->vcBal;
-
- /* Treble Enhancement parameters */
- params->TE_OperatingMode = plvmConfigParams->trebleEnable;
-
- /* PSA Control parameters */
- params->PSA_Enable = LVM_PSA_ON;
-
- /* Bass Enhancement parameters */
- params->BE_OperatingMode = plvmConfigParams->bassEnable;
-
- /* Activate the initial settings */
- LvmStatus =
- LVM_SetControlParameters(pContext->pBundledContext->hInstance, params);
-
- LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmBundle_init");
- if (LvmStatus != LVM_SUCCESS) return -EINVAL;
-
- LvmStatus = LVM_ApplyNewSettings(pContext->pBundledContext->hInstance);
-
- if (LvmStatus != LVM_SUCCESS) return -EINVAL;
-
- return 0;
-}
-
-int lvmExecute(float *floatIn, float *floatOut, struct EffectContext *pContext,
- lvmConfigParams_t *plvmConfigParams) {
- const int frameLength = plvmConfigParams->frameLength;
- return
- LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
- floatIn, /* Input buffer */
- floatOut, /* Output buffer */
- (LVM_UINT16)frameLength, /* Number of samples to read */
- 0); /* Audio Time */
-}
-
-int lvmMainProcess(EffectContext *pContext,
- LVM_ControlParams_t *pParams,
- lvmConfigParams_t *plvmConfigParams,
- FILE *finp,
- FILE *fout) {
- int errCode = lvmControl(pContext, plvmConfigParams, pParams);
- if (errCode) {
- ALOGE("Error: lvmControl returned with %d\n", errCode);
- return errCode;
- }
-
- const int channelCount = plvmConfigParams->nrChannels;
- const int frameLength = plvmConfigParams->frameLength;
- const int frameSize = channelCount * sizeof(float); // processing size
- const int ioChannelCount = plvmConfigParams->fChannels;
- const int ioFrameSize = ioChannelCount * sizeof(short); // file load size
- const int maxChannelCount = std::max(channelCount, ioChannelCount);
- /*
- * Mono input will be converted to 2 channels internally in the process call
- * by copying the same data into the second channel.
- * Hence when channelCount is 1, output buffer should be allocated for
- * 2 channels. The memAllocChCount takes care of allocation of sufficient
- * memory for the output buffer.
- */
- const int memAllocChCount = (channelCount == 1 ? 2 : channelCount);
-
- std::vector<short> in(frameLength * maxChannelCount);
- std::vector<short> out(frameLength * maxChannelCount);
- std::vector<float> floatIn(frameLength * channelCount);
- std::vector<float> floatOut(frameLength * memAllocChCount);
-
- int frameCounter = 0;
- while (fread(in.data(), ioFrameSize, frameLength, finp) == (size_t)frameLength) {
- if (ioChannelCount != channelCount) {
- adjust_channels(in.data(), ioChannelCount, in.data(), channelCount,
- sizeof(short), frameLength * ioFrameSize);
+int lvmCreate(struct EffectContext* pContext, lvmConfigParams_t* plvmConfigParams,
+ LVM_ControlParams_t* params) {
+ int ret = 0;
+ pContext->pBundledContext = NULL;
+ pContext->pBundledContext = (BundledEffectContext*)malloc(sizeof(struct BundledEffectContext));
+ if (NULL == pContext->pBundledContext) {
+ return -EINVAL;
}
- memcpy_to_float_from_i16(floatIn.data(), in.data(), frameLength * channelCount);
- // Mono mode will replicate the first channel to all other channels.
- // This ensures all audio channels are identical. This is useful for testing
- // Bass Boost, which extracts a mono signal for processing.
- if (plvmConfigParams->monoMode && channelCount > 1) {
- for (int i = 0; i < frameLength; ++i) {
- auto *fp = &floatIn[i * channelCount];
- std::fill(fp + 1, fp + channelCount, *fp); // replicate ch 0
+ pContext->pBundledContext->SessionNo = 0;
+ pContext->pBundledContext->SessionId = 0;
+ pContext->pBundledContext->hInstance = NULL;
+ pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
+ pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
+ pContext->pBundledContext->bBassEnabled = LVM_FALSE;
+ pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
+ pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
+ pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
+ pContext->pBundledContext->nOutputDevice = AUDIO_DEVICE_NONE;
+ pContext->pBundledContext->nVirtualizerForcedDevice = AUDIO_DEVICE_NONE;
+ pContext->pBundledContext->NumberEffectsEnabled = 0;
+ pContext->pBundledContext->NumberEffectsCalled = 0;
+ pContext->pBundledContext->firstVolume = LVM_TRUE;
+ pContext->pBundledContext->volume = 0;
+
+ /* 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
+ * quantisation like effect when returning
+ */
+ pContext->pBundledContext->BassStrengthSaved = 0;
+ pContext->pBundledContext->VirtStrengthSaved = 0;
+ pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
+ pContext->pBundledContext->levelSaved = 0;
+ pContext->pBundledContext->bMuteEnabled = LVM_FALSE;
+ pContext->pBundledContext->bStereoPositionEnabled = LVM_FALSE;
+ pContext->pBundledContext->positionSaved = 0;
+ pContext->pBundledContext->workBuffer = NULL;
+ pContext->pBundledContext->frameCount = -1;
+ pContext->pBundledContext->SamplesToExitCountVirt = 0;
+ pContext->pBundledContext->SamplesToExitCountBb = 0;
+ pContext->pBundledContext->SamplesToExitCountEq = 0;
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
+ pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
+ }
+ pContext->config.inputCfg.channels = plvmConfigParams->nrChannels;
+ ALOGV("\tEffectCreate - Calling LvmBundle_init");
+ ret = LvmBundle_init(pContext, params);
+
+ if (ret < 0) {
+ ALOGE("\tLVM_ERROR : lvmCreate() Bundle init failed");
+ return ret;
+ }
+ return 0;
+}
+
+int lvmControl(struct EffectContext* pContext, lvmConfigParams_t* plvmConfigParams,
+ LVM_ControlParams_t* params) {
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+
+ /* Set the initial process parameters */
+ /* General parameters */
+ params->OperatingMode = LVM_MODE_ON;
+ params->SpeakerType = LVM_HEADPHONES;
+
+ params->ChMask = plvmConfigParams->chMask;
+ params->NrChannels = plvmConfigParams->nrChannels;
+ if (params->NrChannels == 1) {
+ params->SourceFormat = LVM_MONO;
+ } else if (params->NrChannels == 2) {
+ params->SourceFormat = LVM_STEREO;
+ } else if (params->NrChannels > 2 && params->NrChannels <= 8) { // FCC_2 FCC_8
+ params->SourceFormat = LVM_MULTICHANNEL;
+ } else {
+ return -EINVAL;
+ }
+
+ LVM_Fs_en sampleRate;
+ switch (plvmConfigParams->samplingFreq) {
+ case 8000:
+ sampleRate = LVM_FS_8000;
+ break;
+ case 11025:
+ sampleRate = LVM_FS_11025;
+ break;
+ case 12000:
+ sampleRate = LVM_FS_12000;
+ break;
+ case 16000:
+ sampleRate = LVM_FS_16000;
+ break;
+ case 22050:
+ sampleRate = LVM_FS_22050;
+ break;
+ case 24000:
+ sampleRate = LVM_FS_24000;
+ break;
+ case 32000:
+ sampleRate = LVM_FS_32000;
+ break;
+ case 44100:
+ sampleRate = LVM_FS_44100;
+ break;
+ case 48000:
+ sampleRate = LVM_FS_48000;
+ break;
+ case 88200:
+ sampleRate = LVM_FS_88200;
+ break;
+ case 96000:
+ sampleRate = LVM_FS_96000;
+ break;
+ case 176400:
+ sampleRate = LVM_FS_176400;
+ break;
+ case 192000:
+ sampleRate = LVM_FS_192000;
+ break;
+ default:
+ return -EINVAL;
+ }
+ params->SampleRate = sampleRate;
+
+ /* Concert Sound parameters */
+ params->VirtualizerOperatingMode = plvmConfigParams->csEnable;
+ params->VirtualizerType = LVM_CONCERTSOUND;
+ params->VirtualizerReverbLevel = 100;
+ params->CS_EffectLevel = LVM_CS_EFFECT_NONE;
+
+ /* N-Band Equaliser parameters */
+ const int eqPresetLevel = plvmConfigParams->eqPresetLevel;
+ LVM_EQNB_BandDef_t BandDefs[MAX_NUM_BANDS]; /* Equaliser band definitions */
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
+ BandDefs[i].Frequency = EQNB_5BandPresetsFrequencies[i];
+ BandDefs[i].QFactor = EQNB_5BandPresetsQFactors[i];
+ BandDefs[i].Gain = EQNB_5BandSoftPresets[(FIVEBAND_NUMBANDS * eqPresetLevel) + i];
+ }
+ params->EQNB_OperatingMode = plvmConfigParams->eqEnable;
+ // Caution: raw pointer to stack data, stored in instance by LVM_SetControlParameters.
+ params->pEQNB_BandDefinition = &BandDefs[0];
+
+ /* Volume Control parameters */
+ params->VC_EffectLevel = 0;
+ params->VC_Balance = plvmConfigParams->vcBal;
+
+ /* Treble Enhancement parameters */
+ params->TE_OperatingMode = plvmConfigParams->trebleEnable;
+
+ /* PSA Control parameters */
+ params->PSA_Enable = LVM_PSA_ON;
+
+ /* Bass Enhancement parameters */
+ params->BE_OperatingMode = plvmConfigParams->bassEnable;
+
+ /* Activate the initial settings */
+ LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, params);
+
+ LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmBundle_init");
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+
+ LvmStatus = LVM_ApplyNewSettings(pContext->pBundledContext->hInstance);
+
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+
+ return 0;
+}
+
+int lvmExecute(float* floatIn, float* floatOut, struct EffectContext* pContext,
+ lvmConfigParams_t* plvmConfigParams) {
+ const int frameLength = plvmConfigParams->frameLength;
+ return LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
+ floatIn, /* Input buffer */
+ floatOut, /* Output buffer */
+ (LVM_UINT16)frameLength, /* Number of samples to read */
+ 0); /* Audio Time */
+}
+
+int lvmMainProcess(EffectContext* pContext, LVM_ControlParams_t* pParams,
+ lvmConfigParams_t* plvmConfigParams, FILE* finp, FILE* fout) {
+ int errCode = lvmControl(pContext, plvmConfigParams, pParams);
+ if (errCode) {
+ ALOGE("Error: lvmControl returned with %d\n", errCode);
+ return errCode;
+ }
+
+ const int channelCount = plvmConfigParams->nrChannels;
+ const int frameLength = plvmConfigParams->frameLength;
+ const int frameSize = channelCount * sizeof(float); // processing size
+ const int ioChannelCount = plvmConfigParams->fChannels;
+ const int ioFrameSize = ioChannelCount * sizeof(short); // file load size
+ const int maxChannelCount = std::max(channelCount, ioChannelCount);
+ /*
+ * Mono input will be converted to 2 channels internally in the process call
+ * by copying the same data into the second channel.
+ * Hence when channelCount is 1, output buffer should be allocated for
+ * 2 channels. The memAllocChCount takes care of allocation of sufficient
+ * memory for the output buffer.
+ */
+ const int memAllocChCount = (channelCount == 1 ? 2 : channelCount);
+
+ std::vector<short> in(frameLength * maxChannelCount);
+ std::vector<short> out(frameLength * maxChannelCount);
+ std::vector<float> floatIn(frameLength * channelCount);
+ std::vector<float> floatOut(frameLength * memAllocChCount);
+
+ int frameCounter = 0;
+ while (fread(in.data(), ioFrameSize, frameLength, finp) == (size_t)frameLength) {
+ if (ioChannelCount != channelCount) {
+ adjust_channels(in.data(), ioChannelCount, in.data(), channelCount, sizeof(short),
+ frameLength * ioFrameSize);
+ }
+ memcpy_to_float_from_i16(floatIn.data(), in.data(), frameLength * channelCount);
+
+ // Mono mode will replicate the first channel to all other channels.
+ // This ensures all audio channels are identical. This is useful for testing
+ // Bass Boost, which extracts a mono signal for processing.
+ if (plvmConfigParams->monoMode && channelCount > 1) {
+ for (int i = 0; i < frameLength; ++i) {
+ auto* fp = &floatIn[i * channelCount];
+ std::fill(fp + 1, fp + channelCount, *fp); // replicate ch 0
+ }
+ }
+#ifndef BYPASS_EXEC
+ errCode = lvmExecute(floatIn.data(), floatOut.data(), pContext, plvmConfigParams);
+ if (errCode) {
+ printf("\nError: lvmExecute returned with %d\n", errCode);
+ return errCode;
+ }
+
+ (void)frameSize; // eliminate warning
+#else
+ memcpy(floatOut.data(), floatIn.data(), frameLength * frameSize);
+#endif
+ memcpy_to_i16_from_float(out.data(), floatOut.data(), frameLength * channelCount);
+ if (ioChannelCount != channelCount) {
+ adjust_channels(out.data(), channelCount, out.data(), ioChannelCount, sizeof(short),
+ frameLength * channelCount * sizeof(short));
+ }
+ (void)fwrite(out.data(), ioFrameSize, frameLength, fout);
+ frameCounter += frameLength;
+ }
+ printf("frameCounter: [%d]\n", frameCounter);
+ return 0;
+}
+
+int main(int argc, const char* argv[]) {
+ if (argc == 1) {
+ printUsage();
+ return -1;
+ }
+
+ lvmConfigParams_t lvmConfigParams{}; // default initialize
+ const char* infile = nullptr;
+ const char* outfile = nullptr;
+
+ for (int i = 1; i < argc; i++) {
+ printf("%s ", argv[i]);
+ if (!strncmp(argv[i], "-i:", 3)) {
+ infile = argv[i] + 3;
+ } else if (!strncmp(argv[i], "-o:", 3)) {
+ outfile = argv[i] + 3;
+ } else if (!strncmp(argv[i], "-fs:", 4)) {
+ const int samplingFreq = atoi(argv[i] + 4);
+ if (samplingFreq != 8000 && samplingFreq != 11025 && samplingFreq != 12000 &&
+ samplingFreq != 16000 && samplingFreq != 22050 && samplingFreq != 24000 &&
+ samplingFreq != 32000 && samplingFreq != 44100 && samplingFreq != 48000 &&
+ samplingFreq != 88200 && samplingFreq != 96000 && samplingFreq != 176400 &&
+ samplingFreq != 192000) {
+ printf("Error: Unsupported Sampling Frequency : %d\n", samplingFreq);
+ return -1;
+ }
+ lvmConfigParams.samplingFreq = samplingFreq;
+ } else if (!strncmp(argv[i], "-chMask:", 8)) {
+ const int chMaskConfigIdx = atoi(argv[i] + 8);
+ if (chMaskConfigIdx < 0 || (size_t)chMaskConfigIdx >= std::size(lvmConfigChMask)) {
+ ALOGE("\nError: Unsupported Channel Mask : %d\n", chMaskConfigIdx);
+ return -1;
+ }
+ const audio_channel_mask_t chMask = lvmConfigChMask[chMaskConfigIdx];
+ lvmConfigParams.chMask = chMask;
+ lvmConfigParams.nrChannels = audio_channel_count_from_out_mask(chMask);
+ } else if (!strncmp(argv[i], "-vcBal:", 7)) {
+ const int vcBalance = atoi(argv[i] + 7);
+ if (vcBalance > 96 || vcBalance < -96) {
+ ALOGE("\nError: Unsupported volume balance value: %d\n", vcBalance);
+ }
+ lvmConfigParams.vcBal = vcBalance;
+ } else if (!strncmp(argv[i], "-fch:", 5)) {
+ const int fChannels = atoi(argv[i] + 5);
+ if (fChannels > 8 || fChannels < 1) {
+ printf("Error: Unsupported number of file channels : %d\n", fChannels);
+ return -1;
+ }
+ lvmConfigParams.fChannels = fChannels;
+ } else if (!strcmp(argv[i], "-M")) {
+ lvmConfigParams.monoMode = true;
+ } else if (!strncmp(argv[i], "-basslvl:", 9)) {
+ const int bassEffectLevel = atoi(argv[i] + 9);
+ if (bassEffectLevel > LVM_BE_MAX_EFFECTLEVEL ||
+ bassEffectLevel < LVM_BE_MIN_EFFECTLEVEL) {
+ printf("Error: Unsupported Bass Effect Level : %d\n", bassEffectLevel);
+ printUsage();
+ return -1;
+ }
+ lvmConfigParams.bassEffectLevel = bassEffectLevel;
+ } else if (!strncmp(argv[i], "-eqPreset:", 10)) {
+ const int eqPresetLevel = atoi(argv[i] + 10);
+ const int numPresetLvls = std::size(gEqualizerPresets);
+ if (eqPresetLevel >= numPresetLvls || eqPresetLevel < 0) {
+ printf("Error: Unsupported Equalizer Preset : %d\n", eqPresetLevel);
+ printUsage();
+ return -1;
+ }
+ lvmConfigParams.eqPresetLevel = eqPresetLevel;
+ } else if (!strcmp(argv[i], "-bE")) {
+ lvmConfigParams.bassEnable = LVM_BE_ON;
+ } else if (!strcmp(argv[i], "-eqE")) {
+ lvmConfigParams.eqEnable = LVM_EQNB_ON;
+ } else if (!strcmp(argv[i], "-tE")) {
+ lvmConfigParams.trebleEnable = LVM_TE_ON;
+ } else if (!strcmp(argv[i], "-csE")) {
+ lvmConfigParams.csEnable = LVM_MODE_ON;
+ } else if (!strcmp(argv[i], "-h")) {
+ printUsage();
+ return 0;
}
}
-#ifndef BYPASS_EXEC
- errCode = lvmExecute(floatIn.data(), floatOut.data(), pContext, plvmConfigParams);
- if (errCode) {
- printf("\nError: lvmExecute returned with %d\n", errCode);
- return errCode;
- }
- (void)frameSize; // eliminate warning
-#else
- memcpy(floatOut.data(), floatIn.data(), frameLength * frameSize);
-#endif
- memcpy_to_i16_from_float(out.data(), floatOut.data(), frameLength * channelCount);
- if (ioChannelCount != channelCount) {
- adjust_channels(out.data(), channelCount, out.data(), ioChannelCount,
- sizeof(short), frameLength * channelCount * sizeof(short));
- }
- (void) fwrite(out.data(), ioFrameSize, frameLength, fout);
- frameCounter += frameLength;
- }
- printf("frameCounter: [%d]\n", frameCounter);
- return 0;
-}
-
-int main(int argc, const char *argv[]) {
- if (argc == 1) {
- printUsage();
- return -1;
- }
-
- lvmConfigParams_t lvmConfigParams{}; // default initialize
- const char *infile = nullptr;
- const char *outfile = nullptr;
-
- for (int i = 1; i < argc; i++) {
- printf("%s ", argv[i]);
- if (!strncmp(argv[i], "-i:", 3)) {
- infile = argv[i] + 3;
- } else if (!strncmp(argv[i], "-o:", 3)) {
- outfile = argv[i] + 3;
- } else if (!strncmp(argv[i], "-fs:", 4)) {
- const int samplingFreq = atoi(argv[i] + 4);
- if (samplingFreq != 8000 && samplingFreq != 11025 &&
- samplingFreq != 12000 && samplingFreq != 16000 &&
- samplingFreq != 22050 && samplingFreq != 24000 &&
- samplingFreq != 32000 && samplingFreq != 44100 &&
- samplingFreq != 48000 && samplingFreq != 88200 &&
- samplingFreq != 96000 && samplingFreq != 176400 &&
- samplingFreq != 192000) {
- printf("Error: Unsupported Sampling Frequency : %d\n", samplingFreq);
- return -1;
- }
- lvmConfigParams.samplingFreq = samplingFreq;
- } else if (!strncmp(argv[i], "-chMask:", 8)) {
- const int chMaskConfigIdx = atoi(argv[i] + 8);
- if (chMaskConfigIdx < 0 || (size_t)chMaskConfigIdx >= std::size(lvmConfigChMask)) {
- ALOGE("\nError: Unsupported Channel Mask : %d\n", chMaskConfigIdx);
- return -1;
- }
- const audio_channel_mask_t chMask = lvmConfigChMask[chMaskConfigIdx];
- lvmConfigParams.chMask = chMask;
- lvmConfigParams.nrChannels = audio_channel_count_from_out_mask(chMask);
- } else if (!strncmp(argv[i], "-vcBal:", 7)) {
- const int vcBalance = atoi(argv[i] + 7);
- if (vcBalance > 96 || vcBalance < -96) {
- ALOGE("\nError: Unsupported volume balance value: %d\n", vcBalance);
- }
- lvmConfigParams.vcBal = vcBalance;
- } else if (!strncmp(argv[i], "-fch:", 5)) {
- const int fChannels = atoi(argv[i] + 5);
- if (fChannels > 8 || fChannels < 1) {
- printf("Error: Unsupported number of file channels : %d\n", fChannels);
- return -1;
- }
- lvmConfigParams.fChannels = fChannels;
- } else if (!strcmp(argv[i],"-M")) {
- lvmConfigParams.monoMode = true;
- } else if (!strncmp(argv[i], "-basslvl:", 9)) {
- const int bassEffectLevel = atoi(argv[i] + 9);
- if (bassEffectLevel > LVM_BE_MAX_EFFECTLEVEL || bassEffectLevel < LVM_BE_MIN_EFFECTLEVEL) {
- printf("Error: Unsupported Bass Effect Level : %d\n",
- bassEffectLevel);
+ if (infile == nullptr || outfile == nullptr) {
+ printf("Error: missing input/output files\n");
printUsage();
return -1;
- }
- lvmConfigParams.bassEffectLevel = bassEffectLevel;
- } else if (!strncmp(argv[i], "-eqPreset:", 10)) {
- const int eqPresetLevel = atoi(argv[i] + 10);
- const int numPresetLvls = std::size(gEqualizerPresets);
- if (eqPresetLevel >= numPresetLvls || eqPresetLevel < 0) {
- printf("Error: Unsupported Equalizer Preset : %d\n", eqPresetLevel);
- printUsage();
- return -1;
- }
- lvmConfigParams.eqPresetLevel = eqPresetLevel;
- } else if (!strcmp(argv[i], "-bE")) {
- lvmConfigParams.bassEnable = LVM_BE_ON;
- } else if (!strcmp(argv[i], "-eqE")) {
- lvmConfigParams.eqEnable = LVM_EQNB_ON;
- } else if (!strcmp(argv[i], "-tE")) {
- lvmConfigParams.trebleEnable = LVM_TE_ON;
- } else if (!strcmp(argv[i], "-csE")) {
- lvmConfigParams.csEnable = LVM_MODE_ON;
- } else if (!strcmp(argv[i], "-h")) {
- printUsage();
- return 0;
}
- }
- if (infile == nullptr || outfile == nullptr) {
- printf("Error: missing input/output files\n");
- printUsage();
- return -1;
- }
+ FILE* finp = fopen(infile, "rb");
+ if (finp == nullptr) {
+ printf("Cannot open input file %s", infile);
+ return -1;
+ }
- FILE *finp = fopen(infile, "rb");
- if (finp == nullptr) {
- printf("Cannot open input file %s", infile);
- return -1;
- }
+ FILE* fout = fopen(outfile, "wb");
+ if (fout == nullptr) {
+ printf("Cannot open output file %s", outfile);
+ fclose(finp);
+ return -1;
+ }
- FILE *fout = fopen(outfile, "wb");
- if (fout == nullptr) {
- printf("Cannot open output file %s", outfile);
+ EffectContext context;
+ LVM_ControlParams_t params;
+ int errCode = lvmCreate(&context, &lvmConfigParams, ¶ms);
+ if (errCode == 0) {
+ errCode = lvmMainProcess(&context, ¶ms, &lvmConfigParams, finp, fout);
+ if (errCode != 0) {
+ printf("Error: lvmMainProcess returned with the error: %d", errCode);
+ }
+ } else {
+ printf("Error: lvmCreate returned with the error: %d", errCode);
+ }
fclose(finp);
- return -1;
- }
-
- EffectContext context;
- LVM_ControlParams_t params;
- int errCode = lvmCreate(&context, &lvmConfigParams, ¶ms);
- if (errCode == 0) {
- errCode = lvmMainProcess(&context, ¶ms, &lvmConfigParams, finp, fout);
- if (errCode != 0) {
- printf("Error: lvmMainProcess returned with the error: %d",errCode);
+ fclose(fout);
+ /* Free the allocated buffers */
+ if (context.pBundledContext != nullptr) {
+ if (context.pBundledContext->hInstance != nullptr) {
+ LVM_DelInstanceHandle(&context.pBundledContext->hInstance);
+ }
+ free(context.pBundledContext);
}
- } else {
- printf("Error: lvmCreate returned with the error: %d", errCode);
- }
- fclose(finp);
- fclose(fout);
- /* Free the allocated buffers */
- if (context.pBundledContext != nullptr) {
- if (context.pBundledContext->hInstance != nullptr) {
- LVM_DelInstanceHandle(&context.pBundledContext->hInstance);
- }
- free(context.pBundledContext);
- }
- if (errCode) {
- return -1;
- }
- return 0;
+ if (errCode) {
+ return -1;
+ }
+ return 0;
}
diff --git a/media/libeffects/lvm/tests/reverb_test.cpp b/media/libeffects/lvm/tests/reverb_test.cpp
index f403229..7cbca9b 100644
--- a/media/libeffects/lvm/tests/reverb_test.cpp
+++ b/media/libeffects/lvm/tests/reverb_test.cpp
@@ -34,365 +34,363 @@
// Global Variables
enum ReverbParams {
- ARG_HELP = 1,
- ARG_INPUT,
- ARG_OUTPUT,
- ARG_FS,
- ARG_CH_MASK,
- ARG_PRESET,
- ARG_AUX,
- ARG_MONO_MODE,
- ARG_FILE_CH,
+ ARG_HELP = 1,
+ ARG_INPUT,
+ ARG_OUTPUT,
+ ARG_FS,
+ ARG_CH_MASK,
+ ARG_PRESET,
+ ARG_AUX,
+ ARG_MONO_MODE,
+ ARG_FILE_CH,
};
const effect_uuid_t kReverbUuids[] = {
- {0x172cdf00,
- 0xa3bc,
- 0x11df,
- 0xa72f,
- {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // preset-insert mode
- {0xf29a1400,
- 0xa3bb,
- 0x11df,
- 0x8ddc,
- {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // preset-aux mode
+ {0x172cdf00,
+ 0xa3bc,
+ 0x11df,
+ 0xa72f,
+ {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // preset-insert mode
+ {0xf29a1400,
+ 0xa3bb,
+ 0x11df,
+ 0x8ddc,
+ {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // preset-aux mode
};
// structures
struct reverbConfigParams_t {
- int fChannels = 2;
- int monoMode = false;
- int frameLength = 256;
- int preset = 0;
- int nrChannels = 2;
- int sampleRate = 48000;
- int auxiliary = 0;
- audio_channel_mask_t chMask = AUDIO_CHANNEL_OUT_STEREO;
+ int fChannels = 2;
+ int monoMode = false;
+ int frameLength = 256;
+ int preset = 0;
+ int nrChannels = 2;
+ int sampleRate = 48000;
+ int auxiliary = 0;
+ audio_channel_mask_t chMask = AUDIO_CHANNEL_OUT_STEREO;
};
constexpr audio_channel_mask_t kReverbConfigChMask[] = {
- AUDIO_CHANNEL_OUT_MONO,
- AUDIO_CHANNEL_OUT_STEREO,
- AUDIO_CHANNEL_OUT_2POINT1,
- AUDIO_CHANNEL_OUT_2POINT0POINT2,
- AUDIO_CHANNEL_OUT_QUAD,
- AUDIO_CHANNEL_OUT_QUAD_BACK,
- AUDIO_CHANNEL_OUT_QUAD_SIDE,
- AUDIO_CHANNEL_OUT_SURROUND,
- (1 << 4) - 1,
- AUDIO_CHANNEL_OUT_2POINT1POINT2,
- AUDIO_CHANNEL_OUT_3POINT0POINT2,
- AUDIO_CHANNEL_OUT_PENTA,
- (1 << 5) - 1,
- AUDIO_CHANNEL_OUT_3POINT1POINT2,
- AUDIO_CHANNEL_OUT_5POINT1,
- AUDIO_CHANNEL_OUT_5POINT1_BACK,
- AUDIO_CHANNEL_OUT_5POINT1_SIDE,
- (1 << 6) - 1,
- AUDIO_CHANNEL_OUT_6POINT1,
- (1 << 7) - 1,
- AUDIO_CHANNEL_OUT_5POINT1POINT2,
- AUDIO_CHANNEL_OUT_7POINT1,
- (1 << 8) - 1,
+ AUDIO_CHANNEL_OUT_MONO,
+ AUDIO_CHANNEL_OUT_STEREO,
+ AUDIO_CHANNEL_OUT_2POINT1,
+ AUDIO_CHANNEL_OUT_2POINT0POINT2,
+ AUDIO_CHANNEL_OUT_QUAD,
+ AUDIO_CHANNEL_OUT_QUAD_BACK,
+ AUDIO_CHANNEL_OUT_QUAD_SIDE,
+ AUDIO_CHANNEL_OUT_SURROUND,
+ AUDIO_CHANNEL_INDEX_MASK_4,
+ AUDIO_CHANNEL_OUT_2POINT1POINT2,
+ AUDIO_CHANNEL_OUT_3POINT0POINT2,
+ AUDIO_CHANNEL_OUT_PENTA,
+ AUDIO_CHANNEL_INDEX_MASK_5,
+ AUDIO_CHANNEL_OUT_3POINT1POINT2,
+ AUDIO_CHANNEL_OUT_5POINT1,
+ AUDIO_CHANNEL_OUT_5POINT1_BACK,
+ AUDIO_CHANNEL_OUT_5POINT1_SIDE,
+ AUDIO_CHANNEL_INDEX_MASK_6,
+ AUDIO_CHANNEL_OUT_6POINT1,
+ AUDIO_CHANNEL_INDEX_MASK_7,
+ AUDIO_CHANNEL_OUT_5POINT1POINT2,
+ AUDIO_CHANNEL_OUT_7POINT1,
+ AUDIO_CHANNEL_INDEX_MASK_8,
};
constexpr int kReverbConfigChMaskCount = std::size(kReverbConfigChMask);
-int reverbCreateEffect(effect_handle_t *pEffectHandle, effect_config_t *pConfig, int sessionId,
+int reverbCreateEffect(effect_handle_t* pEffectHandle, effect_config_t* pConfig, int sessionId,
int ioId, int auxFlag) {
- if (int status = AUDIO_EFFECT_LIBRARY_INFO_SYM.create_effect(&kReverbUuids[auxFlag], sessionId,
- ioId, pEffectHandle);
- status != 0) {
- ALOGE("Reverb create returned an error = %d\n", status);
- return EXIT_FAILURE;
- }
- int reply = 0;
- uint32_t replySize = sizeof(reply);
- (**pEffectHandle)
- ->command(*pEffectHandle, EFFECT_CMD_SET_CONFIG, sizeof(effect_config_t), pConfig,
- &replySize, &reply);
- return reply;
+ if (int status = AUDIO_EFFECT_LIBRARY_INFO_SYM.create_effect(&kReverbUuids[auxFlag], sessionId,
+ ioId, pEffectHandle);
+ status != 0) {
+ ALOGE("Reverb create returned an error = %d\n", status);
+ return EXIT_FAILURE;
+ }
+ int reply = 0;
+ uint32_t replySize = sizeof(reply);
+ (**pEffectHandle)
+ ->command(*pEffectHandle, EFFECT_CMD_SET_CONFIG, sizeof(effect_config_t), pConfig,
+ &replySize, &reply);
+ return reply;
}
int reverbSetConfigParam(uint32_t paramType, uint32_t paramValue, effect_handle_t effectHandle) {
- int reply = 0;
- uint32_t replySize = sizeof(reply);
- uint32_t paramData[2] = {paramType, paramValue};
- effect_param_t *effectParam =
- (effect_param_t *)malloc(sizeof(*effectParam) + sizeof(paramData));
- memcpy(&effectParam->data[0], ¶mData[0], sizeof(paramData));
- effectParam->psize = sizeof(paramData[0]);
- effectParam->vsize = sizeof(paramData[1]);
- int status =
- (*effectHandle)
- ->command(effectHandle, EFFECT_CMD_SET_PARAM,
- sizeof(effect_param_t) + sizeof(paramData), effectParam, &replySize, &reply);
- free(effectParam);
- if (status != 0) {
- ALOGE("Reverb set config returned an error = %d\n", status);
- return status;
- }
- return reply;
+ int reply = 0;
+ uint32_t replySize = sizeof(reply);
+ uint32_t paramData[2] = {paramType, paramValue};
+ effect_param_t* effectParam = (effect_param_t*)malloc(sizeof(*effectParam) + sizeof(paramData));
+ memcpy(&effectParam->data[0], ¶mData[0], sizeof(paramData));
+ effectParam->psize = sizeof(paramData[0]);
+ effectParam->vsize = sizeof(paramData[1]);
+ int status = (*effectHandle)
+ ->command(effectHandle, EFFECT_CMD_SET_PARAM,
+ sizeof(effect_param_t) + sizeof(paramData), effectParam,
+ &replySize, &reply);
+ free(effectParam);
+ if (status != 0) {
+ ALOGE("Reverb set config returned an error = %d\n", status);
+ return status;
+ }
+ return reply;
}
void printUsage() {
- printf("\nUsage: ");
- printf("\n <executable> [options]\n");
- printf("\nwhere options are, ");
- printf("\n --input <inputfile>");
- printf("\n path to the input file");
- printf("\n --output <outputfile>");
- printf("\n path to the output file");
- printf("\n --help");
- printf("\n prints this usage information");
- printf("\n --chMask <channel_mask>\n");
- printf("\n 0 - AUDIO_CHANNEL_OUT_MONO");
- printf("\n 1 - AUDIO_CHANNEL_OUT_STEREO");
- printf("\n 2 - AUDIO_CHANNEL_OUT_2POINT1");
- printf("\n 3 - AUDIO_CHANNEL_OUT_2POINT0POINT2");
- printf("\n 4 - AUDIO_CHANNEL_OUT_QUAD");
- printf("\n 5 - AUDIO_CHANNEL_OUT_QUAD_BACK");
- printf("\n 6 - AUDIO_CHANNEL_OUT_QUAD_SIDE");
- printf("\n 7 - AUDIO_CHANNEL_OUT_SURROUND");
- printf("\n 8 - canonical channel index mask for 4 ch: (1 << 4) - 1");
- printf("\n 9 - AUDIO_CHANNEL_OUT_2POINT1POINT2");
- printf("\n 10 - AUDIO_CHANNEL_OUT_3POINT0POINT2");
- printf("\n 11 - AUDIO_CHANNEL_OUT_PENTA");
- printf("\n 12 - canonical channel index mask for 5 ch: (1 << 5) - 1");
- printf("\n 13 - AUDIO_CHANNEL_OUT_3POINT1POINT2");
- printf("\n 14 - AUDIO_CHANNEL_OUT_5POINT1");
- printf("\n 15 - AUDIO_CHANNEL_OUT_5POINT1_BACK");
- printf("\n 16 - AUDIO_CHANNEL_OUT_5POINT1_SIDE");
- printf("\n 17 - canonical channel index mask for 6 ch: (1 << 6) - 1");
- printf("\n 18 - AUDIO_CHANNEL_OUT_6POINT1");
- printf("\n 19 - canonical channel index mask for 7 ch: (1 << 7) - 1");
- printf("\n 20 - AUDIO_CHANNEL_OUT_5POINT1POINT2");
- printf("\n 21 - AUDIO_CHANNEL_OUT_7POINT1");
- printf("\n 22 - canonical channel index mask for 8 ch: (1 << 8) - 1");
- printf("\n default 0");
- printf("\n --fs <sampling_freq>");
- printf("\n Sampling frequency in Hz, default 48000.");
- printf("\n --preset <preset_value>");
- printf("\n 0 - None");
- printf("\n 1 - Small Room");
- printf("\n 2 - Medium Room");
- printf("\n 3 - Large Room");
- printf("\n 4 - Medium Hall");
- printf("\n 5 - Large Hall");
- printf("\n 6 - Plate");
- printf("\n default 0");
- printf("\n --fch <file_channels>");
- printf("\n number of channels in input file (1 through 8), default 1");
- printf("\n --M");
- printf("\n Mono mode (force all input audio channels to be identical)");
- printf("\n --aux <auxiliary_flag> ");
- printf("\n 0 - Insert Mode on");
- printf("\n 1 - auxiliary Mode on");
- printf("\n default 0");
- printf("\n");
+ printf("\nUsage: ");
+ printf("\n <executable> [options]\n");
+ printf("\nwhere options are, ");
+ printf("\n --input <inputfile>");
+ printf("\n path to the input file");
+ printf("\n --output <outputfile>");
+ printf("\n path to the output file");
+ printf("\n --help");
+ printf("\n prints this usage information");
+ printf("\n --chMask <channel_mask>\n");
+ printf("\n 0 - AUDIO_CHANNEL_OUT_MONO");
+ printf("\n 1 - AUDIO_CHANNEL_OUT_STEREO");
+ printf("\n 2 - AUDIO_CHANNEL_OUT_2POINT1");
+ printf("\n 3 - AUDIO_CHANNEL_OUT_2POINT0POINT2");
+ printf("\n 4 - AUDIO_CHANNEL_OUT_QUAD");
+ printf("\n 5 - AUDIO_CHANNEL_OUT_QUAD_BACK");
+ printf("\n 6 - AUDIO_CHANNEL_OUT_QUAD_SIDE");
+ printf("\n 7 - AUDIO_CHANNEL_OUT_SURROUND");
+ printf("\n 8 - canonical channel index mask for 4 ch: (1 << 4) - 1");
+ printf("\n 9 - AUDIO_CHANNEL_OUT_2POINT1POINT2");
+ printf("\n 10 - AUDIO_CHANNEL_OUT_3POINT0POINT2");
+ printf("\n 11 - AUDIO_CHANNEL_OUT_PENTA");
+ printf("\n 12 - canonical channel index mask for 5 ch: (1 << 5) - 1");
+ printf("\n 13 - AUDIO_CHANNEL_OUT_3POINT1POINT2");
+ printf("\n 14 - AUDIO_CHANNEL_OUT_5POINT1");
+ printf("\n 15 - AUDIO_CHANNEL_OUT_5POINT1_BACK");
+ printf("\n 16 - AUDIO_CHANNEL_OUT_5POINT1_SIDE");
+ printf("\n 17 - canonical channel index mask for 6 ch: (1 << 6) - 1");
+ printf("\n 18 - AUDIO_CHANNEL_OUT_6POINT1");
+ printf("\n 19 - canonical channel index mask for 7 ch: (1 << 7) - 1");
+ printf("\n 20 - AUDIO_CHANNEL_OUT_5POINT1POINT2");
+ printf("\n 21 - AUDIO_CHANNEL_OUT_7POINT1");
+ printf("\n 22 - canonical channel index mask for 8 ch: (1 << 8) - 1");
+ printf("\n default 0");
+ printf("\n --fs <sampling_freq>");
+ printf("\n Sampling frequency in Hz, default 48000.");
+ printf("\n --preset <preset_value>");
+ printf("\n 0 - None");
+ printf("\n 1 - Small Room");
+ printf("\n 2 - Medium Room");
+ printf("\n 3 - Large Room");
+ printf("\n 4 - Medium Hall");
+ printf("\n 5 - Large Hall");
+ printf("\n 6 - Plate");
+ printf("\n default 0");
+ printf("\n --fch <file_channels>");
+ printf("\n number of channels in input file (1 through 8), default 1");
+ printf("\n --M");
+ printf("\n Mono mode (force all input audio channels to be identical)");
+ printf("\n --aux <auxiliary_flag> ");
+ printf("\n 0 - Insert Mode on");
+ printf("\n 1 - auxiliary Mode on");
+ printf("\n default 0");
+ printf("\n");
}
-int main(int argc, const char *argv[]) {
- if (argc == 1) {
- printUsage();
- return EXIT_FAILURE;
- }
-
- reverbConfigParams_t revConfigParams{}; // default initialize
- const char *inputFile = nullptr;
- const char *outputFile = nullptr;
-
- const option long_opts[] = {
- {"help", no_argument, nullptr, ARG_HELP},
- {"input", required_argument, nullptr, ARG_INPUT},
- {"output", required_argument, nullptr, ARG_OUTPUT},
- {"fs", required_argument, nullptr, ARG_FS},
- {"chMask", required_argument, nullptr, ARG_CH_MASK},
- {"preset", required_argument, nullptr, ARG_PRESET},
- {"aux", required_argument, nullptr, ARG_AUX},
- {"M", no_argument, &revConfigParams.monoMode, true},
- {"fch", required_argument, nullptr, ARG_FILE_CH},
- {nullptr, 0, nullptr, 0},
- };
-
- while (true) {
- const int opt = getopt_long(argc, (char *const *)argv, "i:o:", long_opts, nullptr);
- if (opt == -1) {
- break;
- }
- switch (opt) {
- case ARG_HELP:
+int main(int argc, const char* argv[]) {
+ if (argc == 1) {
printUsage();
- return EXIT_SUCCESS;
- case ARG_INPUT: {
- inputFile = (char *)optarg;
- break;
- }
- case ARG_OUTPUT: {
- outputFile = (char *)optarg;
- break;
- }
- case ARG_FS: {
- revConfigParams.sampleRate = atoi(optarg);
- break;
- }
- case ARG_CH_MASK: {
- int chMaskIdx = atoi(optarg);
- if (chMaskIdx < 0 or chMaskIdx > kReverbConfigChMaskCount) {
- ALOGE("Channel Mask index not in correct range\n");
- printUsage();
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
+ }
+
+ reverbConfigParams_t revConfigParams{}; // default initialize
+ const char* inputFile = nullptr;
+ const char* outputFile = nullptr;
+
+ const option long_opts[] = {
+ {"help", no_argument, nullptr, ARG_HELP},
+ {"input", required_argument, nullptr, ARG_INPUT},
+ {"output", required_argument, nullptr, ARG_OUTPUT},
+ {"fs", required_argument, nullptr, ARG_FS},
+ {"chMask", required_argument, nullptr, ARG_CH_MASK},
+ {"preset", required_argument, nullptr, ARG_PRESET},
+ {"aux", required_argument, nullptr, ARG_AUX},
+ {"M", no_argument, &revConfigParams.monoMode, true},
+ {"fch", required_argument, nullptr, ARG_FILE_CH},
+ {nullptr, 0, nullptr, 0},
+ };
+
+ while (true) {
+ const int opt = getopt_long(argc, (char* const*)argv, "i:o:", long_opts, nullptr);
+ if (opt == -1) {
+ break;
}
- revConfigParams.chMask = kReverbConfigChMask[chMaskIdx];
- break;
- }
- case ARG_PRESET: {
- revConfigParams.preset = atoi(optarg);
- break;
- }
- case ARG_AUX: {
- revConfigParams.auxiliary = atoi(optarg);
- break;
- }
- case ARG_MONO_MODE: {
- break;
- }
- case ARG_FILE_CH: {
- revConfigParams.fChannels = atoi(optarg);
- break;
- }
- default:
- break;
- }
- }
-
- if (inputFile == nullptr) {
- ALOGE("Error: missing input files\n");
- printUsage();
- return EXIT_FAILURE;
- }
- std::unique_ptr<FILE, decltype(&fclose)> inputFp(fopen(inputFile, "rb"), &fclose);
-
- if (inputFp == nullptr) {
- ALOGE("Cannot open input file %s\n", inputFile);
- return EXIT_FAILURE;
- }
-
- if (outputFile == nullptr) {
- ALOGE("Error: missing output files\n");
- printUsage();
- return EXIT_FAILURE;
- }
- std::unique_ptr<FILE, decltype(&fclose)> outputFp(fopen(outputFile, "wb"), &fclose);
-
- if (outputFp == nullptr) {
- ALOGE("Cannot open output file %s\n", outputFile);
- return EXIT_FAILURE;
- }
-
- int32_t sessionId = 1;
- int32_t ioId = 1;
- effect_handle_t effectHandle = nullptr;
- effect_config_t config;
- config.inputCfg.samplingRate = config.outputCfg.samplingRate = revConfigParams.sampleRate;
- config.inputCfg.channels = config.outputCfg.channels = revConfigParams.chMask;
- config.inputCfg.format = config.outputCfg.format = AUDIO_FORMAT_PCM_FLOAT;
- if (AUDIO_CHANNEL_OUT_MONO == revConfigParams.chMask) {
- config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
- }
- if (int status =
- reverbCreateEffect(&effectHandle, &config, sessionId, ioId, revConfigParams.auxiliary);
- status != 0) {
- ALOGE("Create effect call returned error %i", status);
- return EXIT_FAILURE;
- }
-
- int reply = 0;
- uint32_t replySize = sizeof(reply);
- (*effectHandle)->command(effectHandle, EFFECT_CMD_ENABLE, 0, nullptr, &replySize, &reply);
- if (reply != 0) {
- ALOGE("Command enable call returned error %d\n", reply);
- return EXIT_FAILURE;
- }
-
- if (int status = reverbSetConfigParam(REVERB_PARAM_PRESET, (uint32_t)revConfigParams.preset,
- effectHandle);
- status != 0) {
- ALOGE("Invalid reverb preset. Error %d\n", status);
- return EXIT_FAILURE;
- }
-
- revConfigParams.nrChannels = audio_channel_count_from_out_mask(revConfigParams.chMask);
- const int channelCount = revConfigParams.nrChannels;
- const int frameLength = revConfigParams.frameLength;
-#ifdef BYPASS_EXEC
- const int frameSize = (int)channelCount * sizeof(float);
-#endif
- const int ioChannelCount = revConfigParams.fChannels;
- const int ioFrameSize = ioChannelCount * sizeof(short);
- const int maxChannelCount = std::max(channelCount, ioChannelCount);
- /*
- * Mono input will be converted to 2 channels internally in the process call
- * by copying the same data into the second channel.
- * Hence when channelCount is 1, output buffer should be allocated for
- * 2 channels. The outChannelCount takes care of allocation of sufficient
- * memory for the output buffer.
- */
- const int outChannelCount = (channelCount == 1 ? 2 : channelCount);
-
- std::vector<short> in(frameLength * maxChannelCount);
- std::vector<short> out(frameLength * maxChannelCount);
- std::vector<float> floatIn(frameLength * channelCount);
- std::vector<float> floatOut(frameLength * outChannelCount);
-
- int frameCounter = 0;
-
- while (fread(in.data(), ioFrameSize, frameLength, inputFp.get()) == (size_t)frameLength) {
- if (ioChannelCount != channelCount) {
- adjust_channels(in.data(), ioChannelCount, in.data(), channelCount, sizeof(short),
- frameLength * ioFrameSize);
- }
- memcpy_to_float_from_i16(floatIn.data(), in.data(), frameLength * channelCount);
-
- // Mono mode will replicate the first channel to all other channels.
- // This ensures all audio channels are identical. This is useful for testing
- // Bass Boost, which extracts a mono signal for processing.
- if (revConfigParams.monoMode && channelCount > 1) {
- for (int i = 0; i < frameLength; ++i) {
- auto *fp = &floatIn[i * channelCount];
- std::fill(fp + 1, fp + channelCount, *fp); // replicate ch 0
- }
+ switch (opt) {
+ case ARG_HELP:
+ printUsage();
+ return EXIT_SUCCESS;
+ case ARG_INPUT: {
+ inputFile = (char*)optarg;
+ break;
+ }
+ case ARG_OUTPUT: {
+ outputFile = (char*)optarg;
+ break;
+ }
+ case ARG_FS: {
+ revConfigParams.sampleRate = atoi(optarg);
+ break;
+ }
+ case ARG_CH_MASK: {
+ int chMaskIdx = atoi(optarg);
+ if (chMaskIdx < 0 or chMaskIdx > kReverbConfigChMaskCount) {
+ ALOGE("Channel Mask index not in correct range\n");
+ printUsage();
+ return EXIT_FAILURE;
+ }
+ revConfigParams.chMask = kReverbConfigChMask[chMaskIdx];
+ break;
+ }
+ case ARG_PRESET: {
+ revConfigParams.preset = atoi(optarg);
+ break;
+ }
+ case ARG_AUX: {
+ revConfigParams.auxiliary = atoi(optarg);
+ break;
+ }
+ case ARG_MONO_MODE: {
+ break;
+ }
+ case ARG_FILE_CH: {
+ revConfigParams.fChannels = atoi(optarg);
+ break;
+ }
+ default:
+ break;
+ }
}
- audio_buffer_t inputBuffer, outputBuffer;
- inputBuffer.frameCount = outputBuffer.frameCount = frameLength;
- inputBuffer.f32 = floatIn.data();
- outputBuffer.f32 = floatOut.data();
-#ifndef BYPASS_EXEC
- if (int status = (*effectHandle)->process(effectHandle, &inputBuffer, &outputBuffer);
+ if (inputFile == nullptr) {
+ ALOGE("Error: missing input files\n");
+ printUsage();
+ return EXIT_FAILURE;
+ }
+ std::unique_ptr<FILE, decltype(&fclose)> inputFp(fopen(inputFile, "rb"), &fclose);
+
+ if (inputFp == nullptr) {
+ ALOGE("Cannot open input file %s\n", inputFile);
+ return EXIT_FAILURE;
+ }
+
+ if (outputFile == nullptr) {
+ ALOGE("Error: missing output files\n");
+ printUsage();
+ return EXIT_FAILURE;
+ }
+ std::unique_ptr<FILE, decltype(&fclose)> outputFp(fopen(outputFile, "wb"), &fclose);
+
+ if (outputFp == nullptr) {
+ ALOGE("Cannot open output file %s\n", outputFile);
+ return EXIT_FAILURE;
+ }
+
+ int32_t sessionId = 1;
+ int32_t ioId = 1;
+ effect_handle_t effectHandle = nullptr;
+ effect_config_t config;
+ config.inputCfg.samplingRate = config.outputCfg.samplingRate = revConfigParams.sampleRate;
+ config.inputCfg.channels = config.outputCfg.channels = revConfigParams.chMask;
+ config.inputCfg.format = config.outputCfg.format = AUDIO_FORMAT_PCM_FLOAT;
+ if (AUDIO_CHANNEL_OUT_MONO == revConfigParams.chMask) {
+ config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ }
+ if (int status = reverbCreateEffect(&effectHandle, &config, sessionId, ioId,
+ revConfigParams.auxiliary);
status != 0) {
- ALOGE("\nError: Process returned with error %d\n", status);
- return EXIT_FAILURE;
+ ALOGE("Create effect call returned error %i", status);
+ return EXIT_FAILURE;
}
-#else
- memcpy(floatOut.data(), floatIn.data(), frameLength * frameSize);
+
+ int reply = 0;
+ uint32_t replySize = sizeof(reply);
+ (*effectHandle)->command(effectHandle, EFFECT_CMD_ENABLE, 0, nullptr, &replySize, &reply);
+ if (reply != 0) {
+ ALOGE("Command enable call returned error %d\n", reply);
+ return EXIT_FAILURE;
+ }
+
+ if (int status = reverbSetConfigParam(REVERB_PARAM_PRESET, (uint32_t)revConfigParams.preset,
+ effectHandle);
+ status != 0) {
+ ALOGE("Invalid reverb preset. Error %d\n", status);
+ return EXIT_FAILURE;
+ }
+
+ revConfigParams.nrChannels = audio_channel_count_from_out_mask(revConfigParams.chMask);
+ const int channelCount = revConfigParams.nrChannels;
+ const int frameLength = revConfigParams.frameLength;
+#ifdef BYPASS_EXEC
+ const int frameSize = (int)channelCount * sizeof(float);
#endif
- memcpy_to_i16_from_float(out.data(), floatOut.data(), frameLength * outChannelCount);
+ const int ioChannelCount = revConfigParams.fChannels;
+ const int ioFrameSize = ioChannelCount * sizeof(short);
+ const int maxChannelCount = std::max(channelCount, ioChannelCount);
+ /*
+ * Mono input will be converted to 2 channels internally in the process call
+ * by copying the same data into the second channel.
+ * Hence when channelCount is 1, output buffer should be allocated for
+ * 2 channels. The outChannelCount takes care of allocation of sufficient
+ * memory for the output buffer.
+ */
+ const int outChannelCount = (channelCount == 1 ? 2 : channelCount);
- if (ioChannelCount != outChannelCount) {
- adjust_channels(out.data(), outChannelCount, out.data(), ioChannelCount, sizeof(short),
- frameLength * outChannelCount * sizeof(short));
+ std::vector<short> in(frameLength * maxChannelCount);
+ std::vector<short> out(frameLength * maxChannelCount);
+ std::vector<float> floatIn(frameLength * channelCount);
+ std::vector<float> floatOut(frameLength * outChannelCount);
+
+ int frameCounter = 0;
+
+ while (fread(in.data(), ioFrameSize, frameLength, inputFp.get()) == (size_t)frameLength) {
+ if (ioChannelCount != channelCount) {
+ adjust_channels(in.data(), ioChannelCount, in.data(), channelCount, sizeof(short),
+ frameLength * ioFrameSize);
+ }
+ memcpy_to_float_from_i16(floatIn.data(), in.data(), frameLength * channelCount);
+
+ // Mono mode will replicate the first channel to all other channels.
+ // This ensures all audio channels are identical. This is useful for testing
+ // Bass Boost, which extracts a mono signal for processing.
+ if (revConfigParams.monoMode && channelCount > 1) {
+ for (int i = 0; i < frameLength; ++i) {
+ auto* fp = &floatIn[i * channelCount];
+ std::fill(fp + 1, fp + channelCount, *fp); // replicate ch 0
+ }
+ }
+
+ audio_buffer_t inputBuffer, outputBuffer;
+ inputBuffer.frameCount = outputBuffer.frameCount = frameLength;
+ inputBuffer.f32 = floatIn.data();
+ outputBuffer.f32 = floatOut.data();
+#ifndef BYPASS_EXEC
+ if (int status = (*effectHandle)->process(effectHandle, &inputBuffer, &outputBuffer);
+ status != 0) {
+ ALOGE("\nError: Process returned with error %d\n", status);
+ return EXIT_FAILURE;
+ }
+#else
+ memcpy(floatOut.data(), floatIn.data(), frameLength * frameSize);
+#endif
+ memcpy_to_i16_from_float(out.data(), floatOut.data(), frameLength * outChannelCount);
+
+ if (ioChannelCount != outChannelCount) {
+ adjust_channels(out.data(), outChannelCount, out.data(), ioChannelCount, sizeof(short),
+ frameLength * outChannelCount * sizeof(short));
+ }
+ (void)fwrite(out.data(), ioFrameSize, frameLength, outputFp.get());
+ frameCounter += frameLength;
}
- (void)fwrite(out.data(), ioFrameSize, frameLength, outputFp.get());
- frameCounter += frameLength;
- }
- if (int status = AUDIO_EFFECT_LIBRARY_INFO_SYM.release_effect(effectHandle);
- status != 0) {
- ALOGE("Audio Preprocessing release returned an error = %d\n", status);
- return EXIT_FAILURE;
- }
- printf("frameCounter: [%d]\n", frameCounter);
+ if (int status = AUDIO_EFFECT_LIBRARY_INFO_SYM.release_effect(effectHandle); status != 0) {
+ ALOGE("Audio Preprocessing release returned an error = %d\n", status);
+ return EXIT_FAILURE;
+ }
+ printf("frameCounter: [%d]\n", frameCounter);
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
diff --git a/media/libeffects/lvm/tests/snr.cpp b/media/libeffects/lvm/tests/snr.cpp
index 885994c..0fef334 100644
--- a/media/libeffects/lvm/tests/snr.cpp
+++ b/media/libeffects/lvm/tests/snr.cpp
@@ -22,84 +22,83 @@
#include <vector>
template <typename T, typename A = float>
-std::pair<A, A> getSignalNoise(FILE *finp, FILE *fref) {
- constexpr size_t framesize = 256;
- std::vector<T> in(framesize);
- std::vector<T> ref(framesize);
- A signal{};
- A noise{};
+std::pair<A, A> getSignalNoise(FILE* finp, FILE* fref) {
+ constexpr size_t framesize = 256;
+ std::vector<T> in(framesize);
+ std::vector<T> ref(framesize);
+ A signal{};
+ A noise{};
- for (;;) {
- size_t read_samples_in = fread(&in[0], sizeof(T), framesize, finp);
- const size_t read_samples_ref = fread(&ref[0], sizeof(T), framesize, fref);
- if (read_samples_in != read_samples_ref) {
- printf("file sizes do not match (last %zu %zu)", read_samples_in, read_samples_ref);
- read_samples_in = std::min(read_samples_in, read_samples_ref);
+ for (;;) {
+ size_t read_samples_in = fread(&in[0], sizeof(T), framesize, finp);
+ const size_t read_samples_ref = fread(&ref[0], sizeof(T), framesize, fref);
+ if (read_samples_in != read_samples_ref) {
+ printf("file sizes do not match (last %zu %zu)", read_samples_in, read_samples_ref);
+ read_samples_in = std::min(read_samples_in, read_samples_ref);
+ }
+ if (read_samples_in == 0) {
+ return {signal, noise};
+ }
+ for (size_t i = 0; i < read_samples_in; ++i) {
+ const A value(ref[i]);
+ const A diff(A(in[i]) - value);
+ signal += value * value;
+ noise += diff * diff;
+ }
}
- if (read_samples_in == 0) {
- return { signal, noise };
- }
- for (size_t i = 0; i < read_samples_in; ++i) {
- const A value(ref[i]);
- const A diff(A(in[i]) - value);
- signal += value * value;
- noise += diff * diff;
- }
- }
}
void printUsage() {
- printf("\nUsage: ");
- printf("\n snr <ref_file> <test_file> [options]\n");
- printf("\nwhere, \n <ref_file> is the reference file name");
- printf("\n on which will be taken as pure signal");
- printf("\n <test_file> is test file for snr calculation");
- printf("\n and options are mentioned below");
- printf("\n");
- printf("\n -pcm_format:<pcm format of input files>");
- printf("\n 0 - 16 bit pcm");
- printf("\n 1 - 32 bit float");
- printf("\n default 0");
- printf("\n -thr:<threshold value>");
- printf("\n default - negative infinity\n\n");
+ printf("\nUsage: ");
+ printf("\n snr <ref_file> <test_file> [options]\n");
+ printf("\nwhere, \n <ref_file> is the reference file name");
+ printf("\n on which will be taken as pure signal");
+ printf("\n <test_file> is test file for snr calculation");
+ printf("\n and options are mentioned below");
+ printf("\n");
+ printf("\n -pcm_format:<pcm format of input files>");
+ printf("\n 0 - 16 bit pcm");
+ printf("\n 1 - 32 bit float");
+ printf("\n default 0");
+ printf("\n -thr:<threshold value>");
+ printf("\n default - negative infinity\n\n");
}
-int main(int argc, const char *argv[]) {
- if (argc < 3) {
- printUsage();
- return -1;
- }
- int pcm_format = 0;
- float thr = - std::numeric_limits<float>::infinity();
- FILE *fref = fopen(argv[1], "rb");
- FILE *finp = fopen(argv[2], "rb");
- for (int i = 3; i < argc; i++) {
- if (!strncmp(argv[i], "-pcm_format:", 12)) {
- pcm_format = atoi(argv[i] + 12);
- } else if (!strncmp(argv[i], "-thr:", 5)) {
- thr = atof(argv[i] + 5);
+int main(int argc, const char* argv[]) {
+ if (argc < 3) {
+ printUsage();
+ return -1;
}
- }
- if (finp == nullptr || fref == nullptr) {
- printf("\nError: missing input/reference files\n");
- return -1;
- }
- int ret = EXIT_SUCCESS;
- auto sn = pcm_format == 0
- ? getSignalNoise<short>(finp, fref)
- : getSignalNoise<float>(finp, fref);
- if (sn.first > 0.f && sn.second > 0.f) {
- float snr = 10.f * log(sn.first / sn.second);
- // compare the measured snr value with threshold
- if (snr < thr) {
- printf("%.6f less than threshold %.6f\n", snr, thr);
- ret = EXIT_FAILURE;
- } else {
- printf("%.6f\n", snr);
+ int pcm_format = 0;
+ float thr = -std::numeric_limits<float>::infinity();
+ FILE* fref = fopen(argv[1], "rb");
+ FILE* finp = fopen(argv[2], "rb");
+ for (int i = 3; i < argc; i++) {
+ if (!strncmp(argv[i], "-pcm_format:", 12)) {
+ pcm_format = atoi(argv[i] + 12);
+ } else if (!strncmp(argv[i], "-thr:", 5)) {
+ thr = atof(argv[i] + 5);
+ }
}
- }
- fclose(finp);
- fclose(fref);
+ if (finp == nullptr || fref == nullptr) {
+ printf("\nError: missing input/reference files\n");
+ return -1;
+ }
+ int ret = EXIT_SUCCESS;
+ auto sn =
+ pcm_format == 0 ? getSignalNoise<short>(finp, fref) : getSignalNoise<float>(finp, fref);
+ if (sn.first > 0.f && sn.second > 0.f) {
+ float snr = 10.f * log(sn.first / sn.second);
+ // compare the measured snr value with threshold
+ if (snr < thr) {
+ printf("%.6f less than threshold %.6f\n", snr, thr);
+ ret = EXIT_FAILURE;
+ } else {
+ printf("%.6f\n", snr);
+ }
+ }
+ fclose(finp);
+ fclose(fref);
- return ret;
+ return ret;
}
diff --git a/media/libeffects/lvm/wrapper/Android.bp b/media/libeffects/lvm/wrapper/Android.bp
index f08caec..be60aae 100644
--- a/media/libeffects/lvm/wrapper/Android.bp
+++ b/media/libeffects/lvm/wrapper/Android.bp
@@ -1,5 +1,5 @@
// music bundle wrapper
-cc_library_shared {
+cc_library {
name: "libbundlewrapper",
arch: {
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index dac283e..973a164 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -18,7 +18,7 @@
typedef float LVM_FLOAT;
#endif
#define LOG_TAG "Bundle"
-#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array)[0])
//#define LOG_NDEBUG 0
#include <assert.h>
@@ -42,26 +42,33 @@
#ifdef VERY_VERY_VERBOSE_LOGGING
#define ALOGVV ALOGV
#else
-#define ALOGVV(a...) do { } while (false)
+#define ALOGVV(a...) \
+ do { \
+ } while (false)
#endif
-#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
- if ((LvmStatus) == LVM_NULLADDRESS){\
- ALOGV("\tLVM_ERROR : Parameter error - "\
- "null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
- }\
- if ((LvmStatus) == LVM_ALIGNMENTERROR){\
- ALOGV("\tLVM_ERROR : Parameter error - "\
- "bad alignment returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
- }\
- if ((LvmStatus) == LVM_INVALIDNUMSAMPLES){\
- ALOGV("\tLVM_ERROR : Parameter error - "\
- "bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
- }\
- if ((LvmStatus) == LVM_OUTOFRANGE){\
- ALOGV("\tLVM_ERROR : Parameter error - "\
- "out of range returned by %s in %s\n", callingFunc, calledFunc);\
- }\
+#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc) \
+ { \
+ if ((LvmStatus) == LVM_NULLADDRESS) { \
+ ALOGV("\tLVM_ERROR : Parameter error - " \
+ "null pointer returned by %s in %s\n\n\n\n", \
+ callingFunc, calledFunc); \
+ } \
+ if ((LvmStatus) == LVM_ALIGNMENTERROR) { \
+ ALOGV("\tLVM_ERROR : Parameter error - " \
+ "bad alignment returned by %s in %s\n\n\n\n", \
+ callingFunc, calledFunc); \
+ } \
+ if ((LvmStatus) == LVM_INVALIDNUMSAMPLES) { \
+ ALOGV("\tLVM_ERROR : Parameter error - " \
+ "bad number of samples returned by %s in %s\n\n\n\n", \
+ callingFunc, calledFunc); \
+ } \
+ if ((LvmStatus) == LVM_OUTOFRANGE) { \
+ ALOGV("\tLVM_ERROR : Parameter error - " \
+ "out of range returned by %s in %s\n", \
+ callingFunc, calledFunc); \
+ } \
}
// Namespaces
@@ -74,20 +81,21 @@
int SessionIndex[LVM_MAX_SESSIONS];
/* local functions */
-#define CHECK_ARG(cond) { \
- if (!(cond)) { \
- ALOGV("\tLVM_ERROR : Invalid argument: "#cond); \
- return -EINVAL; \
- } \
-}
+#define CHECK_ARG(cond) \
+ { \
+ if (!(cond)) { \
+ ALOGV("\tLVM_ERROR : Invalid argument: " #cond); \
+ return -EINVAL; \
+ } \
+ }
// NXP SW BassBoost UUID
const effect_descriptor_t gBassBoostDescriptor = {
- {0x0634f220, 0xddd4, 0x11db, 0xa0fc, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
- {0x8631f300, 0x72e2, 0x11df, 0xb57e, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid
+ {0x0634f220, 0xddd4, 0x11db, 0xa0fc, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
+ {0x8631f300, 0x72e2, 0x11df, 0xb57e, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid
EFFECT_CONTROL_API_VERSION,
- (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_DEVICE_IND
- | EFFECT_FLAG_VOLUME_CTRL),
+ (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_DEVICE_IND |
+ EFFECT_FLAG_VOLUME_CTRL),
BASS_BOOST_CUP_LOAD_ARM9E,
BUNDLE_MEM_USAGE,
"Dynamic Bass Boost",
@@ -99,8 +107,8 @@
{0x37cc2c00, 0xdddd, 0x11db, 0x8577, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
{0x1d4033c0, 0x8557, 0x11df, 0x9f2d, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
EFFECT_CONTROL_API_VERSION,
- (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_LAST | EFFECT_FLAG_DEVICE_IND
- | EFFECT_FLAG_VOLUME_CTRL),
+ (EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_LAST | EFFECT_FLAG_DEVICE_IND |
+ EFFECT_FLAG_VOLUME_CTRL),
VIRTUALIZER_CUP_LOAD_ARM9E,
BUNDLE_MEM_USAGE,
"Virtualizer",
@@ -109,8 +117,8 @@
// NXP SW Equalizer UUID
const effect_descriptor_t gEqualizerDescriptor = {
- {0x0bed4300, 0xddd6, 0x11db, 0x8f34, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // type
- {0xce772f20, 0x847d, 0x11df, 0xbb17, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid Eq NXP
+ {0x0bed4300, 0xddd6, 0x11db, 0x8f34, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // type
+ {0xce772f20, 0x847d, 0x11df, 0xbb17, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid Eq NXP
EFFECT_CONTROL_API_VERSION,
(EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_FIRST | EFFECT_FLAG_VOLUME_CTRL),
EQUALIZER_CUP_LOAD_ARM9E,
@@ -121,8 +129,8 @@
// NXP SW Volume UUID
const effect_descriptor_t gVolumeDescriptor = {
- {0x09e8ede0, 0xddde, 0x11db, 0xb4f6, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }},
- {0x119341a0, 0x8469, 0x11df, 0x81f9, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b }}, //uuid VOL NXP
+ {0x09e8ede0, 0xddde, 0x11db, 0xb4f6, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
+ {0x119341a0, 0x8469, 0x11df, 0x81f9, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // uuid VOL NXP
EFFECT_CONTROL_API_VERSION,
(EFFECT_FLAG_TYPE_INSERT | EFFECT_FLAG_INSERT_LAST | EFFECT_FLAG_VOLUME_CTRL),
VOLUME_CUP_LOAD_ARM9E,
@@ -132,76 +140,50 @@
};
//--- local function prototypes
-void LvmGlobalBundle_init (void);
-int LvmBundle_init (EffectContext *pContext);
-int LvmEffect_enable (EffectContext *pContext);
-int LvmEffect_disable (EffectContext *pContext);
-int Effect_setConfig (EffectContext *pContext, effect_config_t *pConfig);
-void Effect_getConfig (EffectContext *pContext, effect_config_t *pConfig);
-int BassBoost_setParameter (EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t valueSize,
- void *pValue);
-int BassBoost_getParameter (EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue);
-int Virtualizer_setParameter (EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t valueSize,
- void *pValue);
-int Virtualizer_getParameter (EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue);
-int Equalizer_setParameter (EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t valueSize,
- void *pValue);
-int Equalizer_getParameter (EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue);
-int Volume_setParameter (EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t valueSize,
- void *pValue);
-int Volume_getParameter (EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue);
-int Effect_setEnabled(EffectContext *pContext, bool enabled);
+void LvmGlobalBundle_init(void);
+int LvmBundle_init(EffectContext* pContext);
+int LvmEffect_enable(EffectContext* pContext);
+int LvmEffect_disable(EffectContext* pContext);
+int Effect_setConfig(EffectContext* pContext, effect_config_t* pConfig);
+void Effect_getConfig(EffectContext* pContext, effect_config_t* pConfig);
+int BassBoost_setParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t valueSize, void* pValue);
+int BassBoost_getParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t* pValueSize, void* pValue);
+int Virtualizer_setParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t valueSize, void* pValue);
+int Virtualizer_getParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t* pValueSize, void* pValue);
+int Equalizer_setParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t valueSize, void* pValue);
+int Equalizer_getParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t* pValueSize, void* pValue);
+int Volume_setParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t valueSize, void* pValue);
+int Volume_getParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t* pValueSize, void* pValue);
+int Effect_setEnabled(EffectContext* pContext, bool enabled);
/* Effect Library Interface Implementation */
-extern "C" int EffectCreate(const effect_uuid_t *uuid,
- int32_t sessionId,
- int32_t ioId __unused,
- effect_handle_t *pHandle){
+extern "C" int EffectCreate(const effect_uuid_t* uuid, int32_t sessionId, int32_t ioId __unused,
+ effect_handle_t* pHandle) {
int ret = 0;
int sessionNo = -1;
int i;
- EffectContext *pContext = NULL;
+ EffectContext* pContext = NULL;
bool newBundle = false;
- SessionContext *pSessionContext;
+ SessionContext* pSessionContext;
ALOGV("\n\tEffectCreate start session %d", sessionId);
- if (pHandle == NULL || uuid == NULL){
+ if (pHandle == NULL || uuid == NULL) {
ALOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
ret = -EINVAL;
goto exit;
}
- if(LvmInitFlag == LVM_FALSE){
+ if (LvmInitFlag == LVM_FALSE) {
LvmInitFlag = LVM_TRUE;
ALOGV("\tEffectCreate - Initializing all global memory");
LvmGlobalBundle_init();
@@ -209,7 +191,7 @@
// Find sessionNo: if one already exists for the sessionId use it,
// otherwise choose the first available empty slot.
- for(i=0; i<LVM_MAX_SESSIONS; i++){
+ for (i = 0; i < LVM_MAX_SESSIONS; i++) {
if (SessionIndex[i] == sessionId) {
sessionNo = i;
break;
@@ -231,106 +213,102 @@
pContext = new EffectContext;
// If this is the first create in this session
- if(GlobalSessionMemory[sessionNo].bBundledEffectsEnabled == LVM_FALSE){
+ if (GlobalSessionMemory[sessionNo].bBundledEffectsEnabled == LVM_FALSE) {
ALOGV("\tEffectCreate - This is the first effect in current sessionId %d sessionNo %d",
- sessionId, sessionNo);
+ sessionId, sessionNo);
GlobalSessionMemory[sessionNo].bBundledEffectsEnabled = LVM_TRUE;
- GlobalSessionMemory[sessionNo].pBundledContext = new BundledEffectContext;
+ GlobalSessionMemory[sessionNo].pBundledContext = new BundledEffectContext;
newBundle = true;
pContext->pBundledContext = GlobalSessionMemory[sessionNo].pBundledContext;
- pContext->pBundledContext->SessionNo = sessionNo;
- pContext->pBundledContext->SessionId = sessionId;
- pContext->pBundledContext->hInstance = NULL;
- pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
- pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
- pContext->pBundledContext->bBassEnabled = LVM_FALSE;
- pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
- pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
+ pContext->pBundledContext->SessionNo = sessionNo;
+ pContext->pBundledContext->SessionId = sessionId;
+ pContext->pBundledContext->hInstance = NULL;
+ pContext->pBundledContext->bVolumeEnabled = LVM_FALSE;
+ pContext->pBundledContext->bEqualizerEnabled = LVM_FALSE;
+ pContext->pBundledContext->bBassEnabled = LVM_FALSE;
+ pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
+ pContext->pBundledContext->bVirtualizerEnabled = LVM_FALSE;
pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
- pContext->pBundledContext->nOutputDevice = AUDIO_DEVICE_NONE;
+ pContext->pBundledContext->nOutputDevice = AUDIO_DEVICE_NONE;
pContext->pBundledContext->nVirtualizerForcedDevice = AUDIO_DEVICE_NONE;
- pContext->pBundledContext->NumberEffectsEnabled = 0;
- pContext->pBundledContext->NumberEffectsCalled = 0;
- pContext->pBundledContext->firstVolume = LVM_TRUE;
- pContext->pBundledContext->volume = 0;
-
+ pContext->pBundledContext->NumberEffectsEnabled = 0;
+ pContext->pBundledContext->NumberEffectsCalled = 0;
+ pContext->pBundledContext->firstVolume = LVM_TRUE;
+ pContext->pBundledContext->volume = 0;
/* 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
* quantisation like effect when returning
*/
- pContext->pBundledContext->BassStrengthSaved = 0;
- pContext->pBundledContext->VirtStrengthSaved = 0;
- pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
- pContext->pBundledContext->levelSaved = 0;
- pContext->pBundledContext->bMuteEnabled = LVM_FALSE;
- pContext->pBundledContext->bStereoPositionEnabled = LVM_FALSE;
- pContext->pBundledContext->positionSaved = 0;
- pContext->pBundledContext->workBuffer = NULL;
- pContext->pBundledContext->frameCount = -1;
- pContext->pBundledContext->SamplesToExitCountVirt = 0;
- pContext->pBundledContext->SamplesToExitCountBb = 0;
- pContext->pBundledContext->SamplesToExitCountEq = 0;
+ pContext->pBundledContext->BassStrengthSaved = 0;
+ pContext->pBundledContext->VirtStrengthSaved = 0;
+ pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
+ pContext->pBundledContext->levelSaved = 0;
+ pContext->pBundledContext->bMuteEnabled = LVM_FALSE;
+ pContext->pBundledContext->bStereoPositionEnabled = LVM_FALSE;
+ pContext->pBundledContext->positionSaved = 0;
+ pContext->pBundledContext->workBuffer = NULL;
+ pContext->pBundledContext->frameCount = -1;
+ pContext->pBundledContext->SamplesToExitCountVirt = 0;
+ pContext->pBundledContext->SamplesToExitCountBb = 0;
+ pContext->pBundledContext->SamplesToExitCountEq = 0;
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
pContext->pBundledContext->bandGaindB[i] = EQNB_5BandSoftPresets[i];
}
- pContext->pBundledContext->effectProcessCalled = 0;
- pContext->pBundledContext->effectInDrain = 0;
+ pContext->pBundledContext->effectProcessCalled = 0;
+ pContext->pBundledContext->effectInDrain = 0;
ALOGV("\tEffectCreate - Calling LvmBundle_init");
ret = LvmBundle_init(pContext);
- if (ret < 0){
+ if (ret < 0) {
ALOGV("\tLVM_ERROR : EffectCreate() Bundle init failed");
goto exit;
}
- }
- else{
+ } else {
ALOGV("\tEffectCreate - Assigning memory for previously created effect on sessionNo %d",
- sessionNo);
- pContext->pBundledContext =
- GlobalSessionMemory[sessionNo].pBundledContext;
+ sessionNo);
+ pContext->pBundledContext = GlobalSessionMemory[sessionNo].pBundledContext;
}
ALOGV("\tEffectCreate - pBundledContext is %p", pContext->pBundledContext);
pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
// Create each Effect
- if (memcmp(uuid, &gBassBoostDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
+ if (memcmp(uuid, &gBassBoostDescriptor.uuid, sizeof(effect_uuid_t)) == 0) {
// Create Bass Boost
ALOGV("\tEffectCreate - Effect to be created is LVM_BASS_BOOST");
pSessionContext->bBassInstantiated = LVM_TRUE;
pContext->pBundledContext->SamplesToExitCountBb = 0;
- pContext->itfe = &gLvmEffectInterface;
+ pContext->itfe = &gLvmEffectInterface;
pContext->EffectType = LVM_BASS_BOOST;
- } else if (memcmp(uuid, &gVirtualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
+ } else if (memcmp(uuid, &gVirtualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0) {
// Create Virtualizer
ALOGV("\tEffectCreate - Effect to be created is LVM_VIRTUALIZER");
- pSessionContext->bVirtualizerInstantiated=LVM_TRUE;
+ pSessionContext->bVirtualizerInstantiated = LVM_TRUE;
pContext->pBundledContext->SamplesToExitCountVirt = 0;
- pContext->itfe = &gLvmEffectInterface;
+ pContext->itfe = &gLvmEffectInterface;
pContext->EffectType = LVM_VIRTUALIZER;
- } else if (memcmp(uuid, &gEqualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
+ } else if (memcmp(uuid, &gEqualizerDescriptor.uuid, sizeof(effect_uuid_t)) == 0) {
// Create Equalizer
ALOGV("\tEffectCreate - Effect to be created is LVM_EQUALIZER");
pSessionContext->bEqualizerInstantiated = LVM_TRUE;
pContext->pBundledContext->SamplesToExitCountEq = 0;
- pContext->itfe = &gLvmEffectInterface;
+ pContext->itfe = &gLvmEffectInterface;
pContext->EffectType = LVM_EQUALIZER;
- } else if (memcmp(uuid, &gVolumeDescriptor.uuid, sizeof(effect_uuid_t)) == 0){
+ } else if (memcmp(uuid, &gVolumeDescriptor.uuid, sizeof(effect_uuid_t)) == 0) {
// Create Volume
ALOGV("\tEffectCreate - Effect to be created is LVM_VOLUME");
pSessionContext->bVolumeInstantiated = LVM_TRUE;
- pContext->itfe = &gLvmEffectInterface;
+ pContext->itfe = &gLvmEffectInterface;
pContext->EffectType = LVM_VOLUME;
- }
- else{
+ } else {
ALOGV("\tLVM_ERROR : EffectCreate() invalid UUID");
ret = -EINVAL;
goto exit;
@@ -346,66 +324,64 @@
}
delete pContext;
}
- if (pHandle != NULL)
- *pHandle = (effect_handle_t)NULL;
+ if (pHandle != NULL) *pHandle = (effect_handle_t)NULL;
} else {
- if (pHandle != NULL)
- *pHandle = (effect_handle_t)pContext;
+ if (pHandle != NULL) *pHandle = (effect_handle_t)pContext;
}
ALOGV("\tEffectCreate end..\n\n");
return ret;
} /* end EffectCreate */
-extern "C" int EffectRelease(effect_handle_t handle){
+extern "C" int EffectRelease(effect_handle_t handle) {
ALOGV("\n\tEffectRelease start %p", handle);
- EffectContext * pContext = (EffectContext *)handle;
+ EffectContext* pContext = (EffectContext*)handle;
ALOGV("\tEffectRelease start handle: %p, context %p", handle, pContext->pBundledContext);
- if (pContext == NULL){
+ if (pContext == NULL) {
ALOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
return -EINVAL;
}
- SessionContext *pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
+ SessionContext* pSessionContext = &GlobalSessionMemory[pContext->pBundledContext->SessionNo];
// Clear the instantiated flag for the effect
// protect agains the case where an effect is un-instantiated without being disabled
- int &effectInDrain = pContext->pBundledContext->effectInDrain;
- if(pContext->EffectType == LVM_BASS_BOOST) {
+ int& effectInDrain = pContext->pBundledContext->effectInDrain;
+ if (pContext->EffectType == LVM_BASS_BOOST) {
ALOGV("\tEffectRelease LVM_BASS_BOOST Clearing global intstantiated flag");
pSessionContext->bBassInstantiated = LVM_FALSE;
- if(pContext->pBundledContext->SamplesToExitCountBb > 0){
+ if (pContext->pBundledContext->SamplesToExitCountBb > 0) {
pContext->pBundledContext->NumberEffectsEnabled--;
}
pContext->pBundledContext->SamplesToExitCountBb = 0;
- } else if(pContext->EffectType == LVM_VIRTUALIZER) {
+ } else if (pContext->EffectType == LVM_VIRTUALIZER) {
ALOGV("\tEffectRelease LVM_VIRTUALIZER Clearing global intstantiated flag");
pSessionContext->bVirtualizerInstantiated = LVM_FALSE;
- if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
+ if (pContext->pBundledContext->SamplesToExitCountVirt > 0) {
pContext->pBundledContext->NumberEffectsEnabled--;
}
pContext->pBundledContext->SamplesToExitCountVirt = 0;
- } else if(pContext->EffectType == LVM_EQUALIZER) {
+ } else if (pContext->EffectType == LVM_EQUALIZER) {
ALOGV("\tEffectRelease LVM_EQUALIZER Clearing global intstantiated flag");
- pSessionContext->bEqualizerInstantiated =LVM_FALSE;
- if(pContext->pBundledContext->SamplesToExitCountEq > 0){
+ pSessionContext->bEqualizerInstantiated = LVM_FALSE;
+ if (pContext->pBundledContext->SamplesToExitCountEq > 0) {
pContext->pBundledContext->NumberEffectsEnabled--;
}
pContext->pBundledContext->SamplesToExitCountEq = 0;
- } else if(pContext->EffectType == LVM_VOLUME) {
+ } else if (pContext->EffectType == LVM_VOLUME) {
ALOGV("\tEffectRelease LVM_VOLUME Clearing global intstantiated flag");
pSessionContext->bVolumeInstantiated = LVM_FALSE;
// There is no samplesToExitCount for volume so we also use the drain flag to check
// if we should decrement the effects enabled.
- if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE
- || (effectInDrain & 1 << LVM_VOLUME) != 0) {
+ if (pContext->pBundledContext->bVolumeEnabled == LVM_TRUE ||
+ (effectInDrain & 1 << LVM_VOLUME) != 0) {
pContext->pBundledContext->NumberEffectsEnabled--;
}
} else {
ALOGV("\tLVM_ERROR : EffectRelease : Unsupported effect\n\n\n\n\n\n\n");
}
- effectInDrain &= ~(1 << pContext->EffectType); // no need to drain if released
+ effectInDrain &= ~(1 << pContext->EffectType); // no need to drain if released
// Disable effect, in this case ignore errors (return codes)
// if an effect has already been disabled
@@ -413,17 +389,15 @@
// if all effects are no longer instantiaed free the lvm memory and delete BundledEffectContext
if ((pSessionContext->bBassInstantiated == LVM_FALSE) &&
- (pSessionContext->bVolumeInstantiated == LVM_FALSE) &&
- (pSessionContext->bEqualizerInstantiated ==LVM_FALSE) &&
- (pSessionContext->bVirtualizerInstantiated==LVM_FALSE))
- {
-
+ (pSessionContext->bVolumeInstantiated == LVM_FALSE) &&
+ (pSessionContext->bEqualizerInstantiated == LVM_FALSE) &&
+ (pSessionContext->bVirtualizerInstantiated == LVM_FALSE)) {
// Clear the SessionIndex
- for(int i=0; i<LVM_MAX_SESSIONS; i++){
- if(SessionIndex[i] == pContext->pBundledContext->SessionId){
+ for (int i = 0; i < LVM_MAX_SESSIONS; i++) {
+ if (SessionIndex[i] == pContext->pBundledContext->SessionId) {
SessionIndex[i] = LVM_UNUSED_SESSION;
- ALOGV("\tEffectRelease: Clearing SessionIndex SessionNo %d for SessionId %d\n",
- i, pContext->pBundledContext->SessionId);
+ ALOGV("\tEffectRelease: Clearing SessionIndex SessionNo %d for SessionId %d\n", i,
+ pContext->pBundledContext->SessionId);
break;
}
}
@@ -448,11 +422,10 @@
} /* end EffectRelease */
-extern "C" int EffectGetDescriptor(const effect_uuid_t *uuid,
- effect_descriptor_t *pDescriptor) {
- const effect_descriptor_t *desc = NULL;
+extern "C" int EffectGetDescriptor(const effect_uuid_t* uuid, effect_descriptor_t* pDescriptor) {
+ const effect_descriptor_t* desc = NULL;
- if (pDescriptor == NULL || uuid == NULL){
+ if (pDescriptor == NULL || uuid == NULL) {
ALOGV("EffectGetDescriptor() called with NULL pointer");
return -EINVAL;
}
@@ -468,7 +441,7 @@
}
if (desc == NULL) {
- return -EINVAL;
+ return -EINVAL;
}
*pDescriptor = *desc;
@@ -476,15 +449,15 @@
return 0;
} /* end EffectGetDescriptor */
-void LvmGlobalBundle_init(){
+void LvmGlobalBundle_init() {
ALOGV("\tLvmGlobalBundle_init start");
- for(int i=0; i<LVM_MAX_SESSIONS; i++){
- GlobalSessionMemory[i].bBundledEffectsEnabled = LVM_FALSE;
- GlobalSessionMemory[i].bVolumeInstantiated = LVM_FALSE;
- GlobalSessionMemory[i].bEqualizerInstantiated = LVM_FALSE;
- GlobalSessionMemory[i].bBassInstantiated = LVM_FALSE;
+ for (int i = 0; i < LVM_MAX_SESSIONS; i++) {
+ GlobalSessionMemory[i].bBundledEffectsEnabled = LVM_FALSE;
+ GlobalSessionMemory[i].bVolumeInstantiated = LVM_FALSE;
+ GlobalSessionMemory[i].bEqualizerInstantiated = LVM_FALSE;
+ GlobalSessionMemory[i].bBassInstantiated = LVM_FALSE;
GlobalSessionMemory[i].bVirtualizerInstantiated = LVM_FALSE;
- GlobalSessionMemory[i].pBundledContext = LVM_NULL;
+ GlobalSessionMemory[i].pBundledContext = LVM_NULL;
SessionIndex[i] = LVM_UNUSED_SESSION;
}
@@ -503,145 +476,140 @@
//
//----------------------------------------------------------------------------
-int LvmBundle_init(EffectContext *pContext){
+int LvmBundle_init(EffectContext* pContext) {
ALOGV("\tLvmBundle_init start");
- pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
- pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
- pContext->config.inputCfg.format = EFFECT_BUFFER_FORMAT;
- pContext->config.inputCfg.samplingRate = 44100;
- pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
- pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
- pContext->config.inputCfg.bufferProvider.cookie = NULL;
- pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
- pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
- pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
- pContext->config.outputCfg.format = EFFECT_BUFFER_FORMAT;
- pContext->config.outputCfg.samplingRate = 44100;
- pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
+ pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
+ pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.inputCfg.format = EFFECT_BUFFER_FORMAT;
+ pContext->config.inputCfg.samplingRate = 44100;
+ pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
+ pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
+ pContext->config.inputCfg.bufferProvider.cookie = NULL;
+ pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
+ pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
+ pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.outputCfg.format = EFFECT_BUFFER_FORMAT;
+ pContext->config.outputCfg.samplingRate = 44100;
+ pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL;
- pContext->config.outputCfg.bufferProvider.cookie = NULL;
- pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL;
+ pContext->config.outputCfg.bufferProvider.cookie = NULL;
+ pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL;
CHECK_ARG(pContext != NULL);
- if (pContext->pBundledContext->hInstance != NULL){
+ if (pContext->pBundledContext->hInstance != NULL) {
ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
- "-> Calling pContext->pBassBoost->free()");
+ "-> Calling pContext->pBassBoost->free()");
LVM_DelInstanceHandle(&pContext->pBundledContext->hInstance);
ALOGV("\tLvmBundle_init pContext->pBassBoost != NULL "
- "-> Called pContext->pBassBoost->free()");
+ "-> Called pContext->pBassBoost->free()");
}
- LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
- LVM_ControlParams_t params; /* Control Parameters */
- LVM_InstParams_t InstParams; /* Instance parameters */
- LVM_EQNB_BandDef_t BandDefs[MAX_NUM_BANDS]; /* Equaliser band definitions */
- LVM_HeadroomParams_t HeadroomParams; /* Headroom parameters */
- LVM_HeadroomBandDef_t HeadroomBandDef[LVM_HEADROOM_MAX_NBANDS];
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_ControlParams_t params; /* Control Parameters */
+ LVM_InstParams_t InstParams; /* Instance parameters */
+ LVM_EQNB_BandDef_t BandDefs[MAX_NUM_BANDS]; /* Equaliser band definitions */
+ LVM_HeadroomParams_t HeadroomParams; /* Headroom parameters */
+ LVM_HeadroomBandDef_t HeadroomBandDef[LVM_HEADROOM_MAX_NBANDS];
/* Set the capabilities */
- InstParams.BufferMode = LVM_UNMANAGED_BUFFERS;
- InstParams.MaxBlockSize = MAX_CALL_SIZE;
- InstParams.EQNB_NumBands = MAX_NUM_BANDS;
- InstParams.PSA_Included = LVM_PSA_ON;
+ InstParams.BufferMode = LVM_UNMANAGED_BUFFERS;
+ InstParams.MaxBlockSize = MAX_CALL_SIZE;
+ InstParams.EQNB_NumBands = MAX_NUM_BANDS;
+ InstParams.PSA_Included = LVM_PSA_ON;
- LvmStatus = LVM_GetInstanceHandle(&pContext->pBundledContext->hInstance,
- &InstParams);
+ LvmStatus = LVM_GetInstanceHandle(&pContext->pBundledContext->hInstance, &InstParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetInstanceHandle", "LvmBundle_init")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
+ ALOGV("\tLvmBundle_init CreateInstance Successfully called LVM_GetInstanceHandle\n");
/* Set the initial process parameters */
/* General parameters */
- params.OperatingMode = LVM_MODE_ON;
- params.SampleRate = LVM_FS_44100;
- params.SourceFormat = LVM_STEREO;
- params.SpeakerType = LVM_HEADPHONES;
+ params.OperatingMode = LVM_MODE_ON;
+ params.SampleRate = LVM_FS_44100;
+ params.SourceFormat = LVM_STEREO;
+ params.SpeakerType = LVM_HEADPHONES;
pContext->pBundledContext->SampleRate = LVM_FS_44100;
pContext->pBundledContext->ChMask = AUDIO_CHANNEL_OUT_STEREO;
/* Concert Sound parameters */
- params.VirtualizerOperatingMode = LVM_MODE_OFF;
- params.VirtualizerType = LVM_CONCERTSOUND;
- params.VirtualizerReverbLevel = 100;
- params.CS_EffectLevel = LVM_CS_EFFECT_NONE;
+ params.VirtualizerOperatingMode = LVM_MODE_OFF;
+ params.VirtualizerType = LVM_CONCERTSOUND;
+ params.VirtualizerReverbLevel = 100;
+ params.CS_EffectLevel = LVM_CS_EFFECT_NONE;
/* N-Band Equaliser parameters */
- params.EQNB_OperatingMode = LVM_EQNB_OFF;
- params.EQNB_NBands = FIVEBAND_NUMBANDS;
- params.pEQNB_BandDefinition = &BandDefs[0];
+ params.EQNB_OperatingMode = LVM_EQNB_OFF;
+ params.EQNB_NBands = FIVEBAND_NUMBANDS;
+ params.pEQNB_BandDefinition = &BandDefs[0];
- for (int i=0; i<FIVEBAND_NUMBANDS; i++)
- {
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
BandDefs[i].Frequency = EQNB_5BandPresetsFrequencies[i];
- BandDefs[i].QFactor = EQNB_5BandPresetsQFactors[i];
- BandDefs[i].Gain = EQNB_5BandSoftPresets[i];
+ BandDefs[i].QFactor = EQNB_5BandPresetsQFactors[i];
+ BandDefs[i].Gain = EQNB_5BandSoftPresets[i];
}
/* Volume Control parameters */
- params.VC_EffectLevel = 0;
- params.VC_Balance = 0;
+ params.VC_EffectLevel = 0;
+ params.VC_Balance = 0;
/* Treble Enhancement parameters */
- params.TE_OperatingMode = LVM_TE_OFF;
- params.TE_EffectLevel = 0;
+ params.TE_OperatingMode = LVM_TE_OFF;
+ params.TE_EffectLevel = 0;
/* PSA Control parameters */
- params.PSA_Enable = LVM_PSA_OFF;
- params.PSA_PeakDecayRate = (LVM_PSA_DecaySpeed_en)0;
+ params.PSA_Enable = LVM_PSA_OFF;
+ params.PSA_PeakDecayRate = (LVM_PSA_DecaySpeed_en)0;
/* Bass Enhancement parameters */
- params.BE_OperatingMode = LVM_BE_OFF;
- params.BE_EffectLevel = 0;
- params.BE_CentreFreq = LVM_BE_CENTRE_90Hz;
- params.BE_HPF = LVM_BE_HPF_ON;
+ params.BE_OperatingMode = LVM_BE_OFF;
+ params.BE_EffectLevel = 0;
+ params.BE_CentreFreq = LVM_BE_CENTRE_90Hz;
+ params.BE_HPF = LVM_BE_HPF_ON;
/* PSA Control parameters */
- params.PSA_Enable = LVM_PSA_OFF;
- params.PSA_PeakDecayRate = LVM_PSA_SPEED_MEDIUM;
+ params.PSA_Enable = LVM_PSA_OFF;
+ params.PSA_PeakDecayRate = LVM_PSA_SPEED_MEDIUM;
/* TE Control parameters */
- params.TE_OperatingMode = LVM_TE_OFF;
- params.TE_EffectLevel = 0;
+ params.TE_OperatingMode = LVM_TE_OFF;
+ params.TE_EffectLevel = 0;
- params.NrChannels =
- audio_channel_count_from_out_mask(AUDIO_CHANNEL_OUT_STEREO);
- params.ChMask = AUDIO_CHANNEL_OUT_STEREO;
+ params.NrChannels = audio_channel_count_from_out_mask(AUDIO_CHANNEL_OUT_STEREO);
+ params.ChMask = AUDIO_CHANNEL_OUT_STEREO;
/* Activate the initial settings */
- LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance,
- ¶ms);
+ LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, ¶ms);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmBundle_init")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetControlParameters\n");
+ ALOGV("\tLvmBundle_init CreateInstance Successfully called LVM_SetControlParameters\n");
/* Set the headroom parameters */
- HeadroomBandDef[0].Limit_Low = 20;
- HeadroomBandDef[0].Limit_High = 4999;
- HeadroomBandDef[0].Headroom_Offset = 0;
- HeadroomBandDef[1].Limit_Low = 5000;
- HeadroomBandDef[1].Limit_High = 24000;
- HeadroomBandDef[1].Headroom_Offset = 0;
- HeadroomParams.pHeadroomDefinition = &HeadroomBandDef[0];
+ HeadroomBandDef[0].Limit_Low = 20;
+ HeadroomBandDef[0].Limit_High = 4999;
+ HeadroomBandDef[0].Headroom_Offset = 0;
+ HeadroomBandDef[1].Limit_Low = 5000;
+ HeadroomBandDef[1].Limit_High = 24000;
+ HeadroomBandDef[1].Headroom_Offset = 0;
+ HeadroomParams.pHeadroomDefinition = &HeadroomBandDef[0];
HeadroomParams.Headroom_OperatingMode = LVM_HEADROOM_ON;
- HeadroomParams.NHeadroomBands = 2;
+ HeadroomParams.NHeadroomBands = 2;
- LvmStatus = LVM_SetHeadroomParams(pContext->pBundledContext->hInstance,
- &HeadroomParams);
+ LvmStatus = LVM_SetHeadroomParams(pContext->pBundledContext->hInstance, &HeadroomParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetHeadroomParams", "LvmBundle_init")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- ALOGV("\tLvmBundle_init CreateInstance Succesfully called LVM_SetHeadroomParams\n");
+ ALOGV("\tLvmBundle_init CreateInstance Successfully called LVM_SetHeadroomParams\n");
ALOGV("\tLvmBundle_init End");
return 0;
-} /* end LvmBundle_init */
+} /* end LvmBundle_init */
//----------------------------------------------------------------------------
// LvmBundle_process()
@@ -660,25 +628,22 @@
// pOut: pointer to updated stereo 16 bit output data
//
//----------------------------------------------------------------------------
-int LvmBundle_process(effect_buffer_t *pIn,
- effect_buffer_t *pOut,
- int frameCount,
- EffectContext *pContext){
-
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
- effect_buffer_t *pOutTmp;
+int LvmBundle_process(effect_buffer_t* pIn, effect_buffer_t* pOut, int frameCount,
+ EffectContext* pContext) {
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ effect_buffer_t* pOutTmp;
const LVM_INT32 NrChannels =
- audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
+ audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
- if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE){
+ if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE) {
pOutTmp = pOut;
- } else if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
+ } 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) * NrChannels);
+ (effect_buffer_t*)calloc(frameCount, sizeof(effect_buffer_t) * NrChannels);
if (pContext->pBundledContext->workBuffer == NULL) {
return -ENOMEM;
}
@@ -690,7 +655,6 @@
return -EINVAL;
}
-
/* Process the samples */
LvmStatus = LVM_Process(pContext->pBundledContext->hInstance, /* Instance handle */
pIn, /* Input buffer */
@@ -698,16 +662,15 @@
(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;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
-
- if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE){
+ if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
for (int i = 0; i < frameCount * NrChannels; i++) {
pOut[i] = pOut[i] + pOutTmp[i];
}
}
return 0;
-} /* end LvmBundle_process */
+} /* end LvmBundle_process */
//----------------------------------------------------------------------------
// EqualizerUpdateActiveParams()
@@ -720,29 +683,28 @@
// Outputs:
//
//----------------------------------------------------------------------------
-void EqualizerUpdateActiveParams(EffectContext *pContext) {
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
+void EqualizerUpdateActiveParams(EffectContext* pContext) {
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerUpdateActiveParams")
- //ALOGV("\tEqualizerUpdateActiveParams Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tEqualizerUpdateActiveParams just Got -> %d\n",
+ // ALOGV("\tEqualizerUpdateActiveParams Successfully returned from LVM_GetControlParameters\n");
+ // 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];
- ActiveParams.pEQNB_BandDefinition[i].Gain = pContext->pBundledContext->bandGaindB[i];
- }
+ ActiveParams.pEQNB_BandDefinition[i].Frequency = EQNB_5BandPresetsFrequencies[i];
+ ActiveParams.pEQNB_BandDefinition[i].QFactor = EQNB_5BandPresetsQFactors[i];
+ ActiveParams.pEQNB_BandDefinition[i].Gain = pContext->pBundledContext->bandGaindB[i];
+ }
/* Activate the initial settings */
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "EqualizerUpdateActiveParams")
- //ALOGV("\tEqualizerUpdateActiveParams just Set -> %d\n",
+ // ALOGV("\tEqualizerUpdateActiveParams just Set -> %d\n",
// ActiveParams.pEQNB_BandDefinition[band].Gain);
-
}
//----------------------------------------------------------------------------
@@ -757,19 +719,19 @@
// Outputs:
//
//----------------------------------------------------------------------------
-void LvmEffect_limitLevel(EffectContext *pContext) {
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
+void LvmEffect_limitLevel(EffectContext* pContext) {
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "LvmEffect_limitLevel")
- //ALOGV("\tLvmEffect_limitLevel Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tLvmEffect_limitLevel just Got -> %d\n",
+ // ALOGV("\tLvmEffect_limitLevel Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tLvmEffect_limitLevel just Got -> %d\n",
// ActiveParams.pEQNB_BandDefinition[band].Gain);
int gainCorrection = 0;
- //Count the energy contribution per band for EQ and BassBoost only if they are active.
+ // Count the energy contribution per band for EQ and BassBoost only if they are active.
float energyContribution = 0;
float energyCross = 0;
float energyBassBoost = 0;
@@ -779,88 +741,83 @@
bool bbEnabled = pContext->pBundledContext->bBassEnabled == LVM_TRUE;
bool viEnabled = pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE;
- //EQ contribution
+ // EQ contribution
if (eqEnabled) {
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- float bandFactor = pContext->pBundledContext->bandGaindB[i]/15.0;
+ float bandFactor = pContext->pBundledContext->bandGaindB[i] / 15.0;
float bandCoefficient = LimitLevel_bandEnergyCoefficient[i];
float bandEnergy = bandFactor * bandCoefficient * bandCoefficient;
- if (bandEnergy > 0)
- energyContribution += bandEnergy;
+ if (bandEnergy > 0) energyContribution += bandEnergy;
}
- //cross EQ coefficients
+ // cross EQ coefficients
float bandFactorSum = 0;
- for (int i = 0; i < FIVEBAND_NUMBANDS-1; i++) {
- float bandFactor1 = pContext->pBundledContext->bandGaindB[i]/15.0;
- float bandFactor2 = pContext->pBundledContext->bandGaindB[i+1]/15.0;
+ for (int i = 0; i < FIVEBAND_NUMBANDS - 1; i++) {
+ float bandFactor1 = pContext->pBundledContext->bandGaindB[i] / 15.0;
+ float bandFactor2 = pContext->pBundledContext->bandGaindB[i + 1] / 15.0;
if (bandFactor1 > 0 && bandFactor2 > 0) {
- float crossEnergy = bandFactor1 * bandFactor2 *
- LimitLevel_bandEnergyCrossCoefficient[i];
+ float crossEnergy =
+ bandFactor1 * bandFactor2 * LimitLevel_bandEnergyCrossCoefficient[i];
bandFactorSum += bandFactor1 * bandFactor2;
- if (crossEnergy > 0)
- energyCross += crossEnergy;
+ if (crossEnergy > 0) energyCross += crossEnergy;
}
}
bandFactorSum -= 1.0;
- if (bandFactorSum > 0)
- crossCorrection = bandFactorSum * 0.7;
+ if (bandFactorSum > 0) crossCorrection = bandFactorSum * 0.7;
}
- //BassBoost contribution
+ // BassBoost contribution
if (bbEnabled) {
- float boostFactor = (pContext->pBundledContext->BassStrengthSaved)/1000.0;
+ float boostFactor = (pContext->pBundledContext->BassStrengthSaved) / 1000.0;
float boostCoefficient = LimitLevel_bassBoostEnergyCoefficient;
energyContribution += boostFactor * boostCoefficient * boostCoefficient;
if (eqEnabled) {
for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- float bandFactor = pContext->pBundledContext->bandGaindB[i]/15.0;
+ float bandFactor = pContext->pBundledContext->bandGaindB[i] / 15.0;
float bandCrossCoefficient = LimitLevel_bassBoostEnergyCrossCoefficient[i];
- float bandEnergy = boostFactor * bandFactor *
- bandCrossCoefficient;
- if (bandEnergy > 0)
- energyBassBoost += bandEnergy;
+ float bandEnergy = boostFactor * bandFactor * bandCrossCoefficient;
+ if (bandEnergy > 0) energyBassBoost += bandEnergy;
}
}
}
- //Virtualizer contribution
+ // Virtualizer contribution
if (viEnabled) {
- energyContribution += LimitLevel_virtualizerContribution *
- LimitLevel_virtualizerContribution;
+ energyContribution +=
+ LimitLevel_virtualizerContribution * LimitLevel_virtualizerContribution;
}
- double totalEnergyEstimation = sqrt(energyContribution + energyCross + energyBassBoost) -
- crossCorrection;
+ double totalEnergyEstimation =
+ sqrt(energyContribution + energyCross + energyBassBoost) - crossCorrection;
ALOGV(" TOTAL energy estimation: %0.2f dB", totalEnergyEstimation);
- //roundoff
+ // roundoff
int maxLevelRound = (int)(totalEnergyEstimation + 0.99);
if (maxLevelRound + pContext->pBundledContext->volume > 0) {
gainCorrection = maxLevelRound + pContext->pBundledContext->volume;
}
- ActiveParams.VC_EffectLevel = pContext->pBundledContext->volume - gainCorrection;
+ ActiveParams.VC_EffectLevel = pContext->pBundledContext->volume - gainCorrection;
if (ActiveParams.VC_EffectLevel < -96) {
ActiveParams.VC_EffectLevel = -96;
}
ALOGV("\tVol:%d, GainCorrection: %d, Actual vol: %d", pContext->pBundledContext->volume,
- gainCorrection, ActiveParams.VC_EffectLevel);
+ gainCorrection, ActiveParams.VC_EffectLevel);
/* Activate the initial settings */
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmEffect_limitLevel")
ALOGV("LVM_SetControlParameters return:%d", (int)LvmStatus);
- //ALOGV("\tLvmEffect_limitLevel just Set -> %d\n",
+ // ALOGV("\tLvmEffect_limitLevel just Set -> %d\n",
// ActiveParams.pEQNB_BandDefinition[band].Gain);
- //ALOGV("\tLvmEffect_limitLevel just set (-96dB -> 0dB) -> %d\n",ActiveParams.VC_EffectLevel );
- if (pContext->pBundledContext->firstVolume == LVM_TRUE){
+ // ALOGV("\tLvmEffect_limitLevel just set (-96dB -> 0dB) -> %d\n",ActiveParams.VC_EffectLevel );
+ if (pContext->pBundledContext->firstVolume == LVM_TRUE) {
LvmStatus = LVM_SetVolumeNoSmoothing(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetVolumeNoSmoothing", "LvmBundle_process")
ALOGV("\tLVM_VOLUME: Disabling Smoothing for first volume change to remove spikes/clicks");
@@ -880,42 +837,41 @@
//
//----------------------------------------------------------------------------
-int LvmEffect_enable(EffectContext *pContext){
- //ALOGV("\tLvmEffect_enable start");
+int LvmEffect_enable(EffectContext* pContext) {
+ // ALOGV("\tLvmEffect_enable start");
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
/* Get the current settings */
- LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
- &ActiveParams);
+ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "LvmEffect_enable")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tLvmEffect_enable Succesfully called LVM_GetControlParameters\n");
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+ // ALOGV("\tLvmEffect_enable Successfully called LVM_GetControlParameters\n");
- if(pContext->EffectType == LVM_BASS_BOOST) {
+ if (pContext->EffectType == LVM_BASS_BOOST) {
ALOGV("\tLvmEffect_enable : Enabling LVM_BASS_BOOST");
- ActiveParams.BE_OperatingMode = LVM_BE_ON;
+ ActiveParams.BE_OperatingMode = LVM_BE_ON;
}
- if(pContext->EffectType == LVM_VIRTUALIZER) {
+ if (pContext->EffectType == LVM_VIRTUALIZER) {
ALOGV("\tLvmEffect_enable : Enabling LVM_VIRTUALIZER");
- ActiveParams.VirtualizerOperatingMode = LVM_MODE_ON;
+ ActiveParams.VirtualizerOperatingMode = LVM_MODE_ON;
}
- if(pContext->EffectType == LVM_EQUALIZER) {
+ if (pContext->EffectType == LVM_EQUALIZER) {
ALOGV("\tLvmEffect_enable : Enabling LVM_EQUALIZER");
- ActiveParams.EQNB_OperatingMode = LVM_EQNB_ON;
+ ActiveParams.EQNB_OperatingMode = LVM_EQNB_ON;
}
- if(pContext->EffectType == LVM_VOLUME) {
+ if (pContext->EffectType == LVM_VOLUME) {
ALOGV("\tLvmEffect_enable : Enabling LVM_VOLUME");
}
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmEffect_enable")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tLvmEffect_enable Succesfully called LVM_SetControlParameters\n");
- //ALOGV("\tLvmEffect_enable end");
+ // ALOGV("\tLvmEffect_enable Successfully called LVM_SetControlParameters\n");
+ // ALOGV("\tLvmEffect_enable end");
LvmEffect_limitLevel(pContext);
return 0;
}
@@ -932,46 +888,44 @@
//
//----------------------------------------------------------------------------
-int LvmEffect_disable(EffectContext *pContext){
- //ALOGV("\tLvmEffect_disable start");
+int LvmEffect_disable(EffectContext* pContext) {
+ // ALOGV("\tLvmEffect_disable start");
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
/* Get the current settings */
- LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
- &ActiveParams);
+ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "LvmEffect_disable")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tLvmEffect_disable Succesfully called LVM_GetControlParameters\n");
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+ // ALOGV("\tLvmEffect_disable Successfully called LVM_GetControlParameters\n");
- if(pContext->EffectType == LVM_BASS_BOOST) {
+ if (pContext->EffectType == LVM_BASS_BOOST) {
ALOGV("\tLvmEffect_disable : Disabling LVM_BASS_BOOST");
- ActiveParams.BE_OperatingMode = LVM_BE_OFF;
+ ActiveParams.BE_OperatingMode = LVM_BE_OFF;
}
- if(pContext->EffectType == LVM_VIRTUALIZER) {
+ if (pContext->EffectType == LVM_VIRTUALIZER) {
ALOGV("\tLvmEffect_disable : Disabling LVM_VIRTUALIZER");
- ActiveParams.VirtualizerOperatingMode = LVM_MODE_OFF;
+ ActiveParams.VirtualizerOperatingMode = LVM_MODE_OFF;
}
- if(pContext->EffectType == LVM_EQUALIZER) {
+ if (pContext->EffectType == LVM_EQUALIZER) {
ALOGV("\tLvmEffect_disable : Disabling LVM_EQUALIZER");
- ActiveParams.EQNB_OperatingMode = LVM_EQNB_OFF;
+ ActiveParams.EQNB_OperatingMode = LVM_EQNB_OFF;
}
- if(pContext->EffectType == LVM_VOLUME) {
+ if (pContext->EffectType == LVM_VOLUME) {
ALOGV("\tLvmEffect_disable : Disabling LVM_VOLUME");
}
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "LvmEffect_disable")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tLvmEffect_disable Succesfully called LVM_SetControlParameters\n");
- //ALOGV("\tLvmEffect_disable end");
+ // ALOGV("\tLvmEffect_disable Successfully called LVM_SetControlParameters\n");
+ // ALOGV("\tLvmEffect_disable end");
LvmEffect_limitLevel(pContext);
return 0;
}
-
//----------------------------------------------------------------------------
// Effect_setConfig()
//----------------------------------------------------------------------------
@@ -986,9 +940,9 @@
//
//----------------------------------------------------------------------------
-int Effect_setConfig(EffectContext *pContext, effect_config_t *pConfig){
- LVM_Fs_en SampleRate;
- //ALOGV("\tEffect_setConfig start");
+int Effect_setConfig(EffectContext* pContext, effect_config_t* pConfig) {
+ LVM_Fs_en SampleRate;
+ // ALOGV("\tEffect_setConfig start");
CHECK_ARG(pContext != NULL);
CHECK_ARG(pConfig != NULL);
@@ -997,72 +951,70 @@
CHECK_ARG(pConfig->inputCfg.channels == pConfig->outputCfg.channels);
CHECK_ARG(pConfig->inputCfg.format == pConfig->outputCfg.format);
CHECK_ARG(audio_channel_count_from_out_mask(pConfig->inputCfg.channels) <= LVM_MAX_CHANNELS);
- CHECK_ARG(pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE
- || pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE);
+ CHECK_ARG(pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE ||
+ pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE);
CHECK_ARG(pConfig->inputCfg.format == EFFECT_BUFFER_FORMAT);
pContext->config = *pConfig;
const LVM_INT16 NrChannels = audio_channel_count_from_out_mask(pConfig->inputCfg.channels);
switch (pConfig->inputCfg.samplingRate) {
- case 8000:
- SampleRate = LVM_FS_8000;
- pContext->pBundledContext->SamplesPerSecond = 8000 * NrChannels;
- break;
- case 16000:
- SampleRate = LVM_FS_16000;
- pContext->pBundledContext->SamplesPerSecond = 16000 * NrChannels;
- break;
- case 22050:
- SampleRate = LVM_FS_22050;
- pContext->pBundledContext->SamplesPerSecond = 22050 * NrChannels;
- break;
- case 32000:
- SampleRate = LVM_FS_32000;
- pContext->pBundledContext->SamplesPerSecond = 32000 * NrChannels;
- break;
- case 44100:
- SampleRate = LVM_FS_44100;
- pContext->pBundledContext->SamplesPerSecond = 44100 * NrChannels;
- break;
- case 48000:
- SampleRate = LVM_FS_48000;
- pContext->pBundledContext->SamplesPerSecond = 48000 * NrChannels;
- break;
- case 88200:
- SampleRate = LVM_FS_88200;
- pContext->pBundledContext->SamplesPerSecond = 88200 * NrChannels;
- break;
- case 96000:
- SampleRate = LVM_FS_96000;
- pContext->pBundledContext->SamplesPerSecond = 96000 * NrChannels;
- break;
- case 176400:
- SampleRate = LVM_FS_176400;
- pContext->pBundledContext->SamplesPerSecond = 176400 * NrChannels;
- break;
- case 192000:
- SampleRate = LVM_FS_192000;
- pContext->pBundledContext->SamplesPerSecond = 192000 * NrChannels;
- break;
- default:
- ALOGV("\tEffect_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
- return -EINVAL;
+ case 8000:
+ SampleRate = LVM_FS_8000;
+ pContext->pBundledContext->SamplesPerSecond = 8000 * NrChannels;
+ break;
+ case 16000:
+ SampleRate = LVM_FS_16000;
+ pContext->pBundledContext->SamplesPerSecond = 16000 * NrChannels;
+ break;
+ case 22050:
+ SampleRate = LVM_FS_22050;
+ pContext->pBundledContext->SamplesPerSecond = 22050 * NrChannels;
+ break;
+ case 32000:
+ SampleRate = LVM_FS_32000;
+ pContext->pBundledContext->SamplesPerSecond = 32000 * NrChannels;
+ break;
+ case 44100:
+ SampleRate = LVM_FS_44100;
+ pContext->pBundledContext->SamplesPerSecond = 44100 * NrChannels;
+ break;
+ case 48000:
+ SampleRate = LVM_FS_48000;
+ pContext->pBundledContext->SamplesPerSecond = 48000 * NrChannels;
+ break;
+ case 88200:
+ SampleRate = LVM_FS_88200;
+ pContext->pBundledContext->SamplesPerSecond = 88200 * NrChannels;
+ break;
+ case 96000:
+ SampleRate = LVM_FS_96000;
+ pContext->pBundledContext->SamplesPerSecond = 96000 * NrChannels;
+ break;
+ case 176400:
+ SampleRate = LVM_FS_176400;
+ pContext->pBundledContext->SamplesPerSecond = 176400 * NrChannels;
+ break;
+ case 192000:
+ SampleRate = LVM_FS_192000;
+ pContext->pBundledContext->SamplesPerSecond = 192000 * NrChannels;
+ break;
+ default:
+ ALOGV("\tEffect_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
+ return -EINVAL;
}
if (pContext->pBundledContext->SampleRate != SampleRate ||
pContext->pBundledContext->ChMask != pConfig->inputCfg.channels) {
-
- LVM_ControlParams_t ActiveParams;
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS;
+ LVM_ControlParams_t ActiveParams;
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS;
ALOGV("\tEffect_setConfig change sampling rate to %d", SampleRate);
/* Get the current settings */
- LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
- &ActiveParams);
+ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "Effect_setConfig")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
ActiveParams.SampleRate = SampleRate;
@@ -1072,19 +1024,19 @@
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "Effect_setConfig")
- ALOGV("\tEffect_setConfig Succesfully called LVM_SetControlParameters\n");
+ ALOGV("\tEffect_setConfig Successfully called LVM_SetControlParameters\n");
pContext->pBundledContext->SampleRate = SampleRate;
pContext->pBundledContext->ChMask = pConfig->inputCfg.channels;
LvmEffect_limitLevel(pContext);
- }else{
- //ALOGV("\tEffect_setConfig keep sampling rate at %d", SampleRate);
+ } else {
+ // ALOGV("\tEffect_setConfig keep sampling rate at %d", SampleRate);
}
- //ALOGV("\tEffect_setConfig End....");
+ // ALOGV("\tEffect_setConfig End....");
return 0;
-} /* end Effect_setConfig */
+} /* end Effect_setConfig */
//----------------------------------------------------------------------------
// Effect_getConfig()
@@ -1100,10 +1052,9 @@
//
//----------------------------------------------------------------------------
-void Effect_getConfig(EffectContext *pContext, effect_config_t *pConfig)
-{
+void Effect_getConfig(EffectContext* pContext, effect_config_t* pConfig) {
*pConfig = pContext->config;
-} /* end Effect_getConfig */
+} /* end Effect_getConfig */
//----------------------------------------------------------------------------
// BassGetStrength()
@@ -1119,32 +1070,31 @@
//
//----------------------------------------------------------------------------
-uint32_t BassGetStrength(EffectContext *pContext){
- //ALOGV("\tBassGetStrength() (0-1000) -> %d\n", pContext->pBundledContext->BassStrengthSaved);
+uint32_t BassGetStrength(EffectContext* pContext) {
+ // ALOGV("\tBassGetStrength() (0-1000) -> %d\n", pContext->pBundledContext->BassStrengthSaved);
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
/* Get the current settings */
- LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
- &ActiveParams);
+ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "BassGetStrength")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tBassGetStrength Succesfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tBassGetStrength Successfully returned from LVM_GetControlParameters\n");
/* Check that the strength returned matches the strength that was set earlier */
- if(ActiveParams.BE_EffectLevel !=
- (LVM_INT16)((15*pContext->pBundledContext->BassStrengthSaved)/1000)){
+ if (ActiveParams.BE_EffectLevel !=
+ (LVM_INT16)((15 * pContext->pBundledContext->BassStrengthSaved) / 1000)) {
ALOGV("\tLVM_ERROR : BassGetStrength module strength does not match savedStrength %d %d\n",
- ActiveParams.BE_EffectLevel, pContext->pBundledContext->BassStrengthSaved);
+ ActiveParams.BE_EffectLevel, pContext->pBundledContext->BassStrengthSaved);
return -EINVAL;
}
- //ALOGV("\tBassGetStrength() (0-15) -> %d\n", ActiveParams.BE_EffectLevel );
- //ALOGV("\tBassGetStrength() (saved) -> %d\n", pContext->pBundledContext->BassStrengthSaved );
+ // ALOGV("\tBassGetStrength() (0-15) -> %d\n", ActiveParams.BE_EffectLevel );
+ // ALOGV("\tBassGetStrength() (saved) -> %d\n", pContext->pBundledContext->BassStrengthSaved );
return pContext->pBundledContext->BassStrengthSaved;
-} /* end BassGetStrength */
+} /* end BassGetStrength */
//----------------------------------------------------------------------------
// BassSetStrength()
@@ -1158,35 +1108,34 @@
//
//----------------------------------------------------------------------------
-void BassSetStrength(EffectContext *pContext, uint32_t strength){
- //ALOGV("\tBassSetStrength(%d)", strength);
+void BassSetStrength(EffectContext* pContext, uint32_t strength) {
+ // ALOGV("\tBassSetStrength(%d)", strength);
pContext->pBundledContext->BassStrengthSaved = (int)strength;
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
/* Get the current settings */
- LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
- &ActiveParams);
+ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "BassSetStrength")
- //ALOGV("\tBassSetStrength Succesfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tBassSetStrength Successfully returned from LVM_GetControlParameters\n");
/* Bass Enhancement parameters */
- ActiveParams.BE_EffectLevel = (LVM_INT16)((15*strength)/1000);
- ActiveParams.BE_CentreFreq = LVM_BE_CENTRE_90Hz;
+ ActiveParams.BE_EffectLevel = (LVM_INT16)((15 * strength) / 1000);
+ ActiveParams.BE_CentreFreq = LVM_BE_CENTRE_90Hz;
- //ALOGV("\tBassSetStrength() (0-15) -> %d\n", ActiveParams.BE_EffectLevel );
+ // ALOGV("\tBassSetStrength() (0-15) -> %d\n", ActiveParams.BE_EffectLevel );
/* Activate the initial settings */
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "BassSetStrength")
- //ALOGV("\tBassSetStrength Succesfully called LVM_SetControlParameters\n");
+ // ALOGV("\tBassSetStrength Successfully called LVM_SetControlParameters\n");
LvmEffect_limitLevel(pContext);
-} /* end BassSetStrength */
+} /* end BassSetStrength */
//----------------------------------------------------------------------------
// VirtualizerGetStrength()
@@ -1202,21 +1151,23 @@
//
//----------------------------------------------------------------------------
-uint32_t VirtualizerGetStrength(EffectContext *pContext){
- //ALOGV("\tVirtualizerGetStrength (0-1000) -> %d\n",pContext->pBundledContext->VirtStrengthSaved);
+uint32_t VirtualizerGetStrength(EffectContext* pContext) {
+ // ALOGV("\tVirtualizerGetStrength (0-1000) ->
+ // %d\n",pContext->pBundledContext->VirtStrengthSaved);
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VirtualizerGetStrength")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tVirtualizerGetStrength Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tVirtualizerGetStrength() (0-100) -> %d\n", ActiveParams.VirtualizerReverbLevel*10);
+ // ALOGV("\tVirtualizerGetStrength Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tVirtualizerGetStrength() (0-100) -> %d\n",
+ // ActiveParams.VirtualizerReverbLevel*10);
return pContext->pBundledContext->VirtStrengthSaved;
-} /* end getStrength */
+} /* end getStrength */
//----------------------------------------------------------------------------
// VirtualizerSetStrength()
@@ -1230,31 +1181,31 @@
//
//----------------------------------------------------------------------------
-void VirtualizerSetStrength(EffectContext *pContext, uint32_t strength){
- //ALOGV("\tVirtualizerSetStrength(%d)", strength);
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
+void VirtualizerSetStrength(EffectContext* pContext, uint32_t strength) {
+ // ALOGV("\tVirtualizerSetStrength(%d)", strength);
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
pContext->pBundledContext->VirtStrengthSaved = (int)strength;
/* Get the current settings */
- LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
+ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VirtualizerSetStrength")
- //ALOGV("\tVirtualizerSetStrength Succesfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tVirtualizerSetStrength Successfully returned from LVM_GetControlParameters\n");
/* Virtualizer parameters */
- ActiveParams.CS_EffectLevel = (int)((strength*32767)/1000);
+ ActiveParams.CS_EffectLevel = (int)((strength * 32767) / 1000);
- ALOGV("\tVirtualizerSetStrength() (0-1000) -> %d\n", strength );
- ALOGV("\tVirtualizerSetStrength() (0- 100) -> %d\n", ActiveParams.CS_EffectLevel );
+ ALOGV("\tVirtualizerSetStrength() (0-1000) -> %d\n", strength);
+ ALOGV("\tVirtualizerSetStrength() (0- 100) -> %d\n", ActiveParams.CS_EffectLevel);
/* Activate the initial settings */
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VirtualizerSetStrength")
- //ALOGV("\tVirtualizerSetStrength Succesfully called LVM_SetControlParameters\n\n");
+ // ALOGV("\tVirtualizerSetStrength Successfully called LVM_SetControlParameters\n\n");
LvmEffect_limitLevel(pContext);
-} /* end setStrength */
+} /* end setStrength */
//----------------------------------------------------------------------------
// VirtualizerIsDeviceSupported()
@@ -1270,14 +1221,14 @@
//----------------------------------------------------------------------------
int VirtualizerIsDeviceSupported(audio_devices_t deviceType) {
switch (deviceType) {
- case AUDIO_DEVICE_OUT_WIRED_HEADSET:
- case AUDIO_DEVICE_OUT_WIRED_HEADPHONE:
- case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES:
- case AUDIO_DEVICE_OUT_USB_HEADSET:
- // case AUDIO_DEVICE_OUT_USB_DEVICE: // For USB testing of the virtualizer only.
- return 0;
- default :
- return -EINVAL;
+ case AUDIO_DEVICE_OUT_WIRED_HEADSET:
+ case AUDIO_DEVICE_OUT_WIRED_HEADPHONE:
+ case AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES:
+ case AUDIO_DEVICE_OUT_USB_HEADSET:
+ // case AUDIO_DEVICE_OUT_USB_DEVICE: // For USB testing of the virtualizer only.
+ return 0;
+ default:
+ return -EINVAL;
}
}
@@ -1295,9 +1246,9 @@
// 0 if the configuration is supported
//----------------------------------------------------------------------------
int VirtualizerIsConfigurationSupported(audio_channel_mask_t channelMask,
- audio_devices_t deviceType) {
+ audio_devices_t deviceType) {
uint32_t channelCount = audio_channel_count_from_out_mask(channelMask);
- if (channelCount < 1 || channelCount > FCC_2) { // TODO: update to 8 channels when supported.
+ if (channelCount < 1 || channelCount > FCC_2) { // TODO: update to 8 channels when supported.
return -EINVAL;
}
return VirtualizerIsDeviceSupported(deviceType);
@@ -1317,16 +1268,16 @@
// 0 if the device is supported and the virtualization mode forced
//
//----------------------------------------------------------------------------
-int VirtualizerForceVirtualizationMode(EffectContext *pContext, audio_devices_t forcedDevice) {
+int VirtualizerForceVirtualizationMode(EffectContext* pContext, audio_devices_t forcedDevice) {
ALOGV("VirtualizerForceVirtualizationMode: forcedDev=0x%x enabled=%d tmpDisabled=%d",
- forcedDevice, pContext->pBundledContext->bVirtualizerEnabled,
- pContext->pBundledContext->bVirtualizerTempDisabled);
+ forcedDevice, pContext->pBundledContext->bVirtualizerEnabled,
+ pContext->pBundledContext->bVirtualizerTempDisabled);
int status = 0;
bool useVirtualizer = false;
if (VirtualizerIsDeviceSupported(forcedDevice) != 0) {
if (forcedDevice != AUDIO_DEVICE_NONE) {
- //forced device is not supported, make it behave as a reset of forced mode
+ // forced device is not supported, make it behave as a reset of forced mode
forcedDevice = AUDIO_DEVICE_NONE;
// but return an error
status = -EINVAL;
@@ -1366,8 +1317,8 @@
}
ALOGV("\tafter VirtualizerForceVirtualizationMode: enabled=%d tmpDisabled=%d",
- pContext->pBundledContext->bVirtualizerEnabled,
- pContext->pBundledContext->bVirtualizerTempDisabled);
+ pContext->pBundledContext->bVirtualizerEnabled,
+ pContext->pBundledContext->bVirtualizerTempDisabled);
return status;
}
@@ -1393,23 +1344,23 @@
//
//----------------------------------------------------------------------------
void VirtualizerGetSpeakerAngles(audio_channel_mask_t channelMask,
- audio_devices_t deviceType __unused, int32_t *pSpeakerAngles) {
+ audio_devices_t deviceType __unused, int32_t* pSpeakerAngles) {
// the channel count is guaranteed to be 1 or 2
// the device is guaranteed to be of type headphone
// this virtualizer is always using 2 virtual speakers at -90 and 90deg of azimuth, 0deg of
// elevation but the return information is sized for nbChannels * 3, so we have to consider
// the (false here) case of a single channel, and return only 3 fields.
if (audio_channel_count_from_out_mask(channelMask) == 1) {
- *pSpeakerAngles++ = (int32_t) AUDIO_CHANNEL_OUT_MONO; // same as FRONT_LEFT
- *pSpeakerAngles++ = 0; // azimuth
- *pSpeakerAngles = 0; // elevation
+ *pSpeakerAngles++ = (int32_t)AUDIO_CHANNEL_OUT_MONO; // same as FRONT_LEFT
+ *pSpeakerAngles++ = 0; // azimuth
+ *pSpeakerAngles = 0; // elevation
} else {
- *pSpeakerAngles++ = (int32_t) AUDIO_CHANNEL_OUT_FRONT_LEFT;
- *pSpeakerAngles++ = -90; // azimuth
- *pSpeakerAngles++ = 0; // elevation
- *pSpeakerAngles++ = (int32_t) AUDIO_CHANNEL_OUT_FRONT_RIGHT;
+ *pSpeakerAngles++ = (int32_t)AUDIO_CHANNEL_OUT_FRONT_LEFT;
+ *pSpeakerAngles++ = -90; // azimuth
+ *pSpeakerAngles++ = 0; // elevation
+ *pSpeakerAngles++ = (int32_t)AUDIO_CHANNEL_OUT_FRONT_RIGHT;
*pSpeakerAngles++ = 90; // azimuth
- *pSpeakerAngles = 0; // elevation
+ *pSpeakerAngles = 0; // elevation
}
}
@@ -1423,10 +1374,10 @@
// AUDIO_DEVICE_NONE if the effect is not virtualizing
// or the device type if the effect is virtualizing
//----------------------------------------------------------------------------
-audio_devices_t VirtualizerGetVirtualizationMode(EffectContext *pContext) {
+audio_devices_t VirtualizerGetVirtualizationMode(EffectContext* pContext) {
audio_devices_t virtDevice = AUDIO_DEVICE_NONE;
- if ((pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE)
- && (pContext->pBundledContext->bVirtualizerTempDisabled == LVM_FALSE)) {
+ if ((pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) &&
+ (pContext->pBundledContext->bVirtualizerTempDisabled == LVM_FALSE)) {
if (pContext->pBundledContext->nVirtualizerForcedDevice != AUDIO_DEVICE_NONE) {
// virtualization mode is forced, return that device
virtDevice = pContext->pBundledContext->nVirtualizerForcedDevice;
@@ -1451,8 +1402,8 @@
// Outputs:
//
//----------------------------------------------------------------------------
-int32_t EqualizerGetBandLevel(EffectContext *pContext, int32_t band){
- //ALOGV("\tEqualizerGetBandLevel -> %d\n", pContext->pBundledContext->bandGaindB[band] );
+int32_t EqualizerGetBandLevel(EffectContext* pContext, int32_t band) {
+ // ALOGV("\tEqualizerGetBandLevel -> %d\n", pContext->pBundledContext->bandGaindB[band] );
return pContext->pBundledContext->bandGaindB[band] * 100;
}
@@ -1470,14 +1421,14 @@
// Outputs:
//
//---------------------------------------------------------------------------
-void EqualizerSetBandLevel(EffectContext *pContext, int band, short Gain){
+void EqualizerSetBandLevel(EffectContext* pContext, int band, short Gain) {
int gainRounded;
- if(Gain > 0){
- gainRounded = (int)((Gain+50)/100);
- }else{
- gainRounded = (int)((Gain-50)/100);
+ if (Gain > 0) {
+ gainRounded = (int)((Gain + 50) / 100);
+ } else {
+ gainRounded = (int)((Gain - 50) / 100);
}
- //ALOGV("\tEqualizerSetBandLevel(%d)->(%d)", Gain, gainRounded);
+ // ALOGV("\tEqualizerSetBandLevel(%d)->(%d)", Gain, gainRounded);
pContext->pBundledContext->bandGaindB[band] = gainRounded;
pContext->pBundledContext->CurPreset = PRESET_CUSTOM;
@@ -1497,23 +1448,22 @@
// Outputs:
//
//----------------------------------------------------------------------------
-int32_t EqualizerGetCentreFrequency(EffectContext *pContext, int32_t band){
- int32_t Frequency =0;
+int32_t EqualizerGetCentreFrequency(EffectContext* pContext, int32_t band) {
+ int32_t Frequency = 0;
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
- LVM_EQNB_BandDef_t *BandDef;
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_EQNB_BandDef_t* BandDef;
/* Get the current settings */
- LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance,
- &ActiveParams);
+ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "EqualizerGetCentreFrequency")
- BandDef = ActiveParams.pEQNB_BandDefinition;
- Frequency = (int32_t)BandDef[band].Frequency*1000; // Convert to millibels
+ BandDef = ActiveParams.pEQNB_BandDefinition;
+ Frequency = (int32_t)BandDef[band].Frequency * 1000; // Convert to millibels
- //ALOGV("\tEqualizerGetCentreFrequency -> %d\n", Frequency );
- //ALOGV("\tEqualizerGetCentreFrequency Succesfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tEqualizerGetCentreFrequency -> %d\n", Frequency );
+ // ALOGV("\tEqualizerGetCentreFrequency Successfully returned from LVM_GetControlParameters\n");
return Frequency;
}
@@ -1535,10 +1485,10 @@
// pLow: lower band range
// pLow: upper band range
//----------------------------------------------------------------------------
-int32_t EqualizerGetBandFreqRange(EffectContext *pContext __unused, int32_t band, uint32_t *pLow,
- uint32_t *pHi){
+int32_t EqualizerGetBandFreqRange(EffectContext* pContext __unused, int32_t band, uint32_t* pLow,
+ uint32_t* pHi) {
*pLow = bandFreqRange[band][0];
- *pHi = bandFreqRange[band][1];
+ *pHi = bandFreqRange[band][1];
return 0;
}
@@ -1559,16 +1509,16 @@
// pLow: lower band range
// pLow: upper band range
//----------------------------------------------------------------------------
-int32_t EqualizerGetBand(EffectContext *pContext __unused, uint32_t targetFreq){
+int32_t EqualizerGetBand(EffectContext* pContext __unused, uint32_t targetFreq) {
int band = 0;
- if(targetFreq < bandFreqRange[0][0]){
+ if (targetFreq < bandFreqRange[0][0]) {
return -EINVAL;
- }else if(targetFreq == bandFreqRange[0][0]){
+ } else if (targetFreq == bandFreqRange[0][0]) {
return 0;
}
- for(int i=0; i<FIVEBAND_NUMBANDS;i++){
- if((targetFreq > bandFreqRange[i][0])&&(targetFreq <= bandFreqRange[i][1])){
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
+ if ((targetFreq > bandFreqRange[i][0]) && (targetFreq <= bandFreqRange[i][1])) {
band = i;
}
}
@@ -1588,7 +1538,7 @@
// pContext: effect engine context
//
//----------------------------------------------------------------------------
-int32_t EqualizerGetPreset(EffectContext *pContext){
+int32_t EqualizerGetPreset(EffectContext* pContext) {
return pContext->pBundledContext->CurPreset;
}
@@ -1605,14 +1555,12 @@
// preset The preset ID.
//
//----------------------------------------------------------------------------
-void EqualizerSetPreset(EffectContext *pContext, int preset){
-
- //ALOGV("\tEqualizerSetPreset(%d)", preset);
+void EqualizerSetPreset(EffectContext* pContext, int preset) {
+ // ALOGV("\tEqualizerSetPreset(%d)", preset);
pContext->pBundledContext->CurPreset = preset;
- //ActiveParams.pEQNB_BandDefinition = &BandDefs[0];
- for (int i=0; i<FIVEBAND_NUMBANDS; i++)
- {
+ // ActiveParams.pEQNB_BandDefinition = &BandDefs[0];
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
pContext->pBundledContext->bandGaindB[i] =
EQNB_5BandSoftPresets[i + preset * FIVEBAND_NUMBANDS];
}
@@ -1620,11 +1568,11 @@
EqualizerUpdateActiveParams(pContext);
LvmEffect_limitLevel(pContext);
- //ALOGV("\tEqualizerSetPreset Succesfully called LVM_SetControlParameters\n");
+ // ALOGV("\tEqualizerSetPreset Successfully called LVM_SetControlParameters\n");
return;
}
-int32_t EqualizerGetNumPresets(){
+int32_t EqualizerGetNumPresets() {
return sizeof(gEqualizerPresets) / sizeof(PresetConfig);
}
@@ -1639,14 +1587,14 @@
// preset The preset ID. Must be less than number of presets.
//
//-------------------------------------------------------------------------
-const char * EqualizerGetPresetName(int32_t preset){
- //ALOGV("\tEqualizerGetPresetName start(%d)", preset);
+const char* EqualizerGetPresetName(int32_t preset) {
+ // ALOGV("\tEqualizerGetPresetName start(%d)", preset);
if (preset == PRESET_CUSTOM) {
return "Custom";
} else {
return gEqualizerPresets[preset].name;
}
- //ALOGV("\tEqualizerGetPresetName end(%d)", preset);
+ // ALOGV("\tEqualizerGetPresetName end(%d)", preset);
return 0;
}
@@ -1661,8 +1609,7 @@
//
//----------------------------------------------------------------------------
-int VolumeSetVolumeLevel(EffectContext *pContext, int16_t level){
-
+int VolumeSetVolumeLevel(EffectContext* pContext, int16_t level) {
if (level > 0 || level < -9600) {
return -EINVAL;
}
@@ -1676,7 +1623,7 @@
LvmEffect_limitLevel(pContext);
return 0;
-} /* end VolumeSetVolumeLevel */
+} /* end VolumeSetVolumeLevel */
//----------------------------------------------------------------------------
// VolumeGetVolumeLevel()
@@ -1688,15 +1635,14 @@
//
//----------------------------------------------------------------------------
-int VolumeGetVolumeLevel(EffectContext *pContext, int16_t *level){
-
+int VolumeGetVolumeLevel(EffectContext* pContext, int16_t* level) {
if (pContext->pBundledContext->bMuteEnabled == LVM_TRUE) {
*level = pContext->pBundledContext->levelSaved * 100;
} else {
*level = pContext->pBundledContext->volume * 100;
}
return 0;
-} /* end VolumeGetVolumeLevel */
+} /* end VolumeGetVolumeLevel */
//----------------------------------------------------------------------------
// VolumeSetMute()
@@ -1709,23 +1655,23 @@
//
//----------------------------------------------------------------------------
-int32_t VolumeSetMute(EffectContext *pContext, uint32_t mute){
- //ALOGV("\tVolumeSetMute start(%d)", mute);
+int32_t VolumeSetMute(EffectContext* pContext, uint32_t mute) {
+ // ALOGV("\tVolumeSetMute start(%d)", mute);
pContext->pBundledContext->bMuteEnabled = mute;
/* Set appropriate volume level */
- if(pContext->pBundledContext->bMuteEnabled == LVM_TRUE){
+ if (pContext->pBundledContext->bMuteEnabled == LVM_TRUE) {
pContext->pBundledContext->levelSaved = pContext->pBundledContext->volume;
pContext->pBundledContext->volume = -96;
- }else{
+ } else {
pContext->pBundledContext->volume = pContext->pBundledContext->levelSaved;
}
LvmEffect_limitLevel(pContext);
return 0;
-} /* end setMute */
+} /* end setMute */
//----------------------------------------------------------------------------
// VolumeGetMute()
@@ -1739,26 +1685,25 @@
// mute: enable/disable flag
//----------------------------------------------------------------------------
-int32_t VolumeGetMute(EffectContext *pContext, uint32_t *mute){
- //ALOGV("\tVolumeGetMute start");
- if((pContext->pBundledContext->bMuteEnabled == LVM_FALSE)||
- (pContext->pBundledContext->bMuteEnabled == LVM_TRUE)){
+int32_t VolumeGetMute(EffectContext* pContext, uint32_t* mute) {
+ // ALOGV("\tVolumeGetMute start");
+ if ((pContext->pBundledContext->bMuteEnabled == LVM_FALSE) ||
+ (pContext->pBundledContext->bMuteEnabled == LVM_TRUE)) {
*mute = pContext->pBundledContext->bMuteEnabled;
return 0;
- }else{
+ } else {
ALOGV("\tLVM_ERROR : VolumeGetMute read an invalid value from context %d",
pContext->pBundledContext->bMuteEnabled);
return -EINVAL;
}
- //ALOGV("\tVolumeGetMute end");
-} /* end getMute */
+ // ALOGV("\tVolumeGetMute end");
+} /* end getMute */
-int16_t VolumeConvertStereoPosition(int16_t position){
+int16_t VolumeConvertStereoPosition(int16_t position) {
int16_t convertedPosition = 0;
- convertedPosition = (int16_t)(((float)position/1000)*96);
+ convertedPosition = (int16_t)(((float)position / 1000) * 96);
return convertedPosition;
-
}
//----------------------------------------------------------------------------
@@ -1773,55 +1718,55 @@
// Outputs:
//----------------------------------------------------------------------------
-int VolumeSetStereoPosition(EffectContext *pContext, int16_t position){
-
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
- LVM_INT16 Balance = 0;
+int VolumeSetStereoPosition(EffectContext* pContext, int16_t position) {
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_INT16 Balance = 0;
pContext->pBundledContext->positionSaved = position;
Balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
- //ALOGV("\tVolumeSetStereoPosition start pContext->pBundledContext->positionSaved = %d",
- //pContext->pBundledContext->positionSaved);
+ // ALOGV("\tVolumeSetStereoPosition start pContext->pBundledContext->positionSaved = %d",
+ // pContext->pBundledContext->positionSaved);
- if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){
-
- //ALOGV("\tVolumeSetStereoPosition Position to be set is %d %d\n", position, Balance);
+ if (pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE) {
+ // ALOGV("\tVolumeSetStereoPosition Position to be set is %d %d\n", position, Balance);
pContext->pBundledContext->positionSaved = position;
/* Get the current settings */
LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetStereoPosition")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got:"
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+ // ALOGV("\tVolumeSetStereoPosition Successfully returned from LVM_GetControlParameters
+ // got:"
// " %d\n", ActiveParams.VC_Balance);
/* Volume parameters */
- ActiveParams.VC_Balance = Balance;
- //ALOGV("\tVolumeSetStereoPosition() (-96dB -> +96dB) -> %d\n", ActiveParams.VC_Balance );
+ ActiveParams.VC_Balance = Balance;
+ // ALOGV("\tVolumeSetStereoPosition() (-96dB -> +96dB) -> %d\n", ActiveParams.VC_Balance
+ // );
/* Activate the initial settings */
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeSetStereoPosition")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tVolumeSetStereoPosition Succesfully called LVM_SetControlParameters\n");
+ // ALOGV("\tVolumeSetStereoPosition Successfully called LVM_SetControlParameters\n");
/* Get the current settings */
LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetStereoPosition")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tVolumeSetStereoPosition Succesfully returned from LVM_GetControlParameters got: "
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
+ // ALOGV("\tVolumeSetStereoPosition Successfully returned from LVM_GetControlParameters got:
+ // "
// "%d\n", ActiveParams.VC_Balance);
+ } else {
+ // ALOGV("\tVolumeSetStereoPosition Position attempting to set, but not enabled %d %d\n",
+ // position, Balance);
}
- else{
- //ALOGV("\tVolumeSetStereoPosition Position attempting to set, but not enabled %d %d\n",
- //position, Balance);
- }
- //ALOGV("\tVolumeSetStereoPosition end pContext->pBundledContext->positionSaved = %d\n",
- //pContext->pBundledContext->positionSaved);
+ // ALOGV("\tVolumeSetStereoPosition end pContext->pBundledContext->positionSaved = %d\n",
+ // pContext->pBundledContext->positionSaved);
return 0;
-} /* end VolumeSetStereoPosition */
+} /* end VolumeSetStereoPosition */
//----------------------------------------------------------------------------
// VolumeGetStereoPosition()
@@ -1835,35 +1780,35 @@
// position: stereo position
//----------------------------------------------------------------------------
-int32_t VolumeGetStereoPosition(EffectContext *pContext, int16_t *position){
- //ALOGV("\tVolumeGetStereoPosition start");
+int32_t VolumeGetStereoPosition(EffectContext* pContext, int16_t* position) {
+ // ALOGV("\tVolumeGetStereoPosition start");
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
- LVM_INT16 balance;
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
+ LVM_INT16 balance;
- //ALOGV("\tVolumeGetStereoPosition start pContext->pBundledContext->positionSaved = %d",
- //pContext->pBundledContext->positionSaved);
+ // ALOGV("\tVolumeGetStereoPosition start pContext->pBundledContext->positionSaved = %d",
+ // pContext->pBundledContext->positionSaved);
LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeGetStereoPosition")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tVolumeGetStereoPosition -> %d\n", ActiveParams.VC_Balance);
- //ALOGV("\tVolumeGetStereoPosition Succesfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tVolumeGetStereoPosition -> %d\n", ActiveParams.VC_Balance);
+ // ALOGV("\tVolumeGetStereoPosition Successfully returned from LVM_GetControlParameters\n");
balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
- if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){
- if(balance != ActiveParams.VC_Balance){
+ if (pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE) {
+ if (balance != ActiveParams.VC_Balance) {
return -EINVAL;
}
}
- *position = (LVM_INT16)pContext->pBundledContext->positionSaved; // Convert dB to millibels
- //ALOGV("\tVolumeGetStereoPosition end returning pContext->pBundledContext->positionSaved =%d\n",
- //pContext->pBundledContext->positionSaved);
+ *position = (LVM_INT16)pContext->pBundledContext->positionSaved; // Convert dB to millibels
+ // ALOGV("\tVolumeGetStereoPosition end returning pContext->pBundledContext->positionSaved
+ // =%d\n", pContext->pBundledContext->positionSaved);
return 0;
-} /* end VolumeGetStereoPosition */
+} /* end VolumeGetStereoPosition */
//----------------------------------------------------------------------------
// VolumeEnableStereoPosition()
@@ -1876,40 +1821,40 @@
//
//----------------------------------------------------------------------------
-int32_t VolumeEnableStereoPosition(EffectContext *pContext, uint32_t enabled){
- //ALOGV("\tVolumeEnableStereoPosition start()");
+int32_t VolumeEnableStereoPosition(EffectContext* pContext, uint32_t enabled) {
+ // ALOGV("\tVolumeEnableStereoPosition start()");
pContext->pBundledContext->bStereoPositionEnabled = enabled;
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeEnableStereoPosition")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tVolumeEnableStereoPosition Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tVolumeEnableStereoPosition to %d, position was %d\n",
+ // ALOGV("\tVolumeEnableStereoPosition Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tVolumeEnableStereoPosition to %d, position was %d\n",
// enabled, ActiveParams.VC_Balance );
/* Set appropriate stereo position */
- if(pContext->pBundledContext->bStereoPositionEnabled == LVM_FALSE){
+ if (pContext->pBundledContext->bStereoPositionEnabled == LVM_FALSE) {
ActiveParams.VC_Balance = 0;
- }else{
- ActiveParams.VC_Balance =
- VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
+ } else {
+ ActiveParams.VC_Balance =
+ VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved);
}
/* Activate the initial settings */
LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeEnableStereoPosition")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
- //ALOGV("\tVolumeEnableStereoPosition Succesfully called LVM_SetControlParameters\n");
- //ALOGV("\tVolumeEnableStereoPosition end()\n");
+ // ALOGV("\tVolumeEnableStereoPosition Successfully called LVM_SetControlParameters\n");
+ // ALOGV("\tVolumeEnableStereoPosition end()\n");
return 0;
-} /* end VolumeEnableStereoPosition */
+} /* end VolumeEnableStereoPosition */
//----------------------------------------------------------------------------
// BassBoost_getParameter()
@@ -1932,13 +1877,10 @@
//
//----------------------------------------------------------------------------
-int BassBoost_getParameter(EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue) {
+int BassBoost_getParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t* pValueSize, void* pValue) {
int status = 0;
- int32_t *params = (int32_t *)pParam;
+ int32_t* params = (int32_t*)pParam;
ALOGVV("%s start", __func__);
@@ -1949,28 +1891,27 @@
switch (params[0]) {
case BASSBOOST_PARAM_STRENGTH_SUPPORTED:
if (*pValueSize != sizeof(uint32_t)) { // legacy: check equality here.
- ALOGV("%s BASSBOOST_PARAM_STRENGTH_SUPPORTED invalid *pValueSize %u",
- __func__, *pValueSize);
+ ALOGV("%s BASSBOOST_PARAM_STRENGTH_SUPPORTED invalid *pValueSize %u", __func__,
+ *pValueSize);
status = -EINVAL;
break;
}
// no need to set *pValueSize
- *(uint32_t *)pValue = 1;
- ALOGVV("%s BASSBOOST_PARAM_STRENGTH_SUPPORTED %u", __func__, *(uint32_t *)pValue);
+ *(uint32_t*)pValue = 1;
+ ALOGVV("%s BASSBOOST_PARAM_STRENGTH_SUPPORTED %u", __func__, *(uint32_t*)pValue);
break;
case BASSBOOST_PARAM_STRENGTH:
if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
- ALOGV("%s BASSBOOST_PARAM_STRENGTH invalid *pValueSize %u",
- __func__, *pValueSize);
+ ALOGV("%s BASSBOOST_PARAM_STRENGTH invalid *pValueSize %u", __func__, *pValueSize);
status = -EINVAL;
break;
}
// no need to set *pValueSize
- *(int16_t *)pValue = BassGetStrength(pContext);
- ALOGVV("%s BASSBOOST_PARAM_STRENGTH %d", __func__, *(int16_t *)pValue);
+ *(int16_t*)pValue = BassGetStrength(pContext);
+ ALOGVV("%s BASSBOOST_PARAM_STRENGTH %d", __func__, *(int16_t*)pValue);
break;
default:
@@ -1998,13 +1939,10 @@
//
//----------------------------------------------------------------------------
-int BassBoost_setParameter(EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t valueSize,
- void *pValue) {
+int BassBoost_setParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t valueSize, void* pValue) {
int status = 0;
- int32_t *params = (int32_t *)pParam;
+ int32_t* params = (int32_t*)pParam;
ALOGVV("%s start", __func__);
@@ -2020,7 +1958,7 @@
break;
}
- const int16_t strength = *(int16_t *)pValue;
+ const int16_t strength = *(int16_t*)pValue;
ALOGVV("%s BASSBOOST_PARAM_STRENGTH %d", __func__, strength);
ALOGVV("%s BASSBOOST_PARAM_STRENGTH Calling BassSetStrength", __func__);
BassSetStrength(pContext, (int32_t)strength);
@@ -2058,13 +1996,10 @@
//
//----------------------------------------------------------------------------
-int Virtualizer_getParameter(EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue) {
+int Virtualizer_getParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t* pValueSize, void* pValue) {
int status = 0;
- int32_t *params = (int32_t *)pParam;
+ int32_t* params = (int32_t*)pParam;
ALOGVV("%s start", __func__);
@@ -2074,47 +2009,47 @@
}
switch (params[0]) {
case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED:
- if (*pValueSize != sizeof(uint32_t)) { // legacy: check equality here.
- ALOGV("%s VIRTUALIZER_PARAM_STRENGTH_SUPPORTED invalid *pValueSize %u",
- __func__, *pValueSize);
+ if (*pValueSize != sizeof(uint32_t)) { // legacy: check equality here.
+ ALOGV("%s VIRTUALIZER_PARAM_STRENGTH_SUPPORTED invalid *pValueSize %u", __func__,
+ *pValueSize);
status = -EINVAL;
break;
}
// no need to set *pValueSize
- *(uint32_t *)pValue = 1;
- ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH_SUPPORTED %d", __func__, *(uint32_t *)pValue);
+ *(uint32_t*)pValue = 1;
+ ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH_SUPPORTED %d", __func__, *(uint32_t*)pValue);
break;
case VIRTUALIZER_PARAM_STRENGTH:
- if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
- ALOGV("%s VIRTUALIZER_PARAM_STRENGTH invalid *pValueSize %u",
- __func__, *pValueSize);
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ ALOGV("%s VIRTUALIZER_PARAM_STRENGTH invalid *pValueSize %u", __func__,
+ *pValueSize);
status = -EINVAL;
break;
}
// no need to set *pValueSize
- *(int16_t *)pValue = VirtualizerGetStrength(pContext);
+ *(int16_t*)pValue = VirtualizerGetStrength(pContext);
- ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH %d", __func__, *(int16_t *)pValue);
+ ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH %d", __func__, *(int16_t*)pValue);
break;
case VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES: {
if (paramSize < 3 * sizeof(int32_t)) {
- ALOGV("%s VIRTUALIZER_PARAM_SPEAKER_ANGLES invalid paramSize: %u",
- __func__, paramSize);
+ ALOGV("%s VIRTUALIZER_PARAM_SPEAKER_ANGLES invalid paramSize: %u", __func__,
+ paramSize);
status = -EINVAL;
break;
}
- const audio_channel_mask_t channelMask = (audio_channel_mask_t) params[1];
- const audio_devices_t deviceType = (audio_devices_t) params[2];
+ const audio_channel_mask_t channelMask = (audio_channel_mask_t)params[1];
+ const audio_devices_t deviceType = (audio_devices_t)params[2];
const uint32_t nbChannels = audio_channel_count_from_out_mask(channelMask);
const uint32_t valueSizeRequired = 3 * nbChannels * sizeof(int32_t);
if (*pValueSize < valueSizeRequired) {
- ALOGV("%s VIRTUALIZER_PARAM_SPEAKER_ANGLES invalid *pValueSize %u",
- __func__, *pValueSize);
+ ALOGV("%s VIRTUALIZER_PARAM_SPEAKER_ANGLES invalid *pValueSize %u", __func__,
+ *pValueSize);
status = -EINVAL;
break;
}
@@ -2123,23 +2058,23 @@
// verify the configuration is supported
status = VirtualizerIsConfigurationSupported(channelMask, deviceType);
if (status == 0) {
- ALOGV("%s VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES mask=0x%x device=0x%x",
- __func__, channelMask, deviceType);
+ ALOGV("%s VIRTUALIZER_PARAM_VIRTUAL_SPEAKER_ANGLES mask=0x%x device=0x%x", __func__,
+ channelMask, deviceType);
// configuration is supported, get the angles
- VirtualizerGetSpeakerAngles(channelMask, deviceType, (int32_t *)pValue);
+ VirtualizerGetSpeakerAngles(channelMask, deviceType, (int32_t*)pValue);
}
} break;
case VIRTUALIZER_PARAM_VIRTUALIZATION_MODE:
- if (*pValueSize != sizeof(uint32_t)) { // legacy: check equality here.
- ALOGV("%s VIRTUALIZER_PARAM_VIRTUALIZATION_MODE invalid *pValueSize %u",
- __func__, *pValueSize);
+ if (*pValueSize != sizeof(uint32_t)) { // legacy: check equality here.
+ ALOGV("%s VIRTUALIZER_PARAM_VIRTUALIZATION_MODE invalid *pValueSize %u", __func__,
+ *pValueSize);
status = -EINVAL;
break;
}
// no need to set *pValueSize
- *(uint32_t *)pValue = (uint32_t) VirtualizerGetVirtualizationMode(pContext);
+ *(uint32_t*)pValue = (uint32_t)VirtualizerGetVirtualizationMode(pContext);
break;
default:
@@ -2167,17 +2102,14 @@
//
//----------------------------------------------------------------------------
-int Virtualizer_setParameter(EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t valueSize,
- void *pValue) {
+int Virtualizer_setParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t valueSize, void* pValue) {
int status = 0;
- int32_t *params = (int32_t *)pParam;
+ int32_t* params = (int32_t*)pParam;
ALOGVV("%s start", __func__);
- if (paramSize != sizeof(int32_t)) { // legacy: check equality here.
+ if (paramSize != sizeof(int32_t)) { // legacy: check equality here.
ALOGV("%s invalid paramSize: %u", __func__, paramSize);
return -EINVAL;
}
@@ -2189,7 +2121,7 @@
break;
}
- const int16_t strength = *(int16_t *)pValue;
+ const int16_t strength = *(int16_t*)pValue;
ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH %d", __func__, strength);
ALOGVV("%s VIRTUALIZER_PARAM_STRENGTH Calling VirtualizerSetStrength", __func__);
VirtualizerSetStrength(pContext, (int32_t)strength);
@@ -2199,16 +2131,16 @@
case VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE: {
if (valueSize < sizeof(int32_t)) {
ALOGV("%s VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE invalid valueSize: %u",
- __func__, valueSize);
+ __func__, valueSize);
android_errorWriteLog(0x534e4554, "64478003");
status = -EINVAL;
break;
}
- const audio_devices_t deviceType = (audio_devices_t)*(int32_t *)pValue;
+ const audio_devices_t deviceType = (audio_devices_t) * (int32_t*)pValue;
status = VirtualizerForceVirtualizationMode(pContext, deviceType);
- ALOGVV("%s VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE device=%#x result=%d",
- __func__, deviceType, status);
+ ALOGVV("%s VIRTUALIZER_PARAM_FORCE_VIRTUALIZATION_MODE device=%#x result=%d", __func__,
+ deviceType, status);
} break;
default:
@@ -2241,13 +2173,10 @@
// Side Effects:
//
//----------------------------------------------------------------------------
-int Equalizer_getParameter(EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue) {
+int Equalizer_getParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t* pValueSize, void* pValue) {
int status = 0;
- int32_t *params = (int32_t *)pParam;
+ int32_t* params = (int32_t*)pParam;
ALOGVV("%s start", __func__);
@@ -2256,211 +2185,210 @@
return -EINVAL;
}
switch (params[0]) {
- case EQ_PARAM_NUM_BANDS:
- if (*pValueSize < sizeof(uint16_t)) {
- ALOGV("%s EQ_PARAM_NUM_BANDS invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
- break;
- }
- *pValueSize = sizeof(uint16_t);
-
- *(uint16_t *)pValue = (uint16_t)FIVEBAND_NUMBANDS;
- ALOGVV("%s EQ_PARAM_NUM_BANDS %u", __func__, *(uint16_t *)pValue);
- break;
-
- case EQ_PARAM_CUR_PRESET:
- if (*pValueSize < sizeof(uint16_t)) {
- ALOGV("%s EQ_PARAM_CUR_PRESET invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
- break;
- }
- *pValueSize = sizeof(uint16_t);
-
- *(uint16_t *)pValue = (uint16_t)EqualizerGetPreset(pContext);
- ALOGVV("%s EQ_PARAM_CUR_PRESET %u", __func__, *(uint16_t *)pValue);
- break;
-
- case EQ_PARAM_GET_NUM_OF_PRESETS:
- if (*pValueSize < sizeof(uint16_t)) {
- ALOGV("%s EQ_PARAM_GET_NUM_OF_PRESETS invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
- break;
- }
- *pValueSize = sizeof(uint16_t);
-
- *(uint16_t *)pValue = (uint16_t)EqualizerGetNumPresets();
- ALOGVV("%s EQ_PARAM_GET_NUM_OF_PRESETS %u", __func__, *(uint16_t *)pValue);
- break;
-
- case EQ_PARAM_GET_BAND: {
- if (paramSize < 2 * sizeof(int32_t)) {
- ALOGV("%s EQ_PARAM_GET_BAND invalid paramSize: %u", __func__, paramSize);
- status = -EINVAL;
- break;
- }
- if (*pValueSize < sizeof(uint16_t)) {
- ALOGV("%s EQ_PARAM_GET_BAND invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
- break;
- }
- *pValueSize = sizeof(uint16_t);
-
- const int32_t frequency = params[1];
- *(uint16_t *)pValue = (uint16_t)EqualizerGetBand(pContext, frequency);
- ALOGVV("%s EQ_PARAM_GET_BAND frequency %d, band %u",
- __func__, frequency, *(uint16_t *)pValue);
- } break;
-
- case EQ_PARAM_BAND_LEVEL: {
- if (paramSize < 2 * sizeof(int32_t)) {
- ALOGV("%s EQ_PARAM_BAND_LEVEL invalid paramSize %u", __func__, paramSize);
- status = -EINVAL;
- break;
- }
- if (*pValueSize < sizeof(int16_t)) {
- ALOGV("%s EQ_PARAM_BAND_LEVEL invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
- break;
- }
- *pValueSize = sizeof(int16_t);
-
- const int32_t band = params[1];
- if (band < 0 || band >= FIVEBAND_NUMBANDS) {
- if (band < 0) {
- android_errorWriteLog(0x534e4554, "32438598");
- ALOGW("%s EQ_PARAM_BAND_LEVEL invalid band %d", __func__, band);
+ case EQ_PARAM_NUM_BANDS:
+ if (*pValueSize < sizeof(uint16_t)) {
+ ALOGV("%s EQ_PARAM_NUM_BANDS invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
}
- status = -EINVAL;
- break;
- }
- *(int16_t *)pValue = (int16_t)EqualizerGetBandLevel(pContext, band);
- ALOGVV("%s EQ_PARAM_BAND_LEVEL band %d, level %d",
- __func__, band, *(int16_t *)pValue);
- } break;
+ *pValueSize = sizeof(uint16_t);
- case EQ_PARAM_LEVEL_RANGE:
- if (*pValueSize < 2 * sizeof(int16_t)) {
- ALOGV("%s EQ_PARAM_LEVEL_RANGE invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
+ *(uint16_t*)pValue = (uint16_t)FIVEBAND_NUMBANDS;
+ ALOGVV("%s EQ_PARAM_NUM_BANDS %u", __func__, *(uint16_t*)pValue);
break;
- }
- *pValueSize = 2 * sizeof(int16_t);
- *(int16_t *)pValue = -1500;
- *((int16_t *)pValue + 1) = 1500;
- ALOGVV("%s EQ_PARAM_LEVEL_RANGE min %d, max %d",
- __func__, *(int16_t *)pValue, *((int16_t *)pValue + 1));
- break;
-
- case EQ_PARAM_BAND_FREQ_RANGE: {
- if (paramSize < 2 * sizeof(int32_t)) {
- ALOGV("%s EQ_PARAM_BAND_FREQ_RANGE invalid paramSize: %u", __func__, paramSize);
- status = -EINVAL;
- break;
- }
- if (*pValueSize < 2 * sizeof(int32_t)) {
- ALOGV("%s EQ_PARAM_BAND_FREQ_RANGE invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
- break;
- }
- *pValueSize = 2 * sizeof(int32_t);
-
- const int32_t band = params[1];
- if (band < 0 || band >= FIVEBAND_NUMBANDS) {
- if (band < 0) {
- android_errorWriteLog(0x534e4554, "32247948");
- ALOGW("%s EQ_PARAM_BAND_FREQ_RANGE invalid band %d",
- __func__, band);
+ case EQ_PARAM_CUR_PRESET:
+ if (*pValueSize < sizeof(uint16_t)) {
+ ALOGV("%s EQ_PARAM_CUR_PRESET invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
}
- status = -EINVAL;
- break;
- }
- EqualizerGetBandFreqRange(pContext, band, (uint32_t *)pValue, ((uint32_t *)pValue + 1));
- ALOGVV("%s EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d",
- __func__, band, *(int32_t *)pValue, *((int32_t *)pValue + 1));
+ *pValueSize = sizeof(uint16_t);
- } break;
-
- case EQ_PARAM_CENTER_FREQ: {
- if (paramSize < 2 * sizeof(int32_t)) {
- ALOGV("%s EQ_PARAM_CENTER_FREQ invalid paramSize: %u", __func__, paramSize);
- status = -EINVAL;
+ *(uint16_t*)pValue = (uint16_t)EqualizerGetPreset(pContext);
+ ALOGVV("%s EQ_PARAM_CUR_PRESET %u", __func__, *(uint16_t*)pValue);
break;
- }
- if (*pValueSize < sizeof(int32_t)) {
- ALOGV("%s EQ_PARAM_CENTER_FREQ invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
- break;
- }
- *pValueSize = sizeof(int32_t);
- const int32_t band = params[1];
- if (band < 0 || band >= FIVEBAND_NUMBANDS) {
- status = -EINVAL;
- if (band < 0) {
- android_errorWriteLog(0x534e4554, "32436341");
- ALOGW("%s EQ_PARAM_CENTER_FREQ invalid band %d", __func__, band);
+ case EQ_PARAM_GET_NUM_OF_PRESETS:
+ if (*pValueSize < sizeof(uint16_t)) {
+ ALOGV("%s EQ_PARAM_GET_NUM_OF_PRESETS invalid *pValueSize %u", __func__,
+ *pValueSize);
+ status = -EINVAL;
+ break;
}
- break;
- }
- *(int32_t *)pValue = EqualizerGetCentreFrequency(pContext, band);
- ALOGVV("%s EQ_PARAM_CENTER_FREQ band %d, frequency %d",
- __func__, band, *(int32_t *)pValue);
- } break;
+ *pValueSize = sizeof(uint16_t);
- case EQ_PARAM_GET_PRESET_NAME: {
- if (paramSize < 2 * sizeof(int32_t)) {
- ALOGV("%s EQ_PARAM_PRESET_NAME invalid paramSize: %u", __func__, paramSize);
- status = -EINVAL;
+ *(uint16_t*)pValue = (uint16_t)EqualizerGetNumPresets();
+ ALOGVV("%s EQ_PARAM_GET_NUM_OF_PRESETS %u", __func__, *(uint16_t*)pValue);
break;
- }
- if (*pValueSize < 1) {
- android_errorWriteLog(0x534e4554, "37536407");
- status = -EINVAL;
- break;
- }
- const int32_t preset = params[1];
- if ((preset < 0 && preset != PRESET_CUSTOM) || preset >= EqualizerGetNumPresets()) {
- if (preset < 0) {
- android_errorWriteLog(0x534e4554, "32448258");
- ALOGE("%s EQ_PARAM_GET_PRESET_NAME preset %d", __func__, preset);
+ case EQ_PARAM_GET_BAND: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_GET_BAND invalid paramSize: %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
}
+ if (*pValueSize < sizeof(uint16_t)) {
+ ALOGV("%s EQ_PARAM_GET_BAND invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(uint16_t);
+
+ const int32_t frequency = params[1];
+ *(uint16_t*)pValue = (uint16_t)EqualizerGetBand(pContext, frequency);
+ ALOGVV("%s EQ_PARAM_GET_BAND frequency %d, band %u", __func__, frequency,
+ *(uint16_t*)pValue);
+ } break;
+
+ case EQ_PARAM_BAND_LEVEL: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_BAND_LEVEL invalid paramSize %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
+ if (*pValueSize < sizeof(int16_t)) {
+ ALOGV("%s EQ_PARAM_BAND_LEVEL invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(int16_t);
+
+ const int32_t band = params[1];
+ if (band < 0 || band >= FIVEBAND_NUMBANDS) {
+ if (band < 0) {
+ android_errorWriteLog(0x534e4554, "32438598");
+ ALOGW("%s EQ_PARAM_BAND_LEVEL invalid band %d", __func__, band);
+ }
+ status = -EINVAL;
+ break;
+ }
+ *(int16_t*)pValue = (int16_t)EqualizerGetBandLevel(pContext, band);
+ ALOGVV("%s EQ_PARAM_BAND_LEVEL band %d, level %d", __func__, band, *(int16_t*)pValue);
+ } break;
+
+ case EQ_PARAM_LEVEL_RANGE:
+ if (*pValueSize < 2 * sizeof(int16_t)) {
+ ALOGV("%s EQ_PARAM_LEVEL_RANGE invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = 2 * sizeof(int16_t);
+
+ *(int16_t*)pValue = -1500;
+ *((int16_t*)pValue + 1) = 1500;
+ ALOGVV("%s EQ_PARAM_LEVEL_RANGE min %d, max %d", __func__, *(int16_t*)pValue,
+ *((int16_t*)pValue + 1));
+ break;
+
+ case EQ_PARAM_BAND_FREQ_RANGE: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_BAND_FREQ_RANGE invalid paramSize: %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
+ if (*pValueSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_BAND_FREQ_RANGE invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = 2 * sizeof(int32_t);
+
+ const int32_t band = params[1];
+ if (band < 0 || band >= FIVEBAND_NUMBANDS) {
+ if (band < 0) {
+ android_errorWriteLog(0x534e4554, "32247948");
+ ALOGW("%s EQ_PARAM_BAND_FREQ_RANGE invalid band %d", __func__, band);
+ }
+ status = -EINVAL;
+ break;
+ }
+ EqualizerGetBandFreqRange(pContext, band, (uint32_t*)pValue, ((uint32_t*)pValue + 1));
+ ALOGVV("%s EQ_PARAM_BAND_FREQ_RANGE band %d, min %d, max %d", __func__, band,
+ *(int32_t*)pValue, *((int32_t*)pValue + 1));
+
+ } break;
+
+ case EQ_PARAM_CENTER_FREQ: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_CENTER_FREQ invalid paramSize: %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
+ if (*pValueSize < sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_CENTER_FREQ invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = sizeof(int32_t);
+
+ const int32_t band = params[1];
+ if (band < 0 || band >= FIVEBAND_NUMBANDS) {
+ status = -EINVAL;
+ if (band < 0) {
+ android_errorWriteLog(0x534e4554, "32436341");
+ ALOGW("%s EQ_PARAM_CENTER_FREQ invalid band %d", __func__, band);
+ }
+ break;
+ }
+ *(int32_t*)pValue = EqualizerGetCentreFrequency(pContext, band);
+ ALOGVV("%s EQ_PARAM_CENTER_FREQ band %d, frequency %d", __func__, band,
+ *(int32_t*)pValue);
+ } break;
+
+ case EQ_PARAM_GET_PRESET_NAME: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_PRESET_NAME invalid paramSize: %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
+ if (*pValueSize < 1) {
+ android_errorWriteLog(0x534e4554, "37536407");
+ status = -EINVAL;
+ break;
+ }
+
+ const int32_t preset = params[1];
+ if ((preset < 0 && preset != PRESET_CUSTOM) || preset >= EqualizerGetNumPresets()) {
+ if (preset < 0) {
+ android_errorWriteLog(0x534e4554, "32448258");
+ ALOGE("%s EQ_PARAM_GET_PRESET_NAME preset %d", __func__, preset);
+ }
+ status = -EINVAL;
+ break;
+ }
+
+ char* const name = (char*)pValue;
+ strncpy(name, EqualizerGetPresetName(preset), *pValueSize - 1);
+ name[*pValueSize - 1] = 0;
+ *pValueSize = strlen(name) + 1;
+ ALOGVV("%s EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d", __func__, preset, name,
+ *pValueSize);
+
+ } break;
+
+ case EQ_PARAM_PROPERTIES: {
+ constexpr uint32_t requiredValueSize = (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t);
+ if (*pValueSize < requiredValueSize) {
+ ALOGV("%s EQ_PARAM_PROPERTIES invalid *pValueSize %u", __func__, *pValueSize);
+ status = -EINVAL;
+ break;
+ }
+ *pValueSize = requiredValueSize;
+
+ int16_t* p = (int16_t*)pValue;
+ ALOGV("%s EQ_PARAM_PROPERTIES", __func__);
+ p[0] = (int16_t)EqualizerGetPreset(pContext);
+ p[1] = (int16_t)FIVEBAND_NUMBANDS;
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
+ p[2 + i] = (int16_t)EqualizerGetBandLevel(pContext, i);
+ }
+ } break;
+
+ default:
+ ALOGV("%s invalid param %d", __func__, params[0]);
status = -EINVAL;
break;
- }
-
- char * const name = (char *)pValue;
- strncpy(name, EqualizerGetPresetName(preset), *pValueSize - 1);
- name[*pValueSize - 1] = 0;
- *pValueSize = strlen(name) + 1;
- ALOGVV("%s EQ_PARAM_GET_PRESET_NAME preset %d, name %s len %d",
- __func__, preset, name, *pValueSize);
-
- } break;
-
- case EQ_PARAM_PROPERTIES: {
- constexpr uint32_t requiredValueSize = (2 + FIVEBAND_NUMBANDS) * sizeof(uint16_t);
- if (*pValueSize < requiredValueSize) {
- ALOGV("%s EQ_PARAM_PROPERTIES invalid *pValueSize %u", __func__, *pValueSize);
- status = -EINVAL;
- break;
- }
- *pValueSize = requiredValueSize;
-
- int16_t *p = (int16_t *)pValue;
- ALOGV("%s EQ_PARAM_PROPERTIES", __func__);
- p[0] = (int16_t)EqualizerGetPreset(pContext);
- p[1] = (int16_t)FIVEBAND_NUMBANDS;
- for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- p[2 + i] = (int16_t)EqualizerGetBandLevel(pContext, i);
- }
- } break;
-
- default:
- ALOGV("%s invalid param %d", __func__, params[0]);
- status = -EINVAL;
- break;
}
ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
@@ -2483,13 +2411,10 @@
// Outputs:
//
//----------------------------------------------------------------------------
-int Equalizer_setParameter(EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t valueSize,
- void *pValue) {
+int Equalizer_setParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t valueSize, void* pValue) {
int status = 0;
- int32_t *params = (int32_t *)pParam;
+ int32_t* params = (int32_t*)pParam;
ALOGVV("%s start", __func__);
@@ -2498,87 +2423,87 @@
return -EINVAL;
}
switch (params[0]) {
- case EQ_PARAM_CUR_PRESET: {
- if (valueSize < sizeof(int16_t)) {
- ALOGV("%s EQ_PARAM_CUR_PRESET invalid valueSize %u", __func__, valueSize);
- status = -EINVAL;
- break;
- }
- const int32_t preset = (int32_t)*(uint16_t *)pValue;
-
- ALOGVV("%s EQ_PARAM_CUR_PRESET %d", __func__, preset);
- if (preset >= EqualizerGetNumPresets() || preset < 0) {
- ALOGV("%s EQ_PARAM_CUR_PRESET invalid preset %d", __func__, preset);
- status = -EINVAL;
- break;
- }
- EqualizerSetPreset(pContext, preset);
- } break;
-
- case EQ_PARAM_BAND_LEVEL: {
- if (paramSize < 2 * sizeof(int32_t)) {
- ALOGV("%s EQ_PARAM_BAND_LEVEL invalid paramSize: %u", __func__, paramSize);
- status = -EINVAL;
- break;
- }
- if (valueSize < sizeof(int16_t)) {
- ALOGV("%s EQ_PARAM_BAND_LEVEL invalid valueSize %u", __func__, valueSize);
- status = -EINVAL;
- break;
- }
- const int32_t band = params[1];
- const int32_t level = (int32_t)*(int16_t *)pValue;
- ALOGVV("%s EQ_PARAM_BAND_LEVEL band %d, level %d", __func__, band, level);
- if (band < 0 || band >= FIVEBAND_NUMBANDS) {
- if (band < 0) {
- android_errorWriteLog(0x534e4554, "32095626");
- ALOGE("%s EQ_PARAM_BAND_LEVEL invalid band %d", __func__, band);
- }
- status = -EINVAL;
- break;
- }
- EqualizerSetBandLevel(pContext, band, level);
- } break;
-
- case EQ_PARAM_PROPERTIES: {
- ALOGVV("%s EQ_PARAM_PROPERTIES", __func__);
- if (valueSize < sizeof(int16_t)) {
- ALOGV("%s EQ_PARAM_PROPERTIES invalid valueSize %u", __func__, valueSize);
- status = -EINVAL;
- break;
- }
- int16_t *p = (int16_t *)pValue;
- if ((int)p[0] >= EqualizerGetNumPresets()) {
- ALOGV("%s EQ_PARAM_PROPERTIES invalid preset %d", __func__, (int)p[0]);
- status = -EINVAL;
- break;
- }
- if (p[0] >= 0) {
- EqualizerSetPreset(pContext, (int)p[0]);
- } else {
- constexpr uint32_t valueSizeRequired = (2 + FIVEBAND_NUMBANDS) * sizeof(int16_t);
- if (valueSize < valueSizeRequired) {
- android_errorWriteLog(0x534e4554, "37563371");
- ALOGE("%s EQ_PARAM_PROPERTIES invalid valueSize %u < %u",
- __func__, valueSize, valueSizeRequired);
- status = -EINVAL;
- break;
- }
- if ((int)p[1] != FIVEBAND_NUMBANDS) {
- ALOGV("%s EQ_PARAM_PROPERTIES invalid bands %d", __func__, (int)p[1]);
+ case EQ_PARAM_CUR_PRESET: {
+ if (valueSize < sizeof(int16_t)) {
+ ALOGV("%s EQ_PARAM_CUR_PRESET invalid valueSize %u", __func__, valueSize);
status = -EINVAL;
break;
}
- for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
- EqualizerSetBandLevel(pContext, i, (int)p[2 + i]);
- }
- }
- } break;
+ const int32_t preset = (int32_t) * (uint16_t*)pValue;
- default:
- ALOGV("%s invalid param %d", __func__, params[0]);
- status = -EINVAL;
- break;
+ ALOGVV("%s EQ_PARAM_CUR_PRESET %d", __func__, preset);
+ if (preset >= EqualizerGetNumPresets() || preset < 0) {
+ ALOGV("%s EQ_PARAM_CUR_PRESET invalid preset %d", __func__, preset);
+ status = -EINVAL;
+ break;
+ }
+ EqualizerSetPreset(pContext, preset);
+ } break;
+
+ case EQ_PARAM_BAND_LEVEL: {
+ if (paramSize < 2 * sizeof(int32_t)) {
+ ALOGV("%s EQ_PARAM_BAND_LEVEL invalid paramSize: %u", __func__, paramSize);
+ status = -EINVAL;
+ break;
+ }
+ if (valueSize < sizeof(int16_t)) {
+ ALOGV("%s EQ_PARAM_BAND_LEVEL invalid valueSize %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
+ }
+ const int32_t band = params[1];
+ const int32_t level = (int32_t) * (int16_t*)pValue;
+ ALOGVV("%s EQ_PARAM_BAND_LEVEL band %d, level %d", __func__, band, level);
+ if (band < 0 || band >= FIVEBAND_NUMBANDS) {
+ if (band < 0) {
+ android_errorWriteLog(0x534e4554, "32095626");
+ ALOGE("%s EQ_PARAM_BAND_LEVEL invalid band %d", __func__, band);
+ }
+ status = -EINVAL;
+ break;
+ }
+ EqualizerSetBandLevel(pContext, band, level);
+ } break;
+
+ case EQ_PARAM_PROPERTIES: {
+ ALOGVV("%s EQ_PARAM_PROPERTIES", __func__);
+ if (valueSize < sizeof(int16_t)) {
+ ALOGV("%s EQ_PARAM_PROPERTIES invalid valueSize %u", __func__, valueSize);
+ status = -EINVAL;
+ break;
+ }
+ int16_t* p = (int16_t*)pValue;
+ if ((int)p[0] >= EqualizerGetNumPresets()) {
+ ALOGV("%s EQ_PARAM_PROPERTIES invalid preset %d", __func__, (int)p[0]);
+ status = -EINVAL;
+ break;
+ }
+ if (p[0] >= 0) {
+ EqualizerSetPreset(pContext, (int)p[0]);
+ } else {
+ constexpr uint32_t valueSizeRequired = (2 + FIVEBAND_NUMBANDS) * sizeof(int16_t);
+ if (valueSize < valueSizeRequired) {
+ android_errorWriteLog(0x534e4554, "37563371");
+ ALOGE("%s EQ_PARAM_PROPERTIES invalid valueSize %u < %u", __func__, valueSize,
+ valueSizeRequired);
+ status = -EINVAL;
+ break;
+ }
+ if ((int)p[1] != FIVEBAND_NUMBANDS) {
+ ALOGV("%s EQ_PARAM_PROPERTIES invalid bands %d", __func__, (int)p[1]);
+ status = -EINVAL;
+ break;
+ }
+ for (int i = 0; i < FIVEBAND_NUMBANDS; i++) {
+ EqualizerSetBandLevel(pContext, i, (int)p[2 + i]);
+ }
+ }
+ } break;
+
+ default:
+ ALOGV("%s invalid param %d", __func__, params[0]);
+ status = -EINVAL;
+ break;
}
ALOGVV("%s end param: %d, status: %d", __func__, params[0], status);
@@ -2606,13 +2531,10 @@
//
//----------------------------------------------------------------------------
-int Volume_getParameter(EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue) {
+int Volume_getParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t* pValueSize, void* pValue) {
int status = 0;
- int32_t *params = (int32_t *)pParam;
+ int32_t* params = (int32_t*)pParam;
ALOGVV("%s start", __func__);
@@ -2622,19 +2544,19 @@
}
switch (params[0]) {
case VOLUME_PARAM_LEVEL:
- if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
ALOGV("%s VOLUME_PARAM_LEVEL invalid *pValueSize %u", __func__, *pValueSize);
status = -EINVAL;
break;
}
// no need to set *pValueSize
- status = VolumeGetVolumeLevel(pContext, (int16_t *)(pValue));
- ALOGVV("%s VOLUME_PARAM_LEVEL %d", __func__, *(int16_t *)pValue);
+ status = VolumeGetVolumeLevel(pContext, (int16_t*)(pValue));
+ ALOGVV("%s VOLUME_PARAM_LEVEL %d", __func__, *(int16_t*)pValue);
break;
case VOLUME_PARAM_MAXLEVEL:
- if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
ALOGV("%s VOLUME_PARAM_MAXLEVEL invalid *pValueSize %u", __func__, *pValueSize);
status = -EINVAL;
break;
@@ -2642,21 +2564,21 @@
// no need to set *pValueSize
// in millibel
- *(int16_t *)pValue = 0;
- ALOGVV("%s VOLUME_PARAM_MAXLEVEL %d", __func__, *(int16_t *)pValue);
+ *(int16_t*)pValue = 0;
+ ALOGVV("%s VOLUME_PARAM_MAXLEVEL %d", __func__, *(int16_t*)pValue);
break;
case VOLUME_PARAM_STEREOPOSITION:
- if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
- ALOGV("%s VOLUME_PARAM_STEREOPOSITION invalid *pValueSize %u",
- __func__, *pValueSize);
+ if (*pValueSize != sizeof(int16_t)) { // legacy: check equality here.
+ ALOGV("%s VOLUME_PARAM_STEREOPOSITION invalid *pValueSize %u", __func__,
+ *pValueSize);
status = -EINVAL;
break;
}
// no need to set *pValueSize
- VolumeGetStereoPosition(pContext, (int16_t *)pValue);
- ALOGVV("%s VOLUME_PARAM_STEREOPOSITION %d", __func__, *(int16_t *)pValue);
+ VolumeGetStereoPosition(pContext, (int16_t*)pValue);
+ ALOGVV("%s VOLUME_PARAM_STEREOPOSITION %d", __func__, *(int16_t*)pValue);
break;
case VOLUME_PARAM_MUTE:
@@ -2667,21 +2589,21 @@
}
*pValueSize = sizeof(uint32_t);
- status = VolumeGetMute(pContext, (uint32_t *)pValue);
- ALOGV("%s VOLUME_PARAM_MUTE %u", __func__, *(uint32_t *)pValue);
+ status = VolumeGetMute(pContext, (uint32_t*)pValue);
+ ALOGV("%s VOLUME_PARAM_MUTE %u", __func__, *(uint32_t*)pValue);
break;
case VOLUME_PARAM_ENABLESTEREOPOSITION:
if (*pValueSize < sizeof(int32_t)) {
- ALOGV("%s VOLUME_PARAM_ENABLESTEREOPOSITION invalid *pValueSize %u",
- __func__, *pValueSize);
+ ALOGV("%s VOLUME_PARAM_ENABLESTEREOPOSITION invalid *pValueSize %u", __func__,
+ *pValueSize);
status = -EINVAL;
break;
}
*pValueSize = sizeof(int32_t);
- *(int32_t *)pValue = pContext->pBundledContext->bStereoPositionEnabled;
- ALOGVV("%s VOLUME_PARAM_ENABLESTEREOPOSITION %d", __func__, *(int32_t *)pValue);
+ *(int32_t*)pValue = pContext->pBundledContext->bStereoPositionEnabled;
+ ALOGVV("%s VOLUME_PARAM_ENABLESTEREOPOSITION %d", __func__, *(int32_t*)pValue);
break;
@@ -2710,13 +2632,10 @@
//
//----------------------------------------------------------------------------
-int Volume_setParameter(EffectContext *pContext,
- uint32_t paramSize,
- void *pParam,
- uint32_t valueSize,
- void *pValue) {
+int Volume_setParameter(EffectContext* pContext, uint32_t paramSize, void* pParam,
+ uint32_t valueSize, void* pValue) {
int status = 0;
- int32_t *params = (int32_t *)pParam;
+ int32_t* params = (int32_t*)pParam;
ALOGVV("%s start", __func__);
@@ -2732,7 +2651,7 @@
break;
}
- const int16_t level = *(int16_t *)pValue;
+ const int16_t level = *(int16_t*)pValue;
ALOGVV("%s VOLUME_PARAM_LEVEL %d", __func__, level);
ALOGVV("%s VOLUME_PARAM_LEVEL Calling VolumeSetVolumeLevel", __func__);
status = VolumeSetVolumeLevel(pContext, level);
@@ -2747,7 +2666,7 @@
break;
}
- const uint32_t mute = *(uint32_t *)pValue;
+ const uint32_t mute = *(uint32_t*)pValue;
ALOGVV("%s VOLUME_PARAM_MUTE %d", __func__, mute);
ALOGVV("%s VOLUME_PARAM_MUTE Calling VolumeSetMute", __func__);
status = VolumeSetMute(pContext, mute);
@@ -2756,15 +2675,16 @@
case VOLUME_PARAM_ENABLESTEREOPOSITION: {
if (valueSize < sizeof(uint32_t)) {
- ALOGV("%s VOLUME_PARAM_ENABLESTEREOPOSITION invalid valueSize %u",
- __func__, valueSize);
+ ALOGV("%s VOLUME_PARAM_ENABLESTEREOPOSITION invalid valueSize %u", __func__,
+ valueSize);
status = -EINVAL;
break;
}
- const uint32_t positionEnabled = *(uint32_t *)pValue;
+ const uint32_t positionEnabled = *(uint32_t*)pValue;
status = VolumeEnableStereoPosition(pContext, positionEnabled)
- ?: VolumeSetStereoPosition(pContext, pContext->pBundledContext->positionSaved);
+ ?: VolumeSetStereoPosition(pContext,
+ pContext->pBundledContext->positionSaved);
ALOGVV("%s VOLUME_PARAM_ENABLESTEREOPOSITION called", __func__);
} break;
@@ -2775,13 +2695,11 @@
break;
}
- const int16_t position = *(int16_t *)pValue;
+ const int16_t position = *(int16_t*)pValue;
ALOGVV("%s VOLUME_PARAM_STEREOPOSITION %d", __func__, position);
- ALOGVV("%s VOLUME_PARAM_STEREOPOSITION Calling VolumeSetStereoPosition",
- __func__);
+ ALOGVV("%s VOLUME_PARAM_STEREOPOSITION Calling VolumeSetStereoPosition", __func__);
status = VolumeSetStereoPosition(pContext, position);
- ALOGVV("%s VOLUME_PARAM_STEREOPOSITION Called VolumeSetStereoPosition",
- __func__);
+ ALOGVV("%s VOLUME_PARAM_STEREOPOSITION Called VolumeSetStereoPosition", __func__);
} break;
default:
@@ -2806,18 +2724,15 @@
* Remarks :
****************************************************************************************/
-LVM_INT16 LVC_ToDB_s32Tos16(LVM_INT32 Lin_fix)
-{
- LVM_INT16 db_fix;
- LVM_INT16 Shift;
- LVM_INT16 SmallRemainder;
- LVM_UINT32 Remainder = (LVM_UINT32)Lin_fix;
+LVM_INT16 LVC_ToDB_s32Tos16(LVM_INT32 Lin_fix) {
+ LVM_INT16 db_fix;
+ LVM_INT16 Shift;
+ LVM_INT16 SmallRemainder;
+ LVM_UINT32 Remainder = (LVM_UINT32)Lin_fix;
/* Count leading bits, 1 cycle in assembly*/
- for (Shift = 0; Shift<32; Shift++)
- {
- if ((Remainder & 0x80000000U)!=0)
- {
+ for (Shift = 0; Shift < 32; Shift++) {
+ if ((Remainder & 0x80000000U) != 0) {
break;
}
Remainder = Remainder << 1;
@@ -2828,9 +2743,9 @@
*
* dB = -96 * Shift + 16 * (8 * Remainder - 2 * Remainder^2)
*/
- db_fix = (LVM_INT16)(-96 * Shift); /* Six dB steps in Q11.4 format*/
+ db_fix = (LVM_INT16)(-96 * Shift); /* Six dB steps in Q11.4 format*/
SmallRemainder = (LVM_INT16)((Remainder & 0x7fffffff) >> 24);
- db_fix = (LVM_INT16)(db_fix + SmallRemainder );
+ db_fix = (LVM_INT16)(db_fix + SmallRemainder);
SmallRemainder = (LVM_INT16)(SmallRemainder * SmallRemainder);
db_fix = (LVM_INT16)(db_fix - (LVM_INT16)((LVM_UINT16)SmallRemainder >> 9));
@@ -2854,11 +2769,10 @@
//
//----------------------------------------------------------------------------
-int Effect_setEnabled(EffectContext *pContext, bool enabled)
-{
- ALOGV("%s effectType %d, enabled %d, currently enabled %d", __func__,
- pContext->EffectType, enabled, pContext->pBundledContext->NumberEffectsEnabled);
- int &effectInDrain = pContext->pBundledContext->effectInDrain;
+int Effect_setEnabled(EffectContext* pContext, bool enabled) {
+ ALOGV("%s effectType %d, enabled %d, currently enabled %d", __func__, pContext->EffectType,
+ enabled, pContext->pBundledContext->NumberEffectsEnabled);
+ int& effectInDrain = pContext->pBundledContext->effectInDrain;
if (enabled) {
// Bass boost or Virtualizer can be temporarily disabled if playing over device speaker due
// to their nature.
@@ -2866,15 +2780,15 @@
switch (pContext->EffectType) {
case LVM_BASS_BOOST:
if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
- ALOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already enabled");
- return -EINVAL;
+ ALOGV("\tEffect_setEnabled() LVM_BASS_BOOST is already enabled");
+ return -EINVAL;
}
- if(pContext->pBundledContext->SamplesToExitCountBb <= 0){
+ if (pContext->pBundledContext->SamplesToExitCountBb <= 0) {
pContext->pBundledContext->NumberEffectsEnabled++;
}
effectInDrain &= ~(1 << LVM_BASS_BOOST);
pContext->pBundledContext->SamplesToExitCountBb =
- (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
+ (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond * 0.1);
pContext->pBundledContext->bBassEnabled = LVM_TRUE;
tempDisabled = pContext->pBundledContext->bBassTempDisabled;
break;
@@ -2883,12 +2797,12 @@
ALOGV("\tEffect_setEnabled() LVM_EQUALIZER is already enabled");
return -EINVAL;
}
- if(pContext->pBundledContext->SamplesToExitCountEq <= 0){
+ if (pContext->pBundledContext->SamplesToExitCountEq <= 0) {
pContext->pBundledContext->NumberEffectsEnabled++;
}
effectInDrain &= ~(1 << LVM_EQUALIZER);
pContext->pBundledContext->SamplesToExitCountEq =
- (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
+ (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond * 0.1);
pContext->pBundledContext->bEqualizerEnabled = LVM_TRUE;
break;
case LVM_VIRTUALIZER:
@@ -2896,12 +2810,12 @@
ALOGV("\tEffect_setEnabled() LVM_VIRTUALIZER is already enabled");
return -EINVAL;
}
- if(pContext->pBundledContext->SamplesToExitCountVirt <= 0){
+ if (pContext->pBundledContext->SamplesToExitCountVirt <= 0) {
pContext->pBundledContext->NumberEffectsEnabled++;
}
effectInDrain &= ~(1 << LVM_VIRTUALIZER);
pContext->pBundledContext->SamplesToExitCountVirt =
- (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond*0.1);
+ (LVM_INT32)(pContext->pBundledContext->SamplesPerSecond * 0.1);
pContext->pBundledContext->bVirtualizerEnabled = LVM_TRUE;
tempDisabled = pContext->pBundledContext->bVirtualizerTempDisabled;
break;
@@ -2978,41 +2892,39 @@
//
//-----------------------------------------------------------------------
-int16_t LVC_Convert_VolToDb(uint32_t vol){
- int16_t dB;
+int16_t LVC_Convert_VolToDb(uint32_t vol) {
+ int16_t dB;
- dB = LVC_ToDB_s32Tos16(vol <<7);
- dB = (dB +8)>>4;
- dB = (dB <-96) ? -96 : dB ;
+ dB = LVC_ToDB_s32Tos16(vol << 7);
+ dB = (dB + 8) >> 4;
+ dB = (dB < -96) ? -96 : dB;
return dB;
}
-} // namespace
-} // namespace
+} // namespace
+} // namespace android
extern "C" {
/* Effect Control Interface Implementation: Process */
-int Effect_process(effect_handle_t self,
- audio_buffer_t *inBuffer,
- audio_buffer_t *outBuffer){
- EffectContext * pContext = (EffectContext *) self;
- int status = 0;
- int processStatus = 0;
+int Effect_process(effect_handle_t self, audio_buffer_t* inBuffer, audio_buffer_t* outBuffer) {
+ EffectContext* pContext = (EffectContext*)self;
+ int status = 0;
+ int processStatus = 0;
const int NrChannels = audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
-//ALOGV("\tEffect_process Start : Enabled = %d Called = %d (%8d %8d %8d)",
-//pContext->pBundledContext->NumberEffectsEnabled,pContext->pBundledContext->NumberEffectsCalled,
-// pContext->pBundledContext->SamplesToExitCountBb,
-// pContext->pBundledContext->SamplesToExitCountVirt,
-// pContext->pBundledContext->SamplesToExitCountEq);
+ // ALOGV("\tEffect_process Start : Enabled = %d Called = %d (%8d %8d %8d)",
+ // pContext->pBundledContext->NumberEffectsEnabled,pContext->pBundledContext->NumberEffectsCalled,
+ // pContext->pBundledContext->SamplesToExitCountBb,
+ // pContext->pBundledContext->SamplesToExitCountVirt,
+ // pContext->pBundledContext->SamplesToExitCountEq);
- if (pContext == NULL){
+ if (pContext == NULL) {
ALOGV("\tLVM_ERROR : Effect_process() ERROR pContext == NULL");
return -EINVAL;
}
- //if(pContext->EffectType == LVM_BASS_BOOST){
+ // if(pContext->EffectType == LVM_BASS_BOOST){
// ALOGV("\tEffect_process: Effect type is BASS_BOOST");
//}else if(pContext->EffectType == LVM_EQUALIZER){
// ALOGV("\tEffect_process: Effect type is LVM_EQUALIZER");
@@ -3020,15 +2932,14 @@
// ALOGV("\tEffect_process: Effect type is LVM_VIRTUALIZER");
//}
- if (inBuffer == NULL || inBuffer->raw == NULL ||
- outBuffer == NULL || outBuffer->raw == NULL ||
- inBuffer->frameCount != outBuffer->frameCount){
+ if (inBuffer == NULL || inBuffer->raw == NULL || outBuffer == NULL || outBuffer->raw == NULL ||
+ inBuffer->frameCount != outBuffer->frameCount) {
ALOGV("\tLVM_ERROR : Effect_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
return -EINVAL;
}
- int &effectProcessCalled = pContext->pBundledContext->effectProcessCalled;
- int &effectInDrain = pContext->pBundledContext->effectInDrain;
+ int& effectProcessCalled = pContext->pBundledContext->effectProcessCalled;
+ int& effectInDrain = pContext->pBundledContext->effectInDrain;
if ((effectProcessCalled & 1 << pContext->EffectType) != 0) {
ALOGW("Effect %d already called", pContext->EffectType);
const int undrainedEffects = effectInDrain & ~effectProcessCalled;
@@ -3058,12 +2969,12 @@
}
effectProcessCalled |= 1 << pContext->EffectType;
- if ((pContext->pBundledContext->bBassEnabled == LVM_FALSE)&&
- (pContext->EffectType == LVM_BASS_BOOST)){
- //ALOGV("\tEffect_process() LVM_BASS_BOOST Effect is not enabled");
- if(pContext->pBundledContext->SamplesToExitCountBb > 0){
+ if ((pContext->pBundledContext->bBassEnabled == LVM_FALSE) &&
+ (pContext->EffectType == LVM_BASS_BOOST)) {
+ // ALOGV("\tEffect_process() LVM_BASS_BOOST Effect is not enabled");
+ if (pContext->pBundledContext->SamplesToExitCountBb > 0) {
pContext->pBundledContext->SamplesToExitCountBb -= outBuffer->frameCount * NrChannels;
- //ALOGV("\tEffect_process: Waiting to turn off BASS_BOOST, %d samples left",
+ // ALOGV("\tEffect_process: Waiting to turn off BASS_BOOST, %d samples left",
// pContext->pBundledContext->SamplesToExitCountBb);
}
if (pContext->pBundledContext->SamplesToExitCountBb <= 0) {
@@ -3075,21 +2986,21 @@
ALOGV("\tEffect_process() this is the last frame for LVM_BASS_BOOST");
}
}
- if ((pContext->pBundledContext->bVolumeEnabled == LVM_FALSE)&&
- (pContext->EffectType == LVM_VOLUME)){
- //ALOGV("\tEffect_process() LVM_VOLUME Effect is not enabled");
+ if ((pContext->pBundledContext->bVolumeEnabled == LVM_FALSE) &&
+ (pContext->EffectType == LVM_VOLUME)) {
+ // ALOGV("\tEffect_process() LVM_VOLUME Effect is not enabled");
status = -ENODATA;
if ((effectInDrain & 1 << LVM_VOLUME) != 0) {
pContext->pBundledContext->NumberEffectsEnabled--;
effectInDrain &= ~(1 << LVM_VOLUME);
}
}
- if ((pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE)&&
- (pContext->EffectType == LVM_EQUALIZER)){
- //ALOGV("\tEffect_process() LVM_EQUALIZER Effect is not enabled");
- if(pContext->pBundledContext->SamplesToExitCountEq > 0){
+ if ((pContext->pBundledContext->bEqualizerEnabled == LVM_FALSE) &&
+ (pContext->EffectType == LVM_EQUALIZER)) {
+ // ALOGV("\tEffect_process() LVM_EQUALIZER Effect is not enabled");
+ if (pContext->pBundledContext->SamplesToExitCountEq > 0) {
pContext->pBundledContext->SamplesToExitCountEq -= outBuffer->frameCount * NrChannels;
- //ALOGV("\tEffect_process: Waiting to turn off EQUALIZER, %d samples left",
+ // ALOGV("\tEffect_process: Waiting to turn off EQUALIZER, %d samples left",
// pContext->pBundledContext->SamplesToExitCountEq);
}
if (pContext->pBundledContext->SamplesToExitCountEq <= 0) {
@@ -3101,13 +3012,12 @@
ALOGV("\tEffect_process() this is the last frame for LVM_EQUALIZER");
}
}
- if ((pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE)&&
- (pContext->EffectType == LVM_VIRTUALIZER)){
- //ALOGV("\tEffect_process() LVM_VIRTUALIZER Effect is not enabled");
- if(pContext->pBundledContext->SamplesToExitCountVirt > 0){
- pContext->pBundledContext->SamplesToExitCountVirt -=
- outBuffer->frameCount * NrChannels;
- //ALOGV("\tEffect_process: Waiting for to turn off VIRTUALIZER, %d samples left",
+ if ((pContext->pBundledContext->bVirtualizerEnabled == LVM_FALSE) &&
+ (pContext->EffectType == LVM_VIRTUALIZER)) {
+ // ALOGV("\tEffect_process() LVM_VIRTUALIZER Effect is not enabled");
+ if (pContext->pBundledContext->SamplesToExitCountVirt > 0) {
+ pContext->pBundledContext->SamplesToExitCountVirt -= outBuffer->frameCount * NrChannels;
+ // ALOGV("\tEffect_process: Waiting for to turn off VIRTUALIZER, %d samples left",
// pContext->pBundledContext->SamplesToExitCountVirt);
}
if (pContext->pBundledContext->SamplesToExitCountVirt <= 0) {
@@ -3120,37 +3030,34 @@
}
}
- if(status != -ENODATA){
+ if (status != -ENODATA) {
pContext->pBundledContext->NumberEffectsCalled++;
}
if (pContext->pBundledContext->NumberEffectsCalled >=
- pContext->pBundledContext->NumberEffectsEnabled) {
-
+ pContext->pBundledContext->NumberEffectsEnabled) {
// We expect the # effects called to be equal to # effects enabled in sequence (including
// draining effects). Warn if this is not the case due to inconsistent calls.
ALOGW_IF(pContext->pBundledContext->NumberEffectsCalled >
- pContext->pBundledContext->NumberEffectsEnabled,
- "%s Number of effects called %d is greater than number of effects enabled %d",
- __func__, pContext->pBundledContext->NumberEffectsCalled,
- pContext->pBundledContext->NumberEffectsEnabled);
- effectProcessCalled = 0; // reset our consistency check.
+ pContext->pBundledContext->NumberEffectsEnabled,
+ "%s Number of effects called %d is greater than number of effects enabled %d",
+ __func__, pContext->pBundledContext->NumberEffectsCalled,
+ pContext->pBundledContext->NumberEffectsEnabled);
+ effectProcessCalled = 0; // reset our consistency check.
- //ALOGV("\tEffect_process Calling process with %d effects enabled, %d called: Effect %d",
- //pContext->pBundledContext->NumberEffectsEnabled,
- //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
+ // ALOGV("\tEffect_process Calling process with %d effects enabled, %d called: Effect
+ // %d", pContext->pBundledContext->NumberEffectsEnabled,
+ // pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
- if (status == -ENODATA){
+ if (status == -ENODATA) {
ALOGV("\tEffect_process() processing last frame");
}
pContext->pBundledContext->NumberEffectsCalled = 0;
/* Process all the available frames, block processing is
handled internalLY by the LVM bundle */
- processStatus = android::LvmBundle_process(inBuffer->f32,
- outBuffer->f32,
- outBuffer->frameCount,
- pContext);
- if (processStatus != 0){
+ processStatus = android::LvmBundle_process(inBuffer->f32, outBuffer->f32,
+ outBuffer->frameCount, pContext);
+ if (processStatus != 0) {
ALOGV("\tLVM_ERROR : LvmBundle_process returned error %d", processStatus);
if (status == 0) {
status = processStatus;
@@ -3158,133 +3065,126 @@
return status;
}
} else {
- //ALOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect %d",
- //pContext->pBundledContext->NumberEffectsEnabled,
- //pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
+ // ALOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect
+ // %d", pContext->pBundledContext->NumberEffectsEnabled,
+ // pContext->pBundledContext->NumberEffectsCalled, pContext->EffectType);
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
for (size_t i = 0; i < outBuffer->frameCount * NrChannels; ++i) {
outBuffer->f32[i] += inBuffer->f32[i];
}
} else if (outBuffer->raw != inBuffer->raw) {
- memcpy(outBuffer->raw,
- inBuffer->raw,
- outBuffer->frameCount * sizeof(effect_buffer_t) * FCC_2);
+ memcpy(outBuffer->raw, inBuffer->raw,
+ outBuffer->frameCount * sizeof(effect_buffer_t) * FCC_2);
}
}
return status;
-} /* end Effect_process */
+} /* end Effect_process */
// The value offset of an effect parameter is computed by rounding up
// the parameter size to the next 32 bit alignment.
-static inline uint32_t computeParamVOffset(const effect_param_t *p) {
- return ((p->psize + sizeof(int32_t) - 1) / sizeof(int32_t)) *
- sizeof(int32_t);
+static inline uint32_t computeParamVOffset(const effect_param_t* p) {
+ return ((p->psize + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t);
}
/* Effect Control Interface Implementation: Command */
-int Effect_command(effect_handle_t self,
- uint32_t cmdCode,
- uint32_t cmdSize,
- void *pCmdData,
- uint32_t *replySize,
- void *pReplyData){
- EffectContext * pContext = (EffectContext *) self;
+int Effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, void* pCmdData,
+ uint32_t* replySize, void* pReplyData) {
+ EffectContext* pContext = (EffectContext*)self;
- //ALOGV("\t\nEffect_command start");
+ // ALOGV("\t\nEffect_command start");
- if(pContext->EffectType == LVM_BASS_BOOST){
- //ALOGV("\tEffect_command setting command for LVM_BASS_BOOST");
+ if (pContext->EffectType == LVM_BASS_BOOST) {
+ // ALOGV("\tEffect_command setting command for LVM_BASS_BOOST");
}
- if(pContext->EffectType == LVM_VIRTUALIZER){
- //ALOGV("\tEffect_command setting command for LVM_VIRTUALIZER");
+ if (pContext->EffectType == LVM_VIRTUALIZER) {
+ // ALOGV("\tEffect_command setting command for LVM_VIRTUALIZER");
}
- if(pContext->EffectType == LVM_EQUALIZER){
- //ALOGV("\tEffect_command setting command for LVM_EQUALIZER");
+ if (pContext->EffectType == LVM_EQUALIZER) {
+ // ALOGV("\tEffect_command setting command for LVM_EQUALIZER");
}
- if(pContext->EffectType == LVM_VOLUME){
- //ALOGV("\tEffect_command setting command for LVM_VOLUME");
+ if (pContext->EffectType == LVM_VOLUME) {
+ // ALOGV("\tEffect_command setting command for LVM_VOLUME");
}
- if (pContext == NULL){
+ if (pContext == NULL) {
ALOGV("\tLVM_ERROR : Effect_command ERROR pContext == NULL");
return -EINVAL;
}
- //ALOGV("\tEffect_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
+ // ALOGV("\tEffect_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
// Incase we disable an effect, next time process is
// called the number of effect called could be greater
// pContext->pBundledContext->NumberEffectsCalled = 0;
- //ALOGV("\tEffect_command NumberEffectsCalled = %d, NumberEffectsEnabled = %d",
+ // ALOGV("\tEffect_command NumberEffectsCalled = %d, NumberEffectsEnabled = %d",
// pContext->pBundledContext->NumberEffectsCalled,
// pContext->pBundledContext->NumberEffectsEnabled);
- switch (cmdCode){
+ switch (cmdCode) {
case EFFECT_CMD_INIT:
- if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR, EFFECT_CMD_INIT: ERROR for effect type %d",
- pContext->EffectType);
+ pContext->EffectType);
return -EINVAL;
}
- *(int *) pReplyData = 0;
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT start");
- if(pContext->EffectType == LVM_BASS_BOOST){
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_BASS_BOOST");
+ *(int*)pReplyData = 0;
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT start");
+ if (pContext->EffectType == LVM_BASS_BOOST) {
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_BASS_BOOST");
android::BassSetStrength(pContext, 0);
}
- if(pContext->EffectType == LVM_VIRTUALIZER){
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VIRTUALIZER");
+ if (pContext->EffectType == LVM_VIRTUALIZER) {
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VIRTUALIZER");
android::VirtualizerSetStrength(pContext, 0);
}
- if(pContext->EffectType == LVM_EQUALIZER){
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_EQUALIZER");
+ if (pContext->EffectType == LVM_EQUALIZER) {
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_EQUALIZER");
android::EqualizerSetPreset(pContext, 0);
}
- if(pContext->EffectType == LVM_VOLUME){
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VOLUME");
- *(int *) pReplyData = android::VolumeSetVolumeLevel(pContext, 0);
+ if (pContext->EffectType == LVM_VOLUME) {
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_INIT for LVM_VOLUME");
+ *(int*)pReplyData = android::VolumeSetVolumeLevel(pContext, 0);
}
break;
case EFFECT_CMD_SET_CONFIG:
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_CONFIG start");
- if (pCmdData == NULL || cmdSize != sizeof(effect_config_t) ||
- pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_CONFIG start");
+ if (pCmdData == NULL || cmdSize != sizeof(effect_config_t) || pReplyData == NULL ||
+ replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
- "EFFECT_CMD_SET_CONFIG: ERROR");
+ "EFFECT_CMD_SET_CONFIG: ERROR");
return -EINVAL;
}
- *(int *) pReplyData = android::Effect_setConfig(pContext, (effect_config_t *) pCmdData);
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_CONFIG end");
+ *(int*)pReplyData = android::Effect_setConfig(pContext, (effect_config_t*)pCmdData);
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_CONFIG end");
break;
case EFFECT_CMD_GET_CONFIG:
if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(effect_config_t)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
- "EFFECT_CMD_GET_CONFIG: ERROR");
+ "EFFECT_CMD_GET_CONFIG: ERROR");
return -EINVAL;
}
- android::Effect_getConfig(pContext, (effect_config_t *)pReplyData);
+ android::Effect_getConfig(pContext, (effect_config_t*)pReplyData);
break;
case EFFECT_CMD_RESET:
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET start");
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET start");
android::Effect_setConfig(pContext, &pContext->config);
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET end");
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_RESET end");
break;
- case EFFECT_CMD_GET_PARAM:{
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
+ case EFFECT_CMD_GET_PARAM: {
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
- effect_param_t *p = (effect_param_t *)pCmdData;
+ effect_param_t* p = (effect_param_t*)pCmdData;
if (pCmdData == NULL || cmdSize < sizeof(effect_param_t) ||
- cmdSize < (sizeof(effect_param_t) + p->psize) ||
- pReplyData == NULL || replySize == NULL ||
- *replySize < (sizeof(effect_param_t) + p->psize)) {
+ cmdSize < (sizeof(effect_param_t) + p->psize) || pReplyData == NULL ||
+ replySize == NULL || *replySize < (sizeof(effect_param_t) + p->psize)) {
ALOGV("\tLVM_ERROR : EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
}
@@ -3295,75 +3195,62 @@
}
const uint32_t paddedParamSize = computeParamVOffset(p);
if ((EFFECT_PARAM_SIZE_MAX - sizeof(effect_param_t) < paddedParamSize) ||
- (EFFECT_PARAM_SIZE_MAX - sizeof(effect_param_t) - paddedParamSize <
- p->vsize)) {
+ (EFFECT_PARAM_SIZE_MAX - sizeof(effect_param_t) - paddedParamSize < p->vsize)) {
ALOGV("\tLVM_ERROR : EFFECT_CMD_GET_PARAM: padded_psize or vsize too big");
return -EINVAL;
}
uint32_t expectedReplySize = sizeof(effect_param_t) + paddedParamSize + p->vsize;
if (*replySize < expectedReplySize) {
ALOGV("\tLVM_ERROR : EFFECT_CMD_GET_PARAM: min. replySize %u, got %u bytes",
- expectedReplySize, *replySize);
+ expectedReplySize, *replySize);
android_errorWriteLog(0x534e4554, "32705438");
return -EINVAL;
}
memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
- p = (effect_param_t *)pReplyData;
+ p = (effect_param_t*)pReplyData;
uint32_t voffset = paddedParamSize;
- if(pContext->EffectType == LVM_BASS_BOOST){
- p->status = android::BassBoost_getParameter(pContext,
- p->psize,
- p->data,
- &p->vsize,
+ if (pContext->EffectType == LVM_BASS_BOOST) {
+ p->status = android::BassBoost_getParameter(pContext, p->psize, p->data, &p->vsize,
p->data + voffset);
- //ALOGV("\tBassBoost_command EFFECT_CMD_GET_PARAM "
+ // ALOGV("\tBassBoost_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
// *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
}
- if(pContext->EffectType == LVM_VIRTUALIZER){
- p->status = android::Virtualizer_getParameter(pContext,
- p->psize,
- (void *)p->data,
- &p->vsize,
- p->data + voffset);
+ if (pContext->EffectType == LVM_VIRTUALIZER) {
+ p->status = android::Virtualizer_getParameter(pContext, p->psize, (void*)p->data,
+ &p->vsize, p->data + voffset);
- //ALOGV("\tVirtualizer_command EFFECT_CMD_GET_PARAM "
+ // ALOGV("\tVirtualizer_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
// *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
}
- if(pContext->EffectType == LVM_EQUALIZER){
- //ALOGV("\tEqualizer_command cmdCode Case: "
+ if (pContext->EffectType == LVM_EQUALIZER) {
+ // ALOGV("\tEqualizer_command cmdCode Case: "
// "EFFECT_CMD_GET_PARAM start");
- p->status = android::Equalizer_getParameter(pContext,
- p->psize,
- p->data,
- &p->vsize,
+ p->status = android::Equalizer_getParameter(pContext, p->psize, p->data, &p->vsize,
p->data + voffset);
- //ALOGV("\tEqualizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, "
+ // ALOGV("\tEqualizer_command EFFECT_CMD_GET_PARAM *pCmdData %d, *replySize %d, "
// "*pReplyData %08x %08x",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)), *replySize,
// *(int32_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset),
// *(int32_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset +
// sizeof(int32_t)));
}
- if(pContext->EffectType == LVM_VOLUME){
- //ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
- p->status = android::Volume_getParameter(pContext,
- p->psize,
- (void *)p->data,
- &p->vsize,
- p->data + voffset);
+ if (pContext->EffectType == LVM_VOLUME) {
+ // ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
+ p->status = android::Volume_getParameter(pContext, p->psize, (void*)p->data,
+ &p->vsize, p->data + voffset);
- //ALOGV("\tVolume_command EFFECT_CMD_GET_PARAM "
+ // ALOGV("\tVolume_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
@@ -3371,123 +3258,114 @@
}
*replySize = sizeof(effect_param_t) + voffset + p->vsize;
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM end");
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_GET_PARAM end");
} break;
- case EFFECT_CMD_SET_PARAM:{
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
- if(pContext->EffectType == LVM_BASS_BOOST){
- //ALOGV("\tBassBoost_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
+ case EFFECT_CMD_SET_PARAM: {
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
+ if (pContext->EffectType == LVM_BASS_BOOST) {
+ // ALOGV("\tBassBoost_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value
+ // %d",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
- if (pCmdData == NULL ||
- cmdSize != (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t)) ||
- pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
+ if (pCmdData == NULL ||
+ cmdSize != (sizeof(effect_param_t) + sizeof(int32_t) + sizeof(int16_t)) ||
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
- "EFFECT_CMD_SET_PARAM: ERROR");
+ "EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t * const p = (effect_param_t *) pCmdData;
+ effect_param_t* const p = (effect_param_t*)pCmdData;
const uint32_t voffset = computeParamVOffset(p);
- //ALOGV("\tnBassBoost_command cmdSize is %d\n"
+ // ALOGV("\tnBassBoost_command cmdSize is %d\n"
// "\tsizeof(effect_param_t) is %d\n"
// "\tp->psize is %d\n"
// "\tp->vsize is %d"
// "\n",
// cmdSize, sizeof(effect_param_t), p->psize, p->vsize );
- *(int *)pReplyData = android::BassBoost_setParameter(pContext,
- p->psize,
- (void *)p->data,
- p->vsize,
- p->data + voffset);
+ *(int*)pReplyData = android::BassBoost_setParameter(
+ pContext, p->psize, (void*)p->data, p->vsize, p->data + voffset);
}
- if(pContext->EffectType == LVM_VIRTUALIZER){
- // Warning this log will fail to properly read an int32_t value, assumes int16_t
- //ALOGV("\tVirtualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d",
- // *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
- // *replySize,
- // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
+ if (pContext->EffectType == LVM_VIRTUALIZER) {
+ // Warning this log will fail to properly read an int32_t value, assumes int16_t
+ // ALOGV("\tVirtualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value
+ // %d",
+ // *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
+ // *replySize,
+ // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +
+ // sizeof(int32_t)));
- if (pCmdData == NULL ||
- // legal parameters are int16_t or int32_t
- cmdSize > (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int32_t)) ||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t)) ||
- pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
+ if (pCmdData == NULL ||
+ // legal parameters are int16_t or int32_t
+ cmdSize > (sizeof(effect_param_t) + sizeof(int32_t) + sizeof(int32_t)) ||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t) + sizeof(int16_t)) ||
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
- "EFFECT_CMD_SET_PARAM: ERROR");
+ "EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t * const p = (effect_param_t *) pCmdData;
+ effect_param_t* const p = (effect_param_t*)pCmdData;
const uint32_t voffset = computeParamVOffset(p);
- //ALOGV("\tnVirtualizer_command cmdSize is %d\n"
+ // ALOGV("\tnVirtualizer_command cmdSize is %d\n"
// "\tsizeof(effect_param_t) is %d\n"
// "\tp->psize is %d\n"
// "\tp->vsize is %d"
// "\n",
// cmdSize, sizeof(effect_param_t), p->psize, p->vsize );
- *(int *)pReplyData = android::Virtualizer_setParameter(pContext,
- p->psize,
- (void *)p->data,
- p->vsize,
- p->data + voffset);
+ *(int*)pReplyData = android::Virtualizer_setParameter(
+ pContext, p->psize, (void*)p->data, p->vsize, p->data + voffset);
}
- if(pContext->EffectType == LVM_EQUALIZER){
- //ALOGV("\tEqualizer_command cmdCode Case: "
- // "EFFECT_CMD_SET_PARAM start");
- //ALOGV("\tEqualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
- // *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
- // *replySize,
- // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
+ if (pContext->EffectType == LVM_EQUALIZER) {
+ // ALOGV("\tEqualizer_command cmdCode Case: "
+ // "EFFECT_CMD_SET_PARAM start");
+ // ALOGV("\tEqualizer_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d
+ // ",
+ // *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
+ // *replySize,
+ // *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +
+ // sizeof(int32_t)));
if (pCmdData == NULL || cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
- "EFFECT_CMD_SET_PARAM: ERROR");
+ "EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t * const p = (effect_param_t *) pCmdData;
+ effect_param_t* const p = (effect_param_t*)pCmdData;
const uint32_t voffset = computeParamVOffset(p);
- *(int *)pReplyData = android::Equalizer_setParameter(pContext,
- p->psize,
- (void *)p->data,
- p->vsize,
- p->data + voffset);
+ *(int*)pReplyData = android::Equalizer_setParameter(
+ pContext, p->psize, (void*)p->data, p->vsize, p->data + voffset);
}
- if(pContext->EffectType == LVM_VOLUME){
- //ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
- //ALOGV("\tVolume_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
+ if (pContext->EffectType == LVM_VOLUME) {
+ // ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_SET_PARAM start");
+ // ALOGV("\tVolume_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +sizeof(int32_t)));
- if (pCmdData == NULL ||
- cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
- pReplyData == NULL || replySize == NULL ||
- *replySize != sizeof(int32_t)) {
+ if (pCmdData == NULL || cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
- "EFFECT_CMD_SET_PARAM: ERROR");
+ "EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t * const p = (effect_param_t *) pCmdData;
+ effect_param_t* const p = (effect_param_t*)pCmdData;
const uint32_t voffset = computeParamVOffset(p);
- *(int *)pReplyData = android::Volume_setParameter(pContext,
- p->psize,
- (void *)p->data,
- p->vsize,
- p->data + voffset);
+ *(int*)pReplyData = android::Volume_setParameter(pContext, p->psize, (void*)p->data,
+ p->vsize, p->data + voffset);
}
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM end");
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_PARAM end");
} break;
case EFFECT_CMD_ENABLE:
@@ -3497,57 +3375,56 @@
return -EINVAL;
}
- *(int *)pReplyData = android::Effect_setEnabled(pContext, LVM_TRUE);
+ *(int*)pReplyData = android::Effect_setEnabled(pContext, LVM_TRUE);
break;
case EFFECT_CMD_DISABLE:
- //ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_DISABLE start");
+ // ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_DISABLE start");
if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_DISABLE: ERROR");
return -EINVAL;
}
- *(int *)pReplyData = android::Effect_setEnabled(pContext, LVM_FALSE);
+ *(int*)pReplyData = android::Effect_setEnabled(pContext, LVM_FALSE);
break;
- case EFFECT_CMD_SET_DEVICE:
- {
+ case EFFECT_CMD_SET_DEVICE: {
ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE start");
- if (pCmdData == NULL){
+ if (pCmdData == NULL) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: EFFECT_CMD_SET_DEVICE: ERROR");
return -EINVAL;
}
- uint32_t device = *(uint32_t *)pCmdData;
- pContext->pBundledContext->nOutputDevice = (audio_devices_t) device;
+ uint32_t device = *(uint32_t*)pCmdData;
+ pContext->pBundledContext->nOutputDevice = (audio_devices_t)device;
if (pContext->EffectType == LVM_BASS_BOOST) {
- if((device == AUDIO_DEVICE_OUT_SPEAKER) ||
- (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) ||
- (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)){
+ if ((device == AUDIO_DEVICE_OUT_SPEAKER) ||
+ (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) ||
+ (device == AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER)) {
ALOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_BASS_BOOST %d",
- *(int32_t *)pCmdData);
+ *(int32_t*)pCmdData);
ALOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_BAS_BOOST");
- // If a device doesnt support bassboost the effect must be temporarily disabled
+ // If a device doesn't support bassboost the effect must be temporarily disabled
// the effect must still report its original state as this can only be changed
// by the ENABLE/DISABLE command
if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
ALOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_BASS_BOOST %d",
- *(int32_t *)pCmdData);
+ *(int32_t*)pCmdData);
android::LvmEffect_disable(pContext);
}
pContext->pBundledContext->bBassTempDisabled = LVM_TRUE;
} else {
ALOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_BASS_BOOST %d",
- *(int32_t *)pCmdData);
+ *(int32_t*)pCmdData);
// If a device supports bassboost and the effect has been temporarily disabled
// previously then re-enable it
if (pContext->pBundledContext->bBassEnabled == LVM_TRUE) {
ALOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_BASS_BOOST %d",
- *(int32_t *)pCmdData);
+ *(int32_t*)pCmdData);
android::LvmEffect_enable(pContext);
}
pContext->pBundledContext->bBassTempDisabled = LVM_FALSE;
@@ -3558,129 +3435,128 @@
// default case unless configuration is forced
if (android::VirtualizerIsDeviceSupported(device) != 0) {
ALOGV("\tEFFECT_CMD_SET_DEVICE device is invalid for LVM_VIRTUALIZER %d",
- *(int32_t *)pCmdData);
+ *(int32_t*)pCmdData);
ALOGV("\tEFFECT_CMD_SET_DEVICE temporary disable LVM_VIRTUALIZER");
- //If a device doesnt support virtualizer the effect must be temporarily
+ // If a device doesn't support virtualizer the effect must be temporarily
// disabled the effect must still report its original state as this can
// only be changed by the ENABLE/DISABLE command
if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
ALOGV("\tEFFECT_CMD_SET_DEVICE disable LVM_VIRTUALIZER %d",
- *(int32_t *)pCmdData);
+ *(int32_t*)pCmdData);
android::LvmEffect_disable(pContext);
}
pContext->pBundledContext->bVirtualizerTempDisabled = LVM_TRUE;
} else {
ALOGV("\tEFFECT_CMD_SET_DEVICE device is valid for LVM_VIRTUALIZER %d",
- *(int32_t *)pCmdData);
+ *(int32_t*)pCmdData);
// If a device supports virtualizer and the effect has been temporarily
// disabled previously then re-enable it
- if(pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE){
+ if (pContext->pBundledContext->bVirtualizerEnabled == LVM_TRUE) {
ALOGV("\tEFFECT_CMD_SET_DEVICE re-enable LVM_VIRTUALIZER %d",
- *(int32_t *)pCmdData);
+ *(int32_t*)pCmdData);
android::LvmEffect_enable(pContext);
}
pContext->pBundledContext->bVirtualizerTempDisabled = LVM_FALSE;
}
- } // else virtualization mode is forced to a certain device, nothing to do
+ } // else virtualization mode is forced to a certain device, nothing to do
}
ALOGV("\tEffect_command cmdCode Case: EFFECT_CMD_SET_DEVICE end");
break;
}
- case EFFECT_CMD_SET_VOLUME:
- {
+ case EFFECT_CMD_SET_VOLUME: {
uint32_t leftVolume, rightVolume;
- int16_t leftdB, rightdB;
- int16_t maxdB, pandB;
- int32_t vol_ret[2] = {1<<24,1<<24}; // Apply no volume
- LVM_ControlParams_t ActiveParams; /* Current control Parameters */
- LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */
+ int16_t leftdB, rightdB;
+ int16_t maxdB, pandB;
+ int32_t vol_ret[2] = {1 << 24, 1 << 24}; // Apply no volume
+ LVM_ControlParams_t ActiveParams; /* Current control Parameters */
+ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */
// if pReplyData is NULL, VOL_CTRL is delegated to another effect
- if(pReplyData == LVM_NULL){
+ if (pReplyData == LVM_NULL) {
break;
}
if (pCmdData == NULL || cmdSize != 2 * sizeof(uint32_t) || pReplyData == NULL ||
- replySize == NULL || *replySize < 2*sizeof(int32_t)) {
+ replySize == NULL || *replySize < 2 * sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Effect_command cmdCode Case: "
- "EFFECT_CMD_SET_VOLUME: ERROR");
+ "EFFECT_CMD_SET_VOLUME: ERROR");
return -EINVAL;
}
- leftVolume = ((*(uint32_t *)pCmdData));
- rightVolume = ((*((uint32_t *)pCmdData + 1)));
+ leftVolume = ((*(uint32_t*)pCmdData));
+ rightVolume = ((*((uint32_t*)pCmdData + 1)));
- if(leftVolume == 0x1000000){
+ if (leftVolume == 0x1000000) {
leftVolume -= 1;
}
- if(rightVolume == 0x1000000){
+ if (rightVolume == 0x1000000) {
rightVolume -= 1;
}
// Convert volume to dB
- leftdB = android::LVC_Convert_VolToDb(leftVolume);
+ leftdB = android::LVC_Convert_VolToDb(leftVolume);
rightdB = android::LVC_Convert_VolToDb(rightVolume);
pandB = rightdB - leftdB;
// Calculate max volume in dB
maxdB = leftdB;
- if(rightdB > maxdB){
+ if (rightdB > maxdB) {
maxdB = rightdB;
}
- //ALOGV("\tEFFECT_CMD_SET_VOLUME Session: %d, SessionID: %d VOLUME is %d dB, "
+ // ALOGV("\tEFFECT_CMD_SET_VOLUME Session: %d, SessionID: %d VOLUME is %d dB, "
// "effect is %d",
- //pContext->pBundledContext->SessionNo, pContext->pBundledContext->SessionId,
+ // pContext->pBundledContext->SessionNo, pContext->pBundledContext->SessionId,
//(int32_t)maxdB, pContext->EffectType);
- //ALOGV("\tEFFECT_CMD_SET_VOLUME: Left is %d, Right is %d", leftVolume, rightVolume);
- //ALOGV("\tEFFECT_CMD_SET_VOLUME: Left %ddB, Right %ddB, Position %ddB",
+ // ALOGV("\tEFFECT_CMD_SET_VOLUME: Left is %d, Right is %d", leftVolume, rightVolume);
+ // ALOGV("\tEFFECT_CMD_SET_VOLUME: Left %ddB, Right %ddB, Position %ddB",
// leftdB, rightdB, pandB);
- memcpy(pReplyData, vol_ret, sizeof(int32_t)*2);
- android::VolumeSetVolumeLevel(pContext, (int16_t)(maxdB*100));
+ memcpy(pReplyData, vol_ret, sizeof(int32_t) * 2);
+ android::VolumeSetVolumeLevel(pContext, (int16_t)(maxdB * 100));
/* Get the current settings */
- LvmStatus =LVM_GetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
+ LvmStatus =
+ LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetControlParameters", "VolumeSetStereoPosition")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
/* Volume parameters */
- ActiveParams.VC_Balance = pandB;
- ALOGV("\t\tVolumeSetStereoPosition() (-96dB -> +96dB)-> %d\n", ActiveParams.VC_Balance );
+ ActiveParams.VC_Balance = pandB;
+ ALOGV("\t\tVolumeSetStereoPosition() (-96dB -> +96dB)-> %d\n", ActiveParams.VC_Balance);
/* Activate the initial settings */
- LvmStatus =LVM_SetControlParameters(pContext->pBundledContext->hInstance,&ActiveParams);
+ LvmStatus =
+ LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_SetControlParameters", "VolumeSetStereoPosition")
- if(LvmStatus != LVM_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVM_SUCCESS) return -EINVAL;
break;
- }
+ }
case EFFECT_CMD_SET_AUDIO_MODE:
break;
default:
return -EINVAL;
}
- //ALOGV("\tEffect_command end...\n\n");
+ // ALOGV("\tEffect_command end...\n\n");
return 0;
-} /* end Effect_command */
+} /* end Effect_command */
/* Effect Control Interface Implementation: get_descriptor */
-int Effect_getDescriptor(effect_handle_t self,
- effect_descriptor_t *pDescriptor)
-{
- EffectContext * pContext = (EffectContext *) self;
- const effect_descriptor_t *desc;
+int Effect_getDescriptor(effect_handle_t self, effect_descriptor_t* pDescriptor) {
+ EffectContext* pContext = (EffectContext*)self;
+ const effect_descriptor_t* desc;
if (pContext == NULL || pDescriptor == NULL) {
ALOGV("Effect_getDescriptor() invalid param");
return -EINVAL;
}
- switch(pContext->EffectType) {
+ switch (pContext->EffectType) {
case LVM_BASS_BOOST:
desc = &android::gBassBoostDescriptor;
break;
@@ -3700,26 +3576,24 @@
*pDescriptor = *desc;
return 0;
-} /* end Effect_getDescriptor */
+} /* end Effect_getDescriptor */
// effect_handle_t interface implementation for effect
const struct effect_interface_s gLvmEffectInterface = {
- Effect_process,
- Effect_command,
- Effect_getDescriptor,
- NULL,
-}; /* end gLvmEffectInterface */
+ Effect_process,
+ Effect_command,
+ Effect_getDescriptor,
+ NULL,
+}; /* end gLvmEffectInterface */
// This is the only symbol that needs to be exported
-__attribute__ ((visibility ("default")))
-audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
- .tag = AUDIO_EFFECT_LIBRARY_TAG,
- .version = EFFECT_LIBRARY_API_VERSION,
- .name = "Effect Bundle Library",
- .implementor = "NXP Software Ltd.",
- .create_effect = android::EffectCreate,
- .release_effect = android::EffectRelease,
- .get_descriptor = android::EffectGetDescriptor,
+__attribute__((visibility("default"))) audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
+ .tag = AUDIO_EFFECT_LIBRARY_TAG,
+ .version = EFFECT_LIBRARY_API_VERSION,
+ .name = "Effect Bundle Library",
+ .implementor = "NXP Software Ltd.",
+ .create_effect = android::EffectCreate,
+ .release_effect = android::EffectRelease,
+ .get_descriptor = android::EffectGetDescriptor,
};
-
}
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
index 63bc45c..f3e7884 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.h
@@ -23,174 +23,148 @@
#include <LVM.h>
#include <limits.h>
-#define FIVEBAND_NUMBANDS 5
-#define MAX_NUM_BANDS 5
-#define MAX_CALL_SIZE 256
-#define LVM_MAX_SESSIONS 32
-#define LVM_UNUSED_SESSION INT_MAX
-#define BASS_BOOST_CUP_LOAD_ARM9E 150 // Expressed in 0.1 MIPS
-#define VIRTUALIZER_CUP_LOAD_ARM9E 120 // Expressed in 0.1 MIPS
-#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 FIVEBAND_NUMBANDS 5
+#define MAX_NUM_BANDS 5
+#define MAX_CALL_SIZE 256
+#define LVM_MAX_SESSIONS 32
+#define LVM_UNUSED_SESSION INT_MAX
+#define BASS_BOOST_CUP_LOAD_ARM9E 150 // Expressed in 0.1 MIPS
+#define VIRTUALIZER_CUP_LOAD_ARM9E 120 // Expressed in 0.1 MIPS
+#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
#ifndef OPENSL_ES_H_
-static const effect_uuid_t SL_IID_VOLUME_ = { 0x09e8ede0, 0xddde, 0x11db, 0xb4f6,
- { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
-const effect_uuid_t * const SL_IID_VOLUME = &SL_IID_VOLUME_;
-#endif //OPENSL_ES_H_
+static const effect_uuid_t SL_IID_VOLUME_ = {
+ 0x09e8ede0, 0xddde, 0x11db, 0xb4f6, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}};
+const effect_uuid_t* const SL_IID_VOLUME = &SL_IID_VOLUME_;
+#endif // OPENSL_ES_H_
-typedef enum
-{
- LVM_BASS_BOOST,
- LVM_VIRTUALIZER,
- LVM_EQUALIZER,
- LVM_VOLUME
-} lvm_effect_en;
+typedef enum { LVM_BASS_BOOST, LVM_VIRTUALIZER, LVM_EQUALIZER, LVM_VOLUME } lvm_effect_en;
// Preset configuration.
struct PresetConfig {
// Human-readable name.
- const char * name;
+ const char* name;
// An array of size nBands where each element is a configuration for the
// corresponding band.
- //const BandConfig * bandConfigs;
+ // const BandConfig * bandConfigs;
};
/* BundledEffectContext : One per session */
-struct BundledEffectContext{
- LVM_Handle_t hInstance; /* Instance handle */
- int SessionNo; /* Current session number */
- int SessionId; /* Current session id */
- bool bVolumeEnabled; /* Flag for Volume */
- bool bEqualizerEnabled; /* Flag for EQ */
- bool bBassEnabled; /* Flag for Bass */
- bool bBassTempDisabled; /* Flag for Bass to be re-enabled */
- bool bVirtualizerEnabled; /* Flag for Virtualizer */
- bool bVirtualizerTempDisabled; /* Flag for effect to be re-enabled */
- audio_devices_t nOutputDevice; /* Output device for the effect */
- audio_devices_t nVirtualizerForcedDevice; /* Forced device virtualization mode*/
- int NumberEffectsEnabled; /* Effects in this session */
- int NumberEffectsCalled; /* Effects called so far */
- bool firstVolume; /* No smoothing on first Vol change */
+struct BundledEffectContext {
+ LVM_Handle_t hInstance; /* Instance handle */
+ int SessionNo; /* Current session number */
+ int SessionId; /* Current session id */
+ bool bVolumeEnabled; /* Flag for Volume */
+ bool bEqualizerEnabled; /* Flag for EQ */
+ bool bBassEnabled; /* Flag for Bass */
+ bool bBassTempDisabled; /* Flag for Bass to be re-enabled */
+ bool bVirtualizerEnabled; /* Flag for Virtualizer */
+ bool bVirtualizerTempDisabled; /* Flag for effect to be re-enabled */
+ audio_devices_t nOutputDevice; /* Output device for the effect */
+ audio_devices_t nVirtualizerForcedDevice; /* Forced device virtualization mode*/
+ int NumberEffectsEnabled; /* Effects in this session */
+ int NumberEffectsCalled; /* Effects called so far */
+ bool firstVolume; /* No smoothing on first Vol change */
// Saved parameters for each effect */
// Bass Boost
- int BassStrengthSaved; /* Conversion between Get/Set */
+ int BassStrengthSaved; /* Conversion between Get/Set */
// Equalizer
- int CurPreset; /* Current preset being used */
+ int CurPreset; /* Current preset being used */
// Virtualzer
- int VirtStrengthSaved; /* Conversion between Get/Set */
+ int VirtStrengthSaved; /* Conversion between Get/Set */
// Volume
- int levelSaved; /* for when mute is set, level must be saved */
- int positionSaved;
- bool bMuteEnabled; /* Must store as mute = -96dB level */
- bool bStereoPositionEnabled;
- LVM_Fs_en SampleRate;
- int SamplesPerSecond;
- int SamplesToExitCountEq;
- int SamplesToExitCountBb;
- int SamplesToExitCountVirt;
- effect_buffer_t *workBuffer;
- int frameCount;
- int32_t bandGaindB[FIVEBAND_NUMBANDS];
- int volume;
- LVM_INT32 ChMask;
+ int levelSaved; /* for when mute is set, level must be saved */
+ int positionSaved;
+ bool bMuteEnabled; /* Must store as mute = -96dB level */
+ bool bStereoPositionEnabled;
+ LVM_Fs_en SampleRate;
+ int SamplesPerSecond;
+ int SamplesToExitCountEq;
+ int SamplesToExitCountBb;
+ int SamplesToExitCountVirt;
+ effect_buffer_t* workBuffer;
+ int frameCount;
+ int32_t bandGaindB[FIVEBAND_NUMBANDS];
+ int volume;
+ LVM_INT32 ChMask;
/* Bitmask whether drain is in progress due to disabling the effect.
The corresponding bit to an effect is set by 1 << lvm_effect_en. */
- int effectInDrain;
+ int effectInDrain;
/* Bitmask whether process() was called for a particular effect.
The corresponding bit to an effect is set by 1 << lvm_effect_en. */
- int effectProcessCalled;
+ int effectProcessCalled;
};
/* SessionContext : One session */
-struct SessionContext{
- bool bBundledEffectsEnabled;
- bool bVolumeInstantiated;
- bool bEqualizerInstantiated;
- bool bBassInstantiated;
- bool bVirtualizerInstantiated;
- BundledEffectContext *pBundledContext;
+struct SessionContext {
+ bool bBundledEffectsEnabled;
+ bool bVolumeInstantiated;
+ bool bEqualizerInstantiated;
+ bool bBassInstantiated;
+ bool bVirtualizerInstantiated;
+ BundledEffectContext* pBundledContext;
};
-struct EffectContext{
- const struct effect_interface_s *itfe;
- effect_config_t config;
- lvm_effect_en EffectType;
- BundledEffectContext *pBundledContext;
+struct EffectContext {
+ const struct effect_interface_s* itfe;
+ effect_config_t config;
+ lvm_effect_en EffectType;
+ BundledEffectContext* pBundledContext;
};
/* enumerated parameter settings for Volume effect */
-typedef enum
-{
- VOLUME_PARAM_LEVEL, // type SLmillibel = typedef SLuint16 (set & get)
- VOLUME_PARAM_MAXLEVEL, // type SLmillibel = typedef SLuint16 (get)
- VOLUME_PARAM_MUTE, // type SLboolean = typedef SLuint32 (set & get)
- VOLUME_PARAM_ENABLESTEREOPOSITION, // type SLboolean = typedef SLuint32 (set & get)
- VOLUME_PARAM_STEREOPOSITION, // type SLpermille = typedef SLuint16 (set & get)
+typedef enum {
+ VOLUME_PARAM_LEVEL, // type SLmillibel = typedef SLuint16 (set & get)
+ VOLUME_PARAM_MAXLEVEL, // type SLmillibel = typedef SLuint16 (get)
+ VOLUME_PARAM_MUTE, // type SLboolean = typedef SLuint32 (set & get)
+ VOLUME_PARAM_ENABLESTEREOPOSITION, // type SLboolean = typedef SLuint32 (set & get)
+ VOLUME_PARAM_STEREOPOSITION, // type SLpermille = typedef SLuint16 (set & get)
} t_volume_params;
static const int PRESET_CUSTOM = -1;
-static const uint32_t bandFreqRange[FIVEBAND_NUMBANDS][2] = {
- {30000, 120000},
- {120001, 460000},
- {460001, 1800000},
- {1800001, 7000000},
- {7000001, 20000000}};
+static const uint32_t bandFreqRange[FIVEBAND_NUMBANDS][2] = {{30000, 120000},
+ {120001, 460000},
+ {460001, 1800000},
+ {1800001, 7000000},
+ {7000001, 20000000}};
-//Note: If these frequencies change, please update LimitLevel values accordingly.
-static const LVM_UINT16 EQNB_5BandPresetsFrequencies[] = {
- 60, /* Frequencies in Hz */
- 230,
- 910,
- 3600,
- 14000};
+// Note: If these frequencies change, please update LimitLevel values accordingly.
+static const LVM_UINT16 EQNB_5BandPresetsFrequencies[] = {60, /* Frequencies in Hz */
+ 230, 910, 3600, 14000};
-static const LVM_UINT16 EQNB_5BandPresetsQFactors[] = {
- 96, /* Q factor multiplied by 100 */
- 96,
- 96,
- 96,
- 96};
+static const LVM_UINT16 EQNB_5BandPresetsQFactors[] = {96, /* Q factor multiplied by 100 */
+ 96, 96, 96, 96};
-static const LVM_INT16 EQNB_5BandNormalPresets[] = {
- 3, 0, 0, 0, 3, /* Normal Preset */
- 8, 5, -3, 5, 6, /* Classical Preset */
- 15, -6, 7, 13, 10, /* Dance Preset */
- 0, 0, 0, 0, 0, /* Flat Preset */
- 6, -2, -2, 6, -3, /* Folk Preset */
- 8, -8, 13, -1, -4, /* Heavy Metal Preset */
- 10, 6, -4, 5, 8, /* Hip Hop Preset */
- 8, 5, -4, 5, 9, /* Jazz Preset */
- -6, 4, 9, 4, -5, /* Pop Preset */
- 10, 6, -1, 8, 10}; /* Rock Preset */
+static const LVM_INT16 EQNB_5BandNormalPresets[] = {3, 0, 0, 0, 3, /* Normal Preset */
+ 8, 5, -3, 5, 6, /* Classical Preset */
+ 15, -6, 7, 13, 10, /* Dance Preset */
+ 0, 0, 0, 0, 0, /* Flat Preset */
+ 6, -2, -2, 6, -3, /* Folk Preset */
+ 8, -8, 13, -1, -4, /* Heavy Metal Preset */
+ 10, 6, -4, 5, 8, /* Hip Hop Preset */
+ 8, 5, -4, 5, 9, /* Jazz Preset */
+ -6, 4, 9, 4, -5, /* Pop Preset */
+ 10, 6, -1, 8, 10}; /* Rock Preset */
-static const LVM_INT16 EQNB_5BandSoftPresets[] = {
- 3, 0, 0, 0, 3, /* Normal Preset */
- 5, 3, -2, 4, 4, /* Classical Preset */
- 6, 0, 2, 4, 1, /* Dance Preset */
- 0, 0, 0, 0, 0, /* Flat Preset */
- 3, 0, 0, 2, -1, /* Folk Preset */
- 4, 1, 9, 3, 0, /* Heavy Metal Preset */
- 5, 3, 0, 1, 3, /* Hip Hop Preset */
- 4, 2, -2, 2, 5, /* Jazz Preset */
- -1, 2, 5, 1, -2, /* Pop Preset */
- 5, 3, -1, 3, 5}; /* Rock Preset */
+static const LVM_INT16 EQNB_5BandSoftPresets[] = {3, 0, 0, 0, 3, /* Normal Preset */
+ 5, 3, -2, 4, 4, /* Classical Preset */
+ 6, 0, 2, 4, 1, /* Dance Preset */
+ 0, 0, 0, 0, 0, /* Flat Preset */
+ 3, 0, 0, 2, -1, /* Folk Preset */
+ 4, 1, 9, 3, 0, /* Heavy Metal Preset */
+ 5, 3, 0, 1, 3, /* Hip Hop Preset */
+ 4, 2, -2, 2, 5, /* Jazz Preset */
+ -1, 2, 5, 1, -2, /* Pop Preset */
+ 5, 3, -1, 3, 5}; /* Rock Preset */
-static const PresetConfig gEqualizerPresets[] = {
- {"Normal"},
- {"Classical"},
- {"Dance"},
- {"Flat"},
- {"Folk"},
- {"Heavy Metal"},
- {"Hip Hop"},
- {"Jazz"},
- {"Pop"},
- {"Rock"}};
+static const PresetConfig gEqualizerPresets[] = {{"Normal"}, {"Classical"}, {"Dance"}, {"Flat"},
+ {"Folk"}, {"Heavy Metal"}, {"Hip Hop"}, {"Jazz"},
+ {"Pop"}, {"Rock"}};
/* The following tables have been computed using the actual levels measured by the output of
* white noise or pink noise (IEC268-1) for the EQ and BassBoost Effects. These are estimates of
@@ -199,14 +173,14 @@
* updated.
*/
-static const float LimitLevel_bandEnergyCoefficient[FIVEBAND_NUMBANDS] = {
- 7.56, 9.69, 9.59, 7.37, 2.88};
+static const float LimitLevel_bandEnergyCoefficient[FIVEBAND_NUMBANDS] = {7.56, 9.69, 9.59, 7.37,
+ 2.88};
-static const float LimitLevel_bandEnergyCrossCoefficient[FIVEBAND_NUMBANDS-1] = {
- 126.0, 115.0, 125.0, 104.0 };
+static const float LimitLevel_bandEnergyCrossCoefficient[FIVEBAND_NUMBANDS - 1] = {126.0, 115.0,
+ 125.0, 104.0};
static const float LimitLevel_bassBoostEnergyCrossCoefficient[FIVEBAND_NUMBANDS] = {
- 221.21, 208.10, 28.16, 0.0, 0.0 };
+ 221.21, 208.10, 28.16, 0.0, 0.0};
static const float LimitLevel_bassBoostEnergyCoefficient = 9.00;
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 4411a7d..9ea70ce 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -18,7 +18,7 @@
typedef float LVM_FLOAT;
#endif
#define LOG_TAG "Reverb"
-#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array)[0])
//#define LOG_NDEBUG 0
#include <assert.h>
@@ -37,19 +37,23 @@
// effect_handle_t interface implementation for reverb
extern "C" const struct effect_interface_s gReverbInterface;
-#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
- if ((LvmStatus) == LVREV_NULLADDRESS){\
- ALOGV("\tLVREV_ERROR : Parameter error - "\
- "null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
- }\
- if ((LvmStatus) == LVREV_INVALIDNUMSAMPLES){\
- ALOGV("\tLVREV_ERROR : Parameter error - "\
- "bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
- }\
- if ((LvmStatus) == LVREV_OUTOFRANGE){\
- ALOGV("\tLVREV_ERROR : Parameter error - "\
- "out of range returned by %s in %s\n", callingFunc, calledFunc);\
- }\
+#define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc) \
+ { \
+ if ((LvmStatus) == LVREV_NULLADDRESS) { \
+ ALOGV("\tLVREV_ERROR : Parameter error - " \
+ "null pointer returned by %s in %s\n\n\n\n", \
+ callingFunc, calledFunc); \
+ } \
+ if ((LvmStatus) == LVREV_INVALIDNUMSAMPLES) { \
+ ALOGV("\tLVREV_ERROR : Parameter error - " \
+ "bad number of samples returned by %s in %s\n\n\n\n", \
+ callingFunc, calledFunc); \
+ } \
+ if ((LvmStatus) == LVREV_OUTOFRANGE) { \
+ ALOGV("\tLVREV_ERROR : Parameter error - " \
+ "out of range returned by %s in %s\n", \
+ callingFunc, calledFunc); \
+ } \
}
// Namespaces
@@ -81,8 +85,8 @@
// NXP SW auxiliary environmental reverb
const effect_descriptor_t gAuxEnvReverbDescriptor = {
- { 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e } },
- { 0x4a387fc0, 0x8ab3, 0x11df, 0x8bad, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } },
+ {0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, {0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e}},
+ {0x4a387fc0, 0x8ab3, 0x11df, 0x8bad, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
EFFECT_CONTROL_API_VERSION,
EFFECT_FLAG_TYPE_AUXILIARY,
LVREV_CUP_LOAD_ARM9E,
@@ -128,42 +132,39 @@
};
// gDescriptors contains pointers to all defined effect descriptor in this library
-static const effect_descriptor_t * const gDescriptors[] = {
- &gAuxEnvReverbDescriptor,
- &gInsertEnvReverbDescriptor,
- &gAuxPresetReverbDescriptor,
- &gInsertPresetReverbDescriptor
-};
+static const effect_descriptor_t* const gDescriptors[] = {
+ &gAuxEnvReverbDescriptor, &gInsertEnvReverbDescriptor, &gAuxPresetReverbDescriptor,
+ &gInsertPresetReverbDescriptor};
-typedef float process_buffer_t; // process in float
+typedef float process_buffer_t; // process in float
-struct ReverbContext{
- const struct effect_interface_s *itfe;
- effect_config_t config;
- LVREV_Handle_t hInstance;
- int16_t SavedRoomLevel;
- int16_t SavedHfLevel;
- int16_t SavedDecayTime;
- int16_t SavedDecayHfRatio;
- int16_t SavedReverbLevel;
- int16_t SavedDiffusion;
- int16_t SavedDensity;
- bool bEnabled;
- LVM_Fs_en SampleRate;
- process_buffer_t *InFrames;
- process_buffer_t *OutFrames;
- size_t bufferSizeIn;
- size_t bufferSizeOut;
- bool auxiliary;
- bool preset;
- uint16_t curPreset;
- uint16_t nextPreset;
- int SamplesToExitCount;
- LVM_INT16 leftVolume;
- LVM_INT16 rightVolume;
- LVM_INT16 prevLeftVolume;
- LVM_INT16 prevRightVolume;
- int volumeMode;
+struct ReverbContext {
+ const struct effect_interface_s* itfe;
+ effect_config_t config;
+ LVREV_Handle_t hInstance;
+ int16_t SavedRoomLevel;
+ int16_t SavedHfLevel;
+ int16_t SavedDecayTime;
+ int16_t SavedDecayHfRatio;
+ int16_t SavedReverbLevel;
+ int16_t SavedDiffusion;
+ int16_t SavedDensity;
+ bool bEnabled;
+ LVM_Fs_en SampleRate;
+ process_buffer_t* InFrames;
+ process_buffer_t* OutFrames;
+ size_t bufferSizeIn;
+ size_t bufferSizeOut;
+ bool auxiliary;
+ bool preset;
+ uint16_t curPreset;
+ uint16_t nextPreset;
+ int SamplesToExitCount;
+ LVM_INT16 leftVolume;
+ LVM_INT16 rightVolume;
+ LVM_INT16 prevLeftVolume;
+ LVM_INT16 prevRightVolume;
+ int volumeMode;
};
enum {
@@ -174,44 +175,38 @@
#define REVERB_DEFAULT_PRESET REVERB_PRESET_NONE
-#define REVERB_SEND_LEVEL 0.75f // 0.75 in 4.12 format
-#define REVERB_UNIT_VOLUME (0x1000) // 1.0 in 4.12 format
+#define REVERB_SEND_LEVEL 0.75f // 0.75 in 4.12 format
+#define REVERB_UNIT_VOLUME (0x1000) // 1.0 in 4.12 format
//--- local function prototypes
-int Reverb_init (ReverbContext *pContext);
-void Reverb_free (ReverbContext *pContext);
-int Reverb_setConfig (ReverbContext *pContext, effect_config_t *pConfig);
-void Reverb_getConfig (ReverbContext *pContext, effect_config_t *pConfig);
-int Reverb_setParameter (ReverbContext *pContext, void *pParam, void *pValue, int vsize);
-int Reverb_getParameter (ReverbContext *pContext,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue);
-int Reverb_LoadPreset (ReverbContext *pContext);
-int Reverb_paramValueSize (int32_t param);
+int Reverb_init(ReverbContext* pContext);
+void Reverb_free(ReverbContext* pContext);
+int Reverb_setConfig(ReverbContext* pContext, effect_config_t* pConfig);
+void Reverb_getConfig(ReverbContext* pContext, effect_config_t* pConfig);
+int Reverb_setParameter(ReverbContext* pContext, void* pParam, void* pValue, int vsize);
+int Reverb_getParameter(ReverbContext* pContext, void* pParam, uint32_t* pValueSize, void* pValue);
+int Reverb_LoadPreset(ReverbContext* pContext);
+int Reverb_paramValueSize(int32_t param);
/* Effect Library Interface Implementation */
-extern "C" int EffectCreate(const effect_uuid_t *uuid,
- int32_t sessionId __unused,
- int32_t ioId __unused,
- effect_handle_t *pHandle){
+extern "C" int EffectCreate(const effect_uuid_t* uuid, int32_t sessionId __unused,
+ int32_t ioId __unused, effect_handle_t* pHandle) {
int ret;
int i;
- int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
- const effect_descriptor_t *desc;
+ int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t*);
+ const effect_descriptor_t* desc;
ALOGV("\t\nEffectCreate start");
- if (pHandle == NULL || uuid == NULL){
+ if (pHandle == NULL || uuid == NULL) {
ALOGV("\tLVM_ERROR : EffectCreate() called with NULL pointer");
return -EINVAL;
}
for (i = 0; i < length; i++) {
desc = gDescriptors[i];
- if (memcmp(uuid, &desc->uuid, sizeof(effect_uuid_t))
- == 0) {
+ if (memcmp(uuid, &desc->uuid, sizeof(effect_uuid_t)) == 0) {
ALOGV("\tEffectCreate - UUID matched Reverb type %d, UUID = %x", i, desc->uuid.timeLow);
break;
}
@@ -221,16 +216,16 @@
return -ENOENT;
}
- ReverbContext *pContext = new ReverbContext;
+ ReverbContext* pContext = new ReverbContext;
- pContext->itfe = &gReverbInterface;
+ pContext->itfe = &gReverbInterface;
pContext->hInstance = NULL;
pContext->auxiliary = false;
- if ((desc->flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY){
+ if ((desc->flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY) {
pContext->auxiliary = true;
ALOGV("\tEffectCreate - AUX");
- }else{
+ } else {
ALOGV("\tEffectCreate - INS");
}
@@ -241,14 +236,14 @@
pContext->curPreset = REVERB_PRESET_LAST + 1;
pContext->nextPreset = REVERB_DEFAULT_PRESET;
ALOGV("\tEffectCreate - PRESET");
- }else{
+ } else {
ALOGV("\tEffectCreate - ENVIRONMENTAL");
}
ALOGV("\tEffectCreate - Calling Reverb_init");
ret = Reverb_init(pContext);
- if (ret < 0){
+ if (ret < 0) {
ALOGV("\tLVM_ERROR : EffectCreate() init failed");
delete pContext;
return ret;
@@ -256,26 +251,25 @@
*pHandle = (effect_handle_t)pContext;
-
int channels = audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
- channels = (pContext->auxiliary == true)? channels : FCC_2;
+ channels = (pContext->auxiliary == true) ? channels : FCC_2;
// Allocate memory for reverb process (*2 is for STEREO)
pContext->bufferSizeIn = LVREV_MAX_FRAME_SIZE * sizeof(process_buffer_t) * channels;
pContext->bufferSizeOut = LVREV_MAX_FRAME_SIZE * sizeof(process_buffer_t) * FCC_2;
- pContext->InFrames = (process_buffer_t *)calloc(pContext->bufferSizeIn, 1 /* size */);
- pContext->OutFrames = (process_buffer_t *)calloc(pContext->bufferSizeOut, 1 /* size */);
+ pContext->InFrames = (process_buffer_t*)calloc(pContext->bufferSizeIn, 1 /* size */);
+ pContext->OutFrames = (process_buffer_t*)calloc(pContext->bufferSizeOut, 1 /* size */);
ALOGV("\tEffectCreate %p, size %zu", pContext, sizeof(ReverbContext));
ALOGV("\tEffectCreate end\n");
return 0;
} /* end EffectCreate */
-extern "C" int EffectRelease(effect_handle_t handle){
- ReverbContext * pContext = (ReverbContext *)handle;
+extern "C" int EffectRelease(effect_handle_t handle) {
+ ReverbContext* pContext = (ReverbContext*)handle;
ALOGV("\tEffectRelease %p", handle);
- if (pContext == NULL){
+ if (pContext == NULL) {
ALOGV("\tLVM_ERROR : EffectRelease called with NULL pointer");
return -EINVAL;
}
@@ -289,12 +283,11 @@
return 0;
} /* end EffectRelease */
-extern "C" int EffectGetDescriptor(const effect_uuid_t *uuid,
- effect_descriptor_t *pDescriptor) {
+extern "C" int EffectGetDescriptor(const effect_uuid_t* uuid, effect_descriptor_t* pDescriptor) {
int i;
- int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t *);
+ int length = sizeof(gDescriptors) / sizeof(const effect_descriptor_t*);
- if (pDescriptor == NULL || uuid == NULL){
+ if (pDescriptor == NULL || uuid == NULL) {
ALOGV("EffectGetDescriptor() called with NULL pointer");
return -EINVAL;
}
@@ -302,8 +295,8 @@
for (i = 0; i < length; i++) {
if (memcmp(uuid, &gDescriptors[i]->uuid, sizeof(effect_uuid_t)) == 0) {
*pDescriptor = *gDescriptors[i];
- ALOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x",
- i, gDescriptors[i]->uuid.timeLow);
+ ALOGV("EffectGetDescriptor - UUID matched Reverb type %d, UUID = %x", i,
+ gDescriptors[i]->uuid.timeLow);
return 0;
}
}
@@ -312,12 +305,13 @@
} /* end EffectGetDescriptor */
/* local functions */
-#define CHECK_ARG(cond) { \
- if (!(cond)) { \
- ALOGV("\tLVM_ERROR : Invalid argument: "#cond); \
- return -EINVAL; \
- } \
-}
+#define CHECK_ARG(cond) \
+ { \
+ if (!(cond)) { \
+ ALOGV("\tLVM_ERROR : Invalid argument: " #cond); \
+ return -EINVAL; \
+ } \
+ }
//----------------------------------------------------------------------------
// process()
@@ -336,13 +330,9 @@
// pOut: pointer to updated stereo 16 bit output data
//
//----------------------------------------------------------------------------
-int process( effect_buffer_t *pIn,
- effect_buffer_t *pOut,
- int frameCount,
- ReverbContext *pContext){
-
+int process(effect_buffer_t* pIn, effect_buffer_t* pOut, int frameCount, ReverbContext* pContext) {
int channels = audio_channel_count_from_out_mask(pContext->config.inputCfg.channels);
- LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
// Reverb only effects the stereo channels in multichannel source.
if (channels < 1 || channels > LVM_MAX_CHANNELS) {
@@ -352,71 +342,66 @@
size_t inSize = frameCount * sizeof(process_buffer_t) * channels;
size_t outSize = frameCount * sizeof(process_buffer_t) * FCC_2;
- if (pContext->InFrames == NULL ||
- pContext->bufferSizeIn < inSize) {
+ if (pContext->InFrames == NULL || pContext->bufferSizeIn < inSize) {
free(pContext->InFrames);
pContext->bufferSizeIn = inSize;
- pContext->InFrames = (process_buffer_t *)calloc(1, pContext->bufferSizeIn);
+ pContext->InFrames = (process_buffer_t*)calloc(1, pContext->bufferSizeIn);
}
- if (pContext->OutFrames == NULL ||
- pContext->bufferSizeOut < outSize) {
+ if (pContext->OutFrames == NULL || pContext->bufferSizeOut < outSize) {
free(pContext->OutFrames);
pContext->bufferSizeOut = outSize;
- pContext->OutFrames = (process_buffer_t *)calloc(1, pContext->bufferSizeOut);
+ pContext->OutFrames = (process_buffer_t*)calloc(1, pContext->bufferSizeOut);
}
-
// Check for NULL pointers
if ((pContext->InFrames == NULL) || (pContext->OutFrames == NULL)) {
ALOGE("\tLVREV_ERROR : process failed to allocate memory for temporary buffers ");
return -EINVAL;
}
-
if (pContext->preset && pContext->nextPreset != pContext->curPreset) {
Reverb_LoadPreset(pContext);
}
if (pContext->auxiliary) {
static_assert(std::is_same<decltype(*pIn), decltype(*pContext->InFrames)>::value,
- "pIn and InFrames must be same type");
+ "pIn and InFrames must be same type");
memcpy(pContext->InFrames, pIn, frameCount * channels * sizeof(*pIn));
} else {
// mono input is duplicated
if (channels >= FCC_2) {
for (int i = 0; i < frameCount; i++) {
pContext->InFrames[FCC_2 * i] =
- (process_buffer_t)pIn[channels * i] * REVERB_SEND_LEVEL;
+ (process_buffer_t)pIn[channels * i] * REVERB_SEND_LEVEL;
pContext->InFrames[FCC_2 * i + 1] =
- (process_buffer_t)pIn[channels * i + 1] * REVERB_SEND_LEVEL;
+ (process_buffer_t)pIn[channels * i + 1] * REVERB_SEND_LEVEL;
}
} else {
for (int i = 0; i < frameCount; i++) {
pContext->InFrames[FCC_2 * i] = pContext->InFrames[FCC_2 * i + 1] =
- (process_buffer_t)pIn[i] * REVERB_SEND_LEVEL;
+ (process_buffer_t)pIn[i] * REVERB_SEND_LEVEL;
}
}
}
if (pContext->preset && pContext->curPreset == REVERB_PRESET_NONE) {
memset(pContext->OutFrames, 0,
- frameCount * sizeof(*pContext->OutFrames) * FCC_2); //always stereo here
+ frameCount * sizeof(*pContext->OutFrames) * FCC_2); // always stereo here
} else {
- if(pContext->bEnabled == LVM_FALSE && pContext->SamplesToExitCount > 0) {
- memset(pContext->InFrames, 0,
- frameCount * sizeof(*pContext->OutFrames) * channels);
+ if (pContext->bEnabled == LVM_FALSE && pContext->SamplesToExitCount > 0) {
+ memset(pContext->InFrames, 0, frameCount * sizeof(*pContext->OutFrames) * channels);
ALOGV("\tZeroing %d samples per frame at the end of call", channels);
}
/* Process the samples, producing a stereo output */
- LvmStatus = LVREV_Process(pContext->hInstance, /* Instance handle */
- pContext->InFrames, /* Input buffer */
- pContext->OutFrames, /* Output buffer */
- frameCount); /* Number of samples to read */
+ LvmStatus = LVREV_Process(pContext->hInstance, /* Instance handle */
+ pContext->InFrames, /* Input buffer */
+ pContext->OutFrames, /* Output buffer */
+ frameCount); /* Number of samples to read */
}
LVM_ERROR_CHECK(LvmStatus, "LVREV_Process", "process")
- if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVREV_SUCCESS) return -EINVAL;
// Convert to 16 bits
if (pContext->auxiliary) {
@@ -437,8 +422,8 @@
}
// apply volume with ramp if needed
if ((pContext->leftVolume != pContext->prevLeftVolume ||
- pContext->rightVolume != pContext->prevRightVolume) &&
- pContext->volumeMode == REVERB_VOLUME_RAMP) {
+ pContext->rightVolume != pContext->prevRightVolume) &&
+ pContext->volumeMode == REVERB_VOLUME_RAMP) {
// FIXME: still using int16 volumes.
// For reference: REVERB_UNIT_VOLUME (0x1000) // 1.0 in 4.12 format
float vl = (float)pContext->prevLeftVolume / 4096;
@@ -470,7 +455,7 @@
}
if (channels > 2) {
- //Accumulate if required
+ // Accumulate if required
if (pContext->config.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) {
for (int i = 0; i < frameCount; i++) {
pOut[channels * i] += pContext->OutFrames[FCC_2 * i];
@@ -497,7 +482,7 @@
}
}
return 0;
-} /* end process */
+} /* end process */
//----------------------------------------------------------------------------
// Reverb_free()
@@ -511,30 +496,28 @@
//
//----------------------------------------------------------------------------
-void Reverb_free(ReverbContext *pContext){
-
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
- LVREV_MemoryTable_st MemTab;
+void Reverb_free(ReverbContext* pContext) {
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVREV_MemoryTable_st MemTab;
/* Free the algorithm memory */
- LvmStatus = LVREV_GetMemoryTable(pContext->hInstance,
- &MemTab,
- LVM_NULL);
+ LvmStatus = LVREV_GetMemoryTable(pContext->hInstance, &MemTab, LVM_NULL);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetMemoryTable", "Reverb_free")
- for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
- if (MemTab.Region[i].Size != 0){
- if (MemTab.Region[i].pBaseAddress != NULL){
+ for (int i = 0; i < LVM_NR_MEMORY_REGIONS; i++) {
+ if (MemTab.Region[i].Size != 0) {
+ if (MemTab.Region[i].pBaseAddress != NULL) {
free(MemTab.Region[i].pBaseAddress);
- }else{
- ALOGV("\tLVM_ERROR : free() - trying to free with NULL pointer %" PRIu32 " bytes "
- "for region %u at %p ERROR\n",
- MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
+ } else {
+ ALOGV("\tLVM_ERROR : free() - trying to free with NULL pointer %" PRIu32
+ " bytes "
+ "for region %u at %p ERROR\n",
+ MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
}
}
}
-} /* end Reverb_free */
+} /* end Reverb_free */
//----------------------------------------------------------------------------
// Reverb_setConfig()
@@ -550,9 +533,9 @@
//
//----------------------------------------------------------------------------
-int Reverb_setConfig(ReverbContext *pContext, effect_config_t *pConfig){
- LVM_Fs_en SampleRate;
- //ALOGV("\tReverb_setConfig start");
+int Reverb_setConfig(ReverbContext* pContext, effect_config_t* pConfig) {
+ LVM_Fs_en SampleRate;
+ // ALOGV("\tReverb_setConfig start");
CHECK_ARG(pContext != NULL);
CHECK_ARG(pConfig != NULL);
@@ -561,81 +544,78 @@
CHECK_ARG(pConfig->inputCfg.format == pConfig->outputCfg.format);
int inputChannels = audio_channel_count_from_out_mask(pConfig->inputCfg.channels);
CHECK_ARG((pContext->auxiliary && pConfig->inputCfg.channels == AUDIO_CHANNEL_OUT_MONO) ||
- ((!pContext->auxiliary) &&
- (inputChannels <= LVM_MAX_CHANNELS)));
+ ((!pContext->auxiliary) && (inputChannels <= LVM_MAX_CHANNELS)));
int outputChannels = audio_channel_count_from_out_mask(pConfig->outputCfg.channels);
CHECK_ARG(outputChannels >= FCC_2 && outputChannels <= LVM_MAX_CHANNELS);
- CHECK_ARG(pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE
- || pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE);
+ CHECK_ARG(pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE ||
+ pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE);
CHECK_ARG(pConfig->inputCfg.format == EFFECT_BUFFER_FORMAT);
- //ALOGV("\tReverb_setConfig calling memcpy");
+ // ALOGV("\tReverb_setConfig calling memcpy");
pContext->config = *pConfig;
switch (pConfig->inputCfg.samplingRate) {
- case 8000:
- SampleRate = LVM_FS_8000;
- break;
- case 16000:
- SampleRate = LVM_FS_16000;
- break;
- case 22050:
- SampleRate = LVM_FS_22050;
- break;
- case 32000:
- SampleRate = LVM_FS_32000;
- break;
- case 44100:
- SampleRate = LVM_FS_44100;
- break;
- case 48000:
- SampleRate = LVM_FS_48000;
- break;
- case 88200:
- SampleRate = LVM_FS_88200;
- break;
- case 96000:
- SampleRate = LVM_FS_96000;
- break;
- case 176400:
- SampleRate = LVM_FS_176400;
- break;
- case 192000:
- SampleRate = LVM_FS_192000;
- break;
- default:
- ALOGV("\rReverb_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
- return -EINVAL;
+ case 8000:
+ SampleRate = LVM_FS_8000;
+ break;
+ case 16000:
+ SampleRate = LVM_FS_16000;
+ break;
+ case 22050:
+ SampleRate = LVM_FS_22050;
+ break;
+ case 32000:
+ SampleRate = LVM_FS_32000;
+ break;
+ case 44100:
+ SampleRate = LVM_FS_44100;
+ break;
+ case 48000:
+ SampleRate = LVM_FS_48000;
+ break;
+ case 88200:
+ SampleRate = LVM_FS_88200;
+ break;
+ case 96000:
+ SampleRate = LVM_FS_96000;
+ break;
+ case 176400:
+ SampleRate = LVM_FS_176400;
+ break;
+ case 192000:
+ SampleRate = LVM_FS_192000;
+ break;
+ default:
+ ALOGV("\rReverb_setConfig invalid sampling rate %d", pConfig->inputCfg.samplingRate);
+ return -EINVAL;
}
if (pContext->SampleRate != SampleRate) {
+ LVREV_ControlParams_st ActiveParams;
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS;
- LVREV_ControlParams_st ActiveParams;
- LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS;
-
- //ALOGV("\tReverb_setConfig change sampling rate to %d", SampleRate);
+ // ALOGV("\tReverb_setConfig change sampling rate to %d", SampleRate);
/* Get the current settings */
- LvmStatus = LVREV_GetControlParameters(pContext->hInstance,
- &ActiveParams);
+ LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "Reverb_setConfig")
- if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVREV_SUCCESS) return -EINVAL;
ActiveParams.SampleRate = SampleRate;
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "Reverb_setConfig")
- if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
- //ALOGV("\tReverb_setConfig Succesfully called LVREV_SetControlParameters\n");
+ if (LvmStatus != LVREV_SUCCESS) return -EINVAL;
+ // ALOGV("\tReverb_setConfig Successfully called LVREV_SetControlParameters\n");
pContext->SampleRate = SampleRate;
- }else{
- //ALOGV("\tReverb_setConfig keep sampling rate at %d", SampleRate);
+ } else {
+ // ALOGV("\tReverb_setConfig keep sampling rate at %d", SampleRate);
}
- //ALOGV("\tReverb_setConfig End");
+ // ALOGV("\tReverb_setConfig End");
return 0;
-} /* end Reverb_setConfig */
+} /* end Reverb_setConfig */
//----------------------------------------------------------------------------
// Reverb_getConfig()
@@ -651,10 +631,9 @@
//
//----------------------------------------------------------------------------
-void Reverb_getConfig(ReverbContext *pContext, effect_config_t *pConfig)
-{
+void Reverb_getConfig(ReverbContext* pContext, effect_config_t* pConfig) {
*pConfig = pContext->config;
-} /* end Reverb_getConfig */
+} /* end Reverb_getConfig */
//----------------------------------------------------------------------------
// Reverb_init()
@@ -668,35 +647,35 @@
//
//----------------------------------------------------------------------------
-int Reverb_init(ReverbContext *pContext){
+int Reverb_init(ReverbContext* pContext) {
ALOGV("\tReverb_init start");
CHECK_ARG(pContext != NULL);
- if (pContext->hInstance != NULL){
+ if (pContext->hInstance != NULL) {
Reverb_free(pContext);
}
- pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
+ pContext->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
if (pContext->auxiliary) {
- pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_MONO;
+ pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_MONO;
} else {
- pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
}
- pContext->config.inputCfg.format = EFFECT_BUFFER_FORMAT;
- pContext->config.inputCfg.samplingRate = 44100;
- pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
- pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
- pContext->config.inputCfg.bufferProvider.cookie = NULL;
- pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
- pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
- pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
- pContext->config.outputCfg.format = EFFECT_BUFFER_FORMAT;
- pContext->config.outputCfg.samplingRate = 44100;
- pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
+ pContext->config.inputCfg.format = EFFECT_BUFFER_FORMAT;
+ pContext->config.inputCfg.samplingRate = 44100;
+ pContext->config.inputCfg.bufferProvider.getBuffer = NULL;
+ pContext->config.inputCfg.bufferProvider.releaseBuffer = NULL;
+ pContext->config.inputCfg.bufferProvider.cookie = NULL;
+ pContext->config.inputCfg.mask = EFFECT_CONFIG_ALL;
+ pContext->config.outputCfg.accessMode = EFFECT_BUFFER_ACCESS_ACCUMULATE;
+ pContext->config.outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
+ pContext->config.outputCfg.format = EFFECT_BUFFER_FORMAT;
+ pContext->config.outputCfg.samplingRate = 44100;
+ pContext->config.outputCfg.bufferProvider.getBuffer = NULL;
pContext->config.outputCfg.bufferProvider.releaseBuffer = NULL;
- pContext->config.outputCfg.bufferProvider.cookie = NULL;
- pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL;
+ pContext->config.outputCfg.bufferProvider.cookie = NULL;
+ pContext->config.outputCfg.mask = EFFECT_CONFIG_ALL;
pContext->leftVolume = REVERB_UNIT_VOLUME;
pContext->rightVolume = REVERB_UNIT_VOLUME;
@@ -704,40 +683,39 @@
pContext->prevRightVolume = REVERB_UNIT_VOLUME;
pContext->volumeMode = REVERB_VOLUME_FLAT;
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
- LVREV_ControlParams_st params; /* Control Parameters */
- LVREV_InstanceParams_st InstParams; /* Instance parameters */
- LVREV_MemoryTable_st MemTab; /* Memory allocation table */
- bool bMallocFailure = LVM_FALSE;
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st params; /* Control Parameters */
+ LVREV_InstanceParams_st InstParams; /* Instance parameters */
+ LVREV_MemoryTable_st MemTab; /* Memory allocation table */
+ bool bMallocFailure = LVM_FALSE;
/* Set the capabilities */
- InstParams.MaxBlockSize = MAX_CALL_SIZE;
- InstParams.SourceFormat = LVM_STEREO; // Max format, could be mono during process
- InstParams.NumDelays = LVREV_DELAYLINES_4;
+ InstParams.MaxBlockSize = MAX_CALL_SIZE;
+ InstParams.SourceFormat = LVM_STEREO; // Max format, could be mono during process
+ InstParams.NumDelays = LVREV_DELAYLINES_4;
/* Allocate memory, forcing alignment */
- LvmStatus = LVREV_GetMemoryTable(LVM_NULL,
- &MemTab,
- &InstParams);
+ LvmStatus = LVREV_GetMemoryTable(LVM_NULL, &MemTab, &InstParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetMemoryTable", "Reverb_init")
- if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVREV_SUCCESS) return -EINVAL;
- ALOGV("\tCreateInstance Succesfully called LVM_GetMemoryTable\n");
+ ALOGV("\tCreateInstance Successfully called LVM_GetMemoryTable\n");
/* Allocate memory */
- for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
- if (MemTab.Region[i].Size != 0){
+ for (int i = 0; i < LVM_NR_MEMORY_REGIONS; i++) {
+ if (MemTab.Region[i].Size != 0) {
MemTab.Region[i].pBaseAddress = calloc(1, MemTab.Region[i].Size);
- if (MemTab.Region[i].pBaseAddress == LVM_NULL){
+ if (MemTab.Region[i].pBaseAddress == LVM_NULL) {
ALOGV("\tLVREV_ERROR :Reverb_init CreateInstance Failed to allocate %" PRIu32
- " bytes for region %u\n", MemTab.Region[i].Size, i );
+ " bytes for region %u\n",
+ MemTab.Region[i].Size, i);
bMallocFailure = LVM_TRUE;
- }else{
+ } else {
ALOGV("\tReverb_init CreateInstance allocate %" PRIu32
- " bytes for region %u at %p\n",
- MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
+ " bytes for region %u at %p\n",
+ MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
}
}
}
@@ -745,85 +723,83 @@
/* If one or more of the memory regions failed to allocate, free the regions that were
* succesfully allocated and return with an error
*/
- if(bMallocFailure == LVM_TRUE){
- for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
- if (MemTab.Region[i].pBaseAddress == LVM_NULL){
+ if (bMallocFailure == LVM_TRUE) {
+ for (int i = 0; i < LVM_NR_MEMORY_REGIONS; i++) {
+ if (MemTab.Region[i].pBaseAddress == LVM_NULL) {
ALOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed to allocate %" PRIu32
- " bytes for region %u - Not freeing\n", MemTab.Region[i].Size, i );
- }else{
+ " bytes for region %u - Not freeing\n",
+ MemTab.Region[i].Size, i);
+ } else {
ALOGV("\tLVM_ERROR :Reverb_init CreateInstance Failed: but allocated %" PRIu32
- " bytes for region %u at %p- free\n",
- MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
+ " bytes for region %u at %p- free\n",
+ MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress);
free(MemTab.Region[i].pBaseAddress);
}
}
return -EINVAL;
}
- ALOGV("\tReverb_init CreateInstance Succesfully malloc'd memory\n");
+ ALOGV("\tReverb_init CreateInstance Successfully malloc'd memory\n");
/* Initialise */
pContext->hInstance = LVM_NULL;
/* Init sets the instance handle */
- LvmStatus = LVREV_GetInstanceHandle(&pContext->hInstance,
- &MemTab,
- &InstParams);
+ LvmStatus = LVREV_GetInstanceHandle(&pContext->hInstance, &MemTab, &InstParams);
LVM_ERROR_CHECK(LvmStatus, "LVM_GetInstanceHandle", "Reverb_init")
- if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVREV_SUCCESS) return -EINVAL;
- ALOGV("\tReverb_init CreateInstance Succesfully called LVM_GetInstanceHandle\n");
+ ALOGV("\tReverb_init CreateInstance Successfully called LVM_GetInstanceHandle\n");
/* Set the initial process parameters */
/* General parameters */
- params.OperatingMode = LVM_MODE_ON;
- params.SampleRate = LVM_FS_44100;
- pContext->SampleRate = LVM_FS_44100;
+ params.OperatingMode = LVM_MODE_ON;
+ params.SampleRate = LVM_FS_44100;
+ pContext->SampleRate = LVM_FS_44100;
- if(pContext->config.inputCfg.channels == AUDIO_CHANNEL_OUT_MONO){
- params.SourceFormat = LVM_MONO;
+ if (pContext->config.inputCfg.channels == AUDIO_CHANNEL_OUT_MONO) {
+ params.SourceFormat = LVM_MONO;
} else {
- params.SourceFormat = LVM_STEREO;
+ params.SourceFormat = LVM_STEREO;
}
if ((pContext->auxiliary == false) && (params.SourceFormat == LVM_MONO)) {
- params.SourceFormat = LVM_STEREO;
+ params.SourceFormat = LVM_STEREO;
}
/* Reverb parameters */
- params.Level = 0;
- params.LPF = 23999;
- params.HPF = 50;
- params.T60 = 1490;
- params.Density = 100;
- params.Damping = 21;
- params.RoomSize = 100;
+ params.Level = 0;
+ params.LPF = 23999;
+ params.HPF = 50;
+ params.T60 = 1490;
+ params.Density = 100;
+ params.Damping = 21;
+ params.RoomSize = 100;
- pContext->SamplesToExitCount = (params.T60 * pContext->config.inputCfg.samplingRate)/1000;
+ pContext->SamplesToExitCount = (params.T60 * pContext->config.inputCfg.samplingRate) / 1000;
/* 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
* quantisation like effect when returning
*/
- pContext->SavedRoomLevel = -6000;
- pContext->SavedHfLevel = 0;
- pContext->bEnabled = LVM_FALSE;
- pContext->SavedDecayTime = params.T60;
- pContext->SavedDecayHfRatio = params.Damping*20;
- pContext->SavedDensity = params.RoomSize*10;
- pContext->SavedDiffusion = params.Density*10;
- pContext->SavedReverbLevel = -6000;
+ pContext->SavedRoomLevel = -6000;
+ pContext->SavedHfLevel = 0;
+ pContext->bEnabled = LVM_FALSE;
+ pContext->SavedDecayTime = params.T60;
+ pContext->SavedDecayHfRatio = params.Damping * 20;
+ pContext->SavedDensity = params.RoomSize * 10;
+ pContext->SavedDiffusion = params.Density * 10;
+ pContext->SavedReverbLevel = -6000;
/* Activate the initial settings */
- LvmStatus = LVREV_SetControlParameters(pContext->hInstance,
- ¶ms);
+ LvmStatus = LVREV_SetControlParameters(pContext->hInstance, ¶ms);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "Reverb_init")
- if(LvmStatus != LVREV_SUCCESS) return -EINVAL;
+ if (LvmStatus != LVREV_SUCCESS) return -EINVAL;
- ALOGV("\tReverb_init CreateInstance Succesfully called LVREV_SetControlParameters\n");
+ ALOGV("\tReverb_init CreateInstance Successfully called LVREV_SetControlParameters\n");
ALOGV("\tReverb_init End");
return 0;
-} /* end Reverb_init */
+} /* end Reverb_init */
//----------------------------------------------------------------------------
// ReverbConvertLevel()
@@ -836,27 +812,21 @@
//
//----------------------------------------------------------------------------
-int16_t ReverbConvertLevel(int16_t level){
- static int16_t LevelArray[101] =
- {
- -12000, -4000, -3398, -3046, -2796, -2603, -2444, -2310, -2194, -2092,
- -2000, -1918, -1842, -1773, -1708, -1648, -1592, -1540, -1490, -1443,
- -1398, -1356, -1316, -1277, -1240, -1205, -1171, -1138, -1106, -1076,
- -1046, -1018, -990, -963, -938, -912, -888, -864, -841, -818,
- -796, -775, -754, -734, -714, -694, -675, -656, -638, -620,
- -603, -585, -568, -552, -536, -520, -504, -489, -474, -459,
- -444, -430, -416, -402, -388, -375, -361, -348, -335, -323,
- -310, -298, -286, -274, -262, -250, -239, -228, -216, -205,
- -194, -184, -173, -162, -152, -142, -132, -121, -112, -102,
- -92, -82, -73, -64, -54, -45, -36, -27, -18, -9,
- 0
- };
+int16_t ReverbConvertLevel(int16_t level) {
+ static int16_t LevelArray[101] = {
+ -12000, -4000, -3398, -3046, -2796, -2603, -2444, -2310, -2194, -2092, -2000, -1918,
+ -1842, -1773, -1708, -1648, -1592, -1540, -1490, -1443, -1398, -1356, -1316, -1277,
+ -1240, -1205, -1171, -1138, -1106, -1076, -1046, -1018, -990, -963, -938, -912,
+ -888, -864, -841, -818, -796, -775, -754, -734, -714, -694, -675, -656,
+ -638, -620, -603, -585, -568, -552, -536, -520, -504, -489, -474, -459,
+ -444, -430, -416, -402, -388, -375, -361, -348, -335, -323, -310, -298,
+ -286, -274, -262, -250, -239, -228, -216, -205, -194, -184, -173, -162,
+ -152, -142, -132, -121, -112, -102, -92, -82, -73, -64, -54, -45,
+ -36, -27, -18, -9, 0};
int16_t i;
- for(i = 0; i < 101; i++)
- {
- if(level <= LevelArray[i])
- break;
+ for (i = 0; i < 101; i++) {
+ if (level <= LevelArray[i]) break;
}
return i;
}
@@ -872,37 +842,31 @@
//
//----------------------------------------------------------------------------
-int16_t ReverbConvertHfLevel(int16_t Hflevel){
+int16_t ReverbConvertHfLevel(int16_t Hflevel) {
int16_t i;
- static LPFPair_t LPFArray[97] =
- { // Limit range to 50 for LVREV parameter range
- {-10000, 50}, { -5000, 50 }, { -4000, 50}, { -3000, 158}, { -2000, 502},
- {-1000, 1666},{ -900, 1897}, { -800, 2169}, { -700, 2496}, { -600, 2895},
- {-500, 3400}, { -400, 4066}, { -300, 5011}, { -200, 6537}, { -100, 9826},
- {-99, 9881 }, { -98, 9937 }, { -97, 9994 }, { -96, 10052}, { -95, 10111},
- {-94, 10171}, { -93, 10231}, { -92, 10293}, { -91, 10356}, { -90, 10419},
- {-89, 10484}, { -88, 10549}, { -87, 10616}, { -86, 10684}, { -85, 10753},
- {-84, 10823}, { -83, 10895}, { -82, 10968}, { -81, 11042}, { -80, 11117},
- {-79, 11194}, { -78, 11272}, { -77, 11352}, { -76, 11433}, { -75, 11516},
- {-74, 11600}, { -73, 11686}, { -72, 11774}, { -71, 11864}, { -70, 11955},
- {-69, 12049}, { -68, 12144}, { -67, 12242}, { -66, 12341}, { -65, 12443},
- {-64, 12548}, { -63, 12654}, { -62, 12763}, { -61, 12875}, { -60, 12990},
- {-59, 13107}, { -58, 13227}, { -57, 13351}, { -56, 13477}, { -55, 13607},
- {-54, 13741}, { -53, 13878}, { -52, 14019}, { -51, 14164}, { -50, 14313},
- {-49, 14467}, { -48, 14626}, { -47, 14789}, { -46, 14958}, { -45, 15132},
- {-44, 15312}, { -43, 15498}, { -42, 15691}, { -41, 15890}, { -40, 16097},
- {-39, 16311}, { -38, 16534}, { -37, 16766}, { -36, 17007}, { -35, 17259},
- {-34, 17521}, { -33, 17795}, { -32, 18081}, { -31, 18381}, { -30, 18696},
- {-29, 19027}, { -28, 19375}, { -27, 19742}, { -26, 20129}, { -25, 20540},
- {-24, 20976}, { -23, 21439}, { -22, 21934}, { -21, 22463}, { -20, 23031},
- {-19, 23643}, { -18, 23999}
- };
+ static LPFPair_t LPFArray[97] = {
+ // Limit range to 50 for LVREV parameter range
+ {-10000, 50}, {-5000, 50}, {-4000, 50}, {-3000, 158}, {-2000, 502}, {-1000, 1666},
+ {-900, 1897}, {-800, 2169}, {-700, 2496}, {-600, 2895}, {-500, 3400}, {-400, 4066},
+ {-300, 5011}, {-200, 6537}, {-100, 9826}, {-99, 9881}, {-98, 9937}, {-97, 9994},
+ {-96, 10052}, {-95, 10111}, {-94, 10171}, {-93, 10231}, {-92, 10293}, {-91, 10356},
+ {-90, 10419}, {-89, 10484}, {-88, 10549}, {-87, 10616}, {-86, 10684}, {-85, 10753},
+ {-84, 10823}, {-83, 10895}, {-82, 10968}, {-81, 11042}, {-80, 11117}, {-79, 11194},
+ {-78, 11272}, {-77, 11352}, {-76, 11433}, {-75, 11516}, {-74, 11600}, {-73, 11686},
+ {-72, 11774}, {-71, 11864}, {-70, 11955}, {-69, 12049}, {-68, 12144}, {-67, 12242},
+ {-66, 12341}, {-65, 12443}, {-64, 12548}, {-63, 12654}, {-62, 12763}, {-61, 12875},
+ {-60, 12990}, {-59, 13107}, {-58, 13227}, {-57, 13351}, {-56, 13477}, {-55, 13607},
+ {-54, 13741}, {-53, 13878}, {-52, 14019}, {-51, 14164}, {-50, 14313}, {-49, 14467},
+ {-48, 14626}, {-47, 14789}, {-46, 14958}, {-45, 15132}, {-44, 15312}, {-43, 15498},
+ {-42, 15691}, {-41, 15890}, {-40, 16097}, {-39, 16311}, {-38, 16534}, {-37, 16766},
+ {-36, 17007}, {-35, 17259}, {-34, 17521}, {-33, 17795}, {-32, 18081}, {-31, 18381},
+ {-30, 18696}, {-29, 19027}, {-28, 19375}, {-27, 19742}, {-26, 20129}, {-25, 20540},
+ {-24, 20976}, {-23, 21439}, {-22, 21934}, {-21, 22463}, {-20, 23031}, {-19, 23643},
+ {-18, 23999}};
- for(i = 0; i < 96; i++)
- {
- if(Hflevel <= LPFArray[i].Room_HF)
- break;
+ for (i = 0; i < 96; i++) {
+ if (Hflevel <= LPFArray[i].Room_HF) break;
}
return LPFArray[i].LPF;
}
@@ -919,26 +883,26 @@
//
//----------------------------------------------------------------------------
-void ReverbSetRoomHfLevel(ReverbContext *pContext, int16_t level){
- //ALOGV("\tReverbSetRoomHfLevel start (%d)", level);
+void ReverbSetRoomHfLevel(ReverbContext* pContext, int16_t level) {
+ // ALOGV("\tReverbSetRoomHfLevel start (%d)", level);
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetRoomHfLevel")
- //ALOGV("\tReverbSetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbSetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
+ // ALOGV("\tReverbSetRoomHfLevel Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbSetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
ActiveParams.LPF = ReverbConvertHfLevel(level);
/* Activate the initial settings */
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetRoomHfLevel")
- //ALOGV("\tReverbSetRoomhfLevel() just Set -> %d\n", ActiveParams.LPF);
+ // ALOGV("\tReverbSetRoomhfLevel() just Set -> %d\n", ActiveParams.LPF);
pContext->SavedHfLevel = level;
- //ALOGV("\tReverbSetHfRoomLevel end.. saving %d", pContext->SavedHfLevel);
+ // ALOGV("\tReverbSetHfRoomLevel end.. saving %d", pContext->SavedHfLevel);
return;
}
@@ -953,30 +917,31 @@
//
//----------------------------------------------------------------------------
-int16_t ReverbGetRoomHfLevel(ReverbContext *pContext){
+int16_t ReverbGetRoomHfLevel(ReverbContext* pContext) {
int16_t level;
- //ALOGV("\tReverbGetRoomHfLevel start, saved level is %d", pContext->SavedHfLevel);
+ // ALOGV("\tReverbGetRoomHfLevel start, saved level is %d", pContext->SavedHfLevel);
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetRoomHfLevel")
- //ALOGV("\tReverbGetRoomHfLevel Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbGetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
+ // ALOGV("\tReverbGetRoomHfLevel Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbGetRoomHfLevel() just Got -> %d\n", ActiveParams.LPF);
level = ReverbConvertHfLevel(pContext->SavedHfLevel);
- //ALOGV("\tReverbGetRoomHfLevel() ActiveParams.LPFL %d, pContext->SavedHfLevel: %d, "
+ // ALOGV("\tReverbGetRoomHfLevel() ActiveParams.LPFL %d, pContext->SavedHfLevel: %d, "
// "converted level: %d\n", ActiveParams.LPF, pContext->SavedHfLevel, level);
- if((int16_t)ActiveParams.LPF != level){
- ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomHfLevel() has wrong level -> %d %d\n",
- ActiveParams.Level, level);
+ if ((int16_t)ActiveParams.LPF != level) {
+ ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomHfLevel() has wrong level -> %d "
+ "%d\n",
+ ActiveParams.Level, level);
}
- //ALOGV("\tReverbGetRoomHfLevel end");
+ // ALOGV("\tReverbGetRoomHfLevel end");
return pContext->SavedHfLevel;
}
@@ -992,35 +957,35 @@
//
//----------------------------------------------------------------------------
-void ReverbSetReverbLevel(ReverbContext *pContext, int16_t level){
- //ALOGV("\n\tReverbSetReverbLevel start (%d)", level);
+void ReverbSetReverbLevel(ReverbContext* pContext, int16_t level) {
+ // ALOGV("\n\tReverbSetReverbLevel start (%d)", level);
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
- LVM_INT32 CombinedLevel; // Sum of room and reverb level controls
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVM_INT32 CombinedLevel; // Sum of room and reverb level controls
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetReverbLevel")
- //ALOGV("\tReverbSetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbSetReverbLevel just Got -> %d\n", ActiveParams.Level);
+ // ALOGV("\tReverbSetReverbLevel Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbSetReverbLevel just Got -> %d\n", ActiveParams.Level);
// needs to subtract max levels for both RoomLevel and ReverbLevel
- CombinedLevel = (level + pContext->SavedRoomLevel)-LVREV_MAX_REVERB_LEVEL;
- //ALOGV("\tReverbSetReverbLevel() CombinedLevel is %d = %d + %d\n",
+ CombinedLevel = (level + pContext->SavedRoomLevel) - LVREV_MAX_REVERB_LEVEL;
+ // ALOGV("\tReverbSetReverbLevel() CombinedLevel is %d = %d + %d\n",
// CombinedLevel, level, pContext->SavedRoomLevel);
ActiveParams.Level = ReverbConvertLevel(CombinedLevel);
- //ALOGV("\tReverbSetReverbLevel() Trying to set -> %d\n", ActiveParams.Level);
+ // ALOGV("\tReverbSetReverbLevel() Trying to set -> %d\n", ActiveParams.Level);
/* Activate the initial settings */
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetReverbLevel")
- //ALOGV("\tReverbSetReverbLevel() just Set -> %d\n", ActiveParams.Level);
+ // ALOGV("\tReverbSetReverbLevel() just Set -> %d\n", ActiveParams.Level);
pContext->SavedReverbLevel = level;
- //ALOGV("\tReverbSetReverbLevel end pContext->SavedReverbLevel is %d\n\n",
+ // ALOGV("\tReverbSetReverbLevel end pContext->SavedReverbLevel is %d\n\n",
// pContext->SavedReverbLevel);
return;
}
@@ -1036,37 +1001,40 @@
//
//----------------------------------------------------------------------------
-int16_t ReverbGetReverbLevel(ReverbContext *pContext){
+int16_t ReverbGetReverbLevel(ReverbContext* pContext) {
int16_t level;
- //ALOGV("\tReverbGetReverbLevel start");
+ // ALOGV("\tReverbGetReverbLevel start");
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
- LVM_INT32 CombinedLevel; // Sum of room and reverb level controls
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVM_INT32 CombinedLevel; // Sum of room and reverb level controls
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetReverbLevel")
- //ALOGV("\tReverbGetReverbLevel Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbGetReverbLevel() just Got -> %d\n", ActiveParams.Level);
+ // ALOGV("\tReverbGetReverbLevel Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbGetReverbLevel() just Got -> %d\n", ActiveParams.Level);
// needs to subtract max levels for both RoomLevel and ReverbLevel
- CombinedLevel = (pContext->SavedReverbLevel + pContext->SavedRoomLevel)-LVREV_MAX_REVERB_LEVEL;
+ CombinedLevel =
+ (pContext->SavedReverbLevel + pContext->SavedRoomLevel) - LVREV_MAX_REVERB_LEVEL;
- //ALOGV("\tReverbGetReverbLevel() CombinedLevel is %d = %d + %d\n",
- //CombinedLevel, pContext->SavedReverbLevel, pContext->SavedRoomLevel);
+ // ALOGV("\tReverbGetReverbLevel() CombinedLevel is %d = %d + %d\n",
+ // CombinedLevel, pContext->SavedReverbLevel, pContext->SavedRoomLevel);
level = ReverbConvertLevel(CombinedLevel);
- //ALOGV("\tReverbGetReverbLevel(): ActiveParams.Level: %d, pContext->SavedReverbLevel: %d, "
+ // ALOGV("\tReverbGetReverbLevel(): ActiveParams.Level: %d, pContext->SavedReverbLevel: %d, "
//"pContext->SavedRoomLevel: %d, CombinedLevel: %d, converted level: %d\n",
- //ActiveParams.Level, pContext->SavedReverbLevel,pContext->SavedRoomLevel, CombinedLevel,level);
+ // ActiveParams.Level, pContext->SavedReverbLevel,pContext->SavedRoomLevel,
+ // CombinedLevel,level);
- if(ActiveParams.Level != level){
- ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetReverbLevel() has wrong level -> %d %d\n",
- ActiveParams.Level, level);
+ if (ActiveParams.Level != level) {
+ ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetReverbLevel() has wrong level -> %d "
+ "%d\n",
+ ActiveParams.Level, level);
}
- //ALOGV("\tReverbGetReverbLevel end\n");
+ // ALOGV("\tReverbGetReverbLevel end\n");
return pContext->SavedReverbLevel;
}
@@ -1083,30 +1051,30 @@
//
//----------------------------------------------------------------------------
-void ReverbSetRoomLevel(ReverbContext *pContext, int16_t level){
- //ALOGV("\tReverbSetRoomLevel start (%d)", level);
+void ReverbSetRoomLevel(ReverbContext* pContext, int16_t level) {
+ // ALOGV("\tReverbSetRoomLevel start (%d)", level);
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
- LVM_INT32 CombinedLevel; // Sum of room and reverb level controls
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVM_INT32 CombinedLevel; // Sum of room and reverb level controls
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetRoomLevel")
- //ALOGV("\tReverbSetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbSetRoomLevel() just Got -> %d\n", ActiveParams.Level);
+ // ALOGV("\tReverbSetRoomLevel Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbSetRoomLevel() just Got -> %d\n", ActiveParams.Level);
// needs to subtract max levels for both RoomLevel and ReverbLevel
- CombinedLevel = (level + pContext->SavedReverbLevel)-LVREV_MAX_REVERB_LEVEL;
+ CombinedLevel = (level + pContext->SavedReverbLevel) - LVREV_MAX_REVERB_LEVEL;
ActiveParams.Level = ReverbConvertLevel(CombinedLevel);
/* Activate the initial settings */
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetRoomLevel")
- //ALOGV("\tReverbSetRoomLevel() just Set -> %d\n", ActiveParams.Level);
+ // ALOGV("\tReverbSetRoomLevel() just Set -> %d\n", ActiveParams.Level);
pContext->SavedRoomLevel = level;
- //ALOGV("\tReverbSetRoomLevel end");
+ // ALOGV("\tReverbSetRoomLevel end");
return;
}
@@ -1121,35 +1089,36 @@
//
//----------------------------------------------------------------------------
-int16_t ReverbGetRoomLevel(ReverbContext *pContext){
+int16_t ReverbGetRoomLevel(ReverbContext* pContext) {
int16_t level;
- //ALOGV("\tReverbGetRoomLevel start");
+ // ALOGV("\tReverbGetRoomLevel start");
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
- LVM_INT32 CombinedLevel; // Sum of room and reverb level controls
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVM_INT32 CombinedLevel; // Sum of room and reverb level controls
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetRoomLevel")
- //ALOGV("\tReverbGetRoomLevel Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbGetRoomLevel() just Got -> %d\n", ActiveParams.Level);
+ // ALOGV("\tReverbGetRoomLevel Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbGetRoomLevel() just Got -> %d\n", ActiveParams.Level);
// needs to subtract max levels for both RoomLevel and ReverbLevel
- CombinedLevel = (pContext->SavedRoomLevel + pContext->SavedReverbLevel-LVREV_MAX_REVERB_LEVEL);
+ CombinedLevel =
+ (pContext->SavedRoomLevel + pContext->SavedReverbLevel - LVREV_MAX_REVERB_LEVEL);
level = ReverbConvertLevel(CombinedLevel);
- //ALOGV("\tReverbGetRoomLevel, Level = %d, pContext->SavedRoomLevel = %d, "
+ // ALOGV("\tReverbGetRoomLevel, Level = %d, pContext->SavedRoomLevel = %d, "
// "pContext->SavedReverbLevel = %d, CombinedLevel = %d, level = %d",
// ActiveParams.Level, pContext->SavedRoomLevel,
// pContext->SavedReverbLevel, CombinedLevel, level);
- if(ActiveParams.Level != level){
+ if (ActiveParams.Level != level) {
ALOGV("\tLVM_ERROR : (ignore at start up) ReverbGetRoomLevel() has wrong level -> %d %d\n",
ActiveParams.Level, level);
}
- //ALOGV("\tReverbGetRoomLevel end");
+ // ALOGV("\tReverbGetRoomLevel end");
return pContext->SavedRoomLevel;
}
@@ -1165,34 +1134,35 @@
//
//----------------------------------------------------------------------------
-void ReverbSetDecayTime(ReverbContext *pContext, uint32_t time){
- //ALOGV("\tReverbSetDecayTime start (%d)", time);
+void ReverbSetDecayTime(ReverbContext* pContext, uint32_t time) {
+ // ALOGV("\tReverbSetDecayTime start (%d)", time);
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDecayTime")
- //ALOGV("\tReverbSetDecayTime Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbSetDecayTime() just Got -> %d\n", ActiveParams.T60);
+ // ALOGV("\tReverbSetDecayTime Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbSetDecayTime() just Got -> %d\n", ActiveParams.T60);
if (time <= LVREV_MAX_T60) {
ActiveParams.T60 = (LVM_UINT16)time;
- }
- else {
+ } else {
ActiveParams.T60 = LVREV_MAX_T60;
}
/* Activate the initial settings */
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDecayTime")
- //ALOGV("\tReverbSetDecayTime() just Set -> %d\n", ActiveParams.T60);
+ // ALOGV("\tReverbSetDecayTime() just Set -> %d\n", ActiveParams.T60);
- pContext->SamplesToExitCount = (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000;
- //ALOGV("\tReverbSetDecayTime() just Set SamplesToExitCount-> %d\n",pContext->SamplesToExitCount);
+ pContext->SamplesToExitCount =
+ (ActiveParams.T60 * pContext->config.inputCfg.samplingRate) / 1000;
+ // ALOGV("\tReverbSetDecayTime() just Set SamplesToExitCount->
+ // %d\n",pContext->SamplesToExitCount);
pContext->SavedDecayTime = (int16_t)time;
- //ALOGV("\tReverbSetDecayTime end");
+ // ALOGV("\tReverbSetDecayTime end");
return;
}
@@ -1207,25 +1177,25 @@
//
//----------------------------------------------------------------------------
-uint32_t ReverbGetDecayTime(ReverbContext *pContext){
- //ALOGV("\tReverbGetDecayTime start");
+uint32_t ReverbGetDecayTime(ReverbContext* pContext) {
+ // ALOGV("\tReverbGetDecayTime start");
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDecayTime")
- //ALOGV("\tReverbGetDecayTime Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbGetDecayTime() just Got -> %d\n", ActiveParams.T60);
+ // ALOGV("\tReverbGetDecayTime Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbGetDecayTime() just Got -> %d\n", ActiveParams.T60);
- if(ActiveParams.T60 != pContext->SavedDecayTime){
+ if (ActiveParams.T60 != pContext->SavedDecayTime) {
// This will fail if the decay time is set to more than 7000
- ALOGV("\tLVM_ERROR : ReverbGetDecayTime() has wrong level -> %d %d\n",
- ActiveParams.T60, pContext->SavedDecayTime);
+ ALOGV("\tLVM_ERROR : ReverbGetDecayTime() has wrong level -> %d %d\n", ActiveParams.T60,
+ pContext->SavedDecayTime);
}
- //ALOGV("\tReverbGetDecayTime end");
+ // ALOGV("\tReverbGetDecayTime end");
return (uint32_t)ActiveParams.T60;
}
@@ -1241,27 +1211,27 @@
//
//----------------------------------------------------------------------------
-void ReverbSetDecayHfRatio(ReverbContext *pContext, int16_t ratio){
- //ALOGV("\tReverbSetDecayHfRatioe start (%d)", ratio);
+void ReverbSetDecayHfRatio(ReverbContext* pContext, int16_t ratio) {
+ // ALOGV("\tReverbSetDecayHfRatioe start (%d)", ratio);
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDecayHfRatio")
- //ALOGV("\tReverbSetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbSetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
+ // ALOGV("\tReverbSetDecayHfRatio Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbSetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
- ActiveParams.Damping = (LVM_INT16)(ratio/20);
+ ActiveParams.Damping = (LVM_INT16)(ratio / 20);
/* Activate the initial settings */
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDecayHfRatio")
- //ALOGV("\tReverbSetDecayHfRatio() just Set -> %d\n", ActiveParams.Damping);
+ // ALOGV("\tReverbSetDecayHfRatio() just Set -> %d\n", ActiveParams.Damping);
pContext->SavedDecayHfRatio = ratio;
- //ALOGV("\tReverbSetDecayHfRatio end");
+ // ALOGV("\tReverbSetDecayHfRatio end");
return;
}
@@ -1276,24 +1246,24 @@
//
//----------------------------------------------------------------------------
-int32_t ReverbGetDecayHfRatio(ReverbContext *pContext){
- //ALOGV("\tReverbGetDecayHfRatio start");
+int32_t ReverbGetDecayHfRatio(ReverbContext* pContext) {
+ // ALOGV("\tReverbGetDecayHfRatio start");
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDecayHfRatio")
- //ALOGV("\tReverbGetDecayHfRatio Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbGetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
+ // ALOGV("\tReverbGetDecayHfRatio Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbGetDecayHfRatio() just Got -> %d\n", ActiveParams.Damping);
- if(ActiveParams.Damping != (LVM_INT16)(pContext->SavedDecayHfRatio / 20)){
+ if (ActiveParams.Damping != (LVM_INT16)(pContext->SavedDecayHfRatio / 20)) {
ALOGV("\tLVM_ERROR : ReverbGetDecayHfRatio() has wrong level -> %d %d\n",
- ActiveParams.Damping, pContext->SavedDecayHfRatio);
+ ActiveParams.Damping, pContext->SavedDecayHfRatio);
}
- //ALOGV("\tReverbGetDecayHfRatio end");
+ // ALOGV("\tReverbGetDecayHfRatio end");
return pContext->SavedDecayHfRatio;
}
@@ -1309,27 +1279,27 @@
//
//----------------------------------------------------------------------------
-void ReverbSetDiffusion(ReverbContext *pContext, int16_t level){
- //ALOGV("\tReverbSetDiffusion start (%d)", level);
+void ReverbSetDiffusion(ReverbContext* pContext, int16_t level) {
+ // ALOGV("\tReverbSetDiffusion start (%d)", level);
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDiffusion")
- //ALOGV("\tReverbSetDiffusion Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbSetDiffusion() just Got -> %d\n", ActiveParams.Density);
+ // ALOGV("\tReverbSetDiffusion Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbSetDiffusion() just Got -> %d\n", ActiveParams.Density);
- ActiveParams.Density = (LVM_INT16)(level/10);
+ ActiveParams.Density = (LVM_INT16)(level / 10);
/* Activate the initial settings */
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDiffusion")
- //ALOGV("\tReverbSetDiffusion() just Set -> %d\n", ActiveParams.Density);
+ // ALOGV("\tReverbSetDiffusion() just Set -> %d\n", ActiveParams.Density);
pContext->SavedDiffusion = level;
- //ALOGV("\tReverbSetDiffusion end");
+ // ALOGV("\tReverbSetDiffusion end");
return;
}
@@ -1344,26 +1314,26 @@
//
//----------------------------------------------------------------------------
-int32_t ReverbGetDiffusion(ReverbContext *pContext){
- //ALOGV("\tReverbGetDiffusion start");
+int32_t ReverbGetDiffusion(ReverbContext* pContext) {
+ // ALOGV("\tReverbGetDiffusion start");
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
- LVM_INT16 Temp;
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVM_INT16 Temp;
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDiffusion")
- //ALOGV("\tReverbGetDiffusion Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbGetDiffusion just Got -> %d\n", ActiveParams.Density);
+ // ALOGV("\tReverbGetDiffusion Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbGetDiffusion just Got -> %d\n", ActiveParams.Density);
- Temp = (LVM_INT16)(pContext->SavedDiffusion/10);
+ Temp = (LVM_INT16)(pContext->SavedDiffusion / 10);
- if(ActiveParams.Density != Temp){
+ if (ActiveParams.Density != Temp) {
ALOGV("\tLVM_ERROR : ReverbGetDiffusion invalid value %d %d", Temp, ActiveParams.Density);
}
- //ALOGV("\tReverbGetDiffusion end");
+ // ALOGV("\tReverbGetDiffusion end");
return pContext->SavedDiffusion;
}
@@ -1379,27 +1349,27 @@
//
//----------------------------------------------------------------------------
-void ReverbSetDensity(ReverbContext *pContext, int16_t level){
- //ALOGV("\tReverbSetDensity start (%d)", level);
+void ReverbSetDensity(ReverbContext* pContext, int16_t level) {
+ // ALOGV("\tReverbSetDensity start (%d)", level);
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbSetDensity")
- //ALOGV("\tReverbSetDensity Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbSetDensity just Got -> %d\n", ActiveParams.RoomSize);
+ // ALOGV("\tReverbSetDensity Successfully returned from LVM_GetControlParameters\n");
+ // ALOGV("\tReverbSetDensity just Got -> %d\n", ActiveParams.RoomSize);
ActiveParams.RoomSize = (LVM_INT16)(((level * 99) / 1000) + 1);
/* Activate the initial settings */
LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_SetControlParameters", "ReverbSetDensity")
- //ALOGV("\tReverbSetDensity just Set -> %d\n", ActiveParams.RoomSize);
+ // ALOGV("\tReverbSetDensity just Set -> %d\n", ActiveParams.RoomSize);
pContext->SavedDensity = level;
- //ALOGV("\tReverbSetDensity end");
+ // ALOGV("\tReverbSetDensity end");
return;
}
@@ -1414,25 +1384,25 @@
//
//----------------------------------------------------------------------------
-int32_t ReverbGetDensity(ReverbContext *pContext){
- //ALOGV("\tReverbGetDensity start");
+int32_t ReverbGetDensity(ReverbContext* pContext) {
+ // ALOGV("\tReverbGetDensity start");
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
- LVM_INT16 Temp;
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
+ LVM_INT16 Temp;
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "ReverbGetDensity")
- //ALOGV("\tReverbGetDensity Succesfully returned from LVM_GetControlParameters\n");
- //ALOGV("\tReverbGetDensity() just Got -> %d\n", ActiveParams.RoomSize);
+ // ALOGV("\tReverbGetDensity Successfully 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){
+ if (Temp != ActiveParams.RoomSize) {
ALOGV("\tLVM_ERROR : ReverbGetDensity invalid value %d %d", Temp, ActiveParams.RoomSize);
}
- //ALOGV("\tReverbGetDensity end");
+ // ALOGV("\tReverbGetDensity end");
return pContext->SavedDensity;
}
@@ -1450,20 +1420,19 @@
// Side Effects:
//
//----------------------------------------------------------------------------
-int Reverb_LoadPreset(ReverbContext *pContext)
-{
- //TODO: add reflections delay, level and reverb delay when early reflections are
+int Reverb_LoadPreset(ReverbContext* pContext) {
+ // TODO: add reflections delay, level and reverb delay when early reflections are
// implemented
pContext->curPreset = pContext->nextPreset;
if (pContext->curPreset != REVERB_PRESET_NONE) {
- const t_reverb_settings *preset = &sReverbPresets[pContext->curPreset];
+ const t_reverb_settings* preset = &sReverbPresets[pContext->curPreset];
ReverbSetRoomLevel(pContext, preset->roomLevel);
ReverbSetRoomHfLevel(pContext, preset->roomHFLevel);
ReverbSetDecayTime(pContext, preset->decayTime);
ReverbSetDecayHfRatio(pContext, preset->decayHFRatio);
- //reflectionsLevel
- //reflectionsDelay
+ // reflectionsLevel
+ // reflectionsDelay
ReverbSetReverbLevel(pContext, preset->reverbLevel);
// reverbDelay
ReverbSetDiffusion(pContext, preset->diffusion);
@@ -1494,99 +1463,96 @@
//
//----------------------------------------------------------------------------
-int Reverb_getParameter(ReverbContext *pContext,
- void *pParam,
- uint32_t *pValueSize,
- void *pValue){
+int Reverb_getParameter(ReverbContext* pContext, void* pParam, uint32_t* pValueSize, void* pValue) {
int status = 0;
- int32_t *pParamTemp = (int32_t *)pParam;
+ int32_t* pParamTemp = (int32_t*)pParam;
int32_t param = *pParamTemp++;
- t_reverb_settings *pProperties;
+ t_reverb_settings* pProperties;
- //ALOGV("\tReverb_getParameter start");
+ // ALOGV("\tReverb_getParameter start");
if (pContext->preset) {
if (param != REVERB_PARAM_PRESET || *pValueSize < sizeof(uint16_t)) {
return -EINVAL;
}
- *(uint16_t *)pValue = pContext->nextPreset;
+ *(uint16_t*)pValue = pContext->nextPreset;
ALOGV("get REVERB_PARAM_PRESET, preset %d", pContext->nextPreset);
return 0;
}
- switch (param){
+ switch (param) {
case REVERB_PARAM_ROOM_LEVEL:
- if (*pValueSize != sizeof(int16_t)){
+ if (*pValueSize != sizeof(int16_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize1 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(int16_t);
break;
case REVERB_PARAM_ROOM_HF_LEVEL:
- if (*pValueSize != sizeof(int16_t)){
+ if (*pValueSize != sizeof(int16_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize12 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(int16_t);
break;
case REVERB_PARAM_DECAY_TIME:
- if (*pValueSize != sizeof(uint32_t)){
+ if (*pValueSize != sizeof(uint32_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize3 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(uint32_t);
break;
case REVERB_PARAM_DECAY_HF_RATIO:
- if (*pValueSize != sizeof(int16_t)){
+ if (*pValueSize != sizeof(int16_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize4 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(int16_t);
break;
case REVERB_PARAM_REFLECTIONS_LEVEL:
- if (*pValueSize != sizeof(int16_t)){
+ if (*pValueSize != sizeof(int16_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize5 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(int16_t);
break;
case REVERB_PARAM_REFLECTIONS_DELAY:
- if (*pValueSize != sizeof(uint32_t)){
+ if (*pValueSize != sizeof(uint32_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize6 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(uint32_t);
break;
case REVERB_PARAM_REVERB_LEVEL:
- if (*pValueSize != sizeof(int16_t)){
+ if (*pValueSize != sizeof(int16_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize7 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(int16_t);
break;
case REVERB_PARAM_REVERB_DELAY:
- if (*pValueSize != sizeof(uint32_t)){
+ if (*pValueSize != sizeof(uint32_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize8 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(uint32_t);
break;
case REVERB_PARAM_DIFFUSION:
- if (*pValueSize != sizeof(int16_t)){
+ if (*pValueSize != sizeof(int16_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize9 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(int16_t);
break;
case REVERB_PARAM_DENSITY:
- if (*pValueSize != sizeof(int16_t)){
+ if (*pValueSize != sizeof(int16_t)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize10 %d", *pValueSize);
return -EINVAL;
}
*pValueSize = sizeof(int16_t);
break;
case REVERB_PARAM_PROPERTIES:
- if (*pValueSize != sizeof(t_reverb_settings)){
+ if (*pValueSize != sizeof(t_reverb_settings)) {
ALOGV("\tLVM_ERROR : Reverb_getParameter() invalid pValueSize11 %d", *pValueSize);
return -EINVAL;
}
@@ -1598,9 +1564,9 @@
return -EINVAL;
}
- pProperties = (t_reverb_settings *) pValue;
+ pProperties = (t_reverb_settings*)pValue;
- switch (param){
+ switch (param) {
case REVERB_PARAM_PROPERTIES:
pProperties->roomLevel = ReverbGetRoomLevel(pContext);
pProperties->roomHFLevel = ReverbGetRoomHfLevel(pContext);
@@ -1614,74 +1580,74 @@
pProperties->density = ReverbGetDensity(pContext);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomLevel %d",
- pProperties->roomLevel);
+ pProperties->roomLevel);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomHFLevel %d",
- pProperties->roomHFLevel);
+ pProperties->roomHFLevel);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayTime %d",
- pProperties->decayTime);
+ pProperties->decayTime);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayHFRatio %d",
- pProperties->decayHFRatio);
+ pProperties->decayHFRatio);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsLevel %d",
- pProperties->reflectionsLevel);
+ pProperties->reflectionsLevel);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsDelay %d",
- pProperties->reflectionsDelay);
+ pProperties->reflectionsDelay);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbDelay %d",
- pProperties->reverbDelay);
+ pProperties->reverbDelay);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbLevel %d",
- pProperties->reverbLevel);
+ pProperties->reverbLevel);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is diffusion %d",
- pProperties->diffusion);
+ pProperties->diffusion);
ALOGV("\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is density %d",
- pProperties->density);
+ pProperties->density);
break;
case REVERB_PARAM_ROOM_LEVEL:
- *(int16_t *)pValue = ReverbGetRoomLevel(pContext);
+ *(int16_t*)pValue = ReverbGetRoomLevel(pContext);
- //ALOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_LEVEL Value is %d",
+ // ALOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_LEVEL Value is %d",
// *(int16_t *)pValue);
break;
case REVERB_PARAM_ROOM_HF_LEVEL:
- *(int16_t *)pValue = ReverbGetRoomHfLevel(pContext);
+ *(int16_t*)pValue = ReverbGetRoomHfLevel(pContext);
- //ALOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_HF_LEVEL Value is %d",
+ // ALOGV("\tReverb_getParameter() REVERB_PARAM_ROOM_HF_LEVEL Value is %d",
// *(int16_t *)pValue);
break;
case REVERB_PARAM_DECAY_TIME:
- *(uint32_t *)pValue = ReverbGetDecayTime(pContext);
+ *(uint32_t*)pValue = ReverbGetDecayTime(pContext);
- //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_TIME Value is %d",
+ // ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_TIME Value is %d",
// *(int32_t *)pValue);
break;
case REVERB_PARAM_DECAY_HF_RATIO:
- *(int16_t *)pValue = ReverbGetDecayHfRatio(pContext);
+ *(int16_t*)pValue = ReverbGetDecayHfRatio(pContext);
- //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_HF_RATION Value is %d",
+ // ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_HF_RATION Value is %d",
// *(int16_t *)pValue);
break;
case REVERB_PARAM_REVERB_LEVEL:
- *(int16_t *)pValue = ReverbGetReverbLevel(pContext);
+ *(int16_t*)pValue = ReverbGetReverbLevel(pContext);
- //ALOGV("\tReverb_getParameter() REVERB_PARAM_REVERB_LEVEL Value is %d",
+ // ALOGV("\tReverb_getParameter() REVERB_PARAM_REVERB_LEVEL Value is %d",
// *(int16_t *)pValue);
break;
case REVERB_PARAM_DIFFUSION:
- *(int16_t *)pValue = ReverbGetDiffusion(pContext);
+ *(int16_t*)pValue = ReverbGetDiffusion(pContext);
- //ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_DIFFUSION Value is %d",
+ // ALOGV("\tReverb_getParameter() REVERB_PARAM_DECAY_DIFFUSION Value is %d",
// *(int16_t *)pValue);
break;
case REVERB_PARAM_DENSITY:
- *(int16_t *)pValue = ReverbGetDensity(pContext);
- //ALOGV("\tReverb_getParameter() REVERB_PARAM_DENSITY Value is %d",
+ *(int16_t*)pValue = ReverbGetDensity(pContext);
+ // ALOGV("\tReverb_getParameter() REVERB_PARAM_DENSITY Value is %d",
// *(uint32_t *)pValue);
break;
case REVERB_PARAM_REFLECTIONS_LEVEL:
- *(uint16_t *)pValue = 0;
+ *(uint16_t*)pValue = 0;
break;
case REVERB_PARAM_REFLECTIONS_DELAY:
case REVERB_PARAM_REVERB_DELAY:
- *(uint32_t *)pValue = 0;
+ *(uint32_t*)pValue = 0;
break;
default:
@@ -1690,7 +1656,7 @@
break;
}
- //ALOGV("\tReverb_getParameter end");
+ // ALOGV("\tReverb_getParameter end");
return status;
} /* end Reverb_getParameter */
@@ -1710,16 +1676,16 @@
//
//----------------------------------------------------------------------------
-int Reverb_setParameter (ReverbContext *pContext, void *pParam, void *pValue, int vsize){
+int Reverb_setParameter(ReverbContext* pContext, void* pParam, void* pValue, int vsize) {
int status = 0;
int16_t level;
int16_t ratio;
uint32_t time;
- t_reverb_settings *pProperties;
- int32_t *pParamTemp = (int32_t *)pParam;
+ t_reverb_settings* pProperties;
+ int32_t* pParamTemp = (int32_t*)pParam;
int32_t param = *pParamTemp++;
- //ALOGV("\tReverb_setParameter start");
+ // ALOGV("\tReverb_setParameter start");
if (pContext->preset) {
if (param != REVERB_PARAM_PRESET) {
return -EINVAL;
@@ -1729,7 +1695,7 @@
return -EINVAL;
}
- uint16_t preset = *(uint16_t *)pValue;
+ uint16_t preset = *(uint16_t*)pValue;
ALOGV("set REVERB_PARAM_PRESET, preset %d", preset);
if (preset > REVERB_PRESET_LAST) {
return -EINVAL;
@@ -1743,10 +1709,10 @@
return -EINVAL;
}
- switch (param){
+ switch (param) {
case REVERB_PARAM_PROPERTIES:
ALOGV("\tReverb_setParameter() REVERB_PARAM_PROPERTIES");
- pProperties = (t_reverb_settings *) pValue;
+ pProperties = (t_reverb_settings*)pValue;
ReverbSetRoomLevel(pContext, pProperties->roomLevel);
ReverbSetRoomHfLevel(pContext, pProperties->roomHFLevel);
ReverbSetDecayTime(pContext, pProperties->decayTime);
@@ -1756,55 +1722,55 @@
ReverbSetDensity(pContext, pProperties->density);
break;
case REVERB_PARAM_ROOM_LEVEL:
- level = *(int16_t *)pValue;
- //ALOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_LEVEL value is %d", level);
- //ALOGV("\tReverb_setParameter() Calling ReverbSetRoomLevel");
+ level = *(int16_t*)pValue;
+ // ALOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_LEVEL value is %d", level);
+ // ALOGV("\tReverb_setParameter() Calling ReverbSetRoomLevel");
ReverbSetRoomLevel(pContext, level);
- //ALOGV("\tReverb_setParameter() Called ReverbSetRoomLevel");
- break;
- case REVERB_PARAM_ROOM_HF_LEVEL:
- level = *(int16_t *)pValue;
- //ALOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_HF_LEVEL value is %d", level);
- //ALOGV("\tReverb_setParameter() Calling ReverbSetRoomHfLevel");
- ReverbSetRoomHfLevel(pContext, level);
- //ALOGV("\tReverb_setParameter() Called ReverbSetRoomHfLevel");
- break;
- case REVERB_PARAM_DECAY_TIME:
- time = *(uint32_t *)pValue;
- //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_TIME value is %d", time);
- //ALOGV("\tReverb_setParameter() Calling ReverbSetDecayTime");
- ReverbSetDecayTime(pContext, time);
- //ALOGV("\tReverb_setParameter() Called ReverbSetDecayTime");
- break;
- case REVERB_PARAM_DECAY_HF_RATIO:
- ratio = *(int16_t *)pValue;
- //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_HF_RATIO value is %d", ratio);
- //ALOGV("\tReverb_setParameter() Calling ReverbSetDecayHfRatio");
- ReverbSetDecayHfRatio(pContext, ratio);
- //ALOGV("\tReverb_setParameter() Called ReverbSetDecayHfRatio");
+ // ALOGV("\tReverb_setParameter() Called ReverbSetRoomLevel");
break;
- case REVERB_PARAM_REVERB_LEVEL:
- level = *(int16_t *)pValue;
- //ALOGV("\tReverb_setParameter() REVERB_PARAM_REVERB_LEVEL value is %d", level);
- //ALOGV("\tReverb_setParameter() Calling ReverbSetReverbLevel");
+ case REVERB_PARAM_ROOM_HF_LEVEL:
+ level = *(int16_t*)pValue;
+ // ALOGV("\tReverb_setParameter() REVERB_PARAM_ROOM_HF_LEVEL value is %d", level);
+ // ALOGV("\tReverb_setParameter() Calling ReverbSetRoomHfLevel");
+ ReverbSetRoomHfLevel(pContext, level);
+ // ALOGV("\tReverb_setParameter() Called ReverbSetRoomHfLevel");
+ break;
+ case REVERB_PARAM_DECAY_TIME:
+ time = *(uint32_t*)pValue;
+ // ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_TIME value is %d", time);
+ // ALOGV("\tReverb_setParameter() Calling ReverbSetDecayTime");
+ ReverbSetDecayTime(pContext, time);
+ // ALOGV("\tReverb_setParameter() Called ReverbSetDecayTime");
+ break;
+ case REVERB_PARAM_DECAY_HF_RATIO:
+ ratio = *(int16_t*)pValue;
+ // ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_HF_RATIO value is %d", ratio);
+ // ALOGV("\tReverb_setParameter() Calling ReverbSetDecayHfRatio");
+ ReverbSetDecayHfRatio(pContext, ratio);
+ // ALOGV("\tReverb_setParameter() Called ReverbSetDecayHfRatio");
+ break;
+ case REVERB_PARAM_REVERB_LEVEL:
+ level = *(int16_t*)pValue;
+ // ALOGV("\tReverb_setParameter() REVERB_PARAM_REVERB_LEVEL value is %d", level);
+ // ALOGV("\tReverb_setParameter() Calling ReverbSetReverbLevel");
ReverbSetReverbLevel(pContext, level);
- //ALOGV("\tReverb_setParameter() Called ReverbSetReverbLevel");
- break;
+ // ALOGV("\tReverb_setParameter() Called ReverbSetReverbLevel");
+ break;
case REVERB_PARAM_DIFFUSION:
- ratio = *(int16_t *)pValue;
- //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DIFFUSION value is %d", ratio);
- //ALOGV("\tReverb_setParameter() Calling ReverbSetDiffusion");
+ ratio = *(int16_t*)pValue;
+ // ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DIFFUSION value is %d", ratio);
+ // ALOGV("\tReverb_setParameter() Calling ReverbSetDiffusion");
ReverbSetDiffusion(pContext, ratio);
- //ALOGV("\tReverb_setParameter() Called ReverbSetDiffusion");
+ // ALOGV("\tReverb_setParameter() Called ReverbSetDiffusion");
break;
case REVERB_PARAM_DENSITY:
- ratio = *(int16_t *)pValue;
- //ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DENSITY value is %d", ratio);
- //ALOGV("\tReverb_setParameter() Calling ReverbSetDensity");
+ ratio = *(int16_t*)pValue;
+ // ALOGV("\tReverb_setParameter() REVERB_PARAM_DECAY_DENSITY value is %d", ratio);
+ // ALOGV("\tReverb_setParameter() Calling ReverbSetDensity");
ReverbSetDensity(pContext, ratio);
- //ALOGV("\tReverb_setParameter() Called ReverbSetDensity");
+ // ALOGV("\tReverb_setParameter() Called ReverbSetDensity");
break;
- break;
+ break;
case REVERB_PARAM_REFLECTIONS_LEVEL:
case REVERB_PARAM_REFLECTIONS_DELAY:
case REVERB_PARAM_REVERB_DELAY:
@@ -1814,7 +1780,7 @@
break;
}
- //ALOGV("\tReverb_setParameter end");
+ // ALOGV("\tReverb_setParameter end");
return status;
} /* end Reverb_setParameter */
@@ -1823,52 +1789,46 @@
*/
int Reverb_paramValueSize(int32_t param) {
switch (param) {
- case REVERB_PARAM_ROOM_LEVEL:
- case REVERB_PARAM_ROOM_HF_LEVEL:
- case REVERB_PARAM_REFLECTIONS_LEVEL:
- case REVERB_PARAM_REVERB_LEVEL:
- return sizeof(int16_t); // millibel
- case REVERB_PARAM_DECAY_TIME:
- case REVERB_PARAM_REFLECTIONS_DELAY:
- case REVERB_PARAM_REVERB_DELAY:
- return sizeof(uint32_t); // milliseconds
- case REVERB_PARAM_DECAY_HF_RATIO:
- case REVERB_PARAM_DIFFUSION:
- case REVERB_PARAM_DENSITY:
- return sizeof(int16_t); // permille
- case REVERB_PARAM_PROPERTIES:
- return sizeof(s_reverb_settings); // struct of all reverb properties
+ case REVERB_PARAM_ROOM_LEVEL:
+ case REVERB_PARAM_ROOM_HF_LEVEL:
+ case REVERB_PARAM_REFLECTIONS_LEVEL:
+ case REVERB_PARAM_REVERB_LEVEL:
+ return sizeof(int16_t); // millibel
+ case REVERB_PARAM_DECAY_TIME:
+ case REVERB_PARAM_REFLECTIONS_DELAY:
+ case REVERB_PARAM_REVERB_DELAY:
+ return sizeof(uint32_t); // milliseconds
+ case REVERB_PARAM_DECAY_HF_RATIO:
+ case REVERB_PARAM_DIFFUSION:
+ case REVERB_PARAM_DENSITY:
+ return sizeof(int16_t); // permille
+ case REVERB_PARAM_PROPERTIES:
+ return sizeof(s_reverb_settings); // struct of all reverb properties
}
return sizeof(int32_t);
}
-} // namespace
-} // namespace
+} // namespace
+} // namespace android
extern "C" {
/* Effect Control Interface Implementation: Process */
-int Reverb_process(effect_handle_t self,
- audio_buffer_t *inBuffer,
- audio_buffer_t *outBuffer){
- android::ReverbContext * pContext = (android::ReverbContext *) self;
- int status = 0;
+int Reverb_process(effect_handle_t self, audio_buffer_t* inBuffer, audio_buffer_t* outBuffer) {
+ android::ReverbContext* pContext = (android::ReverbContext*)self;
+ int status = 0;
- if (pContext == NULL){
+ if (pContext == NULL) {
ALOGV("\tLVM_ERROR : Reverb_process() ERROR pContext == NULL");
return -EINVAL;
}
- if (inBuffer == NULL || inBuffer->raw == NULL ||
- outBuffer == NULL || outBuffer->raw == NULL ||
- inBuffer->frameCount != outBuffer->frameCount){
+ if (inBuffer == NULL || inBuffer->raw == NULL || outBuffer == NULL || outBuffer->raw == NULL ||
+ inBuffer->frameCount != outBuffer->frameCount) {
ALOGV("\tLVM_ERROR : Reverb_process() ERROR NULL INPUT POINTER OR FRAME COUNT IS WRONG");
return -EINVAL;
}
- //ALOGV("\tReverb_process() Calling process with %d frames", outBuffer->frameCount);
+ // ALOGV("\tReverb_process() Calling process with %d frames", outBuffer->frameCount);
/* Process all the available frames, block processing is handled internalLY by the LVM bundle */
- status = process( inBuffer->f32,
- outBuffer->f32,
- outBuffer->frameCount,
- pContext);
+ status = process(inBuffer->f32, outBuffer->f32, outBuffer->frameCount, pContext);
if (pContext->bEnabled == LVM_FALSE) {
if (pContext->SamplesToExitCount > 0) {
@@ -1880,72 +1840,67 @@
}
return status;
-} /* end Reverb_process */
+} /* end Reverb_process */
/* Effect Control Interface Implementation: Command */
-int Reverb_command(effect_handle_t self,
- uint32_t cmdCode,
- uint32_t cmdSize,
- void *pCmdData,
- uint32_t *replySize,
- void *pReplyData){
- android::ReverbContext * pContext = (android::ReverbContext *) self;
- LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
- LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */
+int Reverb_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, void* pCmdData,
+ uint32_t* replySize, void* pReplyData) {
+ android::ReverbContext* pContext = (android::ReverbContext*)self;
+ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */
+ LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Function call status */
- if (pContext == NULL){
+ if (pContext == NULL) {
ALOGV("\tLVM_ERROR : Reverb_command ERROR pContext == NULL");
return -EINVAL;
}
- //ALOGV("\tReverb_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
+ // ALOGV("\tReverb_command INPUTS are: command %d cmdSize %d",cmdCode, cmdSize);
- switch (cmdCode){
+ switch (cmdCode) {
case EFFECT_CMD_INIT:
- //ALOGV("\tReverb_command cmdCode Case: "
+ // ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_INIT start");
- if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_INIT: ERROR");
+ "EFFECT_CMD_INIT: ERROR");
return -EINVAL;
}
- *(int *) pReplyData = 0;
+ *(int*)pReplyData = 0;
break;
case EFFECT_CMD_SET_CONFIG:
- //ALOGV("\tReverb_command cmdCode Case: "
+ // ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_SET_CONFIG start");
- if (pCmdData == NULL || cmdSize != sizeof(effect_config_t) ||
- pReplyData == NULL || replySize == NULL || *replySize != sizeof(int)) {
+ if (pCmdData == NULL || cmdSize != sizeof(effect_config_t) || pReplyData == NULL ||
+ replySize == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_SET_CONFIG: ERROR");
+ "EFFECT_CMD_SET_CONFIG: ERROR");
return -EINVAL;
}
- *(int *) pReplyData = android::Reverb_setConfig(pContext,
- (effect_config_t *) pCmdData);
+ *(int*)pReplyData = android::Reverb_setConfig(pContext, (effect_config_t*)pCmdData);
break;
case EFFECT_CMD_GET_CONFIG:
if (pReplyData == NULL || replySize == NULL || *replySize != sizeof(effect_config_t)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_GET_CONFIG: ERROR");
+ "EFFECT_CMD_GET_CONFIG: ERROR");
return -EINVAL;
}
- android::Reverb_getConfig(pContext, (effect_config_t *)pReplyData);
+ android::Reverb_getConfig(pContext, (effect_config_t*)pReplyData);
break;
case EFFECT_CMD_RESET:
- //ALOGV("\tReverb_command cmdCode Case: "
+ // ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_RESET start");
Reverb_setConfig(pContext, &pContext->config);
break;
- case EFFECT_CMD_GET_PARAM:{
- //ALOGV("\tReverb_command cmdCode Case: "
+ case EFFECT_CMD_GET_PARAM: {
+ // ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_GET_PARAM start");
- effect_param_t *p = (effect_param_t *)pCmdData;
+ effect_param_t* p = (effect_param_t*)pCmdData;
if (pCmdData == nullptr) {
ALOGW("\tLVM_ERROR : pCmdData is NULL");
return -EINVAL;
@@ -1954,163 +1909,156 @@
android_errorWriteLog(0x534e4554, "26347509");
return -EINVAL;
}
- if (cmdSize < sizeof(effect_param_t) ||
- cmdSize < (sizeof(effect_param_t) + p->psize) ||
- pReplyData == NULL || replySize == NULL ||
- *replySize < (sizeof(effect_param_t) + p->psize)) {
+ if (cmdSize < sizeof(effect_param_t) || cmdSize < (sizeof(effect_param_t) + p->psize) ||
+ pReplyData == NULL || replySize == NULL ||
+ *replySize < (sizeof(effect_param_t) + p->psize)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_GET_PARAM: ERROR");
+ "EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
}
memcpy(pReplyData, pCmdData, sizeof(effect_param_t) + p->psize);
- p = (effect_param_t *)pReplyData;
+ p = (effect_param_t*)pReplyData;
int voffset = ((p->psize - 1) / sizeof(int32_t) + 1) * sizeof(int32_t);
- p->status = android::Reverb_getParameter(pContext,
- (void *)p->data,
- &p->vsize,
- p->data + voffset);
+ p->status = android::Reverb_getParameter(pContext, (void*)p->data, &p->vsize,
+ p->data + voffset);
*replySize = sizeof(effect_param_t) + voffset + p->vsize;
- //ALOGV("\tReverb_command EFFECT_CMD_GET_PARAM "
+ // ALOGV("\tReverb_command EFFECT_CMD_GET_PARAM "
// "*pCmdData %d, *replySize %d, *pReplyData %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
// *(int16_t *)((char *)pReplyData + sizeof(effect_param_t) + voffset));
} break;
- case EFFECT_CMD_SET_PARAM:{
-
- //ALOGV("\tReverb_command cmdCode Case: "
+ case EFFECT_CMD_SET_PARAM: {
+ // ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_SET_PARAM start");
- //ALOGV("\tReverb_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
+ // ALOGV("\tReverb_command EFFECT_CMD_SET_PARAM param %d, *replySize %d, value %d ",
// *(int32_t *)((char *)pCmdData + sizeof(effect_param_t)),
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
if (pCmdData == NULL || (cmdSize < (sizeof(effect_param_t) + sizeof(int32_t))) ||
- pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
+ pReplyData == NULL || replySize == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_SET_PARAM: ERROR");
+ "EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;
}
- effect_param_t *p = (effect_param_t *) pCmdData;
+ effect_param_t* p = (effect_param_t*)pCmdData;
- if (p->psize != sizeof(int32_t)){
+ if (p->psize != sizeof(int32_t)) {
ALOGV("\t4LVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
+ "EFFECT_CMD_SET_PARAM: ERROR, psize is not sizeof(int32_t)");
return -EINVAL;
}
- //ALOGV("\tn5Reverb_command cmdSize is %d\n"
+ // ALOGV("\tn5Reverb_command cmdSize is %d\n"
// "\tsizeof(effect_param_t) is %d\n"
// "\tp->psize is %d\n"
// "\tp->vsize is %d"
// "\n",
// cmdSize, sizeof(effect_param_t), p->psize, p->vsize );
- *(int *)pReplyData = android::Reverb_setParameter(pContext,
- (void *)p->data,
- p->data + p->psize,
- p->vsize);
+ *(int*)pReplyData = android::Reverb_setParameter(pContext, (void*)p->data,
+ p->data + p->psize, p->vsize);
} break;
case EFFECT_CMD_ENABLE:
- //ALOGV("\tReverb_command cmdCode Case: "
+ // ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_ENABLE start");
- if (pReplyData == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_ENABLE: ERROR");
+ "EFFECT_CMD_ENABLE: ERROR");
return -EINVAL;
}
- if(pContext->bEnabled == LVM_TRUE){
- ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_ENABLE: ERROR-Effect is already enabled");
- return -EINVAL;
- }
- *(int *)pReplyData = 0;
+ if (pContext->bEnabled == LVM_TRUE) {
+ ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+ "EFFECT_CMD_ENABLE: ERROR-Effect is already enabled");
+ return -EINVAL;
+ }
+ *(int*)pReplyData = 0;
pContext->bEnabled = LVM_TRUE;
/* Get the current settings */
LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams);
LVM_ERROR_CHECK(LvmStatus, "LVREV_GetControlParameters", "EFFECT_CMD_ENABLE")
pContext->SamplesToExitCount =
- (ActiveParams.T60 * pContext->config.inputCfg.samplingRate)/1000;
+ (ActiveParams.T60 * pContext->config.inputCfg.samplingRate) / 1000;
// force no volume ramp for first buffer processed after enabling the effect
pContext->volumeMode = android::REVERB_VOLUME_FLAT;
- //ALOGV("\tEFFECT_CMD_ENABLE SamplesToExitCount = %d", pContext->SamplesToExitCount);
+ // ALOGV("\tEFFECT_CMD_ENABLE SamplesToExitCount = %d", pContext->SamplesToExitCount);
break;
case EFFECT_CMD_DISABLE:
- //ALOGV("\tReverb_command cmdCode Case: "
+ // ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_DISABLE start");
- if (pReplyData == NULL || *replySize != sizeof(int)){
+ if (pReplyData == NULL || *replySize != sizeof(int)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_DISABLE: ERROR");
+ "EFFECT_CMD_DISABLE: ERROR");
return -EINVAL;
}
- if(pContext->bEnabled == LVM_FALSE){
- ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_DISABLE: ERROR-Effect is not yet enabled");
- return -EINVAL;
- }
- *(int *)pReplyData = 0;
+ if (pContext->bEnabled == LVM_FALSE) {
+ ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
+ "EFFECT_CMD_DISABLE: ERROR-Effect is not yet enabled");
+ return -EINVAL;
+ }
+ *(int*)pReplyData = 0;
pContext->bEnabled = LVM_FALSE;
break;
case EFFECT_CMD_SET_VOLUME:
- if (pCmdData == NULL ||
- cmdSize != 2 * sizeof(uint32_t)) {
+ if (pCmdData == NULL || cmdSize != 2 * sizeof(uint32_t)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "EFFECT_CMD_SET_VOLUME: ERROR");
+ "EFFECT_CMD_SET_VOLUME: ERROR");
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);
- *(uint32_t *)pReplyData = (1 << 24);
- *((uint32_t *)pReplyData + 1) = (1 << 24);
+ 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);
+ *(uint32_t*)pReplyData = (1 << 24);
+ *((uint32_t*)pReplyData + 1) = (1 << 24);
if (pContext->volumeMode == android::REVERB_VOLUME_OFF) {
// force no volume ramp for first buffer processed after getting volume control
pContext->volumeMode = android::REVERB_VOLUME_FLAT;
}
- } else { // we don't have volume control
+ } else { // we don't have volume control
pContext->leftVolume = REVERB_UNIT_VOLUME;
pContext->rightVolume = REVERB_UNIT_VOLUME;
pContext->volumeMode = android::REVERB_VOLUME_OFF;
}
- ALOGV("EFFECT_CMD_SET_VOLUME left %d, right %d mode %d",
- pContext->leftVolume, pContext->rightVolume, pContext->volumeMode);
+ ALOGV("EFFECT_CMD_SET_VOLUME left %d, right %d mode %d", pContext->leftVolume,
+ pContext->rightVolume, pContext->volumeMode);
break;
case EFFECT_CMD_SET_DEVICE:
case EFFECT_CMD_SET_AUDIO_MODE:
- //ALOGV("\tReverb_command cmdCode Case: "
- // "EFFECT_CMD_SET_DEVICE/EFFECT_CMD_SET_VOLUME/EFFECT_CMD_SET_AUDIO_MODE start");
+ // ALOGV("\tReverb_command cmdCode Case: "
+ // "EFFECT_CMD_SET_DEVICE/EFFECT_CMD_SET_VOLUME/EFFECT_CMD_SET_AUDIO_MODE
+ // start");
break;
default:
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
- "DEFAULT start %d ERROR",cmdCode);
+ "DEFAULT start %d ERROR",
+ cmdCode);
return -EINVAL;
}
- //ALOGV("\tReverb_command end\n\n");
+ // ALOGV("\tReverb_command end\n\n");
return 0;
-} /* end Reverb_command */
+} /* end Reverb_command */
/* Effect Control Interface Implementation: get_descriptor */
-int Reverb_getDescriptor(effect_handle_t self,
- effect_descriptor_t *pDescriptor)
-{
- android::ReverbContext * pContext = (android::ReverbContext *)self;
- const effect_descriptor_t *desc;
+int Reverb_getDescriptor(effect_handle_t self, effect_descriptor_t* pDescriptor) {
+ android::ReverbContext* pContext = (android::ReverbContext*)self;
+ const effect_descriptor_t* desc;
if (pContext == NULL || pDescriptor == NULL) {
ALOGV("Reverb_getDescriptor() invalid param");
@@ -2134,26 +2082,24 @@
*pDescriptor = *desc;
return 0;
-} /* end Reverb_getDescriptor */
+} /* end Reverb_getDescriptor */
// effect_handle_t interface implementation for Reverb effect
const struct effect_interface_s gReverbInterface = {
- Reverb_process,
- Reverb_command,
- Reverb_getDescriptor,
- NULL,
-}; /* end gReverbInterface */
+ Reverb_process,
+ Reverb_command,
+ Reverb_getDescriptor,
+ NULL,
+}; /* end gReverbInterface */
// This is the only symbol that needs to be exported
-__attribute__ ((visibility ("default")))
-audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
- .tag = AUDIO_EFFECT_LIBRARY_TAG,
- .version = EFFECT_LIBRARY_API_VERSION,
- .name = "Reverb Library",
- .implementor = "NXP Software Ltd.",
- .create_effect = android::EffectCreate,
- .release_effect = android::EffectRelease,
- .get_descriptor = android::EffectGetDescriptor,
+__attribute__((visibility("default"))) audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM = {
+ .tag = AUDIO_EFFECT_LIBRARY_TAG,
+ .version = EFFECT_LIBRARY_API_VERSION,
+ .name = "Reverb Library",
+ .implementor = "NXP Software Ltd.",
+ .create_effect = android::EffectCreate,
+ .release_effect = android::EffectRelease,
+ .get_descriptor = android::EffectGetDescriptor,
};
-
}
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
index 96223a8..227d953 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
@@ -20,16 +20,15 @@
#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
-#define LVREV_MAX_REVERB_LEVEL 2000
-#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 MAX_NUM_BANDS 5
+#define MAX_CALL_SIZE 256
+#define LVREV_MAX_T60 7000
+#define LVREV_MAX_REVERB_LEVEL 2000
+#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
-typedef struct _LPFPair_t
-{
+typedef struct _LPFPair_t {
int16_t Room_HF;
int16_t LPF;
} LPFPair_t;
diff --git a/media/libeffects/preprocessing/Android.bp b/media/libeffects/preprocessing/Android.bp
index 16cd0ad..5217cf9 100644
--- a/media/libeffects/preprocessing/Android.bp
+++ b/media/libeffects/preprocessing/Android.bp
@@ -1,6 +1,6 @@
// audio preprocessing wrapper
cc_library_shared {
- name: "libaudiopreprocessing",
+ name: "libaudiopreprocessing_legacy",
vendor: true,
@@ -17,6 +17,7 @@
cflags: [
"-DWEBRTC_POSIX",
+ "-DWEBRTC_LEGACY",
"-fvisibility=hidden",
"-Wall",
"-Werror",
@@ -27,3 +28,34 @@
"libhardware_headers",
],
}
+
+cc_library_shared {
+ name: "libaudiopreprocessing",
+ vendor: true,
+ relative_install_path: "soundfx",
+ srcs: ["PreProcessing.cpp"],
+ local_include_dirs: [
+ ".",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ ],
+
+ shared_libs: [
+ "liblog",
+ "libutils",
+ ],
+
+ static_libs: [
+ "webrtc_audio_processing",
+ ],
+
+ header_libs: [
+ "libaudioeffects",
+ "libhardware_headers",
+ "libwebrtc_absl_headers",
+ ],
+}
diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp
index c7afe2f..f2f74a5 100644
--- a/media/libeffects/preprocessing/PreProcessing.cpp
+++ b/media/libeffects/preprocessing/PreProcessing.cpp
@@ -23,10 +23,15 @@
#include <hardware/audio_effect.h>
#include <audio_effects/effect_aec.h>
#include <audio_effects/effect_agc.h>
+#ifndef WEBRTC_LEGACY
+#include <audio_effects/effect_agc2.h>
+#endif
#include <audio_effects/effect_ns.h>
#include <module_common_types.h>
#include <audio_processing.h>
+#ifdef WEBRTC_LEGACY
#include "speex/speex_resampler.h"
+#endif
// undefine to perform multi channels API functional tests
//#define DUAL_MIC_TEST
@@ -42,6 +47,9 @@
enum preproc_id
{
PREPROC_AGC, // Automatic Gain Control
+#ifndef WEBRTC_LEGACY
+ PREPROC_AGC2, // Automatic Gain Control 2
+#endif
PREPROC_AEC, // Acoustic Echo Canceler
PREPROC_NS, // Noise Suppressor
PREPROC_NUM_EFFECTS
@@ -103,6 +111,10 @@
int id; // audio session ID
int io; // handle of input stream this session is on
webrtc::AudioProcessing* apm; // handle on webRTC audio processing module (APM)
+#ifndef WEBRTC_LEGACY
+ // Audio Processing module builder
+ webrtc::AudioProcessingBuilder ap_builder;
+#endif
size_t apmFrameCount; // buffer size for webRTC process (10 ms)
uint32_t apmSamplingRate; // webRTC APM sampling rate (8/16 or 32 kHz)
size_t frameCount; // buffer size before input resampler ( <=> apmFrameCount)
@@ -113,25 +125,42 @@
uint32_t enabledMsk; // bit field containing IDs of enabled pre processors
uint32_t processedMsk; // bit field containing IDs of pre processors already
// processed in current round
+#ifdef WEBRTC_LEGACY
webrtc::AudioFrame *procFrame; // audio frame passed to webRTC AMP ProcessStream()
+#else
+ // audio config strucutre
+ webrtc::AudioProcessing::Config config;
+ webrtc::StreamConfig inputConfig; // input stream configuration
+ webrtc::StreamConfig outputConfig; // output stream configuration
+#endif
int16_t *inBuf; // input buffer used when resampling
size_t inBufSize; // input buffer size in frames
size_t framesIn; // number of frames in input buffer
+#ifdef WEBRTC_LEGACY
SpeexResamplerState *inResampler; // handle on input speex resampler
+#endif
int16_t *outBuf; // output buffer used when resampling
size_t outBufSize; // output buffer size in frames
size_t framesOut; // number of frames in output buffer
+#ifdef WEBRTC_LEGACY
SpeexResamplerState *outResampler; // handle on output speex resampler
+#endif
uint32_t revChannelCount; // number of channels on reverse stream
uint32_t revEnabledMsk; // bit field containing IDs of enabled pre processors
// with reverse channel
uint32_t revProcessedMsk; // bit field containing IDs of pre processors with reverse
// channel already processed in current round
+#ifdef WEBRTC_LEGACY
webrtc::AudioFrame *revFrame; // audio frame passed to webRTC AMP AnalyzeReverseStream()
+#else
+ webrtc::StreamConfig revConfig; // reverse stream configuration.
+#endif
int16_t *revBuf; // reverse channel input buffer
size_t revBufSize; // reverse channel input buffer size
size_t framesRev; // number of frames in reverse channel input buffer
+#ifdef WEBRTC_LEGACY
SpeexResamplerState *revResampler; // handle on reverse channel input speex resampler
+#endif
};
#ifdef DUAL_MIC_TEST
@@ -188,6 +217,20 @@
"The Android Open Source Project"
};
+#ifndef WEBRTC_LEGACY
+// Automatic Gain Control 2
+static const effect_descriptor_t sAgc2Descriptor = {
+ { 0xae3c653b, 0xbe18, 0x4ab8, 0x8938, { 0x41, 0x8f, 0x0a, 0x7f, 0x06, 0xac } }, // type
+ { 0x89f38e65, 0xd4d2, 0x4d64, 0xad0e, { 0x2b, 0x3e, 0x79, 0x9e, 0xa8, 0x86 } }, // uuid
+ EFFECT_CONTROL_API_VERSION,
+ (EFFECT_FLAG_TYPE_PRE_PROC|EFFECT_FLAG_DEVICE_IND),
+ 0, //FIXME indicate CPU load
+ 0, //FIXME indicate memory usage
+ "Automatic Gain Control 2",
+ "The Android Open Source Project"
+};
+#endif
+
// Acoustic Echo Cancellation
static const effect_descriptor_t sAecDescriptor = {
{ 0x7b491460, 0x8d4d, 0x11e0, 0xbd61, { 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } }, // type
@@ -215,6 +258,9 @@
static const effect_descriptor_t *sDescriptors[PREPROC_NUM_EFFECTS] = {
&sAgcDescriptor,
+#ifndef WEBRTC_LEGACY
+ &sAgc2Descriptor,
+#endif
&sAecDescriptor,
&sNsDescriptor
};
@@ -225,6 +271,9 @@
const effect_uuid_t * const sUuidToPreProcTable[PREPROC_NUM_EFFECTS] = {
FX_IID_AGC,
+#ifndef WEBRTC_LEGACY
+ FX_IID_AGC2,
+#endif
FX_IID_AEC,
FX_IID_NS
};
@@ -266,19 +315,50 @@
static const int kAgcDefaultCompGain = 9;
static const bool kAgcDefaultLimiter = true;
+#ifndef WEBRTC_LEGACY
+int Agc2Init (preproc_effect_t *effect)
+{
+ ALOGV("Agc2Init");
+ effect->session->config = effect->session->apm->GetConfig();
+ effect->session->config.gain_controller2.fixed_digital.gain_db = 0.f;
+ effect->session->config.gain_controller2.adaptive_digital.level_estimator =
+ effect->session->config.gain_controller2.kRms;
+ effect->session->config.gain_controller2.adaptive_digital.extra_saturation_margin_db = 2.f;
+ effect->session->apm->ApplyConfig(effect->session->config);
+ return 0;
+}
+#endif
+
int AgcInit (preproc_effect_t *effect)
{
ALOGV("AgcInit");
+#ifdef WEBRTC_LEGACY
webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
agc->set_mode(webrtc::GainControl::kFixedDigital);
agc->set_target_level_dbfs(kAgcDefaultTargetLevel);
agc->set_compression_gain_db(kAgcDefaultCompGain);
agc->enable_limiter(kAgcDefaultLimiter);
+#else
+ effect->session->config = effect->session->apm->GetConfig();
+ effect->session->config.gain_controller1.target_level_dbfs = kAgcDefaultTargetLevel;
+ effect->session->config.gain_controller1.compression_gain_db = kAgcDefaultCompGain;
+ effect->session->config.gain_controller1.enable_limiter = kAgcDefaultLimiter;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
return 0;
}
+#ifndef WEBRTC_LEGACY
+int Agc2Create(preproc_effect_t *effect)
+{
+ Agc2Init(effect);
+ return 0;
+}
+#endif
+
int AgcCreate(preproc_effect_t *effect)
{
+#ifdef WEBRTC_LEGACY
webrtc::GainControl *agc = effect->session->apm->gain_control();
ALOGV("AgcCreate got agc %p", agc);
if (agc == NULL) {
@@ -286,10 +366,93 @@
return -ENOMEM;
}
effect->engine = static_cast<preproc_fx_handle_t>(agc);
+#endif
AgcInit(effect);
return 0;
}
+#ifndef WEBRTC_LEGACY
+int Agc2GetParameter(preproc_effect_t *effect,
+ void *pParam,
+ uint32_t *pValueSize,
+ void *pValue)
+{
+ int status = 0;
+ uint32_t param = *(uint32_t *)pParam;
+ agc2_settings_t *pProperties = (agc2_settings_t *)pValue;
+
+ switch (param) {
+ case AGC2_PARAM_FIXED_DIGITAL_GAIN:
+ if (*pValueSize < sizeof(float)) {
+ *pValueSize = 0.f;
+ return -EINVAL;
+ }
+ break;
+ case AGC2_PARAM_ADAPT_DIGI_LEVEL_ESTIMATOR:
+ if (*pValueSize < sizeof(int32_t)) {
+ *pValueSize = 0;
+ return -EINVAL;
+ }
+ break;
+ case AGC2_PARAM_ADAPT_DIGI_EXTRA_SATURATION_MARGIN:
+ if (*pValueSize < sizeof(float)) {
+ *pValueSize = 0.f;
+ return -EINVAL;
+ }
+ break;
+ case AGC2_PARAM_PROPERTIES:
+ if (*pValueSize < sizeof(agc2_settings_t)) {
+ *pValueSize = 0;
+ return -EINVAL;
+ }
+ break;
+
+ default:
+ ALOGW("Agc2GetParameter() unknown param %08x", param);
+ status = -EINVAL;
+ break;
+ }
+
+ effect->session->config = effect->session->apm->GetConfig();
+ switch (param) {
+ case AGC2_PARAM_FIXED_DIGITAL_GAIN:
+ *(float *) pValue =
+ (float)(effect->session->config.gain_controller2.fixed_digital.gain_db);
+ ALOGV("Agc2GetParameter() target level %f dB", *(float *) pValue);
+ break;
+ case AGC2_PARAM_ADAPT_DIGI_LEVEL_ESTIMATOR:
+ *(uint32_t *) pValue =
+ (uint32_t)(effect->session->config.gain_controller2.adaptive_digital.
+ level_estimator);
+ ALOGV("Agc2GetParameter() level estimator %d",
+ *(webrtc::AudioProcessing::Config::GainController2::LevelEstimator *) pValue);
+ break;
+ case AGC2_PARAM_ADAPT_DIGI_EXTRA_SATURATION_MARGIN:
+ *(float *) pValue =
+ (float)(effect->session->config.gain_controller2.adaptive_digital.
+ extra_saturation_margin_db);
+ ALOGV("Agc2GetParameter() extra saturation margin %f dB", *(float *) pValue);
+ break;
+ case AGC2_PARAM_PROPERTIES:
+ pProperties->fixedDigitalGain =
+ (float)(effect->session->config.gain_controller2.fixed_digital.gain_db);
+ pProperties->level_estimator =
+ (uint32_t)(effect->session->config.gain_controller2.adaptive_digital.
+ level_estimator);
+ pProperties->extraSaturationMargin =
+ (float)(effect->session->config.gain_controller2.adaptive_digital.
+ extra_saturation_margin_db);
+ break;
+ default:
+ ALOGW("Agc2GetParameter() unknown param %d", param);
+ status = -EINVAL;
+ break;
+ }
+
+ return status;
+}
+#endif
+
int AgcGetParameter(preproc_effect_t *effect,
void *pParam,
uint32_t *pValueSize,
@@ -298,7 +461,9 @@
int status = 0;
uint32_t param = *(uint32_t *)pParam;
t_agc_settings *pProperties = (t_agc_settings *)pValue;
+#ifdef WEBRTC_LEGACY
webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
+#endif
switch (param) {
case AGC_PARAM_TARGET_LEVEL:
@@ -327,6 +492,7 @@
break;
}
+#ifdef WEBRTC_LEGACY
switch (param) {
case AGC_PARAM_TARGET_LEVEL:
*(int16_t *) pValue = (int16_t)(agc->target_level_dbfs() * -100);
@@ -351,12 +517,98 @@
status = -EINVAL;
break;
}
+#else
+ effect->session->config = effect->session->apm->GetConfig();
+ switch (param) {
+ case AGC_PARAM_TARGET_LEVEL:
+ *(int16_t *) pValue =
+ (int16_t)(effect->session->config.gain_controller1.target_level_dbfs * -100);
+ ALOGV("AgcGetParameter() target level %d milliBels", *(int16_t *) pValue);
+ break;
+ case AGC_PARAM_COMP_GAIN:
+ *(int16_t *) pValue =
+ (int16_t)(effect->session->config.gain_controller1.compression_gain_db * -100);
+ ALOGV("AgcGetParameter() comp gain %d milliBels", *(int16_t *) pValue);
+ break;
+ case AGC_PARAM_LIMITER_ENA:
+ *(bool *) pValue =
+ (bool)(effect->session->config.gain_controller1.enable_limiter);
+ ALOGV("AgcGetParameter() limiter enabled %s",
+ (*(int16_t *) pValue != 0) ? "true" : "false");
+ break;
+ case AGC_PARAM_PROPERTIES:
+ pProperties->targetLevel =
+ (int16_t)(effect->session->config.gain_controller1.target_level_dbfs * -100);
+ pProperties->compGain =
+ (int16_t)(effect->session->config.gain_controller1.compression_gain_db * -100);
+ pProperties->limiterEnabled =
+ (bool)(effect->session->config.gain_controller1.enable_limiter);
+ break;
+ default:
+ ALOGW("AgcGetParameter() unknown param %d", param);
+ status = -EINVAL;
+ break;
+ }
+#endif
return status;
}
+#ifndef WEBRTC_LEGACY
+int Agc2SetParameter (preproc_effect_t *effect, void *pParam, void *pValue)
+{
+ int status = 0;
+ uint32_t param = *(uint32_t *)pParam;
+ float valueFloat = 0.f;
+ agc2_settings_t *pProperties = (agc2_settings_t *)pValue;
+ effect->session->config = effect->session->apm->GetConfig();
+ switch (param) {
+ case AGC2_PARAM_FIXED_DIGITAL_GAIN:
+ valueFloat = (float)(*(int32_t *) pValue);
+ ALOGV("Agc2SetParameter() fixed digital gain %f dB", valueFloat);
+ effect->session->config.gain_controller2.fixed_digital.gain_db = valueFloat;
+ break;
+ case AGC2_PARAM_ADAPT_DIGI_LEVEL_ESTIMATOR:
+ ALOGV("Agc2SetParameter() level estimator %d", *(webrtc::AudioProcessing::Config::
+ GainController2::LevelEstimator *) pValue);
+ effect->session->config.gain_controller2.adaptive_digital.level_estimator =
+ (*(webrtc::AudioProcessing::Config::GainController2::LevelEstimator *) pValue);
+ break;
+ case AGC2_PARAM_ADAPT_DIGI_EXTRA_SATURATION_MARGIN:
+ valueFloat = (float)(*(int32_t *) pValue);
+ ALOGV("Agc2SetParameter() extra saturation margin %f dB", valueFloat);
+ effect->session->config.gain_controller2.adaptive_digital.extra_saturation_margin_db =
+ valueFloat;
+ break;
+ case AGC2_PARAM_PROPERTIES:
+ ALOGV("Agc2SetParameter() properties gain %f, level %d margin %f",
+ pProperties->fixedDigitalGain,
+ pProperties->level_estimator,
+ pProperties->extraSaturationMargin);
+ effect->session->config.gain_controller2.fixed_digital.gain_db =
+ pProperties->fixedDigitalGain;
+ effect->session->config.gain_controller2.adaptive_digital.level_estimator =
+ (webrtc::AudioProcessing::Config::GainController2::LevelEstimator)pProperties->
+ level_estimator;
+ effect->session->config.gain_controller2.adaptive_digital.extra_saturation_margin_db =
+ pProperties->extraSaturationMargin;
+ break;
+ default:
+ ALOGW("Agc2SetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
+ status = -EINVAL;
+ break;
+ }
+ effect->session->apm->ApplyConfig(effect->session->config);
+
+ ALOGV("Agc2SetParameter() done status %d", status);
+
+ return status;
+}
+#endif
+
int AgcSetParameter (preproc_effect_t *effect, void *pParam, void *pValue)
{
int status = 0;
+#ifdef WEBRTC_LEGACY
uint32_t param = *(uint32_t *)pParam;
t_agc_settings *pProperties = (t_agc_settings *)pValue;
webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
@@ -390,27 +642,95 @@
status = -EINVAL;
break;
}
+#else
+ uint32_t param = *(uint32_t *)pParam;
+ t_agc_settings *pProperties = (t_agc_settings *)pValue;
+ effect->session->config = effect->session->apm->GetConfig();
+ switch (param) {
+ case AGC_PARAM_TARGET_LEVEL:
+ ALOGV("AgcSetParameter() target level %d milliBels", *(int16_t *)pValue);
+ effect->session->config.gain_controller1.target_level_dbfs =
+ (-(*(int16_t *)pValue / 100));
+ break;
+ case AGC_PARAM_COMP_GAIN:
+ ALOGV("AgcSetParameter() comp gain %d milliBels", *(int16_t *)pValue);
+ effect->session->config.gain_controller1.compression_gain_db =
+ (*(int16_t *)pValue / 100);
+ break;
+ case AGC_PARAM_LIMITER_ENA:
+ ALOGV("AgcSetParameter() limiter enabled %s", *(bool *)pValue ? "true" : "false");
+ effect->session->config.gain_controller1.enable_limiter =
+ (*(bool *)pValue);
+ break;
+ case AGC_PARAM_PROPERTIES:
+ ALOGV("AgcSetParameter() properties level %d, gain %d limiter %d",
+ pProperties->targetLevel,
+ pProperties->compGain,
+ pProperties->limiterEnabled);
+ effect->session->config.gain_controller1.target_level_dbfs =
+ -(pProperties->targetLevel / 100);
+ effect->session->config.gain_controller1.compression_gain_db =
+ pProperties->compGain / 100;
+ effect->session->config.gain_controller1.enable_limiter =
+ pProperties->limiterEnabled;
+ break;
+ default:
+ ALOGW("AgcSetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
+ status = -EINVAL;
+ break;
+ }
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
ALOGV("AgcSetParameter() done status %d", status);
return status;
}
+#ifndef WEBRTC_LEGACY
+void Agc2Enable(preproc_effect_t *effect)
+{
+ effect->session->config = effect->session->apm->GetConfig();
+ effect->session->config.gain_controller2.enabled = true;
+ effect->session->apm->ApplyConfig(effect->session->config);
+}
+#endif
+
void AgcEnable(preproc_effect_t *effect)
{
+#ifdef WEBRTC_LEGACY
webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
ALOGV("AgcEnable agc %p", agc);
agc->Enable(true);
+#else
+ effect->session->config = effect->session->apm->GetConfig();
+ effect->session->config.gain_controller1.enabled = true;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
}
+#ifndef WEBRTC_LEGACY
+void Agc2Disable(preproc_effect_t *effect)
+{
+ effect->session->config = effect->session->apm->GetConfig();
+ effect->session->config.gain_controller2.enabled = false;
+ effect->session->apm->ApplyConfig(effect->session->config);
+}
+#endif
+
void AgcDisable(preproc_effect_t *effect)
{
+#ifdef WEBRTC_LEGACY
ALOGV("AgcDisable");
webrtc::GainControl *agc = static_cast<webrtc::GainControl *>(effect->engine);
agc->Enable(false);
+#else
+ effect->session->config = effect->session->apm->GetConfig();
+ effect->session->config.gain_controller1.enabled = false;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
}
-
static const preproc_ops_t sAgcOps = {
AgcCreate,
AgcInit,
@@ -422,26 +742,48 @@
NULL
};
+#ifndef WEBRTC_LEGACY
+static const preproc_ops_t sAgc2Ops = {
+ Agc2Create,
+ Agc2Init,
+ NULL,
+ Agc2Enable,
+ Agc2Disable,
+ Agc2SetParameter,
+ Agc2GetParameter,
+ NULL
+};
+#endif
//------------------------------------------------------------------------------
// Acoustic Echo Canceler (AEC)
//------------------------------------------------------------------------------
+#ifdef WEBRTC_LEGACY
static const webrtc::EchoControlMobile::RoutingMode kAecDefaultMode =
webrtc::EchoControlMobile::kEarpiece;
static const bool kAecDefaultComfortNoise = true;
+#endif
int AecInit (preproc_effect_t *effect)
{
ALOGV("AecInit");
+#ifdef WEBRTC_LEGACY
webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
aec->set_routing_mode(kAecDefaultMode);
aec->enable_comfort_noise(kAecDefaultComfortNoise);
+#else
+ effect->session->config =
+ effect->session->apm->GetConfig() ;
+ effect->session->config.echo_canceller.mobile_mode = false;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
return 0;
}
int AecCreate(preproc_effect_t *effect)
{
+#ifdef WEBRTC_LEGACY
webrtc::EchoControlMobile *aec = effect->session->apm->echo_control_mobile();
ALOGV("AecCreate got aec %p", aec);
if (aec == NULL) {
@@ -449,6 +791,7 @@
return -ENOMEM;
}
effect->engine = static_cast<preproc_fx_handle_t>(aec);
+#endif
AecInit (effect);
return 0;
}
@@ -470,6 +813,14 @@
*(uint32_t *)pValue = 1000 * effect->session->apm->stream_delay_ms();
ALOGV("AecGetParameter() echo delay %d us", *(uint32_t *)pValue);
break;
+#ifndef WEBRTC_LEGACY
+ case AEC_PARAM_MOBILE_MODE:
+ effect->session->config =
+ effect->session->apm->GetConfig() ;
+ *(uint32_t *)pValue = effect->session->config.echo_canceller.mobile_mode;
+ ALOGV("AecGetParameter() mobile mode %d us", *(uint32_t *)pValue);
+ break;
+#endif
default:
ALOGW("AecGetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
status = -EINVAL;
@@ -490,6 +841,15 @@
status = effect->session->apm->set_stream_delay_ms(value/1000);
ALOGV("AecSetParameter() echo delay %d us, status %d", value, status);
break;
+#ifndef WEBRTC_LEGACY
+ case AEC_PARAM_MOBILE_MODE:
+ effect->session->config =
+ effect->session->apm->GetConfig() ;
+ effect->session->config.echo_canceller.mobile_mode = value;
+ ALOGV("AecSetParameter() mobile mode %d us", value);
+ effect->session->apm->ApplyConfig(effect->session->config);
+ break;
+#endif
default:
ALOGW("AecSetParameter() unknown param %08x value %08x", param, *(uint32_t *)pValue);
status = -EINVAL;
@@ -500,28 +860,43 @@
void AecEnable(preproc_effect_t *effect)
{
+#ifdef WEBRTC_LEGACY
webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
ALOGV("AecEnable aec %p", aec);
aec->Enable(true);
+#else
+ effect->session->config = effect->session->apm->GetConfig();
+ effect->session->config.echo_canceller.enabled = true;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
}
void AecDisable(preproc_effect_t *effect)
{
+#ifdef WEBRTC_LEGACY
ALOGV("AecDisable");
webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
aec->Enable(false);
+#else
+ effect->session->config = effect->session->apm->GetConfig();
+ effect->session->config.echo_canceller.enabled = false;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
}
int AecSetDevice(preproc_effect_t *effect, uint32_t device)
{
ALOGV("AecSetDevice %08x", device);
+#ifdef WEBRTC_LEGACY
webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine);
webrtc::EchoControlMobile::RoutingMode mode = webrtc::EchoControlMobile::kQuietEarpieceOrHeadset;
+#endif
if (audio_is_input_device(device)) {
return 0;
}
+#ifdef WEBRTC_LEGACY
switch(device) {
case AUDIO_DEVICE_OUT_EARPIECE:
mode = webrtc::EchoControlMobile::kEarpiece;
@@ -536,6 +911,7 @@
break;
}
aec->set_routing_mode(mode);
+#endif
return 0;
}
@@ -554,11 +930,17 @@
// Noise Suppression (NS)
//------------------------------------------------------------------------------
+#ifdef WEBRTC_LEGACY
static const webrtc::NoiseSuppression::Level kNsDefaultLevel = webrtc::NoiseSuppression::kModerate;
+#else
+static const webrtc::AudioProcessing::Config::NoiseSuppression::Level kNsDefaultLevel =
+ webrtc::AudioProcessing::Config::NoiseSuppression::kModerate;
+#endif
int NsInit (preproc_effect_t *effect)
{
ALOGV("NsInit");
+#ifdef WEBRTC_LEGACY
webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
ns->set_level(kNsDefaultLevel);
webrtc::Config config;
@@ -575,12 +957,20 @@
config.Set<webrtc::Beamforming>(
new webrtc::Beamforming(false, geometry));
effect->session->apm->SetExtraOptions(config);
+#else
+ effect->session->config =
+ effect->session->apm->GetConfig() ;
+ effect->session->config.noise_suppression.level =
+ kNsDefaultLevel;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
effect->type = NS_TYPE_SINGLE_CHANNEL;
return 0;
}
int NsCreate(preproc_effect_t *effect)
{
+#ifdef WEBRTC_LEGACY
webrtc::NoiseSuppression *ns = effect->session->apm->noise_suppression();
ALOGV("NsCreate got ns %p", ns);
if (ns == NULL) {
@@ -588,6 +978,7 @@
return -ENOMEM;
}
effect->engine = static_cast<preproc_fx_handle_t>(ns);
+#endif
NsInit (effect);
return 0;
}
@@ -604,6 +995,7 @@
int NsSetParameter (preproc_effect_t *effect, void *pParam, void *pValue)
{
int status = 0;
+#ifdef WEBRTC_LEGACY
webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
uint32_t param = *(uint32_t *)pParam;
uint32_t value = *(uint32_t *)pValue;
@@ -629,12 +1021,30 @@
ALOGW("NsSetParameter() unknown param %08x value %08x", param, value);
status = -EINVAL;
}
+#else
+ uint32_t param = *(uint32_t *)pParam;
+ uint32_t value = *(uint32_t *)pValue;
+ effect->session->config =
+ effect->session->apm->GetConfig();
+ switch (param) {
+ case NS_PARAM_LEVEL:
+ effect->session->config.noise_suppression.level =
+ (webrtc::AudioProcessing::Config::NoiseSuppression::Level)value;
+ ALOGV("NsSetParameter() level %d", value);
+ break;
+ default:
+ ALOGW("NsSetParameter() unknown param %08x value %08x", param, value);
+ status = -EINVAL;
+ }
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
return status;
}
void NsEnable(preproc_effect_t *effect)
{
+#ifdef WEBRTC_LEGACY
webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
ALOGV("NsEnable ns %p", ns);
ns->Enable(true);
@@ -644,17 +1054,30 @@
config.Set<webrtc::Beamforming>(new webrtc::Beamforming(true, geometry));
effect->session->apm->SetExtraOptions(config);
}
+#else
+ effect->session->config =
+ effect->session->apm->GetConfig();
+ effect->session->config.noise_suppression.enabled = true;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
}
void NsDisable(preproc_effect_t *effect)
{
ALOGV("NsDisable");
+#ifdef WEBRTC_LEGACY
webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
ns->Enable(false);
webrtc::Config config;
std::vector<webrtc::Point> geometry;
config.Set<webrtc::Beamforming>(new webrtc::Beamforming(false, geometry));
effect->session->apm->SetExtraOptions(config);
+#else
+ effect->session->config =
+ effect->session->apm->GetConfig();
+ effect->session->config.noise_suppression.enabled = false;
+ effect->session->apm->ApplyConfig(effect->session->config);
+#endif
}
static const preproc_ops_t sNsOps = {
@@ -669,8 +1092,12 @@
};
+
static const preproc_ops_t *sPreProcOps[PREPROC_NUM_EFFECTS] = {
&sAgcOps,
+#ifndef WEBRTC_LEGACY
+ &sAgc2Ops,
+#endif
&sAecOps,
&sNsOps
};
@@ -812,7 +1239,9 @@
session->id = 0;
session->io = 0;
session->createdMsk = 0;
+#ifdef WEBRTC_LEGACY
session->apm = NULL;
+#endif
for (i = 0; i < PREPROC_NUM_EFFECTS && status == 0; i++) {
status = Effect_Init(&session->effects[i], i);
}
@@ -829,6 +1258,7 @@
ALOGV("Session_CreateEffect procId %d, createdMsk %08x", procId, session->createdMsk);
if (session->createdMsk == 0) {
+#ifdef WEBRTC_LEGACY
session->apm = webrtc::AudioProcessing::Create();
if (session->apm == NULL) {
ALOGW("Session_CreateEffect could not get apm engine");
@@ -850,28 +1280,53 @@
ALOGW("Session_CreateEffect could not allocate reverse audio frame");
goto error;
}
+#else
+ session->apm = session->ap_builder.Create();
+ if (session->apm == NULL) {
+ ALOGW("Session_CreateEffect could not get apm engine");
+ goto error;
+ }
+#endif
session->apmSamplingRate = kPreprocDefaultSr;
session->apmFrameCount = (kPreprocDefaultSr) / 100;
session->frameCount = session->apmFrameCount;
session->samplingRate = kPreprocDefaultSr;
session->inChannelCount = kPreProcDefaultCnl;
session->outChannelCount = kPreProcDefaultCnl;
+#ifdef WEBRTC_LEGACY
session->procFrame->sample_rate_hz_ = kPreprocDefaultSr;
session->procFrame->num_channels_ = kPreProcDefaultCnl;
+#else
+ session->inputConfig.set_sample_rate_hz(kPreprocDefaultSr);
+ session->inputConfig.set_num_channels(kPreProcDefaultCnl);
+ session->outputConfig.set_sample_rate_hz(kPreprocDefaultSr);
+ session->outputConfig.set_num_channels(kPreProcDefaultCnl);
+#endif
session->revChannelCount = kPreProcDefaultCnl;
+#ifdef WEBRTC_LEGACY
session->revFrame->sample_rate_hz_ = kPreprocDefaultSr;
session->revFrame->num_channels_ = kPreProcDefaultCnl;
+#else
+ session->revConfig.set_sample_rate_hz(kPreprocDefaultSr);
+ session->revConfig.set_num_channels(kPreProcDefaultCnl);
+#endif
session->enabledMsk = 0;
session->processedMsk = 0;
session->revEnabledMsk = 0;
session->revProcessedMsk = 0;
+#ifdef WEBRTC_LEGACY
session->inResampler = NULL;
+#endif
session->inBuf = NULL;
session->inBufSize = 0;
+#ifdef WEBRTC_LEGACY
session->outResampler = NULL;
+#endif
session->outBuf = NULL;
session->outBufSize = 0;
+#ifdef WEBRTC_LEGACY
session->revResampler = NULL;
+#endif
session->revBuf = NULL;
session->revBufSize = 0;
}
@@ -885,12 +1340,17 @@
error:
if (session->createdMsk == 0) {
+#ifdef WEBRTC_LEGACY
delete session->revFrame;
session->revFrame = NULL;
delete session->procFrame;
session->procFrame = NULL;
delete session->apm;
session->apm = NULL; // NOLINT(clang-analyzer-cplusplus.NewDelete)
+#else
+ delete session->apm;
+ session->apm = NULL;
+#endif
}
return status;
}
@@ -901,6 +1361,7 @@
ALOGW_IF(Effect_Release(fx) != 0, " Effect_Release() failed for proc ID %d", fx->procId);
session->createdMsk &= ~(1<<fx->procId);
if (session->createdMsk == 0) {
+#ifdef WEBRTC_LEGACY
delete session->apm;
session->apm = NULL;
delete session->procFrame;
@@ -919,6 +1380,10 @@
speex_resampler_destroy(session->revResampler);
session->revResampler = NULL;
}
+#else
+ delete session->apm;
+ session->apm = NULL;
+#endif
delete session->inBuf;
session->inBuf = NULL;
delete session->outBuf;
@@ -946,7 +1411,9 @@
ALOGV("Session_SetConfig sr %d cnl %08x",
config->inputCfg.samplingRate, config->inputCfg.channels);
+#ifdef WEBRTC_LEGACY
int status;
+#endif
// AEC implementation is limited to 16kHz
if (config->inputCfg.samplingRate >= 32000 && !(session->createdMsk & (1 << PREPROC_AEC))) {
@@ -958,6 +1425,7 @@
session->apmSamplingRate = 8000;
}
+#ifdef WEBRTC_LEGACY
const webrtc::ProcessingConfig processing_config = {
{{static_cast<int>(session->apmSamplingRate), inCnl},
{static_cast<int>(session->apmSamplingRate), outCnl},
@@ -967,23 +1435,41 @@
if (status < 0) {
return -EINVAL;
}
+#endif
session->samplingRate = config->inputCfg.samplingRate;
session->apmFrameCount = session->apmSamplingRate / 100;
if (session->samplingRate == session->apmSamplingRate) {
session->frameCount = session->apmFrameCount;
} else {
+#ifdef WEBRTC_LEGACY
session->frameCount = (session->apmFrameCount * session->samplingRate) /
session->apmSamplingRate + 1;
+#else
+ session->frameCount = (session->apmFrameCount * session->samplingRate) /
+ session->apmSamplingRate;
+#endif
}
session->inChannelCount = inCnl;
session->outChannelCount = outCnl;
+#ifdef WEBRTC_LEGACY
session->procFrame->num_channels_ = inCnl;
session->procFrame->sample_rate_hz_ = session->apmSamplingRate;
+#else
+ session->inputConfig.set_sample_rate_hz(session->samplingRate);
+ session->inputConfig.set_num_channels(inCnl);
+ session->outputConfig.set_sample_rate_hz(session->samplingRate);
+ session->outputConfig.set_num_channels(inCnl);
+#endif
session->revChannelCount = inCnl;
+#ifdef WEBRTC_LEGACY
session->revFrame->num_channels_ = inCnl;
session->revFrame->sample_rate_hz_ = session->apmSamplingRate;
+#else
+ session->revConfig.set_sample_rate_hz(session->samplingRate);
+ session->revConfig.set_num_channels(inCnl);
+#endif
// force process buffer reallocation
session->inBufSize = 0;
@@ -992,6 +1478,7 @@
session->framesOut = 0;
+#ifdef WEBRTC_LEGACY
if (session->inResampler != NULL) {
speex_resampler_destroy(session->inResampler);
session->inResampler = NULL;
@@ -1043,6 +1530,7 @@
return -EINVAL;
}
}
+#endif
session->state = PREPROC_SESSION_STATE_CONFIG;
return 0;
@@ -1079,6 +1567,7 @@
return -EINVAL;
}
uint32_t inCnl = audio_channel_count_from_out_mask(config->inputCfg.channels);
+#ifdef WEBRTC_LEGACY
const webrtc::ProcessingConfig processing_config = {
{{static_cast<int>(session->apmSamplingRate), session->inChannelCount},
{static_cast<int>(session->apmSamplingRate), session->outChannelCount},
@@ -1088,9 +1577,12 @@
if (status < 0) {
return -EINVAL;
}
+#endif
session->revChannelCount = inCnl;
+#ifdef WEBRTC_LEGACY
session->revFrame->num_channels_ = inCnl;
session->revFrame->sample_rate_hz_ = session->apmSamplingRate;
+#endif
// force process buffer reallocation
session->revBufSize = 0;
session->framesRev = 0;
@@ -1114,6 +1606,7 @@
if (enabled) {
if(session->enabledMsk == 0) {
session->framesIn = 0;
+#ifdef WEBRTC_LEGACY
if (session->inResampler != NULL) {
speex_resampler_reset_mem(session->inResampler);
}
@@ -1121,13 +1614,16 @@
if (session->outResampler != NULL) {
speex_resampler_reset_mem(session->outResampler);
}
+#endif
}
session->enabledMsk |= (1 << procId);
if (HasReverseStream(procId)) {
session->framesRev = 0;
+#ifdef WEBRTC_LEGACY
if (session->revResampler != NULL) {
speex_resampler_reset_mem(session->revResampler);
}
+#endif
session->revEnabledMsk |= (1 << procId);
}
} else {
@@ -1252,6 +1748,7 @@
return 0;
}
+#ifdef WEBRTC_LEGACY
if (session->inResampler != NULL) {
size_t fr = session->frameCount - session->framesIn;
if (inBuffer->frameCount < fr) {
@@ -1335,6 +1832,28 @@
session->procFrame->samples_per_channel_ = session->apmFrameCount;
effect->session->apm->ProcessStream(session->procFrame);
+#else
+ size_t fr = session->frameCount - session->framesIn;
+ if (inBuffer->frameCount < fr) {
+ fr = inBuffer->frameCount;
+ }
+ session->framesIn += fr;
+ inBuffer->frameCount = fr;
+ if (session->framesIn < session->frameCount) {
+ return 0;
+ }
+ session->framesIn = 0;
+ if (int status = effect->session->apm->ProcessStream(
+ (const int16_t* const)inBuffer->s16,
+ (const webrtc::StreamConfig)effect->session->inputConfig,
+ (const webrtc::StreamConfig)effect->session->outputConfig,
+ (int16_t* const)outBuffer->s16);
+ status != 0) {
+ ALOGE("Process Stream failed with error %d\n", status);
+ return status;
+ }
+ outBuffer->frameCount = inBuffer->frameCount;
+#endif
if (session->outBufSize < session->framesOut + session->frameCount) {
int16_t *buf;
@@ -1350,6 +1869,7 @@
session->outBuf = buf;
}
+#ifdef WEBRTC_LEGACY
if (session->outResampler != NULL) {
spx_uint32_t frIn = session->apmFrameCount;
spx_uint32_t frOut = session->frameCount;
@@ -1375,6 +1895,9 @@
session->framesOut += session->frameCount;
}
size_t fr = session->framesOut;
+#else
+ fr = session->framesOut;
+#endif
if (framesRq - framesWr < fr) {
fr = framesRq - framesWr;
}
@@ -1794,6 +2317,7 @@
if ((session->revProcessedMsk & session->revEnabledMsk) == session->revEnabledMsk) {
effect->session->revProcessedMsk = 0;
+#ifdef WEBRTC_LEGACY
if (session->revResampler != NULL) {
size_t fr = session->frameCount - session->framesRev;
if (inBuffer->frameCount < fr) {
@@ -1858,6 +2382,27 @@
}
session->revFrame->samples_per_channel_ = session->apmFrameCount;
effect->session->apm->AnalyzeReverseStream(session->revFrame);
+#else
+ size_t fr = session->frameCount - session->framesRev;
+ if (inBuffer->frameCount < fr) {
+ fr = inBuffer->frameCount;
+ }
+ session->framesRev += fr;
+ inBuffer->frameCount = fr;
+ if (session->framesRev < session->frameCount) {
+ return 0;
+ }
+ session->framesRev = 0;
+ if (int status = effect->session->apm->ProcessReverseStream(
+ (const int16_t* const)inBuffer->s16,
+ (const webrtc::StreamConfig)effect->session->revConfig,
+ (const webrtc::StreamConfig)effect->session->revConfig,
+ (int16_t* const)outBuffer->s16);
+ status != 0) {
+ ALOGE("Process Reverse Stream failed with error %d\n", status);
+ return status;
+ }
+#endif
return 0;
} else {
return -ENODATA;
diff --git a/media/libeffects/preprocessing/tests/Android.bp b/media/libeffects/preprocessing/tests/Android.bp
index 71f6e8f..045b0d3 100644
--- a/media/libeffects/preprocessing/tests/Android.bp
+++ b/media/libeffects/preprocessing/tests/Android.bp
@@ -1,5 +1,37 @@
// audio preprocessing unit test
cc_test {
+ name: "AudioPreProcessingLegacyTest",
+
+ vendor: true,
+
+ relative_install_path: "soundfx",
+
+ srcs: ["PreProcessingTest.cpp"],
+
+ shared_libs: [
+ "libaudiopreprocessing_legacy",
+ "libaudioutils",
+ "liblog",
+ "libutils",
+ "libwebrtc_audio_preprocessing",
+ ],
+
+ cflags: [
+ "-DWEBRTC_POSIX",
+ "-DWEBRTC_LEGACY",
+ "-fvisibility=default",
+ "-Wall",
+ "-Werror",
+ "-Wextra",
+ ],
+
+ header_libs: [
+ "libaudioeffects",
+ "libhardware_headers",
+ ],
+}
+
+cc_test {
name: "AudioPreProcessingTest",
vendor: true,
@@ -13,16 +45,7 @@
"libaudioutils",
"liblog",
"libutils",
- "libwebrtc_audio_preprocessing",
],
-
- cflags: [
- "-DWEBRTC_POSIX",
- "-fvisibility=default",
- "-Wall",
- "-Werror",
- ],
-
header_libs: [
"libaudioeffects",
"libhardware_headers",
diff --git a/media/libeffects/preprocessing/tests/PreProcessingTest.cpp b/media/libeffects/preprocessing/tests/PreProcessingTest.cpp
index 5c81d78..3244c1f 100644
--- a/media/libeffects/preprocessing/tests/PreProcessingTest.cpp
+++ b/media/libeffects/preprocessing/tests/PreProcessingTest.cpp
@@ -14,23 +14,19 @@
* limitations under the License.
*/
+#include <getopt.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <sys/stat.h>
+#include <vector>
+
#include <audio_effects/effect_aec.h>
#include <audio_effects/effect_agc.h>
+#ifndef WEBRTC_LEGACY
+#include <audio_effects/effect_agc2.h>
+#endif
#include <audio_effects/effect_ns.h>
-#include <audio_processing.h>
-#include <getopt.h>
-#include <hardware/audio_effect.h>
-#include <module_common_types.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <utils/Log.h>
-#include <utils/Timers.h>
-
-#include <audio_utils/channels.h>
-#include <audio_utils/primitives.h>
#include <log/log.h>
-#include <system/audio.h>
// This is the only symbol that needs to be imported
extern audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM;
@@ -42,6 +38,9 @@
// types of pre processing modules
enum PreProcId {
PREPROC_AGC, // Automatic Gain Control
+#ifndef WEBRTC_LEGACY
+ PREPROC_AGC2, // Automatic Gain Control 2
+#endif
PREPROC_AEC, // Acoustic Echo Canceler
PREPROC_NS, // Noise Suppressor
PREPROC_NUM_EFFECTS
@@ -58,6 +57,12 @@
ARG_AGC_COMP_LVL,
ARG_AEC_DELAY,
ARG_NS_LVL,
+#ifndef WEBRTC_LEGACY
+ ARG_AEC_MOBILE,
+ ARG_AGC2_GAIN,
+ ARG_AGC2_LVL,
+ ARG_AGC2_SAT_MGN
+#endif
};
struct preProcConfigParams_t {
@@ -66,11 +71,19 @@
int nsLevel = 0; // a value between 0-3
int agcTargetLevel = 3; // in dB
int agcCompLevel = 9; // in dB
+#ifndef WEBRTC_LEGACY
+ float agc2Gain = 0.f; // in dB
+ float agc2SaturationMargin = 2.f; // in dB
+ int agc2Level = 0; // either kRms(0) or kPeak(1)
+#endif
int aecDelay = 0; // in ms
};
const effect_uuid_t kPreProcUuids[PREPROC_NUM_EFFECTS] = {
{0xaa8130e0, 0x66fc, 0x11e0, 0xbad0, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // agc uuid
+#ifndef WEBRTC_LEGACY
+ {0x89f38e65, 0xd4d2, 0x4d64, 0xad0e, {0x2b, 0x3e, 0x79, 0x9e, 0xa8, 0x86}}, // agc2 uuid
+#endif
{0xbb392ec0, 0x8d4d, 0x11e0, 0xa896, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // aec uuid
{0xc06c8400, 0x8e06, 0x11e0, 0x9cb6, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, // ns uuid
};
@@ -126,14 +139,30 @@
printf("\n Enable Noise Suppression, default disabled");
printf("\n --agc");
printf("\n Enable Gain Control, default disabled");
+#ifndef WEBRTC_LEGACY
+ printf("\n --agc2");
+ printf("\n Enable Gain Controller 2, default disabled");
+#endif
printf("\n --ns_lvl <ns_level>");
printf("\n Noise Suppression level in dB, default value 0dB");
printf("\n --agc_tgt_lvl <target_level>");
printf("\n AGC Target Level in dB, default value 3dB");
printf("\n --agc_comp_lvl <comp_level>");
printf("\n AGC Comp Level in dB, default value 9dB");
+#ifndef WEBRTC_LEGACY
+ printf("\n --agc2_gain <fixed_digital_gain>");
+ printf("\n AGC Fixed Digital Gain in dB, default value 0dB");
+ printf("\n --agc2_lvl <level_estimator>");
+ printf("\n AGC Adaptive Digital Level Estimator, default value kRms");
+ printf("\n --agc2_sat_mgn <saturation_margin>");
+ printf("\n AGC Adaptive Digital Saturation Margin in dB, default value 2dB");
+#endif
printf("\n --aec_delay <delay>");
printf("\n AEC delay value in ms, default value 0ms");
+#ifndef WEBRTC_LEGACY
+ printf("\n --aec_mobile");
+ printf("\n Enable mobile mode of echo canceller, default disabled");
+#endif
printf("\n");
}
@@ -184,6 +213,9 @@
const char *outputFile = nullptr;
const char *farFile = nullptr;
int effectEn[PREPROC_NUM_EFFECTS] = {0};
+#ifndef WEBRTC_LEGACY
+ int aecMobileMode = 0;
+#endif
const option long_opts[] = {
{"help", no_argument, nullptr, ARG_HELP},
@@ -194,11 +226,22 @@
{"ch_mask", required_argument, nullptr, ARG_CH_MASK},
{"agc_tgt_lvl", required_argument, nullptr, ARG_AGC_TGT_LVL},
{"agc_comp_lvl", required_argument, nullptr, ARG_AGC_COMP_LVL},
+#ifndef WEBRTC_LEGACY
+ {"agc2_gain", required_argument, nullptr, ARG_AGC2_GAIN},
+ {"agc2_lvl", required_argument, nullptr, ARG_AGC2_LVL},
+ {"agc2_sat_mgn", required_argument, nullptr, ARG_AGC2_SAT_MGN},
+#endif
{"aec_delay", required_argument, nullptr, ARG_AEC_DELAY},
{"ns_lvl", required_argument, nullptr, ARG_NS_LVL},
{"aec", no_argument, &effectEn[PREPROC_AEC], 1},
{"agc", no_argument, &effectEn[PREPROC_AGC], 1},
+#ifndef WEBRTC_LEGACY
+ {"agc2", no_argument, &effectEn[PREPROC_AGC2], 1},
+#endif
{"ns", no_argument, &effectEn[PREPROC_NS], 1},
+#ifndef WEBRTC_LEGACY
+ {"aec_mobile", no_argument, &aecMobileMode, 1},
+#endif
{nullptr, 0, nullptr, 0},
};
struct preProcConfigParams_t preProcCfgParams {};
@@ -246,6 +289,20 @@
preProcCfgParams.agcCompLevel = atoi(optarg);
break;
}
+#ifndef WEBRTC_LEGACY
+ case ARG_AGC2_GAIN: {
+ preProcCfgParams.agc2Gain = atof(optarg);
+ break;
+ }
+ case ARG_AGC2_LVL: {
+ preProcCfgParams.agc2Level = atoi(optarg);
+ break;
+ }
+ case ARG_AGC2_SAT_MGN: {
+ preProcCfgParams.agc2SaturationMargin = atof(optarg);
+ break;
+ }
+#endif
case ARG_AEC_DELAY: {
preProcCfgParams.aecDelay = atoi(optarg);
break;
@@ -342,6 +399,31 @@
return EXIT_FAILURE;
}
}
+#ifndef WEBRTC_LEGACY
+ if (effectEn[PREPROC_AGC2]) {
+ if (int status = preProcSetConfigParam(AGC2_PARAM_FIXED_DIGITAL_GAIN,
+ (float)preProcCfgParams.agc2Gain,
+ effectHandle[PREPROC_AGC2]);
+ status != 0) {
+ ALOGE("Invalid AGC2 Fixed Digital Gain. Error %d\n", status);
+ return EXIT_FAILURE;
+ }
+ if (int status = preProcSetConfigParam(AGC2_PARAM_ADAPT_DIGI_LEVEL_ESTIMATOR,
+ (uint32_t)preProcCfgParams.agc2Level,
+ effectHandle[PREPROC_AGC2]);
+ status != 0) {
+ ALOGE("Invalid AGC2 Level Estimator. Error %d\n", status);
+ return EXIT_FAILURE;
+ }
+ if (int status = preProcSetConfigParam(AGC2_PARAM_ADAPT_DIGI_EXTRA_SATURATION_MARGIN,
+ (float)preProcCfgParams.agc2SaturationMargin,
+ effectHandle[PREPROC_AGC2]);
+ status != 0) {
+ ALOGE("Invalid AGC2 Saturation Margin. Error %d\n", status);
+ return EXIT_FAILURE;
+ }
+ }
+#endif
if (effectEn[PREPROC_NS]) {
if (int status = preProcSetConfigParam(NS_PARAM_LEVEL, (uint32_t)preProcCfgParams.nsLevel,
effectHandle[PREPROC_NS]);
@@ -350,6 +432,16 @@
return EXIT_FAILURE;
}
}
+#ifndef WEBRTC_LEGACY
+ if (effectEn[PREPROC_AEC]) {
+ if (int status = preProcSetConfigParam(AEC_PARAM_MOBILE_MODE, (uint32_t)aecMobileMode,
+ effectHandle[PREPROC_AEC]);
+ status != 0) {
+ ALOGE("Invalid AEC mobile mode value %d\n", status);
+ return EXIT_FAILURE;
+ }
+ }
+#endif
// Process Call
const int frameLength = (int)(preProcCfgParams.samplingFreq * kTenMilliSecVal);
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index 20bc23d..4c76fd2 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -958,7 +958,7 @@
case PREPARE_DRM: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
- uint8_t uuid[16];
+ uint8_t uuid[16] = {};
data.read(uuid, sizeof(uuid));
Vector<uint8_t> drmSessionId;
readVector(data, drmSessionId);
diff --git a/media/libmedia/aidl/android/media/IResourceManagerService.aidl b/media/libmedia/aidl/android/media/IResourceManagerService.aidl
index 1b2d522..621bd84 100644
--- a/media/libmedia/aidl/android/media/IResourceManagerService.aidl
+++ b/media/libmedia/aidl/android/media/IResourceManagerService.aidl
@@ -102,4 +102,11 @@
* @param clientId clientId within the pid that will be removed.
*/
void markClientForPendingRemoval(int pid, long clientId);
+
+ /**
+ * Reclaim resources from clients pending removal, if any.
+ *
+ * @param pid pid from which resources will be reclaimed.
+ */
+ void reclaimResourcesFromClientsPendingRemoval(int pid);
}
diff --git a/media/libmedia/tests/codeclist/Android.bp b/media/libmedia/tests/codeclist/Android.bp
new file mode 100644
index 0000000..b9c1bdb
--- /dev/null
+++ b/media/libmedia/tests/codeclist/Android.bp
@@ -0,0 +1,47 @@
+/*
+ * 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: "CodecListTest",
+ gtest: true,
+
+ srcs: [
+ "CodecListTest.cpp",
+ ],
+
+ shared_libs: [
+ "libbinder",
+ "liblog",
+ "libmedia_codeclist",
+ "libstagefright",
+ "libstagefright_foundation",
+ "libstagefright_xmlparser",
+ "libutils",
+ ],
+
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+
+ sanitize: {
+ cfi: true,
+ misc_undefined: [
+ "unsigned-integer-overflow",
+ "signed-integer-overflow",
+ ],
+ },
+}
diff --git a/media/libmedia/tests/codeclist/CodecListTest.cpp b/media/libmedia/tests/codeclist/CodecListTest.cpp
new file mode 100644
index 0000000..bd2adf7
--- /dev/null
+++ b/media/libmedia/tests/codeclist/CodecListTest.cpp
@@ -0,0 +1,222 @@
+/*
+ * 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 "CodecListTest"
+#include <utils/Log.h>
+
+#include <gtest/gtest.h>
+
+#include <binder/Parcel.h>
+#include <media/stagefright/MediaCodecConstants.h>
+#include <media/stagefright/MediaCodecList.h>
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/AString.h>
+#include <media/stagefright/xmlparser/MediaCodecsXmlParser.h>
+
+#define kSwCodecXmlPath "/apex/com.android.media.swcodec/etc/"
+
+using namespace android;
+
+struct CddReq {
+ CddReq(const char *type, bool encoder) {
+ mediaType = type;
+ isEncoder = encoder;
+ }
+
+ const char *mediaType;
+ bool isEncoder;
+};
+
+TEST(CodecListTest, CodecListSanityTest) {
+ sp<IMediaCodecList> list = MediaCodecList::getInstance();
+ ASSERT_NE(list, nullptr) << "Unable to get MediaCodecList instance.";
+ EXPECT_GT(list->countCodecs(), 0) << "No codecs in CodecList";
+ for (size_t i = 0; i < list->countCodecs(); ++i) {
+ sp<MediaCodecInfo> info = list->getCodecInfo(i);
+ ASSERT_NE(info, nullptr) << "CodecInfo is null";
+ ssize_t index = list->findCodecByName(info->getCodecName());
+ EXPECT_GE(index, 0) << "Wasn't able to find existing codec: " << info->getCodecName();
+ }
+}
+
+TEST(CodecListTest, CodecListByTypeTest) {
+ sp<IMediaCodecList> list = MediaCodecList::getInstance();
+ ASSERT_NE(list, nullptr) << "Unable to get MediaCodecList instance.";
+
+ std::vector<CddReq> cddReq{
+ // media type, isEncoder
+ CddReq(MIMETYPE_AUDIO_AAC, false),
+ CddReq(MIMETYPE_AUDIO_AAC, true),
+
+ CddReq(MIMETYPE_VIDEO_AVC, false),
+ CddReq(MIMETYPE_VIDEO_HEVC, false),
+ CddReq(MIMETYPE_VIDEO_MPEG4, false),
+ CddReq(MIMETYPE_VIDEO_VP8, false),
+ CddReq(MIMETYPE_VIDEO_VP9, false),
+
+ CddReq(MIMETYPE_VIDEO_AVC, true),
+ CddReq(MIMETYPE_VIDEO_VP8, true),
+ };
+
+ for (CddReq codecReq : cddReq) {
+ ssize_t index = list->findCodecByType(codecReq.mediaType, codecReq.isEncoder);
+ EXPECT_GE(index, 0) << "Wasn't able to find codec for media type: " << codecReq.mediaType
+ << (codecReq.isEncoder ? " encoder" : " decoder");
+ }
+}
+
+TEST(CodecInfoTest, ListInfoTest) {
+ ALOGV("Compare CodecInfo with info in XML");
+ MediaCodecsXmlParser parser;
+ status_t status = parser.parseXmlFilesInSearchDirs();
+ ASSERT_EQ(status, OK) << "XML Parsing failed for default paths";
+
+ const std::vector<std::string> &xmlFiles = MediaCodecsXmlParser::getDefaultXmlNames();
+ const std::vector<std::string> &searchDirsApex{std::string(kSwCodecXmlPath)};
+ status = parser.parseXmlFilesInSearchDirs(xmlFiles, searchDirsApex);
+ ASSERT_EQ(status, OK) << "XML Parsing of " << kSwCodecXmlPath << " failed";
+
+ MediaCodecsXmlParser::CodecMap codecMap = parser.getCodecMap();
+
+ sp<IMediaCodecList> list = MediaCodecList::getInstance();
+ ASSERT_NE(list, nullptr) << "Unable to get MediaCodecList instance";
+
+ // Compare CodecMap from XML to CodecList
+ for (auto mapIter : codecMap) {
+ ssize_t index = list->findCodecByName(mapIter.first.c_str());
+ if (index < 0) {
+ std::cout << "[ WARN ] " << mapIter.first << " not found in CodecList \n";
+ continue;
+ }
+
+ sp<MediaCodecInfo> info = list->getCodecInfo(index);
+ ASSERT_NE(info, nullptr) << "CodecInfo is null";
+
+ MediaCodecsXmlParser::CodecProperties codecProperties = mapIter.second;
+ ASSERT_EQ(codecProperties.isEncoder, info->isEncoder()) << "Encoder property mismatch";
+
+ ALOGV("codec name: %s", info->getCodecName());
+ ALOGV("codec rank: %d", info->getRank());
+ ALOGV("codec ownername: %s", info->getOwnerName());
+ ALOGV("codec isEncoder: %d", info->isEncoder());
+
+ ALOGV("attributeFlags: kFlagIsHardwareAccelerated, kFlagIsSoftwareOnly, kFlagIsVendor, "
+ "kFlagIsEncoder");
+ std::bitset<4> attr(info->getAttributes());
+ ALOGV("codec attributes: %s", attr.to_string().c_str());
+
+ Vector<AString> mediaTypes;
+ info->getSupportedMediaTypes(&mediaTypes);
+ ALOGV("supported media types count: %zu", mediaTypes.size());
+ ASSERT_FALSE(mediaTypes.isEmpty())
+ << "no media type supported by codec: " << info->getCodecName();
+
+ MediaCodecsXmlParser::TypeMap typeMap = codecProperties.typeMap;
+ for (auto mediaType : mediaTypes) {
+ ALOGV("codec mediaTypes: %s", mediaType.c_str());
+ auto searchTypeMap = typeMap.find(mediaType.c_str());
+ ASSERT_NE(searchTypeMap, typeMap.end())
+ << "CodecList doesn't contain codec media type: " << mediaType.c_str();
+ MediaCodecsXmlParser::AttributeMap attributeMap = searchTypeMap->second;
+
+ const sp<MediaCodecInfo::Capabilities> &capabilities =
+ info->getCapabilitiesFor(mediaType.c_str());
+
+ Vector<uint32_t> colorFormats;
+ capabilities->getSupportedColorFormats(&colorFormats);
+ for (auto colorFormat : colorFormats) {
+ ALOGV("supported color formats: %d", colorFormat);
+ }
+
+ Vector<MediaCodecInfo::ProfileLevel> profileLevels;
+ capabilities->getSupportedProfileLevels(&profileLevels);
+ if (!profileLevels.empty()) {
+ ALOGV("supported profilelevel for media type: %s", mediaType.c_str());
+ }
+ for (auto profileLevel : profileLevels) {
+ ALOGV("profile: %d, level: %d", profileLevel.mProfile, profileLevel.mLevel);
+ }
+
+ sp<AMessage> details = capabilities->getDetails();
+ ASSERT_NE(details, nullptr) << "Details in codec capabilities is null";
+ ALOGV("no. of entries in details: %zu", details->countEntries());
+
+ for (size_t idxDetail = 0; idxDetail < details->countEntries(); idxDetail++) {
+ AMessage::Type type;
+ const char *name = details->getEntryNameAt(idxDetail, &type);
+ ALOGV("details entry name: %s", name);
+ AMessage::ItemData itemData = details->getEntryAt(idxDetail);
+ switch (type) {
+ case AMessage::kTypeInt32:
+ int32_t val32;
+ if (itemData.find(&val32)) {
+ ALOGV("entry int val: %d", val32);
+ auto searchAttr = attributeMap.find(name);
+ if (searchAttr == attributeMap.end()) {
+ ALOGW("Parser doesn't have key: %s", name);
+ } else if (stoi(searchAttr->second) != val32) {
+ ALOGW("Values didn't match for key: %s", name);
+ ALOGV("Values act/exp: %d / %d", val32, stoi(searchAttr->second));
+ }
+ }
+ break;
+ case AMessage::kTypeString:
+ if (AString valStr; itemData.find(&valStr)) {
+ ALOGV("entry str val: %s", valStr.c_str());
+ auto searchAttr = attributeMap.find(name);
+ if (searchAttr == attributeMap.end()) {
+ ALOGW("Parser doesn't have key: %s", name);
+ } else if (searchAttr->second != valStr.c_str()) {
+ ALOGW("Values didn't match for key: %s", name);
+ ALOGV("Values act/exp: %s / %s", valStr.c_str(),
+ searchAttr->second.c_str());
+ }
+ }
+ break;
+ default:
+ ALOGV("data type: %d shouldn't be present in details", type);
+ break;
+ }
+ }
+ }
+
+ Parcel *codecInfoParcel = new Parcel();
+ ASSERT_NE(codecInfoParcel, nullptr) << "Unable to create parcel";
+
+ status_t status = info->writeToParcel(codecInfoParcel);
+ ASSERT_EQ(status, OK) << "Writing to parcel failed";
+
+ codecInfoParcel->setDataPosition(0);
+ sp<MediaCodecInfo> parcelCodecInfo = info->FromParcel(*codecInfoParcel);
+ ASSERT_NE(parcelCodecInfo, nullptr) << "CodecInfo from parcel is null";
+ delete codecInfoParcel;
+
+ EXPECT_STREQ(info->getCodecName(), parcelCodecInfo->getCodecName())
+ << "Returned codec name in info doesn't match";
+ EXPECT_EQ(info->getRank(), parcelCodecInfo->getRank())
+ << "Returned component rank in info doesn't match";
+ }
+}
+
+TEST(CodecListTest, CodecListGlobalSettingsTest) {
+ sp<IMediaCodecList> list = MediaCodecList::getInstance();
+ ASSERT_NE(list, nullptr) << "Unable to get MediaCodecList instance";
+
+ sp<AMessage> globalSettings = list->getGlobalSettings();
+ ASSERT_NE(globalSettings, nullptr) << "GlobalSettings AMessage is null";
+ ALOGV("global settings: %s", globalSettings->debugString(0).c_str());
+}
diff --git a/media/libmedia/xsd/vts/Android.mk b/media/libmedia/xsd/vts/Android.mk
deleted file mode 100644
index 52c3779..0000000
--- a/media/libmedia/xsd/vts/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := VtsValidateMediaProfiles
-include test/vts/tools/build/Android.host_config.mk
diff --git a/media/libmedia/xsd/vts/AndroidTest.xml b/media/libmedia/xsd/vts/AndroidTest.xml
deleted file mode 100644
index e68721b..0000000
--- a/media/libmedia/xsd/vts/AndroidTest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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="Config for VTS VtsValidateMediaProfiles.">
- <option name="config-descriptor:metadata" key="plan" value="vts-treble" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
- <option name="abort-on-push-failure" value="false"/>
- <option name="push-group" value="HostDrivenTest.push"/>
- <option name="push" value="DATA/etc/media_profiles.xsd->/data/local/tmp/media_profiles.xsd"/>
- </target_preparer>
- <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
- <option name="test-module-name" value="VtsValidateMediaProfiles"/>
- <option name="binary-test-source" value="_32bit::DATA/nativetest/vts_mediaProfiles_validate_test/vts_mediaProfiles_validate_test" />
- <option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_mediaProfiles_validate_test/vts_mediaProfiles_validate_test" />
- <option name="binary-test-type" value="gtest"/>
- <option name="test-timeout" value="30s"/>
- </test>
-</configuration>
diff --git a/media/libmediametrics/Android.bp b/media/libmediametrics/Android.bp
index 03068c7..ba84761 100644
--- a/media/libmediametrics/Android.bp
+++ b/media/libmediametrics/Android.bp
@@ -3,7 +3,7 @@
export_include_dirs: ["include"],
}
-cc_library_shared {
+cc_library {
name: "libmediametrics",
srcs: [
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index c30f048..7e8fe45 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -922,6 +922,11 @@
firstEntry = false;
int64_t mediaTimeUs;
CHECK(entry->mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
+ if (mediaTimeUs < 0) {
+ ALOGD("fillAudioBuffer: reset negative media time %.2f secs to zero",
+ mediaTimeUs / 1E6);
+ mediaTimeUs = 0;
+ }
ALOGV("fillAudioBuffer: rendering audio at media time %.2f secs", mediaTimeUs / 1E6);
setAudioFirstAnchorTimeIfNeeded_l(mediaTimeUs);
}
diff --git a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
index 83da092..9533ae5 100644
--- a/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/RTSPSource.cpp
@@ -146,7 +146,9 @@
}
// Close socket before posting message to RTSPSource message handler.
- close(mHandler->getARTSPConnection()->getSocket());
+ if (mHandler != NULL) {
+ close(mHandler->getARTSPConnection()->getSocket());
+ }
sp<AMessage> msg = new AMessage(kWhatDisconnect, this);
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 5aa90c9..ffe3052 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -279,6 +279,13 @@
void postFillThisBuffer(BufferInfo *info);
+ void maybePostExtraOutputMetadataBufferRequest() {
+ if (!mPendingExtraOutputMetadataBufferRequest) {
+ (new AMessage(kWhatSubmitExtraOutputMetadataBuffer, mCodec))->post();
+ mPendingExtraOutputMetadataBufferRequest = true;
+ }
+ }
+
private:
// Handles an OMX message. Returns true iff message was handled.
bool onOMXMessage(const sp<AMessage> &msg);
@@ -302,6 +309,8 @@
void getMoreInputDataIfPossible();
+ bool mPendingExtraOutputMetadataBufferRequest;
+
DISALLOW_EVIL_CONSTRUCTORS(BaseState);
};
@@ -555,6 +564,7 @@
mShutdownInProgress(false),
mExplicitShutdown(false),
mIsLegacyVP9Decoder(false),
+ mIsLowLatency(false),
mEncoderDelay(0),
mEncoderPadding(0),
mRotationDegrees(0),
@@ -2415,6 +2425,7 @@
if (err != OK) {
ALOGE("decoder can not set low-latency to %d (err %d)", lowLatency, err);
}
+ mIsLowLatency = (lowLatency && err == OK);
return err;
}
@@ -5748,7 +5759,8 @@
ACodec::BaseState::BaseState(ACodec *codec, const sp<AState> &parentState)
: AState(parentState),
- mCodec(codec) {
+ mCodec(codec),
+ mPendingExtraOutputMetadataBufferRequest(false) {
}
ACodec::BaseState::PortMode ACodec::BaseState::getPortMode(
@@ -5792,17 +5804,19 @@
case ACodec::kWhatSetSurface:
{
- sp<AReplyToken> replyID;
- CHECK(msg->senderAwaitsResponse(&replyID));
-
sp<RefBase> obj;
CHECK(msg->findObject("surface", &obj));
status_t err = mCodec->handleSetSurface(static_cast<Surface *>(obj.get()));
- sp<AMessage> response = new AMessage;
- response->setInt32("err", err);
- response->postReply(replyID);
+ sp<AReplyToken> replyID;
+ if (msg->senderAwaitsResponse(&replyID)) {
+ sp<AMessage> response = new AMessage;
+ response->setInt32("err", err);
+ response->postReply(replyID);
+ } else if (err != OK) {
+ mCodec->signalError(OMX_ErrorUndefined, err);
+ }
break;
}
@@ -5849,6 +5863,21 @@
break;
}
+ case kWhatSubmitExtraOutputMetadataBuffer: {
+ mPendingExtraOutputMetadataBufferRequest = false;
+ if (getPortMode(kPortIndexOutput) == RESUBMIT_BUFFERS && mCodec->mIsLowLatency) {
+ // Decoders often need more than one output buffer to be
+ // submitted before processing a single input buffer.
+ // For low latency codecs, we don't want to wait for more input
+ // to be queued to get those output buffers submitted.
+ if (mCodec->submitOutputMetadataBuffer() == OK
+ && mCodec->mMetadataBuffersToSubmit > 0) {
+ maybePostExtraOutputMetadataBufferRequest();
+ }
+ }
+ break;
+ }
+
default:
return false;
}
@@ -6205,7 +6234,12 @@
(outputMode == FREE_BUFFERS ? "FREE" :
outputMode == KEEP_BUFFERS ? "KEEP" : "RESUBMIT"));
if (outputMode == RESUBMIT_BUFFERS) {
- mCodec->submitOutputMetadataBuffer();
+ status_t err = mCodec->submitOutputMetadataBuffer();
+ if (mCodec->mIsLowLatency
+ && err == OK
+ && mCodec->mMetadataBuffersToSubmit > 0) {
+ maybePostExtraOutputMetadataBufferRequest();
+ }
}
}
info->checkReadFence("onInputBufferFilled");
@@ -7351,6 +7385,9 @@
break;
}
}
+ if (mCodec->mIsLowLatency) {
+ maybePostExtraOutputMetadataBufferRequest();
+ }
// *** NOTE: THE FOLLOWING WORKAROUND WILL BE REMOVED ***
mCodec->signalSubmitOutputMetadataBufferIfEOS_workaround();
@@ -8233,17 +8270,38 @@
FALLTHROUGH_INTENDED;
}
case kWhatResume:
- case kWhatSetParameters:
{
- if (msg->what() == kWhatResume) {
- ALOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());
- }
+ ALOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());
mCodec->deferMessage(msg);
handled = true;
break;
}
+ case kWhatSetParameters:
+ {
+ sp<AMessage> params;
+ CHECK(msg->findMessage("params", ¶ms));
+
+ sp<ABuffer> hdr10PlusInfo;
+ if (params->findBuffer("hdr10-plus-info", &hdr10PlusInfo)) {
+ if (hdr10PlusInfo != nullptr && hdr10PlusInfo->size() > 0) {
+ (void)mCodec->setHdr10PlusInfo(hdr10PlusInfo);
+ }
+ params->removeEntryAt(params->findEntryByName("hdr10-plus-info"));
+
+ if (params->countEntries() == 0) {
+ msg->removeEntryAt(msg->findEntryByName("params"));
+ }
+ }
+
+ if (msg->countEntries() > 0) {
+ mCodec->deferMessage(msg);
+ }
+ handled = true;
+ break;
+ }
+
case kWhatForceStateTransition:
{
int32_t generation = 0;
@@ -8254,6 +8312,23 @@
break;
}
+ case kWhatSetSurface:
+ {
+ ALOGV("[%s] Deferring setSurface", mCodec->mComponentName.c_str());
+
+ sp<AReplyToken> replyID;
+ CHECK(msg->senderAwaitsResponse(&replyID));
+
+ mCodec->deferMessage(msg);
+
+ sp<AMessage> response = new AMessage;
+ response->setInt32("err", OK);
+ response->postReply(replyID);
+
+ handled = true;
+ break;
+ }
+
case kWhatCheckIfStuck:
{
int32_t generation = 0;
@@ -8354,6 +8429,15 @@
return false;
}
+ case OMX_EventConfigUpdate:
+ {
+ CHECK_EQ(data1, (OMX_U32)kPortIndexOutput);
+
+ mCodec->onConfigUpdate((OMX_INDEXTYPE)data2);
+
+ return true;
+ }
+
default:
return BaseState::onOMXEvent(event, data1, data2);
}
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index d497eb7..a3a4aba 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -241,6 +241,9 @@
}
AIBinder_linkToDeath(mService->asBinder().get(), mDeathRecipient.get(), this);
+
+ // Kill clients pending removal.
+ mService->reclaimResourcesFromClientsPendingRemoval(mPid);
}
//static
@@ -634,6 +637,9 @@
mDequeueInputReplyID(0),
mDequeueOutputTimeoutGeneration(0),
mDequeueOutputReplyID(0),
+ mTunneledInputWidth(0),
+ mTunneledInputHeight(0),
+ mTunneled(false),
mHaveInputSurface(false),
mHavePendingInputBuffers(false),
mCpuBoostRequested(false),
@@ -2070,20 +2076,25 @@
} else if (mFlags & kFlagOutputBuffersChanged) {
PostReplyWithError(replyID, INFO_OUTPUT_BUFFERS_CHANGED);
mFlags &= ~kFlagOutputBuffersChanged;
- } else if (mFlags & kFlagOutputFormatChanged) {
- PostReplyWithError(replyID, INFO_FORMAT_CHANGED);
- mFlags &= ~kFlagOutputFormatChanged;
} else {
sp<AMessage> response = new AMessage;
- ssize_t index = dequeuePortBuffer(kPortIndexOutput);
-
- if (index < 0) {
- CHECK_EQ(index, -EAGAIN);
+ BufferInfo *info = peekNextPortBuffer(kPortIndexOutput);
+ if (!info) {
return false;
}
- const sp<MediaCodecBuffer> &buffer =
- mPortBuffers[kPortIndexOutput][index].mData;
+ // In synchronous mode, output format change should be handled
+ // at dequeue to put the event at the correct order.
+
+ const sp<MediaCodecBuffer> &buffer = info->mData;
+ handleOutputFormatChangeIfNeeded(buffer);
+ if (mFlags & kFlagOutputFormatChanged) {
+ PostReplyWithError(replyID, INFO_FORMAT_CHANGED);
+ mFlags &= ~kFlagOutputFormatChanged;
+ return true;
+ }
+
+ ssize_t index = dequeuePortBuffer(kPortIndexOutput);
response->setSize("index", index);
response->setSize("offset", buffer->offset());
@@ -2128,6 +2139,8 @@
}
bool sendErrorResponse = true;
+ std::string origin{"kWhatError:"};
+ origin += stateString(mState);
switch (mState) {
case INITIALIZING:
@@ -2179,14 +2192,14 @@
// be a shutdown complete notification after
// all.
- // note that we're directly going from
+ // note that we may be directly going from
// STOPPING->UNINITIALIZED, instead of the
// usual STOPPING->INITIALIZED state.
setState(UNINITIALIZED);
if (mState == RELEASING) {
mComponentName.clear();
}
- postPendingRepliesAndDeferredMessages();
+ postPendingRepliesAndDeferredMessages(origin + ":dead");
sendErrorResponse = false;
}
break;
@@ -2277,7 +2290,7 @@
// released by ResourceManager.
finalErr = DEAD_OBJECT;
}
- postPendingRepliesAndDeferredMessages(finalErr);
+ postPendingRepliesAndDeferredMessages(origin, finalErr);
}
break;
}
@@ -2325,7 +2338,7 @@
MediaResource::CodecResource(mFlags & kFlagIsSecure, mIsVideo));
}
- postPendingRepliesAndDeferredMessages();
+ postPendingRepliesAndDeferredMessages("kWhatComponentAllocated");
break;
}
@@ -2364,7 +2377,7 @@
mFlags |= kFlagUsesSoftwareRenderer;
}
setState(CONFIGURED);
- postPendingRepliesAndDeferredMessages();
+ postPendingRepliesAndDeferredMessages("kWhatComponentConfigured");
// augment our media metrics info, now that we know more things
// such as what the codec extracted from any CSD passed in.
@@ -2433,7 +2446,7 @@
} else {
response->setInt32("err", err);
}
- postPendingRepliesAndDeferredMessages(response);
+ postPendingRepliesAndDeferredMessages("kWhatInputSurfaceCreated", response);
break;
}
@@ -2455,7 +2468,7 @@
} else {
response->setInt32("err", err);
}
- postPendingRepliesAndDeferredMessages(response);
+ postPendingRepliesAndDeferredMessages("kWhatInputSurfaceAccepted", response);
break;
}
@@ -2473,7 +2486,7 @@
if (msg->findInt32("err", &err)) {
response->setInt32("err", err);
}
- postPendingRepliesAndDeferredMessages(response);
+ postPendingRepliesAndDeferredMessages("kWhatSignaledInputEOS", response);
break;
}
@@ -2492,7 +2505,7 @@
MediaResource::GraphicMemoryResource(getGraphicBufferSize()));
}
setState(STARTED);
- postPendingRepliesAndDeferredMessages();
+ postPendingRepliesAndDeferredMessages("kWhatStartCompleted");
break;
}
@@ -2593,107 +2606,13 @@
break;
}
- sp<RefBase> obj;
- CHECK(msg->findObject("buffer", &obj));
- sp<MediaCodecBuffer> buffer = static_cast<MediaCodecBuffer *>(obj.get());
-
- if (mOutputFormat != buffer->format()) {
- if (mFlags & kFlagUseBlockModel) {
- sp<AMessage> diff1 = mOutputFormat->changesFrom(buffer->format());
- sp<AMessage> diff2 = buffer->format()->changesFrom(mOutputFormat);
- std::set<std::string> keys;
- size_t numEntries = diff1->countEntries();
- AMessage::Type type;
- for (size_t i = 0; i < numEntries; ++i) {
- keys.emplace(diff1->getEntryNameAt(i, &type));
- }
- numEntries = diff2->countEntries();
- for (size_t i = 0; i < numEntries; ++i) {
- keys.emplace(diff2->getEntryNameAt(i, &type));
- }
- sp<WrapperObject<std::set<std::string>>> changedKeys{
- new WrapperObject<std::set<std::string>>{std::move(keys)}};
- buffer->meta()->setObject("changedKeys", changedKeys);
- }
- mOutputFormat = buffer->format();
- ALOGV("[%s] output format changed to: %s",
- mComponentName.c_str(), mOutputFormat->debugString(4).c_str());
-
- if (mSoftRenderer == NULL &&
- mSurface != NULL &&
- (mFlags & kFlagUsesSoftwareRenderer)) {
- AString mime;
- CHECK(mOutputFormat->findString("mime", &mime));
-
- // TODO: propagate color aspects to software renderer to allow better
- // color conversion to RGB. For now, just mark dataspace for YUV
- // rendering.
- int32_t dataSpace;
- if (mOutputFormat->findInt32("android._dataspace", &dataSpace)) {
- ALOGD("[%s] setting dataspace on output surface to #%x",
- mComponentName.c_str(), dataSpace);
- int err = native_window_set_buffers_data_space(
- mSurface.get(), (android_dataspace)dataSpace);
- ALOGW_IF(err != 0, "failed to set dataspace on surface (%d)", err);
- }
- if (mOutputFormat->contains("hdr-static-info")) {
- HDRStaticInfo info;
- if (ColorUtils::getHDRStaticInfoFromFormat(mOutputFormat, &info)) {
- setNativeWindowHdrMetadata(mSurface.get(), &info);
- }
- }
-
- sp<ABuffer> hdr10PlusInfo;
- if (mOutputFormat->findBuffer("hdr10-plus-info", &hdr10PlusInfo)
- && hdr10PlusInfo != nullptr && hdr10PlusInfo->size() > 0) {
- native_window_set_buffers_hdr10_plus_metadata(mSurface.get(),
- hdr10PlusInfo->size(), hdr10PlusInfo->data());
- }
-
- if (mime.startsWithIgnoreCase("video/")) {
- mSurface->setDequeueTimeout(-1);
- mSoftRenderer = new SoftwareRenderer(mSurface, mRotationDegrees);
- }
- }
-
- requestCpuBoostIfNeeded();
-
- if (mFlags & kFlagIsEncoder) {
- // Before we announce the format change we should
- // collect codec specific data and amend the output
- // format as necessary.
- int32_t flags = 0;
- (void) buffer->meta()->findInt32("flags", &flags);
- if ((flags & BUFFER_FLAG_CODECCONFIG) && !(mFlags & kFlagIsSecure)) {
- status_t err =
- amendOutputFormatWithCodecSpecificData(buffer);
-
- if (err != OK) {
- ALOGE("Codec spit out malformed codec "
- "specific data!");
- }
- }
- }
- if (mFlags & kFlagIsAsync) {
- onOutputFormatChanged();
- } else {
- mFlags |= kFlagOutputFormatChanged;
- postActivityNotificationIfPossible();
- }
-
- // Notify mCrypto of video resolution changes
- if (mCrypto != NULL) {
- int32_t left, top, right, bottom, width, height;
- if (mOutputFormat->findRect("crop", &left, &top, &right, &bottom)) {
- mCrypto->notifyResolution(right - left + 1, bottom - top + 1);
- } else if (mOutputFormat->findInt32("width", &width)
- && mOutputFormat->findInt32("height", &height)) {
- mCrypto->notifyResolution(width, height);
- }
- }
- }
-
if (mFlags & kFlagIsAsync) {
+ sp<RefBase> obj;
+ CHECK(msg->findObject("buffer", &obj));
+ sp<MediaCodecBuffer> buffer = static_cast<MediaCodecBuffer *>(obj.get());
+
+ // In asynchronous mode, output format change is processed immediately.
+ handleOutputFormatChangeIfNeeded(buffer);
onOutputBufferAvailable();
} else if (mFlags & kFlagDequeueOutputPending) {
CHECK(handleDequeueOutputBuffer(mDequeueOutputReplyID));
@@ -2722,7 +2641,13 @@
break;
}
setState(INITIALIZED);
- postPendingRepliesAndDeferredMessages();
+ if (mReplyID) {
+ postPendingRepliesAndDeferredMessages("kWhatStopCompleted");
+ } else {
+ ALOGW("kWhatStopCompleted: presumably an error occurred earlier, "
+ "but the operation completed anyway. (last reply origin=%s)",
+ mLastReplyOrigin.c_str());
+ }
break;
}
@@ -2746,7 +2671,7 @@
mReleaseSurface.reset();
if (mReplyID != nullptr) {
- postPendingRepliesAndDeferredMessages();
+ postPendingRepliesAndDeferredMessages("kWhatReleaseCompleted");
}
if (mAsyncReleaseCompleteNotification != nullptr) {
flushMediametrics();
@@ -2771,7 +2696,7 @@
mCodec->signalResume();
}
- postPendingRepliesAndDeferredMessages();
+ postPendingRepliesAndDeferredMessages("kWhatFlushCompleted");
break;
}
@@ -2940,6 +2865,14 @@
extractCSD(format);
+ int32_t tunneled;
+ if (format->findInt32("feature-tunneled-playback", &tunneled) && tunneled != 0) {
+ ALOGI("Configuring TUNNELED video playback.");
+ mTunneled = true;
+ } else {
+ mTunneled = false;
+ }
+
mCodec->initiateConfigureComponent(format);
break;
}
@@ -3160,7 +3093,8 @@
if (mState == FLUSHING || mState == STOPPING
|| mState == CONFIGURING || mState == STARTING) {
// mReply is always set if in these states.
- postPendingRepliesAndDeferredMessages();
+ postPendingRepliesAndDeferredMessages(
+ std::string("kWhatRelease:") + stateString(mState));
}
if (mFlags & kFlagSawMediaServerDie) {
@@ -3209,7 +3143,7 @@
// State transition replies are handled above, so this reply
// would not be related to state transition. As we are
// shutting down the component, just fail the operation.
- postPendingRepliesAndDeferredMessages(UNKNOWN_ERROR);
+ postPendingRepliesAndDeferredMessages("kWhatRelease:reply", UNKNOWN_ERROR);
}
mReplyID = replyID;
setState(msg->what() == kWhatStop ? STOPPING : RELEASING);
@@ -3225,7 +3159,7 @@
if (asyncNotify != nullptr) {
mResourceManagerProxy->markClientForPendingRemoval();
- postPendingRepliesAndDeferredMessages();
+ postPendingRepliesAndDeferredMessages("kWhatRelease:async");
asyncNotifyPost.clear();
mAsyncReleaseCompleteNotification = asyncNotify;
}
@@ -3581,6 +3515,106 @@
}
}
+void MediaCodec::handleOutputFormatChangeIfNeeded(const sp<MediaCodecBuffer> &buffer) {
+ sp<AMessage> format = buffer->format();
+ if (mOutputFormat == format) {
+ return;
+ }
+ if (mFlags & kFlagUseBlockModel) {
+ sp<AMessage> diff1 = mOutputFormat->changesFrom(format);
+ sp<AMessage> diff2 = format->changesFrom(mOutputFormat);
+ std::set<std::string> keys;
+ size_t numEntries = diff1->countEntries();
+ AMessage::Type type;
+ for (size_t i = 0; i < numEntries; ++i) {
+ keys.emplace(diff1->getEntryNameAt(i, &type));
+ }
+ numEntries = diff2->countEntries();
+ for (size_t i = 0; i < numEntries; ++i) {
+ keys.emplace(diff2->getEntryNameAt(i, &type));
+ }
+ sp<WrapperObject<std::set<std::string>>> changedKeys{
+ new WrapperObject<std::set<std::string>>{std::move(keys)}};
+ buffer->meta()->setObject("changedKeys", changedKeys);
+ }
+ mOutputFormat = format;
+ ALOGV("[%s] output format changed to: %s",
+ mComponentName.c_str(), mOutputFormat->debugString(4).c_str());
+
+ if (mSoftRenderer == NULL &&
+ mSurface != NULL &&
+ (mFlags & kFlagUsesSoftwareRenderer)) {
+ AString mime;
+ CHECK(mOutputFormat->findString("mime", &mime));
+
+ // TODO: propagate color aspects to software renderer to allow better
+ // color conversion to RGB. For now, just mark dataspace for YUV
+ // rendering.
+ int32_t dataSpace;
+ if (mOutputFormat->findInt32("android._dataspace", &dataSpace)) {
+ ALOGD("[%s] setting dataspace on output surface to #%x",
+ mComponentName.c_str(), dataSpace);
+ int err = native_window_set_buffers_data_space(
+ mSurface.get(), (android_dataspace)dataSpace);
+ ALOGW_IF(err != 0, "failed to set dataspace on surface (%d)", err);
+ }
+ if (mOutputFormat->contains("hdr-static-info")) {
+ HDRStaticInfo info;
+ if (ColorUtils::getHDRStaticInfoFromFormat(mOutputFormat, &info)) {
+ setNativeWindowHdrMetadata(mSurface.get(), &info);
+ }
+ }
+
+ sp<ABuffer> hdr10PlusInfo;
+ if (mOutputFormat->findBuffer("hdr10-plus-info", &hdr10PlusInfo)
+ && hdr10PlusInfo != nullptr && hdr10PlusInfo->size() > 0) {
+ native_window_set_buffers_hdr10_plus_metadata(mSurface.get(),
+ hdr10PlusInfo->size(), hdr10PlusInfo->data());
+ }
+
+ if (mime.startsWithIgnoreCase("video/")) {
+ mSurface->setDequeueTimeout(-1);
+ mSoftRenderer = new SoftwareRenderer(mSurface, mRotationDegrees);
+ }
+ }
+
+ requestCpuBoostIfNeeded();
+
+ if (mFlags & kFlagIsEncoder) {
+ // Before we announce the format change we should
+ // collect codec specific data and amend the output
+ // format as necessary.
+ int32_t flags = 0;
+ (void) buffer->meta()->findInt32("flags", &flags);
+ if ((flags & BUFFER_FLAG_CODECCONFIG) && !(mFlags & kFlagIsSecure)) {
+ status_t err =
+ amendOutputFormatWithCodecSpecificData(buffer);
+
+ if (err != OK) {
+ ALOGE("Codec spit out malformed codec "
+ "specific data!");
+ }
+ }
+ }
+ if (mFlags & kFlagIsAsync) {
+ onOutputFormatChanged();
+ } else {
+ mFlags |= kFlagOutputFormatChanged;
+ postActivityNotificationIfPossible();
+ }
+
+ // Notify mCrypto of video resolution changes
+ if (mCrypto != NULL) {
+ int32_t left, top, right, bottom, width, height;
+ if (mOutputFormat->findRect("crop", &left, &top, &right, &bottom)) {
+ mCrypto->notifyResolution(right - left + 1, bottom - top + 1);
+ } else if (mOutputFormat->findInt32("width", &width)
+ && mOutputFormat->findInt32("height", &height)) {
+ mCrypto->notifyResolution(width, height);
+ }
+ }
+}
+
void MediaCodec::extractCSD(const sp<AMessage> &format) {
mCSD.clear();
@@ -3918,7 +3952,18 @@
if (hasCryptoOrDescrambler() && !c2Buffer && !memory) {
AString *errorDetailMsg;
CHECK(msg->findPointer("errorDetailMsg", (void **)&errorDetailMsg));
-
+ // Notify mCrypto of video resolution changes
+ if (mTunneled && mCrypto != NULL) {
+ int32_t width, height;
+ if (mInputFormat->findInt32("width", &width) &&
+ mInputFormat->findInt32("height", &height) && width > 0 && height > 0) {
+ if (width != mTunneledInputWidth || height != mTunneledInputHeight) {
+ mTunneledInputWidth = width;
+ mTunneledInputHeight = height;
+ mCrypto->notifyResolution(width, height);
+ }
+ }
+ }
err = mBufferChannel->queueSecureInputBuffer(
buffer,
(mFlags & kFlagIsSecure),
@@ -4046,19 +4091,31 @@
return OK;
}
-ssize_t MediaCodec::dequeuePortBuffer(int32_t portIndex) {
+MediaCodec::BufferInfo *MediaCodec::peekNextPortBuffer(int32_t portIndex) {
CHECK(portIndex == kPortIndexInput || portIndex == kPortIndexOutput);
List<size_t> *availBuffers = &mAvailPortBuffers[portIndex];
if (availBuffers->empty()) {
+ return nullptr;
+ }
+
+ return &mPortBuffers[portIndex][*availBuffers->begin()];
+}
+
+ssize_t MediaCodec::dequeuePortBuffer(int32_t portIndex) {
+ CHECK(portIndex == kPortIndexInput || portIndex == kPortIndexOutput);
+
+ BufferInfo *info = peekNextPortBuffer(portIndex);
+ if (!info) {
return -EAGAIN;
}
+ List<size_t> *availBuffers = &mAvailPortBuffers[portIndex];
size_t index = *availBuffers->begin();
+ CHECK_EQ(info, &mPortBuffers[portIndex][index]);
availBuffers->erase(availBuffers->begin());
- BufferInfo *info = &mPortBuffers[portIndex][index];
CHECK(!info->mOwnedByClient);
{
Mutex::Autolock al(mBufferLock);
@@ -4300,16 +4357,23 @@
return OK;
}
-void MediaCodec::postPendingRepliesAndDeferredMessages(status_t err /* = OK */) {
+void MediaCodec::postPendingRepliesAndDeferredMessages(
+ std::string origin, status_t err /* = OK */) {
sp<AMessage> response{new AMessage};
if (err != OK) {
response->setInt32("err", err);
}
- postPendingRepliesAndDeferredMessages(response);
+ postPendingRepliesAndDeferredMessages(origin, response);
}
-void MediaCodec::postPendingRepliesAndDeferredMessages(const sp<AMessage> &response) {
- CHECK(mReplyID);
+void MediaCodec::postPendingRepliesAndDeferredMessages(
+ std::string origin, const sp<AMessage> &response) {
+ LOG_ALWAYS_FATAL_IF(
+ !mReplyID,
+ "postPendingRepliesAndDeferredMessages: mReplyID == null, from %s following %s",
+ origin.c_str(),
+ mLastReplyOrigin.c_str());
+ mLastReplyOrigin = origin;
response->postReply(mReplyID);
mReplyID.clear();
ALOGV_IF(!mDeferredMessages.empty(),
diff --git a/media/libstagefright/codecs/amrnb/enc/Android.bp b/media/libstagefright/codecs/amrnb/enc/Android.bp
index 73a1d4b..ff9a720 100644
--- a/media/libstagefright/codecs/amrnb/enc/Android.bp
+++ b/media/libstagefright/codecs/amrnb/enc/Android.bp
@@ -81,6 +81,13 @@
//},
shared_libs: ["libstagefright_amrnb_common"],
+
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
//###############################################################################
diff --git a/media/libstagefright/codecs/amrnb/enc/fuzzer/Android.bp b/media/libstagefright/codecs/amrnb/enc/fuzzer/Android.bp
new file mode 100644
index 0000000..e88e5eb
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/enc/fuzzer/Android.bp
@@ -0,0 +1,41 @@
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************
+ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
+ */
+
+cc_fuzz {
+ name: "amrnb_enc_fuzzer",
+ host_supported: true,
+
+ srcs: [
+ "amrnb_enc_fuzzer.cpp",
+ ],
+
+ static_libs: [
+ "liblog",
+ "libstagefright_amrnbenc",
+ "libstagefright_amrnb_common",
+ ],
+
+ fuzz_config: {
+ cc: [
+ "android-media-fuzzing-reports@google.com",
+ ],
+ componentid: 155276,
+ },
+}
diff --git a/media/libstagefright/codecs/amrnb/enc/fuzzer/README.md b/media/libstagefright/codecs/amrnb/enc/fuzzer/README.md
new file mode 100644
index 0000000..239b4a8
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/enc/fuzzer/README.md
@@ -0,0 +1,60 @@
+# Fuzzer for libstagefright_amrnbenc encoder
+
+## Plugin Design Considerations
+The fuzzer plugin for AMR-NB is designed based on the understanding of the
+codec and tries to achieve the following:
+
+##### Maximize code coverage
+The configuration parameters are not hardcoded, but instead selected based on
+incoming data. This ensures more code paths are reached by the fuzzer.
+
+AMR-WB supports the following parameters:
+1. Output Format (parameter name: `outputFormat`)
+2. Mode (parameter name: `mode`)
+
+| Parameter| Valid Values| Configured Value|
+|------------- |-------------| ----- |
+| `outputFormat` | 0. `AMR_TX_WMF` 1. `AMR_TX_IF2` 2. `AMR_TX_ETS` | Bits 0, 1 and 2 of 1st byte of data. |
+| `mode` | 0. `MR475` 1. `MR515` 2. `MR59` 3. `MR67` 4. `MR74 ` 5. `MR795` 6. `MR102` 7. `MR122` 8. `MRDTX` | Bits 3, 4, 5 and 6 of 1st byte of data. |
+
+This also ensures that the plugin is always deterministic for any given input.
+
+##### Maximize utilization of input data
+The plugin feeds the entire input data to the codec using a loop.
+If the encode operation was successful, the input is advanced by the frame size.
+If the encode operation was un-successful, the input is still advanced by frame size so
+that the fuzzer can proceed to feed the next frame.
+
+This ensures that the plugin tolerates any kind of input (empty, huge,
+malformed, etc) and doesnt `exit()` on any input and thereby increasing the
+chance of identifying vulnerabilities.
+
+## Build
+
+This describes steps to build amrnb_enc_fuzzer binary.
+
+### Android
+
+#### Steps to build
+Build the fuzzer
+```
+ $ mm -j$(nproc) amrnb_enc_fuzzer
+```
+
+#### Steps to run
+Create a directory CORPUS_DIR and copy some pcm files to that folder
+Push this directory to device.
+
+To run on device
+```
+ $ adb sync data
+ $ adb shell /data/fuzz/arm64/amrnb_enc_fuzzer/amrnb_enc_fuzzer CORPUS_DIR
+```
+To run on host
+```
+ $ $ANDROID_HOST_OUT/fuzz/x86_64/amrnb_enc_fuzzer/amrnb_enc_fuzzer CORPUS_DIR
+```
+
+## References:
+ * http://llvm.org/docs/LibFuzzer.html
+ * https://github.com/google/oss-fuzz
diff --git a/media/libstagefright/codecs/amrnb/enc/fuzzer/amrnb_enc_fuzzer.cpp b/media/libstagefright/codecs/amrnb/enc/fuzzer/amrnb_enc_fuzzer.cpp
new file mode 100644
index 0000000..2fcbf24
--- /dev/null
+++ b/media/libstagefright/codecs/amrnb/enc/fuzzer/amrnb_enc_fuzzer.cpp
@@ -0,0 +1,105 @@
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************
+ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
+ */
+#include <string.h>
+#include <utils/Log.h>
+#include <algorithm>
+#include "gsmamr_enc.h"
+
+// Constants for AMR-NB
+const int32_t kNumInputSamples = L_FRAME; // 160 samples
+const int32_t kOutputBufferSize = 2 * kNumInputSamples * sizeof(Word16);
+const Mode kModes[9] = {MR475, /* 4.75 kbps */
+ MR515, /* 5.15 kbps */
+ MR59, /* 5.90 kbps */
+ MR67, /* 6.70 kbps */
+ MR74, /* 7.40 kbps */
+ MR795, /* 7.95 kbps */
+ MR102, /* 10.2 kbps */
+ MR122, /* 12.2 kbps */
+ MRDTX, /* DTX */};
+const Word16 kOutputFormat[3] = {AMR_TX_WMF, AMR_TX_IF2, AMR_TX_ETS};
+
+class Codec {
+ public:
+ Codec() = default;
+ ~Codec() { deInitEncoder(); }
+ Word16 initEncoder(const uint8_t *data);
+ void deInitEncoder();
+ void encodeFrames(const uint8_t *data, size_t size);
+
+ private:
+ void *mEncState = nullptr;
+ void *mSidState = nullptr;
+};
+
+Word16 Codec::initEncoder(const uint8_t *data) {
+ return AMREncodeInit(&mEncState, &mSidState, (*data >> 1) & 0x01 /* dtx_enable flag */);
+}
+
+void Codec::deInitEncoder() {
+ if (mEncState) {
+ AMREncodeExit(&mEncState, &mSidState);
+ mEncState = nullptr;
+ mSidState = nullptr;
+ }
+}
+
+void Codec::encodeFrames(const uint8_t *data, size_t size) {
+ AMREncodeReset(mEncState, mSidState);
+ uint8_t startByte = *data;
+ int modeIndex = ((startByte >> 3) % 9);
+ int outputFormatIndex = (startByte % 3);
+ Mode mode = kModes[modeIndex];
+ Word16 outputFormat = kOutputFormat[outputFormatIndex];
+
+ // Consume startByte
+ data++;
+ size--;
+
+ while (size > 0) {
+ Frame_Type_3GPP frameType = (Frame_Type_3GPP)mode;
+
+ Word16 inputBuf[kNumInputSamples] = {};
+ int32_t minSize = std::min(size, sizeof(inputBuf));
+
+ uint8_t outputBuf[kOutputBufferSize] = {};
+ memcpy(inputBuf, data, minSize);
+
+ AMREncode(mEncState, mSidState, mode, inputBuf, outputBuf, &frameType, outputFormat);
+
+ data += minSize;
+ size -= minSize;
+ }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ if (size < 1) {
+ return 0;
+ }
+ Codec *codec = new Codec();
+ if (!codec) {
+ return 0;
+ }
+ if (codec->initEncoder(data) == 0) {
+ codec->encodeFrames(data, size);
+ }
+ delete codec;
+ return 0;
+}
diff --git a/media/libstagefright/codecs/amrwb/src/wb_syn_filt.cpp b/media/libstagefright/codecs/amrwb/src/wb_syn_filt.cpp
index e1af6d4..d960322 100644
--- a/media/libstagefright/codecs/amrwb/src/wb_syn_filt.cpp
+++ b/media/libstagefright/codecs/amrwb/src/wb_syn_filt.cpp
@@ -273,9 +273,10 @@
L_tmp1 >>= 11; /* -4 : sig_lo[i] << 4 */
- L_tmp1 += (int32)exc[(i<<1)] << a0;
+ int64 sig_tmp;
+ sig_tmp = (int64)L_tmp1 + (int32)(exc[(i<<1)] << a0);
+ L_tmp1 = (int32)(sig_tmp - (L_tmp2 << 1));
- L_tmp1 -= (L_tmp2 << 1);
/* sig_hi = bit16 to bit31 of synthesis */
L_tmp1 = shl_int32(L_tmp1, 3); /* ai in Q12 */
@@ -290,9 +291,8 @@
L_tmp3 = fxp_mac_16by16(sig_lo[(i<<1)], a[1], L_tmp3);
L_tmp3 = -L_tmp3 >> 11;
- L_tmp3 += (int32)exc[(i<<1)+1] << a0;
-
- L_tmp3 -= (L_tmp4 << 1);
+ sig_tmp = (int64)L_tmp3 + (int32)(exc[(i<<1)+1] << a0);
+ L_tmp3 = (int32)(sig_tmp - (L_tmp4 << 1));
/* sig_hi = bit16 to bit31 of synthesis */
L_tmp3 = shl_int32(L_tmp3, 3); /* ai in Q12 */
sig_hi[(i<<1)+1] = (int16)(L_tmp3 >> 16);
diff --git a/media/libstagefright/codecs/amrwbenc/Android.bp b/media/libstagefright/codecs/amrwbenc/Android.bp
index 64f302c..70c672d 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.bp
+++ b/media/libstagefright/codecs/amrwbenc/Android.bp
@@ -138,6 +138,12 @@
cfi: true,
},
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
//###############################################################################
diff --git a/media/libstagefright/codecs/amrwbenc/fuzzer/Android.bp b/media/libstagefright/codecs/amrwbenc/fuzzer/Android.bp
new file mode 100644
index 0000000..e3473d6
--- /dev/null
+++ b/media/libstagefright/codecs/amrwbenc/fuzzer/Android.bp
@@ -0,0 +1,41 @@
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************
+ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
+ */
+
+cc_fuzz {
+ name: "amrwb_enc_fuzzer",
+ host_supported: true,
+
+ srcs: [
+ "amrwb_enc_fuzzer.cpp",
+ ],
+
+ static_libs: [
+ "liblog",
+ "libstagefright_amrwbenc",
+ "libstagefright_enc_common",
+ ],
+
+ fuzz_config: {
+ cc: [
+ "android-media-fuzzing-reports@google.com",
+ ],
+ componentid: 155276,
+ },
+}
diff --git a/media/libstagefright/codecs/amrwbenc/fuzzer/README.md b/media/libstagefright/codecs/amrwbenc/fuzzer/README.md
new file mode 100644
index 0000000..447fbfa
--- /dev/null
+++ b/media/libstagefright/codecs/amrwbenc/fuzzer/README.md
@@ -0,0 +1,60 @@
+# Fuzzer for libstagefright_amrwbenc encoder
+
+## Plugin Design Considerations
+The fuzzer plugin for AMR-WB is designed based on the understanding of the
+codec and tries to achieve the following:
+
+##### Maximize code coverage
+The configuration parameters are not hardcoded, but instead selected based on
+incoming data. This ensures more code paths are reached by the fuzzer.
+
+AMR-WB supports the following parameters:
+1. Frame Type (parameter name: `frameType`)
+2. Mode (parameter name: `mode`)
+
+| Parameter| Valid Values| Configured Value|
+|------------- |-------------| ----- |
+| `frameType` | 0. `VOAMRWB_DEFAULT` 1. `VOAMRWB_ITU` 2. `VOAMRWB_RFC3267` | Bits 0, 1 and 2 of 1st byte of data. |
+| `mode` | 0. `VOAMRWB_MD66` 1. `VOAMRWB_MD885` 2. `VOAMRWB_MD1265` 3. `VOAMRWB_MD1425` 4. `VOAMRWB_MD1585 ` 5. `VOAMRWB_MD1825` 6. `VOAMRWB_MD1985` 7. `VOAMRWB_MD2305` 8. `VOAMRWB_MD2385` 9. `VOAMRWB_N_MODES` | Bits 4, 5, 6 and 7 of 1st byte of data. |
+
+This also ensures that the plugin is always deterministic for any given input.
+
+##### Maximize utilization of input data
+The plugin feeds the entire input data to the codec using a loop.
+If the encode operation was successful, the input is advanced by the frame size.
+If the encode operation was un-successful, the input is still advanced by frame size so
+that the fuzzer can proceed to feed the next frame.
+
+This ensures that the plugin tolerates any kind of input (empty, huge,
+malformed, etc) and doesnt `exit()` on any input and thereby increasing the
+chance of identifying vulnerabilities.
+
+## Build
+
+This describes steps to build amrwb_enc_fuzzer binary.
+
+### Android
+
+#### Steps to build
+Build the fuzzer
+```
+ $ mm -j$(nproc) amrwb_enc_fuzzer
+```
+
+#### Steps to run
+Create a directory CORPUS_DIR and copy some pcm files to that folder
+Push this directory to device.
+
+To run on device
+```
+ $ adb sync data
+ $ adb shell /data/fuzz/arm64/amrwb_enc_fuzzer/amrwb_enc_fuzzer CORPUS_DIR
+```
+To run on host
+```
+ $ $ANDROID_HOST_OUT/fuzz/x86_64/amrwb_enc_fuzzer/amrwb_enc_fuzzer CORPUS_DIR
+```
+
+## References:
+ * http://llvm.org/docs/LibFuzzer.html
+ * https://github.com/google/oss-fuzz
diff --git a/media/libstagefright/codecs/amrwbenc/fuzzer/amrwb_enc_fuzzer.cpp b/media/libstagefright/codecs/amrwbenc/fuzzer/amrwb_enc_fuzzer.cpp
new file mode 100644
index 0000000..4773a1f
--- /dev/null
+++ b/media/libstagefright/codecs/amrwbenc/fuzzer/amrwb_enc_fuzzer.cpp
@@ -0,0 +1,142 @@
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************
+ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
+ */
+#include <string.h>
+#include <utils/Log.h>
+#include <algorithm>
+#include "cmnMemory.h"
+#include "voAMRWB.h"
+#include "cnst.h"
+
+typedef int(VO_API *VOGETAUDIOENCAPI)(VO_AUDIO_CODECAPI *pEncHandle);
+const int32_t kInputBufferSize = L_FRAME16k * sizeof(int16_t) * 2;
+const int32_t kOutputBufferSize = 2 * kInputBufferSize;
+const int32_t kModes[] = {VOAMRWB_MD66 /* 6.60kbps */, VOAMRWB_MD885 /* 8.85kbps */,
+ VOAMRWB_MD1265 /* 12.65kbps */, VOAMRWB_MD1425 /* 14.25kbps */,
+ VOAMRWB_MD1585 /* 15.85kbps */, VOAMRWB_MD1825 /* 18.25kbps */,
+ VOAMRWB_MD1985 /* 19.85kbps */, VOAMRWB_MD2305 /* 23.05kbps */,
+ VOAMRWB_MD2385 /* 23.85kbps */, VOAMRWB_N_MODES /* Invalid Mode */};
+const VOAMRWBFRAMETYPE kFrameTypes[] = {VOAMRWB_DEFAULT, VOAMRWB_ITU, VOAMRWB_RFC3267};
+
+class Codec {
+ public:
+ Codec() = default;
+ ~Codec() { deInitEncoder(); }
+ bool initEncoder(const uint8_t *data);
+ void deInitEncoder();
+ void encodeFrames(const uint8_t *data, size_t size);
+
+ private:
+ VO_AUDIO_CODECAPI *mApiHandle = nullptr;
+ VO_MEM_OPERATOR *mMemOperator = nullptr;
+ VO_HANDLE mEncoderHandle = nullptr;
+};
+
+bool Codec::initEncoder(const uint8_t *data) {
+ uint8_t startByte = *data;
+ int32_t mode = kModes[(startByte >> 4) % 10];
+ VOAMRWBFRAMETYPE frameType = kFrameTypes[startByte % 3];
+ mMemOperator = new VO_MEM_OPERATOR;
+ if (!mMemOperator) {
+ return false;
+ }
+
+ mMemOperator->Alloc = cmnMemAlloc;
+ mMemOperator->Copy = cmnMemCopy;
+ mMemOperator->Free = cmnMemFree;
+ mMemOperator->Set = cmnMemSet;
+ mMemOperator->Check = cmnMemCheck;
+
+ VO_CODEC_INIT_USERDATA userData;
+ memset(&userData, 0, sizeof(userData));
+ userData.memflag = VO_IMF_USERMEMOPERATOR;
+ userData.memData = (VO_PTR)mMemOperator;
+
+ mApiHandle = new VO_AUDIO_CODECAPI;
+ if (!mApiHandle) {
+ return false;
+ }
+ if (VO_ERR_NONE != voGetAMRWBEncAPI(mApiHandle)) {
+ // Failed to get api handle
+ return false;
+ }
+ if (VO_ERR_NONE != mApiHandle->Init(&mEncoderHandle, VO_AUDIO_CodingAMRWB, &userData)) {
+ // Failed to init AMRWB encoder
+ return false;
+ }
+ if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_FRAMETYPE, &frameType)) {
+ // Failed to set AMRWB encoder frame type
+ return false;
+ }
+ if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_MODE, &mode)) {
+ // Failed to set AMRWB encoder mode
+ return false;
+ }
+ return true;
+}
+
+void Codec::deInitEncoder() {
+ if (mEncoderHandle) {
+ mApiHandle->Uninit(mEncoderHandle);
+ mEncoderHandle = nullptr;
+ }
+ if (mApiHandle) {
+ delete mApiHandle;
+ mApiHandle = nullptr;
+ }
+ if (mMemOperator) {
+ delete mMemOperator;
+ mMemOperator = nullptr;
+ }
+}
+
+void Codec::encodeFrames(const uint8_t *data, size_t size) {
+ do {
+ int32_t minSize = std::min((int32_t)size, kInputBufferSize);
+ uint8_t outputBuf[kOutputBufferSize] = {};
+ VO_CODECBUFFER inData;
+ VO_CODECBUFFER outData;
+ VO_AUDIO_OUTPUTINFO outFormat;
+ inData.Buffer = (unsigned char *)data;
+ inData.Length = minSize;
+ outData.Buffer = outputBuf;
+ mApiHandle->SetInputData(mEncoderHandle, &inData);
+ mApiHandle->GetOutputData(mEncoderHandle, &outData, &outFormat);
+ data += minSize;
+ size -= minSize;
+ } while (size > 0);
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ if (size < 1) {
+ return 0;
+ }
+ Codec *codec = new Codec();
+ if (!codec) {
+ return 0;
+ }
+ if (codec->initEncoder(data)) {
+ // Consume first byte
+ ++data;
+ --size;
+ codec->encodeFrames(data, size);
+ }
+ delete codec;
+ return 0;
+}
diff --git a/media/libstagefright/codecs/amrwbenc/src/preemph.c b/media/libstagefright/codecs/amrwbenc/src/preemph.c
index 70c8650..a43841a 100644
--- a/media/libstagefright/codecs/amrwbenc/src/preemph.c
+++ b/media/libstagefright/codecs/amrwbenc/src/preemph.c
@@ -24,6 +24,7 @@
#include "typedef.h"
#include "basic_op.h"
+#include <stdint.h>
void Preemph(
Word16 x[], /* (i/o) : input signal overwritten by the output */
diff --git a/media/libstagefright/codecs/amrwbenc/src/q_pulse.c b/media/libstagefright/codecs/amrwbenc/src/q_pulse.c
index fe0bdda..657b6fe 100644
--- a/media/libstagefright/codecs/amrwbenc/src/q_pulse.c
+++ b/media/libstagefright/codecs/amrwbenc/src/q_pulse.c
@@ -27,6 +27,7 @@
#include "q_pulse.h"
#define NB_POS 16 /* pos in track, mask for sign bit */
+#define UNUSED_VAR __attribute__((unused))
Word32 quant_1p_N1( /* (o) return N+1 bits */
Word16 pos, /* (i) position of the pulse */
@@ -188,7 +189,7 @@
Word16 pos[], /* (i) position of the pulse 1..4 */
Word16 N) /* (i) number of bits for position */
{
- Word16 nb_pos, mask __unused, n_1, tmp;
+ Word16 nb_pos, mask UNUSED_VAR, n_1, tmp;
Word16 posA[4], posB[4];
Word32 i, j, k, index;
diff --git a/media/libstagefright/codecs/common/Android.bp b/media/libstagefright/codecs/common/Android.bp
index 260a60a..2290722 100644
--- a/media/libstagefright/codecs/common/Android.bp
+++ b/media/libstagefright/codecs/common/Android.bp
@@ -14,4 +14,11 @@
export_include_dirs: ["include"],
cflags: ["-Werror"],
+
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
}
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/idct_vca.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/idct_vca.cpp
index 0ba4944..dbaf5d1 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/idct_vca.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/idct_vca.cpp
@@ -37,6 +37,7 @@
return ;
}
+__attribute__((no_sanitize("signed-integer-overflow")))
void idctrow1(int16 *blk, uint8 *pred, uint8 *dst, int width)
{
/* shortcut */
@@ -156,6 +157,7 @@
return ;
}
+__attribute__((no_sanitize("signed-integer-overflow")))
void idctcol2(int16 *blk)
{
int32 x0, x1, x3, x5, x7;//, x8;
@@ -256,6 +258,7 @@
return ;
}
+__attribute__((no_sanitize("signed-integer-overflow")))
void idctcol3(int16 *blk)
{
int32 x0, x1, x2, x3, x4, x5, x6, x7, x8;
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp
index a11f55e..335846c 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/vop.cpp
@@ -24,7 +24,6 @@
#define OSCL_DISABLE_WARNING_CONV_POSSIBLE_LOSS_OF_DATA
-#ifdef PV_SUPPORT_MAIN_PROFILE
/* INTRA */
const static int mpeg_iqmat_def[NCOEFF_BLOCK] =
{
@@ -50,7 +49,6 @@
22, 23, 24, 26, 27, 28, 30, 31,
23, 24, 25, 27, 28, 30, 31, 33
};
-#endif
/* ======================================================================== */
/* Function : CalcNumBits() */
@@ -86,9 +84,7 @@
BitstreamDecVideo *stream;
uint32 tmpvar, vol_shape;
uint32 startCode;
-#ifdef PV_SUPPORT_MAIN_PROFILE
int *qmat, i, j;
-#endif
int version_id = 1;
#ifdef PV_TOLERATE_VOL_ERRORS
uint32 profile = 0x01;
@@ -317,7 +313,8 @@
}
else
{
- if (tmpvar != 0x01) return PV_FAIL;
+ // Simple and advanced simple (for quant-type 1)
+ if (tmpvar != 0x01 && tmpvar != 0x11) return PV_FAIL;
}
/* version id specified? */
@@ -486,7 +483,6 @@
currVol->quantType = BitstreamRead1Bits(stream);
if (currVol->quantType)
{
-#ifdef PV_SUPPORT_MAIN_PROFILE
/* load quantization matrices. 5/22/2000 */
/* load_intra_quant_mat (1 bit) */
qmat = currVol->iqmat;
@@ -531,9 +527,6 @@
{
oscl_memcpy(qmat, mpeg_nqmat_def, 64*sizeof(int));
}
-#else
- return PV_FAIL;
-#endif
}
if (version_id != 1)
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/AndroidTest.xml b/media/libstagefright/codecs/m4v_h263/dec/test/AndroidTest.xml
index 47e10ca..f572b0c 100755
--- a/media/libstagefright/codecs/m4v_h263/dec/test/AndroidTest.xml
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/AndroidTest.xml
@@ -19,7 +19,7 @@
<option name="cleanup" value="true" />
<option name="push" value="Mpeg4H263DecoderTest->/data/local/tmp/Mpeg4H263DecoderTest" />
<option name="push-file"
- key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263Decoder.zip?unzip=true"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263Decoder-1.1.zip?unzip=true"
value="/data/local/tmp/Mpeg4H263DecoderTestRes/" />
</target_preparer>
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTest.cpp b/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTest.cpp
index 967c1ea..53d66ea 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTest.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263DecoderTest.cpp
@@ -404,6 +404,9 @@
make_tuple("swirl_352x288_h263.h263", "swirl_352x288_h263.info", false),
make_tuple("bbb_352x288_h263.h263", "bbb_352x288_h263.info", false),
make_tuple("bbb_352x288_mpeg4.m4v", "bbb_352x288_mpeg4.info", true),
+ make_tuple("qtype0_mpeg4.m4v", "qtype0_mpeg4.info", true),
+ make_tuple("qtype1_mpeg4.m4v", "qtype1_mpeg4.info", true),
+ make_tuple("qtype1_qmatrix_mpeg4.m4v", "qtype1_qmatrix_mpeg4.info", true),
make_tuple("swirl_128x128_mpeg4.m4v", "swirl_128x128_mpeg4.info", true),
make_tuple("swirl_130x132_mpeg4.m4v", "swirl_130x132_mpeg4.info", true),
make_tuple("swirl_132x130_mpeg4.m4v", "swirl_132x130_mpeg4.info", true),
diff --git a/media/libstagefright/codecs/m4v_h263/dec/test/README.md b/media/libstagefright/codecs/m4v_h263/dec/test/README.md
index 7e4aea1..38ac567 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/test/README.md
+++ b/media/libstagefright/codecs/m4v_h263/dec/test/README.md
@@ -22,7 +22,8 @@
adb push ${OUT}/data/nativetest/Mpeg4H263DecoderTest/Mpeg4H263DecoderTest /data/local/tmp/
```
-The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263Decoder.zip). Download, unzip and push these files into device for testing.
+The resource file for the tests is taken from [here](https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/test/Mpeg4H263Decoder-1.1.zip).
+Download, unzip and push these files into device for testing.
```
adb push Mpeg4H263Decoder /data/local/tmp/
diff --git a/media/libstagefright/codecs/m4v_h263/enc/Android.bp b/media/libstagefright/codecs/m4v_h263/enc/Android.bp
index b8bc24e..13d310d 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/Android.bp
+++ b/media/libstagefright/codecs/m4v_h263/enc/Android.bp
@@ -6,6 +6,12 @@
"com.android.media.swcodec",
],
min_sdk_version: "29",
+ host_supported: true,
+ target: {
+ darwin: {
+ enabled: false,
+ },
+ },
srcs: [
"src/bitstream_io.cpp",
diff --git a/media/libstagefright/codecs/m4v_h263/fuzzer/Android.bp b/media/libstagefright/codecs/m4v_h263/fuzzer/Android.bp
index 56fc782..778dafb 100644
--- a/media/libstagefright/codecs/m4v_h263/fuzzer/Android.bp
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/Android.bp
@@ -18,25 +18,24 @@
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
-cc_fuzz {
- name: "mpeg4_dec_fuzzer",
+cc_defaults {
+ name: "mpeg4_h263_dec_fuzz_defaults",
+
host_supported: true,
+
srcs: [
"mpeg4_h263_dec_fuzzer.cpp",
],
+
static_libs: [
"libstagefright_m4vh263dec",
"liblog",
],
+
cflags: [
"-DOSCL_IMPORT_REF=",
- "-DMPEG4",
],
- target: {
- darwin: {
- enabled: false,
- },
- },
+
fuzz_config: {
cc: [
"android-media-fuzzing-reports@google.com",
@@ -46,23 +45,45 @@
}
cc_fuzz {
- name: "h263_dec_fuzzer",
- host_supported: true,
- srcs: [
- "mpeg4_h263_dec_fuzzer.cpp",
+ name: "mpeg4_dec_fuzzer",
+
+ defaults: [
+ "mpeg4_h263_dec_fuzz_defaults",
],
- static_libs: [
- "libstagefright_m4vh263dec",
+
+ cflags: [
+ "-DMPEG4",
+ ],
+}
+
+cc_fuzz {
+ name: "h263_dec_fuzzer",
+
+ defaults: [
+ "mpeg4_h263_dec_fuzz_defaults",
+ ],
+}
+
+cc_defaults {
+ name: "mpeg4_h263_enc_fuzz_defaults",
+
+ host_supported: true,
+
+ srcs: ["mpeg4_h263_enc_fuzzer.cpp"],
+
+ shared_libs: [
+ "libutils",
"liblog",
],
- cflags: [
- "-DOSCL_IMPORT_REF=",
+
+ static_libs: [
+ "libstagefright_m4vh263enc",
],
- target: {
- darwin: {
- enabled: false,
- },
- },
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
fuzz_config: {
cc: [
"android-media-fuzzing-reports@google.com",
@@ -70,3 +91,21 @@
componentid: 155276,
},
}
+
+cc_fuzz {
+ name: "mpeg4_enc_fuzzer",
+
+ defaults: [
+ "mpeg4_h263_enc_fuzz_defaults",
+ ],
+
+ cflags: ["-DMPEG4"],
+}
+
+cc_fuzz {
+ name: "h263_enc_fuzzer",
+
+ defaults: [
+ "mpeg4_h263_enc_fuzz_defaults",
+ ],
+}
diff --git a/media/libstagefright/codecs/m4v_h263/fuzzer/README.md b/media/libstagefright/codecs/m4v_h263/fuzzer/README.md
index c2a4f69..ad4ff97 100644
--- a/media/libstagefright/codecs/m4v_h263/fuzzer/README.md
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/README.md
@@ -52,6 +52,107 @@
$ $ANDROID_HOST_OUT/fuzz/x86_64/h263_dec_fuzzer/h263_dec_fuzzer CORPUS_DIR
```
+# Fuzzer for libstagefright_m4vh263enc encoder
+
+## Plugin Design Considerations
+The fuzzer plugin for MPEG4/H263 is designed based on the understanding of the
+codec and tries to achieve the following:
+
+##### Maximize code coverage
+The configuration parameters are not hardcoded, but instead selected based on
+incoming data. This ensures more code paths are reached by the fuzzer.
+
+MPEG4/H263 supports the following parameters:
+1. Frame Width (parameter name: `encWidth`)
+2. Frame Height (parameter name: `encHeight`)
+3. Rate control mode (parameter name: `rcType`)
+4. Number of bytes per packet (parameter name: `packetSize`)
+5. Qp for I-Vop(parameter name: `iQuant`)
+6. Qp for P-Vop (parameter name: `pQuant`)
+7. Enable RVLC mode (parameter name: `rvlcEnable`)
+8. Quantization mode (parameter name: `quantType`)
+9. Disable frame skipping (parameter name: `noFrameSkipped`)
+10. Enable scene change detection (parameter name: `sceneDetect`)
+11. Number of intra MBs in P-frame(parameter name: `numIntraMB`)
+12. Search range of ME (parameter name: `searchRange`)
+13. Enable 8x8 ME and MC (parameter name: `mv8x8Enable`)
+14. Enable AC prediction (parameter name: `useACPred`)
+15. Threshold for intra DC VLC (parameter name: `intraDCVlcTh`)
+16. Encoding Mode (parameter name: `encMode`)
+
+| Parameter| Valid Values| Configured Value|
+|------------- |-------------| ----- |
+| `rcType` | 0. `CONSTANT_Q` 1. `CBR_1` 2. `VBR_1` 3. `CBR_2` 4. `VBR_2` 5. `CBR_LOWDELAY` | All the bits of 6th byte of data modulus 6 |
+| `packetSize` | In the range `0 to 255` | All the bits of 7th byte of data |
+| `iQuant` | In the range `1 to 31` | All the bits of 8th byte of data |
+| `pQuant` | In the range `1 to 31` | All the bits of 9th byte of data |
+| `rvlcEnable` | 0. `PV_OFF` 1. `PV_ON` | bit 0 of 10th byte of data |
+| `quantType` | 0. `0` 1. `1` | bit 0 of 11th byte of data |
+| `noFrameSkipped` | 0. `PV_OFF` 1. `PV_ON` | bit 0 of 12th byte of data |
+| `sceneDetect` | 0. `PV_OFF` 1. `PV_ON` | bit 0 of 13th byte of data |
+| `numIntraMB` | In the range `0 to 7` | bit 0, 1 and 2 of 14th byte of data |
+| `searchRange` | In the range `0 to 31` | bit 0, 1, 2, 3 and 4 of 15th byte of data |
+| `mv8x8Enable` | 0. `PV_OFF` 1. `PV_ON` | bit 0 of 16th byte of data |
+| `useACPred` | 0. `PV_OFF` 1. `PV_ON` | bit 0 of 17th byte of data |
+| `intraDCVlcTh` | In the range `0 to 7` | bit 0, 1 and 2 of 18th byte of data |
+
+Following parameters are only for mpeg4_enc_fuzzer
+
+| Parameter| Valid Values| Configured Value|
+|------------- |-------------| ----- |
+| `encWidth` | In the range `0 to 10239` | All the bits of 1st and 2nd byte of data |
+| `encHeight` | In the range `0 to 10239` | All the bits of 3rd and 4th byte of data |
+| `encMode` | 0. `H263_MODE` 1. `H263_MODE_WITH_ERR_RES` 2. `DATA_PARTITIONING_MODE` 3. `COMBINE_MODE_NO_ERR_RES` 4. `COMBINE_MODE_WITH_ERR_RES` | All the bits of 19th byte of data modulus 5 |
+
+Following parameters are only for h263_enc_fuzzer
+
+| Parameter| Valid Values| Configured Value|
+|------------- |-------------| ----- |
+| `encWidth` | 0. `128` 1. `176` 2. `352` 3. `704` 4. `1408` | All the bits of 1st byte of data modulus 5|
+| `encHeight` | 0. `96` 1. `144` 2. `288` 3. `576` 4. `1152 ` | All the bits of 3rd byte of data modulus 5|
+| `encMode` | 0. `SHORT_HEADER` 1. `SHORT_HEADER_WITH_ERR_RES` | All the bits of 19th byte of data modulus 2 |
+
+This also ensures that the plugin is always deterministic for any given input.
+
+##### Maximize utilization of input data
+The plugin feeds the entire input data to the codec using a loop.
+If the encode operation was successful, the input is advanced by the frame size.
+If the encode operation was un-successful, the input is still advanced by frame size so
+that the fuzzer can proceed to feed the next frame.
+
+This ensures that the plugin tolerates any kind of input (empty, huge,
+malformed, etc) and doesnt `exit()` on any input and thereby increasing the
+chance of identifying vulnerabilities.
+
+## Build
+
+This describes steps to build mpeg4_enc_fuzzer and h263_enc_fuzzer binary.
+
+### Android
+
+#### Steps to build
+Build the fuzzer
+```
+ $ mm -j$(nproc) mpeg4_enc_fuzzer
+ $ mm -j$(nproc) h263_enc_fuzzer
+```
+
+#### Steps to run
+Create a directory CORPUS_DIR and copy some yuv files to that folder
+Push this directory to device.
+
+To run on device
+```
+ $ adb sync data
+ $ adb shell /data/fuzz/arm64/m4v_h263_enc_fuzzer/m4v_h263_enc_fuzzer CORPUS_DIR
+ $ adb shell /data/fuzz/arm64/h263_enc_fuzzer/h263_enc_fuzzer CORPUS_DIR
+```
+To run on host
+```
+ $ $ANDROID_HOST_OUT/fuzz/x86_64/mpeg4_enc_fuzzer/mpeg4_enc_fuzzer CORPUS_DIR
+ $ $ANDROID_HOST_OUT/fuzz/x86_64/h263_enc_fuzzer/h263_enc_fuzzer CORPUS_DIR
+```
+
## References:
* http://llvm.org/docs/LibFuzzer.html
* https://github.com/google/oss-fuzz
diff --git a/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_enc_fuzzer.cpp b/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_enc_fuzzer.cpp
new file mode 100644
index 0000000..f154706
--- /dev/null
+++ b/media/libstagefright/codecs/m4v_h263/fuzzer/mpeg4_h263_enc_fuzzer.cpp
@@ -0,0 +1,190 @@
+/*
+ * 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.
+ */
+#include <algorithm>
+#include "mp4enc_api.h"
+
+constexpr int8_t kIDRFrameRefreshIntervalInSec = 1;
+constexpr MP4RateControlType krcType[] = {CONSTANT_Q, CBR_1, VBR_1, CBR_2, VBR_2, CBR_LOWDELAY};
+#ifdef MPEG4
+constexpr MP4EncodingMode kEncodingMode[] = {SHORT_HEADER, SHORT_HEADER_WITH_ERR_RES,
+ DATA_PARTITIONING_MODE, COMBINE_MODE_NO_ERR_RES,
+ COMBINE_MODE_WITH_ERR_RES};
+constexpr size_t kMaxWidth = 10240;
+constexpr size_t kMaxHeight = 10240;
+#else
+constexpr MP4EncodingMode kEncodingMode[] = {H263_MODE, H263_MODE_WITH_ERR_RES};
+constexpr int kWidth[] = {128, 176, 352, 704, 1408};
+constexpr int kHeight[] = {96, 144, 288, 576, 1152};
+constexpr size_t kWidthNum = std::size(kWidth);
+constexpr size_t kHeightNum = std::size(kHeight);
+#endif
+
+constexpr size_t krcTypeNum = std::size(krcType);
+constexpr size_t kEncodingModeNum = std::size(kEncodingMode);
+constexpr size_t kMaxQP = 51;
+
+enum {
+ IDX_WD_BYTE_1,
+ IDX_WD_BYTE_2,
+ IDX_HT_BYTE_1,
+ IDX_HT_BYTE_2,
+ IDX_FRAME_RATE,
+ IDX_RC_TYPE,
+ IDX_PACKET_SIZE,
+ IDX_I_FRAME_QP,
+ IDX_P_FRAME_QP,
+ IDX_ENABLE_RVLC,
+ IDX_QUANT_TYPE,
+ IDX_NO_FRAME_SKIPPED_FLAG,
+ IDX_ENABLE_SCENE_DETECT,
+ IDX_NUM_INTRA_MB,
+ IDX_SEARCH_RANGE,
+ IDX_ENABLE_MV_8x8,
+ IDX_USE_AC_PRED,
+ IDX_INTRA_DC_VLC_THRESHOLD,
+ IDX_ENC_MODE,
+ IDX_LAST
+};
+
+class Codec {
+ public:
+ Codec() = default;
+ ~Codec() { deInitEncoder(); }
+ bool initEncoder(const uint8_t *data);
+ void encodeFrames(const uint8_t *data, size_t size);
+ void deInitEncoder();
+
+ private:
+ int32_t mFrameWidth = 352;
+ int32_t mFrameHeight = 288;
+ float mFrameRate = 25.0f;
+ VideoEncOptions *mEncodeHandle = nullptr;
+ VideoEncControls *mEncodeControl = nullptr;
+};
+
+bool Codec::initEncoder(const uint8_t *data) {
+ mEncodeHandle = new VideoEncOptions;
+ if (!mEncodeHandle) {
+ return false;
+ }
+ memset(mEncodeHandle, 0, sizeof(VideoEncOptions));
+ mEncodeControl = new VideoEncControls;
+ if (!mEncodeControl) {
+ return false;
+ }
+ memset(mEncodeControl, 0, sizeof(VideoEncControls));
+ PVGetDefaultEncOption(mEncodeHandle, 0);
+
+#ifdef MPEG4
+ mFrameWidth = ((data[IDX_WD_BYTE_1] << 8) | data[IDX_WD_BYTE_2]) % kMaxWidth;
+ mFrameHeight = ((data[IDX_HT_BYTE_1] << 8) | data[IDX_HT_BYTE_2]) % kMaxHeight;
+#else
+ mFrameWidth = kWidth[data[IDX_WD_BYTE_1] % kWidthNum];
+ mFrameHeight = kHeight[data[IDX_HT_BYTE_1] % kHeightNum];
+#endif
+ mFrameRate = data[IDX_FRAME_RATE];
+ mEncodeHandle->rcType = krcType[data[IDX_RC_TYPE] % krcTypeNum];
+ mEncodeHandle->profile_level = CORE_PROFILE_LEVEL2;
+ mEncodeHandle->packetSize = data[IDX_PACKET_SIZE];
+ mEncodeHandle->iQuant[0] = (data[IDX_I_FRAME_QP] % kMaxQP) + 1;
+ mEncodeHandle->pQuant[0] = (data[IDX_P_FRAME_QP] % kMaxQP) + 1;
+ mEncodeHandle->rvlcEnable = (data[IDX_ENABLE_RVLC] & 0x01) ? PV_OFF : PV_ON;
+ mEncodeHandle->quantType[0] = (data[IDX_QUANT_TYPE] & 0x01) ? 0 : 1;
+ mEncodeHandle->noFrameSkipped = (data[IDX_NO_FRAME_SKIPPED_FLAG] & 0x01) ? PV_OFF : PV_ON;
+ mEncodeHandle->sceneDetect = (data[IDX_ENABLE_SCENE_DETECT] & 0x01) ? PV_OFF : PV_ON;
+ mEncodeHandle->numIntraMB = data[IDX_NUM_INTRA_MB] & 0x07;
+ mEncodeHandle->searchRange = data[IDX_SEARCH_RANGE] & 0x1F;
+ mEncodeHandle->mv8x8Enable = (data[IDX_ENABLE_MV_8x8] & 0x01) ? PV_OFF : PV_ON;
+ mEncodeHandle->useACPred = (data[IDX_USE_AC_PRED] & 0x01) ? PV_OFF : PV_ON;
+ mEncodeHandle->intraDCVlcTh = data[IDX_INTRA_DC_VLC_THRESHOLD] & 0x07;
+ mEncodeHandle->encMode = kEncodingMode[data[IDX_ENC_MODE] % kEncodingModeNum];
+ mEncodeHandle->encWidth[0] = mFrameWidth;
+ mEncodeHandle->encHeight[0] = mFrameHeight;
+ mEncodeHandle->encFrameRate[0] = mFrameRate;
+ mEncodeHandle->tickPerSrc = mEncodeHandle->timeIncRes / mFrameRate;
+ mEncodeHandle->intraPeriod = (kIDRFrameRefreshIntervalInSec * mFrameRate);
+ if (!PVInitVideoEncoder(mEncodeControl, mEncodeHandle)) {
+ return false;
+ }
+ return true;
+}
+
+void Codec::deInitEncoder() {
+ if (mEncodeControl) {
+ PVCleanUpVideoEncoder(mEncodeControl);
+ delete mEncodeControl;
+ mEncodeControl = nullptr;
+ }
+ if (mEncodeHandle) {
+ delete mEncodeHandle;
+ mEncodeHandle = nullptr;
+ }
+}
+
+void Codec::encodeFrames(const uint8_t *data, size_t size) {
+ size_t inputBufferSize = (mFrameWidth * mFrameHeight * 3) / 2;
+ size_t outputBufferSize = inputBufferSize * 2;
+ uint8_t outputBuffer[outputBufferSize];
+
+ // Get VOL header.
+ int32_t sizeOutputBuffer = outputBufferSize;
+ PVGetVolHeader(mEncodeControl, outputBuffer, &sizeOutputBuffer, 0);
+
+ size_t numFrame = 0;
+ while (size > 0) {
+ size_t bytesConsumed = std::min(size, inputBufferSize);
+ uint8_t inputBuffer[inputBufferSize];
+ memcpy(inputBuffer, data, bytesConsumed);
+ if (bytesConsumed < sizeof(inputBuffer)) {
+ memset(inputBuffer + bytesConsumed, data[0], sizeof(inputBuffer) - bytesConsumed);
+ }
+ VideoEncFrameIO videoIn{}, videoOut{};
+ videoIn.height = mFrameHeight;
+ videoIn.pitch = mFrameWidth;
+ videoIn.timestamp = (numFrame * 1000) / mFrameRate;
+ videoIn.yChan = inputBuffer;
+ videoIn.uChan = videoIn.yChan + videoIn.height * videoIn.pitch;
+ videoIn.vChan = videoIn.uChan + ((videoIn.height * videoIn.pitch) >> 2);
+ uint32_t modTimeMs = 0;
+ int32_t dataLength = outputBufferSize;
+ int32_t nLayer = 0;
+ PVEncodeVideoFrame(mEncodeControl, &videoIn, &videoOut, &modTimeMs, outputBuffer,
+ &dataLength, &nLayer);
+ MP4HintTrack hintTrack;
+ PVGetHintTrack(mEncodeControl, &hintTrack);
+ PVGetOverrunBuffer(mEncodeControl);
+ ++numFrame;
+ data += bytesConsumed;
+ size -= bytesConsumed;
+ }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ if (size < IDX_LAST) {
+ return 0;
+ }
+ Codec *codec = new Codec();
+ if (!codec) {
+ return 0;
+ }
+ if (codec->initEncoder(data)) {
+ data += IDX_LAST;
+ size -= IDX_LAST;
+ codec->encodeFrames(data, size);
+ }
+ delete codec;
+ return 0;
+}
diff --git a/media/libstagefright/codecs/mp3dec/test/AndroidTest.xml b/media/libstagefright/codecs/mp3dec/test/AndroidTest.xml
index 233f9bb..29952eb 100644
--- a/media/libstagefright/codecs/mp3dec/test/AndroidTest.xml
+++ b/media/libstagefright/codecs/mp3dec/test/AndroidTest.xml
@@ -19,7 +19,7 @@
<option name="cleanup" value="true" />
<option name="push" value="Mp3DecoderTest->/data/local/tmp/Mp3DecoderTest" />
<option name="push-file"
- key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/mp3dec/test/Mp3DecoderTest-1.1.zip?unzip=true"
+ key="https://storage.googleapis.com/android_media/frameworks/av/media/libstagefright/mp3dec/test/Mp3DecoderTest-1.2.zip?unzip=true"
value="/data/local/tmp/Mp3DecoderTestRes/" />
</target_preparer>
diff --git a/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTest.cpp b/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTest.cpp
index 0784c0c..91326a8 100644
--- a/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTest.cpp
+++ b/media/libstagefright/codecs/mp3dec/test/Mp3DecoderTest.cpp
@@ -186,6 +186,7 @@
::testing::Values(("bbb_44100hz_2ch_128kbps_mp3_30sec.mp3"),
("bbb_44100hz_2ch_128kbps_mp3_5mins.mp3"),
("bug_136053885.mp3"),
+ ("bbb_2ch_44kHz_lame_crc.mp3"),
("bbb_mp3_stereo_192kbps_48000hz.mp3")));
int main(int argc, char **argv) {
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index e97f6eb..5509512 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -813,10 +813,6 @@
baseSize = U32_AT(&mParent.mData[mOffset + 4]);
}
- if (baseSize == 0) {
- return;
- }
-
// Prevent integer overflow when adding
if (SIZE_MAX - 10 <= baseSize) {
return;
diff --git a/media/libstagefright/include/media/stagefright/ACodec.h b/media/libstagefright/include/media/stagefright/ACodec.h
index 105e7f7..8ef9278 100644
--- a/media/libstagefright/include/media/stagefright/ACodec.h
+++ b/media/libstagefright/include/media/stagefright/ACodec.h
@@ -147,6 +147,7 @@
kWhatReleaseCodecInstance = 'relC',
kWhatForceStateTransition = 'fstt',
kWhatCheckIfStuck = 'Cstk',
+ kWhatSubmitExtraOutputMetadataBuffer = 'sbxo',
};
enum {
@@ -272,6 +273,7 @@
bool mShutdownInProgress;
bool mExplicitShutdown;
bool mIsLegacyVP9Decoder;
+ bool mIsLowLatency;
// If "mKeepComponentAllocated" we only transition back to Loaded state
// and do not release the component instance.
diff --git a/media/libstagefright/include/media/stagefright/MediaCodec.h b/media/libstagefright/include/media/stagefright/MediaCodec.h
index c9109f5..5ff4e12 100644
--- a/media/libstagefright/include/media/stagefright/MediaCodec.h
+++ b/media/libstagefright/include/media/stagefright/MediaCodec.h
@@ -366,6 +366,7 @@
AString mOwnerName;
sp<MediaCodecInfo> mCodecInfo;
sp<AReplyToken> mReplyID;
+ std::string mLastReplyOrigin;
std::vector<sp<AMessage>> mDeferredMessages;
uint32_t mFlags;
status_t mStickyError;
@@ -417,6 +418,10 @@
sp<ICrypto> mCrypto;
+ int32_t mTunneledInputWidth;
+ int32_t mTunneledInputHeight;
+ bool mTunneled;
+
sp<IDescrambler> mDescrambler;
List<sp<ABuffer> > mCSD;
@@ -450,6 +455,7 @@
size_t updateBuffers(int32_t portIndex, const sp<AMessage> &msg);
status_t onQueueInputBuffer(const sp<AMessage> &msg);
status_t onReleaseOutputBuffer(const sp<AMessage> &msg);
+ BufferInfo *peekNextPortBuffer(int32_t portIndex);
ssize_t dequeuePortBuffer(int32_t portIndex);
status_t getBufferAndFormat(
@@ -481,6 +487,7 @@
status_t onSetParameters(const sp<AMessage> ¶ms);
status_t amendOutputFormatWithCodecSpecificData(const sp<MediaCodecBuffer> &buffer);
+ void handleOutputFormatChangeIfNeeded(const sp<MediaCodecBuffer> &buffer);
bool isExecuting() const;
uint64_t getGraphicBufferSize();
@@ -489,8 +496,8 @@
bool hasPendingBuffer(int portIndex);
bool hasPendingBuffer();
- void postPendingRepliesAndDeferredMessages(status_t err = OK);
- void postPendingRepliesAndDeferredMessages(const sp<AMessage> &response);
+ void postPendingRepliesAndDeferredMessages(std::string origin, status_t err = OK);
+ void postPendingRepliesAndDeferredMessages(std::string origin, const sp<AMessage> &response);
/* called to get the last codec error when the sticky flag is set.
* if no such codec error is found, returns UNKNOWN_ERROR.
diff --git a/media/libstagefright/tests/fuzzers/Android.bp b/media/libstagefright/tests/fuzzers/Android.bp
new file mode 100644
index 0000000..49ff69a
--- /dev/null
+++ b/media/libstagefright/tests/fuzzers/Android.bp
@@ -0,0 +1,53 @@
+cc_defaults {
+ name: "libstagefright_fuzzer_defaults",
+ cflags: [
+ "-Wno-multichar",
+ "-Werror",
+ "-Wno-error=deprecated-declarations",
+ "-Wall",
+ ],
+ shared_libs: [
+ "libstagefright",
+ "libstagefright_codecbase",
+ "libutils",
+ "libstagefright_foundation",
+ "libmedia",
+ "libaudioclient",
+ "libmedia_omx",
+ "libgui",
+ "libbinder",
+ "libcutils",
+ ],
+}
+
+cc_fuzz {
+ name: "libstagefright_mediaclock_fuzzer",
+ srcs: [
+ "MediaClockFuzzer.cpp",
+ ],
+ defaults: ["libstagefright_fuzzer_defaults"],
+}
+
+cc_fuzz {
+ name: "libstagefright_mediascanner_fuzzer",
+ srcs: [
+ "StagefrightMediaScannerFuzzer.cpp",
+ ],
+ defaults: ["libstagefright_fuzzer_defaults"],
+}
+
+cc_fuzz {
+ name: "libstagefright_skipcutbuffer_fuzzer",
+ srcs: [
+ "SkipCutBufferFuzzer.cpp",
+ ],
+ defaults: ["libstagefright_fuzzer_defaults"],
+}
+
+cc_fuzz {
+ name: "libstagefright_mediamuxer_fuzzer",
+ srcs: [
+ "MediaMuxerFuzzer.cpp",
+ ],
+ defaults: ["libstagefright_fuzzer_defaults"],
+}
diff --git a/media/libstagefright/tests/fuzzers/MediaClockFuzzer.cpp b/media/libstagefright/tests/fuzzers/MediaClockFuzzer.cpp
new file mode 100644
index 0000000..e473541
--- /dev/null
+++ b/media/libstagefright/tests/fuzzers/MediaClockFuzzer.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+// Authors: corbin.souffrant@leviathansecurity.com
+// dylan.katz@leviathansecurity.com
+
+#include <fuzzer/FuzzedDataProvider.h>
+#include <media/stagefright/MediaClock.h>
+#include <media/stagefright/foundation/AMessage.h>
+
+namespace android {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ FuzzedDataProvider fdp = FuzzedDataProvider(data, size);
+ sp<MediaClock> mClock(new MediaClock);
+
+ bool registered = false;
+ while (fdp.remaining_bytes() > 0) {
+ switch (fdp.ConsumeIntegralInRange<uint8_t>(0, 5)) {
+ case 0: {
+ if (registered == false) {
+ mClock->init();
+ registered = true;
+ }
+ break;
+ }
+ case 1: {
+ int64_t startingTimeMediaUs = fdp.ConsumeIntegral<int64_t>();
+ mClock->setStartingTimeMedia(startingTimeMediaUs);
+ break;
+ }
+ case 2: {
+ mClock->clearAnchor();
+ break;
+ }
+ case 3: {
+ int64_t anchorTimeRealUs = fdp.ConsumeIntegral<int64_t>();
+ int64_t anchorTimeMediaUs = fdp.ConsumeIntegral<int64_t>();
+ int64_t maxTimeMediaUs = fdp.ConsumeIntegral<int64_t>();
+ mClock->updateAnchor(anchorTimeMediaUs, anchorTimeRealUs, maxTimeMediaUs);
+ break;
+ }
+ case 4: {
+ int64_t maxTimeMediaUs = fdp.ConsumeIntegral<int64_t>();
+ mClock->updateMaxTimeMedia(maxTimeMediaUs);
+ break;
+ }
+ case 5: {
+ wp<AMessage> msg(new AMessage);
+ mClock->setNotificationMessage(msg.promote());
+ }
+ }
+ }
+
+ return 0;
+}
+} // namespace android
diff --git a/media/libstagefright/tests/fuzzers/MediaMuxerFuzzer.cpp b/media/libstagefright/tests/fuzzers/MediaMuxerFuzzer.cpp
new file mode 100644
index 0000000..5df3267
--- /dev/null
+++ b/media/libstagefright/tests/fuzzers/MediaMuxerFuzzer.cpp
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+// Authors: corbin.souffrant@leviathansecurity.com
+// dylan.katz@leviathansecurity.com
+
+#include <MediaMuxerFuzzer.h>
+#include <cutils/ashmem.h>
+#include <fuzzer/FuzzedDataProvider.h>
+#include <media/stagefright/MediaMuxer.h>
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/AMessage.h>
+
+namespace android {
+
+// Can't seem to get setBuffer or setString working. It always segfaults on a
+// null pointer read or memleaks. So that functionality is missing.
+void createMessage(AMessage *msg, FuzzedDataProvider *fdp) {
+ size_t count = fdp->ConsumeIntegralInRange<size_t>(0, 32);
+ while (fdp->remaining_bytes() > 0 && count > 0) {
+ uint8_t function_id =
+ fdp->ConsumeIntegralInRange<uint8_t>(0, amessage_setvals.size() - 1);
+ amessage_setvals[function_id](msg, fdp);
+ count--;
+ }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ FuzzedDataProvider fdp = FuzzedDataProvider(data, size);
+
+ size_t data_size = fdp.ConsumeIntegralInRange<size_t>(0, size);
+ int fd = ashmem_create_region("mediamuxer_fuzz_region", data_size);
+ if (fd < 0)
+ return 0;
+
+ uint8_t *sh_data = static_cast<uint8_t *>(
+ mmap(NULL, data_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
+ if (sh_data == MAP_FAILED)
+ return 0;
+
+ MediaMuxer::OutputFormat format =
+ (MediaMuxer::OutputFormat)fdp.ConsumeIntegralInRange<int32_t>(0, 4);
+ sp<MediaMuxer> mMuxer(new MediaMuxer(fd, format));
+
+ while (fdp.remaining_bytes() > 1) {
+ switch (fdp.ConsumeIntegralInRange<uint8_t>(0, 4)) {
+ case 0: {
+ // For some reason it only likes mp4s here...
+ if (format == 1 || format == 4)
+ break;
+
+ sp<AMessage> a_format(new AMessage);
+ createMessage(a_format.get(), &fdp);
+ mMuxer->addTrack(a_format);
+ break;
+ }
+ case 1: {
+ mMuxer->start();
+ break;
+ }
+ case 2: {
+ int degrees = fdp.ConsumeIntegral<int>();
+ mMuxer->setOrientationHint(degrees);
+ break;
+ }
+ case 3: {
+ int latitude = fdp.ConsumeIntegral<int>();
+ int longitude = fdp.ConsumeIntegral<int>();
+ mMuxer->setLocation(latitude, longitude);
+ break;
+ }
+ case 4: {
+ size_t buf_size = fdp.ConsumeIntegralInRange<size_t>(0, data_size);
+ sp<ABuffer> a_buffer(new ABuffer(buf_size));
+
+ size_t trackIndex = fdp.ConsumeIntegral<size_t>();
+ int64_t timeUs = fdp.ConsumeIntegral<int64_t>();
+ uint32_t flags = fdp.ConsumeIntegral<uint32_t>();
+ mMuxer->writeSampleData(a_buffer, trackIndex, timeUs, flags);
+ }
+ }
+ }
+
+ if (fdp.ConsumeBool())
+ mMuxer->stop();
+
+ munmap(sh_data, data_size);
+ close(fd);
+ return 0;
+}
+} // namespace android
diff --git a/media/libstagefright/tests/fuzzers/MediaMuxerFuzzer.h b/media/libstagefright/tests/fuzzers/MediaMuxerFuzzer.h
new file mode 100644
index 0000000..7d4421d
--- /dev/null
+++ b/media/libstagefright/tests/fuzzers/MediaMuxerFuzzer.h
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+// Authors: corbin.souffrant@leviathansecurity.com
+// dylan.katz@leviathansecurity.com
+
+#pragma once
+
+#include <fuzzer/FuzzedDataProvider.h>
+#include <media/stagefright/foundation/AMessage.h>
+
+namespace android {
+
+// Mappings vectors are the list of attributes that the MediaMuxer
+// class looks for in the message.
+static std::vector<const char *> floatMappings{
+ "capture-rate",
+ "time-lapse-fps",
+ "frame-rate",
+};
+
+static std::vector<const char *> int64Mappings{
+ "exif-offset", "exif-size", "target-time",
+ "thumbnail-time", "timeUs", "durationUs",
+};
+
+static std::vector<const char *> int32Mappings{"loop",
+ "time-scale",
+ "crypto-mode",
+ "crypto-default-iv-size",
+ "crypto-encrypted-byte-block",
+ "crypto-skip-byte-block",
+ "frame-count",
+ "max-bitrate",
+ "pcm-big-endian",
+ "temporal-layer-count",
+ "temporal-layer-id",
+ "thumbnail-width",
+ "thumbnail-height",
+ "track-id",
+ "valid-samples",
+ "color-format",
+ "ca-system-id",
+ "is-sync-frame",
+ "bitrate",
+ "max-bitrate",
+ "width",
+ "height",
+ "sar-width",
+ "sar-height",
+ "display-width",
+ "display-height",
+ "is-default",
+ "tile-width",
+ "tile-height",
+ "grid-rows",
+ "grid-cols",
+ "rotation-degrees",
+ "channel-count",
+ "sample-rate",
+ "bits-per-sample",
+ "channel-mask",
+ "encoder-delay",
+ "encoder-padding",
+ "is-adts",
+ "frame-rate",
+ "max-height",
+ "max-width",
+ "max-input-size",
+ "haptic-channel-count",
+ "pcm-encoding",
+ "aac-profile"};
+
+static const std::vector<std::function<void(AMessage *, FuzzedDataProvider *)>>
+ amessage_setvals = {
+ [](AMessage *msg, FuzzedDataProvider *fdp) -> void {
+ msg->setRect("crop", fdp->ConsumeIntegral<int32_t>(),
+ fdp->ConsumeIntegral<int32_t>(),
+ fdp->ConsumeIntegral<int32_t>(),
+ fdp->ConsumeIntegral<int32_t>());
+ },
+ [](AMessage *msg, FuzzedDataProvider *fdp) -> void {
+ msg->setFloat(floatMappings[fdp->ConsumeIntegralInRange<size_t>(
+ 0, floatMappings.size() - 1)],
+ fdp->ConsumeFloatingPoint<float>());
+ },
+ [](AMessage *msg, FuzzedDataProvider *fdp) -> void {
+ msg->setInt64(int64Mappings[fdp->ConsumeIntegralInRange<size_t>(
+ 0, int64Mappings.size() - 1)],
+ fdp->ConsumeIntegral<int64_t>());
+ },
+ [](AMessage *msg, FuzzedDataProvider *fdp) -> void {
+ msg->setInt32(int32Mappings[fdp->ConsumeIntegralInRange<size_t>(
+ 0, int32Mappings.size() - 1)],
+ fdp->ConsumeIntegral<int32_t>());
+ }};
+} // namespace android
diff --git a/media/libstagefright/tests/fuzzers/SkipCutBufferFuzzer.cpp b/media/libstagefright/tests/fuzzers/SkipCutBufferFuzzer.cpp
new file mode 100644
index 0000000..1f78e6d
--- /dev/null
+++ b/media/libstagefright/tests/fuzzers/SkipCutBufferFuzzer.cpp
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+// Authors: corbin.souffrant@leviathansecurity.com
+// dylan.katz@leviathansecurity.com
+
+#include <fuzzer/FuzzedDataProvider.h>
+#include <media/stagefright/MediaBuffer.h>
+#include <media/stagefright/SkipCutBuffer.h>
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/foundation/AMessage.h>
+
+namespace android {
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ FuzzedDataProvider fdp = FuzzedDataProvider(data, size);
+ size_t skip = fdp.ConsumeIntegral<size_t>();
+ size_t cut = fdp.ConsumeIntegral<size_t>();
+ size_t num16Channels = fdp.ConsumeIntegral<size_t>();
+ sp<SkipCutBuffer> sBuffer(new SkipCutBuffer(skip, cut, num16Channels));
+
+ while (fdp.remaining_bytes() > 0) {
+ // Cap size to 1024 to limit max amount allocated.
+ size_t buf_size = fdp.ConsumeIntegralInRange<size_t>(0, 1024);
+ size_t range = fdp.ConsumeIntegralInRange<size_t>(0, buf_size);
+ size_t length = fdp.ConsumeIntegralInRange<size_t>(0, buf_size - range);
+
+ switch (fdp.ConsumeIntegralInRange<uint8_t>(0, 4)) {
+ case 0: {
+ sp<ABuffer> a_buffer(new ABuffer(buf_size));
+ sp<AMessage> format(new AMessage);
+ sp<MediaCodecBuffer> s_buffer(new MediaCodecBuffer(format, a_buffer));
+ s_buffer->setRange(range, length);
+ sBuffer->submit(s_buffer);
+ break;
+ }
+ case 1: {
+ std::unique_ptr<MediaBufferBase> m_buffer(new MediaBuffer(buf_size));
+ m_buffer->set_range(range, length);
+ sBuffer->submit(reinterpret_cast<MediaBuffer *>(m_buffer.get()));
+ break;
+ }
+ case 2: {
+ sp<ABuffer> a_buffer(new ABuffer(buf_size));
+ sp<AMessage> format(new AMessage);
+ sp<MediaCodecBuffer> s_buffer(new MediaCodecBuffer(format, a_buffer));
+ a_buffer->setRange(range, length);
+ sBuffer->submit(a_buffer);
+ break;
+ }
+ case 3: {
+ sBuffer->clear();
+ break;
+ }
+ case 4: {
+ sBuffer->size();
+ }
+ }
+ }
+ return 0;
+}
+} // namespace android
diff --git a/media/libstagefright/tests/fuzzers/StagefrightMediaScannerFuzzer.cpp b/media/libstagefright/tests/fuzzers/StagefrightMediaScannerFuzzer.cpp
new file mode 100644
index 0000000..a072b7c
--- /dev/null
+++ b/media/libstagefright/tests/fuzzers/StagefrightMediaScannerFuzzer.cpp
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+// Authors: corbin.souffrant@leviathansecurity.com
+// dylan.katz@leviathansecurity.com
+
+#include <cutils/ashmem.h>
+#include <fuzzer/FuzzedDataProvider.h>
+#include <media/stagefright/StagefrightMediaScanner.h>
+
+#include <cstdio>
+
+namespace android {
+class FuzzMediaScannerClient : public MediaScannerClient {
+public:
+ virtual status_t scanFile(const char *, long long, long long, bool, bool) {
+ return 0;
+ }
+
+ virtual status_t handleStringTag(const char *, const char *) { return 0; }
+
+ virtual status_t setMimeType(const char *) { return 0; }
+};
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ FuzzedDataProvider fdp = FuzzedDataProvider(data, size);
+ StagefrightMediaScanner mScanner = StagefrightMediaScanner();
+ // Without this, the fuzzer crashes for some reason.
+ mScanner.setLocale("");
+
+ size_t data_size = fdp.ConsumeIntegralInRange<size_t>(0, size);
+ int fd =
+ ashmem_create_region("stagefrightmediascanner_fuzz_region", data_size);
+ if (fd < 0)
+ return 0;
+
+ uint8_t *sh_data = static_cast<uint8_t *>(
+ mmap(NULL, data_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
+ if (sh_data == MAP_FAILED)
+ return 0;
+
+ while (fdp.remaining_bytes() > 8) {
+ switch (fdp.ConsumeIntegralInRange<uint8_t>(0, 1)) {
+ case 0: {
+ std::string path = fdp.ConsumeRandomLengthString(fdp.remaining_bytes());
+ std::string mimeType =
+ fdp.ConsumeRandomLengthString(fdp.remaining_bytes());
+ std::shared_ptr<MediaScannerClient> client(new FuzzMediaScannerClient());
+ mScanner.processFile(path.c_str(), mimeType.c_str(), *client);
+ break;
+ }
+ case 1: {
+ size_t to_copy = fdp.ConsumeIntegralInRange<size_t>(1, data_size);
+ std::vector<uint8_t> rand_buf = fdp.ConsumeBytes<uint8_t>(to_copy);
+
+ // If fdp doesn't have enough bytes left it will just make a shorter
+ // vector.
+ to_copy = std::min(rand_buf.size(), data_size);
+
+ std::copy(sh_data, sh_data + to_copy, rand_buf.begin());
+ mScanner.extractAlbumArt(fd);
+ }
+ }
+ }
+
+ munmap(sh_data, data_size);
+ close(fd);
+ return 0;
+}
+} // namespace android
diff --git a/media/libstagefright/tests/mediacodec/Android.bp b/media/libstagefright/tests/mediacodec/Android.bp
index 006864e..0bd0639 100644
--- a/media/libstagefright/tests/mediacodec/Android.bp
+++ b/media/libstagefright/tests/mediacodec/Android.bp
@@ -23,7 +23,12 @@
"MediaTestHelper.cpp",
],
+ header_libs: [
+ "libmediadrm_headers",
+ ],
+
shared_libs: [
+ "libgui",
"libmedia",
"libmedia_codeclist",
"libmediametrics",
diff --git a/media/libstagefright/tests/mediacodec/MediaCodecTest.cpp b/media/libstagefright/tests/mediacodec/MediaCodecTest.cpp
index baa86c1..d00a50f 100644
--- a/media/libstagefright/tests/mediacodec/MediaCodecTest.cpp
+++ b/media/libstagefright/tests/mediacodec/MediaCodecTest.cpp
@@ -20,6 +20,8 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+#include <gui/Surface.h>
+#include <mediadrm/ICrypto.h>
#include <media/stagefright/CodecBase.h>
#include <media/stagefright/MediaCodec.h>
#include <media/stagefright/MediaCodecListWriter.h>
@@ -152,6 +154,37 @@
using namespace android;
using ::testing::_;
+static sp<MediaCodec> SetupMediaCodec(
+ const AString &owner,
+ const AString &codecName,
+ const AString &mediaType,
+ const sp<ALooper> &looper,
+ std::function<sp<CodecBase>(const AString &name, const char *owner)> getCodecBase) {
+ std::shared_ptr<MediaCodecListWriter> listWriter =
+ MediaTestHelper::CreateCodecListWriter();
+ std::unique_ptr<MediaCodecInfoWriter> infoWriter = listWriter->addMediaCodecInfo();
+ infoWriter->setName(codecName.c_str());
+ infoWriter->setOwner(owner.c_str());
+ infoWriter->addMediaType(mediaType.c_str());
+ std::vector<sp<MediaCodecInfo>> codecInfos;
+ MediaTestHelper::WriteCodecInfos(listWriter, &codecInfos);
+ std::function<status_t(const AString &, sp<MediaCodecInfo> *)> getCodecInfo =
+ [codecInfos](const AString &name, sp<MediaCodecInfo> *info) -> status_t {
+ auto it = std::find_if(
+ codecInfos.begin(), codecInfos.end(),
+ [&name](const sp<MediaCodecInfo> &info) {
+ return name.equalsIgnoreCase(info->getCodecName());
+ });
+
+ *info = (it == codecInfos.end()) ? nullptr : *it;
+ return (*info) ? OK : NAME_NOT_FOUND;
+ };
+
+ looper->start();
+ return MediaTestHelper::CreateCodec(
+ codecName, looper, getCodecBase, getCodecInfo);
+}
+
TEST(MediaCodecTest, ReclaimReleaseRace) {
// Test scenario:
//
@@ -202,30 +235,9 @@
return mockCodec;
};
- std::shared_ptr<MediaCodecListWriter> listWriter =
- MediaTestHelper::CreateCodecListWriter();
- std::unique_ptr<MediaCodecInfoWriter> infoWriter = listWriter->addMediaCodecInfo();
- infoWriter->setName(kCodecName.c_str());
- infoWriter->setOwner(kCodecOwner.c_str());
- infoWriter->addMediaType(kMediaType.c_str());
- std::vector<sp<MediaCodecInfo>> codecInfos;
- MediaTestHelper::WriteCodecInfos(listWriter, &codecInfos);
- std::function<status_t(const AString &, sp<MediaCodecInfo> *)> getCodecInfo =
- [codecInfos](const AString &name, sp<MediaCodecInfo> *info) -> status_t {
- auto it = std::find_if(
- codecInfos.begin(), codecInfos.end(),
- [&name](const sp<MediaCodecInfo> &info) {
- return name.equalsIgnoreCase(info->getCodecName());
- });
-
- *info = (it == codecInfos.end()) ? nullptr : *it;
- return (*info) ? OK : NAME_NOT_FOUND;
- };
-
sp<ALooper> looper{new ALooper};
- looper->start();
- sp<MediaCodec> codec = MediaTestHelper::CreateCodec(
- kCodecName, looper, getCodecBase, getCodecInfo);
+ sp<MediaCodec> codec = SetupMediaCodec(
+ kCodecOwner, kCodecName, kMediaType, looper, getCodecBase);
ASSERT_NE(nullptr, codec) << "Codec must not be null";
ASSERT_NE(nullptr, mockCodec) << "MockCodec must not be null";
std::promise<void> reclaimCompleted;
@@ -266,3 +278,73 @@
<< "release timed out";
looper->stop();
}
+
+TEST(MediaCodecTest, ErrorWhileStopping) {
+ // Test scenario:
+ //
+ // 1) Client thread calls stop(); MediaCodec looper thread calls
+ // initiateShutdown(); shutdown is being handled at the component thread.
+ // 2) Error occurred, but the shutdown operation is still being done.
+ // 3) MediaCodec looper thread handles the error.
+ // 4) Component thread completes shutdown and posts onStopCompleted()
+
+ static const AString kCodecName{"test.codec"};
+ static const AString kCodecOwner{"nobody"};
+ static const AString kMediaType{"video/x-test"};
+
+ std::promise<void> errorOccurred;
+ sp<MockCodec> mockCodec;
+ std::function<sp<CodecBase>(const AString &name, const char *owner)> getCodecBase =
+ [&mockCodec, &errorOccurred](const AString &, const char *) {
+ mockCodec = new MockCodec([](const std::shared_ptr<MockBufferChannel> &) {
+ // No mock setup, as we don't expect any buffer operations
+ // in this scenario.
+ });
+ ON_CALL(*mockCodec, initiateAllocateComponent(_))
+ .WillByDefault([mockCodec](const sp<AMessage> &) {
+ mockCodec->callback()->onComponentAllocated(kCodecName.c_str());
+ });
+ ON_CALL(*mockCodec, initiateConfigureComponent(_))
+ .WillByDefault([mockCodec](const sp<AMessage> &msg) {
+ mockCodec->callback()->onComponentConfigured(
+ msg->dup(), msg->dup());
+ });
+ ON_CALL(*mockCodec, initiateStart())
+ .WillByDefault([mockCodec]() {
+ mockCodec->callback()->onStartCompleted();
+ });
+ ON_CALL(*mockCodec, initiateShutdown(true))
+ .WillByDefault([mockCodec, &errorOccurred](bool) {
+ mockCodec->callback()->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL);
+ // Mark that 1) and 2) are complete.
+ errorOccurred.set_value();
+ });
+ ON_CALL(*mockCodec, initiateShutdown(false))
+ .WillByDefault([mockCodec](bool) {
+ mockCodec->callback()->onReleaseCompleted();
+ });
+ return mockCodec;
+ };
+
+ sp<ALooper> looper{new ALooper};
+ sp<MediaCodec> codec = SetupMediaCodec(
+ kCodecOwner, kCodecName, kMediaType, looper, getCodecBase);
+ ASSERT_NE(nullptr, codec) << "Codec must not be null";
+ ASSERT_NE(nullptr, mockCodec) << "MockCodec must not be null";
+
+ std::thread([mockCodec, &errorOccurred]{
+ // Simulate component thread that handles stop()
+ errorOccurred.get_future().wait();
+ // Error occurred but shutdown request still got processed.
+ mockCodec->callback()->onStopCompleted();
+ }).detach();
+
+ codec->configure(new AMessage, nullptr, nullptr, 0);
+ codec->start();
+ codec->stop();
+ // Sleep here to give time for the MediaCodec looper thread
+ // to process the messages.
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ codec->release();
+ looper->stop();
+}
diff --git a/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp b/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp
index 3be5e74..dbdb43c 100644
--- a/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp
+++ b/media/libstagefright/xmlparser/MediaCodecsXmlParser.cpp
@@ -493,7 +493,7 @@
mPath(path),
mStatus(NO_INIT) {
// determine href_base
- std::string::size_type end = path.rfind("/");
+ std::string::size_type end = path.rfind('/');
if (end != std::string::npos) {
mHrefBase = path.substr(0, end + 1);
}
diff --git a/media/libstagefright/xmlparser/vts/Android.mk b/media/libstagefright/xmlparser/vts/Android.mk
deleted file mode 100644
index d5290ba..0000000
--- a/media/libstagefright/xmlparser/vts/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := VtsValidateMediaCodecs
-include test/vts/tools/build/Android.host_config.mk
diff --git a/media/libstagefright/xmlparser/vts/AndroidTest.xml b/media/libstagefright/xmlparser/vts/AndroidTest.xml
deleted file mode 100644
index 97ee107..0000000
--- a/media/libstagefright/xmlparser/vts/AndroidTest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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="Config for VTS VtsValidateMediaCodecs.">
- <option name="config-descriptor:metadata" key="plan" value="vts-treble" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
- <option name="abort-on-push-failure" value="false"/>
- <option name="push-group" value="HostDrivenTest.push"/>
- <option name="push" value="DATA/etc/media_codecs.xsd->/data/local/tmp/media_codecs.xsd"/>
- </target_preparer>
- <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
- <option name="test-module-name" value="VtsValidateMediaCodecs"/>
- <option name="binary-test-source" value="_32bit::DATA/nativetest/vts_mediaCodecs_validate_test/vts_mediaCodecs_validate_test" />
- <option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_mediaCodecs_validate_test/vts_mediaCodecs_validate_test" />
- <option name="binary-test-type" value="gtest"/>
- <option name="test-timeout" value="30s"/>
- </test>
-</configuration>
diff --git a/media/mediaserver/main_mediaserver.cpp b/media/mediaserver/main_mediaserver.cpp
index 316732b..58e2d2a 100644
--- a/media/mediaserver/main_mediaserver.cpp
+++ b/media/mediaserver/main_mediaserver.cpp
@@ -18,7 +18,6 @@
#define LOG_TAG "mediaserver"
//#define LOG_NDEBUG 0
-#include <aicu/AIcu.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
@@ -39,7 +38,6 @@
sp<ProcessState> proc(ProcessState::self());
sp<IServiceManager> sm(defaultServiceManager());
ALOGI("ServiceManager: %p", sm.get());
- AIcu_initializeIcuOrDie();
MediaPlayerService::instantiate();
ResourceManagerService::instantiate();
registerExtensions();
diff --git a/media/ndk/Android.bp b/media/ndk/Android.bp
index 37598f8..71e6fac 100644
--- a/media/ndk/Android.bp
+++ b/media/ndk/Android.bp
@@ -54,6 +54,7 @@
cc_library_shared {
name: "libmediandk",
+ llndk_stubs: "libmediandk.llndk",
srcs: [
"NdkJavaVMHelper.cpp",
@@ -134,7 +135,7 @@
}
llndk_library {
- name: "libmediandk",
+ name: "libmediandk.llndk",
symbol_file: "libmediandk.map.txt",
export_include_dirs: [
"include",
diff --git a/services/OWNERS b/services/OWNERS
index 66a4bcb..f0b5e2f 100644
--- a/services/OWNERS
+++ b/services/OWNERS
@@ -5,3 +5,5 @@
gkasten@google.com
hunga@google.com
marcone@google.com
+nchalko@google.com
+quxiangfang@google.com
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 1935cde..5f0b575 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3141,7 +3141,8 @@
// dumpToThreadLog_l() must be called with AudioFlinger::mLock held
void AudioFlinger::dumpToThreadLog_l(const sp<ThreadBase> &thread)
{
- audio_utils::FdToString fdToString;
+ constexpr int THREAD_DUMP_TIMEOUT_MS = 2;
+ audio_utils::FdToString fdToString("- ", THREAD_DUMP_TIMEOUT_MS);
const int fd = fdToString.fd();
if (fd >= 0) {
thread->dump(fd, {} /* args */);
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 384ddb5..b143388 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -7429,7 +7429,7 @@
(framesRead - part1) * mFrameSize);
}
}
- rear = mRsmpInRear += framesRead;
+ mRsmpInRear = audio_utils::safe_add_overflow(mRsmpInRear, (int32_t)framesRead);
size = activeTracks.size();
diff --git a/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
index dd1499c..016aaa5 100644
--- a/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h
@@ -65,6 +65,9 @@
bool supportsFormat(audio_format_t format);
+ void setDynamic() { mIsDynamic = true; }
+ bool isDynamic() const { return mIsDynamic; }
+
// PolicyAudioPortConfig
virtual sp<PolicyAudioPort> getPolicyAudioPort() const {
return static_cast<PolicyAudioPort*>(const_cast<DeviceDescriptor*>(this));
@@ -97,6 +100,8 @@
std::string mTagName; // Unique human readable identifier for a device port found in conf file.
FormatVector mEncodedFormats;
audio_format_t mCurrentEncodedFormat;
+ bool mIsDynamic = false;
+ const std::string mDeclaredAddress; // Original device address
};
class DeviceVector : public SortedVector<sp<DeviceDescriptor> >
@@ -248,7 +253,9 @@
return String8("");
}
- std::string toString() const;
+ // Return a string to describe the DeviceVector. The sensitive information will only be
+ // added to the string if `includeSensitiveInfo` is true.
+ std::string toString(bool includeSensitiveInfo = false) const;
void dump(String8 *dst, const String8 &tag, int spaces = 0, bool verbose = true) const;
diff --git a/services/audiopolicy/common/managerdefinitions/include/HwModule.h b/services/audiopolicy/common/managerdefinitions/include/HwModule.h
index 23f0c9a..b5b10f3 100644
--- a/services/audiopolicy/common/managerdefinitions/include/HwModule.h
+++ b/services/audiopolicy/common/managerdefinitions/include/HwModule.h
@@ -131,8 +131,17 @@
public:
sp<HwModule> getModuleFromName(const char *name) const;
+ /**
+ * @brief getModuleForDeviceType try to get a device from type / format on all modules
+ * @param device type to consider
+ * @param encodedFormat to consider
+ * @param[out] tagName if not null, if a matching device is found, will return the tagName
+ * of original device from XML file so that audio routes matchin rules work.
+ * @return valid module if considered device found, nullptr otherwise.
+ */
sp<HwModule> getModuleForDeviceType(audio_devices_t device,
- audio_format_t encodedFormat) const;
+ audio_format_t encodedFormat,
+ std::string *tagName = nullptr) const;
sp<HwModule> getModuleForDevice(const sp<DeviceDescriptor> &device,
audio_format_t encodedFormat) const;
diff --git a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
index 5f551d5..11d3a99 100644
--- a/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
+++ b/services/audiopolicy/common/managerdefinitions/include/IOProfile.h
@@ -112,6 +112,19 @@
}
/**
+ * @brief getTag
+ * @param deviceTypes to be considered
+ * @return tagName of first matching device for the considered types, empty string otherwise.
+ */
+ std::string getTag(const DeviceTypeSet& deviceTypes) const
+ {
+ if (supportsDeviceTypes(deviceTypes)) {
+ return mSupportedDevices.getDevicesFromTypes(deviceTypes).itemAt(0)->getTagName();
+ }
+ return {};
+ }
+
+ /**
* @brief supportsDevice
* @param device to be checked against
* forceCheckOnAddress if true, check on type and address whatever the type, otherwise
@@ -150,6 +163,12 @@
}
void removeSupportedDevice(const sp<DeviceDescriptor> &device)
{
+ ssize_t ret = mSupportedDevices.indexOf(device);
+ if (ret >= 0 && !mSupportedDevices.itemAt(ret)->isDynamic()) {
+ // devices equality checks only type, address, name and format
+ // Prevents from removing non dynamically added devices
+ return;
+ }
mSupportedDevices.remove(device);
}
void setSupportedDevices(const DeviceVector &devices)
diff --git a/services/audiopolicy/common/managerdefinitions/include/PolicyAudioPort.h b/services/audiopolicy/common/managerdefinitions/include/PolicyAudioPort.h
index d2f6297..e6eef24 100644
--- a/services/audiopolicy/common/managerdefinitions/include/PolicyAudioPort.h
+++ b/services/audiopolicy/common/managerdefinitions/include/PolicyAudioPort.h
@@ -42,6 +42,11 @@
virtual const std::string getTagName() const = 0;
+ bool equals(const sp<PolicyAudioPort> &right) const
+ {
+ return getTagName() == right->getTagName();
+ }
+
virtual sp<AudioPort> asAudioPort() const = 0;
virtual void setFlags(uint32_t flags)
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
index b963121..4922ebe 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioInputDescriptor.cpp
@@ -516,7 +516,7 @@
dst->appendFormat(" Sampling rate: %d\n", mSamplingRate);
dst->appendFormat(" Format: %d\n", mFormat);
dst->appendFormat(" Channels: %08x\n", mChannelMask);
- dst->appendFormat(" Devices %s\n", mDevice->toString().c_str());
+ dst->appendFormat(" Devices %s\n", mDevice->toString(true /*includeSensitiveInfo*/).c_str());
mEnabledEffects.dump(dst, 1 /*spaces*/, false /*verbose*/);
dst->append(" AudioRecord Clients:\n");
ClientMapHandler<RecordClientDescriptor>::dump(dst);
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
index d6d472b..a2e2eec 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
@@ -245,7 +245,7 @@
dst->appendFormat(" Sampling rate: %d\n", mSamplingRate);
dst->appendFormat(" Format: %08x\n", mFormat);
dst->appendFormat(" Channels: %08x\n", mChannelMask);
- dst->appendFormat(" Devices: %s\n", devices().toString().c_str());
+ dst->appendFormat(" Devices: %s\n", devices().toString(true /*includeSensitiveInfo*/).c_str());
dst->appendFormat(" Global active count: %u\n", mGlobalActiveCount);
for (const auto &iter : mRoutingActivities) {
dst->appendFormat(" Product Strategy id: %d", iter.first);
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioRoute.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioRoute.cpp
index 2a18f19..c8e4e76 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioRoute.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioRoute.cpp
@@ -39,12 +39,12 @@
bool AudioRoute::supportsPatch(const sp<PolicyAudioPort> &srcPort,
const sp<PolicyAudioPort> &dstPort) const
{
- if (mSink == 0 || dstPort == 0 || dstPort != mSink) {
+ if (mSink == 0 || dstPort == 0 || !dstPort->equals(mSink)) {
return false;
}
ALOGV("%s: sinks %s matching", __FUNCTION__, mSink->getTagName().c_str());
for (const auto &sourcePort : mSources) {
- if (sourcePort == srcPort) {
+ if (sourcePort->equals(srcPort)) {
ALOGV("%s: sources %s matching", __FUNCTION__, sourcePort->getTagName().c_str());
return true;
}
diff --git a/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
index a29e60e..5120aeb 100644
--- a/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp
@@ -52,7 +52,8 @@
DeviceDescriptor::DeviceDescriptor(const AudioDeviceTypeAddr &deviceTypeAddr,
const std::string &tagName,
const FormatVector &encodedFormats) :
- DeviceDescriptorBase(deviceTypeAddr), mTagName(tagName), mEncodedFormats(encodedFormats)
+ DeviceDescriptorBase(deviceTypeAddr), mTagName(tagName), mEncodedFormats(encodedFormats),
+ mDeclaredAddress(deviceTypeAddr.getAddress())
{
mCurrentEncodedFormat = AUDIO_FORMAT_DEFAULT;
/* If framework runs against a pre 5.0 Audio HAL, encoded formats are absent from the config.
@@ -75,6 +76,10 @@
void DeviceDescriptor::detach() {
mId = AUDIO_PORT_HANDLE_NONE;
PolicyAudioPort::detach();
+ // The device address may have been overwritten on device connection
+ setAddress(mDeclaredAddress);
+ // Device Port does not have a name unless provided by setDeviceConnectionState
+ setName("");
}
template<typename T>
@@ -408,7 +413,7 @@
}
}
-std::string DeviceVector::toString() const
+std::string DeviceVector::toString(bool includeSensitiveInfo) const
{
if (isEmpty()) {
return {"AUDIO_DEVICE_NONE"};
@@ -418,7 +423,7 @@
if (device != *begin()) {
result += ";";
}
- result += device->toString();
+ result += device->toString(includeSensitiveInfo);
}
return result + "}";
}
diff --git a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
index d31e443..2967014 100644
--- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
@@ -271,8 +271,9 @@
return nullptr;
}
-sp <HwModule> HwModuleCollection::getModuleForDeviceType(audio_devices_t type,
- audio_format_t encodedFormat) const
+sp<HwModule> HwModuleCollection::getModuleForDeviceType(audio_devices_t type,
+ audio_format_t encodedFormat,
+ std::string *tagName) const
{
for (const auto& module : *this) {
const auto& profiles = audio_is_output_device(type) ?
@@ -284,9 +285,15 @@
sp <DeviceDescriptor> deviceDesc =
declaredDevices.getDevice(type, String8(), encodedFormat);
if (deviceDesc) {
+ if (tagName != nullptr) {
+ *tagName = deviceDesc->getTagName();
+ }
return module;
}
} else {
+ if (tagName != nullptr) {
+ *tagName = profile->getTag({type});
+ }
return module;
}
}
@@ -325,15 +332,32 @@
}
for (const auto& hwModule : *this) {
+ if (!allowToCreate) {
+ auto dynamicDevices = hwModule->getDynamicDevices();
+ auto dynamicDevice = dynamicDevices.getDevice(deviceType, devAddress, encodedFormat);
+ if (dynamicDevice) {
+ return dynamicDevice;
+ }
+ }
DeviceVector moduleDevices = hwModule->getAllDevices();
auto moduleDevice = moduleDevices.getDevice(deviceType, devAddress, encodedFormat);
+
+ // Prevent overwritting moduleDevice address if connected device does not have the same
+ // address (since getDevice with empty address ignores match on address), use dynamic device
+ if (moduleDevice && allowToCreate &&
+ (!moduleDevice->address().empty() &&
+ (moduleDevice->address().compare(devAddress.c_str()) != 0))) {
+ break;
+ }
if (moduleDevice) {
if (encodedFormat != AUDIO_FORMAT_DEFAULT) {
moduleDevice->setEncodedFormat(encodedFormat);
}
if (allowToCreate) {
moduleDevice->attach(hwModule);
+ // Name may be overwritten, restored on detach.
moduleDevice->setAddress(devAddress.string());
+ // Name may be overwritten, restored on detach.
moduleDevice->setName(name);
}
return moduleDevice;
@@ -352,18 +376,19 @@
const char *name,
const audio_format_t encodedFormat) const
{
- sp<HwModule> hwModule = getModuleForDeviceType(type, encodedFormat);
+ std::string tagName = {};
+ sp<HwModule> hwModule = getModuleForDeviceType(type, encodedFormat, &tagName);
if (hwModule == 0) {
ALOGE("%s: could not find HW module for device %04x address %s", __FUNCTION__, type,
address);
return nullptr;
}
- sp<DeviceDescriptor> device = new DeviceDescriptor(type, name, address);
+ sp<DeviceDescriptor> device = new DeviceDescriptor(type, tagName, address);
device->setName(name);
device->setEncodedFormat(encodedFormat);
-
- // Add the device to the list of dynamic devices
+ device->setDynamic();
+ // Add the device to the list of dynamic devices
hwModule->addDynamicDevice(device);
// Reciprocally attach the device to the module
device->attach(hwModule);
@@ -375,7 +400,7 @@
for (const auto &profile : profiles) {
// Add the device as supported to all profile supporting "weakly" or not the device
// according to its type
- if (profile->supportsDevice(device, false /*matchAdress*/)) {
+ if (profile->supportsDevice(device, false /*matchAddress*/)) {
// @todo quid of audio profile? import the profile from device of the same type?
const auto &isoTypeDeviceForProfile =
@@ -406,10 +431,9 @@
device->detach();
// Only remove from dynamic list, not from declared list!!!
- if (!hwModule->getDynamicDevices().contains(device)) {
+ if (!hwModule->removeDynamicDevice(device)) {
return;
}
- hwModule->removeDynamicDevice(device);
ALOGV("%s: removed dynamic device %s from module %s", __FUNCTION__,
device->toString().c_str(), hwModule->getName());
diff --git a/services/audiopolicy/config/a2dp_audio_policy_configuration_7_0.xml b/services/audiopolicy/config/a2dp_audio_policy_configuration_7_0.xml
new file mode 100644
index 0000000..2d323f6
--- /dev/null
+++ b/services/audiopolicy/config/a2dp_audio_policy_configuration_7_0.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- A2dp Audio HAL Audio Policy Configuration file -->
+<module name="a2dp" halVersion="2.0">
+ <mixPorts>
+ <mixPort name="a2dp output" role="source"/>
+ <mixPort name="a2dp input" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
+ </mixPort>
+ </mixPorts>
+ <devicePorts>
+ <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT A2DP In" type="AUDIO_DEVICE_IN_BLUETOOTH_A2DP" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
+ </devicePort>
+ </devicePorts>
+ <routes>
+ <route type="mix" sink="BT A2DP Out"
+ sources="a2dp output"/>
+ <route type="mix" sink="BT A2DP Headphones"
+ sources="a2dp output"/>
+ <route type="mix" sink="BT A2DP Speaker"
+ sources="a2dp output"/>
+ <route type="mix" sink="a2dp input"
+ sources="BT A2DP In"/>
+ </routes>
+</module>
diff --git a/services/audiopolicy/config/a2dp_in_audio_policy_configuration_7_0.xml b/services/audiopolicy/config/a2dp_in_audio_policy_configuration_7_0.xml
new file mode 100644
index 0000000..d59ad70
--- /dev/null
+++ b/services/audiopolicy/config/a2dp_in_audio_policy_configuration_7_0.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Bluetooth Input Audio HAL Audio Policy Configuration file -->
+<module name="a2dp" halVersion="2.0">
+ <mixPorts>
+ <mixPort name="a2dp input" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
+ </mixPort>
+ </mixPorts>
+ <devicePorts>
+ <devicePort tagName="BT A2DP In" type="AUDIO_DEVICE_IN_BLUETOOTH_A2DP" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO"/>
+ </devicePort>
+ </devicePorts>
+ <routes>
+ <route type="mix" sink="a2dp input"
+ sources="BT A2DP In"/>
+ </routes>
+</module>
diff --git a/services/audiopolicy/config/audio_policy_configuration_7_0.xml b/services/audiopolicy/config/audio_policy_configuration_7_0.xml
new file mode 100644
index 0000000..6087bf2
--- /dev/null
+++ b/services/audiopolicy/config/audio_policy_configuration_7_0.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- 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.
+-->
+
+<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->
+
+ <!-- Global configuration Decalaration -->
+ <globalConfiguration speaker_drc_enabled="true"/>
+
+
+ <!-- Modules section:
+ There is one section per audio HW module present on the platform.
+ Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.
+ The module names are the same as in current .conf file:
+ “primary”, “A2DP”, “remote_submix”, “USB”
+ Each module will contain the following sections:
+ “devicePorts”: a list of device descriptors for all input and output devices accessible via this
+ module.
+ This contains both permanently attached devices and removable devices.
+ “mixPorts”: listing all output and input streams exposed by the audio HAL
+ “routes”: list of possible connections between input and output devices or between stream and
+ devices.
+ "route": is defined by an attribute:
+ -"type": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)
+ -"sink": the sink involved in this route
+ -"sources": all the sources than can be connected to the sink via vis route
+ “attachedDevices”: permanently attached devices.
+ The attachedDevices section is a list of devices names. The names correspond to device names
+ defined in <devicePorts> section.
+ “defaultOutputDevice”: device to be used by default when no policy rule applies
+ -->
+ <modules>
+ <!-- Primary Audio HAL -->
+ <module name="primary" halVersion="3.0">
+ <attachedDevices>
+ <item>Speaker</item>
+ <item>Built-In Mic</item>
+ <item>Built-In Back Mic</item>
+ </attachedDevices>
+ <defaultOutputDevice>Speaker</defaultOutputDevice>
+ <mixPorts>
+ <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ <mixPort name="deep_buffer" role="source"
+ flags="AUDIO_OUTPUT_FLAG_DEEP_BUFFER">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ <mixPort name="compressed_offload" role="source"
+ flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
+ <profile name="" format="AUDIO_FORMAT_MP3"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO"/>
+ <profile name="" format="AUDIO_FORMAT_AAC"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO"/>
+ <profile name="" format="AUDIO_FORMAT_AAC_LC"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_MONO"/>
+ </mixPort>
+ <mixPort name="voice_tx" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
+ </mixPort>
+ <mixPort name="primary input" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
+ </mixPort>
+ <mixPort name="voice_rx" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ </mixPort>
+ </mixPorts>
+ <devicePorts>
+ <!-- Output devices declaration, i.e. Sink DEVICE PORT -->
+ <devicePort tagName="Earpiece" type="AUDIO_DEVICE_OUT_EARPIECE" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ </devicePort>
+ <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address="">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ <gains>
+ <gain name="gain_1" mode="AUDIO_GAIN_MODE_JOINT"
+ minValueMB="-8400"
+ maxValueMB="4000"
+ defaultValueMB="0"
+ stepValueMB="100"/>
+ </gains>
+ </devicePort>
+ <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
+ </devicePort>
+ <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
+ </devicePort>
+ <devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
+ </devicePort>
+ <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
+ </devicePort>
+
+ <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
+ </devicePort>
+ <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
+ </devicePort>
+ <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
+ </devicePort>
+ <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ </devicePort>
+ <devicePort tagName="Telephony Rx" type="AUDIO_DEVICE_IN_TELEPHONY_RX" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ </devicePort>
+ </devicePorts>
+ <!-- route declaration, i.e. list all available sources for a given sink -->
+ <routes>
+ <route type="mix" sink="Earpiece"
+ sources="primary output,deep_buffer,BT SCO Headset Mic"/>
+ <route type="mix" sink="Speaker"
+ sources="primary output,deep_buffer,compressed_offload,BT SCO Headset Mic,Telephony Rx"/>
+ <route type="mix" sink="Wired Headset"
+ sources="primary output,deep_buffer,compressed_offload,BT SCO Headset Mic,Telephony Rx"/>
+ <route type="mix" sink="Wired Headphones"
+ sources="primary output,deep_buffer,compressed_offload,BT SCO Headset Mic,Telephony Rx"/>
+ <route type="mix" sink="primary input"
+ sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic"/>
+ <route type="mix" sink="Telephony Tx"
+ sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic, voice_tx"/>
+ <route type="mix" sink="voice_rx"
+ sources="Telephony Rx"/>
+ </routes>
+
+ </module>
+
+ <!-- A2dp Input Audio HAL -->
+ <xi:include href="a2dp_in_audio_policy_configuration_7_0.xml"/>
+
+ <!-- Usb Audio HAL -->
+ <xi:include href="usb_audio_policy_configuration.xml"/>
+
+ <!-- Remote Submix Audio HAL -->
+ <xi:include href="r_submix_audio_policy_configuration.xml"/>
+
+ <!-- Bluetooth Audio HAL -->
+ <xi:include href="bluetooth_audio_policy_configuration_7_0.xml"/>
+
+ <!-- MSD Audio HAL (optional) -->
+ <xi:include href="msd_audio_policy_configuration_7_0.xml"/>
+
+ </modules>
+ <!-- End of Modules section -->
+
+ <!-- Volume section:
+ IMPORTANT NOTE: Volume tables have been moved to engine configuration.
+ Keep it here for legacy.
+ Engine will fallback on these files if none are provided by engine.
+ -->
+
+ <xi:include href="audio_policy_volumes.xml"/>
+ <xi:include href="default_volume_tables.xml"/>
+
+ <!-- End of Volume section -->
+
+ <!-- Surround Sound configuration -->
+
+ <xi:include href="surround_sound_configuration_5_0.xml"/>
+
+ <!-- End of Surround Sound configuration -->
+
+</audioPolicyConfiguration>
diff --git a/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml b/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml
new file mode 100644
index 0000000..2dffe02
--- /dev/null
+++ b/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Bluetooth Audio HAL Audio Policy Configuration file -->
+<module name="bluetooth" halVersion="2.0">
+ <mixPorts>
+ <!-- A2DP Audio Ports -->
+ <mixPort name="a2dp output" role="source"/>
+ <!-- Hearing AIDs Audio Ports -->
+ <mixPort name="hearing aid output" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="24000 16000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ </mixPorts>
+ <devicePorts>
+ <!-- A2DP Audio Ports -->
+ <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100 48000 88200 96000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100 48000 88200 96000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100 48000 88200 96000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </devicePort>
+ <!-- Hearing AIDs Audio Ports -->
+ <devicePort tagName="BT Hearing Aid Out" type="AUDIO_DEVICE_OUT_HEARING_AID" role="sink"/>
+ </devicePorts>
+ <routes>
+ <route type="mix" sink="BT A2DP Out"
+ sources="a2dp output"/>
+ <route type="mix" sink="BT A2DP Headphones"
+ sources="a2dp output"/>
+ <route type="mix" sink="BT A2DP Speaker"
+ sources="a2dp output"/>
+ <route type="mix" sink="BT Hearing Aid Out"
+ sources="hearing aid output"/>
+ </routes>
+</module>
diff --git a/services/audiopolicy/config/hearing_aid_audio_policy_configuration_7_0.xml b/services/audiopolicy/config/hearing_aid_audio_policy_configuration_7_0.xml
new file mode 100644
index 0000000..8c364e4
--- /dev/null
+++ b/services/audiopolicy/config/hearing_aid_audio_policy_configuration_7_0.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Hearing aid Audio HAL Audio Policy Configuration file -->
+<module name="hearing_aid" halVersion="2.0">
+ <mixPorts>
+ <mixPort name="hearing aid output" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="24000 16000"
+ channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ </mixPorts>
+ <devicePorts>
+ <devicePort tagName="BT Hearing Aid Out" type="AUDIO_DEVICE_OUT_HEARING_AID" role="sink"/>
+ </devicePorts>
+ <routes>
+ <route type="mix" sink="BT Hearing Aid Out" sources="hearing aid output"/>
+ </routes>
+</module>
diff --git a/services/audiopolicy/config/msd_audio_policy_configuration_7_0.xml b/services/audiopolicy/config/msd_audio_policy_configuration_7_0.xml
new file mode 100644
index 0000000..ae0ba80
--- /dev/null
+++ b/services/audiopolicy/config/msd_audio_policy_configuration_7_0.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2017-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.
+-->
+<!-- Multi Stream Decoder Audio Policy Configuration file -->
+<module name="msd" halVersion="2.0">
+ <attachedDevices>
+ <item>MS12 Input</item>
+ <item>MS12 Output</item>
+ </attachedDevices>
+ <mixPorts>
+ <mixPort name="ms12 input" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ <mixPort name="ms12 compressed input" role="source"
+ flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
+ <profile name="" format="AUDIO_FORMAT_AC3"
+ samplingRates="32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_5POINT1"/>
+ <profile name="" format="AUDIO_FORMAT_E_AC3"
+ samplingRates="32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_7POINT1"/>
+ <profile name="" format="AUDIO_FORMAT_E_AC3_JOC"
+ samplingRates="32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_7POINT1"/>
+ <profile name="" format="AUDIO_FORMAT_AC4"
+ samplingRates="32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_7POINT1"/>
+ </mixPort>
+ <!-- The HW AV Sync flag is not required, but is recommended -->
+ <mixPort name="ms12 output" role="sink" flags="AUDIO_INPUT_FLAG_HW_AV_SYNC|AUDIO_INPUT_FLAG_DIRECT">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
+ <profile name="" format="AUDIO_FORMAT_AC3"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_5POINT1"/>
+ <profile name="" format="AUDIO_FORMAT_E_AC3"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_5POINT1"/>
+ </mixPort>
+ </mixPorts>
+ <devicePorts>
+ <devicePort tagName="MS12 Input" type="AUDIO_DEVICE_OUT_BUS" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ <profile name="" format="AUDIO_FORMAT_AC3"
+ samplingRates="32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_5POINT1"/>
+ <profile name="" format="AUDIO_FORMAT_E_AC3"
+ samplingRates="32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_7POINT1"/>
+ <profile name="" format="AUDIO_FORMAT_E_AC3_JOC"
+ samplingRates="32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_7POINT1"/>
+ <profile name="" format="AUDIO_FORMAT_AC4"
+ samplingRates="32000 44100 48000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO AUDIO_CHANNEL_OUT_STEREO AUDIO_CHANNEL_OUT_5POINT1 AUDIO_CHANNEL_OUT_7POINT1"/>
+ </devicePort>
+ <devicePort tagName="MS12 Output" type="AUDIO_DEVICE_IN_BUS" role="source">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
+ </devicePort>
+ </devicePorts>
+ <routes>
+ <route type="mix" sink="MS12 Input" sources="ms12 input,ms12 compressed input"/>
+ <route type="mix" sink="ms12 output" sources="MS12 Output"/>
+ </routes>
+</module>
diff --git a/services/audiopolicy/config/primary_audio_policy_configuration_7_0.xml b/services/audiopolicy/config/primary_audio_policy_configuration_7_0.xml
new file mode 100644
index 0000000..68a56b2
--- /dev/null
+++ b/services/audiopolicy/config/primary_audio_policy_configuration_7_0.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Default Primary Audio HAL Module Audio Policy Configuration include file -->
+<module name="primary" halVersion="2.0">
+ <attachedDevices>
+ <item>Speaker</item>
+ <item>Built-In Mic</item>
+ </attachedDevices>
+ <defaultOutputDevice>Speaker</defaultOutputDevice>
+ <mixPorts>
+ <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="44100" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+ </mixPort>
+ <mixPort name="primary input" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+ samplingRates="8000 16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+ </mixPort>
+ </mixPorts>
+ <devicePorts>
+ <devicePort tagName="Speaker" type="AUDIO_DEVICE_OUT_SPEAKER" role="sink">
+ </devicePort>
+
+ <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
+ </devicePort>
+ </devicePorts>
+ <routes>
+ <route type="mix" sink="Speaker"
+ sources="primary output"/>
+ <route type="mix" sink="primary input"
+ sources="Built-In Mic"/>
+ </routes>
+</module>
diff --git a/services/audiopolicy/engine/common/src/EngineDefaultConfig.h b/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
index 981582e..1821140 100644
--- a/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
+++ b/services/audiopolicy/engine/common/src/EngineDefaultConfig.h
@@ -136,7 +136,7 @@
{"rerouting",
{
{"", AUDIO_STREAM_REROUTING, "AUDIO_STREAM_REROUTING",
- {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT, 0, ""}}
+ {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_VIRTUAL_SOURCE, AUDIO_SOURCE_DEFAULT, 0, ""}}
}
},
},
diff --git a/services/camera/libcameraservice/fuzzer/Android.bp b/services/camera/libcameraservice/fuzzer/Android.bp
new file mode 100644
index 0000000..c5b7f00
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/Android.bp
@@ -0,0 +1,44 @@
+// 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_defaults {
+ name: "libcameraservice_fuzz_defaults",
+ fuzz_config: {
+ componentid: 41727
+ },
+}
+
+cc_fuzz {
+ name: "libcameraservice_distortion_mapper_fuzzer",
+ defaults: ["libcameraservice_fuzz_defaults"],
+ srcs: [
+ "DistortionMapperFuzzer.cpp",
+ ],
+ shared_libs: [
+ "libcameraservice",
+ "libcamera_client",
+ ],
+}
+
+cc_fuzz {
+ name: "libcameraservice_depth_processor_fuzzer",
+ defaults: ["libcameraservice_fuzz_defaults"],
+ srcs: [
+ "DepthProcessorFuzzer.cpp",
+ ],
+ shared_libs: [
+ "libcameraservice",
+ ],
+ corpus: ["corpus/*.jpg"],
+}
diff --git a/services/camera/libcameraservice/fuzzer/DepthProcessorFuzzer.cpp b/services/camera/libcameraservice/fuzzer/DepthProcessorFuzzer.cpp
new file mode 100644
index 0000000..650ca91
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/DepthProcessorFuzzer.cpp
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+#include <array>
+#include <vector>
+
+#include <fuzzer/FuzzedDataProvider.h>
+
+#include "common/DepthPhotoProcessor.h"
+
+using namespace android;
+using namespace android::camera3;
+
+static const size_t kTestBufferWidth = 640;
+static const size_t kTestBufferHeight = 480;
+static const size_t kTestBufferDepthSize (kTestBufferWidth * kTestBufferHeight);
+
+void generateDepth16Buffer(const uint8_t* data, size_t size, std::array<uint16_t, kTestBufferDepthSize> *depth16Buffer /*out*/) {
+ FuzzedDataProvider dataProvider(data, size);
+ for (size_t i = 0; i < depth16Buffer->size(); i++) {
+ (*depth16Buffer)[i] = dataProvider.ConsumeIntegral<uint16_t>();
+ }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ DepthPhotoInputFrame inputFrame;
+ // Worst case both depth and confidence maps have the same size as the main color image.
+ inputFrame.mMaxJpegSize = inputFrame.mMainJpegSize * 3;
+
+ std::vector<uint8_t> depthPhotoBuffer(inputFrame.mMaxJpegSize);
+ size_t actualDepthPhotoSize = 0;
+
+ std::array<uint16_t, kTestBufferDepthSize> depth16Buffer;
+ generateDepth16Buffer(data, size, &depth16Buffer);
+
+ inputFrame.mMainJpegBuffer = reinterpret_cast<const char*> (data);
+ inputFrame.mMainJpegSize = size;
+ inputFrame.mDepthMapBuffer = depth16Buffer.data();
+ inputFrame.mDepthMapStride = kTestBufferWidth;
+ inputFrame.mDepthMapWidth = kTestBufferWidth;
+ inputFrame.mDepthMapHeight = kTestBufferHeight;
+ processDepthPhotoFrame(
+ inputFrame,
+ depthPhotoBuffer.size(),
+ depthPhotoBuffer.data(),
+ &actualDepthPhotoSize);
+
+ return 0;
+}
diff --git a/services/camera/libcameraservice/fuzzer/DistortionMapperFuzzer.cpp b/services/camera/libcameraservice/fuzzer/DistortionMapperFuzzer.cpp
new file mode 100644
index 0000000..96bab4e
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/DistortionMapperFuzzer.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+#include <vector>
+
+#include <fuzzer/FuzzedDataProvider.h>
+
+#include "device3/DistortionMapper.h"
+#include <camera/CameraMetadata.h>
+
+using namespace android;
+using namespace android::camera3;
+
+int32_t testActiveArray[] = {100, 100, 1000, 750};
+float testICal[] = { 1000.f, 1000.f, 500.f, 500.f, 0.f };
+float identityDistortion[] = { 0.f, 0.f, 0.f, 0.f, 0.f};
+
+void setupTestMapper(DistortionMapper *m,
+ float distortion[5], float intrinsics[5],
+ int32_t activeArray[4], int32_t preCorrectionActiveArray[4]) {
+ CameraMetadata deviceInfo;
+
+ deviceInfo.update(ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE,
+ preCorrectionActiveArray, 4);
+
+ deviceInfo.update(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
+ activeArray, 4);
+
+ deviceInfo.update(ANDROID_LENS_INTRINSIC_CALIBRATION,
+ intrinsics, 5);
+
+ deviceInfo.update(ANDROID_LENS_DISTORTION,
+ distortion, 5);
+
+ m->setupStaticInfo(deviceInfo);
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ FuzzedDataProvider fdp(data, size);
+
+ DistortionMapper m;
+ setupTestMapper(&m, identityDistortion, testICal,
+ /*activeArray*/ testActiveArray,
+ /*preCorrectionActiveArray*/ testActiveArray);
+
+ bool clamp = fdp.ConsumeBool();
+ bool simple = fdp.ConsumeBool();
+ std::vector<int32_t> input;
+ for (int index = 0; fdp.remaining_bytes() > 0; index++) {
+ input.push_back(fdp.ConsumeIntegral<int32_t>());
+ }
+
+ // The size argument counts how many coordinate pairs there are, so
+ // it is expected to be 1/2 the size of the input.
+ m.mapCorrectedToRaw(input.data(), input.size()/2, clamp, simple);
+
+ return 0;
+}
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Canon_MakerNote_variant_type_1.jpg b/services/camera/libcameraservice/fuzzer/corpus/Canon_MakerNote_variant_type_1.jpg
new file mode 100644
index 0000000..1eb37d0
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Canon_MakerNote_variant_type_1.jpg
Binary files differ
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Fuji_MakerNote_variant_type_1.jpg b/services/camera/libcameraservice/fuzzer/corpus/Fuji_MakerNote_variant_type_1.jpg
new file mode 100644
index 0000000..75e0371
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Fuji_MakerNote_variant_type_1.jpg
Binary files differ
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_2.jpg b/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_2.jpg
new file mode 100644
index 0000000..461d613
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_2.jpg
Binary files differ
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_3.jpg b/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_3.jpg
new file mode 100644
index 0000000..42498e2
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_3.jpg
Binary files differ
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_4.jpg b/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_4.jpg
new file mode 100644
index 0000000..233ff78
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_4.jpg
Binary files differ
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_5.jpg b/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_5.jpg
new file mode 100644
index 0000000..f083f75
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Olympus_MakerNote_variant_type_5.jpg
Binary files differ
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_2.jpg b/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_2.jpg
new file mode 100644
index 0000000..0ef0ef2
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_2.jpg
Binary files differ
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_3.jpg b/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_3.jpg
new file mode 100644
index 0000000..d93b86f
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_3.jpg
Binary files differ
diff --git a/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_4.jpg b/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_4.jpg
new file mode 100644
index 0000000..297ea1c
--- /dev/null
+++ b/services/camera/libcameraservice/fuzzer/corpus/Pentax_MakerNote_variant_type_4.jpg
Binary files differ
diff --git a/services/medialog/Android.bp b/services/medialog/Android.bp
index 74b63d5..3a27a43 100644
--- a/services/medialog/Android.bp
+++ b/services/medialog/Android.bp
@@ -1,4 +1,4 @@
-cc_library_shared {
+cc_library {
name: "libmedialogservice",
srcs: [
diff --git a/services/medialog/fuzzer/Android.bp b/services/medialog/fuzzer/Android.bp
new file mode 100644
index 0000000..2afaaae
--- /dev/null
+++ b/services/medialog/fuzzer/Android.bp
@@ -0,0 +1,33 @@
+cc_fuzz {
+ name: "media_log_fuzzer",
+ static_libs: [
+ "libmedialogservice",
+ ],
+ srcs: [
+ "media_log_fuzzer.cpp",
+ ],
+ header_libs: [
+ "libmedia_headers",
+ ],
+ shared_libs: [
+ "libaudioutils",
+ "libbinder",
+ "liblog",
+ "libmediautils",
+ "libnblog",
+ "libutils",
+ ],
+ include_dirs: [
+ "frameworks/av/services/medialog",
+ ],
+ cflags: [
+ "-Werror",
+ "-Wall",
+ ],
+ fuzz_config: {
+ cc: [
+ "android-media-fuzzing-reports@google.com",
+ ],
+ componentid: 155276,
+ },
+}
diff --git a/services/medialog/fuzzer/README.md b/services/medialog/fuzzer/README.md
new file mode 100644
index 0000000..b79e5c8
--- /dev/null
+++ b/services/medialog/fuzzer/README.md
@@ -0,0 +1,50 @@
+# Fuzzer for libmedialogservice
+
+## Plugin Design Considerations
+The fuzzer plugin for libmedialogservice is designed based on the understanding of the
+service and tries to achieve the following:
+
+##### Maximize code coverage
+The configuration parameters are not hardcoded, but instead selected based on
+incoming data. This ensures more code paths are reached by the fuzzer.
+
+medialogservice supports the following parameters:
+1. Writer name (parameter name: `writerNameIdx`)
+2. Log size (parameter name: `logSize`)
+3. Enable dump before unrgister API (parameter name: `shouldDumpBeforeUnregister`)
+5. size of string for log dump (parameter name: `numberOfLines`)
+
+| Parameter| Valid Values| Configured Value|
+|------------- |-------------| ----- |
+| `writerNameIdx` | 0. `0` 1. `1` | Value obtained from FuzzedDataProvider |
+| `logSize` | In the range `256 to 65536` | Value obtained from FuzzedDataProvider |
+| `shouldDumpBeforeUnregister` | 0. `0` 1. `1` | Value obtained from FuzzedDataProvider |
+| `numberOfLines` | In the range `0 to 65535` | Value obtained from FuzzedDataProvider |
+
+This also ensures that the plugin is always deterministic for any given input.
+
+## Build
+
+This describes steps to build media_log_fuzzer binary.
+
+### Android
+
+#### Steps to build
+Build the fuzzer
+```
+ $ mm -j$(nproc) media_log_fuzzer
+```
+
+#### Steps to run
+Create a directory CORPUS_DIR and copy some files to that folder
+Push this directory to device.
+
+To run on device
+```
+ $ adb sync data
+ $ adb shell /data/fuzz/arm64/media_log_fuzzer/media_log_fuzzer CORPUS_DIR
+```
+
+## References:
+ * http://llvm.org/docs/LibFuzzer.html
+ * https://github.com/google/oss-fuzz
diff --git a/services/medialog/fuzzer/media_log_fuzzer.cpp b/services/medialog/fuzzer/media_log_fuzzer.cpp
new file mode 100644
index 0000000..bd50d0f
--- /dev/null
+++ b/services/medialog/fuzzer/media_log_fuzzer.cpp
@@ -0,0 +1,76 @@
+/**
+ * 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.
+ */
+#include <binder/IMemory.h>
+#include <binder/MemoryDealer.h>
+#include <private/android_filesystem_config.h>
+#include "MediaLogService.h"
+#include "fuzzer/FuzzedDataProvider.h"
+
+constexpr const char* kWriterNames[2] = {"FastMixer", "FastCapture"};
+constexpr size_t kMinSize = 0x100;
+constexpr size_t kMaxSize = 0x10000;
+constexpr size_t kLogMemorySize = 400 * 1024;
+constexpr size_t kMaxNumLines = USHRT_MAX;
+
+using namespace android;
+
+class MediaLogFuzzer {
+ public:
+ void init();
+ void process(const uint8_t* data, size_t size);
+
+ private:
+ sp<MemoryDealer> mMemoryDealer = nullptr;
+ sp<MediaLogService> mService = nullptr;
+};
+
+void MediaLogFuzzer::init() {
+ setuid(AID_MEDIA);
+ mService = new MediaLogService();
+ mMemoryDealer = new MemoryDealer(kLogMemorySize, "MediaLogFuzzer", MemoryHeapBase::READ_ONLY);
+}
+
+void MediaLogFuzzer::process(const uint8_t* data, size_t size) {
+ FuzzedDataProvider fuzzedDataProvider(data, size);
+ size_t writerNameIdx =
+ fuzzedDataProvider.ConsumeIntegralInRange<size_t>(0, std::size(kWriterNames) - 1);
+ bool shouldDumpBeforeUnregister = fuzzedDataProvider.ConsumeBool();
+ size_t logSize = fuzzedDataProvider.ConsumeIntegralInRange<size_t>(kMinSize, kMaxSize);
+ sp<IMemory> logBuffer = mMemoryDealer->allocate(NBLog::Timeline::sharedSize(logSize));
+ Vector<String16> args;
+ size_t numberOfLines = fuzzedDataProvider.ConsumeIntegralInRange<size_t>(0, kMaxNumLines);
+ for (size_t lineIdx = 0; lineIdx < numberOfLines; ++lineIdx) {
+ args.add(static_cast<String16>(fuzzedDataProvider.ConsumeRandomLengthString().c_str()));
+ }
+ const char* fileName = "logDumpFile";
+ int fd = memfd_create(fileName, MFD_ALLOW_SEALING);
+ fuzzedDataProvider.ConsumeData(logBuffer->unsecurePointer(), logBuffer->size());
+ mService->registerWriter(logBuffer, logSize, kWriterNames[writerNameIdx]);
+ if (shouldDumpBeforeUnregister) {
+ mService->dump(fd, args);
+ mService->unregisterWriter(logBuffer);
+ } else {
+ mService->unregisterWriter(logBuffer);
+ mService->dump(fd, args);
+ }
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ MediaLogFuzzer mediaLogFuzzer = MediaLogFuzzer();
+ mediaLogFuzzer.init();
+ mediaLogFuzzer.process(data, size);
+ return 0;
+}
diff --git a/services/mediametrics/Android.bp b/services/mediametrics/Android.bp
index f033d5c..67e6c39 100644
--- a/services/mediametrics/Android.bp
+++ b/services/mediametrics/Android.bp
@@ -111,7 +111,7 @@
],
}
-cc_library_shared {
+cc_library {
name: "libmediametricsservice",
defaults: [
"mediametrics_flags_defaults",
diff --git a/services/mediametrics/AudioPowerUsage.cpp b/services/mediametrics/AudioPowerUsage.cpp
index cca6b41..33dfa8fa 100644
--- a/services/mediametrics/AudioPowerUsage.cpp
+++ b/services/mediametrics/AudioPowerUsage.cpp
@@ -200,6 +200,34 @@
return true;
}
+bool AudioPowerUsage::saveAsItems_l(
+ int32_t device, int64_t duration_ns, int32_t type, double average_vol)
+{
+ ALOGV("%s: (%#x, %d, %lld, %f)", __func__, device, type,
+ (long long)duration_ns, average_vol );
+ if (duration_ns == 0) {
+ return true; // skip duration 0 usage
+ }
+ if (device == 0) {
+ return true; //ignore unknown device
+ }
+
+ bool ret = false;
+ const int32_t input_bit = device & INPUT_DEVICE_BIT;
+ int32_t device_bits = device ^ input_bit;
+
+ while (device_bits != 0) {
+ int32_t tmp_device = device_bits & -device_bits; // get lowest bit
+ device_bits ^= tmp_device; // clear lowest bit
+ tmp_device |= input_bit; // restore input bit
+ ret = saveAsItem_l(tmp_device, duration_ns, type, average_vol);
+
+ ALOGV("%s: device %#x recorded, remaining device_bits = %#x", __func__,
+ tmp_device, device_bits);
+ }
+ return ret;
+}
+
void AudioPowerUsage::checkTrackRecord(
const std::shared_ptr<const mediametrics::Item>& item, bool isTrack)
{
@@ -245,7 +273,7 @@
ALOGV("device = %s => %d", device_strings.c_str(), device);
}
std::lock_guard l(mLock);
- saveAsItem_l(device, deviceTimeNs, type, deviceVolume);
+ saveAsItems_l(device, deviceTimeNs, type, deviceVolume);
}
void AudioPowerUsage::checkMode(const std::shared_ptr<const mediametrics::Item>& item)
@@ -262,7 +290,7 @@
if (durationNs > 0) {
mDeviceVolume = (mDeviceVolume * double(mVolumeTimeNs - mDeviceTimeNs) +
mVoiceVolume * double(endCallNs - mVolumeTimeNs)) / durationNs;
- saveAsItem_l(mPrimaryDevice, durationNs, VOICE_CALL_TYPE, mDeviceVolume);
+ saveAsItems_l(mPrimaryDevice, durationNs, VOICE_CALL_TYPE, mDeviceVolume);
}
} else if (mode == "AUDIO_MODE_IN_CALL") { // entering call mode
mStartCallNs = item->getTimestamp(); // advisory only
@@ -321,7 +349,7 @@
if (durationNs > 0) {
mDeviceVolume = (mDeviceVolume * double(mVolumeTimeNs - mDeviceTimeNs) +
mVoiceVolume * double(endDeviceNs - mVolumeTimeNs)) / durationNs;
- saveAsItem_l(mPrimaryDevice, durationNs, VOICE_CALL_TYPE, mDeviceVolume);
+ saveAsItems_l(mPrimaryDevice, durationNs, VOICE_CALL_TYPE, mDeviceVolume);
}
// reset statistics
mDeviceVolume = 0;
diff --git a/services/mediametrics/AudioPowerUsage.h b/services/mediametrics/AudioPowerUsage.h
index 446ff4f..b705a6a 100644
--- a/services/mediametrics/AudioPowerUsage.h
+++ b/services/mediametrics/AudioPowerUsage.h
@@ -85,6 +85,8 @@
REQUIRES(mLock);
static void sendItem(const std::shared_ptr<const mediametrics::Item>& item);
void collect();
+ bool saveAsItems_l(int32_t device, int64_t duration, int32_t type, double average_vol)
+ REQUIRES(mLock);
AudioAnalytics * const mAudioAnalytics;
const bool mDisabled;
diff --git a/services/mediaresourcemanager/ResourceManagerService.cpp b/services/mediaresourcemanager/ResourceManagerService.cpp
index 3d36f8e..db06a36 100644
--- a/services/mediaresourcemanager/ResourceManagerService.cpp
+++ b/services/mediaresourcemanager/ResourceManagerService.cpp
@@ -575,13 +575,19 @@
}
}
+ *_aidl_return = reclaimInternal(clients);
+ return Status::ok();
+}
+
+bool ResourceManagerService::reclaimInternal(
+ const Vector<std::shared_ptr<IResourceManagerClient>> &clients) {
if (clients.size() == 0) {
- return Status::ok();
+ return false;
}
std::shared_ptr<IResourceManagerClient> failedClient;
for (size_t i = 0; i < clients.size(); ++i) {
- log = String8::format("reclaimResource from client %p", clients[i].get());
+ String8 log = String8::format("reclaimResource from client %p", clients[i].get());
mServiceLog->add(log);
bool success;
Status status = clients[i]->reclaimResource(&success);
@@ -592,8 +598,7 @@
}
if (failedClient == NULL) {
- *_aidl_return = true;
- return Status::ok();
+ return true;
}
{
@@ -618,7 +623,7 @@
}
}
- return Status::ok();
+ return false;
}
Status ResourceManagerService::overridePid(
@@ -681,6 +686,36 @@
return Status::ok();
}
+Status ResourceManagerService::reclaimResourcesFromClientsPendingRemoval(int32_t pid) {
+ String8 log = String8::format("reclaimResourcesFromClientsPendingRemoval(pid %d)", pid);
+ mServiceLog->add(log);
+
+ Vector<std::shared_ptr<IResourceManagerClient>> clients;
+ {
+ Mutex::Autolock lock(mLock);
+ if (!mProcessInfo->isValidPid(pid)) {
+ ALOGE("Rejected reclaimResourcesFromClientsPendingRemoval call with invalid pid.");
+ return Status::fromServiceSpecificError(BAD_VALUE);
+ }
+
+ for (MediaResource::Type type : {MediaResource::Type::kSecureCodec,
+ MediaResource::Type::kNonSecureCodec,
+ MediaResource::Type::kGraphicMemory,
+ MediaResource::Type::kDrmSession}) {
+ std::shared_ptr<IResourceManagerClient> client;
+ if (getBiggestClient_l(pid, type, &client, true /* pendingRemovalOnly */)) {
+ clients.add(client);
+ break;
+ }
+ }
+ }
+
+ if (!clients.empty()) {
+ reclaimInternal(clients);
+ }
+ return Status::ok();
+}
+
bool ResourceManagerService::getPriority_l(int pid, int* priority) {
int newPid = pid;
@@ -804,7 +839,8 @@
bool pendingRemovalOnly) {
ssize_t index = mMap.indexOfKey(pid);
if (index < 0) {
- ALOGE("getBiggestClient_l: can't find resource info for pid %d", pid);
+ ALOGE_IF(!pendingRemovalOnly,
+ "getBiggestClient_l: can't find resource info for pid %d", pid);
return false;
}
@@ -828,7 +864,9 @@
}
if (clientTemp == NULL) {
- ALOGE("getBiggestClient_l: can't find resource type %s for pid %d", asString(type), pid);
+ ALOGE_IF(!pendingRemovalOnly,
+ "getBiggestClient_l: can't find resource type %s for pid %d",
+ asString(type), pid);
return false;
}
diff --git a/services/mediaresourcemanager/ResourceManagerService.h b/services/mediaresourcemanager/ResourceManagerService.h
index 49c247e..7f18ed3 100644
--- a/services/mediaresourcemanager/ResourceManagerService.h
+++ b/services/mediaresourcemanager/ResourceManagerService.h
@@ -127,11 +127,18 @@
Status markClientForPendingRemoval(int32_t pid, int64_t clientId) override;
+ Status reclaimResourcesFromClientsPendingRemoval(int32_t pid) override;
+
Status removeResource(int pid, int64_t clientId, bool checkValid);
private:
friend class ResourceManagerServiceTest;
+ // Reclaims resources from |clients|. Returns true if reclaim succeeded
+ // for all clients.
+ bool reclaimInternal(
+ const Vector<std::shared_ptr<IResourceManagerClient>> &clients);
+
// Gets the list of all the clients who own the specified resource type.
// Returns false if any client belongs to a process with higher priority than the
// calling process. The clients will remain unchanged if returns false.
diff --git a/services/mediaresourcemanager/test/ResourceManagerService_test.cpp b/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
index 702935d..a6ecc09 100644
--- a/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
+++ b/services/mediaresourcemanager/test/ResourceManagerService_test.cpp
@@ -520,6 +520,30 @@
// clean up client 3 which still left
mService->removeClient(kTestPid2, getId(mTestClient3));
}
+
+ {
+ addResource();
+ mService->mSupportsSecureWithNonSecureCodec = true;
+
+ mService->markClientForPendingRemoval(kTestPid2, getId(mTestClient2));
+
+ // client marked for pending removal got reclaimed
+ EXPECT_TRUE(mService->reclaimResourcesFromClientsPendingRemoval(kTestPid2).isOk());
+ verifyClients(false /* c1 */, true /* c2 */, false /* c3 */);
+
+ // No more clients marked for removal
+ EXPECT_TRUE(mService->reclaimResourcesFromClientsPendingRemoval(kTestPid2).isOk());
+ verifyClients(false /* c1 */, false /* c2 */, false /* c3 */);
+
+ mService->markClientForPendingRemoval(kTestPid2, getId(mTestClient3));
+
+ // client marked for pending removal got reclaimed
+ EXPECT_TRUE(mService->reclaimResourcesFromClientsPendingRemoval(kTestPid2).isOk());
+ verifyClients(false /* c1 */, false /* c2 */, true /* c3 */);
+
+ // clean up client 1 which still left
+ mService->removeClient(kTestPid1, getId(mTestClient1));
+ }
}
void testRemoveClient() {